// File: /workspace/github_c_makefile_star2_O2/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 0x51c4b
cmpl $0xc, %edx
je 0x51bf8
cmpl $0xb, %edx
jne 0x51cba
movq 0x8(%rax), %r14
testq %r14, %r14
jns 0x51cb0
movabsq $0x7fffffffffffffff, %r15 # imm = 0x7FFFFFFFFFFFFFFF
xorl %eax, %eax
cmpb $0x0, 0xc7e8c(%rip)     # 0x119a28
leaq 0x1(%r15), %rcx
cmovneq %rcx, %rax
cmpq %rax, %r14
jne 0x51cf4
cmpb $0x0, 0xc8054(%rip)     # 0x119c08
je 0x51d0d
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x51bd9
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r15, 0x8(%rax)
jmp 0x51cb0
movq 0x8(%rax), %rsi
testq %rsi, %rsi
jns 0x51cb0
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
xorl %edx, %edx
cmpb $0x0, 0xc7e10(%rip)     # 0x119a28
leaq 0x1(%rcx), %rdi
cmovneq %rdi, %rdx
cmpq %rdx, %rsi
jne 0x51cdc
xorl %esi, %esi
cmpb $0x0, 0xc7fd6(%rip)     # 0x119c08
cmovneq %rcx, %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xbd87
movsd 0x8(%rax), %xmm1
ucomisd %xmm1, %xmm1
jp 0x51d54
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x51cb0
xorpd 0x84244(%rip), %xmm1    # 0xd5eb0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x51c95
movq %rbx, %rdi
movapd %xmm1, (%rsp)
callq 0x9c27
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
pushq $0xd
popq %r8
movq %rbx, %rdi
movq %rax, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x77745
negq %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xc761f
negq %r14
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x51d16
leaq 0xc3c49(%rip), %rax     # 0x115950
movq (%rax,%r14,8), %rax
jmp 0x51cb0
movq 0xc3c3c(%rip), %rax     # 0x115950
jmp 0x51cb0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x51d35
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0x51cb0
movq 0xcb13d(%rip), %rax     # 0x11ce98
jmp 0x51cb0