// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movzbl (%rax), %edx
cmpl $0xd, %edx
je 0x6b30f
cmpl $0xc, %edx
je 0x6b2be
cmpl $0xb, %edx
jne 0x6b37a
movq 0x8(%rax), %r14
testq %r14, %r14
jns 0x6b3cd
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
xorl %ecx, %ecx
cmpb $0x0, 0xe77cd(%rip)     # 0x152a28
leaq 0x1(%rax), %rdx
cmovneq %rdx, %rcx
cmpq %rcx, %r14
jne 0x6b3b2
xorl %r14d, %r14d
cmpb $0x0, 0xe7992(%rip)     # 0x152c08
cmovneq %rax, %r14
je 0x6b3c2
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6b298
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0x6b3cd
movq 0x8(%rax), %rsi
testq %rsi, %rsi
jns 0x6b3cd
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
xorl %edx, %edx
cmpb $0x0, 0xe774a(%rip)     # 0x152a28
leaq 0x1(%rcx), %rdi
cmovneq %rdi, %rdx
cmpq %rdx, %rsi
jne 0x6b39c
xorl %esi, %esi
cmpb $0x0, 0xe7910(%rip)     # 0x152c08
cmovneq %rcx, %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0xdd7f
movsd 0x8(%rax), %xmm1
ucomisd %xmm1, %xmm1
jp 0x6b3d5
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x6b3cd
xorpd 0xa7a8c(%rip), %xmm1    # 0x112dc0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6b356
movq %rbx, %rdi
movapd %xmm1, (%rsp)
callq 0xb389
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)
jmp 0x6b3cd
movq %rsi, %rcx
movq 0xb90(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
movl $0xd, %r8d
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x9b739
negq %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x103338
negq %r14
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x6b280
leaq 0xe3587(%rip), %rax     # 0x14e950
movq (%rax,%r14,8), %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq 0xeaabc(%rip), %rax     # 0x155e98
jmp 0x6b3cd