// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: g_integer_decode_float
static s7_pointer g_integer_decode_float(s7_scheme *sc, s7_pointer args)
    {
#define H_integer_decode_float "(integer-decode-float x) returns a list containing the significand, exponent, and \
        sign of 'x' (1 = positive, -1 = negative).  (integer-decode-float 0.0): (0 0 1)"
#define Q_integer_decode_float s7_make_signature(sc, 2, sc->is_pair_symbol, sc->is_float_symbol)

        /* no matter what s7_double is, integer-decode-float acts as if x is a C double */

        typedef union {
            int64_t ix;
            double fx;
        } decode_float_t;

        decode_float_t num;
        s7_pointer x;
        x = car(args);

        switch (type(x))
        {
            case T_REAL:
                num.fx = (double)real(x);
                break;

#if WITH_GMP
            case T_BIG_REAL:
                num.fx = (double)s7_real(x);
                break;
#endif

            default:
                return(method_or_bust_with_type_one_arg(sc, x, sc->integer_decode_float_symbol, args, wrap_string(sc, "a non-rational real", 19)));
        }

        if (num.fx == 0.0)
            return(list_3(sc, small_int(0), small_int(0), small_int(1)));

        return(list_3(sc,
                    make_integer(sc, (s7_int)((num.ix & 0xfffffffffffffLL) | 0x10000000000000LL)),
                    make_integer(sc, (s7_int)(((num.ix & 0x7fffffffffffffffLL) >> 52) - 1023 - 52)),
                    make_integer(sc, ((num.ix & 0x8000000000000000LL) != 0) ? -1 : 1)));
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x8(%rsi), %rsi
cmpb $0xd, (%rsi)
jne 0x6fbcd
movsd 0x8(%rsi), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6fc16
jp 0x6fc16
movq 0xd6df1(%rip), %r14     # 0x146950
movq 0xd6df2(%rip), %r15     # 0x146958
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x6fb8c
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movl $0x200001, %ecx         # imm = 0x200001
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
movq 0x90(%rbx), %rdx
leaq -0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rdx), %rdx
movq %rcx, (%rdx)
movq %r14, 0x8(%rdx)
jmp 0x6fd7f
movq 0xfc0(%rbx), %rdx
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rdi
movq (%rax,%rdi,8), %r8
leal 0x1(%rdi), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0xabb4f(%rip), %rax     # 0x11b748
movq %rax, 0x10(%r8)
movq $0x13, 0x8(%r8)
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xfa261
movq %xmm0, %r12
movabsq $0xfffffffffffff, %rax  # imm = 0xFFFFFFFFFFFFF
movq %r12, %rcx
andq %rax, %rcx
leaq (%rcx,%rax), %r15
incq %r15
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6fc51
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r14
movq $0xb, (%r14)
movq %r15, 0x8(%r14)
movq %r12, %rax
shrq $0x34, %rax
movl $0x7ff, %ecx            # imm = 0x7FF
andq %rcx, %rax
leaq -0x433(%rax), %r13
cmpq %rcx, %r13
ja 0x6fc97
leaq 0xd6cc3(%rip), %rcx     # 0x146950
movq -0x2198(%rcx,%rax,8), %r15
jmp 0x6fcd0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6fcb6
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r15
movq $0xb, (%r15)
movq %r13, 0x8(%r15)
testq %r12, %r12
js 0x6fcde
movq 0xd6c7c(%rip), %r12     # 0x146958
jmp 0x6fd1d
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6fcfd
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r12
movq $0xb, (%r12)
movq $-0x1, 0x8(%r12)
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r13
cmpq 0x98(%rbx), %rax
ja 0x6fd43
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movl $0x200001, %ecx         # imm = 0x200001
movq %rcx, (%rax)
movq %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
movq 0x90(%rbx), %rdx
leaq -0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rdx), %rdx
movq %rcx, (%rdx)
movq %r15, 0x8(%rdx)
movq %rax, 0x10(%rdx)
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rax), %rax
movq %rcx, (%rax)
movq %r14, 0x8(%rax)
movq %rdx, 0x10(%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq