// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_dtoa
NK_LIB char*
nk_dtoa(char *s, double n)
{
    int useExp = 0;
    int digit = 0, m = 0, m1 = 0;
    char *c = s;
    int neg = 0;

    NK_ASSERT(s);
    if (!s) return 0;

    if (n == 0.0) {
        s[0] = '0'; s[1] = '\0';
        return s;
    }

    neg = (n < 0);
    if (neg) n = -n;

    /* calculate magnitude */
    m = nk_log10(n);
    useExp = (m >= 14 || (neg && m >= 9) || m <= -9);
    if (neg) *(c++) = '-';

    /* set up for scientific notation */
    if (useExp) {
        if (m < 0)
           m -= 1;
        n = n / (double)nk_pow(10.0, m);
        m1 = m;
        m = 0;
    }
    if (m < 1.0) {
        m = 0;
    }

    /* convert the number */
    while (n > NK_FLOAT_PRECISION || m >= 0) {
        double weight = nk_pow(10.0, m);
        if (weight > 0) {
            double t = (double)n / weight;
            digit = nk_ifloord(t);
            n -= ((double)digit * weight);
            *(c++) = (char)('0' + (char)digit);
        }
        if (m == 0 && n > 0)
            *(c++) = '.';
        m--;
    }

    if (useExp) {
        /* convert the exponent */
        int i, j;
        *(c++) = 'e';
        if (m1 > 0) {
            *(c++) = '+';
        } else {
            *(c++) = '-';
            m1 = -m1;
        }
        m = 0;
        while (m1 > 0) {
            *(c++) = (char)('0' + (char)(m1 % 10));
            m1 /= 10;
            m++;
        }
        c -= m;
        for (i = 0, j = m-1; i<j; i++, j--) {
            /* swap without temporary */
            c[i] ^= c[j];
            c[j] ^= c[i];
            c[i] ^= c[j];
        }
        c += m;
    }
    *(c) = '\0';
    return s;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movsd %xmm0, 0x50(%rsp)
movl $0x0, 0x4c(%rsp)
movl $0x0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movl $0x0, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
cmpq $0x0, 0x58(%rsp)
jne 0x8fc7c
movq 0x353a0(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x21746(%rip), %rsi     # 0xb13a0
leaq 0x2175d(%rip), %rdx     # 0xb13be
movl $0x1b6c, %ecx           # imm = 0x1B6C
movb $0x0, %al
callq 0x13ec0
movq 0x3537c(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x8fc7e
cmpq $0x0, 0x58(%rsp)
jne 0x8fc94
movq $0x0, 0x60(%rsp)
jmp 0x90072
movsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8fcc5
jp 0x8fcc5
movq 0x58(%rsp), %rax
movb $0x30, (%rax)
movq 0x58(%rsp), %rax
movb $0x0, 0x1(%rax)
movq 0x58(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x90072
xorps %xmm0, %xmm0
ucomisd 0x50(%rsp), %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x34(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x8fd04
movsd 0x50(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x50(%rsp), %xmm0
callq 0x90730
movl %eax, 0x44(%rsp)
movb $0x1, %al
cmpl $0xe, 0x44(%rsp)
movb %al, 0x17(%rsp)
jge 0x8fd40
cmpl $0x0, 0x34(%rsp)
je 0x8fd34
movb $0x1, %al
cmpl $0x9, 0x44(%rsp)
movb %al, 0x17(%rsp)
jge 0x8fd40
cmpl $-0x9, 0x44(%rsp)
setle %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x4c(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x8fd68
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rsp)
movb $0x2d, (%rax)
cmpl $0x0, 0x4c(%rsp)
je 0x8fdc1
cmpl $0x0, 0x44(%rsp)
jge 0x8fd81
movl 0x44(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x44(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x44(%rsp), %edi
movsd 0x1d837(%rip), %xmm0    # 0xad5d0
callq 0x907e0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movl 0x44(%rsp), %eax
movl %eax, 0x40(%rsp)
movl $0x0, 0x44(%rsp)
cvtsi2sdl 0x44(%rsp), %xmm1
movsd 0x1d7e9(%rip), %xmm0    # 0xad5b8
ucomisd %xmm1, %xmm0
jbe 0x8fddd
movl $0x0, 0x44(%rsp)
jmp 0x8fddf
movsd 0x50(%rsp), %xmm0
movb $0x1, %al
movsd 0x1d811(%rip), %xmm1    # 0xad600
ucomisd %xmm1, %xmm0
movb %al, 0x7(%rsp)
ja 0x8fe05
cmpl $0x0, 0x44(%rsp)
setge %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x8fe12
jmp 0x8fee9
movl 0x44(%rsp), %edi
movsd 0x1d7b2(%rip), %xmm0    # 0xad5d0
callq 0x907e0
movsd %xmm0, 0x28(%rsp)
movsd 0x28(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x8feaf
movsd 0x50(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
callq 0x908b0
movl %eax, 0x48(%rsp)
cvtsi2sdl 0x48(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
movsd 0x50(%rsp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movl 0x48(%rsp), %eax
movsbl %al, %eax
addl $0x30, %eax
movb %al, %cl
movq 0x38(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x38(%rsp)
movb %cl, (%rax)
cmpl $0x0, 0x44(%rsp)
jne 0x8fed9
movsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x8fed9
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rsp)
movb $0x2e, (%rax)
movl 0x44(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x8fddf
cmpl $0x0, 0x4c(%rsp)
je 0x90060
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rsp)
movb $0x65, (%rax)
cmpl $0x0, 0x40(%rsp)
jle 0x8ff25
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rsp)
movb $0x2b, (%rax)
jmp 0x8ff43
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rsp)
movb $0x2d, (%rax)
xorl %eax, %eax
subl 0x40(%rsp), %eax
movl %eax, 0x40(%rsp)
movl $0x0, 0x44(%rsp)
cmpl $0x0, 0x40(%rsp)
jle 0x8ff98
movl 0x40(%rsp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movb %dl, %al
movsbl %al, %eax
addl $0x30, %eax
movb %al, %cl
movq 0x38(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x38(%rsp)
movb %cl, (%rax)
movl 0x40(%rsp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, 0x40(%rsp)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x8ff4b
movl 0x44(%rsp), %ecx
movq 0x38(%rsp), %rax
movslq %ecx, %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x44(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x18(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x9004c
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsbl (%rax,%rcx), %esi
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %esi
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsbl (%rax,%rcx), %esi
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x18(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x8ffc4
movl 0x44(%rsp), %ecx
movq 0x38(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movb $0x0, (%rax)
movq 0x58(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nopl (%rax)