// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_sin
static s7_pointer g_sin(s7_scheme *sc, s7_pointer args)
    {
#define H_sin "(sin z) returns sin(z)"
#define Q_sin sc->pl_nn

        s7_pointer x;
        x = car(args);
        switch (type(x))
        {
            case T_REAL:
                return(make_real(sc, sin(real(x))));

            case T_INTEGER:
                if (integer(x) == 0) return(small_int(0));                      /* (sin 0) -> 0 */
                return(make_real(sc, sin((s7_double)integer(x))));

            case T_RATIO:
                return(make_real(sc, sin((s7_double)(fraction(x)))));

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

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

        /* sin is totally inaccurate over about 1e18.  There's a way to get true results,
         *   but it involves fancy "range reduction" techniques.
         *   This means that lots of things are inaccurate:
         * (sin (remainder 1e22 (* 2 pi))) -> -0.57876806033477
         * but it should be -8.522008497671888065747423101326159661908E-1
         * ---
         * (remainder 1e22 (* 2 pi)) -> 1.0057952155665e+22 !!
         *   it should be 5.263007914620499494429139986095833592117E0
         */
    }

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rax
movzbl (%rax), %eax
addl $-0xb, %eax
movl %eax, %ecx
movq %rcx, 0x10(%rsp)
subl $0x3, %eax
ja 0x73a2e
movq 0x10(%rsp), %rax
leaq 0x16b2ab(%rip), %rcx    # 0x1dea00
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x98(%rsp), %rax
movsd 0x8(%rax), %xmm0
callq 0x95e0
movsd %xmm0, 0x88(%rsp)
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x737a6
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
movq $0xd, (%rax)
movsd 0x88(%rsp), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x73a69
movq 0x98(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x7383c
movq 0x1a2c51(%rip), %rax    # 0x216480
movq %rax, 0xb0(%rsp)
jmp 0x73a69
movq 0x98(%rsp), %rax
cvtsi2sdq 0x8(%rax), %xmm0
callq 0x95e0
movsd %xmm0, 0x70(%rsp)
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x73882
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq $0xd, (%rax)
movsd 0x70(%rsp), %xmm0
movq 0x78(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x73a69
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rcx, 0x28(%rsp)
fildll 0x28(%rsp)
movq %rax, 0x20(%rsp)
fildll 0x20(%rsp)
fdivrp %st, %st(1)
fstpl 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x95e0
movsd %xmm0, 0x58(%rsp)
movq 0xa8(%rsp), %rax
movq 0x90(%rax), %rax
movq 0xa8(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x73946
movq 0xa8(%rsp), %rdi
callq 0xc670
movq 0xa8(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq $0xd, (%rax)
movsd 0x58(%rsp), %xmm0
movq 0x60(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x73a69
movq 0xa8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x98(%rsp), %rax
movsd 0x8(%rax), %xmm1
movq 0x98(%rsp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm3, %xmm3
movaps %xmm0, %xmm2
mulsd %xmm3, %xmm2
movsd 0x16df8b(%rip), %xmm3   # 0x1e1968
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd %xmm0, 0x48(%rsp)
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
callq 0x9670
movq 0x8(%rsp), %rdi
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
callq 0x1bb560
movq %rax, 0xb0(%rsp)
jmp 0x73a69
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0xa8(%rsp), %rax
movq 0x14d8(%rax), %rdx
movq 0xa0(%rsp), %rcx
movq 0x1b1494(%rip), %r8     # 0x224ef0
callq 0x1ba7e0
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
addq $0xb8, %rsp
retq
nopl (%rax)