// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Draw.cpp
// Function: gaps::R3Cylinder::Draw(gaps::RNFlags) const
void R3Cylinder::
Draw(const R3DrawFlags draw_flags) const
{
#if (RN_3D_GRFX == RN_OPENGL)
    // Create GLU quadric
    static GLUquadricObj *cylinder = gluNewQuadric();

    // Push matrix
    R4Matrix matrix = R4identity_matrix;
    matrix.Translate(axis.Start().Vector());
    matrix.Rotate(R3posz_vector, axis.Vector());
    matrix.Push();

    // Draw surface
    if (draw_flags[R3_SURFACES_DRAW_FLAG]) {
	if (draw_flags[R3_VERTEX_NORMALS_DRAW_FLAG]) gluQuadricNormals(cylinder, (GLenum) GLU_SMOOTH);
	else if (draw_flags[R3_SURFACE_NORMALS_DRAW_FLAG]) gluQuadricNormals(cylinder, (GLenum) GLU_FLAT);
	if (draw_flags[R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG]) gluQuadricTexture(cylinder, GL_TRUE);
	else gluQuadricTexture(cylinder, GL_FALSE);
	gluQuadricDrawStyle(cylinder, (GLenum) GLU_FILL);
	gluCylinder(cylinder, base.Radius(), top.Radius(), Height(), 16, 1);
	gluQuadricOrientation(cylinder, (GLenum) GLU_INSIDE);
	gluDisk(cylinder, 0.0, Radius(), 16, 1);
	gluQuadricOrientation(cylinder, (GLenum) GLU_OUTSIDE);
	glTranslated(0.0, 0.0, Height());
	gluDisk(cylinder, 0.0, Radius(), 16, 1);
    }

    // Draw edges
    if (draw_flags[R3_EDGES_DRAW_FLAG]) {
	gluQuadricNormals(cylinder, (GLenum) GLU_NONE);
	gluQuadricTexture(cylinder, GL_FALSE);
	gluQuadricDrawStyle(cylinder, (GLenum) GLU_SILHOUETTE);
	gluCylinder(cylinder, base.Radius(), top.Radius(), Height(), 16, 1);
    }

    // Pop matrix
    matrix.Pop();
#else
    RNAbort("Not Implemented");
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movb 0x4a4cce(%rip), %al     # 0x4e6d10
testb %al, %al
je 0x421f9
leaq 0x60def(%rip), %rsi     # 0xa2e40
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x2c5ba
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
movq %rsp, %r12
movq %r12, %rdi
callq 0x3d4be
movq %r15, %rdi
movq %r12, %rsi
callq 0x2d6f4
leaq 0x20(%rbx), %rdx
leaq 0x666b2(%rip), %rsi     # 0xa8740
movq %r15, %rdi
callq 0x2dee0
movq %r15, %rdi
callq 0x40928
testb $0x2, %r14b
je 0x42187
movl $0x186a0, %esi          # imm = 0x186A0
btl $0x8, %r14d
jb 0x420bf
movl $0x186a1, %esi          # imm = 0x186A1
testb $0x20, %r14b
je 0x420cb
movq 0x4a4c42(%rip), %rdi    # 0x4e6d08
callq 0xe1d0
movl %r14d, %esi
shrl $0x9, %esi
movq 0x4a4c30(%rip), %rdi    # 0x4e6d08
andl $0x1, %esi
callq 0xe830
movq 0x4a4c21(%rip), %rdi    # 0x4e6d08
movl $0x186ac, %esi          # imm = 0x186AC
callq 0xe770
movq 0x4a4c10(%rip), %rdi    # 0x4e6d08
movsd 0x50(%rbx), %xmm2
movsd 0x78(%rbx), %xmm0
movsd 0xc0(%rbx), %xmm1
movl $0x10, %esi
movl $0x1, %edx
callq 0xe090
movq 0x4a4be8(%rip), %rdi    # 0x4e6d08
movl $0x186b5, %esi          # imm = 0x186B5
callq 0xe150
movq 0x4a4bd7(%rip), %rdi    # 0x4e6d08
movsd 0x78(%rbx), %xmm1
xorps %xmm0, %xmm0
movl $0x10, %esi
movl $0x1, %edx
callq 0xe4b0
movq 0x4a4bb9(%rip), %rdi    # 0x4e6d08
movl $0x186b4, %esi          # imm = 0x186B4
callq 0xe150
movsd 0x50(%rbx), %xmm2
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0xe4a0
movq 0x4a4b98(%rip), %rdi    # 0x4e6d08
movsd 0x78(%rbx), %xmm1
xorps %xmm0, %xmm0
movl $0x10, %esi
movl $0x1, %edx
callq 0xe4b0
testb $0x1, %r14b
je 0x421e5
movq 0x4a4b74(%rip), %rdi    # 0x4e6d08
movl $0x186a2, %esi          # imm = 0x186A2
callq 0xe1d0
movq 0x4a4b63(%rip), %rdi    # 0x4e6d08
xorl %esi, %esi
callq 0xe830
movq 0x4a4b55(%rip), %rdi    # 0x4e6d08
movl $0x186ad, %esi          # imm = 0x186AD
callq 0xe770
movq 0x4a4b44(%rip), %rdi    # 0x4e6d08
movsd 0x50(%rbx), %xmm2
movsd 0x78(%rbx), %xmm0
movsd 0xc0(%rbx), %xmm1
movl $0x10, %esi
movl $0x1, %edx
callq 0xe090
callq 0xe850
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x4a4b10(%rip), %rdi    # 0x4e6d10
callq 0xe810
testl %eax, %eax
je 0x4204a
callq 0xe500
movq %rax, 0x4a4aef(%rip)    # 0x4e6d08
leaq 0x4a4af0(%rip), %rdi    # 0x4e6d10
callq 0xe2e0
jmp 0x4204a
movq %rax, %rbx
leaq 0x4a4adc(%rip), %rdi    # 0x4e6d10
callq 0xe2d0
movq %rbx, %rdi
callq 0xe7e0
nop