LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fgWarning
void fgWarning( const char *fmt, ... )
{
    va_list ap;

    va_start( ap, fmt );

    fprintf( stderr, "freeglut ");
    if( fgState.ProgramName )
        fprintf( stderr, "(%s): ", fgState.ProgramName );
    VFPRINTF( stderr, fmt, ap );
    fprintf( stderr, "\n" );

    va_end( ap );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x22ad5
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsp)
movq 0x11a4ac(%rip), %r14    # 0x13cfa8
movq (%r14), %rcx
leaq 0xd7af6(%rip), %rdi     # 0xfa5fc
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x22290
leaq 0x11f6a8(%rip), %rax    # 0x1421c0
movq 0xa8(%rax), %rdx
testq %rdx, %rdx
je 0x22b35
movq (%r14), %rdi
leaq 0xd7ad8(%rip), %rsi     # 0xfa606
xorl %eax, %eax
callq 0x21d80
movq (%r14), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
callq 0x21c70
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x21bb0
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: DrawBBoxes(gaps::R3Scene*, gaps::R3SceneNode*)
static void 
DrawBBoxes(R3Scene *scene, R3SceneNode *node)
{
  // Draw node bounding box
  node->BBox().Outline();

  // Push transformation
  node->Transformation().Push();

  // Draw children bboxes
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    DrawBBoxes(scene, child);
  }

  // Pop transformation
  node->Transformation().Pop();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x3c478
movq (%rax), %rcx
movl $0x1, %esi
movq %rax, %rdi
callq *0xb0(%rcx)
leaq 0x58(%rbx), %r14
movq 0x58(%rbx), %rax
movq %r14, %rdi
callq *0xb0(%rax)
cmpl $0x0, 0x2c(%rbx)
jle 0x263ca
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x26379
incq %r15
movslq 0x2c(%rbx), %rax
cmpq %rax, %r15
jl 0x263b1
movq (%r14), %rax
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmpq *0xb8(%rax)
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTResize(int, int)
void GLUTResize(int w, int h)
{
  // Resize window
  glViewport(0, 0, w, h);

  // Resize viewer viewport
  viewer->ResizeViewport(0, 0, w, h);

  // Resize scene viewport
  scene->SetViewport(viewer->Viewport());

  // Remember window size 
  GLUTwindow_width = w;
  GLUTwindow_height = h;

  // Redraw
  glutPostRedisplay();
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
xorl %edi, %edi
xorl %esi, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x21200
movq 0x11c4f2(%rip), %rdi    # 0x1428e8
xorl %esi, %esi
xorl %edx, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x3e254
movq 0x11c4cd(%rip), %rdi    # 0x1428d8
movl $0x98, %esi
addq 0x11c4d1(%rip), %rsi    # 0x1428e8
callq 0x289ba
movl %ebp, 0x117592(%rip)    # 0x13d9b4
movl %ebx, 0x117590(%rip)    # 0x13d9b8
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xcd590
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTSpecial(int, int, int)
void GLUTSpecial(int key, int x, int y)
{
  // Invert y coordinate
  y = GLUTwindow_height - y;

  // Process keyboard button event
  switch (key) {
  case GLUT_KEY_LEFT:
    viewer->TranslateCamera(0.1*viewer->Camera().Left());
    break;
  case GLUT_KEY_RIGHT:
    viewer->TranslateCamera(0.1*viewer->Camera().Right());
    break;
  case GLUT_KEY_DOWN:
    viewer->TranslateCamera(0.1*viewer->Camera().Down());
    break;
  case GLUT_KEY_UP:
    viewer->TranslateCamera(0.1*viewer->Camera().Up());
    break;
  }    

  // Remember mouse position 
  GLUTmouse[0] = x;
  GLUTmouse[1] = y;

  // Remember modifiers 
  GLUTmodifiers = glutGetModifiers();

  // Redraw
  glutPostRedisplay();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movl %esi, %ebx
movl 0x116e4b(%rip), %r13d   # 0x13d9b8
addl $-0x64, %edi
cmpl $0x3, %edi
ja 0x26c16
leaq 0xb3510(%rip), %rax     # 0xda090
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x11bd58(%rip), %rsi    # 0x1428e8
leaq 0x8(%rsi), %r14
addq $0x20, %rsi
jmp 0x26bba
movq 0x11bd47(%rip), %rsi    # 0x1428e8
leaq 0x8(%rsi), %r14
addq $0x20, %rsi
jmp 0x26bf6
movq 0x11bd36(%rip), %rsi    # 0x1428e8
leaq 0x8(%rsi), %r14
addq $0x38, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x76a98
leaq 0x8(%rsp), %r12
movsd 0xb3464(%rip), %xmm0    # 0xda038
movq %r12, %rdi
movq %r15, %rsi
callq 0x767fa
movq %r14, %rdi
movq %r12, %rsi
jmp 0x26c11
movq 0x11bcfa(%rip), %rsi    # 0x1428e8
leaq 0x8(%rsi), %r14
addq $0x38, %rsi
leaq 0x8(%rsp), %r15
movsd 0xb3435(%rip), %xmm0    # 0xda038
movq %r15, %rdi
callq 0x767fa
movq %r14, %rdi
movq %r15, %rsi
callq 0x40424
subl %ebp, %r13d
movl %ebx, 0x11bd69(%rip)    # 0x142988
movl %r13d, 0x11bd66(%rip)   # 0x14298c
callq 0xd2449
movl %eax, 0x11bd63(%rip)    # 0x142994
callq 0xcd590
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTInit(int*, char**)
void GLUTInit(int *argc, char **argv)
{
  // Open window 
  glutInit(argc, argv);
  glutInitWindowPosition(100, 100);
  glutInitWindowSize(GLUTwindow_width, GLUTwindow_height);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ALPHA);
  GLUTwindow = glutCreateWindow("Scene Viewer");
  
  // Initialize grfx (after create context because calls glewInit)
  RNInitGrfx();

  // Initialize depth testing
  glEnable(GL_DEPTH_TEST);

  // Initialize lighting
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  static GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
  glEnable(GL_NORMALIZE);
  glEnable(GL_LIGHTING); 

  // Initialize color settings
  glEnable(GL_COLOR_MATERIAL);
  glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

  // Initialize GLUT callback functions 
  glutDisplayFunc(GLUTRedraw);
  glutReshapeFunc(GLUTResize);
  glutKeyboardFunc(GLUTKeyboard);
  glutSpecialFunc(GLUTSpecial);
  glutMouseFunc(GLUTMouse);
  glutMotionFunc(GLUTMotion);
}

// Assembly:
pushq %rax
callq 0xce205
movl $0x64, %edi
movl $0x64, %esi
callq 0xce755
movl 0x1169c0(%rip), %edi    # 0x13d9b4
movl 0x1169be(%rip), %esi    # 0x13d9b8
callq 0xce76b
movl $0x1a, %edi
callq 0xce78a
leaq 0xb31c3(%rip), %rdi     # 0xda1d3
callq 0xd373a
movl %eax, 0x11b8b5(%rip)    # 0x1428d0
callq 0x870d8
movl $0xb71, %edi            # imm = 0xB71
callq 0x21810
movl $0x1700, %edi           # imm = 0x1700
callq 0x21cb0
callq 0x21c40
leaq 0x116980(%rip), %rsi    # 0x13d9c0
movl $0xb53, %edi            # imm = 0xB53
callq 0x22200
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x21150
movl $0xb52, %edi            # imm = 0xB52
movl $0x1, %esi
callq 0x21150
movl $0xba1, %edi            # imm = 0xBA1
callq 0x21810
movl $0xb50, %edi            # imm = 0xB50
callq 0x21810
movl $0xb57, %edi            # imm = 0xB57
callq 0x21810
movl $0x404, %edi            # imm = 0x404
movl $0x1602, %esi           # imm = 0x1602
callq 0x21590
leaq -0x1c8d(%rip), %rdi     # 0x2540f
callq 0xccc8c
leaq -0xccd(%rip), %rdi      # 0x263db
callq 0xccce1
leaq -0x46f(%rip), %rdi      # 0x26c45
callq 0xccd23
leaq -0x56c(%rip), %rdi      # 0x26b54
callq 0xccd6b
leaq -0xa4c(%rip), %rdi      # 0x26680
callq 0xcd0b4
leaq -0xca5(%rip), %rdi      # 0x26433
popq %rax
jmp 0xcd144
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTMainLoop()
void GLUTMainLoop(void)
{
  // Just checking
  if (!viewer || !scene) return;
  
  // Initialize viewing center
  center = scene->BBox().Centroid();

  // Define headlight
  if (headlight) {
    static GLfloat light0_diffuse[] = { 0.5, 0.5, 0.5, 1.0 };
    static GLfloat light0_position[] = { 0.0, 0.0, 1.0, 0.0 };
    glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
    glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
    glEnable(GL_LIGHT0);
  }
  
  // Run main loop -- never returns 
  glutMainLoop();
}

// Assembly:
cmpq $0x0, 0x11b802(%rip)    # 0x1428e8
setne %cl
movq 0x11b7e8(%rip), %rax    # 0x1428d8
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x27173
pushq %rbx
subq $0x20, %rsp
movq (%rax), %rdi
callq 0x3c478
movq (%rax), %rcx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq *0x68(%rcx)
leaq 0x11b796(%rip), %rdi    # 0x1428b8
movq %rbx, %rsi
callq 0x75732
cmpb $0x1, 0x11b81f(%rip)    # 0x142950
jne 0x27169
leaq 0x116896(%rip), %rdx    # 0x13d9d0
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
callq 0x220a0
leaq 0x116890(%rip), %rdx    # 0x13d9e0
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
callq 0x220a0
movl $0x4000, %edi           # imm = 0x4000
callq 0x21810
callq 0xd084b
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::R3Scene()
R3Scene::
R3Scene(void)
  : nodes(),
    lights(),
    materials(),
    brdfs(),
    textures(),
    referenced_scenes(),
    info(),
    viewer(),
    ambient(0.2, 0.2, 0.2),
    background(0, 0, 0),
    filename(NULL),
    name(NULL),
    data(NULL)
{
  // Create root node
  root = new R3SceneNode(this);

  // Initialize viewer
  viewer.SetCamera(R3default_camera);
  viewer.SetViewport(R2default_viewport);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
leaq 0x8(%rdi), %rbx
movq %rbx, %rdi
callq 0x8758c
leaq 0x18(%r13), %r14
movq %r14, %rdi
movq %rbx, 0x20(%rsp)
callq 0x8758c
leaq 0x28(%r13), %r15
movq %r15, %rdi
movq %r14, 0x18(%rsp)
callq 0x8758c
movq %r15, 0x10(%rsp)
leaq 0x38(%r13), %r12
movq %r12, %rdi
callq 0x8758c
leaq 0x48(%r13), %rbp
movq %rbp, %rdi
callq 0x8758c
leaq 0x58(%r13), %rbx
movq %rbx, %rdi
callq 0x8758c
movl $0x30, %edi
callq 0x218c0
movq %rax, %rcx
addq $0x8, %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %edx, %edx
movq %rdx, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rdx, 0x28(%rax)
movq %rax, 0x68(%r13)
leaq 0x70(%r13), %r14
movq %r14, %rdi
callq 0x3e074
leaq 0x118(%r13), %rdi
movsd 0xb2180(%rip), %xmm0    # 0xda4a0
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x87400
leaq 0x130(%r13), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x87400
xorps %xmm0, %xmm0
movups %xmm0, 0x148(%r13)
movq $0x0, 0x158(%r13)
movl $0x1b0, %edi            # imm = 0x1B0
callq 0x218c0
movq %rax, %r15
movq %rax, %rdi
movq %r13, %rsi
callq 0x3b560
movq %r15, (%r13)
leaq 0x11a707(%rip), %rsi    # 0x142a80
movq %r14, %rdi
callq 0x3e154
leaq 0x115670(%rip), %rsi    # 0x13d9f8
movq %r14, %rdi
callq 0x3e1ae
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, 0x8(%rsp)
movl $0x1b0, %esi            # imm = 0x1B0
movq %r15, %rdi
callq 0x218e0
jmp 0x283e9
movq %rax, 0x8(%rsp)
jmp 0x283f1
movq %rax, 0x8(%rsp)
jmp 0x283fd
movq %rax, 0x8(%rsp)
jmp 0x28405
movq %rax, 0x8(%rsp)
jmp 0x2840d
movq %rax, 0x8(%rsp)
jmp 0x28415
movq %rax, 0x8(%rsp)
jmp 0x2841f
movq %rax, 0x8(%rsp)
jmp 0x28429
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x3e148
addq $0x68, %r13
movq %r13, %rdi
callq 0x36e90
movq %rbx, %rdi
callq 0x875f6
movq %rbp, %rdi
callq 0x875f6
movq %r12, %rdi
callq 0x875f6
movq 0x10(%rsp), %rdi
callq 0x875f6
movq 0x18(%rsp), %rdi
callq 0x875f6
movq 0x20(%rsp), %rdi
callq 0x875f6
movq 0x8(%rsp), %rdi
callq 0x220c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Node(char const*) const
R3SceneNode *R3Scene::
Node(const char *name) const
{
  // Search nodes for matching name
  for (int i = 0; i < NNodes(); i++) {
    R3SceneNode *node = Node(i);
    if (!node->Name()) continue;
    if (!strcmp(node->Name(), name)) return node;
  }

  // Node not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x14(%rdi), %r15
testq %r15, %r15
jle 0x284f0
movq %rsi, %rbx
movq 0x8(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x1a0(%r14), %rdi
testq %rdi, %rdi
je 0x284e8
movq %rbx, %rsi
callq 0x21d00
testl %eax, %eax
je 0x284f3
incq %r13
cmpq %r13, %r15
jne 0x284cc
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Material(char const*) const
R3Material *R3Scene::
Material(const char *name) const
{
  // Search materials for matching name
  for (int i = 0; i < NMaterials(); i++) {
    R3Material *material = Material(i);
    if (!material->Name()) continue;
    if (!strcmp(material->Name(), name)) return material;
  }

  // Material not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x34(%rdi), %r15
testq %r15, %r15
jle 0x2853d
movq %rsi, %rbx
movq 0x28(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x28535
movq %rbx, %rsi
callq 0x21d00
testl %eax, %eax
je 0x28540
incq %r13
cmpq %r13, %r15
jne 0x2851c
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Light(char const*) const
R3Light *R3Scene::
Light(const char *name) const
{
  // Search lights for matching name
  for (int i = 0; i < NLights(); i++) {
    R3Light *light = Light(i);
    if (!light->Name()) continue;
    if (!strcmp(light->Name(), name)) return light;
  }

  // Light not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x24(%rdi), %r15
testq %r15, %r15
jle 0x2858b
movq %rsi, %rbx
movq 0x18(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x28583
movq %rbx, %rsi
callq 0x21d00
testl %eax, %eax
je 0x2858e
incq %r13
cmpq %r13, %r15
jne 0x2856a
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Brdf(char const*) const
R3Brdf *R3Scene::
Brdf(const char *name) const
{
  // Search brdfs for matching name
  for (int i = 0; i < NBrdfs(); i++) {
    R3Brdf *brdf = Brdf(i);
    if (!brdf->Name()) continue;
    if (!strcmp(brdf->Name(), name)) return brdf;
  }

  // Brdf not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x44(%rdi), %r15
testq %r15, %r15
jle 0x285d9
movq %rsi, %rbx
movq 0x38(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x285d1
movq %rbx, %rsi
callq 0x21d00
testl %eax, %eax
je 0x285dc
incq %r13
cmpq %r13, %r15
jne 0x285b8
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Texture(char const*) const
R2Texture *R3Scene::
Texture(const char *name) const
{
  // Search textures for matching name
  for (int i = 0; i < NTextures(); i++) {
    R2Texture *texture = Texture(i);
    if (!texture->Name()) continue;
    if (!strcmp(texture->Name(), name)) return texture;
  }

  // Texture not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x54(%rdi), %r15
testq %r15, %r15
jle 0x28627
movq %rsi, %rbx
movq 0x48(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x2861f
movq %rbx, %rsi
callq 0x21d00
testl %eax, %eax
je 0x2862a
incq %r13
cmpq %r13, %r15
jne 0x28606
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::ReferencedScene(char const*) const
R3Scene *R3Scene::
ReferencedScene(const char *name) const
{
  // Search textures for matching name
  for (int i = 0; i < NReferencedScenes(); i++) {
    R3Scene *referenced_scene = ReferencedScene(i);
    if (!referenced_scene->Name()) continue;
    if (!strcmp(referenced_scene->Name(), name)) return referenced_scene;
  }

  // Referenced scene not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x64(%rdi), %r15
testq %r15, %r15
jle 0x28678
movq %rsi, %rbx
movq 0x58(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x150(%r14), %rdi
testq %rdi, %rdi
je 0x28670
movq %rbx, %rsi
callq 0x21d00
testl %eax, %eax
je 0x2867b
incq %r13
cmpq %r13, %r15
jne 0x28654
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveLight(gaps::R3Light*)
void R3Scene::
RemoveLight(R3Light *light) 
{
  // Remove light
  assert(light->scene == this);
  assert(light->scene_index >= 0);
  RNArrayEntry *entry = lights.KthEntry(light->scene_index);
  assert(lights.EntryContents(entry) == light);
  R3Light *tail = lights.Tail();
  lights.EntryContents(entry) = tail;
  tail->scene_index = light->scene_index;
  lights.RemoveTail();
  light->scene_index = -1;
  light->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x18(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x18(%rdi), %rdx
movslq 0x24(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x10(%rdi)
decl %esi
movq %rax, %rdi
callq 0x877ac
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveMaterial(gaps::R3Material*)
void R3Scene::
RemoveMaterial(R3Material *material) 
{
  // Remove material
  assert(material->scene == this);
  assert(material->scene_index >= 0);
  RNArrayEntry *entry = materials.KthEntry(material->scene_index);
  assert(materials.EntryContents(entry) == material);
  R3Material *tail = materials.Tail();
  materials.EntryContents(entry) = tail;
  tail->scene_index = material->scene_index;
  materials.RemoveTail();
  material->scene_index = -1;
  material->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x28(%rdi), %rax
movslq 0x8(%rsi), %rcx
movq 0x28(%rdi), %rdx
movslq 0x34(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x8(%rdi)
decl %esi
movq %rax, %rdi
callq 0x877ac
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq $0x0, (%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveBrdf(gaps::R3Brdf*)
void R3Scene::
RemoveBrdf(R3Brdf *brdf) 
{
  // Remove brdf
  assert(brdf->scene == this);
  assert(brdf->scene_index >= 0);
  RNArrayEntry *entry = brdfs.KthEntry(brdf->scene_index);
  assert(brdfs.EntryContents(entry) == brdf);
  R3Brdf *tail = brdfs.Tail();
  brdfs.EntryContents(entry) = tail;
  tail->scene_index = brdf->scene_index;
  brdfs.RemoveTail();
  brdf->scene_index = -1;
  brdf->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x38(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x38(%rdi), %rdx
movslq 0x44(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x10(%rdi)
decl %esi
movq %rax, %rdi
callq 0x877ac
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveTexture(gaps::R2Texture*)
void R3Scene::
RemoveTexture(R2Texture *texture) 
{
  // Remove texture
  assert(texture->scene == this);
  assert(texture->scene_index >= 0);
  RNArrayEntry *entry = textures.KthEntry(texture->scene_index);
  assert(textures.EntryContents(entry) == texture);
  R2Texture *tail = textures.Tail();
  textures.EntryContents(entry) = tail;
  tail->scene_index = texture->scene_index;
  textures.RemoveTail();
  texture->scene_index = -1;
  texture->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x48(%rdi), %rax
movslq 0x8(%rsi), %rcx
movq 0x48(%rdi), %rdx
movslq 0x54(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x8(%rdi)
decl %esi
movq %rax, %rdi
callq 0x877ac
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq $0x0, (%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveReferences()
void R3Scene::
RemoveReferences(void)
{
  // Replace all references with copies of referenced scenes
  R3SceneRemoveReferences(this, root);

  // Remove/delete referenced scenes
  while (NReferencedScenes() > 0) {
    R3Scene *referenced_scene = ReferencedScene(0);
    RemoveReferencedScene(referenced_scene);
    delete referenced_scene;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
callq 0x28a98
cmpl $0x0, 0x64(%rbx)
jle 0x28a92
leaq 0x58(%rbx), %r14
movq (%r14), %rax
movq (%rax), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x87604
subq (%r14), %rax
shrq $0x3, %rax
movq %r14, %rdi
movl %eax, %esi
callq 0x877ac
testq %r15, %r15
je 0x28a7f
movq %r15, %rdi
callq 0x2843e
movl $0x160, %esi            # imm = 0x160
movq %r15, %rdi
callq 0x218e0
cmpl $0x0, 0x64(%rbx)
jg 0x28a50
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneRemoveReferences(gaps::R3Scene*, gaps::R3SceneNode*)
static void
R3SceneRemoveReferences(R3Scene *scene, R3SceneNode *node)
{
  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneRemoveReferences(scene, child);
  }

  // Insert copy of all referenced scenes
  for (int i = 0; i < node->NReferences(); i++) {
    R3SceneReference *reference = node->Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    CopyScene(referenced_scene, scene, node, &(reference->Materials()));
  }

  // Remove references
  while (node->NReferences() > 0) {
    R3SceneReference *reference = node->Reference(0);
    node->RemoveReference(reference);
    delete reference;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0x2c(%rsi)
jle 0x28ac8
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x28a98
incq %r15
movslq 0x2c(%rbx), %rax
cmpq %rax, %r15
jl 0x28aac
cmpl $0x0, 0x4c(%rbx)
jle 0x28b2d
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rcx
movq (%rcx), %rdi
addq $0x8, %rcx
movq %r14, %rsi
movq %rbx, %rdx
callq 0x368de
incq %r15
movslq 0x4c(%rbx), %rax
cmpq %rax, %r15
jl 0x28ad1
testl %eax, %eax
jle 0x28b2d
movq 0x40(%rbx), %rax
movq (%rax), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b9ba
testq %r14, %r14
je 0x28b1a
movq %r14, %rdi
callq 0x3dde0
movl $0x30, %esi
movq %r14, %rdi
callq 0x218e0
cmpl $0x0, 0x4c(%rbx)
jg 0x28afb
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneRemoveHierarchy(gaps::R3Scene*, gaps::R3SceneNode*, gaps::R3Affine const&)
static void
R3SceneRemoveHierarchy(R3Scene *scene, R3SceneNode *node, const R3Affine& parent_transformation)
{
  // Compute transformation
  R3Affine transformation = R3identity_affine;
  transformation.Transform(parent_transformation);
  transformation.Transform(node->Transformation());

  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneRemoveHierarchy(scene, child, transformation);
  }

  // Check if should move node to root
  R3SceneNode *root = scene->Root();
  if (node != root) {
    R3SceneNode *parent = node->Parent();
    if (parent && (parent != root)) {
      // Assign transformation
      node->SetTransformation(transformation);

      // Move node to be child of root
      parent->RemoveChild(node);
      root->InsertChild(node);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1105cb(%rip), %rax    # 0x139148
addq $0x10, %rax
leaq 0x10(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x11caef(%rip), %r12    # 0x145680
leaq 0x8(%r12), %rsi
callq 0x71cc6
movl $0x88, %esi
leaq 0x8(%rsp), %rdi
addq %rsi, %rdi
addq 0x114429(%rip), %rsi    # 0x13cfd8
callq 0x71cc6
movq 0x108(%r12), %rax
leaq 0x8(%rsp), %rdi
movq %rax, 0x108(%rdi)
movq %r15, %rsi
callq 0x6fb9e
leaq 0x58(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x6fb9e
cmpl $0x0, 0x2c(%rbx)
jle 0x28c0b
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x28b5f
incq %r12
movslq 0x2c(%rbx), %rax
cmpq %rax, %r12
jl 0x28bec
movq (%r14), %r14
cmpq %rbx, %r14
je 0x28c4a
movq 0x10(%rbx), %r15
testq %r15, %r15
sete %al
cmpq %r14, %r15
sete %cl
orb %al, %cl
jne 0x28c4a
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3cb96
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3ba02
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3c97e
leaq 0x8(%rsp), %rdi
callq 0x6fa30
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x28c76
jmp 0x28c76
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x700c4
jmp 0x28c83
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6fa30
movq %rbx, %rdi
callq 0x220c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneRemoveTransformations(gaps::R3Scene*, gaps::R3SceneNode*, gaps::R3Affine const&)
static void
R3SceneRemoveTransformations(R3Scene *scene, R3SceneNode *node, const R3Affine& parent_transformation)
{
  // Compute transformation
  R3Affine transformation = R3identity_affine;
  transformation.Transform(parent_transformation);
  transformation.Transform(node->Transformation());

  // Check if node has references
  if (node->NReferences() > 0) {
    node->SetTransformation(transformation);
    return;
  }

  // Transform elements
  for (int i = 0; i < node->NElements(); i++) {
    R3SceneElement *element = node->Element(i);
    element->Transform(transformation);
  }

  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneRemoveTransformations(scene, child, transformation);
  }

  // Remove transformation
  node->SetTransformation(R3identity_affine);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x110495(%rip), %rax    # 0x139148
addq $0x10, %rax
leaq 0x10(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x11c9b9(%rip), %r15    # 0x145680
leaq 0x8(%r15), %rsi
callq 0x71cc6
movl $0x88, %esi
leaq 0x8(%rsp), %rdi
addq %rsi, %rdi
addq 0x1142f4(%rip), %rsi    # 0x13cfd8
callq 0x71cc6
movq 0x108(%r15), %rax
leaq 0x8(%rsp), %rdi
movq %rax, 0x108(%rdi)
movq %r14, %rsi
callq 0x6fb9e
leaq 0x58(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x6fb9e
cmpl $0x0, 0x4c(%rbx)
jg 0x28d72
cmpl $0x0, 0x3c(%rbx)
jle 0x28d45
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq %r14, %rsi
callq 0x3d852
incq %r12
movslq 0x3c(%rbx), %rax
cmpq %rax, %r12
jl 0x28d29
cmpl $0x0, 0x2c(%rbx)
jle 0x28d6f
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq %r14, %rsi
callq 0x28c98
incq %r12
movslq 0x2c(%rbx), %rax
cmpq %rax, %r12
jl 0x28d53
movq %r15, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3cb96
leaq 0x8(%rsp), %rdi
callq 0x6fa30
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x700c4
jmp 0x28db6
jmp 0x28da9
jmp 0x28da9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6fa30
movq %rbx, %rdi
callq 0x220c0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneSubdivideTriangles(gaps::R3Scene*, gaps::R3SceneNode*, double)
static void
R3SceneSubdivideTriangles(R3Scene *scene, R3SceneNode *node, RNLength max_edge_length)
{
  // Check max edge length
  if (RNIsNegativeOrZero(max_edge_length)) return;

  // Transform max_edge_length
  RNScalar scale = node->Transformation().ScaleFactor();
  if (RNIsNotZero(scale)) max_edge_length /= scale;

  // Subdivide triangles in elements
  for (int i = 0; i < node->NElements(); i++) {
    R3SceneElement *element = node->Element(i);
    for (int j = 0; j < element->NShapes(); j++) {
      R3Shape *shape = element->Shape(j);
      if (shape->ClassID() == R3TriangleArray::CLASS_ID()) {
        R3TriangleArray *triangles = (R3TriangleArray *) shape;
        triangles->Subdivide(max_edge_length);
      }
    }
  }

  // Subdivide triangles in references
  for (int i = 0; i < node->NReferences(); i++) {
    R3SceneReference *reference = node->Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    R3SceneSubdivideTriangles(referenced_scene, referenced_scene->Root(), max_edge_length);
  }

  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneSubdivideTriangles(scene, child, max_edge_length);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x115300(%rip), %r14    # 0x13e0d8
movsd (%r14), %xmm1
ucomisd %xmm0, %xmm1
jae 0x28f14
movq %rdi, %rbx
addq $0x58, %rdi
movq 0x58(%rbx), %rax
movapd %xmm0, (%rsp)
callq *0xc0(%rax)
movapd %xmm0, %xmm3
movsd (%r14), %xmm0
movapd 0xb1732(%rip), %xmm1    # 0xda540
xorpd %xmm0, %xmm1
movapd (%rsp), %xmm4
movapd %xmm4, %xmm2
divsd %xmm3, %xmm2
cmpnltsd %xmm3, %xmm0
cmpnltsd %xmm1, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm2, %xmm1
andpd %xmm4, %xmm3
orpd %xmm1, %xmm3
andpd %xmm0, %xmm3
andnpd %xmm2, %xmm0
orpd %xmm0, %xmm3
movl 0x3c(%rbx), %eax
testl %eax, %eax
movapd %xmm3, (%rsp)
jle 0x28eb8
xorl %r15d, %r15d
movq 0x30(%rbx), %rcx
movq (%rcx,%r15,8), %r12
cmpl $0x0, 0x1c(%r12)
jle 0x28ead
xorl %r13d, %r13d
movq 0x10(%r12), %rax
movq (%rax,%r13,8), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0xb8(%rax)
movl %eax, %ebp
callq 0x678ec
cmpl %eax, %ebp
jne 0x28e98
movq (%r14), %rax
movq %r14, %rdi
movapd (%rsp), %xmm0
callq *0x228(%rax)
incq %r13
movslq 0x1c(%r12), %rax
cmpq %rax, %r13
jl 0x28e67
movl 0x3c(%rbx), %eax
movapd (%rsp), %xmm3
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x28e54
cmpl $0x0, 0x4c(%rbx)
jle 0x28ee9
xorl %r14d, %r14d
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rax
movq (%rax), %rdi
movapd %xmm3, %xmm0
callq 0x28dc3
movapd (%rsp), %xmm3
incq %r14
movslq 0x4c(%rbx), %rax
cmpq %rax, %r14
jl 0x28ec1
cmpl $0x0, 0x2c(%rbx)
jle 0x28f14
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
movapd %xmm3, %xmm0
callq 0x28dc3
movapd (%rsp), %xmm3
incq %r14
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jl 0x28ef2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::CreateDirectionalLights()
void R3Scene::
CreateDirectionalLights(void)
{
  // Create directional light pointing diagonally down
  RNRgb color1(1,1,1);
  R3Vector direction1(-3,-4,-5);
  direction1.Normalize();
  R3DirectionalLight *light1 = new R3DirectionalLight(direction1, color1);
  InsertLight(light1);

  // Create second (weaker) directional light pointing diagonally up
  RNRgb color2(0.5, 0.5, 0.5);
  R3Vector direction2(3,2,3);
  direction2.Normalize();
  R3DirectionalLight *light2 = new R3DirectionalLight(direction2, color2);
  InsertLight(light2);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
leaq 0x48(%rsp), %r14
movsd 0xb10d7(%rip), %xmm0    # 0xda018
movq %r14, %rdi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x87400
leaq 0x30(%rsp), %r12
movsd 0xb154c(%rip), %xmm0    # 0xda4a8
movsd 0xb154c(%rip), %xmm1    # 0xda4b0
movsd 0xb154c(%rip), %xmm2    # 0xda4b8
movq %r12, %rdi
callq 0x75e5e
movq %r12, %rdi
callq 0x76174
movl $0x68, %edi
callq 0x218c0
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
movq %r14, %rdx
movsd 0xb107e(%rip), %xmm0    # 0xda018
movl $0x1, %ecx
callq 0x424ba
movq %rbx, 0x8(%r15)
leaq 0x18(%rbx), %r14
movl 0x24(%rbx), %edx
movl %edx, 0x10(%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x87622
leaq 0x18(%rsp), %r15
movsd 0xb1055(%rip), %xmm0    # 0xda020
movq %r15, %rdi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x87400
movq %rsp, %r13
movsd 0xb14dc(%rip), %xmm1    # 0xda4c0
movsd 0xb14dc(%rip), %xmm0    # 0xda4c8
movq %r13, %rdi
movaps %xmm0, %xmm2
callq 0x75e5e
movq %r13, %rdi
callq 0x76174
movl $0x68, %edi
callq 0x218c0
movq %rax, %r12
movsd 0xb1004(%rip), %xmm0    # 0xda018
movq %rax, %rdi
movq %r13, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x424ba
movq %rbx, 0x8(%r12)
movl 0x24(%rbx), %edx
movl %edx, 0x10(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0x87622
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0x68, %esi
movq %r12, %rdi
jmp 0x29065
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
callq 0x218e0
movq %rbx, %rdi
callq 0x220c0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::LoadLights(int, int) const
int R3Scene::
LoadLights(int min_index, int max_index) const
{
  // Set ambient light
  static GLfloat ambient[4];
  ambient[0] = Ambient().R();
  ambient[1] = Ambient().G();
  ambient[2] = Ambient().B();
  ambient[3] = 1;
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);

  // Draw lights 
  int count = 0;
  for (int i = 0; i < NLights(); i++) {
    R3Light *light = Light(i);
    if (min_index + count > max_index) break;
    light->Draw(min_index + count);
    count++;
  }

  // Return number of lights loaded
  return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movupd 0x118(%rdi), %xmm0
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, 0x119965(%rip)   # 0x142a10
xorps %xmm0, %xmm0
cvtsd2ss 0x128(%rdi), %xmm0
movl %esi, %ebp
leaq 0x119951(%rip), %rsi    # 0x142a10
movss %xmm0, 0x119951(%rip)   # 0x142a18
movl $0x3f800000, 0x11994b(%rip) # imm = 0x3F800000
movl $0xb53, %edi            # imm = 0xB53
callq 0x22200
cmpl $0x0, 0x24(%r14)
jle 0x2910c
movl %ebp, %r12d
xorl %r15d, %r15d
leaq (%r12,%r15), %rsi
cmpl %ebx, %esi
jg 0x2910f
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x290e8
jmp 0x2910f
xorl %r15d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Draw(gaps::RNFlags) const
void R3Scene::
Draw(const R3DrawFlags draw_flags) const
{
  // Draw null material
  R3null_material.Draw();

  // Draw nodes recursively
  if (NLights() > 7) DrawNodeWithLights(this, root, R3identity_affine, draw_flags, 1, 7);
  else root->Draw(draw_flags);

  // Draw null material
  R3null_material.Draw();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x119a95(%rip), %rdi    # 0x142e20
xorl %esi, %esi
callq 0x43cee
cmpl $0x8, 0x24(%r14)
movq (%r14), %rsi
jl 0x293b0
leaq 0x11c2dd(%rip), %rdx    # 0x145680
movq %r14, %rdi
movq %rbx, %rcx
callq 0x293d2
jmp 0x293bd
movq %rsi, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3d1ec
leaq 0x119a5c(%rip), %rdi    # 0x142e20
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x43cee
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::ReadMeshFile(char const*, gaps::R3SceneNode*)
int R3Scene::
ReadMeshFile(const char *filename, R3SceneNode *parent_node)
{
  // Check/set parent node
  if (!parent_node) parent_node = root;

  // Load triangles into scene
  R3TriangleArray *shape = ReadMesh(filename);
  if (!shape) return 0;
  R3SceneElement *element = new R3SceneElement();
  element->InsertShape(shape);
  R3SceneNode *node = new R3SceneNode(this);
  node->InsertElement(element);
  parent_node->InsertChild(node);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
testq %rdx, %rdx
jne 0x2d010
movq (%r14), %rbx
movq %rsi, %rdi
callq 0x339e1
testq %rax, %rax
je 0x2d077
movq %rax, %r12
movl $0x60, %edi
callq 0x218c0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x3d514
movq %r15, %rdi
movq %r12, %rsi
callq 0x3d7bc
movl $0x1b0, %edi            # imm = 0x1B0
callq 0x218c0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x3b560
movq %r12, %rdi
movq %r15, %rsi
callq 0x3c9ce
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3c97e
movl $0x1, %eax
jmp 0x2d079
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0x1b0, %esi            # imm = 0x1B0
movq %r12, %rdi
jmp 0x2d09d
movq %rax, %rbx
movl $0x60, %esi
movq %r15, %rdi
callq 0x218e0
movq %rbx, %rdi
callq 0x220c0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::WriteFile(char const*) const
int R3Scene::
WriteFile(const char *filename) const
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    RNFail("Filename %s has no extension (e.g., .txt)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".scn", 4)) {
    if (!WritePrincetonFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".obj", 4)) {
    if (!WriteObjFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".json", 4)) {
    if (!WriteSUNCGFile(filename)) return 0;
  }
  else {
    RNFail("Unable to write file %s (unrecognized extension: %s)\n", filename, extension);
    return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x219b0
testq %rax, %rax
je 0x3046c
movq %rax, %r15
leaq 0xaa1a8(%rip), %rsi     # 0xda5bb
movl $0x4, %edx
movq %rax, %rdi
callq 0x213d0
testl %eax, %eax
je 0x30481
leaq 0xaae75(%rip), %rsi     # 0xdb2a0
movl $0x4, %edx
movq %r15, %rdi
callq 0x213d0
testl %eax, %eax
je 0x3048e
leaq 0xaa19c(%rip), %rsi     # 0xda5df
movl $0x4, %edx
movq %r15, %rdi
callq 0x213d0
testl %eax, %eax
je 0x304a6
leaq 0xaa1bf(%rip), %rdi     # 0xda61a
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8a0fe
jmp 0x304be
leaq 0xaa11d(%rip), %rdi     # 0xda590
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x8a0fe
jmp 0x304be
movq %r14, %rdi
movq %rbx, %rsi
callq 0x304cc
jmp 0x304b1
movq %r14, %rdi
callq 0x28a36
movq (%r14), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x3353a
jmp 0x304b1
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30b04
testl %eax, %eax
je 0x304bc
movl $0x1, %ebp
jmp 0x304be
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::WriteSUNCGFile(char const*) const
int R3Scene::
WriteSUNCGFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s", filename);
    return 0;
  }

  // Write header
  fprintf(fp, "{\n");
  fprintf(fp, "  \"version\":\"suncg@1.0.0\",\n");
  if (root->Name()) fprintf(fp, "  \"id\":\"%s\",\n", root->Name());
  fprintf(fp, "  \"up\":[0,1,0],\n");
  fprintf(fp, "  \"front\":[0,0,1],\n");
  fprintf(fp, "  \"scaleToMeters\":1,\n");  
  fprintf(fp, "  \"levels\":[\n");  

  // Write nodes recursively
  for (int i = 0; i < root->NChildren(); i++) {
    R3SceneNode *child = root->Child(i);
    if (!WriteSUNCGNode(this, child, fp)) {
      fclose(fp);
      return 0;
    }
  }

  // Write trailer
  fprintf(fp, "\n  ]\n");
  fprintf(fp, "}\n");
  
  // Close file
  fclose(fp);
  
  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0xad326(%rip), %rsi     # 0xdde3c
movq %r15, %rdi
callq 0x21ab0
testq %rax, %rax
je 0x30c50
movq %rax, %rbx
leaq 0xaae70(%rip), %rdi     # 0xdb9a1
movl $0x2, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x22290
leaq 0xaa7a0(%rip), %rdi     # 0xdb2ea
movl $0x1b, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
movq (%r14), %rax
movq 0x1a0(%rax), %rdx
testq %rdx, %rdx
je 0x30b7c
leaq 0xaae38(%rip), %rsi     # 0xdb9aa
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21d80
leaq 0xaa783(%rip), %rdi     # 0xdb306
movl $0x10, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
leaq 0xaa77b(%rip), %rdi     # 0xdb317
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
leaq 0xaa776(%rip), %rdi     # 0xdb32b
movl $0x15, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
leaq 0xaa773(%rip), %rdi     # 0xdb341
movl $0xd, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
movq (%r14), %rax
cmpl $0x0, 0x2c(%rax)
jle 0x30c0f
xorl %r15d, %r15d
movq 0x20(%rax), %rax
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x3517a
testl %eax, %eax
je 0x30c65
incq %r15
movq (%r14), %rax
movslq 0x2c(%rax), %rcx
cmpq %rcx, %r15
jl 0x30bec
leaq 0xaa739(%rip), %rdi     # 0xdb34f
movl $0x5, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
leaq 0xaadfd(%rip), %rdi     # 0xdba2c
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22290
movq %rbx, %rdi
callq 0x218b0
movl $0x1, %ebx
jmp 0x30c6f
leaq 0xa99ff(%rip), %rdi     # 0xda656
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x8a0fe
jmp 0x30c6f
movq %rbx, %rdi
callq 0x218b0
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::ReadMesh(char const*)
static R3TriangleArray *
ReadMesh(const char *filename)
{
  // Read mesh file
  R3Mesh mesh;
  if (!mesh.ReadFile(filename)) {
    RNFail("Unable to read mesh %s\n", filename);
    return NULL;
  }

  // Allocate triangle array
  R3TriangleArray *array = new R3TriangleArray();
  if (!array) {
    RNFail("Unable to allocate triangle array");
    return NULL;
  }

  // Load mesh into triangle array
  array->LoadMesh(mesh);

  // Return triangle array
  return array;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %r14
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x50e64
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5de58
testl %eax, %eax
je 0x33a2e
movl $0x70, %edi
callq 0x218c0
movq %rax, %rbx
movq %rax, %rdi
callq 0x6791c
movq (%rbx), %rax
movq %rsp, %rsi
movq %rbx, %rdi
callq *0x240(%rax)
jmp 0x33a41
xorl %ebx, %ebx
leaq 0xa6dcb(%rip), %rdi     # 0xda802
movq %r14, %rsi
xorl %eax, %eax
callq 0x8a0fe
movq %rsp, %rdi
callq 0x513a2
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
retq
movq %rax, %r14
movl $0x70, %esi
movq %rbx, %rdi
callq 0x218e0
jmp 0x33a6e
jmp 0x33a6b
movq %rax, %r14
movq %rsp, %rdi
callq 0x513a2
movq %r14, %rdi
callq 0x220c0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::FindPrincetonMaterialAndElement(gaps::R3Scene*, gaps::R3SceneNode*, gaps::RNArray<gaps::R3Material*> const&, int, gaps::R3Material*&, gaps::R3Material*&, gaps::R3SceneElement*&)
static int
FindPrincetonMaterialAndElement(R3Scene *scene, R3SceneNode *node,
  const RNArray<R3Material *>& materials, int m, R3Material *&default_material,
  R3Material *& material, R3SceneElement *& element)
{
  // Find material from m
  material = NULL;
  if (m >= 0) {
    if (m < materials.NEntries()) material = materials[m];
    else return 0;
  }
  else {
    // Get material from 
    material = default_material;
    if (!material) {
      R3Brdf *brdf = new R3Brdf(R3default_brdf);
      scene->InsertBrdf(brdf);
      material = new R3Material(brdf);
      scene->InsertMaterial(material);
      default_material = material;
    }
  }

  // Find element with that material
  element = NULL;
  for (int i = 0; i < node->NElements(); i++) {
    R3SceneElement *e = node->Element(i);
    if (e->Material() == material) { element = e; break; }
  }

  // Create element if none found
  if (!element) {
    element = new R3SceneElement(material);
    node->InsertElement(element);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %rsi, %rbx
movq $0x0, (%r9)
testl %ecx, %ecx
js 0x33ab6
xorl %eax, %eax
cmpl %ecx, 0xc(%rdx)
jle 0x33ba3
movl %ecx, %eax
shlq $0x3, %rax
addq (%rdx), %rax
movq %r14, %r15
jmp 0x33b3a
movq %r8, %r15
movq (%r8), %rax
movq %rax, (%r14)
testq %rax, %rax
jne 0x33b40
movq %rdi, %r12
movl $0xb8, %edi
callq 0x218c0
movq %rax, %r13
leaq 0x10f7c5(%rip), %rsi    # 0x1432a0
movq %rax, %rdi
xorl %edx, %edx
callq 0x43df4
movq %r12, 0x8(%r13)
leaq 0x38(%r12), %rdi
movl 0x44(%r12), %edx
movl %edx, 0x10(%r13)
movq %r13, %rsi
callq 0x87622
movl $0x30, %edi
callq 0x218c0
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x43ace
movq %rbp, (%r14)
movq %r12, (%rbp)
movl 0x34(%r12), %edx
addq $0x28, %r12
movl %edx, 0x8(%rbp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x87622
movq %r14, %rax
movq (%rax), %rax
movq %rax, (%r15)
movq 0x40(%rsp), %r12
movq $0x0, (%r12)
movslq 0x3c(%rbx), %rax
testq %rax, %rax
jle 0x33b71
movq 0x30(%rbx), %rcx
movq (%r14), %rdx
xorl %esi, %esi
movq (%rcx,%rsi,8), %rdi
cmpq %rdx, 0x8(%rdi)
je 0x33b9a
incq %rsi
cmpq %rsi, %rax
jne 0x33b5f
movl $0x60, %edi
callq 0x218c0
movq %rax, %r15
movq (%r14), %rsi
movq %rax, %rdi
callq 0x3d514
movq %r15, (%r12)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3c9ce
jmp 0x33b9e
movq %rdi, (%r12)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x30, %esi
movq %rbp, %rdi
jmp 0x33bd7
movq %rax, %rbx
movl $0xb8, %esi
movq %r13, %rdi
jmp 0x33bd7
movq %rax, %rbx
movl $0x60, %esi
movq %r15, %rdi
callq 0x218e0
movq %rbx, %rdi
callq 0x220c0