// File: /workspace/github_c_makefile_star2_O2/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 0x52771
leaq 0x81304(%rip), %rcx     # 0xd39d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x528dd
cvtsi2sd %rax, %xmm0
jmp 0x5275e
movsd 0x8(%r14), %xmm0
jmp 0x5275e
movsd 0x8(%r14), %xmm1
movsd 0x10(%r14), %xmm2
movapd 0x837b7(%rip), %xmm0    # 0xd5ec0
xorpd %xmm3, %xmm3
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
andpd %xmm0, %xmm1
ucomisd 0x7f987(%rip), %xmm1    # 0xd20a8
ja 0x527dc
andpd %xmm2, %xmm0
ucomisd 0x7f975(%rip), %xmm0    # 0xd20a8
ja 0x527dc
movapd %xmm3, %xmm0
movapd %xmm2, %xmm1
callq 0x83c0
movq %rbx, %rdi
jmp 0x528cd
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 0xc77f0
movq 0xbe0(%rbx), %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x5279e
movq %rbx, %rdi
callq 0x9c27
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 0xd1bdd(%rip), %r8      # 0x1243a0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xc736d
movsd 0x7f84c(%rip), %xmm0    # 0xd2030
subsd %xmm3, %xmm0
movapd 0x836c0(%rip), %xmm1    # 0xd5eb0
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 0x7f811(%rip), %xmm0    # 0xd2030
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 0x528f0
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 0x5292c
callq 0x8740
movapd %xmm0, %xmm1
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xc152
movq 0xc306c(%rip), %rax     # 0x115950
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movapd %xmm3, %xmm1
addsd %xmm4, %xmm1
ucomisd %xmm1, %xmm1
jnp 0x5288a
movsd 0x18(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movsd 0x20(%rsp), %xmm3
movsd %xmm5, 0x8(%rsp)
callq 0xd1640
movsd 0x8(%rsp), %xmm5
jmp 0x5288a
ucomisd %xmm0, %xmm0
jnp 0x528bb
movapd 0x83576(%rip), %xmm3    # 0xd5eb0
xorpd 0x40(%rsp), %xmm3
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
callq 0xd1640
movapd %xmm1, %xmm0
jmp 0x528bb