LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawScanViewpoints() const
void R3SurfelViewer::
DrawScanViewpoints(void) const
{
  // Check stuff
  if (!scene) return;
  if (!scan_viewpoint_visibility) return;
  
  // Draw scan viewpoints
  glDisable(GL_LIGHTING);
  RNLoadRgb(scan_viewpoint_color);
  RNGrfxBegin(RN_GRFX_LINES);
  for (int i = 0; i < scene->NScans(); i++) {
    R3SurfelScan *scan = scene->Scan(i);
    const R3Point& viewpoint = scan->Viewpoint();
    const R3Vector towards = scan->Towards();
    const R3Vector up = scan->Up();
    R3LoadPoint(viewpoint);
    R3LoadPoint(viewpoint + towards);
    R3LoadPoint(viewpoint);
    R3LoadPoint(viewpoint + 0.5 * up);
  }
  RNGrfxEnd();
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2f32d
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r12
cmpl $0x0, 0x320(%rdi)
je 0x2f31f
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
movsd 0x410(%r12), %xmm0
movsd 0x418(%r12), %xmm1
movsd 0x420(%r12), %xmm2
callq 0x27ed0
movl $0x1, %edi
callq 0x271a0
movq 0x8(%r12), %rax
cmpl $0x0, 0x8c(%rax)
jle 0x2f31a
xorl %r15d, %r15d
movq 0x80(%rax), %rax
movq (%rax,%r15,8), %r14
leaq 0x28(%r14), %rbp
leaq 0x70(%r14), %rsi
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0xc5400
addq $0x58, %r14
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc47d6
movq %rbp, %rdi
callq 0x271c0
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xc4077
movq %r14, %rdi
callq 0x271c0
movq %rbp, %rdi
callq 0x271c0
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movsd 0x108d29(%rip), %xmm0   # 0x138010
callq 0xc5162
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xc4077
movq %r14, %rdi
callq 0x271c0
incq %r15
movq 0x8(%r12), %rax
movslq 0x8c(%rax), %rcx
cmpq %rcx, %r15
jl 0x2f275
callq 0x27cb0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawImageViewpoints() const
void R3SurfelViewer::
DrawImageViewpoints(void) const
{
  // Check stuff
  if (!scene) return;
  if (!image_viewpoint_visibility) return;
  
  // Draw image viewpoints
  glDisable(GL_LIGHTING);
  RNLoadRgb(image_viewpoint_color);
  for (int i = 0; i < scene->NImages(); i++) {
    R3SurfelImage *image = scene->Image(i);
    if (image == selected_image) glLineWidth(5);
    image->Draw();
    if (image == selected_image) glLineWidth(1);
  }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2f3ed
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x324(%rdi)
je 0x2f3e8
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
movsd 0x428(%rbx), %xmm0
movsd 0x430(%rbx), %xmm1
movsd 0x438(%rbx), %xmm2
callq 0x27ed0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x9c(%rax)
jle 0x2f3e8
xorl %r15d, %r15d
movq 0x90(%rax), %rax
movq (%rax,%r15,8), %r14
cmpq 0x2d0(%rbx), %r14
jne 0x2f3a6
movss 0x1091a7(%rip), %xmm0   # 0x138548
callq 0x281a0
movq (%r14), %rax
movl $0x1, %esi
movq %r14, %rdi
movsd 0x108c4f(%rip), %xmm0   # 0x138008
callq *0xf0(%rax)
cmpq 0x2d0(%rbx), %r14
jne 0x2f3d5
movss 0x108c70(%rip), %xmm0   # 0x138040
callq 0x281a0
incq %r15
movq 0x8(%rbx), %rax
movslq 0x9c(%rax), %rcx
cmpq %rcx, %r15
jl 0x2f385
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawAxes() const
void R3SurfelViewer::
DrawAxes(void) const
{
  // Check stuff
  if (!axes_visibility) return;

  // Draw axes
  RNScalar d = 1.0;
  glDisable(GL_LIGHTING);
  glLineWidth(3);
  R3BeginLine();
  RNLoadRgb(1, 0, 0);
  R3LoadPoint(R3zero_point);
  R3LoadPoint(R3zero_point + d * R3posx_vector);
  R3EndLine();
  R3BeginLine();
  RNLoadRgb(0, 1, 0);
  R3LoadPoint(R3zero_point);
  R3LoadPoint(R3zero_point + d * R3posy_vector);
  R3EndLine();
  R3BeginLine();
  RNLoadRgb(0, 0, 1);
  R3LoadPoint(R3zero_point);
  R3LoadPoint(R3zero_point + d * R3posz_vector);
  R3EndLine();
  glLineWidth(1);
}

// Assembly:
cmpl $0x0, 0x33c(%rdi)
je 0x2fff7
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl $0xb50, %edi            # imm = 0xB50
callq 0x27200
movss 0x108694(%rip), %xmm0   # 0x13854c
callq 0x281a0
movl $0x3, %edi
callq 0x271a0
movss 0x108171(%rip), %xmm0   # 0x138040
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x28350
leaq 0x59531f(%rip), %rbx    # 0x5c5200
movq %rbx, %rdi
callq 0x271c0
leaq 0x1123c8(%rip), %rsi    # 0x1422b8
movq %rsp, %r14
movsd 0x10810d(%rip), %xmm0   # 0x138008
movq %r14, %rdi
callq 0xc5162
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xc4077
movq %r15, %rdi
callq 0x271c0
callq 0x27cb0
movl $0x3, %edi
callq 0x271a0
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movss 0x108105(%rip), %xmm1   # 0x138040
callq 0x28350
movq %rbx, %rdi
callq 0x271c0
leaq 0x112381(%rip), %rsi    # 0x1422d0
movq %rsp, %r14
movq %r14, %rdi
movsd 0x1080ab(%rip), %xmm0   # 0x138008
callq 0xc5162
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xc4077
movq %r15, %rdi
callq 0x271c0
callq 0x27cb0
movl $0x3, %edi
callq 0x271a0
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movss 0x1080a6(%rip), %xmm2   # 0x138040
callq 0x28350
movq %rbx, %rdi
callq 0x271c0
leaq 0x11233a(%rip), %rsi    # 0x1422e8
movq %rsp, %r14
movq %r14, %rdi
movsd 0x10804c(%rip), %xmm0   # 0x138008
callq 0xc5162
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xc4077
movq %r15, %rdi
callq 0x271c0
callq 0x27cb0
movss 0x108057(%rip), %xmm0   # 0x138040
callq 0x281a0
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::CaptureImage(char const*) const
void R3SurfelViewer::
CaptureImage(const char *filename) const
{
  // Check stuff
  if (!filename) return;

  // Capture iamge
  R2Image image(viewer.Viewport().Width(), viewer.Viewport().Height(), 3);
  image.Capture();

  // Wrimte to file
  image.Write(filename);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x3003e
movq %rsi, %rbx
movl 0x118(%rdi), %esi
movl 0x11c(%rdi), %edx
movq %rsp, %r14
movq %r14, %rdi
movl $0x3, %ecx
callq 0xded9a
movq %r14, %rdi
callq 0xdf824
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xe0c18
movq %rsp, %rdi
callq 0xdeff4
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xdeff4
movq %rbx, %rdi
callq 0x28120
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::Resize(int, int)
int R3SurfelViewer::
Resize(int w, int h)
{
  // Resize window
  glViewport(0, 0, w, h);

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

  // Remember window size
  window_width = w;
  window_height = h;

  // Return whether need redraw
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
xorl %edi, %edi
xorl %esi, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x27210
leaq 0x78(%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x78704
movl %ebp, 0x498(%r14)
movl %ebx, 0x494(%r14)
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::Initialize()
void R3SurfelViewer::
Initialize(void)
{
  // Initialize lights
  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);
  static GLfloat light0_diffuse[] = { 1.0, 1.0, 1.0, 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);
  static GLfloat light1_diffuse[] = { 0.5, 0.5, 0.5, 1.0 };
  static GLfloat light1_position[] = { 0.0, -1.0, 0.0, 0.0 };
  glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
  glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
  glEnable(GL_LIGHT1);
  glEnable(GL_NORMALIZE);

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

  // Initialize graphics modes
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_CULL_FACE);

  // Initialize shaders
  CompileShaders();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x18b4a9(%rip), %rsi    # 0x1bca30
movl $0xb53, %edi            # imm = 0xB53
callq 0x28260
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x27150
leaq 0x18b499(%rip), %rdx    # 0x1bca40
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
callq 0x28100
leaq 0x18b493(%rip), %rdx    # 0x1bca50
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
callq 0x28100
movl $0x4000, %edi           # imm = 0x4000
callq 0x27860
leaq 0x18b483(%rip), %rdx    # 0x1bca60
movl $0x4001, %edi           # imm = 0x4001
movl $0x1201, %esi           # imm = 0x1201
callq 0x28100
leaq 0x18b47d(%rip), %rdx    # 0x1bca70
movl $0x4001, %edi           # imm = 0x4001
movl $0x1203, %esi           # imm = 0x1203
callq 0x28100
movl $0x4001, %edi           # imm = 0x4001
callq 0x27860
movl $0xba1, %edi            # imm = 0xBA1
callq 0x27860
movl $0xb57, %edi            # imm = 0xB57
callq 0x27860
movl $0x404, %edi            # imm = 0x404
movl $0x1602, %esi           # imm = 0x1602
callq 0x275b0
movl $0xb71, %edi            # imm = 0xB71
callq 0x27860
movl $0xb44, %edi            # imm = 0xB44
callq 0x27860
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x388(%rax)
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::ResetCamera()
void R3SurfelViewer::
ResetCamera(void)
{
  // Move center point to scene centroid
  if (!scene) return;
  SetCenterPoint(scene->Centroid());
  R3Point eye = CenterPoint() + 2 * scene->BBox().DiagonalRadius() * R3posz_vector;
  viewer.RepositionCamera(eye);
  viewer.ReorientCamera(R3negz_vector, R3posy_vector);
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x31742
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdi
leaq 0x192ed1(%rip), %r14    # 0x1c4558
movq %r14, %rsi
testq %rdi, %rdi
je 0x31697
callq 0x4003c
movq %rax, %rsi
movq (%rsi), %rax
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq *0x68(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x80(%rax)
leaq 0x2b0(%rbx), %r15
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x316d7
callq 0x4003c
movq %rax, %r14
movq %r14, %rdi
callq 0xad918
mulsd 0x106929(%rip), %xmm0   # 0x138010
addsd %xmm0, %xmm0
leaq 0x110bf6(%rip), %rsi    # 0x1422e8
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xc5162
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xc4077
subq $-0x80, %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7a61c
leaq 0x110c08(%rip), %rsi    # 0x142330
leaq 0x110ba1(%rip), %rdx    # 0x1422d0
movq %rbx, %rdi
callq 0x7a622
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::ZoomCamera(double)
void R3SurfelViewer::
ZoomCamera(RNScalar scale)
{
  // Zoom into center point so that an area of radius scale is visible
  if (!scene) return;
  R3Point eye = center_point - scale * scene->BBox().DiagonalRadius() * viewer.Camera().Towards();
  viewer.RepositionCamera(eye);
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x31803
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
movsd %xmm0, 0x8(%rsp)
leaq 0x2b0(%rdi), %rbx
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x31786
callq 0x4003c
movq %rax, %rdi
jmp 0x3178d
leaq 0x192dcb(%rip), %rdi    # 0x1c4558
callq 0xad918
mulsd 0x106876(%rip), %xmm0   # 0x138010
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x80(%r14), %r15
addq $0xc8, %r14
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xc5400
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
callq 0xc5162
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xc4753
movq %r15, %rdi
movq %r12, %rsi
callq 0x7a61c
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::SelectPoint(gaps::R3SurfelObject*)
void R3SurfelViewer::
SelectPoint(R3SurfelObject *object)
{
  // Create pointset
  R3SurfelPointSet *pointset = object->PointSet(TRUE);
  if (!pointset) {
    SelectPoint(NULL, -1);
    return;
  }

  // Get object centroid
  R3Point centroid = object->Centroid();

  // Find point nearest object centroid
  RNLength best_dd = FLT_MAX;
  R3SurfelPoint *best_point = NULL;
  for (int i = 0; i < pointset->NPoints(); i++) {
    R3SurfelPoint *point = pointset->Point(i);
    RNLength dd = R3SquaredDistance(centroid, point->Position());
    if (dd < best_dd) {
      best_point = point;
      best_dd = dd;
    }
  }

  // Select point 
  R3SurfelBlock *block = (best_point) ? best_point->Block() : NULL;
  int surfel_index = (best_point) ? best_point->BlockIndex() : -1;
  SelectPoint(block, surfel_index);

  // Delete pointset
  delete pointset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movq %rsi, %rdi
movl $0x1, %esi
callq 0x46d72
testq %rax, %rax
je 0x31909
movq %rax, %r14
movq %r15, %rdi
callq 0x46944
movq (%rax), %rcx
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq *0x68(%rcx)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $0x0, 0x10(%r14)
jle 0x3192d
movq %rbx, 0x8(%rsp)
movsd 0x106ad0(%rip), %xmm0   # 0x138338
xorl %r13d, %r13d
leaq 0x30(%rsp), %r15
xorl %ebx, %ebx
xorl %ebp, %ebp
movsd %xmm0, 0x10(%rsp)
movq 0x8(%r14), %rax
leaq (%rax,%r13), %r12
movq (%rax,%r13), %rcx
movq 0x8(%rax,%r13), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
addsd 0x10(%rcx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%rax), %xmm1
addsd 0x18(%rcx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rax), %xmm2
addsd 0x20(%rcx), %xmm2
movq %r15, %rdi
callq 0xc3d32
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x8baff
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %r12, %rbp
minsd %xmm1, %xmm0
incq %rbx
movslq 0x10(%r14), %rax
addq $0x10, %r13
cmpq %rax, %rbx
jl 0x31874
testq %rbp, %rbp
movq 0x8(%rsp), %rbx
je 0x31931
movq (%rbp), %rsi
movq 0x8(%rbp), %rax
subq (%rsi), %rax
shrq $0x4, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
jmp 0x31938
movq (%rbx), %rax
movq 0x1b8(%rax), %rax
movq %rbx, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
xorl %esi, %esi
jmp 0x31938
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x1b8(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::SelectPoint(gaps::R3SurfelBlock*, int)
void R3SurfelViewer::
SelectPoint(R3SurfelBlock *block, int surfel_index)
{
  // Remember previously selected point
  R3SurfelPoint *previous_selected_point = selected_point;

  // Select point
  selected_point = NULL;
  if (block && (surfel_index >= 0) && (surfel_index < block->NSurfels())) {
    selected_point = new R3SurfelPoint(block, surfel_index);
  }

  // Delete previously selected point
  if (previous_selected_point) delete previous_selected_point;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x2c8(%rdi), %rbx
movq $0x0, 0x2c8(%rdi)
testq %rsi, %rsi
sete %al
testl %edx, %edx
sets %cl
orb %al, %cl
jne 0x319b3
movl %edx, %ebp
movq %rsi, %r15
cmpl %edx, 0x8(%rsi)
jle 0x319b3
movq %rdi, %r14
movl $0x10, %edi
callq 0x27910
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x3b994
movq %r12, 0x2c8(%r14)
testq %rbx, %rbx
je 0x319d5
movq %rbx, %rdi
callq 0x3ba06
movl $0x10, %esi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x27930
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x10, %esi
movq %r12, %rdi
callq 0x27930
movq %rbx, %rdi
callq 0x28120
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::SelectImage(gaps::R3SurfelImage*, int, int)
void R3SurfelViewer::
SelectImage(R3SurfelImage *image, RNBoolean update_working_set, RNBoolean jump_to_viewpoint)
{
  // Jump to viewpoint
  if (image && jump_to_viewpoint) {
    R3Camera camera(image->Viewpoint(), image->Towards(), image->Up(),
      image->XFOV(), image->YFOV(), viewer.Camera().Near(), viewer.Camera().Far());
    viewer.SetCamera(camera);
  }

  // Update working set
  if (image && update_working_set) {
    R3SurfelScan *scan = image->Scan();
    R3SurfelNode *node = (scan) ? scan->Node() : NULL;
    if (!node) {
      SetCenterPoint(image->Viewpoint() + 2.0 * image->Towards());
    }
    else {
      EmptyWorkingSet();
      center_point = node->Centroid();
      InsertIntoWorkingSet(node, TRUE);
    }
  }

  // Remember selected image
  selected_image = image;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
sete %al
testl %ecx, %ecx
sete %cl
orb %al, %cl
jne 0x31ae7
movl %edx, 0xc(%rsp)
leaq 0x78(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0xc5400
movsd 0xb0(%rbx), %xmm2
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
xorpd %xmm0, %xmm0
jae 0x31a68
xorps %xmm0, %xmm0
cvtsi2sdl 0x98(%rbx), %xmm0
mulsd 0x1065b5(%rip), %xmm0   # 0x138010
divsd %xmm2, %xmm0
callq 0x27780
xorpd %xmm1, %xmm1
leaq 0x30(%rbx), %r12
leaq 0x60(%rbx), %r15
movsd 0xb8(%rbx), %xmm2
ucomisd %xmm2, %xmm1
jae 0x31aaa
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x9c(%rbx), %xmm0
mulsd 0x106579(%rip), %xmm0   # 0x138010
divsd %xmm2, %xmm0
callq 0x27780
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
leaq 0x78(%r14), %r13
movsd 0xf0(%r14), %xmm2
movsd 0xf8(%r14), %xmm3
leaq 0x48(%rsp), %rbp
leaq 0x18(%rsp), %rdx
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rcx
callq 0x79f14
movq %r13, %rdi
movq %rbp, %rsi
callq 0x78604
movl 0xc(%rsp), %edx
testq %rbx, %rbx
sete %al
testl %edx, %edx
sete %cl
orb %al, %cl
jne 0x31ba5
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x31b56
movq 0x18(%rax), %r15
testq %r15, %r15
je 0x31b56
movq (%r14), %rax
movq %r14, %rdi
callq *0x308(%rax)
movq %r15, %rdi
callq 0x4003c
movq (%rax), %rcx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq *0x68(%rcx)
leaq 0x2b0(%r14), %rdi
movq %r12, %rsi
callq 0xc409a
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq *0x328(%rax)
jmp 0x31ba5
leaq 0x30(%rbx), %r15
leaq 0x78(%rbx), %rsi
leaq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0xc5400
leaq 0x18(%rsp), %r13
movsd 0x106898(%rip), %xmm0   # 0x138410
movq %r13, %rdi
movq %r12, %rsi
callq 0xc5162
leaq 0x48(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xc4077
movq (%r14), %rax
movq %r14, %rdi
movq %r12, %rsi
callq *0x80(%rax)
movq %rbx, 0x2d0(%r14)
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::WriteImage(char const*)
int R3SurfelViewer::
WriteImage(const char *filename)
{
  // Check if can write file
  FILE *fp = fopen(filename, "w");
  if (!fp) return 0;
  else fclose(fp);

  // Remember screenshot image name -- capture image next redraw
  if (screenshot_name) free(screenshot_name);
  if (!filename) screenshot_name = NULL;
  else screenshot_name = RNStrdup(filename);

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10f815(%rip), %rsi    # 0x1413e4
movq %r14, %rdi
callq 0x27b00
testq %rax, %rax
je 0x31c04
movq %rax, %rdi
callq 0x27900
movq 0x4f0(%rbx), %rdi
testq %rdi, %rdi
je 0x31bf5
callq 0x27b20
testq %r14, %r14
je 0x31c08
movq %r14, %rdi
callq 0xe839b
jmp 0x31c0a
xorl %eax, %eax
jmp 0x31c16
xorl %eax, %eax
movq %rax, 0x4f0(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::ReadCoarsestBlocks(double)
void R3SurfelViewer::
ReadCoarsestBlocks(RNScalar max_complexity)
{
  // Just checking
  if (!scene) return;

  // Get convenient variables
  R3SurfelTree *tree = scene->Tree();
  if (!tree) return;

  // Seed breadth first search with root node
  RNQueue<R3SurfelNode *> queue;
  queue.Insert(tree->RootNode());

  // Visit nodes in breadth first search reading blocks
  RNScalar total_complexity = 0;
  while (!queue.IsEmpty()) {
    R3SurfelNode *node = queue.Pop();
    if (total_complexity + node->Complexity() > max_complexity) break;
    total_complexity += node->Complexity();
    node->ReadBlocks();
    for (int i = 0; i < node->NParts(); i++) {
      R3SurfelNode *part = node->Part(i);
      queue.Push(part);
    }
  }

  // Invalidate VBO buffers
  InvalidateVBO();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movsd %xmm0, 0x28(%rsp)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x32012
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x32012
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xe5684
movq 0x18(%r15), %rax
movq (%rax), %rsi
movl 0x10(%r14), %edx
movq %r14, %rdi
callq 0xe56f4
cmpl $0x0, 0x20(%rsp)
je 0x31ffc
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x10(%rsp), %r14
movl 0x24(%rsp), %eax
cltd
idivl 0x18(%rsp)
movq 0x10(%rsp), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %r15
movq %r14, %rdi
xorl %esi, %esi
callq 0xe58a8
movq %r15, %rdi
callq 0x3ff0e
addsd 0x8(%rsp), %xmm0
ucomisd 0x28(%rsp), %xmm0
ja 0x31ffc
movq %r15, %rdi
callq 0x3ff0e
movsd %xmm0, 0x30(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x4071e
cmpl $0x0, 0x3c(%r15)
jle 0x31fdf
xorl %r12d, %r12d
movq 0x30(%r15), %rax
movq (%rax,%r12,8), %rsi
movl 0x20(%rsp), %edx
movq %r14, %rdi
callq 0xe56f4
incq %r12
movslq 0x3c(%r15), %rax
cmpq %rax, %r12
jl 0x31fbf
movsd 0x8(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $0x0, 0x20(%rsp)
jne 0x31f68
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x378(%rax)
leaq 0x10(%rsp), %rdi
callq 0xe5a32
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x32024
jmp 0x32024
jmp 0x32024
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xe5a32
movq %rbx, %rdi
callq 0x28120
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::ReleaseCoarsestBlocks(double)
void R3SurfelViewer::
ReleaseCoarsestBlocks(RNScalar max_complexity)
{
  // Just checking
  if (!scene) return;

  // Get convenient variables
  R3SurfelTree *tree = scene->Tree();
  if (!tree) return;

  // Seed breadth first search with root nodes
  RNQueue<R3SurfelNode *> queue;
  for (int i = 0; i < tree->NNodes(); i++) {
    R3SurfelNode *node = tree->Node(i);
    queue.Insert(node);
  }

  // Visit nodes in breadth first search reading blocks
  RNScalar total_complexity = 0;
  while (!queue.IsEmpty()) {
    R3SurfelNode *node = queue.Pop();
    if (total_complexity + node->Complexity() > max_complexity) break;
    total_complexity += node->Complexity();
    node->ReleaseBlocks();
    for (int i = 0; i < node->NParts(); i++) {
      R3SurfelNode *part = node->Part(i);
      queue.Push(part);
    }
  }

  // Invalidate VBO buffers
  InvalidateVBO();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movsd %xmm0, 0x28(%rsp)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x32165
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x32165
movq %rdi, %rbx
leaq 0x10(%rsp), %rdi
callq 0xe5684
cmpl $0x0, 0x24(%r15)
jle 0x320a1
xorl %r12d, %r12d
leaq 0x10(%rsp), %r14
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rsi
movl 0x20(%rsp), %edx
movq %r14, %rdi
callq 0xe56f4
incq %r12
movslq 0x24(%r15), %rax
cmpq %rax, %r12
jl 0x32081
cmpl $0x0, 0x20(%rsp)
je 0x3214f
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x10(%rsp), %r14
movl 0x24(%rsp), %eax
cltd
idivl 0x18(%rsp)
movq 0x10(%rsp), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %r15
movq %r14, %rdi
xorl %esi, %esi
callq 0xe58a8
movq %r15, %rdi
callq 0x3ff0e
addsd 0x8(%rsp), %xmm0
ucomisd 0x28(%rsp), %xmm0
ja 0x3214f
movq %r15, %rdi
callq 0x3ff0e
movsd %xmm0, 0x30(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x407bc
cmpl $0x0, 0x3c(%r15)
jle 0x32132
xorl %r12d, %r12d
movq 0x30(%r15), %rax
movq (%rax,%r12,8), %rsi
movl 0x20(%rsp), %edx
movq %r14, %rdi
callq 0xe56f4
incq %r12
movslq 0x3c(%r15), %rax
cmpq %rax, %r12
jl 0x32112
movsd 0x8(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $0x0, 0x20(%rsp)
jne 0x320bb
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x378(%rax)
leaq 0x10(%rsp), %rdi
callq 0xe5a32
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x32177
jmp 0x32177
jmp 0x32177
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xe5a32
movq %rbx, %rdi
callq 0x28120
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::EmptyWorkingSet()
void R3SurfelViewer::
EmptyWorkingSet(void)
{
  // Just checking
  if (!scene) return;

  // Release blocks from resident nodes
  resident_nodes.ReleaseBlocks();

  // Empty resident nodes
  resident_nodes.Empty();

  // Invalidate VBO buffers
  InvalidateVBO();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x321c1
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq %r14, %rdi
callq 0x417fc
movq %r14, %rdi
callq 0x41776
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *0x378(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::UpdateWorkingSet(gaps::R3Point const&, double, double)
void R3SurfelViewer::
UpdateWorkingSet(const R3Point& center, RNScalar resolution, RNScalar radius)
{
  // Just checking
  if (!scene) return;

  // Get convenient variables
  R3SurfelTree *tree = scene->Tree();
  if (!tree) return;

  // Check if already at full resolution
  if ((resolution == last_target_resolution) && (resolution >= RN_INFINITY) && 
      (radius == last_focus_radius) && (radius >= RN_INFINITY)) return;

  // Find new set of nodes
  R3SurfelNodeSet new_resident_nodes;
  new_resident_nodes.InsertNodes(tree, center, radius, -FLT_MAX, FLT_MAX, resolution, RN_EPSILON);

  // Read new working set
  new_resident_nodes.ReadBlocks();

  // Release old working set
  resident_nodes.ReleaseBlocks();

  // Now use newnodes 
  resident_nodes = new_resident_nodes;

  // Invalidate VBO buffers
  InvalidateVBO();

  // Remember parameters
  last_target_resolution = resolution;
  last_focus_radius = radius;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x32305
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x32305
movq %rsi, %r14
movq %rdi, %rbx
movsd 0x470(%rdi), %xmm2
ucomisd %xmm0, %xmm2
jne 0x32230
jp 0x32230
leaq 0x18af8c(%rip), %rax    # 0x1bd198
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm1
jb 0x32230
ucomisd %xmm2, %xmm0
jb 0x32230
movsd 0x480(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jne 0x32230
jnp 0x32305
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
callq 0x411ac
leaq 0x18af39(%rip), %rax    # 0x1bd188
movsd (%rax), %xmm4
movsd 0x1060e5(%rip), %xmm1   # 0x138340
movsd 0x1060d5(%rip), %xmm2   # 0x138338
movsd 0x1061c5(%rip), %xmm5   # 0x138430
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm3
callq 0x41636
leaq 0x10(%rsp), %rdi
callq 0x417c8
leaq 0x10(%rbx), %rdi
callq 0x417fc
leaq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe59dc
leaq 0x38(%rsp), %rsi
movsd -0x10(%rsi), %xmm0
movsd %xmm0, 0x28(%rbx)
leaq 0x38(%rbx), %rdi
callq 0xc409a
leaq 0x50(%rbx), %rdi
leaq 0x50(%rsp), %rsi
callq 0xc409a
movups 0x68(%rsp), %xmm0
movups %xmm0, 0x68(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x378(%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x470(%rbx)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x480(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x412c0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x412c0
movq %rbx, %rdi
callq 0x28120
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::InsertIntoWorkingSet(gaps::R3SurfelNode*, int)
void R3SurfelViewer::
InsertIntoWorkingSet(R3SurfelNode *node, RNBoolean full_resolution)
{
  // Just checking
  if (!scene) return;

  // Recurse to children
  if (full_resolution) {
    if (node->NParts() == 0) {
      InsertIntoWorkingSet(node, FALSE);
    }
    else {
      for (int i = 0; i < node->NParts(); i++) {
        R3SurfelNode *part = node->Part(i);
        InsertIntoWorkingSet(part, full_resolution);
      }
    }
  }
  else {
    // Read blocks 
    node->ReadBlocks();

    // Insert into resident nodes
    resident_nodes.InsertNode(node);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x32bdb
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x32be6
cmpl $0x0, 0x3c(%rbx)
je 0x32c09
jle 0x32bdb
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq (%r14), %rax
movq %r14, %rdi
movl %ebp, %edx
callq *0x328(%rax)
incq %r15
movslq 0x3c(%rbx), %rax
cmpq %rax, %r15
jl 0x32bb9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4071e
addq $0x10, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4168a
movq (%r14), %rax
movq 0x328(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::RemoveFromWorkingSet(gaps::R3SurfelNode*, int)
void R3SurfelViewer::
RemoveFromWorkingSet(R3SurfelNode *node, RNBoolean full_resolution)
{
  // Just checking
  if (!scene) return;

  // Recurse to children
  if (full_resolution) {
    if (node->NParts() == 0) {
      RemoveFromWorkingSet(node, FALSE);
    }
    else {
      for (int i = 0; i < node->NParts(); i++) {
        R3SurfelNode *part = node->Part(i);
        RemoveFromWorkingSet(part, full_resolution);
      }
    }
  }
  else {
    // Release blocks 
    node->ReleaseBlocks();

    // Remove from resident nodes
    resident_nodes.RemoveNode(node);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x32c6f
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x32c7a
cmpl $0x0, 0x3c(%rbx)
je 0x32c9d
jle 0x32c6f
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq (%r14), %rax
movq %r14, %rdi
movl %ebp, %edx
callq *0x330(%rax)
incq %r15
movslq 0x3c(%rbx), %rax
cmpq %rax, %r15
jl 0x32c4d
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
callq 0x407bc
addq $0x10, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x416fe
movq (%r14), %rax
movq 0x330(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::RotateWorld(double, gaps::R3Point const&, int, int, int, int)
void R3SurfelViewer::
RotateWorld(RNScalar factor, const R3Point& origin, int, int, int dx, int dy)
{
  // Rotate world based on mouse (dx)
  if ((dx == 0) && (dy == 0)) return;
  RNLength vx = (RNLength) dx / (RNLength) viewer.Viewport().Width();
  RNLength vy = (RNLength) dy / (RNLength) viewer.Viewport().Height();
  RNAngle theta = -1 * factor * 4.0 * vx;
  viewer.RotateWorld(origin, viewer.Camera().Up(), theta);
  RNAngle phi = factor * 4.0 * vy;
  RNAngle max_phi = R3InteriorAngle(viewer.Camera().Towards(), R3posz_vector) - RN_PI_OVER_TWO;
  if (phi > max_phi) phi = max_phi;
  viewer.RotateWorld(origin, viewer.Camera().Right(), phi);
}

// Assembly:
movl %r9d, %eax
orl %r8d, %eax
je 0x32d9e
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movapd %xmm0, %xmm2
movq %rdi, %r14
cvtsi2sd %r8d, %xmm1
leaq 0x78(%rdi), %r15
xorps %xmm0, %xmm0
cvtsi2sdl 0x118(%rdi), %xmm0
cvtsi2sd %r9d, %xmm3
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x11c(%rdi), %xmm0
divsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rsp)
movsd 0x1056e9(%rip), %xmm0   # 0x138400
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
leaq 0xb0(%rdi), %rdx
movq %r15, %rdi
movsd %xmm2, (%rsp)
callq 0x787ea
movsd (%rsp), %xmm0
mulsd 0x1056c8(%rip), %xmm0   # 0x138408
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0xc8(%r14), %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0xc5400
leaq 0x10f582(%rip), %rsi    # 0x1422e8
movq %r12, %rdi
callq 0x8e387
leaq 0x110a43(%rip), %rax    # 0x1437b8
subsd (%rax), %xmm0
minsd (%rsp), %xmm0
addq $0x98, %r14
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x787ea
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::PickObject(int, int, gaps::R3Point*)
R3SurfelObject *R3SurfelViewer::
PickObject(int x, int y, R3Point *picked_position)
{
  // Pick node
  R3SurfelNode *node = PickNode(x, y, picked_position, NULL, NULL, TRUE);
  if (!node) return NULL;

  // Get picked object
  R3SurfelObject *picked_object = node->Object(TRUE);
  if (!picked_object) return NULL;

  // Adjust picked object to be ancestor directly under root object
  while (picked_object && picked_object->Parent() && (picked_object->Parent() != scene->RootObject())) {
    picked_object = picked_object->Parent();
  }

  // Return picked object
  return picked_object;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rax
movl $0x1, (%rsp)
xorl %ebx, %ebx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq *0x1f8(%rax)
testq %rax, %rax
je 0x33049
xorl %ebx, %ebx
movq %rax, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x401d4
testq %rax, %rax
je 0x33049
movq 0x8(%r14), %rcx
movq %rax, %rbx
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x33049
movq 0x10(%rcx), %rdx
cmpq (%rdx), %rax
jne 0x33034
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawObject(gaps::R3SurfelObject*, gaps::RNFlags) const
void R3SurfelViewer::
DrawObject(R3SurfelObject *object, RNFlags draw_flags) const
{
  // Draw nodes
  for (int i = 0; i < object->NNodes(); i++) {
    R3SurfelNode *node = object->Node(i);
    if (!node->DrawResidentDescendents(draw_flags)) {
      if (!node->DrawResidentAncestor(draw_flags)) {
        // const char *object_name = (object->Name()) ? object->Name() : "None";
        // RNFail("Did not draw object %s\n", object_name);
      }
    }
  }

  // Draw parts
  for (int i = 0; i < object->NParts(); i++) {
    R3SurfelObject *part = object->Part(i);
    DrawObject(part, draw_flags);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x0, 0x6c(%rsi)
jle 0x33683
xorl %r13d, %r13d
movq 0x60(%r14), %rax
movq (%rax,%r13,8), %r12
movq (%r12), %rax
movq %r12, %rdi
movq %rbx, %rsi
callq *0x58(%rax)
testl %eax, %eax
jne 0x33677
movq (%r12), %rax
movq %r12, %rdi
movq %rbx, %rsi
callq *0x50(%rax)
incq %r13
movslq 0x6c(%r14), %rax
cmpq %rax, %r13
jl 0x33651
cmpl $0x0, 0x2c(%r14)
jle 0x336b0
xorl %r12d, %r12d
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rsi
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rdx
callq *0x360(%rax)
incq %r12
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jl 0x3368d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DeleteShaders()
void R3SurfelViewer::
DeleteShaders(void)
{
  // Delete shader program
  if (shader_program > 0) {
    glDetachShader(shader_program, vertex_shader);
    glDetachShader(shader_program, fragment_shader);
    glDeleteProgram(shader_program);
    shader_program = 0;
  }

  // Delete vertex shader
  if (vertex_shader > 0) {
    glDeleteShader(vertex_shader);
    vertex_shader = 0;
  }

  // Delete fragment shader
  if (fragment_shader > 0) {
    glDeleteShader(fragment_shader);
    fragment_shader = 0;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x608(%rdi), %edi
testl %edi, %edi
je 0x344af
movq 0x187a4a(%rip), %r14    # 0x1bbec8
movl 0x60c(%rbx), %esi
callq *(%r14)
movl 0x608(%rbx), %edi
movl 0x610(%rbx), %esi
callq *(%r14)
movq 0x187a33(%rip), %rax    # 0x1bbed0
movl 0x608(%rbx), %edi
callq *(%rax)
movl $0x0, 0x608(%rbx)
movl 0x60c(%rbx), %edi
testl %edi, %edi
je 0x344cc
movq 0x187ad0(%rip), %rax    # 0x1bbf90
callq *(%rax)
movl $0x0, 0x60c(%rbx)
movl 0x610(%rbx), %edi
testl %edi, %edi
je 0x344e9
movq 0x187ab3(%rip), %rax    # 0x1bbf90
callq *(%rax)
movl $0x0, 0x610(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/RNQueue.cpp
// Function: gaps::RNVQueue::FindEntry(void const*) const
RNQueueEntry *RNVQueue::
FindEntry(const void *data) const
{
  // Search for entry matching data
  for (int i = 0; i < nentries; i++) {
    RNQueueEntry *entry = KthEntry(i);
    if (EntryContents(entry) == data) return entry;
  }

  // Entry was not found
  return NULL;
}

// Assembly:
movl 0x10(%rdi), %r9d
testl %r9d, %r9d
jle 0xe56e8
movl 0x14(%rdi), %r8d
movl 0x8(%rdi), %r10d
movq (%rdi), %rdi
xorl %ecx, %ecx
movl %r8d, %eax
cltd
idivl %r10d
movslq %edx, %rax
cmpq %rsi, (%rdi,%rax,8)
je 0xe56ec
incl %r8d
decl %r9d
jne 0xe56ce
jmp 0xe56f0
xorl %ecx, %ecx
jmp 0xe56f0
leaq (%rdi,%rax,8), %rcx
movq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/RNQueue.cpp
// Function: gaps::RNVQueue::InternalInsert(void*, int)
RNQueueEntry *RNVQueue::
InternalInsert(void *data, int k)
{
  // Make sure there is enough storage for new entry
  Resize(nentries + 1);

  // Increment number of entries
  nentries++;

  // Check where entry is being inserted
  if (k == 0) {
    // Insert into head by shifting head back one
    head = (head + entries.NEntries() - 1) % entries.NEntries();
  }
  else if (k < (nentries-1)) {
    // Insert into middle by shifting all subsequent entries up one
    Shift(k, 0, 1);
  }

  // Get Kth entry
  RNQueueEntry *entry = KthEntry(k);

  // Insert data in kth entry 
  EntryContents(entry) = data;

  // Return entry
  return entry;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x10(%rdi), %esi
incl %esi
callq 0xe5760
movl 0x10(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
testl %ebp, %ebp
je 0xe5730
cmpl %ebp, %eax
jle 0xe5743
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xe57e6
jmp 0xe5743
movl 0xc(%r14), %ecx
movl 0x14(%r14), %eax
addl %ecx, %eax
decl %eax
cltd
idivl %ecx
movl %edx, 0x14(%r14)
addl 0x14(%r14), %ebp
movl %ebp, %eax
cltd
idivl 0x8(%r14)
movq (%r14), %rax
movslq %edx, %rcx
leaq (%rax,%rcx,8), %rax
movq %rbx, (%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/RNQueue.cpp
// Function: gaps::RNVQueue::Shift(int, int, int)
void RNVQueue::
Shift(int start, int length, int delta)
{
  /* Compute number of entries to shift */
  if ((delta < 0) && (start < -delta)) start = -delta;
  int nshift = nentries - start;
  if (delta > 0) nshift -= delta;
  if (nshift <= 0) return;
  if ((length > 0) && (length < nshift)) nshift = length;

  /* Shift queue entries */
  if (delta < 0) {
    for (int i = start; i < (start + nshift); i++) {
      EntryContents(KthEntry(i+delta)) = EntryContents(KthEntry(i));
    }
  }
  else if (delta > 0) {
    for (int i = (start + nshift - 1); i >= start; i--) {
      EntryContents(KthEntry(i+delta)) = EntryContents(KthEntry(i));
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
movl %ecx, %r8d
negl %r8d
cmpl %esi, %r8d
cmovlel %esi, %r8d
xorl %r9d, %r9d
testl %ecx, %ecx
movl %esi, %r10d
cmovsl %r8d, %r10d
cmovgl %ecx, %r9d
movl 0x10(%rdi), %eax
addl %r10d, %r9d
subl %r9d, %eax
testl %eax, %eax
jle 0xe58a4
cmpl %edx, %eax
movl %edx, %r9d
cmovbl %eax, %r9d
testl %edx, %edx
cmovlel %eax, %r9d
testl %ecx, %ecx
js 0xe5872
jle 0xe58a4
testl %r9d, %r9d
jle 0xe58a4
addl %esi, %r9d
movl 0x8(%rdi), %esi
movl 0x14(%rdi), %r8d
addl %r8d, %ecx
decl %ecx
decl %r8d
leal -0x1(%r9), %r11d
leal (%r8,%r9), %eax
cltd
idivl %esi
movq (%rdi), %rbx
movslq %edx, %rax
movq (%rbx,%rax,8), %r14
addl %ecx, %r9d
movl %r9d, %eax
cltd
idivl %esi
movslq %edx, %rax
movq %r14, (%rbx,%rax,8)
movl %r11d, %r9d
cmpl %r10d, %r11d
jg 0xe5843
jmp 0xe58a4
testl %r9d, %r9d
jle 0xe58a4
movl 0x8(%rdi), %esi
addl 0x14(%rdi), %r8d
movl %r8d, %eax
cltd
idivl %esi
movq (%rdi), %r10
movslq %edx, %rax
movq (%r10,%rax,8), %r11
leal (%rcx,%r8), %eax
cltd
idivl %esi
movslq %edx, %rax
movq %r11, (%r10,%rax,8)
incl %r8d
decl %r9d
jne 0xe587e
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/RNQueue.cpp
// Function: gaps::RNVQueue::InternalRemove(int)
void RNVQueue::
InternalRemove(int k) 
{
  // Check where entry is being removed
  if (k == 0) {
    // Remove from head by shifting head forward one
    head = (head + 1) % entries.NEntries();
  }
  else if (k < (nentries-1)) {
    // Remove from middle by shifting all subsequent entries back one
    Shift(k+1, 0, -1);
  }

  // Decrement number of entries
  nentries--;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0xe58cc
movl 0x10(%rbx), %eax
decl %eax
cmpl %esi, %eax
jle 0xe58d8
incl %esi
movq %rbx, %rdi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xe57e6
jmp 0xe58d8
movl 0x14(%rbx), %eax
incl %eax
cltd
idivl 0xc(%rbx)
movl %edx, 0x14(%rbx)
decl 0x10(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/RNQueue.cpp
// Function: gaps::RNVQueue::Reverse(int, int)
void RNVQueue::
Reverse(int start, int length)
{
  /* Compute number of entries to reverse */
  int nreverse = nentries - start;
  if (nreverse <= 0) return;
  if ((length > 0) && (length < nreverse)) nreverse = length;
  if (nreverse <= 0) return;

  // Reverse length at start
  int i, j;
  for (i = start, j = start + nreverse - 1; i < j; i++, j--) {
    RNSwap(KthEntry(i), KthEntry(j), NULL, sizeof(void *));
  }
}

// Assembly:
movl 0x10(%rdi), %eax
subl %esi, %eax
jle 0xe5997
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
cmpl %edx, %eax
movl %edx, %ecx
cmovbl %eax, %ecx
testl %edx, %edx
cmovlel %eax, %ecx
leal (%rcx,%rbx), %ebp
decl %ebp
cmpl %esi, %ebp
jle 0xe5993
movq %rdi, %r14
movl 0x14(%r14), %ecx
leal (%rbx,%rcx), %eax
movl 0x8(%r14), %esi
cltd
idivl %esi
movq (%r14), %r8
movslq %edx, %rax
leaq (%r8,%rax,8), %rdi
addl %ebp, %ecx
movl %ecx, %eax
cltd
idivl %esi
movslq %edx, %rax
leaq (%r8,%rax,8), %rsi
xorl %edx, %edx
movl $0x8, %ecx
callq 0xe82bf
incl %ebx
decl %ebp
cmpl %ebp, %ebx
jl 0xe5959
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scn2cam/scn2cam.cpp
// Function: IsObject(gaps::R3SceneNode*)
static RNBoolean
IsObject(R3SceneNode *node)
{
  // Check name
  if (!node->Name()) return 0;

  // Check category identifier
  if (input_categories_filename) {
    // Check if object with category
    if (strncmp(node->Name(), "Model#", 6)) return 0;
    
    // Get category identifier
    R3SceneNode *ancestor = node;
    const char *category_identifier = NULL;
    while (!category_identifier && ancestor) {
      category_identifier = node->Info("empty_struct_obj");
      ancestor = ancestor->Parent();
    }

    // Check category identifier
    if (category_identifier) {
      if (strcmp(category_identifier, "2")) return 0;
    }
  }

  // Passed all tests
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x1a0(%rdi), %rdi
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x2b5e3
cmpq $0x0, 0x136327(%rip)    # 0x161860
je 0x2b5de
leaq 0xc70ed(%rip), %rsi     # 0xf2633
movl $0x6, %edx
callq 0x223b0
testl %eax, %eax
jne 0x2b5e3
leaq 0x18(%rsp), %r13
leaq 0xc70e6(%rip), %r15     # 0xf264a
leaq 0x8(%rsp), %r12
movq %rbx, %rbp
movq %r13, 0x8(%rsp)
movq %r12, %rdi
leaq 0xc70bf(%rip), %rsi     # 0xf263a
movq %r15, %rdx
callq 0x2cd6a
movq 0x50(%rbx), %rdi
movq %r12, %rsi
callq 0x2c9ac
movq 0x50(%rbx), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
je 0x2b5a2
movq 0x40(%rax), %r14
jmp 0x2b5a5
xorl %r14d, %r14d
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2b5bc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x228b0
movq 0x10(%rbp), %rbp
testq %rbp, %rbp
je 0x2b5ca
testq %r14, %r14
je 0x2b56c
testq %r14, %r14
je 0x2b5de
xorl %ebp, %ebp
cmpb $0x32, (%r14)
jne 0x2b5e3
cmpb $0x0, 0x1(%r14)
jne 0x2b5e3
movl $0x1, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2b60e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x228b0
movq %rbx, %rdi
callq 0x23090
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/scn2cam/scn2cam.cpp
// Function: DrawNodeWithOpenGL(gaps::R3Scene*, gaps::R3SceneNode*, gaps::R3SceneNode*, int)
static void 
DrawNodeWithOpenGL(R3Scene *scene, R3SceneNode *node, R3SceneNode *selected_node, int image_type)
{
  // Set color based on node index
  RNFlags draw_flags = R3_DEFAULT_DRAW_FLAGS;
  if (image_type == NODE_INDEX_IMAGE) {
    draw_flags = R3_SURFACES_DRAW_FLAG;
    unsigned int node_index = node->SceneIndex() + 1;
    unsigned char color[4];
    color[0] = (node_index >> 16) & 0xFF;
    color[1] = (node_index >>  8) & 0xFF;
    color[2] = (node_index      ) & 0xFF;
    RNLoadRgb(color);
  }
  
  // Draw elements
  if (!selected_node || (selected_node == node)) {
    for (int i = 0; i < node->NElements(); i++) {
      R3SceneElement *element = node->Element(i);
      element->Draw(draw_flags);
    }
  }

  // Draw references 
  if (!selected_node || (selected_node == node)) {
    for (int i = 0; i < node->NReferences(); i++) {
      R3SceneReference *reference = node->Reference(i);
      reference->Draw(draw_flags);
    }
  }

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
incl %eax
movl %eax, %ecx
shrl $0x10, %ecx
leaq 0x4(%rsp), %rdi
movb %cl, (%rdi)
movb %ah, 0x5(%rsp)
movb %al, 0x2(%rdi)
callq 0x22b70
cmpl $0x0, 0x3c(%rbx)
jle 0x2bb7e
xorl %r14d, %r14d
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x434a4
incq %r14
movslq 0x3c(%rbx), %rax
cmpq %rax, %r14
jl 0x2bb5e
cmpl $0x0, 0x4c(%rbx)
jle 0x2bba7
xorl %r14d, %r14d
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x43926
incq %r14
movslq 0x4c(%rbx), %rax
cmpq %rax, %r14
jl 0x2bb87
cmpl $0x0, 0x2c(%rbx)
jle 0x2bbc9
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2bb31
incq %r14
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jl 0x2bbb0
addq $0x8, %rsp
popq %rbx
popq %r14
retq