78 lines
1.2 KiB
ArmAsm
78 lines
1.2 KiB
ArmAsm
|
.file "convert.c"
|
||
|
.text
|
||
|
.p2align 4,,15
|
||
|
.globl itoa
|
||
|
.type itoa, @function
|
||
|
itoa:
|
||
|
.LFB2:
|
||
|
.cfi_startproc
|
||
|
movl %edx, %r9d
|
||
|
leal -2(%rdx), %edx
|
||
|
movl %edi, %eax
|
||
|
cmpl $34, %edx
|
||
|
ja .L2
|
||
|
testl %edi, %edi
|
||
|
js .L11
|
||
|
jne .L7
|
||
|
leaq 1(%rsi), %r8
|
||
|
movb $48, (%rsi)
|
||
|
.L5:
|
||
|
movb $0, (%r8)
|
||
|
movq %rsi, %rdi
|
||
|
movabsq $reverse, %rax
|
||
|
jmp *%rax
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L11:
|
||
|
negl %eax
|
||
|
movl $1, %edi
|
||
|
.L4:
|
||
|
movq %rsi, %r8
|
||
|
movabsq $digits, %r10
|
||
|
jmp .L6
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L8:
|
||
|
movq %rcx, %r8
|
||
|
.L6:
|
||
|
cltd
|
||
|
leaq 1(%r8), %rcx
|
||
|
idivl %r9d
|
||
|
movslq %edx, %rdx
|
||
|
testl %eax, %eax
|
||
|
movzbl (%r10,%rdx), %edx
|
||
|
movb %dl, -1(%rcx)
|
||
|
jne .L8
|
||
|
testl %edi, %edi
|
||
|
je .L9
|
||
|
addq $2, %r8
|
||
|
movb $45, (%rcx)
|
||
|
jmp .L5
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L7:
|
||
|
xorl %edi, %edi
|
||
|
jmp .L4
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L2:
|
||
|
xorl %eax, %eax
|
||
|
ret
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L9:
|
||
|
movq %rcx, %r8
|
||
|
jmp .L5
|
||
|
.cfi_endproc
|
||
|
.LFE2:
|
||
|
.size itoa, .-itoa
|
||
|
.section .rodata
|
||
|
.align 32
|
||
|
.type digits, @object
|
||
|
.size digits, 36
|
||
|
digits:
|
||
|
.byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43
|
||
|
.byte 0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50
|
||
|
.byte 0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a
|
||
|
.ident "GCC: (GNU) 7.3.0"
|