// File: /workspace/github_c_makefile_star2_O0/lengjingzju[P]json/dragonbox.c
// Function: dragonbox_convert
static inline void dragonbox_convert(diy_fp_t *v)
{
#define KAPPA_VALUE     2
#define SMALL_DIVISOR   100
#define BIG_DIVISOR     1000

    uint64_t f = v->f;
    int32_t e = v->e;
    int32_t kappa_plus = 0;
    const bool is_even = !(f & (uint64_t)1);

    const int32_t minus_k = floor_log10_pow2(e) - KAPPA_VALUE;
    const int32_t minus_1 = e + floor_log2_pow10(-minus_k); /* The range of e is [6, 9] */
    const u64x2_t pow10 = compute_pow10_double(-minus_k);
    const uint32_t delta = compute_delta(pow10, minus_1); /* The range of delta is [100, 999] */
    const uint64_t two_fc = (f << 1);
    const uint64_t two_fl = two_fc - 1;
    const uint64_t two_fr = two_fc + 1; /* 54 bits */
    const uint64_t zi = mul128_shift(two_fr << minus_1, pow10); // 2 mulx

    uint64_t q = zi / BIG_DIVISOR;
    uint32_t r = (uint32_t)zi - BIG_DIVISOR * (uint32_t)q; /* The range of r is [0, 999] */

    if (r < delta) {
        if (r != 0 || is_even || !is_integral_end_point(two_fr, e, minus_k)) {
            kappa_plus = 1;
            goto end;
        }

        /* q can't be 0 */
        --q;
        r = BIG_DIVISOR;
    } else if (r == delta) {
        if ((is_even && is_integral_end_point(two_fl, e, minus_k)) || compute_parity(two_fl, pow10, minus_1)) {
            kappa_plus = 1;
            goto end;
        }
    }

    {
        q = (q << 1) + (q << 3);

        const uint32_t dist = r - (delta >> 1) + (SMALL_DIVISOR >> 1);
        const uint32_t dist_q = dist / 100;
        q += dist_q;

        if (dist == dist_q * 100)
        {
            if (compute_parity(two_fc, pow10, minus_1) != ((dist & 1) != 0)) {
                --q;
            } else if ((q & (uint64_t)1) && is_integral_mid_point(two_fc, e, minus_k)) {
                --q;
            }
        }
    }

end:
    v->f = q;
    v->e = minus_k + KAPPA_VALUE + kappa_plus;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x64(%rsp)
movl $0x0, 0x60(%rsp)
movq 0x68(%rsp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, 0x5f(%rsp)
movl 0x64(%rsp), %edi
callq 0x58b0
subl $0x2, %eax
movl %eax, 0x58(%rsp)
movl 0x64(%rsp), %eax
movl %eax, (%rsp)
xorl %edi, %edi
subl 0x58(%rsp), %edi
callq 0x58c0
movl %eax, %ecx
movl (%rsp), %eax
addl %ecx, %eax
movl %eax, 0x54(%rsp)
xorl %edi, %edi
subl 0x58(%rsp), %edi
callq 0x58d0
movq %rax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
movl 0x54(%rsp), %edx
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x5900
movl %eax, 0x3c(%rsp)
movq 0x68(%rsp), %rax
shlq %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movl 0x54(%rsp), %eax
movl %eax, %ecx
shlq %cl, %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x5930
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jae 0x5373
cmpl $0x0, 0xc(%rsp)
jne 0x534e
testb $0x1, 0x5f(%rsp)
jne 0x534e
movq 0x20(%rsp), %rdi
movl 0x64(%rsp), %esi
movl 0x58(%rsp), %edx
callq 0x59b0
testb $0x1, %al
jne 0x535b
movl $0x1, 0x60(%rsp)
jmp 0x54a0
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
movl $0x3e8, 0xc(%rsp)       # imm = 0x3E8
jmp 0x53c9
movl 0xc(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jne 0x53c7
testb $0x1, 0x5f(%rsp)
je 0x539a
movq 0x28(%rsp), %rdi
movl 0x64(%rsp), %esi
movl 0x58(%rsp), %edx
callq 0x59b0
testb $0x1, %al
jne 0x53b8
movq 0x28(%rsp), %rdi
movl 0x54(%rsp), %ecx
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x5a10
testb $0x1, %al
jne 0x53b8
jmp 0x53c5
movl $0x1, 0x60(%rsp)
jmp 0x54a0
jmp 0x53c7
jmp 0x53c9
movq 0x10(%rsp), %rax
shlq %rax
movq 0x10(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movl 0xc(%rsp), %eax
movl 0x3c(%rsp), %ecx
shrl %ecx
subl %ecx, %eax
addl $0x32, %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0x8(%rsp), %eax
imull $0x64, 0x4(%rsp), %ecx
cmpl %ecx, %eax
jne 0x549e
movq 0x30(%rsp), %rdi
movl 0x54(%rsp), %ecx
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x5a10
andb $0x1, %al
movzbl %al, %eax
movl 0x8(%rsp), %ecx
andl $0x1, %ecx
cmpl $0x0, %ecx
setne %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x5465
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x549c
movq 0x10(%rsp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x549a
movq 0x30(%rsp), %rdi
movl 0x64(%rsp), %esi
movl 0x58(%rsp), %edx
callq 0x5a90
testb $0x1, %al
jne 0x548c
jmp 0x549a
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x549c
jmp 0x549e
jmp 0x54a0
movq 0x10(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
movl 0x58(%rsp), %ecx
addl $0x2, %ecx
addl 0x60(%rsp), %ecx
movq 0x70(%rsp), %rax
movl %ecx, 0x8(%rax)
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)
nop