// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::GLFaceNormalBufferObject() const
unsigned int R3Mesh::
GLFaceNormalBufferObject(void) const
{
  // Check if nothing to be done
  if (NFaces() == 0) return 0;
  
  // Update normal buffer
  if (vbo_face_normal_buffer == 0) {
    glGenBuffers(1, (GLuint *) &vbo_face_normal_buffer);
    if (vbo_face_normal_buffer > 0) {
      std::vector<GLfloat> normals;
      for (int i = 0; i < NFaces(); i++) {
        R3MeshFace *face = Face(i);
        for (int j = 0; j < 3; j++){
          R3MeshVertex *vertex = VertexOnFace(face, j);
          const R3Vector& normal = VertexNormal(vertex);
          normals.push_back(normal.X());
          normals.push_back(normal.Y());
          normals.push_back(normal.Z());
        }
      }
      glBindBuffer(GL_ARRAY_BUFFER, vbo_face_normal_buffer);
      glBufferData(GL_ARRAY_BUFFER, normals.size() * sizeof(GLfloat), &normals[0], GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
  }

  // Return normal buffer identifier
  return vbo_face_normal_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0x34(%rdi)
je 0x18c48
movq %rdi, %r14
leaq 0x54(%rdi), %r15
cmpl $0x0, 0x54(%rdi)
je 0x18c59
movl (%r15), %eax
jmp 0x18c4a
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xcc328(%rip), %rax     # 0xe4f88
movl $0x1, %edi
movq %r15, %rsi
callq *(%rax)
cmpl $0x0, (%r15)
je 0x18c43
movq %r15, 0x28(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x0, 0x34(%r14)
jle 0x18d8a
xorl %ecx, %ecx
leaq 0x10(%rsp), %r15
leaq 0xc(%rsp), %r12
movq 0x28(%r14), %rax
movq %rcx, 0x30(%rsp)
movq (%rax,%rcx,8), %rbx
movl $0x1, %ebp
movq (%rbx,%rbp,8), %r13
testb $0x2, 0x78(%r13)
jne 0x18cc9
movq (%r14), %rax
movq %r14, %rdi
movq %r13, %rsi
callq *0x2b0(%rax)
xorps %xmm0, %xmm0
cvtsd2ss 0x30(%r13), %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x18cf3
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x18cfe
movq %r15, %rdi
movq %r12, %rdx
callq 0x256b8
xorps %xmm0, %xmm0
cvtsd2ss 0x38(%r13), %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x18d28
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x18d33
movq %r15, %rdi
movq %r12, %rdx
callq 0x256b8
xorps %xmm0, %xmm0
cvtsd2ss 0x40(%r13), %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x18d5d
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x18d68
movq %r15, %rdi
movq %r12, %rdx
callq 0x256b8
incq %rbp
cmpq $0x4, %rbp
jne 0x18caf
movq 0x30(%rsp), %rcx
incq %rcx
movslq 0x34(%r14), %rax
cmpq %rax, %rcx
jl 0x18c9d
movq 0xcc217(%rip), %rbx     # 0xe4fa8
movq 0x28(%rsp), %r15
movl (%r15), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *(%rbx)
movq 0xcc219(%rip), %rax     # 0xe4fc0
movq 0x10(%rsp), %rdx
movq 0x18(%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)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x18c43
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xe450
jmp 0x18c43
jmp 0x18df1
jmp 0x18df1
jmp 0x18df1
jmp 0x18df1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x18e0b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xe450
movq %rbx, %rdi
callq 0xe7e0
nop