// File: /workspace/github_cpp_makefile_star2_O3/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, -0x30(%rbp)
movq %rcx, %rax
xorl %ecx, %ecx
subl 0x8(%rsi), %ecx
movl $0x1, %r10d
shlq %cl, %r10
movq (%rsi), %r9
movq %r9, %r12
shrq %cl, %r12
movq (%rdi), %rdi
leaq -0x1(%r10), %rbx
movl $0x1, %r15d
cmpl $0xa, %r12d
jb 0xcbd9
movl $0x2, %r15d
cmpl $0x64, %r12d
jb 0xcbd9
movl $0x3, %r15d
cmpl $0x3e8, %r12d           # imm = 0x3E8
jb 0xcbd9
movl $0x4, %r15d
cmpl $0x2710, %r12d          # imm = 0x2710
jb 0xcbd9
movl $0x5, %r15d
cmpl $0x186a0, %r12d         # imm = 0x186A0
jb 0xcbd9
movl $0x6, %r15d
cmpl $0xf4240, %r12d         # imm = 0xF4240
jb 0xcbd9
movl $0x7, %r15d
cmpl $0x989680, %r12d        # imm = 0x989680
jb 0xcbd9
cmpl $0x5f5e100, %r12d       # imm = 0x5F5E100
movl $0x9, %r15d
sbbl $0x0, %r15d
movq %r9, %rsi
movq %rdi, -0x40(%rbp)
subq %rdi, %rsi
movq %rbx, %rdi
movq %r9, -0x38(%rbp)
andq %r9, %rdi
movl $0x0, (%r8)
leaq 0x248d(%rip), %r13      # 0xf088
testl %r15d, %r15d
jle 0xcdc4
decl %r15d
cmpl $0x8, %r15d
ja 0xcd19
movslq (%r13,%r15,4), %r9
addq %r13, %r9
jmpq *%r9
xorl %r14d, %r14d
jmp 0xcd03
movl %r12d, %r14d
movl %r12d, %r12d
movl $0xd1b71759, %r9d       # imm = 0xD1B71759
imulq %r9, %r12
shrq $0x2d, %r12
imull $0x2710, %r12d, %r9d    # imm = 0x2710
jmp 0xcd00
movl %r12d, %r9d
movl %r12d, %r14d
imulq $0x51eb851f, %r9, %r12  # imm = 0x51EB851F
shrq $0x25, %r12
imull $0x64, %r12d, %r9d
jmp 0xcd00
movl %r12d, %r9d
movl %r12d, %r14d
imulq $0x10624dd3, %r9, %r12  # imm = 0x10624DD3
shrq $0x26, %r12
imull $0x3e8, %r12d, %r9d     # imm = 0x3E8
jmp 0xcd00
movl %r12d, %r9d
movl %r12d, %r14d
imulq $0x6b5fca6b, %r9, %r12  # imm = 0x6B5FCA6B
shrq $0x36, %r12
imull $0x989680, %r12d, %r9d  # imm = 0x989680
jmp 0xcd00
movl %r12d, %r14d
movl %r12d, %r12d
movl $0xcccccccd, %r9d       # imm = 0xCCCCCCCD
imulq %r9, %r12
shrq $0x23, %r12
leal (%r12,%r12), %r9d
leal (%r9,%r9,4), %r9d
jmp 0xcd00
movl %r12d, %r14d
shrl $0x5, %r12d
imulq $0xa7c5ac5, %r12, %r12  # imm = 0xA7C5AC5
shrq $0x27, %r12
imull $0x186a0, %r12d, %r9d   # imm = 0x186A0
jmp 0xcd00
movl %r12d, %r9d
movl %r12d, %r14d
imulq $0x431bde83, %r9, %r12  # imm = 0x431BDE83
shrq $0x32, %r12
imull $0xf4240, %r12d, %r9d   # imm = 0xF4240
jmp 0xcd00
movl %r12d, %r9d
movl %r12d, %r14d
imulq $0x55e63b89, %r9, %r12  # imm = 0x55E63B89
shrq $0x39, %r12
imull $0x5f5e100, %r12d, %r9d # imm = 0x5F5E100
subl %r9d, %r14d
movl (%r8), %r9d
testl %r12d, %r12d
je 0xcd14
addb $0x30, %r12b
movl %r12d, %r11d
jmp 0xcd27
movl %r14d, %r12d
jmp 0xcd1f
movl (%r8), %r9d
movl %r12d, %r14d
movb $0x30, %r11b
testl %r9d, %r9d
je 0xcd38
leal 0x1(%r9), %r12d
movl %r12d, (%r8)
movslq %r9d, %r9
movb %r11b, (%rax,%r9)
movl %r14d, %r12d
movl %r12d, %r14d
shlq %cl, %r14
addq %rdi, %r14
movq %rdx, %r9
subq %r14, %r9
jb 0xcbfb
movq -0x30(%rbp), %rdi
addl %r15d, (%rdi)
movl %r15d, %edi
movq 0x9222(%rip), %r10      # 0x15f80
movl (%r10,%rdi,4), %edi
shlq %cl, %rdi
cmpq %rsi, %r14
movq -0x40(%rbp), %r10
jae 0xce85
cmpq %rdi, %r9
jb 0xce85
movslq (%r8), %rcx
movq %rsi, %r8
subq %r14, %r8
addq %rdi, %r14
subq %r14, %rdx
subq -0x38(%rbp), %r10
cmpq %rsi, %r14
jb 0xcda0
leaq (%r10,%r14), %r9
cmpq %r9, %r8
jbe 0xce85
decb -0x1(%rax,%rcx)
subq %rdi, %rdx
setb %r9b
cmpq %rsi, %r14
jae 0xce85
subq %rdi, %r8
addq %rdi, %r14
testb %r9b, %r9b
je 0xcd8e
jmp 0xce85
xorl %r9d, %r9d
addq %rdi, %rdi
leaq (%rdi,%rdi,4), %rdi
movq %rdi, %r11
shrq %cl, %r11
testb %r11b, %r11b
sete %r15b
movl (%r8), %r14d
testl %r14d, %r14d
sete %r12b
testb %r12b, %r15b
jne 0xcdfb
movslq %r14d, %r15
addb $0x30, %r11b
incl %r14d
movl %r14d, (%r8)
movb %r11b, (%rax,%r15)
movq %rdx, %r11
addq %rdx, %r11
leaq (%r11,%r11,4), %rdx
andq %rbx, %rdi
incl %r9d
movq %rdx, %r14
subq %rdi, %r14
jbe 0xcdc7
movq -0x30(%rbp), %rcx
subl %r9d, (%rcx)
movl $0x1, %ecx
subl %r9d, %ecx
cmpl $-0x7, %ecx
jl 0xce36
movl %r9d, %ecx
movq 0x914f(%rip), %rdx      # 0x15f80
movl (%rdx,%rcx,4), %ecx
jmp 0xce38
xorl %ecx, %ecx
cmpq %r10, %r14
jb 0xce85
imulq %rsi, %rcx
movq %rcx, %rdx
subq %rdi, %rdx
jbe 0xce85
movslq (%r8), %rsi
leaq (%r11,%r11,4), %r8
addq %r10, %rdi
subq %rdi, %r8
movq %rcx, %r9
negq %r9
cmpq %rcx, %rdi
jb 0xce6a
leaq (%r9,%rdi), %r11
cmpq %r11, %rdx
jbe 0xce85
decb -0x1(%rax,%rsi)
subq %r10, %r8
setb %r11b
cmpq %rcx, %rdi
jae 0xce85
subq %r10, %rdx
addq %r10, %rdi
testb %r11b, %r11b
je 0xce5c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq