// File: Eba-M[P]E3DC-Control/cJSON.c
// Function: print_number(cJSON const*, printbuffer*)
static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer)
{
    unsigned char *output_pointer = NULL;
    double d = item->valuedouble;
    int length = 0;
    size_t i = 0;
    unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */
    unsigned char decimal_point = get_decimal_point();
    double test = 0.0;

    if (output_buffer == NULL)
    {
        return false;
    }

    /* This checks for NaN and Infinity */
    if (isnan(d) || isinf(d))
    {
        length = sprintf((char*)number_buffer, "null");
    }
    else if(d == (double)item->valueint)
    {
        length = sprintf((char*)number_buffer, "%d", item->valueint);
    }
    else
    {
        /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
        length = sprintf((char*)number_buffer, "%1.15g", d);

        /* Check whether the original double can be recovered */
        if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d))
        {
            /* If not, print with 17 decimal places of precision */
            length = sprintf((char*)number_buffer, "%1.17g", d);
        }
    }

    /* sprintf failed or buffer overrun occurred */
    if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1)))
    {
        return false;
    }

    /* reserve appropriate space in the output */
    output_pointer = ensure(output_buffer, (size_t)length + sizeof(""));
    if (output_pointer == NULL)
    {
        return false;
    }

    /* copy the printed number to the output and replace locale
     * dependent decimal point with '.' */
    for (i = 0; i < ((size_t)length); i++)
    {
        if (number_buffer[i] == decimal_point)
        {
            output_pointer[i] = '.';
            continue;
        }

        output_pointer[i] = number_buffer[i];
    }
    output_pointer[i] = '\0';

    output_buffer->offset += (size_t)length;

    return true;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x58(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x1a, %edx
callq 0x2170
callq 0x5d740
movb %al, 0xf(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, (%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x5da0f
movl $0x0, 0x64(%rsp)
jmp 0x5dbe5
movsd 0x40(%rsp), %xmm0
ucomisd 0x40(%rsp), %xmm0
jne 0x5da51
jp 0x5da51
movsd 0x40(%rsp), %xmm0
subsd 0x40(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
subsd 0x40(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jne 0x5da41
jp 0x5da41
jmp 0x5da6d
movsd 0x40(%rsp), %xmm0
ucomisd 0x40(%rsp), %xmm0
jne 0x5da6d
jp 0x5da6d
leaq 0x10(%rsp), %rdi
leaq 0x4ef8(%rip), %rsi      # 0x62955
movb $0x0, %al
callq 0x2060
movl %eax, 0x3c(%rsp)
jmp 0x5db14
movsd 0x40(%rsp), %xmm0
movq 0x58(%rsp), %rax
cvtsi2sdl 0x28(%rax), %xmm1
ucomisd %xmm1, %xmm0
jne 0x5daa6
jp 0x5daa6
leaq 0x10(%rsp), %rdi
movq 0x58(%rsp), %rax
movl 0x28(%rax), %edx
leaq 0x434b(%rip), %rsi      # 0x61de4
movb $0x0, %al
callq 0x2060
movl %eax, 0x3c(%rsp)
jmp 0x5db12
leaq 0x10(%rsp), %rdi
movsd 0x40(%rsp), %xmm0
leaq 0x4ea2(%rip), %rsi      # 0x6295a
movb $0x1, %al
callq 0x2060
movl %eax, 0x3c(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x4e92(%rip), %rsi      # 0x62961
movq %rsp, %rdx
movb $0x0, %al
callq 0x22b0
cmpl $0x1, %eax
jne 0x5daf3
movsd (%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
callq 0x5c620
cmpl $0x0, %eax
jne 0x5db10
leaq 0x10(%rsp), %rdi
movsd 0x40(%rsp), %xmm0
leaq 0x4e60(%rip), %rsi      # 0x62965
movb $0x1, %al
callq 0x2060
movl %eax, 0x3c(%rsp)
jmp 0x5db12
jmp 0x5db14
cmpl $0x0, 0x3c(%rsp)
jl 0x5db22
cmpl $0x19, 0x3c(%rsp)
jle 0x5db2f
movl $0x0, 0x64(%rsp)
jmp 0x5dbe5
movq 0x50(%rsp), %rdi
movslq 0x3c(%rsp), %rsi
addq $0x1, %rsi
callq 0x5d750
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x5db5c
movl $0x0, 0x64(%rsp)
jmp 0x5dbe5
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movslq 0x3c(%rsp), %rcx
cmpq %rcx, %rax
jae 0x5dbbd
movq 0x30(%rsp), %rax
movzbl 0x10(%rsp,%rax), %eax
movzbl 0xf(%rsp), %ecx
cmpl %ecx, %eax
jne 0x5db97
movq 0x48(%rsp), %rax
movq 0x30(%rsp), %rcx
movb $0x2e, (%rax,%rcx)
jmp 0x5dbad
movq 0x30(%rsp), %rax
movb 0x10(%rsp,%rax), %dl
movq 0x48(%rsp), %rax
movq 0x30(%rsp), %rcx
movb %dl, (%rax,%rcx)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x5db65
movq 0x48(%rsp), %rax
movq 0x30(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movslq 0x3c(%rsp), %rcx
movq 0x50(%rsp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movl $0x1, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nop