LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::SetPoints(gaps::GSVPoint const*, int)
void GSVScanline::
SetPoints(const GSVPoint *points, int npoints) 
{
  // Delete previous points
  if (this->points) delete [] this->points;

  // Reset everything
  this->npoints = npoints;
  this->points = NULL;
  this->bbox = R3null_box;

  // Copy points
  if (points && (npoints > 0)) {
    // Allocate points 
    this->points = new GSVPoint [ npoints ];
    if (!this->points) {
      RNAbort("Unable to allocate points for scanline\n");
    }
    
    // Copy points
    for (int i = 0; i < npoints; i++) {
      this->points[i] = points[i];
    }

    // Update bounding box
    for (int i = 0; i < npoints; i++) {
      bbox.Union(this->points[i].Position());
    }
  }

  // Set read count
  read_count = 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x3e3d6
callq 0x27ca0
movl %ebp, 0x30(%rbx)
andq $0x0, 0x28(%rbx)
leaq 0x88(%rbx), %r14
leaq 0x1895cc(%rip), %rsi    # 0x1c79b8
movq %r14, %rdi
callq 0x30d44
testq %r12, %r12
sete %al
testl %ebp, %ebp
setle %cl
orb %al, %cl
jne 0x3e479
movl %ebp, %eax
imulq $0x50, %rax, %r15
movq %r15, %rdi
callq 0x27040
movq %rax, %r13
xorl %ebp, %ebp
movq %r13, %rdi
addq %rbp, %rdi
callq 0x42260
addq $0x50, %rbp
cmpq %rbp, %r15
jne 0x3e416
movq %r13, 0x28(%rbx)
xorl %edx, %edx
pushq $0x4e
popq %rax
cmpq %rdx, %r15
je 0x3e44e
leaq (%r12,%rdx), %rsi
movq 0x28(%rbx), %rdi
addq %rdx, %rdi
movq %rax, %rcx
rep  movsb (%rsi), %es:(%rdi)
addq $0x50, %rdx
jmp 0x3e433
xorl %r13d, %r13d
movq %rsp, %r12
cmpq %r13, %r15
je 0x3e479
movq 0x28(%rbx), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x310c8
movq %r14, %rdi
movq %r12, %rsi
callq 0xad308
addq $0x50, %r13
jmp 0x3e454
movl $0x1, 0x20(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r13, %rdi
movq %r15, %rsi
callq 0x28360
movq %rbx, %rdi
callq 0x28170
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::SetPose(gaps::GSVPose const&)
void GSVScanline::
SetPose(const GSVPose& pose)
{
  // Update points
  if ((NPoints() > 0) && (points) && (!(this->pose.Orientation().IsZero()))) {
    // Determine transformation of points
    R4Matrix matrix = R4identity_matrix;
    matrix.Translate(pose.Viewpoint().Vector());
    matrix.Multiply(pose.Orientation().Matrix());
    matrix.Multiply(this->pose.Orientation().Inverse().Matrix());
    matrix.Translate(-this->pose.Viewpoint().Vector());
    R3Affine transformation(matrix, 0);
    
    // Transform points
    for (int i = 0; i < npoints; i++) {
      points[i].Transform(transformation);
    }
  }

  // Set pose
  this->pose = pose;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x30(%rdi)
jle 0x3e5cc
cmpq $0x0, 0x28(%rbx)
je 0x3e5cc
leaq 0x58(%rbx), %r13
movq %r13, %rdi
callq 0x3f9fc
testl %eax, %eax
jne 0x3e5cc
leaq 0xf1eb3(%rip), %rsi     # 0x1303a0
leaq 0x138(%rsp), %r12
movq %r12, %rdi
callq 0xb1438
leaq 0x8(%r14), %rsi
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3fa22
movq %r12, %rdi
movq %r15, %rsi
callq 0xb2388
leaq 0x20(%r14), %rsi
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
callq 0xb0e4e
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3fa3e
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0xb0fce
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0xb0e4e
movq %r12, %rdi
movq %r13, %rsi
callq 0x3fa3e
leaq 0x40(%rbx), %rsi
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x3fa22
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0xc1f22
movq %r12, %rdi
movq %rbp, %rsi
callq 0xb2388
leaq 0x28(%rsp), %rdi
xorl %r13d, %r13d
movq %r12, %rsi
xorl %edx, %edx
callq 0xaf4c8
xorl %r12d, %r12d
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
jge 0x3e5c2
movq 0x28(%rbx), %rdi
addq %r13, %rdi
movq %r15, %rsi
callq 0x3fa74
incq %r12
addq $0x50, %r13
jmp 0x3e5a1
leaq 0x28(%rsp), %rdi
callq 0xaf516
leaq 0x38(%rbx), %rdi
movq %r14, %rsi
callq 0x376de
movq %rbx, %rdi
callq 0x3e608
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xaf516
movq %rbx, %rdi
callq 0x28170
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3e7c9
movq %rsi, %r14
movq %rdi, %rbx
btl $0xc, %r14d
jb 0x3e6e6
xorl %edi, %edi
callq 0x271a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3e7d8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27ce0
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movapd %xmm0, 0x10(%rsp)
movl $0x3f800000, %eax       # imm = 0x3F800000
movl %eax, (%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0x20(%rsp)
pushq $0x1
popq %rbp
movl %ebp, %edi
callq 0x271a0
movq 0x28(%rbx), %rsi
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x310c8
pushq $-0x1
popq %r12
leaq 0x28(%rsp), %r15
pushq $0x3
popq %r13
cmpl 0x30(%rbx), %ebp
jge 0x3e7c4
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x3f9e0
movsd 0x40(%rsp), %xmm0
subsd 0x28(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
subsd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0xec901(%rip), %xmm1    # 0x12b070
ucomisd %xmm0, %xmm1
jbe 0x3e7af
movl 0x30(%rbx), %eax
addl %r12d, %eax
cvtsi2sd %eax, %xmm0
mulsd 0xec901(%rip), %xmm0    # 0x12b088
cvttsd2si %xmm0, %eax
cltd
idivl %r13d
movslq %edx, %rax
imulq $0xc, %rax, %rax
leaq (%rsp,%rax), %rdi
callq 0x27370
movq %r14, %rdi
callq 0x271c0
movq %r15, %rdi
callq 0x271c0
movq %r14, %rdi
movq %r15, %rsi
callq 0xc10e6
incl %ebp
decl %r12d
jmp 0x3e72d
callq 0x27ce0
addq $0x58, %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/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 0x3f681
movq 0x17e8c2(%rip), %rax    # 0x1bdf40
movq (%rax), %r14
testq %rbx, %rbx
je 0x3f691
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27aa0
movl 0x10(%r12), %edx
leaq 0xecbf3(%rip), %rsi     # 0x12c290
movq %r14, %rdi
xorl %eax, %eax
callq 0x27e20
testq %r15, %r15
je 0x3f6b7
movq %r15, %rdi
movq %r14, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x27c30
leaq 0xec32b(%rip), %rsi     # 0x12b9f4
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_O2/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
movq 0x28(%rdi), %rdx
addq $0x46, %rdx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
pushq $-0x1
popq %rax
xorl %edi, %edi
cmpq %rcx, %rdi
jge 0x3f730
movzbl (%rdx), %r10d
movl %r10d, %r11d
subl %esi, %r11d
movl %r11d, %r9d
negl %r9d
cmovsl %r11d, %r9d
cmpl %r8d, %r9d
jge 0x3f725
cmpl %esi, %r10d
je 0x3f72e
movl %r9d, %r8d
movl %edi, %eax
incq %rdi
addq $0x50, %rdx
jmp 0x3f6fd
movl %edi, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x88(%rdi), %r14
leaq 0x188251(%rip), %rsi    # 0x1c79b8
movq %r14, %rdi
callq 0x30d44
xorl %ebp, %ebp
movq %rsp, %r15
cmpl 0x30(%rbx), %ebp
jge 0x3f795
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x3f9e0
movq %r14, %rdi
movq %r15, %rsi
callq 0xad308
incl %ebp
jmp 0x3f774
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3f94f
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x3f94f
movq %r14, %rdi
xorl %edx, %edx
callq 0xe3986
testl %eax, %eax
jne 0x3f95b
leaq 0xec950(%rip), %rdi     # 0x12c29d
jmp 0x3f9a8
movq %r14, %rdi
callq 0xe3997
movq %rax, 0x18(%rbx)
leaq 0x30(%rbx), %r15
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %r14, %rcx
callq 0x28350
cmpq $0x1, %rax
jne 0x3f9a1
movslq (%r15), %rdx
pushq $0x1
popq %rbp
testq %rdx, %rdx
jle 0x3f9b1
movq 0x28(%rbx), %rdi
pushq $0x50
popq %rsi
movq %r14, %rcx
callq 0x28350
movl 0x30(%rbx), %ecx
cmpq %rcx, %rax
je 0x3f9b1
leaq 0xec996(%rip), %rdi     # 0x12c335
jmp 0x3f9a8
leaq 0xec962(%rip), %rdi     # 0x12c30a
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe434a
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x310c8
movq %rsp, %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x310e4
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x38d32
movq %r15, %rdi
movq %r14, %rsi
callq 0xc1442
movq %r12, %rdi
movq %r14, %rsi
callq 0xc1e68
movq %r13, %rdi
movq %r14, %rsi
callq 0xc1e68
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 0x17f94e(%rip), %rax    # 0x1bf478
movsd (%rax), %xmm1
movsd 0xeb532(%rip), %xmm2    # 0x12b068
addsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
ja 0x3fb5c
xorpd 0xec178(%rip), %xmm1    # 0x12bcc0
ucomisd %xmm2, %xmm1
ja 0x3fb5c
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
andpd 0xec35c(%rip), %xmm0    # 0x12bec0
xorl %eax, %eax
movsd 0xec6ea(%rip), %xmm1    # 0x12c258
cmpq $0x2, %rax
je 0x3fb4e
movzwl 0x40(%rbx,%rax,2), %ecx
cvtsi2sd %ecx, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm1, %xmm3
minsd %xmm2, %xmm3
cvttsd2si %xmm3, %ecx
movw %cx, 0x40(%rbx,%rax,2)
incq %rax
jmp 0x3fb6e
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x175f5d(%rip), %rax    # 0x1b5b60
movq %rax, (%rdi)
callq 0x95076
movq 0x140(%rbx), %r14
testq %r14, %r14
je 0x3fc2a
movq %r14, %rdi
callq 0x84f44
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x27960
movq 0x138(%rbx), %r15
testq %r15, %r15
je 0x3fc76
leaq -0x8(%r15), %r14
movq -0x8(%r15), %r12
testq %r12, %r12
je 0x3fc63
addq $-0xa8, %r15
imulq $0xa8, %r12, %r13
leaq (%r15,%r13), %rdi
callq 0xa2f5c
addq $-0xa8, %r13
jne 0x3fc51
imulq $0xa8, %r12, %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x28360
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x93114
movq %rax, %rdi
callq 0x376d2
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3fce8
pushq %rbx
movq %rsi, %rbx
callq 0x3e1c0
movapd %xmm0, %xmm1
movsd 0x28(%rbx), %xmm0
subsd %xmm1, %xmm0
popq %rbx
retq
movsd 0xeb378(%rip), %xmm0    # 0x12b068
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3fd6e
movq %rsi, %r14
leaq 0x38(%rbx), %r15
addq $0x40, %rbx
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x41e74
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x41eba
addq $0x18, %r14
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xc0fd9
movq %r15, %rdi
callq 0xc16c2
leaq 0x17f726(%rip), %rax    # 0x1bf478
movsd (%rax), %xmm1
movapd 0xebf62(%rip), %xmm2    # 0x12bcc0
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x3fd78
ucomisd %xmm0, %xmm1
jb 0x3fd78
movsd 0xeb2f2(%rip), %xmm0    # 0x12b068
jmp 0x3fdde
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xc1eba
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xc1836
callq 0x278c0
movapd %xmm0, (%rsp)
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0xc1836
movapd %xmm0, %xmm1
leaq 0xf7454(%rip), %rax     # 0x137208
movapd 0xebf04(%rip), %xmm2    # 0x12bcc0
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_O2/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 0x3fe3b
movq %rsi, %r14
leaq 0x38(%rbx), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x41e74
addq $0x40, %rbx
addq $0x18, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xc0fd9
movq %r12, %rdi
movq %r15, %rsi
callq 0xc1836
jmp 0x3fe43
movsd 0xeb225(%rip), %xmm0    # 0x12b068
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3febe
addq $0x38, %rsi
movq %rbx, %rdi
callq 0x41e74
jmp 0x3fecd
leaq 0xf5dd3(%rip), %rsi     # 0x135c98
movq %rbx, %rdi
callq 0xc15cc
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3fef0
addq $0x38, %rsi
movq %rbx, %rdi
callq 0x41eba
jmp 0x3feff
leaq 0xf5da1(%rip), %rsi     # 0x135c98
movq %rbx, %rdi
callq 0xc15cc
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x40a10
movl $0xa8, %edi
callq 0x27940
movq %rax, %rbx
movq %rax, %rdi
callq 0x41c10
orb $0x1, 0x78(%rbx)
andq $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 0x959ac
movq %rax, %r14
movl $0xa8, %esi
movq %rbx, %rdi
callq 0x27960
movq %r14, %rdi
callq 0x28170
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x40a82
movl $0xa8, %edi
callq 0x27940
movq %rax, %rbx
movq %rax, %rdi
callq 0x41c10
orb $0x1, 0x78(%rbx)
andq $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 0x95a26
movq %rax, %r14
movl $0xa8, %esi
movq %rbx, %rdi
callq 0x27960
movq %r14, %rdi
callq 0x28170
// File: /workspace/github_cpp_makefile_star2_O2/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 0x40c26
pushq $0x4
popq %rdi
callq 0x271a0
leaq 0xf6703(%rip), %rax     # 0x1371f8
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
xorl %r12d, %r12d
pushq $-0x1
popq %r13
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jge 0x40c13
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41cc0
movq %rax, %rdi
callq 0x27ea0
movq 0x8(%r14), %r15
movq 0x98(%r15), %rax
movl %r13d, %ebp
testq %rax, %rax
je 0x40b43
movl 0x10(%rax), %ebp
movq %r15, %rsi
callq 0x3fcf2
mulsd 0xeb15d(%rip), %xmm0    # 0x12bcb0
divsd (%rsp), %xmm0
addsd 0xea4d8(%rip), %xmm0    # 0x12b038
cvttsd2si %xmm0, %esi
movl %ebp, %edi
callq 0x276d0
addq $0x18, %r15
movq %r15, %rdi
callq 0x271c0
movq 0x10(%r14), %r15
movq 0x98(%r15), %rax
movl %r13d, %ebp
testq %rax, %rax
je 0x40b8d
movl 0x10(%rax), %ebp
movq %r15, %rsi
callq 0x3fcf2
mulsd 0xeb113(%rip), %xmm0    # 0x12bcb0
divsd (%rsp), %xmm0
addsd 0xea48e(%rip), %xmm0    # 0x12b038
cvttsd2si %xmm0, %esi
movl %ebp, %edi
callq 0x276d0
addq $0x18, %r15
movq %r15, %rdi
callq 0x271c0
movq 0x18(%r14), %r14
movq 0x98(%r14), %rax
movl %r13d, %ebp
testq %rax, %rax
je 0x40bd7
movl 0x10(%rax), %ebp
movq %r14, %rsi
callq 0x3fcf2
mulsd 0xeb0c9(%rip), %xmm0    # 0x12bcb0
divsd (%rsp), %xmm0
addsd 0xea444(%rip), %xmm0    # 0x12b038
cvttsd2si %xmm0, %esi
movl %ebp, %edi
callq 0x276d0
addq $0x18, %r14
movq %r14, %rdi
callq 0x271c0
incq %r12
jmp 0x40b05
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27ce0
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
// File: /workspace/github_cpp_makefile_star2_O2/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, %r13
cmpq $0x0, 0x140(%rdi)
jne 0x40cb8
pushq $0x18
popq %rdi
callq 0x27940
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
callq 0x84e60
movq %rbp, 0x140(%r13)
leaq 0x38(%rsp), %rdi
callq 0xc0dfa
movq 0x140(%r13), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %r15, %rcx
movq %r14, %r8
callq 0x87cec
testq %rbx, %rbx
je 0x40cfa
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x41c84
movl 0x18(%rsp), %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %rbp, %rdi
callq 0x27960
movq %rbx, %rdi
callq 0x28170
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xb0e4e
leaq 0xf3ea7(%rip), %rdx     # 0x135d40
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb2f4f
movq %rbx, %rdi
callq 0xc18be
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xb0e4e
leaq 0xf3e01(%rip), %rdx     # 0x135ce0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb2f4f
movq %rbx, %rdi
callq 0xc18be
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xb0e4e
leaq 0xf3da3(%rip), %rdx     # 0x135cc8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb2f4f
movq %rbx, %rdi
callq 0xc18be
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xee441(%rip), %rsi     # 0x1303a0
callq 0xb1438
leaq 0x8(%r14), %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x3fa22
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb2388
addq $0x20, %r14
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xb0e4e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3fa3e
movq %rbx, %rax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xe9030(%rip), %xmm0    # 0x12b088
movq %r15, %rdi
movq %rbx, %rsi
callq 0xaa6c8
movl $0x772, %esi            # imm = 0x772
movq %r15, %rdi
callq 0x84a86
leaq 0x30(%rsp), %rdi
callq 0xad65a
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x41e74
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xc10c3
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xc02b0
movq %r15, %rdi
callq 0x836b6
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x41eba
movq %rsp, %r14
movsd 0xe8f64(%rip), %xmm0    # 0x12b038
movq %r14, %rdi
movq %r15, %rsi
callq 0xc1cb2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xc10c3
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xc02b0
movq %r14, %rdi
callq 0x836b6
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xad65a
movq %rbx, %rdi
callq 0x28170
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4214f
movq 0x17bdf4(%rip), %rax    # 0x1bdf40
movq (%rax), %rbx
testq %rdx, %rdx
je 0x4215f
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x27aa0
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 0xea5a1(%rip), %rsi     # 0x12c731
movq %rbx, %rdi
movb $0x7, %al
callq 0x27e20
testq %r14, %r14
je 0x421aa
movq %r14, %rdi
movq %rbx, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x27c30
// File: /workspace/github_cpp_makefile_star2_O2/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 0xe8e8e(%rip), %xmm0    # 0x12b070
subsd %xmm1, %xmm0
addq $0x8, %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xc1570
leaq 0x8(%r14), %rsi
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movsd (%rsp), %xmm0
callq 0xc1570
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xc152a
addq $0x20, %r15
addq $0x20, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movsd (%rsp), %xmm0
callq 0xb0615
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x41d1e
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %r14
subq (%rdi), %r14
shrq $0x2, %r14
movslq %r14d, %rsi
leaq 0x4(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rcx
callq 0x13da
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x158f
movq 0x8(%rsp), %rax
movl %r14d, %ecx
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
testl %ecx, %ecx
jle 0x12a6
movl %edi, -0x4(%rax,%rcx,4)
decq %rcx
incl %esi
xorl %r8d, %r8d
cmpl %ebp, %esi
setge %r8b
cmovgel %edx, %esi
addl %r8d, %edi
jmp 0x1288
movq 0x8(%rsp), %rax
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %edx
cmovgl %r14d, %edx
xorl %ebp, %ebp
cmpq %rcx, %rdx
je 0x12d3
movl (%rax,%rcx,4), %esi
incl %esi
movq (%rbx), %rdi
imull (%rdi,%rcx,4), %esi
addl %esi, %ebp
incq %rcx
jmp 0x12bb
leaq 0x8(%rsp), %rdi
callq 0x14c8
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x14c8
movq %rbx, %rdi
callq 0x1100
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2cd2(%rip), %rbx      # 0x3fe0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1080
leaq 0x4(%rsp), %rsi
movq %rax, %rdi
callq 0x1080
leaq 0x10(%rsp), %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
xorl %ebp, %ebp
leaq 0xc(%rsp), %r15
cmpl 0x8(%rsp), %ebp
jge 0x1360
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1080
movq %r14, %rdi
movq %r15, %rsi
callq 0x1430
incl %ebp
jmp 0x1340
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x144e
movl 0x4(%rsp), %esi
leaq 0x30(%rsp), %rdi
callq 0x123c
movq 0x2c4c(%rip), %rdi      # 0x3fd0
movl %eax, %esi
callq 0x10f0
movq %rax, %rdi
callq 0x1060
leaq 0x30(%rsp), %rdi
callq 0x14c8
leaq 0x10(%rsp), %rdi
callq 0x14c8
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13c5
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x14c8
jmp 0x13c8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x14c8
movq %rbx, %rdi
callq 0x1100
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x49e1(%rip), %rsi      # 0x71c8
movq %rbx, %rdi
callq 0x2220
movq %rax, (%r14)
testq %rax, %rax
je 0x280a
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2360
xorl %eax, %eax
jmp 0x280d
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]drumsplusplus/build/../src/MidiFile.cxx
// Function: MidiFile::write_int32(int)
int MidiFile::write_int32(int n)
{
  putc(((n >> 24) & 0xff), out);
  putc(((n >> 16) & 0xff), out);
  putc(((n >> 8) & 0xff), out);
  putc((n & 0xff), out);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %edi
shrl $0x18, %edi
movq (%r14), %rsi
callq 0x2370
movl %ebx, %edi
shrl $0x10, %edi
movl $0xff, %ebp
andl %ebp, %edi
movq (%r14), %rsi
callq 0x2370
movl %ebx, %edi
shrl $0x8, %edi
andl %ebp, %edi
movq (%r14), %rsi
callq 0x2370
andl %ebp, %ebx
movq (%r14), %rsi
movl %ebx, %edi
callq 0x2370
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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, %ebx
movq %rdi, %r14
pushq $-0x7
popq %r15
leal 0xe(%r15), %ecx
movl %ebx, %eax
sarl %cl, %eax
addl $0x7, %r15d
testl %eax, %eax
jne 0x2cfa
movl %ebx, %ebp
andl $0x7f, %ebp
leal 0x7(%r15), %eax
cmpl $0x7, %eax
jl 0x2d3b
movl %ebx, %eax
movl %r15d, %ecx
sarl %cl, %eax
orl $0x80, %eax
testl %r15d, %r15d
movzbl %al, %edi
cmovel %ebp, %edi
movq (%r14), %rsi
callq 0x2370
addl $-0x7, %r15d
jmp 0x2d0f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x41f9(%rip), %rdi      # 0x72a7
xorl %eax, %eax
callq 0x2050
movq 0x20(%rbx), %r15
leaq 0x41fc(%rip), %r14      # 0x72bc
cmpq 0x28(%rbx), %r15
je 0x30e8
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
jmp 0x30c0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4028(%rip), %rdi      # 0x730f
callq 0x22e0
movq (%rbx), %r15
leaq 0x4015(%rip), %r14      # 0x730b
cmpq 0x8(%rbx), %r15
je 0x330f
movl (%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
addq $0x4, %r15
jmp 0x32f6
pushq $0xa
popq %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/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
callq 0x36d8
xorps %xmm0, %xmm0
movups %xmm0, 0x118(%r15)
movq %rsp, %r12
leaq 0x3d59(%rip), %r13      # 0x732c
pushq $0x7
popq %rbp
movabsq $0x6e726574746170, %rbx # imm = 0x6E726574746170
movq %r14, %rdi
movq %r12, %rsi
callq 0x2828
cmpl $-0x1, %eax
je 0x36a9
cmpl $0x746573, (%rsp)       # imm = 0x746573
jne 0x360d
movq %r15, %rdi
movq %r14, %rsi
callq 0x36e8
jmp 0x369b
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x21d0
testl %eax, %eax
je 0x3653
movq (%rsp), %rax
cmpq %rbx, %rax
je 0x366d
movabsq $0x6e6f6974636573, %rcx # imm = 0x6E6F6974636573
cmpq %rcx, %rax
je 0x3660
movabsq $0x6564756c636e69, %rcx # imm = 0x6564756C636E69
cmpq %rcx, %rax
jne 0x367a
movq %r15, %rdi
movq %r14, %rsi
callq 0x3ad0
jmp 0x369b
movq %r15, %rdi
movq %r14, %rsi
callq 0x39be
jmp 0x369b
movq %r15, %rdi
movq %r14, %rsi
callq 0x4352
jmp 0x369b
movq %r15, %rdi
movq %r14, %rsi
callq 0x3c1e
jmp 0x369b
movq %r12, %rdi
leaq 0x3caf(%rip), %rsi      # 0x7333
pushq $0x5
popq %rdx
callq 0x21d0
testl %eax, %eax
jne 0x36bd
movq %r15, %rdi
movq %r14, %rsi
callq 0x45ca
cmpl $-0x1, %eax
jne 0x35e0
pushq $-0x1
popq %rax
jmp 0x36ab
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rdx
movl 0x2c(%r14), %ecx
leaq 0x3c6c(%rip), %rdi      # 0x7338
movq %rsp, %rsi
xorl %eax, %eax
callq 0x2050
jmp 0x36a4
// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x2828
cmpl $0x1, %eax
jne 0x3a8c
leaq 0x430(%rsp), %rsi
movq %rbx, %rdi
callq 0x2828
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x507c
leaq 0xa8(%r14), %r15
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x5b04
movq %rax, %r12
addq $0xb0, %r14
leaq 0x10(%rsp), %rdi
callq 0x20f0
cmpq %r14, %r12
je 0x3a4d
leaq 0x3af6(%rip), %rdx      # 0x7536
leaq 0x30(%rsp), %rcx
movq %rbx, %rsi
callq 0x49e6
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x507c
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x50b8
leaq 0x430(%rsp), %rsi
movq %rax, %rdi
callq 0x2360
leaq 0x10(%rsp), %rdi
callq 0x20f0
xorl %eax, %eax
jmp 0x3aa3
leaq 0x3899(%rip), %rdx      # 0x732c
leaq 0x30(%rsp), %rcx
movq %rbx, %rsi
callq 0x49e6
pushq $-0x1
popq %rax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x3ab6
jmp 0x3abb
movq %rax, %rbx
jmp 0x3ac8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]drumsplusplus/build/../src/Song.cxx
// Function: Song::parse_include(Tokens*)
int Song::parse_include(Tokens *tokens)
{
  int token_type;
  char token[1024];
  char filename[1024];
  char lastfilename[1024];
  Tokens *tokens_include;

  tokens_include = new Tokens();

  token_type = tokens->get(token);

  if (token_type != TOKEN_STRING)
  {
    print_error(tokens, "filename", token);
    return -1;
  }

  filename[0] = 0;

  if (token[0] != '/')
  {
    strcpy(lastfilename, tokens->get_filename());

    if (dirname_m(lastfilename) != 0)
    {
      strcpy(filename, lastfilename);
      strcat(filename, "/");
    }
  }

  strcat(filename, token);

  if (tokens_include->open(filename) != 0)
  {
    printf("Error: included file not found: %s at %s:%d.\n",
      filename, tokens->get_filename(), tokens->get_line());

    delete tokens_include;

    return -1;
  }
    else
  {
    if (parse(tokens_include) == -1) { return -1; }
  }

  tokens_include->close();
  delete tokens_include;

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc08, %rsp            # imm = 0xC08
movq %rsi, %r14
movq %rdi, %r15
pushq $0x30
popq %rdi
callq 0x21b0
movq %rax, %rbx
movq %rax, %rdi
callq 0x27a8
leaq 0x400(%rsp), %rsi
movq %r14, %rdi
callq 0x2828
cmpl $0x4, %eax
jne 0x3bb0
movb $0x0, (%rsp)
cmpb $0x2f, 0x400(%rsp)
je 0x3b60
movq 0x8(%r14), %rsi
leaq 0x800(%rsp), %r12
movq %r12, %rdi
callq 0x2180
movq %r12, %rsi
callq 0x4a06
testq %rax, %rax
je 0x3b60
movq %rsp, %r12
leaq 0x800(%rsp), %rsi
movq %r12, %rdi
callq 0x2180
movq %r12, %rdi
callq 0x20e0
movw $0x2f, (%rsp,%rax)
movq %rsp, %r12
leaq 0x400(%rsp), %rsi
movq %r12, %rdi
callq 0x2340
movq %rbx, %rdi
movq %r12, %rsi
callq 0x27d6
testl %eax, %eax
je 0x3bd9
movq 0x8(%r14), %rdx
movl 0x2c(%r14), %ecx
leaq 0x39be(%rip), %rdi      # 0x754f
movq %rsp, %rsi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x27cc
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0x21c0
jmp 0x3bc7
leaq 0x398f(%rip), %rdx      # 0x7546
leaq 0x400(%rsp), %rcx
movq %r14, %rsi
callq 0x49e6
pushq $-0x1
popq %rax
addq $0xc08, %rsp            # imm = 0xC08
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %rbx, %rsi
callq 0x35a2
cmpl $-0x1, %eax
je 0x3bc7
movq %rbx, %rdi
callq 0x2816
movq %rbx, %rdi
callq 0x27cc
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0x21c0
xorl %eax, %eax
jmp 0x3bca
movq %rax, %r14
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0x21c0
movq %r14, %rdi
callq 0x2330