// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: g_make_polar
static s7_pointer g_make_polar(s7_scheme *sc, s7_pointer args)
    {
        s7_pointer x, y;
        s7_double ang, mag;
#define H_make_polar "(make-polar mag ang) returns a complex number with magnitude mag and angle ang"
#define Q_make_polar s7_make_signature(sc, 3, sc->is_number_symbol, sc->is_real_symbol, sc->is_real_symbol)

        x = car(args);
        y = cadr(args);

        switch (type(x))
        {
            case T_INTEGER:
                switch (type(y))
                {
                    case T_INTEGER:
                        if (integer(x) == 0) return(x);            /* (make-polar 0 1) -> 0 */
                        if (integer(y) == 0) return(x);            /* (make-polar 1 0) -> 1 */
                        mag = (s7_double)integer(x);
                        ang = (s7_double)integer(y);
                        break;

                    case T_RATIO:
                        if (integer(x) == 0) return(x);
                        mag = (s7_double)integer(x);
                        ang = (s7_double)fraction(y);
                        break;

                    case T_REAL:
                        ang = real(y);
                        if (ang == 0.0) return(x);
                        if (is_NaN(ang)) return(y);
                        if (is_inf(ang)) return(real_NaN);
                        if ((ang == M_PI) || (ang == -M_PI)) return(make_integer(sc, -integer(x)));
                        mag = (s7_double)integer(x);
                        break;

                    default:
                        return(method_or_bust(sc, y, sc->make_polar_symbol, args, T_REAL, 2));
                }
                break;

            case T_RATIO:
                switch (type(y))
                {
                    case T_INTEGER:
                        if (integer(y) == 0) return(x);
                        mag = (s7_double)fraction(x);
                        ang = (s7_double)integer(y);
                        break;

                    case T_RATIO:
                        mag = (s7_double)fraction(x);
                        ang = (s7_double)fraction(y);
                        break;

                    case T_REAL:
                        ang = real(y);
                        if (ang == 0.0) return(x);
                        if (is_NaN(ang)) return(y);
                        if (is_inf(ang)) return(real_NaN);
                        if ((ang == M_PI) || (ang == -M_PI)) return(make_simple_ratio(sc, -numerator(x), denominator(x)));
                        mag = (s7_double)fraction(x);
                        break;

                    default:
                        return(method_or_bust(sc, y, sc->make_polar_symbol, args, T_REAL, 2));
                }
                break;

            case T_REAL:
                mag = real(x);
                switch (type(y))
                {
                    case T_INTEGER:
                        if (is_NaN(mag)) return(x);
                        if (integer(y) == 0) return(x);
                        ang = (s7_double)integer(y);
                        break;

                    case T_RATIO:
                        if (is_NaN(mag)) return(x);
                        ang = (s7_double)fraction(y);
                        break;

                    case T_REAL:
                        if (is_NaN(mag)) return(x);
                        ang = real(y);
                        if (ang == 0.0) return(x);
                        if (is_NaN(ang)) return(y);
                        if (is_inf(ang)) return(real_NaN);
                        break;

                    default:
                        return(method_or_bust(sc, y, sc->make_polar_symbol, args, T_REAL, 2));
                }
                break;

            default:
                return(method_or_bust(sc, x, sc->make_polar_symbol, args, T_REAL, 1));
        }

        return(s7_make_complex(sc, mag * cos(ang), mag * sin(ang)));

        /* since sin is inaccurate for large arguments, so is make-polar:
         *    (make-polar 1.0 1e40) -> -0.76267273202438+0.64678458842683i, not 8.218988919070239214448025364432557517335E-1-5.696334009536363273080341815735687231337E-1i
         */
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x8(%rsi), %rsi
movq 0x10(%rcx), %rax
movq 0x8(%rax), %r8
movzbl (%rsi), %eax
cmpl $0xd, %eax
je 0x6f6d0
cmpl $0xc, %eax
je 0x6f674
cmpl $0xb, %eax
jne 0x6f714
movzbl (%r8), %eax
cmpl $0xd, %eax
je 0x6f905
cmpl $0xc, %eax
je 0x6f886
cmpl $0xb, %eax
jne 0x6f72c
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x6f917
movq 0x8(%r8), %rdx
movq %rsi, %rax
testq %rdx, %rdx
je 0x6f945
cvtsi2sd %rcx, %xmm1
cvtsi2sd %rdx, %xmm0
jmp 0x6f974
movzbl (%r8), %eax
cmpl $0xd, %eax
je 0x6f7a5
cmpl $0xc, %eax
je 0x6f754
cmpl $0xb, %eax
jne 0x6f72c
movq 0x8(%r8), %rax
testq %rax, %rax
je 0x6f917
movq 0x8(%rsi), %rcx
movq 0x10(%rsi), %rdx
movq %rcx, 0x40(%rsp)
fildll 0x40(%rsp)
movq %rdx, 0x38(%rsp)
fildll 0x38(%rsp)
fdivrp %st, %st(1)
fstpl 0x30(%rsp)
movsd 0x30(%rsp), %xmm1
cvtsi2sd %rax, %xmm0
jmp 0x6f974
movsd 0x8(%rsi), %xmm1
movzbl (%r8), %eax
cmpl $0xd, %eax
je 0x6f8c6
cmpl $0xc, %eax
je 0x6f83c
cmpl $0xb, %eax
jne 0x6f72c
ucomisd %xmm1, %xmm1
jp 0x6f917
movq 0x8(%r8), %rcx
movq %rsi, %rax
testq %rcx, %rcx
je 0x6f945
cvtsi2sd %rcx, %xmm0
jmp 0x6f974
movq 0x1780(%rbx), %rdx
movq %rbx, %rdi
movl $0xd, %r8d
movl $0x1, %r9d
jmp 0x6f745
movq 0x1780(%rbx), %rdx
movq %rbx, %rdi
movq %r8, %rsi
movl $0xd, %r8d
movl $0x2, %r9d
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xe42d
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, 0x60(%rsp)
fildll 0x60(%rsp)
movq %rcx, 0x58(%rsp)
fildll 0x58(%rsp)
fdivrp %st, %st(1)
fstpl 0x50(%rsp)
movsd 0x50(%rsp), %xmm1
movq 0x8(%r8), %rax
movq 0x10(%r8), %rcx
movq %rax, 0x70(%rsp)
fildll 0x70(%rsp)
movq %rcx, 0x68(%rsp)
fildll 0x68(%rsp)
fdivrp %st, %st(1)
fstpl 0x48(%rsp)
movsd 0x48(%rsp), %xmm0
jmp 0x6f974
movsd 0x8(%r8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6f7bb
jnp 0x6f917
ucomisd %xmm0, %xmm0
movq %r8, %rax
jp 0x6f945
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
je 0x6f93e
ucomisd 0x9690b(%rip), %xmm0    # 0x1060f8
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rdx
jne 0x6f7fd
jnp 0x6f9bb
ucomisd 0x968fb(%rip), %xmm0    # 0x106100
jne 0x6f80d
jnp 0x6f9bb
movq %rax, 0x80(%rsp)
fildll 0x80(%rsp)
movq %rdx, 0x88(%rsp)
fildll 0x88(%rsp)
fdivrp %st, %st(1)
fstpl 0x78(%rsp)
movsd 0x78(%rsp), %xmm1
jmp 0x6f974
ucomisd %xmm1, %xmm1
movq %rsi, %rax
jp 0x6f945
movq 0x8(%r8), %rax
movq 0x10(%r8), %rcx
movq %rax, 0xa0(%rsp)
fildll 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
fildll 0x98(%rsp)
fdivrp %st, %st(1)
fstpl 0x90(%rsp)
movsd 0x90(%rsp), %xmm0
jmp 0x6f974
movq 0x8(%rsi), %rcx
movq %rsi, %rax
testq %rcx, %rcx
je 0x6f945
cvtsi2sd %rcx, %xmm1
movq 0x8(%r8), %rax
movq 0x10(%r8), %rcx
movq %rax, 0x28(%rsp)
fildll 0x28(%rsp)
movq %rcx, 0x20(%rsp)
fildll 0x20(%rsp)
fdivrp %st, %st(1)
fstpl 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
jmp 0x6f974
ucomisd %xmm1, %xmm1
jp 0x6f917
movsd 0x8(%r8), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movq %rsi, %rax
jne 0x6f8e1
jnp 0x6f945
ucomisd %xmm0, %xmm0
movq %r8, %rax
jp 0x6f945
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
je 0x6f93e
jmp 0x6f974
movsd 0x8(%r8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6f91c
jp 0x6f91c
movq %rsi, %rax
jmp 0x6f945
ucomisd %xmm0, %xmm0
movq %r8, %rax
jp 0x6f945
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x6f950
movq 0xde553(%rip), %rax     # 0x14de98
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
ucomisd 0x967a0(%rip), %xmm0    # 0x1060f8
movq 0x8(%rsi), %r14
jne 0x6f960
jnp 0x6f9d3
ucomisd 0x96798(%rip), %xmm0    # 0x106100
jne 0x6f96c
jnp 0x6f9d3
xorps %xmm1, %xmm1
cvtsi2sd %r14, %xmm1
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, (%rsp)
callq 0x82f0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x85e0
movsd (%rsp), %xmm1
mulsd %xmm0, %xmm1
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xd387
negq %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xfa58d
negq %r14
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x6f9ef
leaq 0xd6f6a(%rip), %rax     # 0x146950
movq (%rax,%r14,8), %rax
jmp 0x6f945
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6fa0e
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0x6f945