// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/fglut/freeglut_geometry.c
// Function: glutWireCone
void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLint stacks)
{
    int i,j;

    /* Step in z and radius as stacks are drawn. */

    double z = 0.0;
    double r = base;

    const double zStep = height / ( ( stacks > 0 ) ? stacks : 1 );
    const double rStep = base / ( ( stacks > 0 ) ? stacks : 1 );

    /* Scaling factors for vertex normals */

    const double cosn = ( height / sqrt ( height * height + base * base ));
    const double sinn = ( base   / sqrt ( height * height + base * base ));

    /* Pre-computed circle */

    double *sint,*cost;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireCone" );

    fghCircleTable(&sint,&cost,-slices);

    /* Draw the stacks... */

    for (i=0; i<stacks; i++)
    {
        glBegin(GL_LINE_LOOP);

            for( j=0; j<slices; j++ )
            {
                glNormal3d(cost[j]*sinn, sint[j]*sinn, cosn);
                glVertex3d(cost[j]*r,    sint[j]*r,    z   );
            }

        glEnd();

        z += zStep;
        r -= rStep;
    }

    /* Draw the slices */

    r = base;

    glBegin(GL_LINES);

        for (j=0; j<slices; j++)
        {
            glNormal3d(cost[j]*sinn, sint[j]*sinn, cosn  );
            glVertex3d(cost[j]*r,    sint[j]*r,    0.0   );
            glVertex3d(0.0,          0.0,          height);
        }

    glEnd();

    /* Release sin and cos tables */

    free(sint);
    free(cost);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movl %edi, %ebx
cmpl $0x2, %esi
pushq $0x1
popq %rax
cmovgel %esi, %eax
cvtsi2sd %eax, %xmm5
movapd %xmm1, %xmm4
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
movapd %xmm1, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm3
leaq 0x71c38(%rip), %rax     # 0x1331e0
cmpb $0x0, 0x1c(%rax)
movapd %xmm0, 0x30(%rsp)
movapd %xmm1, 0x40(%rsp)
movapd %xmm4, (%rsp)
jne 0xc15fd
leaq 0x12ca0(%rip), %rdi     # 0xd4266
leaq 0x24648(%rip), %rsi     # 0xe5c15
xorl %eax, %eax
movapd %xmm5, 0x20(%rsp)
movsd %xmm3, 0x10(%rsp)
callq 0xbad73
movsd 0x10(%rsp), %xmm3
movapd 0x20(%rsp), %xmm5
movapd (%rsp), %xmm4
movapd 0x30(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
movapd %xmm4, %xmm2
divpd %xmm5, %xmm2
movapd %xmm2, 0x50(%rsp)
divsd %xmm3, %xmm1
movapd %xmm1, 0x20(%rsp)
divsd %xmm3, %xmm0
movapd %xmm0, 0x10(%rsp)
movl %ebx, %edx
negl %edx
leaq 0x80(%rsp), %r15
leaq 0x78(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xc0eee
xorl %r13d, %r13d
testl %ebx, %ebx
cmovlel %r13d, %ebx
movq (%r14), %r14
testl %ebp, %ebp
cmovlel %r13d, %ebp
movq (%r15), %r15
xorpd %xmm0, %xmm0
shufpd $0x2, (%rsp), %xmm0     # xmm0 = xmm0[0],mem[1]
movapd %xmm0, (%rsp)
cmpl %ebp, %r13d
je 0xc16fe
pushq $0x2
popq %rdi
callq 0x21190
movaps (%rsp), %xmm0
movhlps %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movaps %xmm0, 0x60(%rsp)
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0xc16d1
movsd (%r14,%r12,8), %xmm0
movapd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r15,%r12,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x21300
movsd (%r14,%r12,8), %xmm0
movapd 0x60(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r15,%r12,8), %xmm1
mulsd %xmm2, %xmm1
movapd (%rsp), %xmm2
callq 0x21e80
incq %r12
jmp 0xc167f
callq 0x21c60
movapd (%rsp), %xmm2
movapd %xmm2, %xmm0
movapd 0x50(%rsp), %xmm1
addpd %xmm1, %xmm0
subpd %xmm1, %xmm2
movsd %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1]
movapd %xmm2, (%rsp)
incl %r13d
jmp 0xc165f
pushq $0x1
popq %rdi
callq 0x21190
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0xc176d
movsd (%r14,%r12,8), %xmm0
movapd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r15,%r12,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x21300
movsd (%r14,%r12,8), %xmm0
movapd 0x30(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r15,%r12,8), %xmm1
mulsd %xmm2, %xmm1
xorpd %xmm2, %xmm2
callq 0x21e80
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movapd 0x40(%rsp), %xmm2
callq 0x21e80
incq %r12
jmp 0xc1709
callq 0x21c60
movq %r15, %rdi
callq 0x21ad0
movq %r14, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21ad0