// File: /workspace/github_c_makefile_star2_O1/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 0x74ece
cmpl $0xc, %eax
je 0x74e72
cmpl $0xb, %eax
jne 0x74f12
movzbl (%r8), %eax
cmpl $0xd, %eax
je 0x75103
cmpl $0xc, %eax
je 0x75084
cmpl $0xb, %eax
jne 0x74f2a
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x75115
movq 0x8(%r8), %rdx
movq %rsi, %rax
testq %rdx, %rdx
je 0x75143
cvtsi2sd %rcx, %xmm1
cvtsi2sd %rdx, %xmm0
jmp 0x75172
movzbl (%r8), %eax
cmpl $0xd, %eax
je 0x74fa3
cmpl $0xc, %eax
je 0x74f52
cmpl $0xb, %eax
jne 0x74f2a
movq 0x8(%r8), %rax
testq %rax, %rax
je 0x75115
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 0x75172
movsd 0x8(%rsi), %xmm1
movzbl (%r8), %eax
cmpl $0xd, %eax
je 0x750c4
cmpl $0xc, %eax
je 0x7503a
cmpl $0xb, %eax
jne 0x74f2a
ucomisd %xmm1, %xmm1
jp 0x75115
movq 0x8(%r8), %rcx
movq %rsi, %rax
testq %rcx, %rcx
je 0x75143
cvtsi2sd %rcx, %xmm0
jmp 0x75172
movq 0x1780(%rbx), %rdx
movq %rbx, %rdi
movl $0xd, %r8d
movl $0x1, %r9d
jmp 0x74f43
movq 0x1780(%rbx), %rdx
movq %rbx, %rdi
movq %r8, %rsi
movl $0xd, %r8d
movl $0x2, %r9d
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xf1ae
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 0x75172
movsd 0x8(%r8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x74fb9
jnp 0x75115
ucomisd %xmm0, %xmm0
movq %r8, %rax
jp 0x75143
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
je 0x7513c
ucomisd 0x9a10d(%rip), %xmm0    # 0x10f0f8
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rdx
jne 0x74ffb
jnp 0x751b9
ucomisd 0x9a0fd(%rip), %xmm0    # 0x10f100
jne 0x7500b
jnp 0x751b9
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 0x75172
ucomisd %xmm1, %xmm1
movq %rsi, %rax
jp 0x75143
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 0x75172
movq 0x8(%rsi), %rcx
movq %rsi, %rax
testq %rcx, %rcx
je 0x75143
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 0x75172
ucomisd %xmm1, %xmm1
jp 0x75115
movsd 0x8(%r8), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movq %rsi, %rax
jne 0x750df
jnp 0x75143
ucomisd %xmm0, %xmm0
movq %r8, %rax
jp 0x75143
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
je 0x7513c
jmp 0x75172
movsd 0x8(%r8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7511a
jp 0x7511a
movq %rsi, %rax
jmp 0x75143
ucomisd %xmm0, %xmm0
movq %r8, %rax
jp 0x75143
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x7514e
movq 0xe0d55(%rip), %rax     # 0x155e98
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
ucomisd 0x99fa2(%rip), %xmm0    # 0x10f0f8
movq 0x8(%rsi), %r14
jne 0x7515e
jnp 0x751d1
ucomisd 0x99f9a(%rip), %xmm0    # 0x10f100
jne 0x7516a
jnp 0x751d1
xorps %xmm1, %xmm1
cvtsi2sd %r14, %xmm1
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, (%rsp)
callq 0x92f0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x95e0
movsd (%rsp), %xmm1
mulsd %xmm0, %xmm1
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xe101
negq %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0x103338
negq %r14
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x751ed
leaq 0xd976c(%rip), %rax     # 0x14e950
movq (%rax,%r14,8), %rax
jmp 0x75143
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x75205
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0x75143