// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_truncate
static s7_pointer g_truncate(s7_scheme *sc, s7_pointer args)
    {
#define H_truncate "(truncate x) returns the integer closest to x toward 0"
#define Q_truncate s7_make_signature(sc, 2, sc->is_integer_symbol, sc->is_real_symbol)

        s7_pointer x;
        x = car(args);
        switch (type(x))
        {
            case T_INTEGER:
                return(x);

            case T_RATIO:
                return(make_integer(sc, (s7_int)(numerator(x) / denominator(x)))); /* C "/" already truncates */

            case T_REAL:
                {
                    s7_double z;
                    z = real(x);
                    if (is_NaN(z))
                        return(simple_out_of_range(sc, sc->truncate_symbol, x, its_nan_string));
                    if (is_inf(z))
                        return(simple_out_of_range(sc, sc->truncate_symbol, x, its_infinite_string));
                    return(s7_truncate(sc, sc->truncate_symbol, real(x)));
                }

            case T_COMPLEX:
            default:
                return(method_or_bust_one_arg(sc, x, sc->truncate_symbol, args, T_REAL));
        }
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
addl $-0xb, %eax
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
subl $0x3, %eax
ja 0x7889a
movq 0x8(%rsp), %rax
leaq 0x1663ed(%rip), %rcx    # 0x1deab0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x788c5
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x38(%rsp), %rcx
cqto
idivq 0x10(%rcx)
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
andq $-0x800, %rax           # imm = 0xF800
cmpq $0x0, %rax
jne 0x7871b
movq 0x30(%rsp), %rcx
leaq 0x19dd6f(%rip), %rax    # 0x216480
movq (%rax,%rcx,8), %rax
movq %rax, (%rsp)
jmp 0x78791
jmp 0x7871d
movq 0x48(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x78741
movq 0x48(%rsp), %rdi
callq 0xc670
movq 0x48(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq $0xb, (%rax)
movq 0x30(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x788c5
movq 0x38(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x13860
testb $0x1, %al
jne 0x787ca
jmp 0x787fa
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x1620(%rax), %rax
movq 0x8(%rax), %rsi
movq 0x38(%rsp), %rdx
movq 0x1aca05(%rip), %rcx    # 0x2251f0
callq 0x45240
movq %rax, 0x50(%rsp)
jmp 0x788c5
movsd 0x10(%rsp), %xmm1
movaps %xmm1, %xmm0
movaps 0x169296(%rip), %xmm2   # 0x1e1aa0
pand %xmm2, %xmm0
movq %xmm1, %rdx
movl $0x1, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x0, %rdx
cmovll %eax, %ecx
movsd 0x169144(%rip), %xmm1   # 0x1e1970
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setnp %sil
sete %dl
testb %sil, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
je 0x78871
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x1620(%rax), %rax
movq 0x8(%rax), %rsi
movq 0x38(%rsp), %rdx
movq 0x1ac993(%rip), %rcx    # 0x2251f8
callq 0x45240
movq %rax, 0x50(%rsp)
jmp 0x788c5
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x1620(%rax), %rsi
movq 0x38(%rsp), %rax
movsd 0x8(%rax), %xmm0
callq 0x1bc0a0
movq %rax, 0x50(%rsp)
jmp 0x788c5
jmp 0x7889a
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x1620(%rax), %rdx
movq 0x40(%rsp), %rcx
movl $0xd, %r8d
callq 0xcfd30
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nop