// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/util.c
// Function: d2string
int d2string(char *buf, size_t len, double value) {
    if (isnan(value)) {
        len = snprintf(buf,len,"nan");
    } else if (isinf(value)) {
        if (value < 0)
            len = snprintf(buf,len,"-inf");
        else
            len = snprintf(buf,len,"inf");
    } else if (value == 0) {
        /* See: http://en.wikipedia.org/wiki/Signed_zero, "Comparisons". */
        if (1.0/value < 0)
            len = snprintf(buf,len,"-0");
        else
            len = snprintf(buf,len,"0");
    } else {
#if (DBL_MANT_DIG >= 52) && (LLONG_MAX == 0x7fffffffffffffffLL)
        /* Check if the float is in a safe range to be casted into a
         * long long. We are assuming that long long is 64 bit here.
         * Also we are assuming that there are no implementations around where
         * double has precision < 52 bit.
         *
         * Under this assumptions we test if a double is inside an interval
         * where casting to long long is safe. Then using two castings we
         * make sure the decimal part is zero. If all this is true we use
         * integer printing function that is much faster. */
        double min = -4503599627370495; /* (2^52)-1 */
        double max = 4503599627370496; /* -(2^52) */
        if (value > min && value < max && value == ((double)((long long)value)))
            len = ll2string(buf,len,(long long)value);
        else
#endif
            len = snprintf(buf,len,"%.17g",value);
    }

    return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x47c87
jmp 0x47ca8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xf3953(%rip), %rdx     # 0x13b5e9
movb $0x0, %al
callq 0x26120
cltq
movq %rax, -0x10(%rbp)
jmp 0x47e2f
movsd -0x18(%rbp), %xmm1
movaps %xmm1, %xmm0
movaps 0xf2d59(%rip), %xmm2    # 0x13aa10
pand %xmm2, %xmm0
movq %xmm1, %rdx
movl $0x1, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x0, %rdx
cmovll %eax, %ecx
movsd 0xf2d27(%rip), %xmm1    # 0x13aa00
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
je 0x47d3a
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x47d19
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xf2d80(%rip), %rdx     # 0x13aa8a
movb $0x0, %al
callq 0x26120
cltq
movq %rax, -0x10(%rbp)
jmp 0x47d35
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xf2d63(%rip), %rdx     # 0x13aa8b
movb $0x0, %al
callq 0x26120
cltq
movq %rax, -0x10(%rbp)
jmp 0x47e2d
movsd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x47d9f
jp 0x47d9f
movsd 0xef716(%rip), %xmm1    # 0x137468
divsd -0x18(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x47d7e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xf387e(%rip), %rdx     # 0x13b5ed
movb $0x0, %al
callq 0x26120
cltq
movq %rax, -0x10(%rbp)
jmp 0x47d9a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0xf5d01(%rip), %rdx     # 0x13da8e
movb $0x0, %al
callq 0x26120
cltq
movq %rax, -0x10(%rbp)
jmp 0x47e2b
movsd 0xf3751(%rip), %xmm0    # 0x13b4f8
movsd %xmm0, -0x20(%rbp)
movsd 0xf373c(%rip), %xmm0    # 0x13b4f0
movsd %xmm0, -0x28(%rbp)
movsd -0x18(%rbp), %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x47e08
movsd -0x18(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x47e08
movsd -0x18(%rbp), %xmm0
cvttsd2si -0x18(%rbp), %rax
cvtsi2sd %rax, %xmm1
ucomisd %xmm1, %xmm0
jne 0x47e08
jp 0x47e08
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
cvttsd2si -0x18(%rbp), %rdx
callq 0x477e0
cltq
movq %rax, -0x10(%rbp)
jmp 0x47e29
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movsd -0x18(%rbp), %xmm0
leaq 0xf2c73(%rip), %rdx     # 0x13aa8f
movb $0x1, %al
callq 0x26120
cltq
movq %rax, -0x10(%rbp)
jmp 0x47e2b
jmp 0x47e2d
jmp 0x47e2f
movq -0x10(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)