// File: /workspace/github_c_makefile_star2_O2/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), %r10
movzbl (%rsi), %eax
cmpl $0xd, %eax
je 0x5a1bd
cmpl $0xc, %eax
je 0x5a161
cmpl $0xb, %eax
jne 0x5a201
movzbl (%r10), %eax
cmpl $0xd, %eax
je 0x5a3ea
cmpl $0xc, %eax
je 0x5a36b
cmpl $0xb, %eax
jne 0x5a215
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x5a3fc
movq 0x8(%r10), %rdx
movq %rsi, %rax
testq %rdx, %rdx
je 0x5a42a
cvtsi2sd %rcx, %xmm1
cvtsi2sd %rdx, %xmm0
jmp 0x5a456
movzbl (%r10), %eax
cmpl $0xd, %eax
je 0x5a28a
cmpl $0xc, %eax
je 0x5a239
cmpl $0xb, %eax
jne 0x5a215
movq 0x8(%r10), %rax
testq %rax, %rax
je 0x5a3fc
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 0x5a456
movsd 0x8(%rsi), %xmm1
movzbl (%r10), %eax
cmpl $0xd, %eax
je 0x5a3ab
cmpl $0xc, %eax
je 0x5a321
cmpl $0xb, %eax
jne 0x5a215
ucomisd %xmm1, %xmm1
jp 0x5a3fc
movq 0x8(%r10), %rcx
movq %rsi, %rax
testq %rcx, %rcx
je 0x5a42a
cvtsi2sd %rcx, %xmm0
jmp 0x5a456
movq 0x1780(%rbx), %rdx
pushq $0xd
popq %r8
pushq $0x1
popq %r9
movq %rbx, %rdi
jmp 0x5a22a
movq 0x1780(%rbx), %rdx
pushq $0xd
popq %r8
pushq $0x2
popq %r9
movq %rbx, %rdi
movq %r10, %rsi
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xcd70
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(%r10), %rax
movq 0x10(%r10), %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 0x5a456
movsd 0x8(%r10), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x5a2a0
jnp 0x5a3fc
ucomisd %xmm0, %xmm0
movq %r10, %rax
jp 0x5a42a
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
je 0x5a423
ucomisd 0x77db6(%rip), %xmm0    # 0xd2088
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rdx
jne 0x5a2e2
jnp 0x5a49d
ucomisd 0x77e06(%rip), %xmm0    # 0xd20f0
jne 0x5a2f2
jnp 0x5a49d
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 0x5a456
ucomisd %xmm1, %xmm1
movq %rsi, %rax
jp 0x5a42a
movq 0x8(%r10), %rax
movq 0x10(%r10), %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 0x5a456
movq 0x8(%rsi), %rcx
movq %rsi, %rax
testq %rcx, %rcx
je 0x5a42a
cvtsi2sd %rcx, %xmm1
movq 0x8(%r10), %rax
movq 0x10(%r10), %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 0x5a456
ucomisd %xmm1, %xmm1
jp 0x5a3fc
movsd 0x8(%r10), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movq %rsi, %rax
jne 0x5a3c6
jnp 0x5a42a
ucomisd %xmm0, %xmm0
movq %r10, %rax
jp 0x5a42a
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
je 0x5a423
jmp 0x5a456
movsd 0x8(%r10), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x5a401
jp 0x5a401
movq %rsi, %rax
jmp 0x5a42a
ucomisd %xmm0, %xmm0
movq %r10, %rax
jp 0x5a42a
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x5a435
movq 0xc2a6e(%rip), %rax     # 0x11ce98
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
ucomisd 0x77c4b(%rip), %xmm0    # 0xd2088
movq 0x8(%rsi), %r14
jne 0x5a445
jnp 0x5a4b5
ucomisd 0x77ca3(%rip), %xmm0    # 0xd20f0
jne 0x5a451
jnp 0x5a4b5
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 0xc152
negq %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0xa8, %rsp
popq %rbx
popq %r14
jmp 0xc761f
negq %r14
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0x5a4d1
leaq 0xbb488(%rip), %rax     # 0x115950
movq (%rax,%r14,8), %rax
jmp 0x5a42a
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x5a4f0
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0x5a42a