// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_atanh
static s7_pointer g_atanh(s7_scheme *sc, s7_pointer args)
    {
#define H_atanh "(atanh z) returns atanh(z)"
#define Q_atanh sc->pl_nn
        s7_pointer x;
        x = car(args);
        switch (type(x))
        {
            case T_INTEGER:
                if (integer(x) == 0) return(small_int(0));                    /* (atanh 0) -> 0 */

            case T_REAL:
            case T_RATIO:
                {
                    double x1;
                    x1 = s7_real(x);
                    if (fabs(x1) < 1.0)
                        return(make_real(sc, atanh(x1)));
                }

                /* if we can't distinguish x from 1.0 even with long doubles, we'll get inf.0:
                 *    (atanh 9223372036854775/9223372036854776) -> 18.714973875119
                 *    (atanh 92233720368547758/92233720368547757) -> inf.0
                 */
            case T_COMPLEX:
#if HAVE_COMPLEX_NUMBERS
#if (defined(__OpenBSD__)) || (defined(__NetBSD__))
                return(s7_from_c_complex(sc, catanh_1(s7_to_c_complex(x))));
#else
                return(s7_from_c_complex(sc, catanh(s7_to_c_complex(x))));
#endif
#else
                return(out_of_range(sc, sc->atanh_symbol, small_int(1), x, no_complex_numbers_string));
#endif

            default:
                return(method_or_bust_with_type_one_arg(sc, x, sc->atanh_symbol, list_1(sc, x), a_number_string));
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %r14
movzbl (%r14), %eax
leal -0xb(%rax), %ecx
cmpl $0x3, %ecx
ja 0x6cf1d
leaq 0xa3b8c(%rip), %rdx     # 0x1109b4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpq $0x0, 0x8(%r14)
je 0x6cf88
cmpb $0xd, %al
jne 0x6ce48
movsd 0x8(%r14), %xmm0
jmp 0x6ce5e
movq 0xe5be1(%rip), %rdi     # 0x152a30
leaq 0xa6112(%rip), %rdx     # 0x112f68
movq %r14, %rsi
callq 0xe212
movapd 0xa5f6a(%rip), %xmm1    # 0x112dd0
andpd %xmm0, %xmm1
movsd 0xa21be(%rip), %xmm2    # 0x10f030
ucomisd %xmm1, %xmm2
jbe 0x6ced7
movapd %xmm1, 0x10(%rsp)
callq 0x9080
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6cea7
movq %rbx, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0xb389
movsd 0x8(%rsp), %xmm0
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xd, (%rax)
movsd %xmm0, 0x8(%rax)
movapd 0x10(%rsp), %xmm1
movsd 0xa2159(%rip), %xmm2    # 0x10f030
ucomisd %xmm1, %xmm2
ja 0x6cf8f
movq %r14, %rdi
callq 0xefb9
xorpd %xmm2, %xmm2
cmpb $0xe, (%r14)
xorpd %xmm1, %xmm1
jne 0x6cefd
movsd 0x10(%r14), %xmm1
mulsd %xmm1, %xmm2
addsd %xmm2, %xmm0
callq 0x94d0
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe101
movq 0xc10(%rbx), %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x6cf43
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 0xf0431(%rip), %r8      # 0x15d3a0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x103001
movq 0xe19c1(%rip), %rax     # 0x14e950
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq