// File: /workspace/github_c_makefile_star2_O0/lengjingzju[P]json/jnum.c
// Function: ldouble_convert
static inline int32_t ldouble_convert(diy_fp_t *v, char *buffer, int32_t *vnum_digits)
{
    const uint8_t s_lut[4] = {8, 9, 6, 7};
    int32_t s = s_lut[v->e & 0x3];
    v->f = (v->f << s) + ((uint64_t)1 << (s - 1));
    v->e -= s;
    v->e >>= 2;

    uint32_t index = v->e - POW10_LUT_MIN_IDX;
    uint64_t pow10 = pow10_mul_lut[index];

    v->e -= pow10_exp_lut[index];
    v->f = u128_mul(pow10, v->f).hi;
    uint32_t delta = (uint32_t)(pow10 >> (64 - s));
    uint32_t remainder = 0;
    uint64_t orig = v->f;

    if (orig < 100000000000000000llu) {
        v->f = orig / 10;
        remainder = (uint32_t)(orig - v->f * 10);
        v->e += 1;
        if (delta < 20) {
            if ((v->f & 1) && (10 + remainder <= delta)) {
                v->f -= 1;
            }
        } else {
            uint16_t t = v->f % 10;
            if (t * 10 + remainder <= delta) {
                v->f -= t;
            }
        }
    } else if (orig < 1000000000000000000llu) {
        v->f = orig / 100;
        remainder = (uint32_t)(orig - v->f * 100);
        v->e += 2;
        if (delta < 200) {
            if ((v->f & 1) && (100 + remainder <= delta)) {
                v->f -= 1;
            }
        } else {
            uint16_t t = v->f % 10;
            if (t * 100 + remainder <= delta) {
                v->f -= t;
            }
        }
    } else {
        v->f = orig / 1000;
        remainder = (uint32_t)(orig - v->f * 1000);
        v->e += 3;
        if ((v->f & 1) && (1000 + remainder <= delta)) {
            v->f -= 1;
        }
    }

    int32_t num_digits, trailing_zeros;
    num_digits = fill_significand(buffer, v->f, &trailing_zeros);
    *vnum_digits = num_digits - trailing_zeros;
    return num_digits;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movl 0x3c47(%rip), %eax      # 0x111c0
movl %eax, 0x4c(%rsp)
movq 0x60(%rsp), %rax
movl 0x8(%rax), %eax
andl $0x3, %eax
cltq
movzbl 0x4c(%rsp,%rax), %eax
movl %eax, 0x48(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %rax
movl 0x48(%rsp), %ecx
shlq %cl, %rax
movq %rax, (%rsp)
movl 0x48(%rsp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq (%rsp), %rcx
addq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movl 0x48(%rsp), %edx
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
sarl $0x2, %ecx
movl %ecx, 0x8(%rax)
movq 0x60(%rsp), %rax
movl 0x8(%rax), %eax
subl $0xfffffef0, %eax       # imm = 0xFFFFFEF0
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
movl %eax, %ecx
leaq 0x3bcb(%rip), %rax      # 0x111d0
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movl 0x44(%rsp), %eax
movl %eax, %ecx
leaq 0x4bd5(%rip), %rax      # 0x121f0
movsbl (%rax,%rcx), %edx
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movq 0x38(%rsp), %rdi
movq 0x60(%rsp), %rax
movq (%rax), %rsi
callq 0xefb0
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x28(%rsp), %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rax
movl $0x40, %ecx
subl 0x48(%rsp), %ecx
movl %ecx, %ecx
shrq %cl, %rax
movl %eax, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movabsq $0x16345785d8a0000, %rax # imm = 0x16345785D8A0000
cmpq %rax, 0x18(%rsp)
jae 0xd752
movq 0x18(%rsp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq 0x60(%rsp), %rcx
imulq $0xa, (%rcx), %rcx
subq %rcx, %rax
movl %eax, 0x20(%rsp)
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
cmpl $0x14, 0x24(%rsp)
jae 0xd70a
movq 0x60(%rsp), %rax
movq (%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0xd708
movl 0x20(%rsp), %eax
addl $0xa, %eax
cmpl 0x24(%rsp), %eax
ja 0xd708
movq 0x60(%rsp), %rax
movq (%rax), %rcx
subq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xd74d
movq 0x60(%rsp), %rax
movq (%rax), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movw %dx, %ax
movw %ax, 0x16(%rsp)
movzwl 0x16(%rsp), %eax
imull $0xa, %eax, %eax
addl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
ja 0xd74b
movzwl 0x16(%rsp), %eax
movl %eax, %edx
movq 0x60(%rsp), %rax
movq (%rax), %rcx
subq %rdx, %rcx
movq %rcx, (%rax)
jmp 0xd74d
jmp 0xd897
movabsq $0xde0b6b3a7640000, %rax # imm = 0xDE0B6B3A7640000
cmpq %rax, 0x18(%rsp)
jae 0xd823
movq 0x18(%rsp), %rax
movl $0x64, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq 0x60(%rsp), %rcx
imulq $0x64, (%rcx), %rcx
subq %rcx, %rax
movl %eax, 0x20(%rsp)
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x8(%rax)
cmpl $0xc8, 0x24(%rsp)
jae 0xd7de
movq 0x60(%rsp), %rax
movq (%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0xd7dc
movl 0x20(%rsp), %eax
addl $0x64, %eax
cmpl 0x24(%rsp), %eax
ja 0xd7dc
movq 0x60(%rsp), %rax
movq (%rax), %rcx
subq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xd821
movq 0x60(%rsp), %rax
movq (%rax), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movw %dx, %ax
movw %ax, 0x14(%rsp)
movzwl 0x14(%rsp), %eax
imull $0x64, %eax, %eax
addl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
ja 0xd81f
movzwl 0x14(%rsp), %eax
movl %eax, %edx
movq 0x60(%rsp), %rax
movq (%rax), %rcx
subq %rdx, %rcx
movq %rcx, (%rax)
jmp 0xd821
jmp 0xd895
movq 0x18(%rsp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq 0x60(%rsp), %rcx
imulq $0x3e8, (%rcx), %rcx    # imm = 0x3E8
subq %rcx, %rax
movl %eax, 0x20(%rsp)
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x3, %ecx
movl %ecx, 0x8(%rax)
movq 0x60(%rsp), %rax
movq (%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0xd893
movl 0x20(%rsp), %eax
addl $0x3e8, %eax            # imm = 0x3E8
cmpl 0x24(%rsp), %eax
ja 0xd893
movq 0x60(%rsp), %rax
movq (%rax), %rcx
subq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xd895
jmp 0xd897
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rax
movq (%rax), %rsi
leaq 0xc(%rsp), %rdx
callq 0xeff0
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %ecx
subl 0xc(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, (%rax)
movl 0x10(%rsp), %eax
addq $0x68, %rsp
retq
nopw (%rax,%rax)