// File: 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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
xorl %eax, %eax
cmpl -0x18(%rbp), %eax
jg 0x16046
cmpl $0x15, -0x20(%rbp)
jg 0x16046
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x16010
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x30, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x15ff1
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb $0x2e, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x30, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
xorl %eax, %eax
cmpl -0x20(%rbp), %eax
jge 0x1611a
cmpl $0x15, -0x20(%rbp)
jg 0x1611a
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
addq %rax, %rsi
movl -0x14(%rbp), %eax
subl -0x20(%rbp), %eax
movslq %eax, %rdx
callq 0xf140
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb $0x2e, (%rax,%rcx)
movl -0x18(%rbp), %ecx
addl -0x1c(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jle 0x16101
movl -0x20(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x160e8
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
je 0x160db
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
jmp 0x160dd
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x160a4
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
movl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
cmpl -0x20(%rbp), %eax
jge 0x16205
cmpl $0x0, -0x20(%rbp)
jg 0x16205
movl $0x2, %eax
subl -0x20(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rdx
callq 0xf140
movq -0x10(%rbp), %rax
movb $0x30, (%rax)
movq -0x10(%rbp), %rax
movb $0x2e, 0x1(%rax)
movl $0x2, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x1618a
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x30, (%rax,%rcx)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1616b
movl -0x14(%rbp), %eax
subl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jle 0x161ec
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jle 0x161db
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
je 0x161ce
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
jmp 0x161d0
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1619e
movq -0x10(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl -0x2c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
movl -0x20(%rbp), %eax
xorl %ecx, %ecx
subl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x16236
movq -0x10(%rbp), %rax
movb $0x30, (%rax)
movq -0x10(%rbp), %rax
movb $0x2e, 0x1(%rax)
movq -0x10(%rbp), %rax
movb $0x30, 0x2(%rax)
movq -0x10(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x8(%rbp)
jmp 0x162b5
cmpl $0x1, -0x14(%rbp)
jne 0x1625d
movq -0x10(%rbp), %rax
movb $0x65, 0x1(%rax)
movl -0x20(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
addq $0x2, %rsi
callq 0xf500
movq %rax, -0x8(%rbp)
jmp 0x162b5
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
callq 0xf140
movq -0x10(%rbp), %rax
movb $0x2e, 0x1(%rax)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x65, (%rax,%rcx)
movl -0x20(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %eax
addl $0x0, %eax
addl $0x2, %eax
cltq
addq %rax, %rsi
callq 0xf500
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop