LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::AdaptWorkingSet()
void R3SurfelViewer::
AdaptWorkingSet(void)
{
  // Check if adapting automatically
  if (!adapt_working_set_automatically) return;

  // Adjust target resolution based on frame time
  if (frame_time > 0.05) {
    SetTargetResolution(0.9 * TargetResolution());
  }
  else if (frame_time < 0.025) {
    SetTargetResolution(1.1 * TargetResolution());
  }

  // Make gross estimate of visible radius
  RNLength camera_height = viewer.Camera().Origin().Z();
  RNLength visible_radius = camera_height;

  // Adjust focus radius 
  SetFocusRadius(visible_radius);

  // Adjust surfel size based on visible radius
  if ((TargetResolution() > 0) && (visible_radius > 0)) {
    RNLength window_width = viewer.Viewport().Width();
    RNLength npixels = window_width / (visible_radius * TargetResolution());
    SetSurfelSize(npixels);
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpl $0x0, 0x460(%rdi)
je 0x2d1c3
movq %rdi, %rbx
movsd 0x4e8(%rdi), %xmm0
ucomisd 0xed28f(%rip), %xmm0    # 0x11a3c0
jbe 0x2d13d
movsd 0xed21d(%rip), %xmm0    # 0x11a358
jmp 0x2d153
movsd 0xed28b(%rip), %xmm1    # 0x11a3d0
ucomisd %xmm0, %xmm1
jbe 0x2d167
movsd 0xed275(%rip), %xmm0    # 0x11a3c8
mulsd 0x468(%rbx), %xmm0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x1c8(%rax)
movsd 0x90(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x1d0(%rax)
movsd 0x8(%rsp), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jbe 0x2d1c3
movsd 0x468(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2d1c3
cvtsi2sdl 0x118(%rbx), %xmm0
mulsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq (%rbx), %rax
movq 0x98(%rax), %rax
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmpq *%rax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawSurfels(gaps::R3SurfelNode*, gaps::RNFlags) const
void R3SurfelViewer::
DrawSurfels(R3SurfelNode *node, RNFlags color_draw_flags) const
{
  // Check node
  if (!NodeVisibility(node)) return;

  // Draw all blocks
  for (int i = 0; i < node->NBlocks(); i++) {
    R3SurfelBlock *block = node->Block(i);
    block->Draw(shape_draw_flags | color_draw_flags, subsampling_factor);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x2c136
testl %eax, %eax
je 0x2d213
xorl %r12d, %r12d
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jge 0x2d213
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %rdi
movq 0x458(%r15), %rsi
orq %rbx, %rsi
movl 0x48c(%r15), %edx
callq 0x359ae
incq %r12
jmp 0x2d1e7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawObjectProperties(int) const
void R3SurfelViewer::
DrawObjectProperties(int property_type) const
{
  // Check stuff
  if (!scene) return;
  
  // Draw object properties
  for (int i = 0; i < scene->NObjectProperties(); i++) {
    R3SurfelObjectProperty *property = scene->ObjectProperty(i);
    if (property->Type() != property_type) continue;
    R3SurfelObject *object = property->Object();
    if (!object->Parent()) continue;
    if (object->Parent() != scene->RootObject()) continue;
    if (!ObjectVisibility(object)) continue;
    if (!object->HasSurfels(TRUE)) continue;
    if ((surfel_color_scheme == R3_SURFEL_VIEWER_COLOR_BY_OBJECT) ||
        (surfel_color_scheme == R3_SURFEL_VIEWER_COLOR_BY_CURRENT_LABEL) ||
        (surfel_color_scheme == R3_SURFEL_VIEWER_COLOR_BY_OBJECT_ATTRIBUTES)) {
      unsigned char color[3];
      CreateColor(color, surfel_color_scheme, NULL, NULL, NULL, object, NULL);
      color[0] += 0.5 * (255 - color[0]);
      color[1] += 0.5 * (255 - color[1]);
      color[2] += 0.5 * (255 - color[2]);
      RNLoadRgb(color);
    }
    property->Draw(0);
  }
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x2dc44
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %r15d, %r15d
pushq $0x1
popq %rbp
movslq 0x3c(%rax), %rcx
cmpq %rcx, %r15
jge 0x2dc36
movq 0x30(%rax), %rcx
movq (%rcx,%r15,8), %r12
cmpl %ebx, 0x2c(%r12)
jne 0x2db44
movq 0x18(%r12), %r13
movq 0x18(%r13), %rcx
testq %rcx, %rcx
je 0x2db44
movq 0x10(%rax), %rax
cmpq (%rax), %rcx
je 0x2db4d
incq %r15
movq 0x8(%r14), %rax
jmp 0x2db11
movq %r14, %rdi
movq %r13, %rsi
callq 0x2c0c6
testl %eax, %eax
je 0x2db44
movq %r13, %rdi
movl %ebp, %esi
callq 0x4321c
testl %eax, %eax
je 0x2db44
movl 0x360(%r14), %edx
cmpl $0xd, %edx
ja 0x2dc25
movl $0x2120, %eax           # imm = 0x2120
btl %edx, %eax
jae 0x2dc25
movq (%r14), %rax
movq %r14, %rdi
leaq 0x5(%rsp), %rbp
movq %rbp, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %r13
callq *0x210(%rax)
addq $0x10, %rsp
movzbl 0x5(%rsp), %eax
cvtsi2sd %eax, %xmm0
notb %al
movzbl %al, %eax
cvtsi2sd %eax, %xmm1
movsd 0xec44a(%rip), %xmm2    # 0x11a010
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movb %al, 0x5(%rsp)
movzbl 0x6(%rsp), %eax
cvtsi2sd %eax, %xmm0
notb %al
movzbl %al, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movb %al, 0x6(%rsp)
movzbl 0x7(%rsp), %eax
cvtsi2sd %eax, %xmm0
notb %al
movzbl %al, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movb %al, 0x7(%rsp)
movq %rbp, %rdi
pushq $0x1
popq %rbp
callq 0x27c00
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x10(%rax)
jmp 0x2db44
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawObjectPrincipalAxes() const
void R3SurfelViewer::
DrawObjectPrincipalAxes(void) const
{
  // Check stuff
  if (!object_principal_axes_visibility) return;
  
  // Draw object principal axes
  glDisable(GL_LIGHTING);
  RNLoadRgb(object_principal_axes_color);
  DrawObjectProperties(R3_SURFEL_OBJECT_PCA_PROPERTY);
}

// Assembly:
cmpl $0x0, 0x308(%rdi)
je 0x2dc7c
pushq %rbx
movq %rdi, %rbx
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x398(%rbx), %rdi
callq 0x32b06
movq (%rbx), %rax
movq 0x368(%rax), %rax
pushq $0x1
popq %rsi
movq %rbx, %rdi
popq %rbx
jmpq *%rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawObjectOrientedBBoxes() const
void R3SurfelViewer::
DrawObjectOrientedBBoxes(void) const
{
  // Check stuff
  if (!object_oriented_bbox_visibility) return;

  // Draw object oriented boxes
  glLineWidth(2);
  glDisable(GL_LIGHTING);
  RNLoadRgb(object_oriented_bbox_color);
  DrawObjectProperties(R3_SURFEL_OBJECT_AMODAL_OBB_PROPERTY);
  glLineWidth(1);
}

// Assembly:
cmpl $0x0, 0x30c(%rdi)
je 0x2dccb
pushq %rbx
movq %rdi, %rbx
movss 0xec861(%rip), %xmm0    # 0x11a4f4
callq 0x281c0
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x3b0(%rbx), %rdi
callq 0x32b06
movq (%rbx), %rax
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq *0x368(%rax)
movss 0xec37b(%rip), %xmm0    # 0x11a040
popq %rbx
jmp 0x281c0
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawObjectRelationships() const
void R3SurfelViewer::
DrawObjectRelationships(void) const
{
  // Check stuff
  if (!scene) return;
  if (!object_relationship_visibility) return;
  
  // Draw object relationships
  glDisable(GL_LIGHTING);
  RNLoadRgb(1.0, 1.0, 1.0);
  for (int i = 0; i < scene->NObjectRelationships(); i++) {
    R3SurfelObjectRelationship *relationship = scene->ObjectRelationship(i);
    relationship->Draw();
  }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2dd30
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x310(%rdi)
je 0x2dd2b
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
movsd 0xec312(%rip), %xmm0    # 0x11a008
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x27ef0
xorl %r15d, %r15d
pushq $0x1
popq %r14
movq 0x8(%rbx), %rax
movslq 0x5c(%rax), %rcx
cmpq %rcx, %r15
jge 0x2dd2b
movq 0x50(%rax), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
incq %r15
jmp 0x2dd08
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawObjectBBoxes() const
void R3SurfelViewer::
DrawObjectBBoxes(void) const
{
  // Check stuff
  if (!scene) return;
  if (!object_bbox_visibility) return;
  
  // Draw node bounding boxes
  glDisable(GL_LIGHTING);
  RNLoadRgb(object_bbox_color);
  for (int i = 0; i < scene->NObjects(); i++) {
    R3SurfelObject *object = scene->Object(i);
    if (!object->Parent()) continue;
    if (object->Parent() != scene->RootObject()) continue;
    if ((object->NParts() == 0) && (object->NNodes() == 0)) continue;    
    object->BBox().Outline();
  }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2ddb4
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x314(%rdi)
je 0x2ddaf
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x3c8(%rbx), %rdi
callq 0x32b06
xorl %r15d, %r15d
pushq $0x1
popq %r14
movq 0x8(%rbx), %rax
movslq 0x1c(%rax), %rcx
cmpq %rcx, %r15
jge 0x2ddaf
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rdi
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
je 0x2ddaa
cmpq (%rax), %rcx
jne 0x2ddaa
cmpl $0x0, 0x2c(%rdi)
jne 0x2dd96
cmpl $0x0, 0x6c(%rdi)
je 0x2ddaa
callq 0x42e04
movq (%rax), %rcx
movq %rax, %rdi
movq %r14, %rsi
callq *0xb0(%rcx)
incq %r15
jmp 0x2dd67
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawNodeBBoxes() const
void R3SurfelViewer::
DrawNodeBBoxes(void) const
{
  // Check stuff
  if (!scene) return;
  if (!node_bbox_visibility) return;
  
  // Draw node bounding boxes
  glDisable(GL_LIGHTING);
  RNLoadRgb(node_bbox_color);
  for (int i = 0; i < resident_nodes.NNodes(); i++) {
    R3SurfelNode *node = resident_nodes.Node(i);
    if (node->NParts() > 0) RNLoadRgb(0, 1, 0);
    else RNLoadRgb(1, 0, 0);
    node->BBox().Outline();
  }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2de54
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x318(%rdi)
je 0x2de49
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x3e0(%rbx), %rdi
callq 0x32b06
xorl %r12d, %r12d
pushq $0x1
popq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jge 0x2de49
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %r15
cmpl $0x0, 0x3c(%r15)
jle 0x2de1a
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movss 0xec228(%rip), %xmm1    # 0x11a040
jmp 0x2de28
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movss 0xec218(%rip), %xmm0    # 0x11a040
callq 0x28390
movq %r15, %rdi
callq 0x3d094
movq (%rax), %rcx
movq %rax, %rdi
movq %r14, %rsi
callq *0xb0(%rcx)
incq %r12
jmp 0x2ddf2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawBlockBBoxes() const
void R3SurfelViewer::
DrawBlockBBoxes(void) const
{
  // Check stuff
  if (!scene) return;
  if (!block_bbox_visibility) return;

  // Draw block bounding boxes
  glDisable(GL_LIGHTING);
  RNLoadRgb(block_bbox_color);
  for (int i = 0; i < resident_nodes.NNodes(); i++) {
    R3SurfelNode *node = resident_nodes.Node(i);
    for (int j = 0; j < node->NBlocks(); j++) {
      R3SurfelBlock *block = node->Block(j);
      block->BBox().Outline();
    }
  }
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x2dee1
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x31c(%rdi)
je 0x2ded8
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x3f8(%rbx), %rdi
callq 0x32b06
xorl %r15d, %r15d
pushq $0x1
popq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jge 0x2ded8
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r12
xorl %r13d, %r13d
movslq 0x4c(%r12), %rax
cmpq %rax, %r13
jge 0x2ded3
movq 0x40(%r12), %rax
movq (%rax,%r13,8), %rdi
callq 0x34a58
movq (%rax), %rcx
movq %rax, %rdi
movq %r14, %rsi
callq *0xb0(%rcx)
incq %r13
jmp 0x2dea7
incq %r15
jmp 0x2de93
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawCenterPoint() const
void R3SurfelViewer::
DrawCenterPoint(void) const
{
  // Check stuff
  if (!center_point_visibility) return;
  
  // Draw center point
  glEnable(GL_LIGHTING);
  RNLoadRgb(center_point_color);
  R3Sphere(center_point, 0.1).Draw();
  glDisable(GL_LIGHTING);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
cmpl $0x0, 0x334(%rdi)
je 0x2df47
movq %rdi, %rbx
movl $0xb50, %edi            # imm = 0xB50
callq 0x27870
leaq 0x440(%rbx), %rdi
callq 0x32b06
addq $0x2b0, %rbx            # imm = 0x2B0
movq %rsp, %r14
movsd 0xec433(%rip), %xmm0    # 0x11a350
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9bb80
movl $0x772, %esi            # imm = 0x772
movq %r14, %rdi
callq 0x76026
movq %rsp, %rdi
callq 0x9eb12
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9eb12
movq %rbx, %rdi
callq 0x28140
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Utils/R3SurfelViewer.cpp
// Function: gaps::R3SurfelViewer::DrawSelectedPoint() const
void R3SurfelViewer::
DrawSelectedPoint(void) const
{
  // Check stuff
  if (!selected_point) return;
  // if (!selected_point_visibility) return;

  // Draw selected point
  glEnable(GL_LIGHTING);
  RNLoadRgb(RNred_rgb);
  R3Sphere(selected_point->Position(), 0.05).Draw();
  glDisable(GL_LIGHTING);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
cmpq $0x0, 0x2c8(%rdi)
je 0x2dfd9
movq %rdi, %rbx
movl $0xb50, %edi            # imm = 0xB50
callq 0x27870
leaq 0x17a171(%rip), %rdi    # 0x1a80f8
callq 0x32b06
movq 0x2c8(%rbx), %rsi
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x32b2a
leaq 0x8(%rsp), %r14
movsd 0xec413(%rip), %xmm0    # 0x11a3c0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9bb80
movl $0x772, %esi            # imm = 0x772
movq %r14, %rdi
callq 0x76026
leaq 0x8(%rsp), %rdi
callq 0x9eb12
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x9eb12
movq %rbx, %rdi
callq 0x28140
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2e102
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x320(%rdi)
je 0x2e0f4
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x410(%rbx), %rdi
callq 0x32b06
pushq $0x1
popq %rdi
callq 0x271a0
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movslq 0x8c(%rax), %rcx
cmpq %rcx, %r14
jge 0x2e0ef
movq 0x80(%rax), %rax
movq %rbx, %r15
movq (%rax,%r14,8), %rbx
leaq 0x28(%rbx), %rbp
leaq 0x70(%rbx), %rsi
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0xb3446
addq $0x58, %rbx
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rbx
callq 0xb2af0
movq %rbp, %rdi
callq 0x271c0
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xb25e7
movq %r15, %rdi
callq 0x271c0
movq %rbp, %rdi
callq 0x271c0
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movsd 0xebf44(%rip), %xmm0    # 0x11a010
callq 0xb31d6
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xb25e7
movq %r15, %rdi
callq 0x271c0
incq %r14
jmp 0x2e040
callq 0x27cc0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2e1b2
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x324(%rdi)
je 0x2e1a7
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
leaq 0x428(%rbx), %rdi
callq 0x32b06
xorl %r12d, %r12d
pushq $0x1
popq %r14
movq 0x8(%rbx), %rax
movslq 0x9c(%rax), %rcx
cmpq %rcx, %r12
jge 0x2e1a7
movq 0x90(%rax), %rax
movq (%rax,%r12,8), %r15
cmpq 0x2d0(%rbx), %r15
jne 0x2e175
movss 0xec388(%rip), %xmm0    # 0x11a4f8
callq 0x281c0
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
movsd 0xebe82(%rip), %xmm0    # 0x11a008
callq *0xf0(%rax)
cmpq 0x2d0(%rbx), %r15
jne 0x2e1a2
movss 0xebea3(%rip), %xmm0    # 0x11a040
callq 0x281c0
incq %r12
jmp 0x2e144
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2ed1a
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl $0xb50, %edi            # imm = 0xB50
callq 0x27220
movss 0xeb912(%rip), %xmm0    # 0x11a4fc
callq 0x281c0
callq 0x32bb4
movss 0xeb444(%rip), %xmm0    # 0x11a040
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x28390
leaq 0x581612(%rip), %rbx    # 0x5b0220
movq %rbx, %rdi
callq 0x271c0
leaq 0xf560b(%rip), %rsi     # 0x124228
movq %rsp, %r14
movsd 0xeb3e0(%rip), %xmm0    # 0x11a008
movq %r14, %rdi
callq 0xb31d6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb25e7
movq %r15, %rdi
callq 0x271c0
callq 0x27cc0
callq 0x32bb4
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movss 0xeb3dd(%rip), %xmm1    # 0x11a040
callq 0x28390
movq %rbx, %rdi
callq 0x271c0
leaq 0xf55c9(%rip), %rsi     # 0x124240
movq %rsp, %r14
movq %r14, %rdi
movsd 0xeb383(%rip), %xmm0    # 0x11a008
callq 0xb31d6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb25e7
movq %r15, %rdi
callq 0x271c0
callq 0x27cc0
callq 0x32bb4
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movss 0xeb383(%rip), %xmm2    # 0x11a040
callq 0x28390
movq %rbx, %rdi
callq 0x271c0
leaq 0xf5587(%rip), %rsi     # 0x124258
movq %rsp, %r14
movq %r14, %rdi
movsd 0xeb329(%rip), %xmm0    # 0x11a008
callq 0xb31d6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb25e7
movq %r15, %rdi
callq 0x271c0
callq 0x27cc0
movss 0xeb334(%rip), %xmm0    # 0x11a040
callq 0x281c0
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2ed60
movq %rsi, %rbx
movl 0x118(%rdi), %esi
movl 0x11c(%rdi), %edx
movq %rsp, %r14
pushq $0x3
popq %rcx
movq %r14, %rdi
callq 0xcab4e
movq %r14, %rdi
callq 0xcb4e0
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xcc786
movq %rsp, %rdi
callq 0xcad90
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xcad90
movq %rbx, %rdi
callq 0x28140
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x27230
leaq 0x78(%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x6e9f2
movl %ebp, 0x498(%r14)
movl %ebx, 0x494(%r14)
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x177a65(%rip), %rsi    # 0x1a7a50
movl $0xb53, %edi            # imm = 0xB53
callq 0x28280
pushq $0x1
popq %rsi
movl $0xb51, %edi            # imm = 0xB51
callq 0x27150
leaq 0x177a57(%rip), %rdx    # 0x1a7a60
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
callq 0x28120
leaq 0x177a51(%rip), %rdx    # 0x1a7a70
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
callq 0x28120
movl $0x4000, %edi           # imm = 0x4000
callq 0x27870
leaq 0x177a41(%rip), %rdx    # 0x1a7a80
movl $0x4001, %edi           # imm = 0x4001
movl $0x1201, %esi           # imm = 0x1201
callq 0x28120
leaq 0x177a3b(%rip), %rdx    # 0x1a7a90
movl $0x4001, %edi           # imm = 0x4001
movl $0x1203, %esi           # imm = 0x1203
callq 0x28120
movl $0x4001, %edi           # imm = 0x4001
callq 0x27870
movl $0xba1, %edi            # imm = 0xBA1
callq 0x27870
movl $0xb57, %edi            # imm = 0xB57
callq 0x27870
movl $0x404, %edi            # imm = 0x404
movl $0x1602, %esi           # imm = 0x1602
callq 0x275b0
movl $0xb71, %edi            # imm = 0xB71
callq 0x27870
movl $0xb44, %edi            # imm = 0xB44
callq 0x27870
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x388(%rax)
// File: /workspace/github_cpp_makefile_star2_O2/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), %rsi
testq %rsi, %rsi
je 0x30166
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x32c38
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x80(%rax)
leaq 0x2b0(%rbx), %r14
movq 0x8(%rbx), %rdi
callq 0x32960
movq %rax, %rdi
callq 0x32b1a
addsd %xmm0, %xmm0
leaq 0xf4142(%rip), %rsi     # 0x124258
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0xb31d6
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xb25e7
subq $-0x80, %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x70768
leaq 0xf4154(%rip), %rsi     # 0x1242a0
leaq 0xf40ed(%rip), %rdx     # 0x124240
movq %rbx, %rdi
callq 0x7076e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x301f7
leaq 0x2b0(%r14), %rbx
movsd %xmm0, 0x8(%rsp)
callq 0x32960
movq %rax, %rdi
callq 0x32b1a
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 0xb3446
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
callq 0xb31d6
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb2a71
movq %r15, %rdi
movq %r12, %rsi
callq 0x70768
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
movq %rdi, %rbx
pushq $0x1
popq %rsi
xorps %xmm0, %xmm0
movq %r12, %rdi
callq 0x43140
testq %rax, %rax
je 0x302bd
movq %rax, %r14
movq %rbx, 0x8(%rsp)
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x32942
movsd 0xea0ec(%rip), %xmm0    # 0x11a338
xorl %ebp, %ebp
leaq 0x30(%rsp), %r12
xorl %r15d, %r15d
xorl %ebx, %ebx
movslq 0x10(%r14), %rax
cmpq %rax, %r15
jge 0x302a1
movq 0x8(%r14), %r13
addq %rbp, %r13
movq %r12, %rdi
movq %r13, %rsi
movsd %xmm0, 0x10(%rsp)
callq 0x32b2a
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x7fb71
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %r13, %rbx
minsd %xmm1, %xmm0
incq %r15
addq $0x10, %rbp
jmp 0x30258
testq %rbx, %rbx
je 0x302df
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq (%rsi), %rax
pushq $0x30
popq %rcx
cqto
idivq %rcx
movq %rax, %rdx
jmp 0x302e4
movq (%rbx), %rax
movq 0x1b8(%rax), %rax
pushq $-0x1
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
pushq $-0x1
popq %rdx
xorl %esi, %esi
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
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_O2/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
andq $0x0, 0x2c8(%rdi)
testq %rsi, %rsi
sete %al
testl %edx, %edx
sets %cl
orb %al, %cl
jne 0x3035c
movl %edx, %ebp
movq %rsi, %r15
cmpl %edx, 0x8(%rsi)
jle 0x3035c
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x27920
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x39596
movq %r12, 0x2c8(%r14)
testq %rbx, %rbx
je 0x3037c
movq %rbx, %rdi
callq 0x395d6
pushq $0x10
popq %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x27940
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r12, %rdi
callq 0x27940
movq %rbx, %rdi
callq 0x28140
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 $0xc8, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
sete %al
testl %ecx, %ecx
sete %cl
orb %al, %cl
jne 0x3042f
leaq 0x30(%rbx), %r15
leaq 0x78(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0xb3446
leaq 0x60(%rbx), %r13
movq %rbx, %rdi
callq 0x32b5c
movsd %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x32b88
movaps %xmm0, %xmm1
leaq 0x78(%r14), %r12
movsd 0xf0(%r14), %xmm2
movsd 0xf8(%r14), %xmm3
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
leaq 0x8(%rsp), %rdx
movq %r13, %rcx
movsd (%rsp), %xmm0
callq 0x700ee
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
callq 0x6e8f2
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x304e2
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x30493
movq 0x18(%rax), %r15
testq %r15, %r15
je 0x30493
movq (%r14), %rax
movq %r14, %rdi
callq *0x308(%rax)
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x32924
leaq 0x2b0(%r14), %rdi
movq %r12, %rsi
callq 0xb260a
movq (%r14), %rax
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq *0x328(%rax)
jmp 0x304e2
leaq 0x30(%rbx), %r15
leaq 0x78(%rbx), %rsi
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0xb3446
leaq 0x8(%rsp), %r13
movsd 0xe9f5b(%rip), %xmm0    # 0x11a410
movq %r13, %rdi
movq %r12, %rsi
callq 0xb31d6
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xb25e7
movq (%r14), %rax
movq %r14, %rdi
movq %r12, %rsi
callq *0x80(%rax)
movq %rbx, 0x2d0(%r14)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xf2e47(%rip), %rsi     # 0x123354
movq %r14, %rdi
callq 0x27b00
testq %rax, %rax
je 0x3053d
movq %rax, %rdi
callq 0x27910
movq 0x4f0(%rbx), %rdi
callq 0x27b20
testq %r14, %r14
je 0x30541
movq %r14, %rdi
callq 0xd327d
jmp 0x30543
xorl %eax, %eax
jmp 0x3054d
xorl %eax, %eax
movq %rax, 0x4f0(%rbx)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x10(%rsp)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3087e
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x3087e
movq %rdi, %rbx
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xd0a62
movq 0x18(%r15), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x3343c
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x20(%rsp), %r14
cmpl $0x0, 0x30(%rsp)
je 0x30868
movq %r14, %rdi
callq 0x32c56
movq %rax, %r15
movq %rax, %rdi
callq 0x3cfd0
addsd 0x8(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
ja 0x30868
movq %r15, %rdi
callq 0x3cfd0
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x3d756
movsd 0x8(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r12d, %r12d
movslq 0x3c(%r15), %rax
cmpq %rax, %r12
jge 0x307f5
movq 0x30(%r15), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x3343c
incq %r12
jmp 0x3084a
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x378(%rax)
leaq 0x20(%rsp), %rdi
callq 0xd0e08
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x30890
jmp 0x30890
jmp 0x30890
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xd0e08
movq %rbx, %rdi
callq 0x28140
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x10(%rsp)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3099a
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x3099a
movq %rdi, %rbx
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xd0a62
xorl %r12d, %r12d
movslq 0x24(%r15), %rax
cmpq %rax, %r12
jge 0x30902
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x3343c
incq %r12
jmp 0x308e4
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x20(%rsp), %r14
cmpl $0x0, 0x30(%rsp)
je 0x30984
movq %r14, %rdi
callq 0x32c56
movq %rax, %r15
movq %rax, %rdi
callq 0x3cfd0
addsd 0x8(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
ja 0x30984
movq %r15, %rdi
callq 0x3cfd0
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x3d7b4
movsd 0x8(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r12d, %r12d
movslq 0x3c(%r15), %rax
cmpq %rax, %r12
jge 0x30911
movq 0x30(%r15), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x3343c
incq %r12
jmp 0x30966
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x378(%rax)
leaq 0x20(%rsp), %rdi
callq 0xd0e08
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x309ac
jmp 0x309ac
jmp 0x309ac
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xd0e08
movq %rbx, %rdi
callq 0x28140
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x309f7
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq %r14, %rdi
callq 0x3e61a
movq %r14, %rdi
callq 0x3e5b8
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_O2/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 0x30b0e
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x30b0e
movq %rsi, %r14
movq %rdi, %rbx
movsd 0x470(%rdi), %xmm2
ucomisd %xmm0, %xmm2
jne 0x30a66
jp 0x30a66
leaq 0x177776(%rip), %rax    # 0x1a81b8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm1
jb 0x30a66
ucomisd %xmm2, %xmm0
jb 0x30a66
movsd 0x480(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jne 0x30a66
jnp 0x30b0e
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
callq 0x3e044
leaq 0x177723(%rip), %rax    # 0x1a81a8
movsd (%rax), %xmm4
movsd 0xe98af(%rip), %xmm1    # 0x11a340
movsd 0xe989f(%rip), %xmm2    # 0x11a338
movsd 0xe998f(%rip), %xmm5    # 0x11a430
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm3
callq 0x3e49c
leaq 0x10(%rsp), %rdi
callq 0x3e5ea
leaq 0x10(%rbx), %r14
movq %r14, %rdi
callq 0x3e61a
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x32c72
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 0x3e156
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3e156
movq %rbx, %rdi
callq 0x28140
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x311df
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x311ea
movl 0x3c(%rbx), %eax
testl %eax, %eax
je 0x3120d
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0x311df
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq (%r14), %rax
movq %r14, %rdi
movl %ebp, %edx
callq *0x328(%rax)
incq %r15
movl 0x3c(%rbx), %eax
jmp 0x311ba
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d756
addq $0x10, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3e4ea
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_O2/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 0x31275
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x31280
movl 0x3c(%rbx), %eax
testl %eax, %eax
je 0x312a3
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0x31275
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq (%r14), %rax
movq %r14, %rdi
movl %ebp, %edx
callq *0x330(%rax)
incq %r15
movl 0x3c(%rbx), %eax
jmp 0x31250
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d7b4
addq $0x10, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3e544
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_O2/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 0x3139e
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
cvtsi2sdl 0x118(%rdi), %xmm0
cvtsi2sd %r9d, %xmm3
divsd %xmm0, %xmm1
cvtsi2sdl 0x11c(%rdi), %xmm0
divsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rsp)
movsd 0xe90e9(%rip), %xmm0    # 0x11a400
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
leaq 0xb0(%rdi), %rdx
movq %r15, %rdi
movsd %xmm2, (%rsp)
callq 0x6ead8
movsd (%rsp), %xmm0
mulsd 0xe90c8(%rip), %xmm0    # 0x11a408
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0xc8(%r14), %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0xb3446
leaq 0xf2ef2(%rip), %rsi     # 0x124258
movq %r12, %rdi
callq 0x81edf
leaq 0xf4383(%rip), %rax     # 0x1256f8
subsd (%rax), %xmm0
minsd (%rsp), %xmm0
addq $0x98, %r14
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x6ead8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3162d
pushq $0x1
popq %rsi
xorl %ebx, %ebx
movq %rax, %rdi
xorl %edx, %edx
callq 0x3d228
testq %rax, %rax
je 0x3162d
movq 0x8(%r14), %rcx
movq %rax, %rbx
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x3162d
movq 0x10(%rcx), %rdx
cmpq (%rdx), %rax
jne 0x31618
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq