// File: /workspace/github_cpp_makefile_star2_O1/Konano[P]UselessDatabase/./json.hpp
// Function: nlohmann::detail::dtoa_impl::grisu2(char*, int&, int&, nlohmann::detail::dtoa_impl::diyfp, nlohmann::detail::dtoa_impl::diyfp, nlohmann::detail::dtoa_impl::diyfp)
inline void grisu2(char* buf, int& len, int& decimal_exponent,
                   diyfp m_minus, diyfp v, diyfp m_plus)
{
    assert(m_plus.e == m_minus.e);
    assert(m_plus.e == v.e);

    //  --------(-----------------------+-----------------------)--------    (A)
    //          m-                      v                       m+
    //
    //  --------------------(-----------+-----------------------)--------    (B)
    //                      m-          v                       m+
    //
    // First scale v (and m- and m+) such that the exponent is in the range
    // [alpha, gamma].

    const cached_power cached = get_cached_power_for_binary_exponent(m_plus.e);

    const diyfp c_minus_k(cached.f, cached.e); // = c ~= 10^-k

    // The exponent of the products is = v.e + c_minus_k.e + q and is in the range [alpha,gamma]
    const diyfp w       = diyfp::mul(v,       c_minus_k);
    const diyfp w_minus = diyfp::mul(m_minus, c_minus_k);
    const diyfp w_plus  = diyfp::mul(m_plus,  c_minus_k);

    //  ----(---+---)---------------(---+---)---------------(---+---)----
    //          w-                      w                       w+
    //          = c*m-                  = c*v                   = c*m+
    //
    // diyfp::mul rounds its result and c_minus_k is approximated too. w, w- and
    // w+ are now off by a small amount.
    // In fact:
    //
    //      w - v * 10^k < 1 ulp
    //
    // To account for this inaccuracy, add resp. subtract 1 ulp.
    //
    //  --------+---[---------------(---+---)---------------]---+--------
    //          w-  M-                  w                   M+  w+
    //
    // Now any number in [M-, M+] (bounds included) will round to w when input,
    // regardless of how the input rounding algorithm breaks ties.
    //
    // And digit_gen generates the shortest possible such number in [M-, M+].
    // Note that this does not mean that Grisu2 always generates the shortest
    // possible number in the interval (m-, m+).
    const diyfp M_minus(w_minus.f + 1, w_minus.e);
    const diyfp M_plus (w_plus.f  - 1, w_plus.e );

    decimal_exponent = -cached.k; // = -(-k) = k

    grisu2_digit_gen(buf, len, decimal_exponent, M_minus, w, M_plus);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rax
movq %rcx, 0x58(%rsp)
movl %r8d, 0x60(%rsp)
movl 0xc8(%rsp), %edi
cmpl %r8d, %edi
jne 0xcdbf
movq %rax, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
leaq 0xb0(%rsp), %r13
cmpl 0x8(%r13), %edi
jne 0xcdde
callq 0xce94
movq %rdx, %r12
leaq 0x68(%rsp), %r14
movq %rax, (%r14)
movl %r12d, 0x8(%r14)
movq %r13, %rdi
movq %r14, %rsi
callq 0xcfde
movq %rax, %r15
movl %edx, %ebx
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0xcfde
movq %rax, %r13
movl %edx, %ebp
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
callq 0xcfde
incq %r13
decq %rax
shrq $0x20, %r12
negl %r12d
movq 0x30(%rsp), %rcx
movl %r12d, (%rcx)
movq %r15, 0x48(%rsp)
movl %ebx, 0x50(%rsp)
movq %rax, 0x38(%rsp)
movl %edx, 0x40(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rcx, %rdx
movq %r13, %rcx
movl %ebp, %r8d
callq 0xd03a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x310cf(%rip), %rdi     # 0x3de95
leaq 0x30a30(%rip), %rsi     # 0x3d7fd
leaq 0x310d7(%rip), %rcx     # 0x3deab
movl $0x34a3, %edx           # imm = 0x34A3
callq 0x5280
leaq 0x3111a(%rip), %rdi     # 0x3deff
leaq 0x30a11(%rip), %rsi     # 0x3d7fd
leaq 0x310b8(%rip), %rcx     # 0x3deab
movl $0x34a4, %edx           # imm = 0x34A4
callq 0x5280
nop