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

    /* Adjust z and radius as stacks and slices are drawn. */

    double r;
    double x,y,z;

    /* Pre-computed circle */

    double *sint1,*cost1;
    double *sint2,*cost2;

    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWireSphere" );

    fghCircleTable(&sint1,&cost1,-slices  );
    fghCircleTable(&sint2,&cost2, stacks*2);

    /* Draw a line loop for each stack */

    for (i=1; i<stacks; i++)
    {
        z = cost2[i];
        r = sint2[i];

        glBegin(GL_LINE_LOOP);

            for(j=0; j<=slices; j++)
            {
                x = cost1[j];
                y = sint1[j];

                glNormal3d(x,y,z);
                glVertex3d(x*r*radius,y*r*radius,z*radius);
            }

        glEnd();
    }

    /* Draw a line loop for each slice */

    for (i=0; i<slices; i++)
    {
        glBegin(GL_LINE_STRIP);

            for(j=0; j<=stacks; j++)
            {
                x = cost1[i]*sint2[j];
                y = sint1[i]*sint2[j];
                z = cost2[j];

                glNormal3d(x,y,z);
                glVertex3d(x*radius,y*radius,z*radius);
            }

        glEnd();
    }

    /* Release sin and cos tables */

    free(sint1);
    free(cost1);
    free(sint2);
    free(cost2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebp
movl %edi, %ebx
movsd %xmm0, 0x28(%rsp)
leaq 0x721b8(%rip), %rax     # 0x1331e0
cmpb $0x0, 0x1c(%rax)
jne 0xc1043
leaq 0x13231(%rip), %rdi     # 0xd4266
leaq 0x24bba(%rip), %rsi     # 0xe5bf6
xorl %eax, %eax
callq 0xbad73
movl %ebx, %edx
negl %edx
leaq 0x60(%rsp), %r13
leaq 0x58(%rsp), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0xc0eee
leal (,%rbp,2), %edx
leaq 0x50(%rsp), %r15
leaq 0x48(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xc0eee
movq (%r14), %rax
movq %rax, 0x10(%rsp)
movq (%r15), %r15
movq (%r12), %r12
movq (%r13), %r13
movq %rbx, 0x8(%rsp)
movslq %ebx, %rbx
movslq %ebp, %rbp
pushq $0x1
popq %rcx
cmpq %rbp, %rcx
jge 0xc1154
movq 0x10(%rsp), %rax
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rsp)
movq %rcx, 0x30(%rsp)
movsd (%r15,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
pushq $0x2
popq %rdi
callq 0x21190
movsd (%rsp), %xmm0
mulsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
xorl %r14d, %r14d
cmpq %rbx, %r14
jg 0xc1142
movsd (%r12,%r14,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd (%r13,%r14,8), %xmm1
movsd %xmm1, 0x20(%rsp)
movsd (%rsp), %xmm2
callq 0x21300
movsd 0x40(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd 0x20(%rsp), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm3, %xmm1
movsd 0x38(%rsp), %xmm2
callq 0x21e80
incq %r14
jmp 0xc10de
callq 0x21c60
movq 0x30(%rsp), %rcx
incq %rcx
jmp 0xc1099
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
testl %eax, %eax
cmovlel %ebx, %eax
movq %rax, 0x8(%rsp)
cmpq 0x8(%rsp), %rbx
je 0xc11f2
pushq $0x3
popq %rdi
callq 0x21190
xorl %r14d, %r14d
cmpq %rbp, %r14
jg 0xc11e5
movsd (%r15,%r14,8), %xmm1
movsd (%r12,%rbx,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
mulsd (%r13,%rbx,8), %xmm1
movsd %xmm1, 0x18(%rsp)
movq 0x10(%rsp), %rax
movsd (%rax,%r14,8), %xmm2
movsd %xmm2, 0x20(%rsp)
callq 0x21300
movsd 0x28(%rsp), %xmm3
movsd (%rsp), %xmm0
mulsd %xmm3, %xmm0
movsd 0x18(%rsp), %xmm1
mulsd %xmm3, %xmm1
movsd 0x20(%rsp), %xmm2
mulsd %xmm3, %xmm2
callq 0x21e80
incq %r14
jmp 0xc117b
callq 0x21c60
incq %rbx
jmp 0xc1165
movq %r13, %rdi
callq 0x21ad0
movq %r12, %rdi
callq 0x21ad0
movq %r15, %rdi
callq 0x21ad0
movq 0x10(%rsp), %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21ad0