// File: /workspace/github_cpp_makefile_star2_O3/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 %rcx, 0x58(%rsp)
movl %r8d, 0x60(%rsp)
cmpl %r8d, 0xc8(%rsp)
jne 0xca16
movq %rdi, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
leaq 0xb0(%rsp), %r13
cmpl %r8d, 0x8(%r13)
jne 0xca35
movl %r8d, %edi
callq 0xcaea
movq %rdx, %r12
leaq 0x68(%rsp), %r14
movq %rax, (%r14)
movl %r12d, 0x8(%r14)
movq %r13, %rdi
movq %r14, %rsi
callq 0xcc36
movq %rax, %r15
movl %edx, %ebx
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0xcc36
movq %rax, %r13
movl %edx, %ebp
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
callq 0xcc36
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 0xcc92
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30475(%rip), %rdi     # 0x3ce92
leaq 0x2fdd6(%rip), %rsi     # 0x3c7fa
leaq 0x3047d(%rip), %rcx     # 0x3cea8
movl $0x34a3, %edx           # imm = 0x34A3
callq 0x5280
leaq 0x304c0(%rip), %rdi     # 0x3cefc
leaq 0x2fdb7(%rip), %rsi     # 0x3c7fa
leaq 0x3045e(%rip), %rcx     # 0x3cea8
movl $0x34a4, %edx           # imm = 0x34A4
callq 0x5280