// File: /workspace/github_cpp_makefile_star2_O3/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 $0x98, %rsp
movl %esi, %r15d
movl %edi, %ebp
cmpl $0x2, %esi
movl $0x1, %r13d
cmovgel %esi, %r13d
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
movapd %xmm1, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm2
leaq 0x6b78d(%rip), %rax     # 0x1421c0
cmpb $0x0, 0x1c(%rax)
movapd %xmm1, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
jne 0xd6a72
leaq 0x12b6a(%rip), %rdi     # 0xe95b6
leaq 0x24552(%rip), %rsi     # 0xfafa5
xorl %eax, %eax
movsd %xmm2, 0x10(%rsp)
callq 0xcfe73
movsd 0x10(%rsp), %xmm2
movapd 0x30(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
divsd %xmm2, %xmm1
movapd %xmm1, 0x50(%rsp)
divsd %xmm2, %xmm0
movapd %xmm0, 0x20(%rsp)
movl %ebp, %edx
negl %edx
leaq 0x90(%rsp), %rbx
leaq 0x88(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xd62bb
movq (%rbx), %r14
movq (%r12), %rbx
movl %ebp, %r12d
movl %r15d, 0xc(%rsp)
testl %r15d, %r15d
jle 0xd6b97
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movapd 0x40(%rsp), %xmm1
unpcklpd 0x30(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
xorpd %xmm2, %xmm2
shufpd $0x2, %xmm1, %xmm2      # xmm2 = xmm2[0],xmm1[1]
divpd %xmm0, %xmm1
movapd %xmm1, 0x60(%rsp)
xorl %r13d, %r13d
movapd %xmm2, 0x10(%rsp)
movl $0x2, %edi
callq 0x21190
movl %ebp, %r15d
testl %ebp, %ebp
movapd 0x20(%rsp), %xmm2
jle 0xd6b65
movaps 0x10(%rsp), %xmm1
movhlps %xmm1, %xmm1            # xmm1 = xmm1[1,1]
movaps %xmm1, 0x70(%rsp)
xorl %ebp, %ebp
movsd (%rbx,%rbp,8), %xmm0
mulsd %xmm2, %xmm0
movsd (%r14,%rbp,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x50(%rsp), %xmm2
callq 0x21310
movsd (%rbx,%rbp,8), %xmm0
movapd 0x70(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r14,%rbp,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x10(%rsp), %xmm2
callq 0x21e60
movapd 0x20(%rsp), %xmm2
incq %rbp
cmpq %rbp, %r12
jne 0xd6b17
callq 0x21c50
movapd 0x10(%rsp), %xmm2
movapd %xmm2, %xmm0
movapd 0x60(%rsp), %xmm1
addpd %xmm1, %xmm0
subpd %xmm1, %xmm2
movsd %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1]
incl %r13d
cmpl 0xc(%rsp), %r13d
movl %r15d, %ebp
jne 0xd6aeb
movl $0x1, %edi
callq 0x21190
testl %ebp, %ebp
movapd 0x20(%rsp), %xmm2
jle 0xd6c0f
xorl %r15d, %r15d
movsd (%rbx,%r15,8), %xmm0
mulsd %xmm2, %xmm0
movsd (%r14,%r15,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x50(%rsp), %xmm2
callq 0x21310
movsd (%rbx,%r15,8), %xmm0
movapd 0x30(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r14,%r15,8), %xmm1
mulsd %xmm2, %xmm1
xorpd %xmm2, %xmm2
callq 0x21e60
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movaps 0x40(%rsp), %xmm2
callq 0x21e60
movapd 0x20(%rsp), %xmm2
incq %r15
cmpq %r15, %r12
jne 0xd6bae
callq 0x21c50
movq %r14, %rdi
callq 0x21ad0
movq %rbx, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21ad0