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

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

          double z = 0.0;
    const double zStep = height / ( ( stacks > 0 ) ? stacks : 1 );

    /* Pre-computed circle */

    double *sint,*cost;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireCylinder" );

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

    /* Draw the stacks... */

    for (i=0; i<=stacks; i++)
    {
        if (i==stacks)
            z = height;

        glBegin(GL_LINE_LOOP);

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

        glEnd();

        z += zStep;
    }

    /* Draw the slices */

    glBegin(GL_LINES);

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

    glEnd();

    /* Release sin and cos tables */

    free(sint);
    free(cost);
}

// Assembly:
subq $0x58, %rsp
movsd %xmm0, 0x50(%rsp)
movsd %xmm1, 0x48(%rsp)
movl %edi, 0x44(%rsp)
movl %esi, 0x40(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
cmpl $0x0, 0x40(%rsp)
jle 0x18924e
movl 0x40(%rsp), %eax
movl %eax, 0xc(%rsp)
jmp 0x189259
movl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x189259
movsd 0x10(%rsp), %xmm0
movl 0xc(%rsp), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0x71118(%rip), %rax     # 0x1fa390
cmpb $0x0, 0x1c(%rax)
jne 0x189293
leaq 0x1464d(%rip), %rdi     # 0x19d8d2
leaq 0x2619f(%rip), %rsi     # 0x1af42b
movb $0x0, %al
callq 0x17de70
xorl %edx, %edx
subl 0x44(%rsp), %edx
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x188210
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x40(%rsp), %eax
jg 0x18937f
movl 0x3c(%rsp), %eax
cmpl 0x40(%rsp), %eax
jne 0x1892d4
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movl $0x2, %edi
callq 0x221b0
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x189358
movq 0x18(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x20(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorps %xmm2, %xmm2
callq 0x22330
movq 0x18(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
mulsd 0x50(%rsp), %xmm0
movq 0x20(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x50(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
callq 0x23020
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x1892e6
callq 0x22de0
movsd 0x28(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x1892b0
movl $0x1, %edi
callq 0x221b0
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x18943c
movq 0x18(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x20(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorps %xmm2, %xmm2
callq 0x22330
movq 0x18(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
mulsd 0x50(%rsp), %xmm0
movq 0x20(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x50(%rsp), %xmm1
xorps %xmm2, %xmm2
callq 0x23020
movq 0x18(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
mulsd 0x50(%rsp), %xmm0
movq 0x20(%rsp), %rax
movslq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd 0x50(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
callq 0x23020
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x189391
callq 0x22de0
movq 0x20(%rsp), %rdi
callq 0x22c30
movq 0x18(%rsp), %rdi
callq 0x22c30
addq $0x58, %rsp
retq
nopw (%rax,%rax)