// File: /workspace/github_c_makefile_star2_O0/lengjingzju[P]json/jnum.c
// Function: ldouble_rconvert
static double ldouble_rconvert(uint64_t f, int32_t e)
{
    static uint64_t pow10_lut[20] = {
        1llu, 10llu, 100llu, 1000llu, 10000llu, 100000llu, 1000000llu, 10000000llu, 100000000llu,
        1000000000llu, 10000000000llu, 100000000000llu, 1000000000000llu, 10000000000000llu,
        100000000000000llu, 1000000000000000llu, 10000000000000000llu, 100000000000000000llu,
        1000000000000000000llu, 10000000000000000000llu
    };

    if (e > -20) {
        if (e < 0) {
            return (double)f / pow10_lut[-e];
        } else if (e < 20) {
            return (double)f * pow10_lut[e];
        }
    }

    double d = 0;
    uint64_t *v = (uint64_t *)&d;

    if (e <= POW2_LUT_MIN_IDX) {
        *v = 0;
        return d;
    }
    if (e >= POW2_LUT_MAX_IDX) {
        *v = DP_EXPONENT_MASK;
        return d;
    }

    const int32_t index = e - POW2_LUT_MIN_IDX;
    const uint64_t pow2 = pow2_mul_lut[index];
    int32_t exponent = pow2_exp_lut[index];
    uint64_t significand = 0;

    int32_t bitn = u64_pz_get(f);
    f <<= bitn;
    exponent -= bitn;
    significand = u128_mul(f, pow2).hi;
    exponent += 64;
    bitn = 64 - u64_pz_get(significand) - (DP_SIGNIFICAND_SIZE + 1);
    exponent += bitn;

    if (significand & ((uint64_t)1 << (bitn - 1))) {
        significand >>= bitn;
        significand += 1;
        if (significand == ((uint64_t)1 << (DP_SIGNIFICAND_SIZE + 1))) {
            significand >>= 1;
            exponent += 1;
        }
    } else {
        significand >>= bitn;
    }

    exponent += DP_EXPONENT_OFFSET + DP_SIGNIFICAND_SIZE;
    if (exponent > 1) {
        if (exponent < DP_EXPONENT_MAX) {
            *v = (significand & DP_SIGNIFICAND_MASK) | ((uint64_t)exponent << DP_SIGNIFICAND_SIZE);
        } else {
            *v = DP_EXPONENT_MASK;
        }
    } else {
        if (exponent > -DP_SIGNIFICAND_SIZE) {
            exponent -= 1;
            *v = (significand >> -exponent) + !!(significand & ((uint64_t)1 << (-exponent - 1)));
        } else {
            *v = 0;
        }
    }
    return d;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movl %esi, 0x54(%rsp)
cmpl $-0x14, 0x54(%rsp)
jle 0xe7b4
cmpl $0x0, 0x54(%rsp)
jge 0xe74e
movq 0x58(%rsp), %xmm0
movaps 0x2864(%rip), %xmm3     # 0x10f60
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x2868(%rip), %xmm2     # 0x10f70
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movl 0x54(%rsp), %eax
negl %eax
movslq %eax, %rcx
leaq 0x79e9(%rip), %rax      # 0x16110
movq (%rax,%rcx,8), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0xea33
cmpl $0x14, 0x54(%rsp)
jge 0xe7b0
movq 0x58(%rsp), %xmm0
movaps 0x27fe(%rip), %xmm3     # 0x10f60
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x2802(%rip), %xmm2     # 0x10f70
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movslq 0x54(%rsp), %rcx
leaq 0x7987(%rip), %rax      # 0x16110
movq (%rax,%rcx,8), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0xea33
jmp 0xe7b2
jmp 0xe7b4
xorps %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpl $0xfffffea8, 0x54(%rsp) # imm = 0xFFFFFEA8
jg 0xe7ee
movq 0x40(%rsp), %rax
movq $0x0, (%rax)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0xea33
cmpl $0x135, 0x54(%rsp)      # imm = 0x135
jl 0xe81b
movq 0x40(%rsp), %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
movq %rcx, (%rax)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0xea33
movl 0x54(%rsp), %eax
subl $0xfffffea8, %eax       # imm = 0xFFFFFEA8
movl %eax, 0x3c(%rsp)
movslq 0x3c(%rsp), %rcx
leaq 0x3bcc(%rip), %rax      # 0x12400
movq (%rax,%rcx,8), %rax
movq %rax, 0x30(%rsp)
movslq 0x3c(%rsp), %rcx
leaq 0x5027(%rip), %rax      # 0x13870
movswl (%rax,%rcx,2), %eax
movl %eax, 0x2c(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x58(%rsp), %rdi
callq 0xf2b0
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %ecx
movq 0x58(%rsp), %rax
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, 0x58(%rsp)
movl 0x1c(%rsp), %ecx
movl 0x2c(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x2c(%rsp)
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xefb0
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
movl 0x2c(%rsp), %eax
addl $0x40, %eax
movl %eax, 0x2c(%rsp)
movq 0x20(%rsp), %rdi
callq 0xf2b0
movl %eax, %ecx
movl $0x40, %eax
subl %ecx, %eax
subl $0x35, %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
addl 0x2c(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0xe94b
movl 0x1c(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movabsq $0x20000000000000, %rax # imm = 0x20000000000000
cmpq %rax, 0x20(%rsp)
jne 0xe949
movq 0x20(%rsp), %rax
shrq %rax
movq %rax, 0x20(%rsp)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0xe95e
movl 0x1c(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, 0x20(%rsp)
movl 0x2c(%rsp), %eax
addl $0x433, %eax            # imm = 0x433
movl %eax, 0x2c(%rsp)
cmpl $0x1, 0x2c(%rsp)
jle 0xe9b5
cmpl $0x7ff, 0x2c(%rsp)      # imm = 0x7FF
jge 0xe9a1
movabsq $0xfffffffffffff, %rcx  # imm = 0xFFFFFFFFFFFFF
andq 0x20(%rsp), %rcx
movslq 0x2c(%rsp), %rax
shlq $0x34, %rax
orq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
jmp 0xe9b3
movq 0x40(%rsp), %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
movq %rcx, (%rax)
jmp 0xea27
cmpl $-0x34, 0x2c(%rsp)
jle 0xea19
movl 0x2c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x2c(%rsp)
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
subl 0x2c(%rsp), %ecx
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, (%rsp)
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
subl 0x2c(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq (%rsp), %rcx
andq %rdx, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
addq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
jmp 0xea25
movq 0x40(%rsp), %rax
movq $0x0, (%rax)
jmp 0xea27
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x60(%rsp), %xmm0
addq $0x68, %rsp
retq
nop