// File: /workspace/github_c_makefile_star2_O3/lengjingzju[P]json/jnum.c
// Function: jnum_dtoa
int jnum_dtoa(double num, char *buffer)
{
    diy_fp_t v;
    char *s = buffer;
    union {double d; uint64_t n;} u = {.d = num};
    int32_t signbit = u.n >> (DIY_SIGNIFICAND_SIZE - 1);
    int32_t exponent = (u.n & DP_EXPONENT_MASK) >> DP_SIGNIFICAND_SIZE; /* Exponent */
    uint64_t significand = u.n & DP_SIGNIFICAND_MASK; /* Mantissa */
    int32_t num_digits, vnum_digits;

    if (signbit) {
        *s++ = '-';
    }

    switch (exponent) {
    case DP_EXPONENT_MAX:
        if (significand) {
            memcpy(buffer, "nan", 4);
            return 3;
        } else {
            memcpy(s, "inf", 4);
            return signbit + 3;
        }

    case 0:
        if (significand) {
            /* no-normalized double */
            v.f = significand; /* Non-normalized double doesn't have a extra integer bit for Mantissa */
            v.e = 1 - DP_EXPONENT_OFFSET - DP_SIGNIFICAND_SIZE; /* Fixed Exponent: -1022, divisor of Mantissa: pow(2,52) */
            num_digits = ldouble_convert_n(&v, s + 1, &vnum_digits);
        } else {
            memcpy(s, "0.0", 4);
            return signbit + 3;
        }
        break;

    default:
        /* normalized double */
        v.f = significand + DP_HIDDEN_BIT; /* Normalized double has a extra integer bit for Mantissa */
        v.e = exponent - DP_EXPONENT_OFFSET - DP_SIGNIFICAND_SIZE; /* Exponent offset: -1023, divisor of Mantissa: pow(2,52) */

        if (v.e >= -DP_SIGNIFICAND_SIZE && v.e <= 0 \
            && (v.f & (((uint64_t)1 << -v.e) - 1)) == 0) {
            /* small integer. */
            int32_t tz, n;
            n = fill_1_16_digits(s, v.f >> -v.e, &tz);
            memcpy(s + n, ".0", 3);
            return n + 2 + signbit;
        }
        if (v.e > 0 && v.e <= (63 - DP_SIGNIFICAND_SIZE)) {
            /* big integer. */
            int32_t tz, n;
            n = fill_1_20_digits(s, v.f << v.e, &tz);
            memcpy(s + n, ".0", 3);
            return n + 2 + signbit;
        }
        /* (-1022 - 52) <= e <= (1023 - 52) */
        num_digits = ldouble_convert(&v, s + 1, &vnum_digits);
        break;
    }

    s = ldouble_format(s, num_digits, vnum_digits, num_digits + v.e);
    *s = '\0';
    return (int)(s - buffer);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movabsq $0xfffffffffffff, %rcx  # imm = 0xFFFFFFFFFFFFF
movq %xmm0, %rax
movq %rax, %r12
shrq $0x3f, %r12
movq %rax, %rdx
shrq $0x34, %rdx
andl $0x7ff, %edx            # imm = 0x7FF
movq %rdi, %r14
testq %rax, %rax
jns 0x86a5
leaq 0x1(%rbx), %r14
movb $0x2d, (%rbx)
andq %rcx, %rax
testl %edx, %edx
je 0x86ce
cmpl $0x7ff, %edx            # imm = 0x7FF
jne 0x871b
testq %rax, %rax
je 0x8846
movl $0x6e616e, (%rbx)       # imm = 0x6E616E
movl $0x3, %r12d
jmp 0x8c89
testq %rax, %rax
je 0x884f
shlq $0x6, %rax
orq $0x20, %rax
cmpq $0x4000001, %rax        # imm = 0x4000001
jae 0x885f
movl $0xc5a05278, %ecx       # imm = 0xC5A05278
imulq %rax, %rcx
shrq $0x20, %rcx
imulq $0x51eb851f, %rcx, %rsi # imm = 0x51EB851F
shrq $0x25, %rsi
imulq $-0x64, %rsi, %rdx
addq %rcx, %rdx
cmpq $0x82, %rax
jae 0x888c
jmp 0x889d
leaq (%rcx,%rax), %rsi
incq %rsi
leal -0x433(%rdx), %r15d
leal -0x3ff(%rdx), %eax
cmpl $0x34, %eax
ja 0x875f
movl $0x433, %ecx            # imm = 0x433
subl %edx, %ecx
movq $-0x1, %rax
shlq %cl, %rax
notq %rax
testq %rax, %rsi
jne 0x8798
shrq %cl, %rsi
leaq 0x14(%rsp), %rdx
movq %r14, %rdi
callq 0x8d3f
jmp 0x877d
addl $0xfffffbcc, %edx       # imm = 0xFFFFFBCC
cmpl $0xa, %edx
ja 0x8798
movl %r15d, %ecx
shlq %cl, %rsi
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x7ee6
cltq
movw $0x302e, (%r14,%rax)    # imm = 0x302E
movb $0x0, 0x2(%r14,%rax)
addl %eax, %r12d
addl $0x2, %r12d
jmp 0x8c89
movl %r15d, %eax
andl $0x3, %eax
leaq 0x245f(%rip), %rcx      # 0xac04
movzbl (%rax,%rcx), %edi
movl %edi, %ecx
shlq %cl, %rsi
movl $0xc5a05278, %r8d       # imm = 0xC5A05278
leal -0x1(%rdi), %ecx
movl $0x1, %eax
shlq %cl, %rax
addq %rsi, %rax
subl %edi, %r15d
sarl $0x2, %r15d
leal 0x110(%r15), %ecx
leaq 0x2439(%rip), %rdx      # 0xac10
movq (%rdx,%rcx,8), %r9
leaq 0x344e(%rip), %rdx      # 0xbc30
movsbl (%rcx,%rdx), %r10d
mulq %r9
movq %rdx, %rsi
negb %dil
movl %edi, %ecx
shrq %cl, %r9
subl %r10d, %r15d
movabsq $0x16345785d89ffff, %rax # imm = 0x16345785D89FFFF
cmpq %rax, %rdx
ja 0x88d3
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
movq %rsi, %rax
mulq %rcx
movq %rdx, %rcx
shrq $0x3, %rcx
leal 0x3a5fad7e(%r8), %eax
imull %ecx, %eax
addl %eax, %esi
incl %r15d
cmpl $0x13, %r9d
ja 0x8959
addl $0xa, %esi
cmpl %r9d, %esi
jmp 0x8924
movl $0x666e69, (%r14)       # imm = 0x666E69
jmp 0x8856
movl $0x302e30, (%r14)       # imm = 0x302E30
addl $0x3, %r12d
jmp 0x8c89
movabsq $-0x3a5fad889de41d6c, %rcx # imm = 0xC5A05277621BE294
mulq %rcx
movq %rdx, %rcx
movabsq $0x51eb851eb851eb9, %rdx # imm = 0x51EB851EB851EB9
movq %rcx, %rax
mulq %rdx
movq %rdx, %rsi
shrq %rsi
imulq $-0x64, %rsi, %rdx
addq %rcx, %rdx
cmpq $0x32, %rdx
jae 0x889d
movl $0xfffffebd, %r15d      # imm = 0xFFFFFEBD
xorl %r13d, %r13d
jmp 0x88b3
leaq 0x222c(%rip), %rax      # 0xaad0
movsbq (%rax,%rdx,2), %r13
addq $-0x30, %r13
movl $0xfffffebc, %r15d      # imm = 0xFFFFFEBC
leaq 0x1(%r14), %r12
movl $0x0, 0xc(%rsp)
testq %rsi, %rsi
je 0x8934
leaq 0xc(%rsp), %rdx
movq %r12, %rdi
callq 0x8d3f
jmp 0x8936
movabsq $0xde0b6b3a763ffff, %rax # imm = 0xDE0B6B3A763FFFF
cmpq %rax, %rsi
ja 0x897e
movq %rsi, %rax
shrq $0x2, %rax
movabsq $0x28f5c28f5c28f5c3, %rcx # imm = 0x28F5C28F5C28F5C3
mulq %rcx
movq %rdx, %rcx
shrq $0x2, %rcx
leal 0x3a5fad24(%r8), %eax
imull %ecx, %eax
addl %eax, %esi
addl $0x2, %r15d
cmpl $0xc7, %r9d
ja 0x89bd
addl $0x64, %esi
cmpl %r9d, %esi
setbe %al
andb %cl, %al
movzbl %al, %eax
subq %rax, %rcx
jmp 0x89eb
xorl %eax, %eax
testq %r13, %r13
je 0x894c
addb $0x30, %r13b
movslq %eax, %rcx
incl %eax
movb %r13b, (%r12,%rcx)
xorl %ecx, %ecx
jmp 0x8950
movl 0xc(%rsp), %ecx
movl %eax, %ebp
subl %ecx, %ebp
jmp 0x8bb3
movabsq $0x199999999999999a, %rdx # imm = 0x199999999999999A
movq %rcx, %rax
mulq %rdx
addq %rdx, %rdx
leaq (%rdx,%rdx,4), %rax
movq %rcx, %rdx
subq %rax, %rdx
leal (%rdx,%rdx,4), %eax
leal (%rsi,%rax,2), %eax
jmp 0x89df
movq %rsi, %rax
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
movq %rdx, %rcx
shrq $0x4, %rcx
addl $0x3, %r15d
btl $0x4, %edx
jae 0x89eb
leal 0x3a5fa9a0(%r8), %eax
imull %ecx, %eax
addl %esi, %eax
addl $0x3e8, %eax            # imm = 0x3E8
cmpl %eax, %r9d
adcq $-0x1, %rcx
jmp 0x89eb
movabsq $0x199999999999999a, %rdx # imm = 0x199999999999999A
movq %rcx, %rax
mulq %rdx
addq %rdx, %rdx
leaq (%rdx,%rdx,4), %rax
movq %rcx, %rdx
subq %rax, %rdx
imull $0x64, %edx, %eax
addl %esi, %eax
xorl %esi, %esi
cmpl %r9d, %eax
cmovbeq %rdx, %rsi
subq %rsi, %rcx
movabsq $-0x543388ee7b9e3103, %rdx # imm = 0xABCC77118461CEFD
movq %rcx, %rax
mulq %rdx
shrq $0x1a, %rdx
movl %edx, %eax
addq $0x3469cc88, %r8        # imm = 0x3469CC88
imulq %rdx, %r8
addq %rcx, %r8
imulq $0x68db8bb, %rax, %rax  # imm = 0x68DB8BB
shrq $0x28, %rax
imull $0xffffd8f0, %eax, %esi # imm = 0xFFFFD8F0
addl %edx, %esi
imull $0x147b, %eax, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $-0x64, %edx, %edi
addl %eax, %edi
leaq 0x2099(%rip), %rcx      # 0xaad0
movzwl (%rcx,%rdx,2), %eax
movw %ax, 0x1(%r14)
leal (%rdi,%rdi), %eax
movzwl (%rax,%rcx), %eax
movw %ax, 0x3(%r14)
leaq 0x214d(%rip), %rax      # 0xaba0
testl %edi, %edi
je 0x8a5f
movl %edi, %edx
movzbl (%rdx,%rax), %edx
jmp 0x8a66
movzbl (%rdx,%rax), %edx
addl $0x2, %edx
testl %esi, %esi
je 0x8a99
imull $0x147b, %esi, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $-0x64, %edx, %edi
addl %esi, %edi
movzwl (%rcx,%rdx,2), %esi
movw %si, 0x5(%r14)
leal (%rdi,%rdi), %esi
movzwl (%rsi,%rcx), %esi
movw %si, 0x7(%r14)
testl %edi, %edi
je 0x8aa6
movl %edi, %edx
movzbl (%rdx,%rax), %edx
jmp 0x8aad
movl $0x30303030, 0x5(%r14)  # imm = 0x30303030
addl $0x4, %edx
jmp 0x8aad
movzbl (%rdx,%rax), %edx
addl $0x2, %edx
testl %r8d, %r8d
je 0x8af7
cmpl $0x270f, %r8d           # imm = 0x270F
ja 0x8b0d
movl $0x30303030, 0x9(%r14)  # imm = 0x30303030
imull $0x147b, %r8d, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $-0x64, %edx, %esi
addl %r8d, %esi
movzwl (%rcx,%rdx,2), %edi
movw %di, 0xd(%r14)
leal (%rsi,%rsi), %edi
movzwl (%rdi,%rcx), %ecx
movw %cx, 0xf(%r14)
testl %esi, %esi
je 0x8b93
movl %esi, %ecx
jmp 0x8b8d
movabsq $0x3030303030303030, %rax # imm = 0x3030303030303030
movq %rax, 0x9(%r14)
addl $0x8, %edx
jmp 0x8ba7
movl %r8d, %edx
imulq $0x68db8bb, %rdx, %r9   # imm = 0x68DB8BB
shrq $0x28, %r9
imull $0xffffd8f0, %r9d, %esi # imm = 0xFFFFD8F0
addl %r8d, %esi
imull $0x147b, %r9d, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $-0x64, %edx, %edi
addl %r9d, %edi
movzwl (%rcx,%rdx,2), %r8d
movw %r8w, 0x9(%r14)
leal (%rdi,%rdi), %r8d
movzwl (%r8,%rcx), %r8d
movw %r8w, 0xb(%r14)
testl %edi, %edi
je 0x8b59
movl %edi, %edx
movzbl (%rdx,%rax), %edx
jmp 0x8b60
movzbl (%rdx,%rax), %edx
addl $0x2, %edx
testl %esi, %esi
je 0x8b9c
imull $0x147b, %esi, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $-0x64, %edx, %edi
addl %esi, %edi
movzwl (%rcx,%rdx,2), %esi
movw %si, 0xd(%r14)
leal (%rdi,%rdi), %esi
movzwl (%rsi,%rcx), %ecx
movw %cx, 0xf(%r14)
testl %edi, %edi
je 0x8b93
movl %edi, %ecx
movzbl (%rcx,%rax), %edx
jmp 0x8ba7
movzbl (%rdx,%rax), %edx
addl $0x2, %edx
jmp 0x8ba7
movl $0x30303030, 0xd(%r14)  # imm = 0x30303030
addl $0x4, %edx
movl $0x10, %eax
movl $0x10, %ebp
subl %edx, %ebp
leal (%rax,%r15), %r13d
leal (%rax,%r15), %ecx
decl %ecx
cmpl $0x11, %ecx
jae 0x8c17
leaq 0x1(%r14), %rsi
cmpl %ebp, %r13d
jge 0x8bec
movl %r13d, %r15d
movq %r14, %rdi
movq %r15, %rdx
callq 0x1190
movb $0x2e, (%r14,%r15)
movl %ebp, %eax
leaq (%r14,%rax), %r12
incq %r12
jmp 0x8c81
testl %r15d, %r15d
jle 0x8c63
movslq %eax, %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x1190
addq %r14, %r12
movl %r15d, %edx
movq %r12, %rdi
movl $0x30, %esi
callq 0x10f0
movl %r13d, %r15d
jmp 0x8c71
leal 0x6(%r13), %eax
cmpl $0x6, %eax
ja 0x8c9b
movslq %r13d, %rax
negq %rax
leaq (%r14,%rax), %rdi
addq $0x2, %rdi
leaq 0x1(%r14), %rsi
movslq %ebp, %rdx
callq 0x1190
movl $0x2, %r15d
subl %r13d, %r15d
movq %r14, %rdi
movl $0x30, %esi
movq %r15, %rdx
callq 0x10f0
movb $0x2e, 0x1(%r14)
addl %ebp, %r15d
movslq %r15d, %r12
addq %r14, %r12
jmp 0x8c81
movl %r13d, %r15d
movq %r14, %rdi
movq %r15, %rdx
callq 0x1190
leaq (%r14,%r15), %r12
addq $0x2, %r12
movw $0x302e, -0x2(%r12)     # imm = 0x302E
movb $0x0, (%r12)
subl %ebx, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1(%r14), %rax
movb 0x1(%r14), %cl
movb %cl, (%r14)
cmpl $0x1, %ebp
je 0x8cb4
movb $0x2e, (%rax)
movslq %ebp, %rcx
addq %rcx, %rax
leaq 0x1(%rax), %r12
movb $0x65, (%rax)
leal -0x1(%r13), %edx
testl %r13d, %r13d
setle %sil
addb %sil, %sil
addb $0x2b, %sil
movl %edx, %ecx
negl %ecx
cmovsl %edx, %ecx
movb %sil, 0x1(%rax)
cmpl $0x63, %ecx
ja 0x8cef
cmpl $0x9, %ecx
ja 0x8d21
orb $0x30, %cl
movb %cl, 0x2(%rax)
movl $0x2, %eax
jmp 0x8d37
imull $0x147b, %ecx, %edx     # imm = 0x147B
shrl $0x13, %edx
imull $0x7fffff9c, %edx, %esi # imm = 0x7FFFFF9C
addl %ecx, %esi
addb $0x30, %dl
movb %dl, 0x2(%rax)
addl %esi, %esi
movslq %esi, %rcx
leaq 0x1dbe(%rip), %rdx      # 0xaad0
movzwl (%rcx,%rdx), %ecx
movw %cx, 0x3(%rax)
movl $0x4, %eax
jmp 0x8d37
movl %ecx, %ecx
leaq 0x1da6(%rip), %rdx      # 0xaad0
movzwl (%rdx,%rcx,2), %ecx
movw %cx, 0x2(%rax)
movl $0x3, %eax
addq %rax, %r12
jmp 0x8c81