// File: /workspace/github_c_makefile_star2_O0/lengjingzju[P]json/dragonbox.c
// Function: dragonbox_format
static inline char* dragonbox_format(char *buffer, uint64_t digits, int32_t decimal_exponent)
{
    int32_t num_digits, vnum_digits, trailing_zeros, decimal_point;

    num_digits = fill_significand(buffer, digits, &trailing_zeros);
    vnum_digits = num_digits - trailing_zeros;
    decimal_point = num_digits + decimal_exponent;

    switch (decimal_point) {
    case -6: case -5: case -4: case -3: case -2: case -1: case 0:
         /* 0.[000]digits */
        memmove(buffer + 2 - decimal_point, buffer, vnum_digits);
        memset(buffer, '0', 2 - decimal_point);
        buffer[1] = '.';
        buffer += 2 - decimal_point + vnum_digits;
        break;

    case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9:
    case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
        if (decimal_point < vnum_digits) {
            /* dig.its */
            memmove(buffer + 1 + decimal_point, buffer + decimal_point, vnum_digits - decimal_point);
            buffer[decimal_point] = '.';
            buffer += vnum_digits + 1;
        } else {
            /* digits[000] */
            if (decimal_point > num_digits)
                memset(buffer + num_digits, '0', decimal_point - num_digits);
            buffer += decimal_point;
            memcpy(buffer, ".0", 2);
            buffer += 2;
        }
        break;

    default:
        if (vnum_digits == 1) {
            /* dE+123 */
            ++buffer;
        } else {
            /* d.igitsE+123 */
            memmove(buffer + 2, buffer + 1, vnum_digits - 1);
            buffer[1] = '.';
            buffer += vnum_digits + 1;
        }
        *buffer++ = 'e';
        buffer += fill_exponent(decimal_point - 1, buffer);
        break;
    }

    *buffer = '\0';
    return buffer;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x5c00
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movl 0x8(%rsp), %ecx
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
movl 0x14(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl %eax, (%rsp)
addl $0x6, %eax
subl $0x7, %eax
jb 0x56d6
jmp 0x56c7
movl (%rsp), %eax
decl %eax
subl $0x11, %eax
jb 0x5741
jmp 0x5802
movq 0x20(%rsp), %rdi
addq $0x2, %rdi
movslq 0x4(%rsp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq 0x20(%rsp), %rsi
movslq 0xc(%rsp), %rdx
callq 0x1090
movq 0x20(%rsp), %rdi
movl $0x2, %eax
subl 0x4(%rsp), %eax
movslq %eax, %rdx
movl $0x30, %esi
callq 0x1070
movq 0x20(%rsp), %rax
movb $0x2e, 0x1(%rax)
movl $0x2, %ecx
subl 0x4(%rsp), %ecx
addl 0xc(%rsp), %ecx
movq 0x20(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
jmp 0x5891
movl 0x4(%rsp), %eax
cmpl 0xc(%rsp), %eax
jge 0x57a0
movq 0x20(%rsp), %rdi
addq $0x1, %rdi
movslq 0x4(%rsp), %rax
addq %rax, %rdi
movq 0x20(%rsp), %rsi
movslq 0x4(%rsp), %rax
addq %rax, %rsi
movl 0xc(%rsp), %eax
subl 0x4(%rsp), %eax
movslq %eax, %rdx
callq 0x1090
movq 0x20(%rsp), %rax
movslq 0x4(%rsp), %rcx
movb $0x2e, (%rax,%rcx)
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movq 0x20(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
jmp 0x57fd
movl 0x4(%rsp), %eax
cmpl 0x10(%rsp), %eax
jle 0x57cc
movq 0x20(%rsp), %rdi
movslq 0x10(%rsp), %rax
addq %rax, %rdi
movl 0x4(%rsp), %eax
subl 0x10(%rsp), %eax
movslq %eax, %rdx
movl $0x30, %esi
callq 0x1070
movl 0x4(%rsp), %ecx
movq 0x20(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movw 0x199d(%rip), %cx       # 0x7189
movw %cx, (%rax)
movq 0x20(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x20(%rsp)
jmp 0x5891
cmpl $0x1, 0xc(%rsp)
jne 0x5819
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x585a
movq 0x20(%rsp), %rdi
addq $0x2, %rdi
movq 0x20(%rsp), %rsi
addq $0x1, %rsi
movl 0xc(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rdx
callq 0x1090
movq 0x20(%rsp), %rax
movb $0x2e, 0x1(%rax)
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movq 0x20(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rsp)
movb $0x65, (%rax)
movl 0x4(%rsp), %edi
subl $0x1, %edi
movq 0x20(%rsp), %rsi
callq 0x5d20
movl %eax, %ecx
movq 0x20(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movb $0x0, (%rax)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)