// File: /workspace/github_cpp_makefile_star2_O1/cqbqdd11519[P]DockerClient/rapidjson/include/rapidjson/internal/dtoa.h
// Function: rapidjson::internal::DigitGen(rapidjson::internal::DiyFp const&, rapidjson::internal::DiyFp const&, unsigned long, char*, int*, int*)
inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {
    static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
    const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
    const DiyFp wp_w = Mp - W;
    uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);
    uint64_t p2 = Mp.f & (one.f - 1);
    int kappa = CountDecimalDigit32(p1); // kappa in [0, 9]
    *len = 0;

    while (kappa > 0) {
        uint32_t d = 0;
        switch (kappa) {
            case  9: d = p1 /  100000000; p1 %=  100000000; break;
            case  8: d = p1 /   10000000; p1 %=   10000000; break;
            case  7: d = p1 /    1000000; p1 %=    1000000; break;
            case  6: d = p1 /     100000; p1 %=     100000; break;
            case  5: d = p1 /      10000; p1 %=      10000; break;
            case  4: d = p1 /       1000; p1 %=       1000; break;
            case  3: d = p1 /        100; p1 %=        100; break;
            case  2: d = p1 /         10; p1 %=         10; break;
            case  1: d = p1;              p1 =           0; break;
            default:;
        }
        if (d || *len)
            buffer[(*len)++] = static_cast<char>('0' + static_cast<char>(d));
        kappa--;
        uint64_t tmp = (static_cast<uint64_t>(p1) << -one.e) + p2;
        if (tmp <= delta) {
            *K += kappa;
            GrisuRound(buffer, *len, delta, tmp, static_cast<uint64_t>(kPow10[kappa]) << -one.e, wp_w.f);
            return;
        }
    }

    // kappa = 0
    for (;;) {
        p2 *= 10;
        delta *= 10;
        char d = static_cast<char>(p2 >> -one.e);
        if (d || *len)
            buffer[(*len)++] = static_cast<char>('0' + d);
        p2 &= one.f - 1;
        kappa--;
        if (p2 < delta) {
            *K += kappa;
            int index = -kappa;
            GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * (index < 9 ? kPow10[index] : 0));
            return;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, -0x38(%rbp)
movq %rcx, %rax
xorl %ecx, %ecx
subl 0x8(%rsi), %ecx
movl $0x1, %r9d
shlq %cl, %r9
movq %rdx, %r10
movq (%rsi), %rdx
movq %rdx, %r14
shrq %cl, %r14
movq (%rdi), %r11
movq %r9, -0x30(%rbp)
leaq -0x1(%r9), %rbx
movl $0x1, %r12d
cmpl $0xa, %r14d
jb 0xc762
movl $0x2, %r12d
cmpl $0x64, %r14d
jb 0xc762
movl $0x3, %r12d
cmpl $0x3e8, %r14d           # imm = 0x3E8
jb 0xc762
movl $0x4, %r12d
cmpl $0x2710, %r14d          # imm = 0x2710
jb 0xc762
movl $0x5, %r12d
cmpl $0x186a0, %r14d         # imm = 0x186A0
jb 0xc762
movl $0x6, %r12d
cmpl $0xf4240, %r14d         # imm = 0xF4240
jb 0xc762
movl $0x7, %r12d
cmpl $0x989680, %r14d        # imm = 0x989680
jb 0xc762
cmpl $0x5f5e100, %r14d       # imm = 0x5F5E100
movl $0x9, %r12d
sbbl $0x0, %r12d
movq %rdx, %rsi
subq %r11, %rsi
movq %rbx, %rdi
movq %rdx, -0x40(%rbp)
andq %rdx, %rdi
movl $0x0, (%r8)
leaq 0x3908(%rip), %r13      # 0x10088
testl %r12d, %r12d
jle 0xc8a7
decl %r12d
cmpl $0x8, %r12d
ja 0xc8a2
movslq (%r13,%r12,4), %rdx
addq %r13, %rdx
jmpq *%rdx
movl %r14d, %r15d
xorl %r14d, %r14d
jmp 0xc86e
movl %r14d, %r15d
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %r15
shrq $0x2d, %r15
imull $0x2710, %r15d, %edx    # imm = 0x2710
jmp 0xc86b
movl %r14d, %edx
imulq $0x51eb851f, %rdx, %r15 # imm = 0x51EB851F
shrq $0x25, %r15
imull $0x64, %r15d, %edx
jmp 0xc86b
movl %r14d, %edx
imulq $0x10624dd3, %rdx, %r15 # imm = 0x10624DD3
shrq $0x26, %r15
imull $0x3e8, %r15d, %edx     # imm = 0x3E8
jmp 0xc86b
movl %r14d, %edx
imulq $0x6b5fca6b, %rdx, %r15 # imm = 0x6B5FCA6B
shrq $0x36, %r15
imull $0x989680, %r15d, %edx  # imm = 0x989680
jmp 0xc86b
movl %r14d, %r15d
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rdx, %r15
shrq $0x23, %r15
leal (%r15,%r15), %edx
leal (%rdx,%rdx,4), %edx
jmp 0xc86b
movl %r14d, %edx
shrl $0x5, %edx
imulq $0xa7c5ac5, %rdx, %r15  # imm = 0xA7C5AC5
shrq $0x27, %r15
imull $0x186a0, %r15d, %edx   # imm = 0x186A0
jmp 0xc86b
movl %r14d, %edx
imulq $0x431bde83, %rdx, %r15 # imm = 0x431BDE83
shrq $0x32, %r15
imull $0xf4240, %r15d, %edx   # imm = 0xF4240
jmp 0xc86b
movl %r14d, %edx
imulq $0x55e63b89, %rdx, %r15 # imm = 0x55E63B89
shrq $0x39, %r15
imull $0x5f5e100, %r15d, %edx # imm = 0x5F5E100
subl %edx, %r14d
testl %r15d, %r15d
jne 0xc879
cmpl $0x0, (%r8)
je 0xc88b
addb $0x30, %r15b
movslq (%r8), %rdx
leal 0x1(%rdx), %r9d
movl %r9d, (%r8)
movb %r15b, (%rax,%rdx)
movl %r14d, %r15d
shlq %cl, %r15
addq %rdi, %r15
movq %r10, %rdx
subq %r15, %rdx
jb 0xc780
jmp 0xc90d
xorl %r15d, %r15d
jmp 0xc86e
xorl %r9d, %r9d
addq %rdi, %rdi
leaq (%rdi,%rdi,4), %rdi
movq %rdi, %rdx
shrq %cl, %rdx
testb %dl, %dl
jne 0xc8c1
cmpl $0x0, (%r8)
je 0xc8d2
addb $0x30, %dl
movslq (%r8), %r11
leal 0x1(%r11), %r14d
movl %r14d, (%r8)
movb %dl, (%rax,%r11)
movq %r10, %r11
addq %r10, %r11
leaq (%r11,%r11,4), %r10
andq %rbx, %rdi
incl %r9d
movq %r10, %r14
subq %rdi, %r14
jbe 0xc8aa
movq -0x38(%rbp), %rcx
subl %r9d, (%rcx)
movl $0x1, %ecx
subl %r9d, %ecx
cmpl $-0x7, %ecx
jl 0xc973
movl %r9d, %ecx
movq 0xb678(%rip), %rdx      # 0x17f80
movl (%rdx,%rcx,4), %ecx
jmp 0xc975
movq -0x38(%rbp), %rdi
addl %r12d, (%rdi)
movl %r12d, %edi
movq 0xb662(%rip), %r9       # 0x17f80
movl (%r9,%rdi,4), %edi
shlq %cl, %rdi
cmpq %rsi, %r15
jae 0xc9c6
cmpq %rdi, %rdx
jb 0xc9c6
movslq (%r8), %rcx
movq %rsi, %r8
subq %r15, %r8
addq %rdi, %r15
subq %r15, %r10
subq -0x40(%rbp), %r11
cmpq %rsi, %r15
jb 0xc958
leaq (%r11,%r15), %rdx
cmpq %rdx, %r8
jbe 0xc9c6
decb -0x1(%rax,%rcx)
subq %rdi, %r10
setb %dl
cmpq %rsi, %r15
jae 0xc9c6
subq %rdi, %r8
addq %rdi, %r15
testb %dl, %dl
je 0xc94a
jmp 0xc9c6
xorl %ecx, %ecx
movq -0x30(%rbp), %rbx
cmpq %rbx, %r14
jb 0xc9c6
imulq %rsi, %rcx
movq %rcx, %rdx
subq %rdi, %rdx
jbe 0xc9c6
movslq (%r8), %rsi
leaq (%r11,%r11,4), %r8
addq %rbx, %rdi
subq %rdi, %r8
movq %rcx, %r9
negq %r9
cmpq %rcx, %rdi
jb 0xc9ab
leaq (%r9,%rdi), %r10
cmpq %r10, %rdx
jbe 0xc9c6
decb -0x1(%rax,%rsi)
subq %rbx, %r8
setb %r10b
cmpq %rcx, %rdi
jae 0xc9c6
subq %rbx, %rdx
addq %rbx, %rdi
testb %r10b, %r10b
je 0xc99d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq