// File: /workspace/github_c_makefile_star2_O2/lengjingzju[P]json/grisu2.c
// Function: grisu2_dtoa
int grisu2_dtoa(double num, char *buffer)
{
    int length, K, pre = 0;

    if (num == 0) {
        memcpy(buffer, "0.0", 4);
        return 3;
    }

    if (num < 0) {
        *buffer++ = '-';
        num = -num;
        pre = 1;
    }

    grisu2(num, buffer, &length, &K);
    return (pre + prettify_string(buffer, length, K));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2645
jp 0x2645
movl $0x302e30, (%rbx)       # imm = 0x302E30
pushq $0x3
popq %r12
jmp 0x2aad
ucomisd %xmm0, %xmm1
pushq $0x1
popq %r12
jbe 0x2663
movb $0x2d, (%rbx)
incq %rbx
xorpd 0x19d3(%rip), %xmm0     # 0x4030
movl %r12d, (%rsp)
jmp 0x266a
movl $0x0, (%rsp)
movq %xmm0, %rax
movabsq $0x10000000000000, %rdi # imm = 0x10000000000000
leaq -0x1(%rdi), %rcx
andq %rax, %rcx
movq %rax, %rdx
shrq $0x34, %rdx
andl $0x7ff, %edx            # imm = 0x7FF
movq %rcx, %rax
btsq $0x34, %rax
leal -0x433(%rdx), %esi
testl %edx, %edx
cmoveq %rcx, %rax
movl $0xfffffbce, %edx       # imm = 0xFFFFFBCE
cmovnel %esi, %edx
bsrq %rax, %r8
leaq 0x1(,%rax,2), %rsi
leal -0x1(%rdx), %r9d
bsrq %rsi, %rcx
xorq $0x3f, %rcx
addl $-0x2, %edx
cmpq %rdi, %rax
leaq -0x1(%rax,%rax), %r10
movabsq $0x3fffffffffffff, %rdi # imm = 0x3FFFFFFFFFFFFF
cmovneq %r10, %rdi
cmovnel %r9d, %edx
shlq %cl, %rsi
subl %ecx, %r9d
notl %r8d
movl %r8d, %ecx
shlq %cl, %rax
subl %r9d, %edx
movl %edx, %ecx
shlq %cl, %rdi
movslq %r9d, %rcx
leaq 0x4b51(%rip), %rdx      # 0x7250
movzbl 0x471(%rcx,%rdx), %edx
leal (,%rdx,8), %r15d
leaq 0x47ca(%rip), %r8       # 0x6ee0
movq (%r15,%r8), %r14
leaq 0x4a7f(%rip), %r8       # 0x71a0
movswl (%r8,%rdx,2), %ebp
mulq %r14
movq %rdx, %r11
movq %rax, %r9
sarq $0x3f, %r9
movq %rsi, %rax
mulq %r14
movq %rdx, %r8
movq %rax, %r10
shrq $0x3f, %r10
addl %ebp, %ecx
pushq $-0x40
popq %rsi
subl %ecx, %esi
movq %rdi, %rax
mulq %r14
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%r8,%r10), %rdx
addq %r8, %r10
decq %r10
negl %ecx
pushq $0x1
popq %r8
shlq %cl, %r8
movq %r10, %rdi
shrq %cl, %rdi
notq %rax
subq %r11, %r9
leaq -0x1(%r8), %r13
cmpl $0x186a0, %edi          # imm = 0x186A0
movq %r15, 0x10(%rsp)
jb 0x2793
cmpl $0xf4240, %edi          # imm = 0xF4240
jae 0x279f
pushq $0x6
jmp 0x27d2
cmpl $0x270f, %edi           # imm = 0x270F
jbe 0x27ab
pushq $0x5
jmp 0x27d2
cmpl $0x989680, %edi         # imm = 0x989680
jae 0x27b7
pushq $0x7
jmp 0x27d2
cmpl $0x3e7, %edi            # imm = 0x3E7
jbe 0x27c7
pushq $0x4
jmp 0x27d2
cmpl $0x5f5e100, %edi        # imm = 0x5F5E100
jae 0x2abf
pushq $0x8
jmp 0x27d2
cmpl $0x63, %edi
jbe 0x2ad2
pushq $0x3
popq %r12
leaq (%rax,%rdx), %r11
decq %r11
leaq (%r9,%rdx), %rax
decq %rax
movq %rax, 0x8(%rsp)
andq %r13, %r10
movl %r12d, %eax
shlq $0x2, %rax
leaq 0x5298(%rip), %rbp      # 0x7a90
subq %rax, %rbp
xorl %r14d, %r14d
leaq 0x46af(%rip), %r15      # 0x6eb4
movl $0x3b9aca00, %r9d       # imm = 0x3B9ACA00
movl %r12d, 0x4(%rsp)
movl %r12d, %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
xorl %edx, %edx
jmp 0x28d5
movl %edi, %eax
xorl %edx, %edx
divl %r9d
imull $0xc4653600, %eax, %edx # imm = 0xC4653600
jmp 0x28d1
movl %edi, %eax
shrl $0x2, %eax
leaq 0x527f(%rip), %rcx      # 0x7ac0
movzbl (%rax,%rcx), %eax
imull $-0x64, %eax, %edx
jmp 0x28d1
movl %edi, %eax
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
divl %ecx
imull $0xfffffc18, %eax, %edx # imm = 0xFFFFFC18
jmp 0x28d1
movl %edi, %eax
xorl %edx, %edx
movl $0x989680, %ecx         # imm = 0x989680
divl %ecx
imull $0xff676980, %eax, %edx # imm = 0xFF676980
jmp 0x28d1
movl %edi, %eax
xorl %edx, %edx
movl $0x186a0, %ecx          # imm = 0x186A0
divl %ecx
imull $0xfffe7960, %eax, %edx # imm = 0xFFFE7960
jmp 0x28d1
movl %edi, %eax
shrl %eax
leaq 0x532f(%rip), %rcx      # 0x7bc0
movzbl (%rax,%rcx), %eax
imull $-0xa, %eax, %edx
jmp 0x28d1
movl %edi, %eax
xorl %edx, %edx
movl $0xf4240, %ecx          # imm = 0xF4240
divl %ecx
imull $0xfff0bdc0, %eax, %edx # imm = 0xFFF0BDC0
jmp 0x28d1
movl %edi, %eax
xorl %edx, %edx
movl $0x5f5e100, %ecx        # imm = 0x5F5E100
divl %ecx
imull $0xfa0a1f00, %eax, %edx # imm = 0xFA0A1F00
jmp 0x28d1
movl %edi, %eax
xorl %edx, %edx
movl $0x2710, %ecx           # imm = 0x2710
divl %ecx
imull $0xffffd8f0, %eax, %edx # imm = 0xFFFFD8F0
addl %edi, %edx
movl %eax, %edi
addb $0x30, %dil
movb %dil, (%rbx,%r14)
incq %r14
decl %r12d
movl %edx, %eax
movl %esi, %ecx
shlq %cl, %rax
addq %r10, %rax
addq $0x4, %rbp
movl %edx, %edi
cmpq %r11, %rax
ja 0x2810
movl %r12d, %ecx
leaq 0x518a(%rip), %rdx      # 0x7a90
movl (%rdx,%rcx,4), %r8d
movl %esi, %ecx
shlq %cl, %r8
movq %rbx, %rdi
movl %r14d, %esi
movq %r11, %rdx
movq %rax, %rcx
movq 0x8(%rsp), %r9
callq 0x2ade
movq 0x10(%rsp), %r15
subl %r15d, %r12d
leal (%r12,%r14), %r15d
addl $0x15c, %r15d           # imm = 0x15C
cmpl $0x15, %r15d
jg 0x2a4a
movl %r12d, %eax
addl $0x15c, %eax            # imm = 0x15C
js 0x2975
movslq %r14d, %rdi
addq %rbx, %rdi
movl %eax, %edx
pushq $0x30
popq %rsi
callq 0x1080
movslq %r15d, %r12
movw $0x302e, (%rbx,%r12)    # imm = 0x302E
movb $0x0, 0x2(%rbx,%r12)
addq $0x2, %r12
jmp 0x2aa9
testl %r15d, %r15d
jle 0x2a0b
movl %r15d, %eax
leaq (%rbx,%rax), %rsi
leaq (%rbx,%rax), %r15
incq %r15
movl $0xfffffea4, %eax       # imm = 0xFFFFFEA4
subl %r12d, %eax
movslq %eax, %rdx
movq %r15, %rdi
callq 0x10a0
movb $0x2e, -0x1(%r15)
movslq %r14d, %r12
movb $0x0, 0x1(%rbx,%r12)
incq %r12
jmp 0x2aa9
movq 0x10(%rsp), %r15
imulq $0xa, %r10, %r10
movq %r10, %rax
movl %esi, %ecx
shrq %cl, %rax
imulq $0xa, %r11, %r11
addb $0x30, %al
movb %al, (%rbx,%r14)
incq %r14
andq %r13, %r10
addq $0x4, %rbp
cmpq %r11, %r10
jae 0x29ba
movl (%rbp), %eax
movq 0x8(%rsp), %r9
imulq %rax, %r9
movq %rbx, %rdi
movl %r14d, %esi
movq %r11, %rdx
movq %r10, %rcx
callq 0x2ade
movl 0x4(%rsp), %eax
subl %r14d, %eax
movl %eax, %r12d
jmp 0x292a
cmpl $-0x5, %r15d
jl 0x2a4a
pushq $0x2
popq %r12
subl %r15d, %r12d
leaq (%rbx,%r12), %rdi
movslq %r14d, %rdx
movq %rbx, %rsi
callq 0x10a0
movw $0x2e30, (%rbx)         # imm = 0x2E30
leaq 0x2(%rbx), %rdi
negl %r15d
pushq $0x30
popq %rsi
movq %r15, %rdx
callq 0x1080
addl %r14d, %r12d
movslq %r12d, %rax
movb $0x0, (%rbx,%rax)
jmp 0x2aa9
cmpl $0x1, %r14d
jne 0x2a6f
movb $0x65, 0x1(%rbx)
decl %r15d
addq $0x2, %rbx
movl %r15d, %edi
movq %rbx, %rsi
callq 0x2b15
movl %eax, %r12d
addl $0x2, %r12d
jmp 0x2aa9
leaq 0x2(%rbx), %rdi
leaq 0x1(%rbx), %rsi
leal -0x1(%r14), %eax
movslq %eax, %rdx
callq 0x10a0
movb $0x2e, 0x1(%rbx)
movslq %r14d, %rax
leaq (%rbx,%rax), %rsi
addq $0x2, %rsi
movb $0x65, -0x1(%rsi)
decl %r15d
movl %r15d, %edi
callq 0x2b15
leal (%r14,%rax), %r12d
addl $0x2, %r12d
addl (%rsp), %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3b9aca00, %edi       # imm = 0x3B9ACA00
pushq $0xa
popq %r12
sbbl $0x0, %r12d
jmp 0x27d4
cmpl $0xa, %edi
sbbl $-0x1, %r12d
jmp 0x27d4