// File: /workspace/github_cpp_makefile_star2_O1/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, %ebp
movl %edi, 0xc(%rsp)
cmpl $0x2, %esi
movl $0x1, %r15d
cmovgel %esi, %r15d
movapd %xmm0, 0x50(%rsp)
mulsd %xmm0, %xmm0
movapd %xmm1, %xmm4
mulsd %xmm1, %xmm4
addsd %xmm0, %xmm4
sqrtsd %xmm4, %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
movapd %xmm2, %xmm3
movapd %xmm1, 0x40(%rsp)
jae 0xd89d6
movapd %xmm4, %xmm0
movsd %xmm2, 0x20(%rsp)
movapd %xmm4, 0x10(%rsp)
callq 0x216c0
movapd 0x10(%rsp), %xmm4
movsd 0x20(%rsp), %xmm2
movapd 0x40(%rsp), %xmm1
movapd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
jae 0xd89fb
movapd %xmm4, %xmm0
movsd %xmm3, 0x10(%rsp)
callq 0x216c0
movsd 0x10(%rsp), %xmm3
movapd 0x40(%rsp), %xmm1
movapd %xmm0, %xmm2
leaq 0x6b7be(%rip), %rax     # 0x1441c0
cmpb $0x0, 0x1c(%rax)
movapd 0x50(%rsp), %xmm0
jne 0xd8a47
leaq 0x12b51(%rip), %rdi     # 0xeb566
leaq 0x24539(%rip), %rsi     # 0xfcf55
xorl %eax, %eax
movsd %xmm2, 0x20(%rsp)
movsd %xmm3, 0x10(%rsp)
callq 0xd1cf7
movsd 0x10(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
movapd 0x50(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
divsd %xmm3, %xmm1
movapd %xmm1, 0x60(%rsp)
divsd %xmm2, %xmm0
movapd %xmm0, 0x10(%rsp)
movl 0xc(%rsp), %ebx
movl %ebx, %edx
negl %edx
leaq 0x38(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xd81be
movl %ebx, %r14d
testl %ebp, %ebp
jle 0xd8b64
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movapd 0x40(%rsp), %xmm1
unpcklpd 0x50(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %r12
xorpd %xmm2, %xmm2
shufpd $0x2, %xmm1, %xmm2      # xmm2 = xmm2[0],xmm1[1]
divpd %xmm0, %xmm1
movapd %xmm1, 0x70(%rsp)
xorl %r13d, %r13d
movapd %xmm2, 0x20(%rsp)
movl $0x2, %edi
callq 0x21190
cmpl $0x0, 0xc(%rsp)
movapd 0x10(%rsp), %xmm2
jle 0xd8b37
movaps 0x20(%rsp), %xmm1
movhlps %xmm1, %xmm1            # xmm1 = xmm1[1,1]
movaps %xmm1, 0x80(%rsp)
xorl %ebx, %ebx
movsd (%r15,%rbx,8), %xmm0
mulsd %xmm2, %xmm0
movsd (%r12,%rbx,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x60(%rsp), %xmm2
callq 0x21310
movsd (%r15,%rbx,8), %xmm0
movapd 0x80(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r12,%rbx,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x21e70
movapd 0x10(%rsp), %xmm2
incq %rbx
cmpq %rbx, %r14
jne 0xd8ae4
callq 0x21c60
movapd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm0
movapd 0x70(%rsp), %xmm1
addpd %xmm1, %xmm0
subpd %xmm1, %xmm2
movsd %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1]
incl %r13d
cmpl %ebp, %r13d
jne 0xd8ab5
movl $0x1, %edi
callq 0x21190
cmpl $0x0, 0xc(%rsp)
movapd 0x10(%rsp), %xmm2
jle 0xd8be9
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %r15
xorl %r12d, %r12d
movsd (%rbx,%r12,8), %xmm0
mulsd %xmm2, %xmm0
movsd (%r15,%r12,8), %xmm1
mulsd %xmm2, %xmm1
movaps 0x60(%rsp), %xmm2
callq 0x21310
movsd (%rbx,%r12,8), %xmm0
movapd 0x50(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd (%r15,%r12,8), %xmm1
mulsd %xmm2, %xmm1
xorpd %xmm2, %xmm2
callq 0x21e70
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movaps 0x40(%rsp), %xmm2
callq 0x21e70
movapd 0x10(%rsp), %xmm2
incq %r12
cmpq %r12, %r14
jne 0xd8b88
callq 0x21c60
movq 0x38(%rsp), %rdi
callq 0x21ae0
movq 0x30(%rsp), %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21ae0