// File: /workspace/github_cpp_makefile_star2_O3/cqbqdd11519[P]DockerClient/rapidjson/include/rapidjson/internal/dtoa.h
// Function: rapidjson::internal::Prettify(char*, int, int, int)
inline char* Prettify(char* buffer, int length, int k, int maxDecimalPlaces) {
    const int kk = length + k;  // 10^(kk-1) <= v < 10^kk

    if (0 <= k && kk <= 21) {
        // 1234e7 -> 12340000000
        for (int i = length; i < kk; i++)
            buffer[i] = '0';
        buffer[kk] = '.';
        buffer[kk + 1] = '0';
        return &buffer[kk + 2];
    }
    else if (0 < kk && kk <= 21) {
        // 1234e-2 -> 12.34
        std::memmove(&buffer[kk + 1], &buffer[kk], static_cast<size_t>(length - kk));
        buffer[kk] = '.';
        if (0 > k + maxDecimalPlaces) {
            // When maxDecimalPlaces = 2, 1.2345 -> 1.23, 1.102 -> 1.1
            // Remove extra trailing zeros (at least one) after truncation.
            for (int i = kk + maxDecimalPlaces; i > kk + 1; i--)
                if (buffer[i] != '0')
                    return &buffer[i + 1];
            return &buffer[kk + 2]; // Reserve one zero
        }
        else
            return &buffer[length + 1];
    }
    else if (-6 < kk && kk <= 0) {
        // 1234e-6 -> 0.001234
        const int offset = 2 - kk;
        std::memmove(&buffer[offset], &buffer[0], static_cast<size_t>(length));
        buffer[0] = '0';
        buffer[1] = '.';
        for (int i = 2; i < offset; i++)
            buffer[i] = '0';
        if (length - kk > maxDecimalPlaces) {
            // When maxDecimalPlaces = 2, 0.123 -> 0.12, 0.102 -> 0.1
            // Remove extra trailing zeros (at least one) after truncation.
            for (int i = maxDecimalPlaces + 1; i > 2; i--)
                if (buffer[i] != '0')
                    return &buffer[i + 1];
            return &buffer[3]; // Reserve one zero
        }
        else
            return &buffer[length + offset];
    }
    else if (kk < -maxDecimalPlaces) {
        // Truncate to zero
        buffer[0] = '0';
        buffer[1] = '.';
        buffer[2] = '0';
        return &buffer[3];
    }
    else if (length == 1) {
        // 1e30
        buffer[1] = 'e';
        return WriteExponent(kk - 1, &buffer[2]);
    }
    else {
        // 1234e30 -> 1.234e33
        std::memmove(&buffer[2], &buffer[1], static_cast<size_t>(length - 1));
        buffer[1] = '.';
        buffer[length + 1] = 'e';
        return WriteExponent(kk - 1, &buffer[0 + length + 2]);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movl %edx, %r12d
movl %esi, %r15d
movq %rdi, %rsi
leal (%r12,%r15), %r13d
testl %edx, %edx
sets %al
cmpl $0x16, %r13d
setge %cl
orb %al, %cl
jne 0xc7cc
testl %r12d, %r12d
je 0xc7b7
movslq %r15d, %rdi
addq %rsi, %rdi
leal 0x1(%r15), %eax
cmpl %eax, %r13d
cmovgl %r13d, %eax
notl %r15d
addl %eax, %r15d
incq %r15
movq %rsi, %rbx
movl $0x30, %esi
movq %r15, %rdx
callq 0x7230
movq %rbx, %rsi
movslq %r13d, %rax
addq %rsi, %rax
addq $0x2, %rax
movw $0x302e, -0x2(%rax)     # imm = 0x302E
jmp 0xca31
leal -0x1(%r13), %ebx
cmpl $0x14, %ebx
ja 0xc81d
movl %r13d, %ebx
leaq (%rsi,%rbx), %rdi
incq %rdi
movq %rdi, -0x38(%rbp)
addq %rsi, %rbx
movl %r12d, %eax
negl %eax
movslq %eax, %rdx
movq %rsi, -0x30(%rbp)
movq %rbx, %rsi
callq 0x7740
movq -0x38(%rbp), %rax
movb $0x2e, -0x1(%rax)
addl %r14d, %r12d
js 0xc8b9
movslq %r15d, %rax
movq -0x30(%rbp), %rcx
addq %rcx, %rax
incq %rax
jmp 0xca31
leal 0x5(%r13), %eax
cmpl $0x5, %eax
ja 0xc89c
movl $0x2, %ebx
subl %r13d, %ebx
leaq (%rsi,%rbx), %rdi
movslq %r15d, %rdx
movq %rsi, -0x30(%rbp)
movq -0x30(%rbp), %rsi
callq 0x7740
movq -0x30(%rbp), %rcx
movw $0x2e30, (%rcx)         # imm = 0x2E30
testl %r13d, %r13d
jns 0xc870
leaq 0x2(%rcx), %rdi
cmpl $0x4, %ebx
movl $0x3, %edx
cmovael %ebx, %edx
addl $-0x2, %edx
movl $0x30, %esi
callq 0x7230
movq -0x30(%rbp), %rcx
negl %r12d
cmpl %r14d, %r12d
jle 0xc8f7
cmpl $0x2, %r14d
jl 0xc896
addl $0x2, %r14d
decl %r14d
cmpb $0x30, (%rcx,%r14)
jne 0xc950
cmpl $0x4, %r14d
jge 0xc882
addq $0x3, %rcx
jmp 0xc900
negl %r14d
cmpl %r14d, %r13d
jge 0xc908
movw $0x2e30, (%rsi)         # imm = 0x2E30
movb $0x30, 0x2(%rsi)
addq $0x3, %rsi
movq %rsi, %rax
jmp 0xca31
cmpl $0x2, %r14d
movq -0x30(%rbp), %rsi
jl 0xc8eb
leal 0x1(%r13), %ecx
addl %r13d, %r14d
movslq %r14d, %rax
addq %rsi, %rax
incq %rax
movl %r14d, %edx
cmpb $0x30, (%rsi,%rdx)
jne 0xca31
decl %r14d
decq %rax
cmpl %ecx, %r14d
jg 0xc8d3
addq $0x2, %rbx
movq %rbx, %rax
jmp 0xca31
addl %r15d, %ebx
movslq %ebx, %rax
addq %rax, %rcx
movq %rcx, %rax
jmp 0xca31
cmpl $0x1, %r15d
jne 0xc91c
movb $0x65, 0x1(%rsi)
testl %ebx, %ebx
js 0xc95c
addq $0x2, %rsi
jmp 0xc96c
leaq 0x2(%rsi), %rdi
movq %rsi, %r14
incq %rsi
leal -0x1(%r15), %eax
movslq %eax, %rdx
callq 0x7740
movq %r14, %rdx
movb $0x2e, 0x1(%r14)
movslq %r15d, %rax
movb $0x65, 0x1(%r14,%rax)
testl %ebx, %ebx
js 0xc9ba
addq %rax, %rdx
addq $0x2, %rdx
jmp 0xc9cd
leaq (%rcx,%r14), %rax
incq %rax
jmp 0xca31
movb $0x2d, 0x2(%rsi)
addq $0x3, %rsi
movl $0x1, %ebx
subl %r13d, %ebx
cmpl $0x64, %ebx
jb 0xc99c
movl %ebx, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rsi)
imull $0x64, %eax, %eax
subl %eax, %ebx
movq 0x95d1(%rip), %rax      # 0x15f60
movzwl (%rax,%rbx,2), %eax
movw %ax, 0x1(%rsi)
jmp 0xc8ad
cmpl $0xa, %ebx
jb 0xca19
movl %ebx, %eax
movq 0x95b6(%rip), %rcx      # 0x15f60
movzwl (%rcx,%rax,2), %eax
movw %ax, (%rsi)
addq $0x2, %rsi
jmp 0xc8b1
addq %rax, %rdx
movb $0x2d, 0x2(%rdx)
addq $0x3, %rdx
movl $0x1, %ebx
subl %r13d, %ebx
cmpl $0x64, %ebx
jb 0xc9fe
movl %ebx, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdx)
imull $0x64, %eax, %eax
subl %eax, %ebx
movq 0x9570(%rip), %rax      # 0x15f60
movzwl (%rax,%rbx,2), %eax
movw %ax, 0x1(%rdx)
addq $0x3, %rdx
jmp 0xca2e
cmpl $0xa, %ebx
jb 0xca26
movl %ebx, %eax
movq 0x9554(%rip), %rcx      # 0x15f60
movzwl (%rcx,%rax,2), %eax
movw %ax, (%rdx)
addq $0x2, %rdx
jmp 0xca2e
orb $0x30, %bl
movb %bl, (%rsi)
incq %rsi
jmp 0xc8b1
orb $0x30, %bl
movb %bl, (%rdx)
incq %rdx
movq %rdx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq