// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_acos
static s7_pointer g_acos(s7_scheme *sc, s7_pointer args)
    {
#define H_acos "(acos z) returns acos(z); (cos (acos 1)) = 1"
#define Q_acos sc->pl_nn
        s7_pointer n;

        n = car(args);
        switch (type(n))
        {
            case T_INTEGER:
                if (integer(n) == 1) return(small_int(0));
                return(c_acos(sc, (s7_double)integer(n)));

            case T_RATIO:
                return(c_acos(sc, (s7_double)numerator(n) / (s7_double)denominator(n)));

            case T_REAL:
                return(c_acos(sc, real(n)));

            case T_COMPLEX:
#if HAVE_COMPLEX_NUMBERS
                /* if either real or imag part is very large, use explicit formula, not cacos */
                /*   this code taken from sbcl's src/code/irrat.lisp */

                if ((fabs(real_part(n)) > 1.0e7) ||
                        (fabs(imag_part(n)) > 1.0e7))
                {
                    s7_complex sq1mz, sq1pz, z;
                    z = as_c_complex(n);
                    sq1mz = csqrt(1.0 - z);
                    sq1pz = csqrt(1.0 + z);	  /* creal(sq1pz) can be 0.0 */
                    if (creal(sq1pz) == 0.0)        /* so the atan arg will be inf, so the real part will be pi/2(?) */
                        return(s7_make_complex(sc, M_PI / 2.0, asinh(cimag(sq1mz * conj(sq1pz)))));
                    return(s7_make_complex(sc, 2.0 * atan(creal(sq1mz) / creal(sq1pz)), asinh(cimag(sq1mz * conj(sq1pz)))));
                }
                return(s7_from_c_complex(sc, cacos(s7_to_c_complex(n))));
#else
                return(out_of_range(sc, sc->acos_symbol, small_int(1), n, no_complex_numbers_string));
#endif

            default:
                return(method_or_bust_with_type_one_arg(sc, n, sc->acos_symbol, list_1(sc, n), a_number_string));
        }
    }

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x148(%rsp)
movq %rsi, 0x140(%rsp)
movq 0x140(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rax
movzbl (%rax), %eax
addl $-0xb, %eax
movl %eax, %ecx
movq %rcx, 0xa0(%rsp)
subl $0x3, %eax
ja 0x74d65
movq 0xa0(%rsp), %rax
leaq 0x16a1b5(%rip), %rcx    # 0x1dea40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x138(%rsp), %rax
cmpq $0x1, 0x8(%rax)
jne 0x748b7
movq 0x1a1bd6(%rip), %rax    # 0x216480
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x148(%rsp), %rdi
movq 0x138(%rsp), %rax
cvtsi2sdq 0x8(%rax), %xmm0
callq 0x1bba60
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x148(%rsp), %rdi
movq 0x138(%rsp), %rax
cvtsi2sdq 0x8(%rax), %xmm0
movq 0x138(%rsp), %rax
cvtsi2sdq 0x10(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x1bba60
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x148(%rsp), %rdi
movq 0x138(%rsp), %rax
movsd 0x8(%rax), %xmm0
callq 0x1bba60
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x138(%rsp), %rax
movsd 0x8(%rax), %xmm0
movaps 0x16d14c(%rip), %xmm1   # 0x1e1aa0
pand %xmm1, %xmm0
movsd 0x16d0a8(%rip), %xmm1   # 0x1e1a08
ucomisd %xmm1, %xmm0
ja 0x74990
movq 0x138(%rsp), %rax
movsd 0x10(%rax), %xmm0
movaps 0x16d126(%rip), %xmm1   # 0x1e1aa0
pand %xmm1, %xmm0
movsd 0x16d082(%rip), %xmm1   # 0x1e1a08
ucomisd %xmm1, %xmm0
jbe 0x74ce7
movq 0x138(%rsp), %rax
movsd 0x8(%rax), %xmm1
movq 0x138(%rsp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm3, %xmm3
movaps %xmm0, %xmm2
mulsd %xmm3, %xmm2
movsd 0x16cfac(%rip), %xmm3   # 0x1e1968
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm1
movsd %xmm1, 0x108(%rsp)
movsd %xmm0, 0x110(%rsp)
movsd 0x108(%rsp), %xmm2
movsd 0x110(%rsp), %xmm0
movsd 0x16cf78(%rip), %xmm1   # 0x1e1968
subsd %xmm2, %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm1, 0xf8(%rsp)
movsd %xmm0, 0x100(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd 0x100(%rsp), %xmm1
callq 0x9560
movsd %xmm0, 0x128(%rsp)
movsd %xmm1, 0x130(%rsp)
movsd 0x108(%rsp), %xmm2
movsd 0x110(%rsp), %xmm0
movsd 0x16cf08(%rip), %xmm1   # 0x1e1968
addsd %xmm2, %xmm1
movsd %xmm1, 0xe8(%rsp)
movsd %xmm0, 0xf0(%rsp)
movsd 0xe8(%rsp), %xmm0
movsd 0xf0(%rsp), %xmm1
callq 0x9560
movsd %xmm0, 0x118(%rsp)
movsd %xmm1, 0x120(%rsp)
movsd 0x118(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x74bcb
jp 0x74bcb
movq 0x148(%rsp), %rax
movq %rax, 0x68(%rsp)
movsd 0x128(%rsp), %xmm1
movsd %xmm1, 0x70(%rsp)
movsd 0x130(%rsp), %xmm2
movsd %xmm2, 0x78(%rsp)
movsd 0x118(%rsp), %xmm4
movsd %xmm4, 0x80(%rsp)
movsd 0x120(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm5
movsd %xmm5, 0x88(%rsp)
movaps %xmm1, %xmm0
mulsd %xmm4, %xmm0
movaps %xmm2, %xmm3
mulsd %xmm5, %xmm3
mulsd %xmm5, %xmm1
mulsd %xmm4, %xmm2
subsd %xmm3, %xmm0
addsd %xmm2, %xmm1
movsd %xmm1, 0x90(%rsp)
ucomisd %xmm0, %xmm0
movsd %xmm1, 0x98(%rsp)
jnp 0x74b9b
movsd 0x90(%rsp), %xmm1
ucomisd %xmm1, %xmm1
movsd %xmm1, 0x98(%rsp)
jnp 0x74b9b
movsd 0x88(%rsp), %xmm3
movsd 0x80(%rsp), %xmm2
movsd 0x78(%rsp), %xmm1
movsd 0x70(%rsp), %xmm0
callq 0x1dc190
movsd %xmm1, 0x98(%rsp)
movsd 0x98(%rsp), %xmm0
callq 0x9740
movq 0x68(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x16ce57(%rip), %xmm0   # 0x1e1a10
callq 0x122a0
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x148(%rsp), %rax
movq %rax, 0x28(%rsp)
movsd 0x128(%rsp), %xmm0
divsd 0x118(%rsp), %xmm0
callq 0x9150
movaps %xmm0, %xmm1
movsd 0x16cdee(%rip), %xmm0   # 0x1e19e8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x128(%rsp), %xmm1
movsd %xmm1, 0x38(%rsp)
movsd 0x130(%rsp), %xmm2
movsd %xmm2, 0x40(%rsp)
movsd 0x118(%rsp), %xmm4
movsd %xmm4, 0x48(%rsp)
movsd 0x120(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm5
movsd %xmm5, 0x50(%rsp)
movaps %xmm1, %xmm0
mulsd %xmm4, %xmm0
movaps %xmm2, %xmm3
mulsd %xmm5, %xmm3
mulsd %xmm5, %xmm1
mulsd %xmm4, %xmm2
subsd %xmm3, %xmm0
addsd %xmm2, %xmm1
movsd %xmm1, 0x58(%rsp)
ucomisd %xmm0, %xmm0
movsd %xmm1, 0x60(%rsp)
jnp 0x74cbc
movsd 0x58(%rsp), %xmm1
ucomisd %xmm1, %xmm1
movsd %xmm1, 0x60(%rsp)
jnp 0x74cbc
movsd 0x50(%rsp), %xmm3
movsd 0x48(%rsp), %xmm2
movsd 0x40(%rsp), %xmm1
movsd 0x38(%rsp), %xmm0
callq 0x1dc190
movsd %xmm1, 0x60(%rsp)
movsd 0x60(%rsp), %xmm0
callq 0x9740
movq 0x28(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
callq 0x122a0
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x148(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x138(%rsp), %rdi
callq 0x1bb600
movsd %xmm0, 0xd8(%rsp)
movsd %xmm1, 0xe0(%rsp)
movsd 0xd8(%rsp), %xmm0
movsd 0xe0(%rsp), %xmm1
callq 0x9120
movq 0x20(%rsp), %rdi
movsd %xmm0, 0xc8(%rsp)
movsd %xmm1, 0xd0(%rsp)
movsd 0xc8(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm1
callq 0x1bb560
movq %rax, 0x150(%rsp)
jmp 0x74e82
movq 0x148(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x148(%rsp), %rax
movq 0xb98(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x148(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0xb0(%rsp)
movq 0x148(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x148(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x74de7
movq 0x148(%rsp), %rdi
callq 0xc670
movq 0x148(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0xb8(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0xb0(%rsp), %rcx
movq 0xc0(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0xc0(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rcx
movq 0x1b007b(%rip), %r8     # 0x224ef0
callq 0x1ba7e0
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rax
addq $0x158, %rsp            # imm = 0x158
retq
nopw %cs:(%rax,%rax)