// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_atan
static s7_pointer g_atan(s7_scheme *sc, s7_pointer args)
    {
#define H_atan "(atan z) returns atan(z), (atan y x) returns atan(y/x)"
#define Q_atan s7_make_signature(sc, 3, sc->is_number_symbol, sc->is_number_symbol, sc->is_real_symbol)
        /* actually if there are two args, both should be real, but how to express that in the signature? */
        s7_pointer x, y;
        s7_double x1, x2;

        /* currently (atan inf.0 inf.0) -> 0.78539816339745, and (atan inf.0 -inf.0) -> 2.3561944901923 (etc) */

        x = car(args);
        if (!is_pair(cdr(args)))
        {
            switch (type(x))
            {
                case T_INTEGER:
                    if (integer(x) == 0) return(small_int(0));                /* (atan 0) -> 0 */

                case T_RATIO:
                case T_REAL:
                    return(make_real(sc, atan(s7_real(x))));

                case T_COMPLEX:
#if HAVE_COMPLEX_NUMBERS
                    return(s7_from_c_complex(sc, catan(as_c_complex(x))));
#else
                    return(out_of_range(sc, sc->atan_symbol, small_int(1), x, no_complex_numbers_string));
#endif

                default:
                    return(method_or_bust_with_type_one_arg(sc, x, sc->atan_symbol, args, a_number_string));
            }
        }

        if (!s7_is_real(x))
            return(method_or_bust(sc, x, sc->atan_symbol, args, T_REAL, 1));

        y = cadr(args);
        if (!s7_is_real(y))
            return(method_or_bust(sc, y, sc->atan_symbol, args, T_REAL, 2));

        x1 = s7_real(x);
        x2 = s7_real(y);
        return(make_real(sc, atan2(x1, x2)));
    }

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x75097
movq 0x78(%rsp), %rax
movzbl (%rax), %eax
movl %eax, 0xc(%rsp)
subl $0xb, %eax
je 0x74f13
jmp 0x74ef3
movl 0xc(%rsp), %eax
addl $-0xc, %eax
subl $0x2, %eax
jb 0x74f35
jmp 0x74f01
movl 0xc(%rsp), %eax
subl $0xe, %eax
je 0x74fd5
jmp 0x7505a
movq 0x78(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x74f33
movq 0x1a155a(%rip), %rax    # 0x216480
movq %rax, 0x90(%rsp)
jmp 0x75209
jmp 0x74f35
movq 0x78(%rsp), %rdi
callq 0x128d0
callq 0x9150
movsd %xmm0, 0x50(%rsp)
movq 0x88(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x88(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x74f77
movq 0x88(%rsp), %rdi
callq 0xc670
movq 0x88(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq $0xd, (%rax)
movsd 0x50(%rsp), %xmm0
movq 0x58(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x75209
movq 0x88(%rsp), %rax
movq %rax, (%rsp)
movq 0x78(%rsp), %rax
movsd 0x8(%rax), %xmm1
movq 0x78(%rsp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm3, %xmm3
movaps %xmm0, %xmm2
mulsd %xmm3, %xmm2
movsd 0x16c961(%rip), %xmm3   # 0x1e1968
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm1
movsd %xmm1, 0x38(%rsp)
movsd %xmm0, 0x40(%rsp)
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
callq 0x9620
movq (%rsp), %rdi
movsd %xmm0, 0x28(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
callq 0x1bb560
movq %rax, 0x90(%rsp)
jmp 0x75209
movq 0x88(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x88(%rsp), %rax
movq 0xc08(%rax), %rdx
movq 0x80(%rsp), %rcx
movq 0x1afe6b(%rip), %r8     # 0x224ef0
callq 0x1ba7e0
movq %rax, 0x90(%rsp)
jmp 0x75209
movq 0x78(%rsp), %rdi
callq 0x11360
testb $0x1, %al
jne 0x750e7
movq 0x88(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x88(%rsp), %rax
movq 0xc08(%rax), %rdx
movq 0x80(%rsp), %rcx
movl $0xd, %r8d
movl $0x1, %r9d
callq 0x13c50
movq %rax, 0x90(%rsp)
jmp 0x75209
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdi
callq 0x11360
testb $0x1, %al
jne 0x7514c
movq 0x88(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x88(%rsp), %rax
movq 0xc08(%rax), %rdx
movq 0x80(%rsp), %rcx
movl $0xd, %r8d
movl $0x2, %r9d
callq 0x13c50
movq %rax, 0x90(%rsp)
jmp 0x75209
movq 0x78(%rsp), %rdi
callq 0x128d0
movsd %xmm0, 0x68(%rsp)
movq 0x70(%rsp), %rdi
callq 0x128d0
movsd %xmm0, 0x60(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
callq 0x94e0
movsd %xmm0, 0x18(%rsp)
movq 0x88(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x88(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x751b0
movq 0x88(%rsp), %rdi
callq 0xc670
movq 0x88(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq $0xd, (%rax)
movsd 0x18(%rsp), %xmm0
movq 0x20(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nopl (%rax)