// File: /workspace/github_c_makefile_star2_O3/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x8(%rsi), %rsi
movq 0x10(%rcx), %rdx
cmpb $0x1, (%rdx)
movzbl (%rsi), %eax
jne 0x675ec
leaq 0xe33eb(%rip), %rdi     # 0x14a9b0
cmpb $0x0, (%rax,%rdi)
je 0x67628
movq 0x8(%rdx), %r14
movzbl (%r14), %edx
cmpb $0x0, (%rdx,%rdi)
je 0x67640
cmpl $0xd, %eax
jne 0x676b7
movsd 0x8(%rsi), %xmm0
jmp 0x676cd
addl $-0xb, %eax
cmpl $0x3, %eax
ja 0x6769a
leaq 0xa03d5(%rip), %rcx     # 0x1079d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, 0x8(%rsi)
je 0x6774e
movq 0xe3416(%rip), %rdi     # 0x14aa30
leaq 0xa2a57(%rip), %rdx     # 0x10a078
callq 0xd498
jmp 0x6766a
movq 0xc08(%rbx), %rdx
movq %rbx, %rdi
movl $0xd, %r8d
movl $0x1, %r9d
jmp 0x67659
movq 0xc08(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movl $0xd, %r8d
movl $0x2, %r9d
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe42d
movsd 0x8(%rsi), %xmm0
callq 0x8150
jmp 0x67702
movsd 0x10(%rsi), %xmm1
xorpd %xmm0, %xmm0
mulsd %xmm1, %xmm0
addsd 0x8(%rsi), %xmm0
callq 0x8620
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xd387
movq 0xc08(%rbx), %rdx
movq 0xedcf8(%rip), %r8      # 0x1553a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xfa261
movq 0xe3372(%rip), %rdi     # 0x14aa30
leaq 0xa29b3(%rip), %rdx     # 0x10a078
callq 0xd498
movb (%r14), %dl
cmpb $0xd, %dl
jne 0x676da
movsd 0x8(%r14), %xmm1
jmp 0x676fd
movq 0xe334f(%rip), %rdi     # 0x14aa30
leaq 0xa2990(%rip), %rdx     # 0x10a078
movq %r14, %rsi
movsd %xmm0, (%rsp)
callq 0xd498
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
callq 0x84e0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6772b
movq %rbx, %rdi
movsd %xmm0, (%rsp)
callq 0xa550
movsd (%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)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0xdf1fb(%rip), %rax     # 0x146950
jmp 0x67746