// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_asin
static s7_pointer g_asin(s7_scheme *sc, s7_pointer args)
    {
#define H_asin "(asin z) returns asin(z); (sin (asin x)) = x"
#define Q_asin sc->pl_nn
        s7_pointer n;

        n = car(args);
        switch (type(n))
        {
            case T_INTEGER:
                if (integer(n) == 0) return(small_int(0));                    /* (asin 0) -> 0 */
                /* in netBSD, (asin 2) returns 0.25383842987008+0.25383842987008i according to Peter Bex */
                return(c_asin(sc, (s7_double)integer(n)));

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

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

            case T_COMPLEX:
#if HAVE_COMPLEX_NUMBERS
                /* if either real or imag part is very large, use explicit formula, not casin */
                /*   this code taken from sbcl's src/code/irrat.lisp; break is around x+70000000i */
                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);
                    return(s7_make_complex(sc, atan(real_part(n) / creal(sq1mz * sq1pz)), asinh(cimag(sq1pz * conj(sq1mz)))));
                }
                return(s7_from_c_complex(sc, casin(as_c_complex(n))));
#else
                return(out_of_range(sc, sc->asin_symbol, small_int(1), n, no_complex_numbers_string));
#endif

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %r14
movzbl (%r14), %eax
addl $-0xb, %eax
cmpl $0x3, %eax
ja 0x6c1e5
leaq 0xa48e7(%rip), %rcx     # 0x110934
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x6c250
cvtsi2sd %rax, %xmm0
jmp 0x6c1d2
movsd 0x8(%r14), %xmm0
jmp 0x6c1d2
movsd 0x8(%r14), %xmm2
movapd 0xa6d4a(%rip), %xmm0    # 0x112dd0
andpd %xmm2, %xmm0
ucomisd 0xa301e(%rip), %xmm0    # 0x10f0b0
ja 0x6c0b4
movsd 0x10(%r14), %xmm1
movapd 0xa6d2e(%rip), %xmm0    # 0x112dd0
andpd %xmm1, %xmm0
ucomisd 0xa3002(%rip), %xmm0    # 0x10f0b0
jbe 0x6c263
movsd 0x10(%r14), %xmm3
movapd %xmm3, 0x30(%rsp)
xorpd %xmm0, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm0, %xmm2
movapd %xmm2, 0x20(%rsp)
movsd 0xa2f56(%rip), %xmm0    # 0x10f030
subsd %xmm2, %xmm0
movapd 0xa6cda(%rip), %xmm1    # 0x112dc0
xorpd %xmm3, %xmm1
callq 0x9560
movsd %xmm0, 0x8(%rsp)
movapd %xmm1, 0x40(%rsp)
movapd 0x20(%rsp), %xmm0
addsd 0xa2f27(%rip), %xmm0    # 0x10f030
movapd 0x30(%rsp), %xmm1
callq 0x9560
movapd %xmm0, %xmm2
movsd 0x8(%r14), %xmm5
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm0
mulsd %xmm2, %xmm0
movapd 0x40(%rsp), %xmm6
movapd %xmm6, %xmm4
mulsd %xmm1, %xmm4
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm3
movsd %xmm0, 0x20(%rsp)
movapd %xmm4, 0x60(%rsp)
subsd %xmm4, %xmm0
ucomisd %xmm0, %xmm0
movapd %xmm6, %xmm4
movsd %xmm2, 0x18(%rsp)
mulsd %xmm2, %xmm4
movsd %xmm3, 0x30(%rsp)
movapd %xmm4, 0x50(%rsp)
jp 0x6c28b
divsd %xmm0, %xmm5
movapd %xmm5, %xmm0
callq 0x9150
movsd %xmm0, (%rsp)
movsd 0x20(%rsp), %xmm1
addsd 0x60(%rsp), %xmm1
movsd 0x30(%rsp), %xmm0
subsd 0x50(%rsp), %xmm0
ucomisd %xmm1, %xmm1
jp 0x6c2c9
callq 0x9740
movapd %xmm0, %xmm1
movq %rbx, %rdi
movsd (%rsp), %xmm0
jmp 0x6c27b
cvtsi2sdq 0x8(%r14), %xmm0
cvtsi2sdq 0x10(%r14), %xmm1
divsd %xmm1, %xmm0
movq %rbx, %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x103490
movq 0xbe0(%rbx), %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x6c20b
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rcx
movq $0x200001, (%rcx)       # imm = 0x200001
movq %r14, 0x8(%rcx)
movq %r12, 0x10(%rcx)
movq 0xf1169(%rip), %r8      # 0x15d3a0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x103001
movq 0xe26f9(%rip), %rax     # 0x14e950
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorpd %xmm0, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm0, %xmm2
movapd %xmm2, %xmm0
callq 0x93c0
movq %rbx, %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe101
movapd %xmm3, %xmm1
addsd %xmm4, %xmm1
ucomisd %xmm1, %xmm1
jnp 0x6c178
movsd 0x8(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movsd 0x10(%rsp), %xmm3
movsd %xmm5, (%rsp)
callq 0x10e760
movsd (%rsp), %xmm5
jmp 0x6c178
ucomisd %xmm0, %xmm0
jnp 0x6c1ac
movapd 0xa6ae5(%rip), %xmm3    # 0x112dc0
xorpd 0x40(%rsp), %xmm3
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
callq 0x10e760
movapd %xmm1, %xmm0
jmp 0x6c1ac