// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::DrawVertices(gaps::RNFlags) const
void R3Mesh::
DrawVertices(const RNFlags draw_flags) const
{
  // Bind position buffer
  if (GLVertexPositionBufferObject() <= 0) return;
  glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_position_buffer);
  glVertexPointer(3, GL_FLOAT, 0, 0);
  glEnableClientState(GL_VERTEX_ARRAY);
  
  // Bind vertex normal buffer
  if (draw_flags[R3_VERTEX_NORMALS_DRAW_FLAG]) {
    if (GLVertexNormalBufferObject() > 0) {
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_normal_buffer);
      glNormalPointer(GL_FLOAT, 0, 0);
      glEnableClientState(GL_NORMAL_ARRAY);
    }
  }
  
  // Bind vertex texcoord buffer
  if (draw_flags & R3_VERTEX_TEXTURE_COORDS_DRAW_FLAG) {  
    if (GLVertexTextureCoordBufferObject() > 0) {
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_texcoord_buffer);
      glTexCoordPointer(2, GL_FLOAT, 0, 0);
      glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    }
  }
  
  // Bind vertex color buffer
  if (draw_flags[R3_VERTEX_PICK_DRAW_FLAG]) {
    if (GLVertexPickColorBufferObject() > 0) {
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_pick_color_buffer);
      glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
      glEnableClientState(GL_COLOR_ARRAY);
    }
  }
  else if (draw_flags[R3_VERTEX_COLORS_DRAW_FLAG]) {
    if (GLVertexRgbColorBufferObject() > 0) {
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_rgb_color_buffer);
      glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
      glEnableClientState(GL_COLOR_ARRAY);
    }
  }
  
  // Draw vertices
  glDrawArrays(GL_POINTS, 0, NVertices());

  // Reset everything
  glBindBuffer(GL_ARRAY_BUFFER, 0);
  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_NORMAL_ARRAY);
  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  glDisableClientState(GL_COLOR_ARRAY);
}

// Assembly:
subq $0x38, %rsp
movq %rsi, 0x30(%rsp)
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq (%rdi), %rax
callq *0x268(%rax)
cmpl $0x0, %eax
ja 0x23bbb
jmp 0x23df0
movq 0x8(%rsp), %rcx
movq 0x14b3f9(%rip), %rax    # 0x16efc0
movq (%rax), %rax
movl 0x64(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
movl $0x3, %edi
movl $0x1406, %esi           # imm = 0x1406
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0xf4f0
movl $0x8074, %edi           # imm = 0x8074
callq 0xf2f0
leaq 0x20(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x13d80
movq 0x20(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
je 0x23c5e
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x270(%rax)
cmpl $0x0, %eax
jbe 0x23c5c
movq 0x8(%rsp), %rcx
movq 0x14b38b(%rip), %rax    # 0x16efc0
movq (%rax), %rax
movl 0x68(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
movl $0x1406, %edi           # imm = 0x1406
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0xf870
movl $0x8075, %edi           # imm = 0x8075
callq 0xf2f0
jmp 0x23c5e
leaq 0x30(%rsp), %rdi
callq 0x13de0
andq $0x200, %rax            # imm = 0x200
cmpq $0x0, %rax
je 0x23cc1
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x278(%rax)
cmpl $0x0, %eax
jbe 0x23cbf
movq 0x8(%rsp), %rcx
movq 0x14b32d(%rip), %rax    # 0x16efc0
movq (%rax), %rax
movl 0x6c(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
movl $0x2, %edi
movl $0x1406, %esi           # imm = 0x1406
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0xf9b0
movl $0x8078, %edi           # imm = 0x8078
callq 0xf2f0
jmp 0x23cc1
leaq 0x18(%rsp), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x13d80
movq 0x18(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
je 0x23d31
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x288(%rax)
cmpl $0x0, %eax
jbe 0x23d2f
movq 0x8(%rsp), %rcx
movq 0x14b2bd(%rip), %rax    # 0x16efc0
movq (%rax), %rax
movl 0x74(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
movl $0x4, %edi
movl $0x1401, %esi           # imm = 0x1401
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0xf4e0
movl $0x8076, %edi           # imm = 0x8076
callq 0xf2f0
jmp 0x23da3
leaq 0x10(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x13d80
movq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x13d50
cmpl $0x0, %eax
je 0x23da1
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x280(%rax)
cmpl $0x0, %eax
jbe 0x23d9f
movq 0x8(%rsp), %rcx
movq 0x14b24d(%rip), %rax    # 0x16efc0
movq (%rax), %rax
movl 0x70(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
movl $0x4, %edi
movl $0x1401, %esi           # imm = 0x1401
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0xf4e0
movl $0x8076, %edi           # imm = 0x8076
callq 0xf2f0
jmp 0x23da1
jmp 0x23da3
movq 0x8(%rsp), %rdi
callq 0x135e0
movl %eax, %edx
xorl %esi, %esi
movl %esi, %edi
callq 0xf060
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
movq 0x14b1fa(%rip), %rax    # 0x16efc0
callq *(%rax)
movl $0x8074, %edi           # imm = 0x8074
callq 0xf2c0
movl $0x8075, %edi           # imm = 0x8075
callq 0xf2c0
movl $0x8078, %edi           # imm = 0x8078
callq 0xf2c0
movl $0x8076, %edi           # imm = 0x8076
callq 0xf2c0
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)