// File: Konano[P]UselessDatabase/./json.hpp
// Function: nlohmann::detail::dtoa_impl::format_buffer(char*, int, int, int, int)
inline char* format_buffer(char* buf, int len, int decimal_exponent,
                           int min_exp, int max_exp)
{
    assert(min_exp < 0);
    assert(max_exp > 0);

    const int k = len;
    const int n = len + decimal_exponent;

    // v = buf * 10^(n-k)
    // k is the length of the buffer (number of decimal digits)
    // n is the position of the decimal point relative to the start of the buffer.

    if (k <= n and n <= max_exp)
    {
        // digits[000]
        // len <= max_exp + 2

        std::memset(buf + k, '0', static_cast<size_t>(n - k));
        // Make it look like a floating-point number (#362, #378)
        buf[n + 0] = '.';
        buf[n + 1] = '0';
        return buf + (n + 2);
    }

    if (0 < n and n <= max_exp)
    {
        // dig.its
        // len <= max_digits10 + 1

        assert(k > n);

        std::memmove(buf + (n + 1), buf + n, static_cast<size_t>(k - n));
        buf[n] = '.';
        return buf + (k + 1);
    }

    if (min_exp < n and n <= 0)
    {
        // 0.[000]digits
        // len <= 2 + (-min_exp - 1) + max_digits10

        std::memmove(buf + (2 + -n), buf, static_cast<size_t>(k));
        buf[0] = '0';
        buf[1] = '.';
        std::memset(buf + 2, '0', static_cast<size_t>(-n));
        return buf + (2 + (-n) + k);
    }

    if (k == 1)
    {
        // dE+123
        // len <= 1 + 5

        buf += 1;
    }
    else
    {
        // d.igitsE+123
        // len <= max_digits10 + 1 + 5

        std::memmove(buf + 2, buf + 1, static_cast<size_t>(k - 1));
        buf[1] = '.';
        buf += 1 + k;
    }

    *buf++ = 'e';
    return append_exponent(buf, n - 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x16551
jmp 0x16570
leaq 0x690be(%rip), %rdi     # 0x7f616
leaq 0x685e2(%rip), %rsi     # 0x7eb41
movl $0x353b, %edx           # imm = 0x353B
leaq 0x690b7(%rip), %rcx     # 0x7f622
callq 0x6350
cmpl $0x0, -0x20(%rbp)
jle 0x16578
jmp 0x16597
leaq 0x690f0(%rip), %rdi     # 0x7f66f
leaq 0x685bb(%rip), %rsi     # 0x7eb41
movl $0x353c, %edx           # imm = 0x353C
leaq 0x69090(%rip), %rcx     # 0x7f622
callq 0x6350
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0x1660f
movl -0x28(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x1660f
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movl -0x28(%rbp), %eax
subl -0x24(%rbp), %eax
movslq %eax, %rdx
movl $0x30, %esi
callq 0x62c0
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movb $0x2e, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x30, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x16777
xorl %eax, %eax
cmpl -0x28(%rbp), %eax
jge 0x16694
movl -0x28(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x16694
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jle 0x16628
jmp 0x16647
leaq 0x6904c(%rip), %rdi     # 0x7f67b
leaq 0x6850b(%rip), %rsi     # 0x7eb41
movl $0x3556, %edx           # imm = 0x3556
leaq 0x68fe0(%rip), %rcx     # 0x7f622
callq 0x6350
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x28(%rbp), %rax
addq %rax, %rsi
movl -0x24(%rbp), %eax
subl -0x28(%rbp), %eax
movslq %eax, %rdx
callq 0x67e0
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb $0x2e, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x16777
movl -0x1c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x16704
cmpl $0x0, -0x28(%rbp)
jg 0x16704
movq -0x10(%rbp), %rdi
xorl %eax, %eax
subl -0x28(%rbp), %eax
addl $0x2, %eax
cltq
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x67e0
movq -0x10(%rbp), %rax
movb $0x30, (%rax)
movq -0x10(%rbp), %rax
movb $0x2e, 0x1(%rax)
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
xorl %eax, %eax
subl -0x28(%rbp), %eax
movslq %eax, %rdx
movl $0x30, %esi
callq 0x62c0
movq -0x10(%rbp), %rax
xorl %ecx, %ecx
subl -0x28(%rbp), %ecx
addl $0x2, %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x16777
cmpl $0x1, -0x24(%rbp)
jne 0x16718
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x16752
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x24(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
callq 0x67e0
movq -0x10(%rbp), %rax
movb $0x2e, 0x1(%rax)
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x65, (%rax)
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
subl $0x1, %esi
callq 0x17910
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)