193 lines
2.7 KiB
ArmAsm
193 lines
2.7 KiB
ArmAsm
|
.file "string.c"
|
||
|
.text
|
||
|
.p2align 4,,15
|
||
|
.globl strlen
|
||
|
.type strlen, @function
|
||
|
strlen:
|
||
|
.LFB2:
|
||
|
.cfi_startproc
|
||
|
movq %rdi, %rax
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L2:
|
||
|
addq $1, %rax
|
||
|
cmpb $0, -1(%rax)
|
||
|
jne .L2
|
||
|
subq %rdi, %rax
|
||
|
subq $1, %rax
|
||
|
ret
|
||
|
.cfi_endproc
|
||
|
.LFE2:
|
||
|
.size strlen, .-strlen
|
||
|
.p2align 4,,15
|
||
|
.globl strcpy
|
||
|
.type strcpy, @function
|
||
|
strcpy:
|
||
|
.LFB3:
|
||
|
.cfi_startproc
|
||
|
movq %rdi, %rax
|
||
|
movq %rdi, %rdx
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L6:
|
||
|
addq $1, %rsi
|
||
|
movzbl -1(%rsi), %ecx
|
||
|
addq $1, %rdx
|
||
|
testb %cl, %cl
|
||
|
movb %cl, -1(%rdx)
|
||
|
jne .L6
|
||
|
rep ret
|
||
|
.cfi_endproc
|
||
|
.LFE3:
|
||
|
.size strcpy, .-strcpy
|
||
|
.p2align 4,,15
|
||
|
.globl strncpy
|
||
|
.type strncpy, @function
|
||
|
strncpy:
|
||
|
.LFB4:
|
||
|
.cfi_startproc
|
||
|
testq %rdx, %rdx
|
||
|
movq %rdi, %rax
|
||
|
je .L9
|
||
|
movzbl (%rsi), %r8d
|
||
|
xorl %ecx, %ecx
|
||
|
testb %r8b, %r8b
|
||
|
jne .L11
|
||
|
jmp .L12
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L20:
|
||
|
movzbl (%rsi,%rcx), %r8d
|
||
|
testb %r8b, %r8b
|
||
|
je .L12
|
||
|
.L11:
|
||
|
movb %r8b, (%rax,%rcx)
|
||
|
addq $1, %rcx
|
||
|
cmpq %rcx, %rdx
|
||
|
jne .L20
|
||
|
.L9:
|
||
|
rep ret
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L12:
|
||
|
addq $1, %rcx
|
||
|
cmpq %rcx, %rdx
|
||
|
movb $0, -1(%rax,%rcx)
|
||
|
jbe .L9
|
||
|
addq $1, %rcx
|
||
|
cmpq %rcx, %rdx
|
||
|
movb $0, -1(%rax,%rcx)
|
||
|
ja .L12
|
||
|
jmp .L9
|
||
|
.cfi_endproc
|
||
|
.LFE4:
|
||
|
.size strncpy, .-strncpy
|
||
|
.p2align 4,,15
|
||
|
.globl xstrcnpy
|
||
|
.type xstrcnpy, @function
|
||
|
xstrcnpy:
|
||
|
.LFB5:
|
||
|
.cfi_startproc
|
||
|
testq %rdx, %rdx
|
||
|
je .L22
|
||
|
movzbl (%rsi), %ecx
|
||
|
xorl %eax, %eax
|
||
|
testb %cl, %cl
|
||
|
jne .L24
|
||
|
jmp .L25
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L33:
|
||
|
movzbl (%rsi,%rax), %ecx
|
||
|
testb %cl, %cl
|
||
|
je .L25
|
||
|
.L24:
|
||
|
movb %cl, (%rdi,%rax)
|
||
|
addq $1, %rax
|
||
|
cmpq %rax, %rdx
|
||
|
jne .L33
|
||
|
.L22:
|
||
|
movl $1, %eax
|
||
|
ret
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L25:
|
||
|
addq $1, %rax
|
||
|
cmpq %rax, %rdx
|
||
|
movb $0, -1(%rdi,%rax)
|
||
|
jbe .L22
|
||
|
addq $1, %rax
|
||
|
cmpq %rax, %rdx
|
||
|
movb $0, -1(%rdi,%rax)
|
||
|
ja .L25
|
||
|
jmp .L22
|
||
|
.cfi_endproc
|
||
|
.LFE5:
|
||
|
.size xstrcnpy, .-xstrcnpy
|
||
|
.p2align 4,,15
|
||
|
.globl strrev
|
||
|
.type strrev, @function
|
||
|
strrev:
|
||
|
.LFB6:
|
||
|
.cfi_startproc
|
||
|
movq %rdi, %rax
|
||
|
movq %rsi, %rdx
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L35:
|
||
|
addq $1, %rdx
|
||
|
cmpb $0, -1(%rdx)
|
||
|
jne .L35
|
||
|
subq %rsi, %rdx
|
||
|
movb $0, -1(%rax,%rdx)
|
||
|
leaq -2(%rsi,%rdx), %rcx
|
||
|
movq %rax, %rdx
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L36:
|
||
|
movzbl (%rcx), %esi
|
||
|
addq $1, %rdx
|
||
|
subq $1, %rcx
|
||
|
testb %sil, %sil
|
||
|
movb %sil, -1(%rdx)
|
||
|
jne .L36
|
||
|
rep ret
|
||
|
.cfi_endproc
|
||
|
.LFE6:
|
||
|
.size strrev, .-strrev
|
||
|
.p2align 4,,15
|
||
|
.globl reverse
|
||
|
.type reverse, @function
|
||
|
reverse:
|
||
|
.LFB7:
|
||
|
.cfi_startproc
|
||
|
movq %rdi, %rax
|
||
|
movq %rdi, %rdx
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L40:
|
||
|
addq $1, %rdx
|
||
|
cmpb $0, -1(%rdx)
|
||
|
jne .L40
|
||
|
subq $2, %rdx
|
||
|
cmpq %rdx, %rax
|
||
|
jnb .L41
|
||
|
movq %rax, %rcx
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L42:
|
||
|
movzbl (%rdx), %esi
|
||
|
movzbl (%rcx), %r8d
|
||
|
subq $1, %rdx
|
||
|
addq $1, %rcx
|
||
|
cmpq %rcx, %rdx
|
||
|
movb %r8b, 1(%rdx)
|
||
|
movb %sil, -1(%rcx)
|
||
|
ja .L42
|
||
|
.L41:
|
||
|
rep ret
|
||
|
.cfi_endproc
|
||
|
.LFE7:
|
||
|
.size reverse, .-reverse
|
||
|
.ident "GCC: (GNU) 7.3.0"
|