// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::GLFaceRgbColorBufferObject() const
unsigned int R3Mesh::
GLFaceRgbColorBufferObject(void) const
{
  // Check if nothing to be done
  if (NFaces() == 0) return 0;

  // Update rgb color buffer
  if (vbo_face_rgb_color_buffer == 0) {
    glGenBuffers(1, (GLuint *) &vbo_face_rgb_color_buffer);
    if (vbo_face_rgb_color_buffer > 0) {
      std::vector<GLubyte> rgb_colors;
      for (int i = 0; i < NFaces(); i++) {
        R3MeshFace *face = Face(i);
        for (int j = 0; j < 3; j++){
          R3MeshVertex *vertex = VertexOnFace(face, j);
          const RNRgb& rgb_color = VertexColor(vertex);
          rgb_colors.push_back(255.0 * rgb_color.R());
          rgb_colors.push_back(255.0 * rgb_color.G());
          rgb_colors.push_back(255.0 * rgb_color.B());
          rgb_colors.push_back(255);
        }
      }
      glBindBuffer(GL_ARRAY_BUFFER, vbo_face_rgb_color_buffer);
      glBufferData(GL_ARRAY_BUFFER, rgb_colors.size() * sizeof(GLubyte), &rgb_colors[0], GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
  }

  // Return rgb color buffer identifier
  return vbo_face_rgb_color_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %eax, %eax
cmpl $0x0, 0x34(%rdi)
je 0x1785a
movq %rdi, %r14
movl 0x5c(%rdi), %eax
testl %eax, %eax
jne 0x1785a
leaq 0x5c(%r14), %rbx
movq 0xc287f(%rip), %rax     # 0xd9f98
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq *(%rax)
cmpl $0x0, (%rbx)
movl $0x0, %eax
je 0x1785a
movq %rbx, 0x10(%rsp)
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %r15
movapd %xmm0, (%r15)
andq $0x0, 0x10(%r15)
xorl %r13d, %r13d
movsd 0x7bac6(%rip), %xmm1    # 0x93218
leaq 0xf(%rsp), %r12
movq %r14, 0x18(%rsp)
movslq 0x34(%r14), %rax
cmpq %rax, %r13
jge 0x1780e
movq 0x28(%r14), %rax
movq (%rax,%r13,8), %rbx
pushq $0x1
popq %rbp
cmpq $0x4, %rbp
je 0x17801
movq (%rbx,%rbp,8), %r14
movsd 0x58(%r14), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
movsd 0x60(%r14), %xmm0
mulsd 0x7ba6b(%rip), %xmm0    # 0x93218
cvttsd2si %xmm0, %eax
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
movsd 0x68(%r14), %xmm0
mulsd 0x7ba4a(%rip), %xmm0    # 0x93218
cvttsd2si %xmm0, %eax
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
movb $-0x1, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
incq %rbp
movsd 0x7ba1c(%rip), %xmm1    # 0x93218
jmp 0x17774
incq %r13
movq 0x18(%rsp), %r14
jmp 0x1775c
movq 0xc279b(%rip), %rbx     # 0xd9fb0
movq 0x10(%rsp), %r14
movl (%r14), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *(%rbx)
movq 0xc279d(%rip), %rax     # 0xd9fc8
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rsi
subq %rdx, %rsi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq *(%rax)
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
callq *(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x23344
movl (%r14), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17871
jmp 0x17871
jmp 0x17871
jmp 0x17871
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x23344
movq %rbx, %rdi
callq 0xe810