// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: g_abs
static s7_pointer g_abs(s7_scheme *sc, s7_pointer args)
    {
#define H_abs "(abs x) returns the absolute value of the real number x"
#define Q_abs s7_make_signature(sc, 2, sc->is_real_symbol, sc->is_real_symbol)

        s7_pointer x;
        x = car(args);
        switch (type(x))
        {
            case T_INTEGER:
                if (integer(x) < 0)
                {
                    if (integer(x) == s7_int_min)
                        return(make_integer(sc, s7_int_max));
                    return(make_integer(sc, -integer(x)));
                }
                return(x);

            case T_RATIO:
                if (numerator(x) < 0)
                {
                    if (numerator(x) == s7_int_min)
                        return(s7_make_ratio(sc, s7_int_max, denominator(x)));
                    return(make_simple_ratio(sc, -numerator(x), denominator(x)));
                }
                return(x);

            case T_REAL:
                if (is_NaN(real(x)))                  /* (abs -nan.0) -> +nan.0, not -nan.0 */
                    return(real_NaN);
                if (real(x) < 0.0)
                    return(make_real(sc, -real(x)));
                return(x);

            default:
                return(method_or_bust_one_arg(sc, x, sc->abs_symbol, args, T_REAL));
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movzbl (%rax), %edx
cmpl $0xd, %edx
je 0x662b6
cmpl $0xc, %edx
je 0x66263
cmpl $0xb, %edx
jne 0x66325
movq 0x8(%rax), %r14
testq %r14, %r14
jns 0x6631b
movabsq $0x7fffffffffffffff, %r15 # imm = 0x7FFFFFFFFFFFFFFF
xorl %eax, %eax
cmpb $0x0, 0xe4821(%rip)     # 0x14aa28
leaq 0x1(%r15), %rcx
cmovneq %rcx, %rax
cmpq %rax, %r14
jne 0x66361
cmpb $0x0, 0xe49e9(%rip)     # 0x14ac08
je 0x6637a
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x66244
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r15, 0x8(%rax)
jmp 0x6631b
movq 0x8(%rax), %rsi
testq %rsi, %rsi
jns 0x6631b
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
xorl %edx, %edx
cmpb $0x0, 0xe47a5(%rip)     # 0x14aa28
leaq 0x1(%rcx), %rdi
cmovneq %rdi, %rdx
cmpq %rdx, %rsi
jne 0x66349
xorl %esi, %esi
cmpb $0x0, 0xe496b(%rip)     # 0x14ac08
cmovneq %rcx, %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xcfa8
movsd 0x8(%rax), %xmm1
ucomisd %xmm1, %xmm1
jp 0x663c1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x6631b
xorpd 0xa3bd9(%rip), %xmm1    # 0x109eb0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x66300
movq %rbx, %rdi
movapd %xmm1, (%rsp)
callq 0xa550
movapd (%rsp), %xmm1
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xd, (%rax)
movsd %xmm1, 0x8(%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rsi, %rcx
movq 0xb90(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
movl $0xd, %r8d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x95069
negq %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xfa58d
negq %r14
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x66383
leaq 0xe05dc(%rip), %rax     # 0x146950
movq (%rax,%r14,8), %rax
jmp 0x6631b
movq 0xe05cf(%rip), %rax     # 0x146950
jmp 0x6631b
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x663a2
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0x6631b
movq 0xe7ad0(%rip), %rax     # 0x14de98
jmp 0x6631b