LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::Draw(gaps::RNFlags) const
void GSVScanline::
Draw(RNFlags flags) const
{
  // Just checking
  if (NPoints() == 0) return;
  assert(points);

  // Draw scanline
  if (flags & GSV_DRAW_SCANLINES_WITH_POINT_INDEX_COLOR) {
    const int ncolors = 3;
    GLfloat color[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
    RNLength max_edge_length_squared = 1;
    RNGrfxBegin(RN_GRFX_LINES);
    R3Point prev_point = PointPosition(0);
    for (int ik = 1; ik < NPoints(); ik++) {
      const R3Point& current_point = PointPosition(ik);
      RNScalar dx = prev_point[0] - current_point[0];
      RNScalar dy = prev_point[1] - current_point[1];
      RNScalar dd = dx*dx + dy*dy;
      if (dd < max_edge_length_squared) {
        RNLoadRgb(color[(int) (0.1 * (NPoints()-ik)) % ncolors]);
        R3LoadPoint(prev_point);
        R3LoadPoint(current_point);
      }
      prev_point = current_point;
    }
    RNGrfxEnd();
  }
  else {
    // Draw points
    RNGrfxBegin(RN_GRFX_POINTS);
    LoadPoints(flags);
    RNGrfxEnd();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
cmpl $0x0, 0x30(%rdi)
je 0x415db
movq %rsi, %r14
movq %rdi, %rbx
btl $0xc, %r14d
jb 0x414aa
xorl %edi, %edi
callq 0x271a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x415ea
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27cd0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x3f800000, %eax       # imm = 0x3F800000
movl %eax, (%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0x20(%rsp)
movl $0x1, %edi
callq 0x271a0
movq 0x28(%rbx), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x28(%rsp), %rdi
callq 0xd43de
cmpl $0x2, 0x30(%rbx)
jl 0x415d6
movl $0x1, %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x60, %r13d
leaq 0x40(%rsp), %r14
leaq 0x28(%rsp), %r15
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r13), %xmm0
movsd -0x8(%rax,%r13), %xmm1
movsd (%rax,%r13), %xmm2
movq %r14, %rdi
callq 0xd43de
movsd 0x28(%rsp), %xmm0
subsd 0x40(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
subsd 0x48(%rsp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0x10ab1b(%rip), %xmm1   # 0x14c078
ucomisd %xmm0, %xmm1
jbe 0x415b5
movl 0x30(%rbx), %eax
addl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x10ab31(%rip), %xmm0   # 0x14c0a8
cvttsd2si %xmm0, %eax
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rax
leaq (%rsp,%rax,4), %rdi
callq 0x27380
movq %r15, %rdi
callq 0x271c0
movq %r14, %rdi
callq 0x271c0
movq %r15, %rdi
movq %r14, %rsi
callq 0xd4746
incq %r12
movslq 0x30(%rbx), %rax
decl %ebp
addq $0x50, %r13
cmpq %rax, %r12
jl 0x41511
callq 0x27cd0
addq $0x58, %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/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::Print(_IO_FILE*, char const*, char const*) const
void GSVScanline::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print scanline header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Scanline %d:", scan_index);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

  // Add indentation to prefix
  char indented_prefix[1024];
  sprintf(indented_prefix, "%s  ", prefix);

  // Print points
  // ???
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
testq %rsi, %rsi
jne 0x426bf
movq 0x192854(%rip), %rax    # 0x1d4f10
movq (%rax), %r14
testq %rbx, %rbx
je 0x426cf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27a90
movl 0x10(%r12), %edx
leaq 0x10abf5(%rip), %rsi    # 0x14d2d0
movq %r14, %rdi
xorl %eax, %eax
callq 0x27e00
testq %r15, %r15
je 0x426f5
movq %r15, %rdi
movq %r14, %rsi
callq 0x27a90
movl $0xa, %edi
movq %r14, %rsi
callq 0x27c30
leaq 0x10a2eb(%rip), %rsi    # 0x14c9f4
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x27140
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::FindPointIndexWithClosestBeamIndex(int) const
int GSVScanline::
FindPointIndexWithClosestBeamIndex(int query_beam_index) const
{
  // Initialize result
  int closest_delta = INT_MAX;
  int closest_point_index = -1;

  // Search for closest point (by beam index)
  for (int i = 0; i < npoints; i++) {
    const GSVPoint *point = &points[i];
    int delta = abs(point->BeamIndex() - query_beam_index);
    if (delta < closest_delta) {
      closest_delta = delta;
      closest_point_index = i;
      if (closest_delta == 0) break;
    }
  }

  // Return closest point index
  return closest_point_index;
}

// Assembly:
movslq 0x30(%rdi), %rcx
testq %rcx, %rcx
jle 0x42774
movq 0x28(%rdi), %rdx
addq $0x46, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
xorl %edi, %edi
movzbl (%rdx), %r10d
movl %r10d, %r11d
subl %esi, %r11d
movl %r11d, %r9d
negl %r9d
cmovsl %r11d, %r9d
cmpl %r8d, %r9d
jge 0x42767
cmpl %esi, %r10d
je 0x4277a
movl %r9d, %r8d
movl %edi, %eax
incq %rdi
addq $0x50, %rdx
cmpq %rdi, %rcx
jne 0x42744
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl %edi, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::UpdateBBox()
void GSVScanline::
UpdateBBox(void) 
{
  // Just checking
  assert(read_count > 0);
  assert(points);

  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NPoints(); i++) {
    bbox.Union(PointPosition(i));
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
addq $0x90, %rdi
leaq 0x19c1e2(%rip), %r14    # 0x1de998
leaq 0x8(%r14), %rsi
callq 0xd4746
leaq 0xa8(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0xd4746
cmpl $0x0, 0x30(%rbx)
jle 0x42828
leaq 0x88(%rbx), %r14
movl $0x10, %r12d
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq 0x28(%rbx), %rax
movsd -0x10(%rax,%r12), %xmm0
movsd -0x8(%rax,%r12), %xmm1
movsd (%rax,%r12), %xmm2
movq %r15, %rdi
callq 0xd43de
movq %r14, %rdi
movq %r15, %rsi
callq 0xbe362
incq %r13
movslq 0x30(%rbx), %rax
addq $0x50, %r12
cmpq %rax, %r13
jl 0x427ed
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::WritePoints(_IO_FILE*, int)
int GSVScanline::
WritePoints(FILE *fp, RNBoolean seek) 
{
  // Seek within file
  if (seek && (file_offset > 0)) {
    // Seek to file offset
    if (!RNFileSeek(fp, file_offset, RN_FILE_SEEK_SET)) {
      RNFail("Unable to seek to scanline points\n");
      return 0;
    }
  }
  else {
    // Update file offset
    file_offset = RNFileTell(fp);
  }

  // Write number of points 
  if (fwrite(&npoints, sizeof(int), 1, fp) != (unsigned int) 1) {
    RNFail("Unable to write number of scanline points\n");
    return 0;
  }

  // Write points
  if (npoints > 0) {
    if (fwrite(points, sizeof(GSVPoint), npoints, fp) != (unsigned int) npoints) {
      RNFail("Unable to write scanline points\n");
      return 0;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0x42a43
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x42a43
movq %r14, %rdi
xorl %edx, %edx
callq 0xfab32
testl %eax, %eax
jne 0x42a4f
leaq 0x10a89c(%rip), %rdi    # 0x14d2dd
jmp 0x42aa4
movq %r14, %rdi
callq 0xfab43
movq %rax, 0x18(%rbx)
leaq 0x30(%rbx), %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x28320
cmpq $0x1, %rax
jne 0x42a9d
movslq (%r15), %rdx
movl $0x1, %ebp
testq %rdx, %rdx
jle 0x42aad
movq 0x28(%rbx), %rdi
movl $0x50, %esi
movq %r14, %rcx
callq 0x28320
movl 0x30(%rbx), %ecx
cmpq %rcx, %rax
je 0x42aad
leaq 0x10a8da(%rip), %rdi    # 0x14d375
jmp 0x42aa4
leaq 0x10a8a6(%rip), %rdi    # 0x14d34a
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xfb6f2
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/./GSVPoint.h
// Function: gaps::GSVPoint::Transform(gaps::R3Transformation const&)
inline void GSVPoint::
Transform(const R3Transformation& transformation)
{
  // Transform position and normal
  R3Point position = Position();
  R3Vector normal = Normal();
  R3Vector tangent = Tangent();
  position.Transform(transformation);
  normal.Transform(transformation);
  tangent.Transform(transformation);
  SetPosition(position);
  SetNormal(normal);
  SetTangent(tangent);

  // Transform radii
  double scale = transformation.ScaleFactor();
  if (RNIsNotEqual(scale, 1.0)) {
    for (int i = 0; i < 2; i++) {
      double r = this->radius[i];
      r *= fabs(scale);
      if (r > 64000) r = 64000;
      this->radius[i] = r;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movsd (%rdi), %xmm0
movsd 0x8(%rdi), %xmm1
movsd 0x10(%rdi), %xmm2
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0xd43de
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x24(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x28(%rbx), %xmm2
movq %rsp, %r12
movq %r12, %rdi
callq 0xd4e72
xorps %xmm0, %xmm0
cvtss2sd 0x2c(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x30(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x34(%rbx), %xmm2
leaq 0x38(%rsp), %r13
movq %r13, %rdi
callq 0xd4e72
movq %r15, %rdi
movq %r14, %rsi
callq 0xd4cf4
movq %r12, %rdi
movq %r14, %rsi
callq 0xd59f2
movq %r13, %rdi
movq %r14, %rsi
callq 0xd59f2
movaps (%r15), %xmm0
movups %xmm0, (%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0x10(%rbx)
movsd 0x10(%r12), %xmm0
movhpd (%r13), %xmm0           # xmm0 = xmm0[0],mem[0]
cvtpd2ps %xmm0, %xmm0
cvtpd2ps (%r12), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd %xmm1, 0x20(%rbx)
movupd 0x8(%r13), %xmm0
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, 0x30(%rbx)
movq (%r14), %rax
movq %r14, %rdi
callq *0xc0(%rax)
leaq 0x19388d(%rip), %rax    # 0x1d6458
movsd (%rax), %xmm1
movsd 0x109499(%rip), %xmm2   # 0x14c070
addsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
ja 0x42bef
xorpd 0x10a0d7(%rip), %xmm1   # 0x14ccc0
ucomisd %xmm2, %xmm1
jbe 0x42c2a
movq 0x40(%rbx), %xmm1
xorpd %xmm2, %xmm2
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
cvtdq2pd %xmm1, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
andpd 0x10a2b4(%rip), %xmm0   # 0x14cec0
mulpd %xmm1, %xmm0
movapd 0x10a6a8(%rip), %xmm1   # 0x14d2c0
minpd %xmm0, %xmm1
cvttpd2dq %xmm1, %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x40(%rbx)
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::~GSVMesh()
GSVMesh::
~GSVMesh(void)
{
  // Delete everything
  Empty();

  // Delete search tree
  if (search_tree) delete search_tree;

  // Delete vertices
  if (gsv_vertex_block) delete [] gsv_vertex_block;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x189ec5(%rip), %rax    # 0x1ccb30
movq %rax, (%rdi)
callq 0xa36a8
movq 0x140(%rbx), %r14
testq %r14, %r14
je 0x42c94
movq %r14, %rdi
callq 0x919ca
movl $0x18, %esi
movq %r14, %rdi
callq 0x27950
movq 0x138(%rbx), %r15
testq %r15, %r15
je 0x42ce0
leaq -0x8(%r15), %r14
movq -0x8(%r15), %r12
testq %r12, %r12
je 0x42ccd
addq $-0xa8, %r15
imulq $0xa8, %r12, %r13
leaq (%r15,%r13), %rdi
callq 0xb3276
addq $-0xa8, %r13
jne 0x42cbb
imulq $0xa8, %r12, %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x28330
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xa1292
movq %rax, %rdi
callq 0x3964d
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::VertexHeight(gaps::R3MeshVertex*) const
RNScalar GSVMesh::
VertexHeight(R3MeshVertex *v) const
{
  // Return vertex height
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  GSVScanline *scanline = vertex->scanline;
  if (!scanline) return RN_UNKNOWN;
  RNCoord groundZ = scanline->EstimatedGroundZ();
  const R3Point& position = VertexPosition(vertex);
  return position.Z() - groundZ;
}

// Assembly:
movq 0x98(%rsi), %rdi
testq %rdi, %rdi
je 0x42d52
pushq %rbx
movq %rsi, %rbx
callq 0x40e10
movapd %xmm0, %xmm1
movsd 0x28(%rbx), %xmm0
subsd %xmm1, %xmm0
popq %rbx
retq
movsd 0x109316(%rip), %xmm0   # 0x14c070
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::VertexLaserAngle(gaps::R3MeshVertex*) const
RNScalar GSVMesh::
VertexLaserAngle(R3MeshVertex *v) const
{
  // Return vertex angle
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  GSVScanline *scanline = vertex->scanline;
  if (!scanline) return RN_UNKNOWN;
  const GSVPose& pose = scanline->Pose();
  const R3Point& viewpoint = pose.Viewpoint();
  const R3Vector& towards = pose.Towards();
  R3Vector up = pose.Up();
  const R3Point& position = VertexPosition(vertex);
  R3Vector vec = position - viewpoint;
  RNLength distance = vec.Length();
  if (RNIsZero(distance)) return RN_UNKNOWN;
  vec /= distance;
  RNScalar dot = vec.Dot(towards);
  RNAngle angle = acos(dot);
  if (vec.Dot(up) > 0) angle = RN_PI_OVER_TWO + angle;
  else angle = RN_PI_OVER_TWO - angle;
  return angle;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq 0x98(%rsi), %rbx
testq %rbx, %rbx
je 0x42dd8
movq %rsi, %r14
leaq 0x38(%rbx), %r15
addq $0x40, %rbx
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x450fa
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x45140
addq $0x18, %r14
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xd463a
movq %r15, %rdi
callq 0xd4f78
leaq 0x19369c(%rip), %rax    # 0x1d6458
movsd (%rax), %xmm1
movapd 0x109ef8(%rip), %xmm2   # 0x14ccc0
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x42de2
ucomisd %xmm0, %xmm1
jb 0x42de2
movsd 0x109290(%rip), %xmm0   # 0x14c070
jmp 0x42e48
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xd5a44
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xd50fe
callq 0x278b0
movapd %xmm0, (%rsp)
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0xd50fe
movapd %xmm0, %xmm1
leaq 0x1154ea(%rip), %rax    # 0x158308
movapd 0x109e9a(%rip), %xmm2   # 0x14ccc0
movapd (%rsp), %xmm3
xorpd %xmm3, %xmm2
xorpd %xmm0, %xmm0
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm3
andnpd %xmm2, %xmm0
orpd %xmm3, %xmm0
addsd (%rax), %xmm0
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::VertexLaserDepth(gaps::R3MeshVertex*) const
RNScalar GSVMesh::
VertexLaserDepth(R3MeshVertex *v) const
{
  // Return vertex depth
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  GSVScanline *scanline = vertex->scanline;
  if (!scanline) return RN_UNKNOWN;
  const GSVPose& pose = scanline->Pose();
  R3Vector towards = pose.Towards();
  const R3Point& viewpoint = pose.Viewpoint();
  const R3Point& position = VertexPosition(vertex);
  R3Vector vec = position - viewpoint;
  RNScalar depth = vec.Dot(towards);
  return depth;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x98(%rsi), %rbx
testq %rbx, %rbx
je 0x42ea5
movq %rsi, %r14
leaq 0x38(%rbx), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x450fa
addq $0x40, %rbx
addq $0x18, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xd463a
movq %r12, %rdi
movq %r15, %rsi
callq 0xd50fe
jmp 0x42ead
movsd 0x1091c3(%rip), %xmm0   # 0x14c070
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::VertexLaserTowards(gaps::R3MeshVertex*) const
R3Vector GSVMesh::
VertexLaserTowards(R3MeshVertex *v) const
{
  // Return vertex viewpoint
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  GSVScanline *scanline = vertex->scanline;
  if (!scanline) return R3zero_vector;
  const GSVPose& pose = scanline->Pose();
  return pose.Towards();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x98(%rdx), %rsi
testq %rsi, %rsi
je 0x42f28
addq $0x38, %rsi
movq %rbx, %rdi
callq 0x450fa
jmp 0x42f37
leaq 0x113e39(%rip), %rsi    # 0x156d68
movq %rbx, %rdi
callq 0xd4e82
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::VertexLaserUp(gaps::R3MeshVertex*) const
R3Vector GSVMesh::
VertexLaserUp(R3MeshVertex *v) const
{
  // Return vertex viewpoint
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  GSVScanline *scanline = vertex->scanline;
  if (!scanline) return R3zero_vector;
  const GSVPose& pose = scanline->Pose();
  return pose.Up();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x98(%rdx), %rsi
testq %rsi, %rsi
je 0x42f5a
addq $0x38, %rsi
movq %rbx, %rdi
callq 0x45140
jmp 0x42f69
leaq 0x113e07(%rip), %rsi    # 0x156d68
movq %rbx, %rdi
callq 0xd4e82
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::CreateVertex(gaps::R3Point const&, gaps::R3MeshVertex*)
R3MeshVertex *GSVMesh::
CreateVertex(const R3Point& position, R3MeshVertex *v)
{
  // Create GSV vertex
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  if (!v) {
    vertex = new GSVMeshVertex();
    vertex->flags.Add(R3_MESH_VERTEX_ALLOCATED);
  }

  // Fill in GSV stuff
  vertex->scanline = NULL;
  vertex->point_index = -1;
  vertex->boundary_type = GSV_MESH_NO_BOUNDARY;

  // Fill in R3Mesh stuff 
  return R3Mesh::CreateVertex(position, vertex);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdx, %rdx
jne 0x43b6d
movl $0xa8, %edi
callq 0x27930
movq %rax, %rbx
movq %rax, %rdi
callq 0xb31d6
leaq 0x189321(%rip), %rax    # 0x1cce70
movq %rax, (%rbx)
movq $0x0, 0x98(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xa0(%rbx)
orb $0x1, 0x78(%rbx)
movq $0x0, 0x98(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xa0(%rbx)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0xa419e
movq %rax, %r14
movl $0xa8, %esi
movq %rbx, %rdi
callq 0x27950
movq %r14, %rdi
callq 0x28150
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::CreateVertex(gaps::R3Point const&, gaps::R3Vector const&, gaps::R3MeshVertex*)
R3MeshVertex *GSVMesh::
CreateVertex(const R3Point& position, const R3Vector& normal, R3MeshVertex *v)
{
  // Create GSV vertex
  GSVMeshVertex *vertex = (GSVMeshVertex *) v;
  if (!vertex) {
    vertex = new GSVMeshVertex();
    vertex->flags.Add(R3_MESH_VERTEX_ALLOCATED);
  }

  // Fill in GSV stuff
  vertex->scanline = NULL;
  vertex->point_index = -1;
  vertex->boundary_type = GSV_MESH_NO_BOUNDARY;

  // Fill in R3Mesh stuff 
  return R3Mesh::CreateVertex(position, normal, vertex);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
testq %rcx, %rcx
jne 0x43c03
movl $0xa8, %edi
callq 0x27930
movq %rax, %rbx
movq %rax, %rdi
callq 0xb31d6
leaq 0x18928b(%rip), %rax    # 0x1cce70
movq %rax, (%rbx)
movq $0x0, 0x98(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xa0(%rbx)
orb $0x1, 0x78(%rbx)
movq $0x0, 0x98(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xa0(%rbx)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xa4218
movq %rax, %r14
movl $0xa8, %esi
movq %rbx, %rdi
callq 0x27950
movq %r14, %rdi
callq 0x28150
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::Draw(int) const
void GSVMesh::
Draw(RNBoolean texture_coordinates) const
{
  if (texture_coordinates) {
    RNGrfxBegin(RN_GRFX_TRIANGLES);
    for (int i = 0; i < NFaces(); i++) {
      GSVMeshFace *face = Face(i);
      R3LoadNormal(FaceNormal(face));
      GSVMeshVertex *v0 = VertexOnFace(face, 0);
      int s0 = VertexScanlineIndex(v0);
      int t0 = (int) (180.0 * VertexLaserAngle(v0) / RN_PI + 0.5);
      R3LoadTextureCoords(s0, t0);
      R3LoadPoint(VertexPosition(v0));
      GSVMeshVertex *v1 = VertexOnFace(face, 1);
      int s1 = VertexScanlineIndex(v1);
      int t1 = (int) (180.0 * VertexLaserAngle(v1) / RN_PI + 0.5);
      R3LoadTextureCoords(s1, t1);
      R3LoadPoint(VertexPosition(v1));
      GSVMeshVertex *v2 = VertexOnFace(face, 2);
      int s2 = VertexScanlineIndex(v2);
      int t2 = (int) (180.0 * VertexLaserAngle(v2) / RN_PI + 0.5);
      R3LoadTextureCoords(s2, t2);
      R3LoadPoint(VertexPosition(v2));
    }
    RNGrfxEnd();
  }
  else {
    DrawFaces();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x43ded
movl $0x4, %edi
callq 0x271a0
cmpl $0x0, 0x34(%rbx)
jle 0x43dda
leaq 0x11464d(%rip), %rax    # 0x1582f8
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
xorl %r13d, %r13d
movq 0x28(%rbx), %rax
movq (%rax,%r13,8), %r14
testb $0x4, 0xa8(%r14)
jne 0x43cd8
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x2c8(%rax)
leaq 0x38(%r14), %rdi
callq 0x27e80
movq 0x8(%r14), %r15
movq 0x98(%r15), %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x43d00
movl 0x10(%rax), %r12d
movq %r15, %rsi
callq 0x42d5c
mulsd 0x108fa0(%rip), %xmm0   # 0x14ccb0
divsd (%rsp), %xmm0
addsd 0x1082f3(%rip), %xmm0   # 0x14c010
cvttsd2si %xmm0, %esi
movl %r12d, %edi
callq 0x276d0
addq $0x18, %r15
movq %r15, %rdi
callq 0x271c0
movq 0x10(%r14), %r15
movq 0x98(%r15), %rax
testq %rax, %rax
je 0x43d48
movl 0x10(%rax), %ebp
movq %r15, %rsi
callq 0x42d5c
mulsd 0x108f58(%rip), %xmm0   # 0x14ccb0
divsd (%rsp), %xmm0
addsd 0x1082ab(%rip), %xmm0   # 0x14c010
cvttsd2si %xmm0, %esi
movl %ebp, %edi
callq 0x276d0
addq $0x18, %r15
movq %r15, %rdi
callq 0x271c0
movq 0x18(%r14), %r14
movq 0x98(%r14), %rax
testq %rax, %rax
je 0x43d91
movl 0x10(%rax), %ebp
jmp 0x43d96
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r14, %rsi
callq 0x42d5c
mulsd 0x108f0a(%rip), %xmm0   # 0x14ccb0
divsd (%rsp), %xmm0
addsd 0x10825d(%rip), %xmm0   # 0x14c010
cvttsd2si %xmm0, %esi
movl %ebp, %edi
callq 0x276d0
addq $0x18, %r14
movq %r14, %rdi
callq 0x271c0
incq %r13
movslq 0x34(%rbx), %rax
cmpq %rax, %r13
jl 0x43cb7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27cd0
movq (%rbx), %rax
movq 0x138(%rax), %rax
movl $0x772, %esi            # imm = 0x772
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::Intersection(gaps::R3Ray const&, gaps::R3MeshIntersection*, double, double, int (*)(gaps::R3Point const&, gaps::R3Vector const&, gaps::R3Mesh*, gaps::R3MeshFace*, void*), void*) const
R3MeshType GSVMesh::
Intersection(const R3Ray& ray, R3MeshIntersection *intersection, 
  RNScalar min_t, RNScalar max_t,
  int (*IsCompatible)(const R3Point&, const R3Vector&, R3Mesh *, R3MeshFace *, void *), 
  void *compatible_data) const
{
  // Create search tree
  if (!search_tree) {
    GSVMesh *mesh = (GSVMesh *) this;
    mesh->search_tree = new R3MeshSearchTree((R3Mesh *) this);
    if (!search_tree) {
      RNFail("Unable to build mesh search tree\n");
      return R3_MESH_NULL_TYPE;
    }
  }

  // Use search tree to find intersection
  R3MeshIntersection closest;
  search_tree->FindIntersection(ray, closest, min_t, max_t, IsCompatible, compatible_data);
  if (intersection) *intersection = closest;
  return closest.type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r14
movq %rcx, %r15
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %rbp
cmpq $0x0, 0x140(%rdi)
jne 0x43e82
movl $0x18, %edi
callq 0x27930
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x918b0
movq %r13, 0x140(%rbp)
leaq 0x38(%rsp), %r13
movq %r13, %rdi
callq 0xd43dc
movq 0x140(%rbp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r15, %rcx
movq %r14, %r8
callq 0x94b88
testq %rbx, %rbx
je 0x43ee2
movups 0x18(%rsp), %xmm0
movups 0x28(%rsp), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0xd4746
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
movl 0x18(%rsp), %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x18, %esi
movq %r13, %rdi
callq 0x27950
movq %rbx, %rdi
callq 0x28150
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVMesh.cpp
// Function: gaps::GSVMesh::ClosestPoint(gaps::R3Point const&, gaps::R3MeshIntersection*, double, double, int (*)(gaps::R3Point const&, gaps::R3Vector const&, gaps::R3Mesh*, gaps::R3MeshFace*, void*), void*)
R3MeshType GSVMesh::
ClosestPoint(const R3Point& query, R3MeshIntersection *closest, 
  RNScalar min_distance, RNScalar max_distance,
  int (*IsCompatible)(const R3Point&, const R3Vector&, R3Mesh *, R3MeshFace *, void *), 
  void *compatible_data)
{
  // Create search tree
  if (!search_tree) {
    GSVMesh *mesh = (GSVMesh *) this;
    mesh->search_tree = new R3MeshSearchTree((R3Mesh *) this);
    if (!search_tree) {
      RNFail("Unable to build mesh search tree\n");
      return R3_MESH_NULL_TYPE;
    }
  }

  // Use search tree to find closest point
  R3MeshIntersection result;
  search_tree->FindClosest(query, result, min_distance, max_distance, IsCompatible, compatible_data);
  if (closest) *closest = result;
  return result.type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r14
movq %rcx, %r15
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %rbp
cmpq $0x0, 0x140(%rdi)
jne 0x43f66
movl $0x18, %edi
callq 0x27930
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x918b0
movq %r13, 0x140(%rbp)
leaq 0x38(%rsp), %r13
movq %r13, %rdi
callq 0xd43dc
movq 0x140(%rbp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r15, %rcx
movq %r14, %r8
callq 0x932cc
testq %rbx, %rbx
je 0x43fc6
movups 0x18(%rsp), %xmm0
movups 0x28(%rsp), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0xd4746
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
movl 0x18(%rsp), %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x18, %esi
movq %r13, %rdi
callq 0x27950
movq %rbx, %rdi
callq 0x28150
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVPose::Towards() const
const R3Vector GSVPose::
Towards(void) const
{
  // Return vector along view direction
  R4Matrix rotation = orientation.Matrix();
  R3Vector towards = rotation * R3negz_vector;
  towards.Normalize();
  return towards;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
addq $0x20, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xc20ca
leaq 0x111cf1(%rip), %rdx    # 0x156e10
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc49de
movq %rbx, %rdi
callq 0xd5188
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVPose::Up() const
const R3Vector GSVPose::
Up(void) const
{
  // Return up vector
  R4Matrix rotation = orientation.Matrix();
  R3Vector up = rotation * R3posy_vector;
  up.Normalize();
  return up;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
addq $0x20, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xc20ca
leaq 0x111c4b(%rip), %rdx    # 0x156db0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc49de
movq %rbx, %rdi
callq 0xd5188
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVPose::Right() const
const R3Vector GSVPose::
Right(void) const
{
  // Return up vector
  R4Matrix rotation = orientation.Matrix();
  R3Vector right = rotation * R3posx_vector;
  right.Normalize();
  return right;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
addq $0x20, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xc20ca
leaq 0x111bed(%rip), %rdx    # 0x156d98
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc49de
movq %rbx, %rdi
callq 0xd5188
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVPose::Matrix() const
const R4Matrix GSVPose::
Matrix(void) const
{
  // Return matrix (std -> pose)
  R4Matrix matrix = R4identity_matrix;
  matrix.Translate(viewpoint.Vector());
  matrix.Multiply(orientation.Matrix());
  return matrix;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10c28b(%rip), %rsi    # 0x151470
callq 0xc295a
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
movsd 0x18(%r14), %xmm2
movq %rsp, %r15
movq %r15, %rdi
callq 0xd4e72
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc3a94
addq $0x20, %r14
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xc20ca
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xc494b
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc453e
movq %rbx, %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVPose::Draw(gaps::RNFlags) const
void GSVPose::
Draw(RNFlags flags) const
{
  // Draw viewpoint
  R3Sphere(viewpoint, 0.1).Draw();

  // Draw towards vector
  R3Span(viewpoint, viewpoint + Towards()).Draw();

  // Draw up vector
  R3Span(viewpoint, viewpoint + 0.5 * Up()).Draw();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r14
leaq 0x8(%rdi), %rbx
leaq 0x30(%rsp), %r15
movsd 0x106da6(%rip), %xmm0   # 0x14c0a8
movq %r15, %rdi
movq %rbx, %rsi
callq 0xbb3fa
movl $0x772, %esi            # imm = 0x772
movq %r15, %rdi
callq 0x915b2
leaq 0x30(%rsp), %rdi
callq 0xbe790
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x450fa
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xd4723
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xd3862
movq %r15, %rdi
callq 0x8fe86
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x45140
movq %rsp, %r14
movsd 0x106c92(%rip), %xmm0   # 0x14c010
movq %r14, %rdi
movq %r15, %rsi
callq 0xd580e
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xd4723
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xd3862
movq %r14, %rdi
callq 0x8fe86
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xbe790
movq %rbx, %rdi
callq 0x28150
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVPose::Print(_IO_FILE*, char const*, char const*) const
void GSVPose::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print pose header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Pose:   %g %g %g   %g %g %g %g", 
    viewpoint[0], viewpoint[1], viewpoint[2], 
    orientation[0], orientation[1], orientation[2], orientation[3]);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
jne 0x453f9
movq 0x18fb1a(%rip), %rax    # 0x1d4f10
movq (%rax), %rbx
testq %rdx, %rdx
je 0x45409
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x27a90
movsd 0x8(%r15), %xmm0
movsd 0x10(%r15), %xmm1
movsd 0x18(%r15), %xmm2
movsd 0x20(%r15), %xmm3
movsd 0x28(%r15), %xmm4
movsd 0x30(%r15), %xmm5
movsd 0x38(%r15), %xmm6
leaq 0x108337(%rip), %rsi    # 0x14d771
movq %rbx, %rdi
movb $0x7, %al
callq 0x27e00
testq %r14, %r14
je 0x45454
movq %r14, %rdi
movq %rbx, %rsi
callq 0x27a90
movl $0xa, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x27c30
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVPose.cpp
// Function: gaps::GSVInterpolatedPose(gaps::GSVPose const&, gaps::GSVPose const&, double)
GSVPose 
GSVInterpolatedPose(const GSVPose& pose0, const GSVPose& pose1, RNScalar t)
{
  // Return interpolated pose (with spherical interpolation of orientation)
  R3Point viewpoint = (1-t)*pose0.Viewpoint() + t*pose1.Viewpoint();
  R3Quaternion orientation = R3QuaternionSlerp(pose0.Orientation(), pose1.Orientation(), t);
  return GSVPose(viewpoint, orientation);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movapd %xmm0, %xmm1
movsd %xmm0, (%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movsd 0x106bea(%rip), %xmm0   # 0x14c078
subsd %xmm1, %xmm0
addq $0x8, %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xd4e22
leaq 0x8(%r14), %rsi
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movsd (%rsp), %xmm0
callq 0xd4e22
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xd4ddc
addq $0x20, %r15
addq $0x20, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movsd (%rsp), %xmm0
callq 0xc18bb
leaq 0x1879cd(%rip), %rax    # 0x1ccec0
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
movq %rbp, %rsi
callq 0xd43ee
movq %rbx, %rdi
addq $0x20, %rdi
movq %r12, %rsi
callq 0xc1866
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/vividvilla[P]hackerrank/src/flowers.cpp
// Function: getMinimumPrice(std::vector<int, std::allocator<int>>, int)
int getMinimumPrice(vector<int> flowers, int K) {
    int p = 0;
    int N = flowers.size();
    int x = 0;
    int c = 0;
    vector<int> m = vector<int>(N, 0);

    sort(flowers.begin(), flowers.end());
    for (int i = N - 1; i >= 0; i--) {
        m[i] = x;
        c++;
        if (c >= K) {
            x++;
            c = 0;
        }
    }

    for (int i = 0; i < N; i++)
        p += (m[i] + 1) * flowers[i];

    return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %r12
subq (%rdi), %r12
shrq $0x2, %r12
movslq %r12d, %rsi
leaq 0x4(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rcx
callq 0x14c8
movq (%rbx), %r14
movq 0x8(%rbx), %r15
cmpq %r15, %r14
je 0x12be
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x16df
movq %r14, %rdi
movq %r15, %rsi
callq 0x17c2
movq 0x8(%rsp), %rdi
testl %r12d, %r12d
jle 0x131f
movl %r12d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
incq %rax
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl %edx, -0x8(%rdi,%rax,4)
incl %esi
xorl %r8d, %r8d
cmpl %ebp, %esi
cmovgel %ecx, %esi
setge %r8b
addl %r8d, %edx
decq %rax
cmpq $0x1, %rax
ja 0x12d9
testl %r12d, %r12d
jle 0x1328
movq (%rbx), %rax
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %ecx, %ecx
xorl %ebx, %ebx
movl (%rdi,%rcx,4), %edx
incl %edx
imull (%rax,%rcx,4), %edx
addl %edx, %ebx
incq %rcx
cmpq %rcx, %r12
jne 0x130a
jmp 0x132a
xorl %ebx, %ebx
testq %rdi, %rdi
jne 0x132a
jmp 0x1337
xorl %ebx, %ebx
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1360
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1100
// File: /workspace/github_cpp_makefile_star2_O3/vividvilla[P]hackerrank/src/flowers.cpp
// Function: main
int main() {
    int N, K, f;
    cin >> N >> K;

    vector<int> flowers;
    for (int i = 0; i < N; i++) {
        cin >> f;
        flowers.push_back(f);
    }

    cout << getMinimumPrice(flowers, K) << endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq 0x2c67(%rip), %rdi      # 0x3fe0
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
callq 0x1060
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x1060
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x0, (%rbx)
jle 0x13f7
xorl %ebp, %ebp
movq 0x2c2e(%rip), %rbx      # 0x3fe0
leaq 0x4(%rsp), %r14
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x13e4
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13ef
movq %r15, %rdi
movq %r14, %rdx
callq 0x1a0e
incl %ebp
cmpl 0xc(%rsp), %ebp
jl 0x13bc
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1644
movl 0x8(%rsp), %esi
leaq 0x30(%rsp), %rdi
callq 0x124c
movq 0x2bb5(%rip), %rdi      # 0x3fd0
movl %eax, %esi
callq 0x10f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1463
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x147a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14a5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x14a8
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
jmp 0x14a8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14bf
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1100
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/Tokens.cxx
// Function: Tokens::open(char const*)
int Tokens::open(const char *filename)
{
  in = fopen(filename, "rb");

  if (in == NULL)
  {
    return -1;
  }

  this->filename = filename;

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4990(%rip), %rsi      # 0x71b1
movq %rbx, %rdi
callq 0x2200
movq %rax, (%r14)
testq %rax, %rax
je 0x2859
movq 0x10(%r14), %r12
addq $0x8, %r14
movq %rbx, %rdi
callq 0x20e0
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x22b0
jmp 0x285f
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/MidiFile.cxx
// Function: MidiFile::write_var(int)
void MidiFile::write_var(int i)
{
  int t, k;

  t = 7;

  while ((i >> t) != 0)
  {
    t = t + 7;
  }

  t = t - 7;

  for (k = t; k >= 0; k = k - 7)
  {
    if (k != 0)
    {
      putc(((i >> k) & 127) + 128, out);
    }
      else
    {
      putc(((i >> k) & 127), out);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl $0xfffffff9, %r14d      # imm = 0xFFFFFFF9
leal 0xe(%r14), %ecx
movl %ebp, %eax
sarl %cl, %eax
addl $0x7, %r14d
testl %eax, %eax
jne 0x2d62
movl %ebp, %r15d
andl $0x7f, %r15d
testl %r14d, %r14d
je 0x2db1
movl %ebp, %eax
movl %r14d, %ecx
sarl %cl, %eax
orl $0x80, %eax
movzbl %al, %edi
movq (%rbx), %rsi
callq 0x2330
leal -0x7(%r14), %eax
addl $0x7, %r14d
cmpl $0xd, %r14d
movl %eax, %r14d
jg 0x2d79
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rsi
movl %r15d, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/Pattern.cxx
// Function: Pattern::add(unsigned char, unsigned char, unsigned char, unsigned int)
void Pattern::add(
  uint8_t value,
  uint8_t volume,
  uint8_t channel,
  uint32_t duration)
{
  Data current;

  current.value = value;
  current.volume = volume;
  current.channel = channel;
  current.duration = duration;

  data.push_back(current);
}

// Assembly:
pushq %rax
movb %sil, (%rsp)
movb %dl, 0x1(%rsp)
movb %cl, 0x2(%rsp)
movl %r8d, 0x4(%rsp)
movq 0x28(%rdi), %rsi
cmpq 0x30(%rdi), %rsi
je 0x3154
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rdi)
jmp 0x3160
addq $0x20, %rdi
movq %rsp, %rdx
callq 0x31b8
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/Pattern.cxx
// Function: Pattern::print()
void Pattern::print()
{
  printf("  -- Pattern %s -- \n", name.c_str());

  for (auto it = data.begin(); it != data.end(); it++)
  {
    printf("   value: %d, volume: %d, channel: %d, duration: %d\n",
      it->value,
      it->volume,
      it->channel,
      it->duration);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x411b(%rip), %rdi      # 0x728f
xorl %eax, %eax
callq 0x2050
movq 0x20(%rbx), %r15
cmpq 0x28(%rbx), %r15
je 0x31b2
leaq 0x4118(%rip), %r14      # 0x72a4
movzbl (%r15), %esi
movzbl 0x1(%r15), %edx
movzbl 0x2(%r15), %ecx
movl 0x4(%r15), %r8d
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
addq $0x8, %r15
cmpq 0x28(%rbx), %r15
jne 0x318c
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/Section.cxx
// Function: Section::print()
void Section::print()
{
  printf("  -- Section -- \n");

  for (auto it = patterns.begin(); it != patterns.end(); it++)
  {
    printf(" %d", *it);
  }

  printf("\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x3f72(%rip), %rdi      # 0x72f7
callq 0x22a0
movq (%rbx), %r15
cmpq 0x8(%rbx), %r15
je 0x33b1
leaq 0x3f59(%rip), %r14      # 0x72f3
movl (%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
addq $0x4, %r15
cmpq 0x8(%rbx), %r15
jne 0x339a
movl $0xa, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x2240
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/Song.cxx
// Function: Song::parse(Tokens*)
int Song::parse(Tokens *tokens)
{
  int token_type;
  char token[1024];

#ifndef WINDOWS
  signal_catch(0);
  play_timer.it_value.tv_sec = 0;
  play_timer.it_value.tv_usec = 0;
#endif

  while(1)
  {
    token_type = tokens->get(token);

    if (token_type == -1) { break; }

    if (strcmp(token, "set") == 0)
    {
      if (parse_set(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "define") == 0)
    {
      if (parse_define(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "include") == 0)
    {
      if (parse_include(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "pattern") == 0)
    {
      if (parse_pattern(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "section") == 0)
    {
      if (parse_section(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "song") == 0)
    {
      if (parse_song(tokens) == -1) { return -1; }
    }
      else
    {
      printf("Error: Unknown token '%s' at %s:%d.\n",
        token, tokens->get_filename(), tokens->get_line());
      return -1;
    }
  }

#ifdef WINDOWS
  Sleep(1000);
#endif

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %r14
movq %rdi, %r15
leaq 0x132(%rip), %rsi       # 0x3734
movl $0x1b, %edi
callq 0x2210
xorps %xmm0, %xmm0
movups %xmm0, 0x118(%r15)
movq %rsp, %rsi
movq %r14, %rdi
callq 0x2884
xorl %ebx, %ebx
cmpl $-0x1, %eax
je 0x3720
movq %rsp, %r12
movl $0x69666564, %ebp       # imm = 0x69666564
movl $0x656e69, %r13d        # imm = 0x656E69
cmpl $0x746573, (%rsp)       # imm = 0x746573
jne 0x3654
movq %r15, %rdi
movq %r14, %rsi
callq 0x3746
jmp 0x36e7
movl (%rsp), %eax
xorl %ebp, %eax
movl 0x3(%rsp), %ecx
xorl %r13d, %ecx
orl %eax, %ecx
je 0x36a2
movq (%rsp), %rax
movabsq $0x6e726574746170, %rcx # imm = 0x6E726574746170
cmpq %rcx, %rax
je 0x36bc
movabsq $0x6e6f6974636573, %rcx # imm = 0x6E6F6974636573
cmpq %rcx, %rax
je 0x36af
movabsq $0x6564756c636e69, %rcx # imm = 0x6564756C636E69
cmpq %rcx, %rax
jne 0x36c9
movq %r15, %rdi
movq %r14, %rsi
callq 0x3c44
jmp 0x36e7
movq %r15, %rdi
movq %r14, %rsi
callq 0x3aae
jmp 0x36e7
movq %r15, %rdi
movq %r14, %rsi
callq 0x46a8
jmp 0x36e7
movq %r15, %rdi
movq %r14, %rsi
callq 0x3daa
jmp 0x36e7
movl (%rsp), %eax
movl $0x676e6f73, %ecx       # imm = 0x676E6F73
xorl %ecx, %eax
movzbl 0x4(%rsp), %ecx
orl %eax, %ecx
jne 0x3702
movq %r15, %rdi
movq %r14, %rsi
callq 0x49e8
cmpl $-0x1, %eax
je 0x371b
movq %r14, %rdi
movq %r12, %rsi
callq 0x2884
cmpl $-0x1, %eax
jne 0x363b
jmp 0x3720
movq 0x8(%r14), %rdx
movl 0x2c(%r14), %ecx
leaq 0x3c0f(%rip), %rdi      # 0x7320
movq %rsp, %rsi
xorl %eax, %eax
callq 0x2050
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]drumsplusplus/build/../src/Song.cxx
// Function: Song::parse_define(Tokens*)
int Song::parse_define(Tokens *tokens)
{
  int token_type;
  char name[1024];
  char value[1024];

  token_type = tokens->get(name);

  if (token_type != TOKEN_ALPHA)
  {
    print_error(tokens, "define", name);
    return -1;
  }

  token_type = tokens->get(value);

  if (defines.find(name) != defines.end())
  {
    print_error(tokens, "already defined", name);
  }

  defines[name] = value;

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x820, %rsp            # imm = 0x820
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x2884
cmpl $0x1, %eax
jne 0x3be1
leaq 0x420(%rsp), %rsi
movq %rbx, %rdi
callq 0x2884
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x20e0
leaq (%rsp,%rax), %rdx
addq $0x20, %rdx
movq %rsp, %rdi
movq %r14, %rsi
callq 0x61de
leaq 0xa8(%r15), %r14
movq %rsp, %rsi
movq %r14, %rdi
callq 0x6154
movq %rax, %r12
addq $0xb0, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3b45
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
cmpq %r15, %r12
je 0x3b6c
movq 0x8(%rbx), %rcx
movl 0x2c(%rbx), %r8d
leaq 0x3d87(%rip), %rdi      # 0x78e0
leaq 0x39be(%rip), %rsi      # 0x751e
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x2050
movq %rsp, %rbx
movq %r13, (%rbx)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x20e0
leaq (%rsp,%rax), %rdx
addq $0x20, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x61de
movq %rsp, %rsi
movq %r14, %rdi
callq 0x5692
movq %rax, %rbx
movq 0x8(%rax), %r14
leaq 0x420(%rsp), %r15
movq %r15, %rdi
callq 0x20e0
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x22b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3bdd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
xorl %eax, %eax
jmp 0x3c08
movq 0x8(%rbx), %rcx
movl 0x2c(%rbx), %r8d
leaq 0x3cf0(%rip), %rdi      # 0x78e0
leaq 0x371d(%rip), %rsi      # 0x7314
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x2050
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x820, %rsp            # imm = 0x820
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x3c1d
jmp 0x3c22
movq %rax, %rbx
jmp 0x3c3b
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3c3b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2300
nop