// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %r14
movzbl (%r14), %eax
addl $-0xb, %eax
cmpl $0x3, %eax
ja 0x670a4
leaq 0xa09b1(%rip), %rcx     # 0x1079b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x67210
cvtsi2sd %rax, %xmm0
jmp 0x67091
movsd 0x8(%r14), %xmm0
jmp 0x67091
movsd 0x8(%r14), %xmm1
movsd 0x10(%r14), %xmm2
movapd 0xa2e84(%rip), %xmm0    # 0x109ec0
xorpd %xmm3, %xmm3
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
andpd %xmm0, %xmm1
ucomisd 0x9f05c(%rip), %xmm1    # 0x1060b0
ja 0x6710f
andpd %xmm2, %xmm0
ucomisd 0x9f04a(%rip), %xmm0    # 0x1060b0
ja 0x6710f
movapd %xmm3, %xmm0
movapd %xmm2, %xmm1
callq 0x83c0
movq %rbx, %rdi
jmp 0x67200
cvtsi2sdq 0x8(%r14), %xmm0
cvtsi2sdq 0x10(%r14), %xmm1
divsd %xmm1, %xmm0
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xfa6e6
movq 0xbe0(%rbx), %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x670d1
movq %rbx, %rdi
callq 0xa550
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 0xee2aa(%rip), %r8      # 0x1553a0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xfa261
movsd 0x9ef19(%rip), %xmm0    # 0x106030
subsd %xmm3, %xmm0
movapd 0xa2d8d(%rip), %xmm1    # 0x109eb0
xorpd %xmm2, %xmm1
movapd %xmm2, 0x30(%rsp)
movsd %xmm3, 0x10(%rsp)
callq 0x8560
movsd %xmm0, 0x18(%rsp)
movapd %xmm1, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
addsd 0x9eede(%rip), %xmm0    # 0x106030
movapd 0x30(%rsp), %xmm1
callq 0x8560
movapd %xmm0, %xmm2
movsd 0x8(%r14), %xmm5
movsd 0x18(%rsp), %xmm3
movapd %xmm3, %xmm0
mulsd %xmm2, %xmm0
movapd 0x40(%rsp), %xmm6
movapd %xmm6, %xmm4
mulsd %xmm1, %xmm4
movsd %xmm1, 0x20(%rsp)
mulsd %xmm1, %xmm3
movsd %xmm0, 0x10(%rsp)
movsd %xmm4, 0x60(%rsp)
subsd %xmm4, %xmm0
ucomisd %xmm0, %xmm0
movapd %xmm6, %xmm4
movsd %xmm2, 0x28(%rsp)
mulsd %xmm2, %xmm4
movsd %xmm3, 0x30(%rsp)
movsd %xmm4, 0x58(%rsp)
jp 0x67223
divsd %xmm0, %xmm5
movapd %xmm5, %xmm0
callq 0x8150
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm1
addsd 0x60(%rsp), %xmm1
movsd 0x30(%rsp), %xmm0
subsd 0x58(%rsp), %xmm0
ucomisd %xmm1, %xmm1
jp 0x6725f
callq 0x8740
movapd %xmm0, %xmm1
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xd387
movq 0xdf739(%rip), %rax     # 0x146950
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movapd %xmm3, %xmm1
addsd %xmm4, %xmm1
ucomisd %xmm1, %xmm1
jnp 0x671bd
movsd 0x18(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movsd 0x20(%rsp), %xmm3
movsd %xmm5, 0x8(%rsp)
callq 0x1051d0
movsd 0x8(%rsp), %xmm5
jmp 0x671bd
ucomisd %xmm0, %xmm0
jnp 0x671ee
movapd 0xa2c43(%rip), %xmm3    # 0x109eb0
xorpd 0x40(%rsp), %xmm3
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
callq 0x1051d0
movapd %xmm1, %xmm0
jmp 0x671ee