// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rdi, %rbx
movabsq $0xfffffffffffff, %rcx  # imm = 0xFFFFFFFFFFFFF
movq %xmm0, %rsi
movq %rsi, %r12
shrq $0x3f, %r12
movq %rsi, %rax
shrq $0x34, %rax
andl $0x7ff, %eax            # imm = 0x7FF
movq %rdi, %r14
testq %rsi, %rsi
jns 0x6e6b
leaq 0x1(%rbx), %r14
movb $0x2d, (%rbx)
andq %rcx, %rsi
testl %eax, %eax
je 0x6e91
cmpl $0x7ff, %eax            # imm = 0x7FF
jne 0x6ec1
testq %rsi, %rsi
je 0x6fd9
movl $0x6e616e, (%rbx)       # imm = 0x6E616E
pushq $0x3
popq %r12
jmp 0x730d
testq %rsi, %rsi
je 0x6fe2
shlq $0x6, %rsi
orq $0x20, %rsi
cmpq $0x4000000, %rsi        # imm = 0x4000000
ja 0x6ff2
movl $0xc5a05278, %eax       # imm = 0xC5A05278
imulq %rax, %rsi
shrq $0x20, %rsi
jmp 0x7005
addq %rcx, %rsi
incq %rsi
leal -0x433(%rax), %r15d
leal -0x3ff(%rax), %ecx
cmpl $0x34, %ecx
ja 0x6f00
movl $0x433, %ecx            # imm = 0x433
subl %eax, %ecx
pushq $-0x1
popq %rax
shlq %cl, %rax
notq %rax
testq %rax, %rsi
jne 0x6f38
shrq %cl, %rsi
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
callq 0x73bb
jmp 0x6f1d
addl $0xfffffbcc, %eax       # imm = 0xFFFFFBCC
cmpl $0xa, %eax
ja 0x6f38
movl %r15d, %ecx
shlq %cl, %rsi
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
callq 0x6c45
cltq
movw $0x302e, (%r14,%rax)    # imm = 0x302E
movb $0x0, 0x2(%r14,%rax)
addl %eax, %r12d
addl $0x2, %r12d
jmp 0x730d
movl %r15d, %eax
andl $0x3, %eax
leaq 0x1cbf(%rip), %rcx      # 0x8c04
movzbl (%rax,%rcx), %edi
movl %edi, %ecx
shlq %cl, %rsi
movl $0xc5a05278, %r12d      # imm = 0xC5A05278
leal -0x1(%rdi), %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
addq %rsi, %rax
subl %edi, %r15d
sarl $0x2, %r15d
leal 0x110(%r15), %ecx
leaq 0x1c9b(%rip), %rdx      # 0x8c10
movq (%rdx,%rcx,8), %r8
leaq 0x2cb0(%rip), %rdx      # 0x9c30
movsbl (%rcx,%rdx), %r9d
mulq %r8
movq %rdx, %rsi
negb %dil
movl %edi, %ecx
shrq %cl, %r8
subl %r9d, %r15d
movabsq $0x16345785d89ffff, %rax # imm = 0x16345785D89FFFF
cmpq %rax, %rdx
ja 0x7054
pushq $0xa
popq %rdi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movq %rax, %rcx
leal 0x3a5fad7e(%r12), %eax
imull %ecx, %eax
addl %eax, %esi
incl %r15d
cmpl $0x13, %r8d
ja 0x70f6
addl $0xa, %esi
jmp 0x7096
movl $0x666e69, (%r14)       # imm = 0x666E69
jmp 0x6fe9
movl $0x302e30, (%r14)       # imm = 0x302E30
addl $0x3, %r12d
jmp 0x730d
movabsq $-0x3a5fad889de41d6c, %rcx # imm = 0xC5A05277621BE294
movq %rsi, %rax
mulq %rcx
movq %rdx, %rsi
leaq 0x1(%r14), %r12
xorl %ecx, %ecx
pushq $0x64
popq %rdi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
imulq $-0x64, %rax, %rdx
addq %rsi, %rdx
cmpq $0x64, %rsi
jae 0x7043
leaq 0x1aa6(%rip), %rax      # 0x8ad0
movsbq (%rax,%rdx,2), %r13
addq $-0x30, %r13
andl $0x0, 0x4(%rsp)
movl $0xfffffebc, %r15d      # imm = 0xFFFFFEBC
jmp 0x70d4
cmpq $0x32, %rdx
jae 0x70a9
movl $0xfffffebd, %r15d      # imm = 0xFFFFFEBD
xorl %r13d, %r13d
jmp 0x70bf
movabsq $0xde0b6b3a763ffff, %rax # imm = 0xDE0B6B3A763FFFF
cmpq %rax, %rsi
ja 0x710f
pushq $0x64
popq %rcx
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
leal 0x3a5fad24(%r12), %eax
imull %ecx, %eax
addl %eax, %esi
addl $0x2, %r15d
cmpl $0xc7, %r8d
ja 0x7143
addl $0x64, %esi
cmpl %r8d, %esi
setbe %al
andb %cl, %al
movzbl %al, %eax
subq %rax, %rcx
jmp 0x7160
leaq 0x1a20(%rip), %rcx      # 0x8ad0
movsbq (%rcx,%rdx,2), %r13
addq $-0x30, %r13
movl $0xfffffebc, %r15d      # imm = 0xFFFFFEBC
leaq 0x4(%rsp), %rdx
andl $0x0, (%rdx)
movq %r12, %rdi
movq %rax, %rsi
callq 0x73bb
movl %eax, %ecx
testq %r13, %r13
je 0x70ed
addb $0x30, %r13b
movslq %ecx, %rax
incl %ecx
movb %r13b, (%r12,%rax)
xorl %eax, %eax
jmp 0x7239
movl 0x4(%rsp), %eax
jmp 0x7239
xorl %r9d, %r9d
movq %rcx, %rax
xorl %edx, %edx
divq %rdi
imull $0xa, %edx, %eax
addl %esi, %eax
cmpl %r8d, %eax
cmovaq %r9, %rdx
jmp 0x715d
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
addl $0x3, %r15d
testb $0x1, %cl
je 0x7160
leal 0x3a5fa9a0(%r12), %eax
imull %ecx, %eax
addl %esi, %eax
addl $0x3e8, %eax            # imm = 0x3E8
cmpl %eax, %r8d
adcq $-0x1, %rcx
jmp 0x7160
xorl %edi, %edi
pushq $0xa
popq %r9
movq %rcx, %rax
xorl %edx, %edx
divq %r9
imull $0x64, %edx, %eax
addl %esi, %eax
cmpl %r8d, %eax
cmovaq %rdi, %rdx
subq %rdx, %rcx
movl $0x5f5e100, %esi        # imm = 0x5F5E100
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movl %eax, %edx
addl $0x3469cc88, %r12d      # imm = 0x3469CC88
imull %eax, %r12d
imulq $0x68db8bb, %rdx, %rdi  # imm = 0x68DB8BB
shrq $0x28, %rdi
imull $0xffffd8f0, %edi, %esi # imm = 0xFFFFD8F0
addl %eax, %esi
imull $0x147b, %edi, %eax     # imm = 0x147B
shrl $0x13, %eax
imull $-0x64, %eax, %edx
addl %edi, %edx
leaq 0x192e(%rip), %rdi      # 0x8ad0
movzwl (%rdi,%rax,2), %r8d
movw %r8w, 0x1(%r14)
leal (%rdx,%rdx), %r8d
movzwl (%r8,%rdi), %edi
movw %di, 0x3(%r14)
testl %edx, %edx
je 0x71cd
movl %edx, %eax
leaq 0x19d9(%rip), %rdx      # 0x8ba0
movzbl (%rax,%rdx), %eax
jmp 0x71db
leaq 0x19cc(%rip), %rdx      # 0x8ba0
movzbl (%rax,%rdx), %eax
addl $0x2, %eax
addl %ecx, %r12d
movl %eax, 0x4(%rsp)
leaq 0x5(%r14), %rdi
testl %esi, %esi
je 0x71f6
leaq 0x4(%rsp), %rdx
callq 0x7b55
jmp 0x7203
movl $0x30303030, (%rdi)     # imm = 0x30303030
addl $0x4, %eax
movl %eax, 0x4(%rsp)
leaq 0x9(%r14), %rdi
testl %r12d, %r12d
je 0x7222
leaq 0x4(%rsp), %r13
movl %r12d, %esi
movq %r13, %rdx
callq 0x6b75
movl (%r13), %eax
jmp 0x7236
movabsq $0x3030303030303030, %rax # imm = 0x3030303030303030
movq %rax, (%rdi)
movl 0x4(%rsp), %eax
addl $0x8, %eax
pushq $0x10
popq %rcx
movl %ecx, %ebp
subl %eax, %ebp
leal (%rcx,%r15), %r13d
leal (%rcx,%r15), %eax
decl %eax
cmpl $0x11, %eax
jae 0x729f
leaq 0x1(%r14), %rsi
cmpl %ebp, %r13d
jge 0x7276
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 0x7305
testl %r15d, %r15d
jle 0x72e7
movslq %ecx, %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x1190
addq %r14, %r12
movl %r15d, %edx
pushq $0x30
popq %rsi
movq %r12, %rdi
callq 0x10f0
movl %r13d, %r15d
jmp 0x72f5
leal 0x6(%r13), %eax
cmpl $0x6, %eax
ja 0x731f
movslq %r13d, %rax
negq %rax
leaq (%r14,%rax), %rdi
addq $0x2, %rdi
leaq 0x1(%r14), %rsi
movslq %ebp, %rdx
callq 0x1190
pushq $0x2
popq %r15
subl %r13d, %r15d
pushq $0x30
popq %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x10f0
movb $0x2e, 0x1(%r14)
addl %ebp, %r15d
movslq %r15d, %r12
addq %r14, %r12
jmp 0x7305
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 $0x8, %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 0x7338
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 0x7370
cmpl $0x9, %ecx
ja 0x739f
orb $0x30, %cl
movb %cl, 0x2(%rax)
pushq $0x2
jmp 0x73b2
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 0x173d(%rip), %rdx      # 0x8ad0
movzwl (%rcx,%rdx), %ecx
movw %cx, 0x3(%rax)
pushq $0x4
jmp 0x73b2
movl %ecx, %ecx
leaq 0x1728(%rip), %rdx      # 0x8ad0
movzwl (%rdx,%rcx,2), %ecx
movw %cx, 0x2(%rax)
pushq $0x3
popq %rax
addq %rax, %r12
jmp 0x7305