// File: /workspace/github_c_makefile_star2_O1/lengjingzju[P]json/jnum.c
// Function: jnum_itoa
int jnum_itoa(int32_t num, char *buffer)
{
    char *s = buffer;
    uint32_t n = 0;
    int32_t tz = 0;

    if (num == 0) {
        memcpy(s, "0", 2);
        return 1;
    }

    if (num < 0) {
        n = -num;
        *s++ = '-';
    } else {
        n = num;
    }

    if (n < 100000000) {
        s += fill_1_8_digits(s, n, &tz);
    } else {
        uint32_t q = (uint32_t)(((uint64_t)n * 1441151881) >> 57); /* n / 100000000 */
        uint32_t r = n - q * 100000000;

        if (q >= 10) {
            tz = tz_100_lut[q];
            memcpy(s, &ch_100_lut[q<<1], 2);
            s += 2;
        } else {
            tz = 0;
            *s++ = q + '0';
        }

        if (!r) {
            tz += 8;
            memset(s, '0', 8);
            s += 8;
        } else {
            s += fill_t_8_digits(s, r, &tz);
        }
    }

    *s = '\0';
    return (int)(s - buffer);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl $0x0, 0x4(%rsp)
testl %edi, %edi
je 0x7bb1
movl %edi, %esi
js 0x7bc0
movq %rbx, %r14
jmp 0x7bc9
movw $0x30, (%rbx)
movl $0x1, %eax
jmp 0x7d71
negl %esi
leaq 0x1(%rbx), %r14
movb $0x2d, (%rbx)
cmpl $0x5f5e0ff, %esi        # imm = 0x5F5E0FF
ja 0x7be8
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
callq 0x7d79
cltq
addq %r14, %rax
jmp 0x7d6c
movl %esi, %eax
imulq $0x55e63b89, %rax, %rax # imm = 0x55E63B89
shrq $0x39, %rax
imull $0xfa0a1f00, %eax, %ecx # imm = 0xFA0A1F00
addl %esi, %ecx
cmpl $0x3b9aca00, %esi       # imm = 0x3B9ACA00
jb 0x7c29
leaq 0x2f94(%rip), %rdx      # 0xaba0
movzbl (%rax,%rdx), %edx
movl %edx, 0x4(%rsp)
leaq 0x2eb5(%rip), %rdx      # 0xaad0
movzwl (%rdx,%rax,2), %eax
movw %ax, (%r14)
addq $0x2, %r14
jmp 0x7c39
movl $0x0, 0x4(%rsp)
orb $0x30, %al
movb %al, (%r14)
incq %r14
movq %r14, %rax
testl %ecx, %ecx
je 0x7c81
cmpl $0x270f, %ecx           # imm = 0x270F
ja 0x7c98
movl $0x30303030, (%rax)     # imm = 0x30303030
imull $0x147b, %ecx, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $-0x64, %edx, %esi
addl %ecx, %esi
leaq 0x2e6d(%rip), %rcx      # 0xaad0
movzwl (%rcx,%rdx,2), %edi
movw %di, 0x4(%rax)
leal (%rsi,%rsi), %edi
movzwl (%rdi,%rcx), %ecx
movw %cx, 0x6(%rax)
testl %esi, %esi
je 0x7cef
movl %esi, %ecx
jmp 0x7d39
addl $0x8, 0x4(%rsp)
movabsq $0x3030303030303030, %rcx # imm = 0x3030303030303030
movq %rcx, (%rax)
jmp 0x7d68
movl %ecx, %edx
imulq $0x68db8bb, %rdx, %r8   # imm = 0x68DB8BB
shrq $0x28, %r8
imull $0xffffd8f0, %r8d, %edx # imm = 0xFFFFD8F0
addl %ecx, %edx
imull $0x147b, %r8d, %esi     # imm = 0x147B
shrl $0x13, %esi
imull $-0x64, %esi, %edi
addl %r8d, %edi
leaq 0x2e0b(%rip), %rcx      # 0xaad0
movzwl (%rcx,%rsi,2), %r8d
movw %r8w, (%rax)
leal (%rdi,%rdi), %r8d
movzwl (%r8,%rcx), %r8d
movw %r8w, 0x2(%rax)
testl %edi, %edi
je 0x7cfc
movl %edi, %esi
leaq 0x2eb7(%rip), %rdi      # 0xaba0
movzbl (%rsi,%rdi), %esi
jmp 0x7d0a
leaq 0x2eaa(%rip), %rcx      # 0xaba0
movzbl (%rdx,%rcx), %ecx
jmp 0x7d61
leaq 0x2e9d(%rip), %rdi      # 0xaba0
movzbl (%rsi,%rdi), %esi
addl $0x2, %esi
movl %esi, 0x4(%rsp)
testl %edx, %edx
je 0x7d46
imull $0x147b, %edx, %esi     # imm = 0x147B
shrl $0x13, %esi
imull $-0x64, %esi, %edi
addl %edx, %edi
movzwl (%rcx,%rsi,2), %edx
movw %dx, 0x4(%rax)
leal (%rdi,%rdi), %edx
movzwl (%rdx,%rcx), %ecx
movw %cx, 0x6(%rax)
testl %edi, %edi
je 0x7d56
movl %edi, %ecx
leaq 0x2e60(%rip), %rdx      # 0xaba0
movzbl (%rcx,%rdx), %ecx
jmp 0x7d64
movl $0x30303030, 0x4(%rax)  # imm = 0x30303030
addl $0x4, %esi
movl %esi, 0x4(%rsp)
jmp 0x7d68
leaq 0x2e43(%rip), %rcx      # 0xaba0
movzbl (%rsi,%rcx), %ecx
addl $0x2, %ecx
movl %ecx, 0x4(%rsp)
addq $0x8, %rax
movb $0x0, (%rax)
subl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq