LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::SplitBlocks(gaps::R3SurfelNode*, gaps::R3SurfelConstraint const&, gaps::RNArray<gaps::R3SurfelBlock*>*, gaps::RNArray<gaps::R3SurfelBlock*>*)
int R3SurfelTree::
SplitBlocks(R3SurfelNode *node, const R3SurfelConstraint& constraint, 
  RNArray<R3SurfelBlock *> *blocksA, RNArray<R3SurfelBlock *> *blocksB)
{
  // Just checking
  assert(node);
  assert(node->Tree() == this);
  assert(node->tree_index >= 0);
  assert(nodes.Kth(node->tree_index) == node);
  int status = 0;

  // Make a temporary array of blocks
  RNArray<R3SurfelBlock *> splittable_blocks;
  for (int i = 0; i < node->NBlocks(); i++) {
    R3SurfelBlock *block = node->Block(i);
    splittable_blocks.Insert(block);
  }

  // Split blocks 
  for (int i = 0; i < splittable_blocks.NEntries(); i++) {
    R3SurfelBlock *block = splittable_blocks.Kth(i);
    R3SurfelBlock *blockA, *blockB;
    if (SplitBlock(node, block, constraint, &blockA, &blockB)) status = 1;
    if (blocksA && blockA) blocksA->Insert(blockA);
    if (blocksB && blockB) blocksB->Insert(blockB);
  }

  // Return whether any blocks were split
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %r13
movq %rsp, %rbp
movq %rbp, %rdi
callq 0x9a7ae
xorl %r15d, %r15d
movslq 0x4c(%r12), %rax
cmpq %rax, %r15
jge 0x368e7
movq 0x40(%r12), %rax
movq (%rax,%r15,8), %rsi
movq %rbp, %rdi
callq 0x1784c
incq %r15
jmp 0x368c7
xorl %r15d, %r15d
xorl %ebp, %ebp
movslq 0xc(%rsp), %rax
cmpq %rax, %r15
jge 0x36964
movq (%rsp), %rax
movq (%rax,%r15,8), %rdx
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x18(%rsp), %r9
callq *0x50(%rax)
testq %r14, %r14
setne %cl
testl %eax, %eax
pushq $0x1
popq %rax
cmovnel %eax, %ebp
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
setne %al
testb %al, %cl
je 0x3693f
movq %r14, %rdi
callq 0x1784c
testq %rbx, %rbx
setne %al
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3695f
movq %rbx, %rdi
callq 0x1784c
incq %r15
jmp 0x368ec
movq %rsp, %rdi
callq 0x9a81c
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3697f
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9a81c
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelTree::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print tree header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%s", "Tree");
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

  // Print all nodes
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    node->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x36bdc
movq 0xed3a7(%rip), %rax     # 0x123f80
movq (%rax), %r15
testq %r12, %r12
je 0x36bec
movq %r12, %rdi
movq %r15, %rsi
callq 0x135d0
leaq 0x92aa4(%rip), %rdi     # 0xc9697
movq %r15, %rsi
callq 0x135d0
testq %rbx, %rbx
je 0x36c0b
movq %rbx, %rdi
movq %r15, %rsi
callq 0x135d0
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x13690
leaq 0x91802(%rip), %rsi     # 0xc841f
xorl %ebp, %ebp
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x130e0
movslq 0x24(%r14), %rax
cmpq %rax, %rbp
jge 0x36c54
movq 0x18(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq *0x60(%rax)
incq %rbp
jmp 0x36c2f
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::~R3SurfelScan()
R3SurfelScan::
~R3SurfelScan(void)
{
  // Remove node
  if (node) SetNode(NULL);

  // Remove image
  if (image) SetImage(NULL);

  // Remove scan from scene
  if (scene) scene->RemoveScan(this);

  // Delete name
  if (name) free(name);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xe8d79(%rip), %rax     # 0x11fbb8
movq %rax, (%rdi)
cmpq $0x0, 0x18(%rdi)
je 0x36e53
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3702e
cmpq $0x0, 0x20(%rbx)
je 0x36e68
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x80(%rax)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x36e7d
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x98(%rax)
movq 0xb8(%rbx), %rdi
popq %rbx
jmp 0x13600
movq %rax, %rdi
callq 0x177bf
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::operator=(gaps::R3SurfelScan const&)
R3SurfelScan& R3SurfelScan::
operator=(const R3SurfelScan& scan)
{
  // Copy properties
  this->pose = scan.pose;
  this->timestamp = scan.timestamp;
  this->image_width = scan.image_width; 
  this->image_height = scan.image_height;
  this->image_center = scan.image_center;
  this->xfocal = scan.xfocal;
  this->yfocal = scan.yfocal;
  this->name = (scan.name) ? RNStrdup(scan.name) : NULL;
  this->flags = 0;

  // Return this
  return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x28, %rsi
addq $0x28, %rdi
callq 0x28a32
movsd 0x88(%r14), %xmm0
movsd %xmm0, 0x88(%rbx)
movq 0x90(%r14), %rax
movq %rax, 0x90(%rbx)
movl $0x98, %edi
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0x93b68
movups 0xa8(%r14), %xmm0
movups %xmm0, 0xa8(%rbx)
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x36f27
callq 0x9cc91
jmp 0x36f29
xorl %eax, %eax
movq %rax, 0xb8(%rbx)
andq $0x0, 0xc0(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::SetName(char const*)
void R3SurfelScan::
SetName(const char *name)
{
  // Delete previous name
  if (this->name) free(this->name);
  this->name = (name) ? RNStrdup(name) : NULL;

  // Mark scene as dirty
  if (Scene()) Scene()->SetDirty();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0xb8(%rdi), %rdi
callq 0x13600
testq %r14, %r14
je 0x36fd9
movq %r14, %rdi
callq 0x9cc91
jmp 0x36fdb
xorl %eax, %eax
movq %rax, 0xb8(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x36ff2
orb $0x1, 0x1e8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelScan::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print scan
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%d %s %d %d",
          SceneIndex(), (Name()) ? Name() : "-",
          (Node()) ? node->TreeIndex() : -1,
          (Image()) ? image->SceneIndex() : -1);
  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 0x370af
movq 0xeced4(%rip), %rax     # 0x123f80
movq (%rax), %rbx
testq %rdx, %rdx
je 0x370bf
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x135d0
movq 0xb8(%r15), %rax
testq %rax, %rax
leaq 0x91276(%rip), %rcx     # 0xc8346
cmovneq %rax, %rcx
movq 0x18(%r15), %rax
pushq $-0x1
popq %r9
movl %r9d, %r8d
testq %rax, %rax
je 0x370e8
movl 0x20(%rax), %r8d
movl 0x10(%r15), %edx
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x370f9
movl 0x10(%rax), %r9d
leaq 0x925b2(%rip), %rsi     # 0xc96b2
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13780
testq %r14, %r14
je 0x3711a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135d0
pushq $0xa
popq %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x13690
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::ImagePosition(gaps::R3Point const&) const
R2Point R3SurfelScan::
ImagePosition(const R3Point& world_position) const
{
  // Transform 3D point into canonical coordinate system
  R3Point p = Pose().InverseMatrix() * world_position;
  if (RNIsPositiveOrZero(p.Z())) return R2infinite_point;

  // Compute 2D point projected onto viewport
  const R2Point c = ImageCenter();
  RNCoord x = c.X() + xfocal * p.X() / -p.Z();
  RNCoord y = c.Y() + yfocal * p.Y() / -p.Z();

  // Return point projected onto viewport
  return R2Point(x, y);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
addq $0x28, %rsi
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x66f9c
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6a31b
movsd 0x10(%r13), %xmm0
leaq 0xedaa0(%rip), %rax     # 0x124c28
movsd (%rax), %xmm1
xorpd 0x9120c(%rip), %xmm1    # 0xc83a0
ucomisd %xmm1, %xmm0
jae 0x371f7
leaq 0x98(%r14), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x93a3a
movsd 0xa8(%r14), %xmm1
movsd 0xb0(%r14), %xmm2
mulsd 0x8(%rsp), %xmm1
movsd 0x18(%rsp), %xmm3
divsd %xmm3, %xmm1
movsd (%r15), %xmm0
subsd %xmm1, %xmm0
movsd 0x8(%r15), %xmm1
mulsd 0x10(%rsp), %xmm2
divsd %xmm3, %xmm2
subsd %xmm2, %xmm1
movq %rbx, %rdi
callq 0x93a30
jmp 0x37206
leaq 0x4f0192(%rip), %rsi    # 0x527390
movq %rbx, %rdi
callq 0x93a3a
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::R3SurfelImage(char const*)
R3SurfelImage::
R3SurfelImage(const char *name)
  : scene(NULL),
    scene_index(-1),
    scan(NULL),
    channels(),
    pose(R3Point(0,0,0), R3Triad(R3Vector(0,0,0), R3Vector(0,0,0))),
    timestamp(0),
    image_width(0), 
    image_height(0),
    image_center(0,0),
    xfocal(0),
    yfocal(0),
    distortion_type(R3_SURFEL_NO_DISTORTION),
    name((name) ? RNStrdup(name) : NULL),
    flags(0),
    data(NULL)
{
  // Intialize distortion parameters
  radial_distortion[0] = 0;
  radial_distortion[1] = 0;
  radial_distortion[2] = 0;
  tangential_distortion[0] = 0;
  tangential_distortion[1] = 0;

  // Initialize rolling shutter pose parameters
  rolling_shutter_poses[0] = pose;
  rolling_shutter_poses[1] = pose;
  rolling_shutter_timestamps[0] = timestamp;
  rolling_shutter_timestamps[1] = timestamp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r14
leaq 0xe8a39(%rip), %rax     # 0x11fc70
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rsi, %r15
orl $-0x1, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x9a7ae
leaq 0x38(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x781bc
leaq 0x20(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x7897c
leaq 0x8(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x7897c
leaq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x67374
leaq 0x30(%r14), %r12
leaq 0x38(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r12, %rdi
callq 0x66f12
leaq 0xa0(%r14), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%r14)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x93a30
leaq 0xf0(%r14), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0xb0(%r14)
andl $0x0, 0xc0(%r14)
movq %r13, %rdi
callq 0x66ed2
leaq 0x150(%r14), %rbp
movq %rbp, %rdi
callq 0x66ed2
testq %r15, %r15
je 0x37317
movq %r15, %rdi
callq 0x9cc91
jmp 0x37319
xorl %eax, %eax
movq %rax, 0x1c0(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0xc8(%r14)
movups %xmm0, 0xd8(%r14)
andq $0x0, 0xe8(%r14)
movups %xmm0, 0x1c8(%r14)
movq %r13, %rdi
movq %r12, %rsi
callq 0x28a32
movq %rbp, %rdi
movq %r12, %rsi
callq 0x28a32
movsd 0x90(%r14), %xmm0
movsd %xmm0, 0x1b0(%r14)
movsd %xmm0, 0x1b8(%r14)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3738e
jmp 0x3738e
jmp 0x3738e
jmp 0x3738e
movq %rax, %r14
movq %rbx, %rdi
callq 0x9a81c
movq %r14, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::~R3SurfelImage()
R3SurfelImage::
~R3SurfelImage(void)
{
  // Remove image from scan
  if (scan) SetScan(NULL);
  
  // Remove image from scene
  if (scene) scene->RemoveImage(this);

  // Delete all channels
  for (int i = 0; i < channels.NEntries(); i++) {
    R2Grid *channel = channels.Kth(i);
    if (channel) delete channel;
  }
  
  // Delete name
  if (name) free(name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xe86d2(%rip), %rax     # 0x11fc70
movq %rax, (%rdi)
cmpq $0x0, 0x18(%rdi)
je 0x375b2
movq %rbx, %rdi
xorl %esi, %esi
callq 0x37f56
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x375c7
movq (%rdi), %rax
movq %rbx, %rsi
callq *0xa8(%rax)
leaq 0x20(%rbx), %r14
xorl %r12d, %r12d
movslq 0x2c(%rbx), %rax
cmpq %rax, %r12
jge 0x375fd
movq (%r14), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x375f8
movq %r15, %rdi
callq 0x846a8
movl $0xd0, %esi
movq %r15, %rdi
callq 0x13500
incq %r12
jmp 0x375ce
movq 0x1c0(%rbx), %rdi
callq 0x13600
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x9a81c
movq %rax, %rdi
callq 0x177bf
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::ColorChannels() const
R2Image R3SurfelImage::
ColorChannels(void) const
{
  // Allocate color image for result
  R2Image color_image;

  // Get RGB channels
  const R2Grid *red_channel = RedChannel();
  const R2Grid *green_channel = GreenChannel();
  const R2Grid *blue_channel = BlueChannel();
  if (red_channel && green_channel && blue_channel) {
    // Fill in RGB for each pixel
    color_image = R2Image(ImageWidth(), ImageHeight(), 3);
    for (int iy = 0; iy < ImageHeight(); iy++) {
      for (int ix = 0; ix < ImageWidth(); ix++) {
        RNScalar red = red_channel->GridValue(ix, iy);
        RNScalar green = green_channel->GridValue(ix, iy);
        RNScalar blue = blue_channel->GridValue(ix, iy);
        RNRgb color(red, green, blue);
        color_image.SetPixelRGB(ix, iy, color);
      }
    }
  }

  // Return color image
  return color_image;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
callq 0x942b8
movq %rbx, %rdx
movl 0x2c(%rbx), %eax
testl %eax, %eax
jle 0x37671
movq 0x20(%rdx), %rcx
movq (%rcx), %rsi
cmpl $0x1, %eax
jne 0x37677
xorl %ebx, %ebx
jmp 0x37686
xorl %ebx, %ebx
xorl %esi, %esi
jmp 0x37686
movq 0x8(%rcx), %rbx
cmpl $0x3, %eax
jb 0x37686
movq 0x10(%rcx), %r14
jmp 0x37689
xorl %r14d, %r14d
testq %rsi, %rsi
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
testq %r14, %r14
sete %al
orb %cl, %al
jne 0x37790
movq %rsi, 0x10(%rsp)
movl 0x98(%rdx), %esi
movq %rdx, 0x18(%rsp)
movl 0x9c(%rdx), %edx
leaq 0x20(%rsp), %rdi
pushq $0x3
popq %rcx
callq 0x945c2
leaq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x948a2
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x94804
xorl %r12d, %r12d
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
cmpl 0x9c(%rax), %r12d
jge 0x37790
movslq %r12d, %r15
xorl %r13d, %r13d
cmpl 0x98(%rax), %r13d
jge 0x37788
movq 0xb8(%rcx), %rax
movslq 0xc8(%rcx), %rcx
imulq %r15, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0xb8(%rbx), %rax
movslq 0xc8(%rbx), %rcx
imulq %r15, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0xb8(%r14), %rax
movslq 0xc8(%r14), %rcx
imulq %r15, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm2
movq %rbp, %rdi
callq 0x9a626
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x94950
incq %r13
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
jmp 0x37704
incl %r12d
jmp 0x376f1
movq 0x8(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x94804
jmp 0x377b8
jmp 0x377b5
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0x94804
movq %r14, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::ProjectionMatrix(double, double) const
R4Matrix R3SurfelImage::
ProjectionMatrix(RNScalar neardist, RNScalar fardist) const
{
  // Return projection transformation from camera coordinates to normalized image coordinates
  RNScalar fx = XFocal();
  RNScalar fy = YFocal();
  RNScalar cx = ImageCenter().X();
  RNScalar cy = ImageCenter().Y();
  RNScalar W = ImageWidth();
  RNScalar H = ImageHeight();
  return R4Matrix(
    2*fx/W, 0, -2*(cx/W)+1, 0,
    0, 2*fy/H, -2*(cy/H)+1, 0,
    0, 0, -(fardist + neardist) / (fardist - neardist),  -2.0 * neardist * fardist / (fardist - neardist),
    0, 0, -1, 0 );
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movapd %xmm0, %xmm3
movq %rdi, %rbx
movsd 0xb0(%rsi), %xmm0
movsd 0xb8(%rsi), %xmm5
movsd 0xa0(%rsi), %xmm4
cvtsi2sdl 0x98(%rsi), %xmm2
cvtsi2sdl 0x9c(%rsi), %xmm7
movsd 0xa8(%rsi), %xmm8
addsd %xmm0, %xmm0
divsd %xmm2, %xmm0
divsd %xmm2, %xmm4
addsd %xmm4, %xmm4
movsd 0x90929(%rip), %xmm6    # 0xc8148
movapd %xmm6, %xmm2
subsd %xmm4, %xmm2
addsd %xmm5, %xmm5
divsd %xmm7, %xmm5
divsd %xmm7, %xmm8
addsd %xmm8, %xmm8
movapd %xmm3, %xmm4
addsd %xmm1, %xmm4
xorpd 0x90b57(%rip), %xmm4    # 0xc83a0
subsd %xmm8, %xmm6
movapd %xmm1, %xmm7
subsd %xmm3, %xmm7
divsd %xmm7, %xmm4
mulsd 0x912ae(%rip), %xmm3    # 0xc8b10
mulsd %xmm1, %xmm3
divsd %xmm7, %xmm3
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x30(%rsp)
xorpd %xmm1, %xmm1
movupd %xmm1, 0x20(%rsp)
movsd %xmm3, 0x18(%rsp)
movupd %xmm1, (%rsp)
movsd %xmm4, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
xorpd %xmm1, %xmm1
xorpd %xmm3, %xmm3
xorpd %xmm4, %xmm4
xorpd %xmm7, %xmm7
callq 0x6882c
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::PixelWorldRay(gaps::R2Point const&) const
R3Ray R3SurfelImage::
PixelWorldRay(const R2Point& image_position) const
{
  // Get/check intrinsics matrix
  if (RNIsZero(xfocal)) return R3null_ray;
  if (RNIsZero(yfocal)) return R3null_ray;

  // Get point at depth 1.0 along ray in camera coordinates
  R3Point camera_position;
  camera_position[0] = (image_position[0] - image_center.X()) / xfocal;
  camera_position[1] = (image_position[1] - image_center.Y()) / yfocal;
  camera_position[2] = -1.0;

  // Create ray and transform into world coordinates
  R3Ray ray(R3zero_point, camera_position);
  ray.Transform(R3Affine(CameraToWorld(), 0));

  // Return ray through pixel in world coordinates
  return ray;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movsd 0xb0(%rsi), %xmm2
leaq 0xed34a(%rip), %rax     # 0x124c28
movsd (%rax), %xmm0
movapd 0x90ab6(%rip), %xmm1    # 0xc83a0
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x378fa
ucomisd %xmm2, %xmm0
jae 0x3790f
movsd 0xb8(%r14), %xmm2
ucomisd %xmm1, %xmm2
jb 0x37923
ucomisd %xmm2, %xmm0
jb 0x37923
leaq 0x4eeada(%rip), %rsi    # 0x5263f0
movq %rbx, %rdi
callq 0x77dc8
jmp 0x379b2
movq %rsp, %r12
movq %r12, %rdi
callq 0x781ba
movupd (%r15), %xmm0
movupd 0xa0(%r14), %xmm1
subpd %xmm1, %xmm0
movupd 0xb0(%r14), %xmm1
divpd %xmm1, %xmm0
movapd %xmm0, (%r12)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x10(%r12)
leaq 0x4eed27(%rip), %rsi    # 0x526690
movq %rbx, %rdi
movq %r12, %rdx
callq 0x77dd4
addq $0x30, %r14
leaq 0x128(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x66f38
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6681c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x77e82
leaq 0x18(%rsp), %rdi
callq 0x6686a
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6686a
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TrajectoryDirection() const
R3Vector R3SurfelImage::
TrajectoryDirection(void) const
{
  // Check scene
  if (!scene) return R3zero_vector;
  if (scene_index < 0) return R3zero_vector;
  
  // Find images before/after this image
  int delta = 7;
  int index = scene_index;
  int indexA = index - delta;
  int indexB = index + delta;
  if (indexA < 0) indexA = 0;
  if (indexB > scene->NImages()-1) indexB = scene->NImages()-1;
  R3SurfelImage *imageA = scene->Image(indexA);
  R3SurfelImage *imageB = scene->Image(indexB);

  // Compute trajector direction
  R3Point viewpointA = imageA->Viewpoint();
  R3Point viewpointB = imageB->Viewpoint();
  R3Vector trajectory_direction = viewpointB - viewpointA;
  trajectory_direction.Normalize();

  // Return trajectory direction
  return trajectory_direction;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x37a62
movl 0x10(%rsi), %ecx
testl %ecx, %ecx
js 0x37a62
leal 0x7(%rcx), %edx
cmpl $0x8, %ecx
pushq $0x7
popq %rsi
cmovael %ecx, %esi
movl 0x9c(%rax), %ecx
leal -0x1(%rcx), %edi
cmpl %ecx, %edx
cmovll %edx, %edi
movq 0x90(%rax), %rax
movq -0x38(%rax,%rsi,8), %rsi
movslq %edi, %rcx
movq (%rax,%rcx,8), %r14
addq $0x30, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x781cc
addq $0x30, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x781cc
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x78399
movq %rbx, %rdi
callq 0x78c7e
jmp 0x37a71
leaq 0x986ef(%rip), %rsi     # 0xd0158
movq %rbx, %rdi
callq 0x7898c
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::operator=(gaps::R3SurfelImage const&)
R3SurfelImage& R3SurfelImage::
operator=(const R3SurfelImage& image)
{
  // Copy properties
  this->pose = image.pose;
  this->timestamp = image.timestamp;
  this->image_width = image.image_width; 
  this->image_height = image.image_height;
  this->image_center = image.image_center;
  this->xfocal = image.xfocal;
  this->yfocal = image.yfocal;
  this->distortion_type = image.distortion_type;
  this->radial_distortion[0] = image.radial_distortion[0];
  this->radial_distortion[1] = image.radial_distortion[1];
  this->radial_distortion[2] = image.radial_distortion[2];
  this->tangential_distortion[0] = image.tangential_distortion[0];
  this->tangential_distortion[1] = image.tangential_distortion[1];
  this->rolling_shutter_poses[0] = image.rolling_shutter_poses[0];
  this->rolling_shutter_poses[1] = image.rolling_shutter_poses[1];
  this->rolling_shutter_timestamps[0] = image.rolling_shutter_timestamps[0];
  this->rolling_shutter_timestamps[1] = image.rolling_shutter_timestamps[1];
  this->name = (image.name) ? RNStrdup(image.name) : NULL;
  this->flags = 0;

  // Copy all channels
  for (int i = 0; i < image.channels.NEntries(); i++) {
    R2Grid *channel = image.channels.Kth(i);
    if (channel) this->channels.Insert(new R2Grid(*channel));
    else this->channels.Insert(NULL);
  }

  // Return this
  return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x30, %rsi
addq $0x30, %rdi
callq 0x28a32
movsd 0x90(%r14), %xmm0
movsd %xmm0, 0x90(%rbx)
movq 0x98(%r14), %rax
movq %rax, 0x98(%rbx)
movl $0xa0, %edi
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0x93b68
movups 0xb0(%r14), %xmm0
movups %xmm0, 0xb0(%rbx)
movl 0xc0(%r14), %eax
movl %eax, 0xc0(%rbx)
movsd 0xc8(%r14), %xmm0
movsd %xmm0, 0xc8(%rbx)
movsd 0xd0(%r14), %xmm0
movsd %xmm0, 0xd0(%rbx)
movsd 0xd8(%r14), %xmm0
movsd %xmm0, 0xd8(%rbx)
movsd 0xe0(%r14), %xmm0
movsd %xmm0, 0xe0(%rbx)
movsd 0xe8(%r14), %xmm0
movsd %xmm0, 0xe8(%rbx)
movl $0xf0, %edi
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0x28a32
movl $0x150, %edi            # imm = 0x150
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0x28a32
movsd 0x1b0(%r14), %xmm0
movsd %xmm0, 0x1b0(%rbx)
movsd 0x1b8(%r14), %xmm0
movsd %xmm0, 0x1b8(%rbx)
movq 0x1c0(%r14), %rdi
testq %rdi, %rdi
je 0x37b96
callq 0x9cc91
jmp 0x37b98
xorl %eax, %eax
movq %rax, 0x1c0(%rbx)
andq $0x0, 0x1c8(%rbx)
leaq 0x20(%rbx), %r15
xorl %ebp, %ebp
movslq 0x2c(%r14), %rax
cmpq %rax, %rbp
jge 0x37bf2
movq 0x20(%r14), %rax
movq (%rax,%rbp,8), %r13
testq %r13, %r13
je 0x37be3
movl $0xd0, %edi
callq 0x134f0
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x844f0
movq %r15, %rdi
movq %r12, %rsi
jmp 0x37be8
movq %r15, %rdi
xorl %esi, %esi
callq 0x1784c
incq %rbp
jmp 0x37bad
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xd0, %esi
movq %r12, %rdi
callq 0x13500
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetChannel(int, gaps::R2Grid const&)
void R3SurfelImage::
SetChannel(int channel_index, const R2Grid& channel)
{
  // Check channel index
  assert(channel_index >= 0);

  // Insert channels up to channel index
  for (int i = channels.NEntries(); i <= channel_index; i++) {
    channels.Insert(NULL);
  }

  // Delete previous channel
  if (channels[channel_index]) delete channels[channel_index];

  // Update image width and height
  if (image_width <= 0) image_width = channel.XResolution();
  if (image_height <= 0) image_height = channel.YResolution();
  
  // Copy image into channel
  channels[channel_index] = new R2Grid(channel);

  // Resample if necessary
  if ((image_width != channel.XResolution()) || (image_height != channel.YResolution())) {
    channels[channel_index]->Resample(image_width, image_height, TRUE);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
leaq 0x20(%rdi), %rbx
movl 0x2c(%rdi), %r12d
cmpl %ebp, %r12d
jg 0x37c4b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1784c
incl %r12d
jmp 0x37c37
movq (%rbx), %rax
movslq %ebp, %r13
movq (%rax,%r13,8), %r12
testq %r12, %r12
je 0x37c6f
movq %r12, %rdi
callq 0x846a8
movl $0xd0, %esi
movq %r12, %rdi
callq 0x13500
cmpl $0x0, 0x98(%r15)
jg 0x37c87
movl 0xc0(%r14), %eax
movl %eax, 0x98(%r15)
cmpl $0x0, 0x9c(%r15)
jg 0x37c9f
movl 0xc4(%r14), %eax
movl %eax, 0x9c(%r15)
movl $0xd0, %edi
callq 0x134f0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x844f0
movq 0x20(%r15), %rax
movq %r12, (%rax,%r13,8)
movl 0x98(%r15), %esi
movl 0x9c(%r15), %edx
cmpl 0xc0(%r14), %esi
jne 0x37cee
cmpl 0xc4(%r14), %edx
jne 0x37cee
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq (%rax,%r13,8), %rdi
pushq $0x1
popq %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x88c46
movq %rax, %rbx
movl $0xd0, %esi
movq %r12, %rdi
callq 0x13500
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetColorChannels(gaps::R2Image const&)
void R3SurfelImage::
SetColorChannels(const R2Image& color_image)
{
  // Initialize channels
  R2Grid red_channel(color_image.Width(), color_image.Height());
  R2Grid green_channel(color_image.Width(), color_image.Height());
  R2Grid blue_channel(color_image.Width(), color_image.Height());

  // Fill channels
  for (int iy = 0; iy < color_image.Height(); iy++) {
    for (int ix = 0; ix < color_image.Width(); ix++) {
      RNRgb rgb = color_image.PixelRGB(ix, iy);
      red_channel.SetGridValue(ix, iy, rgb.R());
      green_channel.SetGridValue(ix, iy, rgb.G());
      blue_channel.SetGridValue(ix, iy, rgb.B());
    }
  }

  // Set channels
  SetRedChannel(red_channel);
  SetGreenChannel(green_channel);
  SetBlueChannel(blue_channel);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %esi
movl 0x4(%r14), %edx
leaq 0x1b8(%rsp), %rdi
callq 0x83b64
movl (%r14), %esi
movl 0x4(%r14), %edx
leaq 0xe8(%rsp), %rdi
callq 0x83b64
movl (%r14), %esi
movl 0x4(%r14), %edx
leaq 0x18(%rsp), %rdi
callq 0x83b64
xorl %r15d, %r15d
movq %rsp, %r12
cmpl 0x4(%r14), %r15d
jge 0x37e6f
movslq %r15d, %rbp
xorl %r13d, %r13d
cmpl (%r14), %r13d
jge 0x37e67
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl %r15d, %ecx
callq 0x94812
movsd (%rsp), %xmm0
movq 0x270(%rsp), %rax
movslq 0x280(%rsp), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x8(%rsp), %xmm0
movq 0x1a0(%rsp), %rax
movslq 0x1b0(%rsp), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x10(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movslq 0xe0(%rsp), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
incq %r13
jmp 0x37de7
incl %r15d
jmp 0x37dd7
movq (%rbx), %rax
leaq 0x1b8(%rsp), %rsi
movq %rbx, %rdi
callq *0x18(%rax)
movq (%rbx), %rax
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq *0x20(%rax)
movq (%rbx), %rax
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq *0x28(%rax)
leaq 0x18(%rsp), %rdi
callq 0x846a8
leaq 0xe8(%rsp), %rdi
callq 0x846a8
leaq 0x1b8(%rsp), %rdi
callq 0x846a8
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x37eee
movq %rax, %rbx
jmp 0x37efb
jmp 0x37ee1
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x846a8
leaq 0xe8(%rsp), %rdi
callq 0x846a8
leaq 0x1b8(%rsp), %rdi
callq 0x846a8
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::RemoveChannel(int)
void R3SurfelImage::
RemoveChannel(int channel_index)
{
  // Check channel index
  if (channel_index < 0) return;
  if (channel_index >= channels.NEntries()) return;
  if (!channels[channel_index]) return;

  // Remove channel
  delete channels[channel_index];
  channels[channel_index] = NULL;
}

// Assembly:
testl %esi, %esi
js 0x37f54
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl %esi, 0x2c(%rdi)
jle 0x37f4f
movq 0x20(%rbx), %rax
movl %esi, %r15d
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x37f4f
movq %r14, %rdi
callq 0x846a8
movl $0xd0, %esi
movq %r14, %rdi
callq 0x13500
movq 0x20(%rbx), %rax
andq $0x0, (%rax,%r15,8)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetPose(gaps::R3CoordSystem const&)
void R3SurfelImage::
SetPose(const R3CoordSystem& pose) 
{
  // Set pose
  this->pose = pose;

  // Update rollling shutter poses
  this->rolling_shutter_poses[0] = this->pose;
  this->rolling_shutter_poses[1] = this->pose;
  flags.Remove(R3_SURFEL_IMAGE_HAS_ROLLING_SHUTTER);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x28a32
leaq 0xf0(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
leaq 0x150(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
andb $-0x2, 0x1c8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetViewpoint(gaps::R3Point const&)
void R3SurfelImage::
SetViewpoint(const R3Point& viewpoint) 
{
  // Set viewpoint
  this->pose.SetOrigin(viewpoint);

  // Update rollling shutter poses
  this->rolling_shutter_poses[0] = this->pose;
  this->rolling_shutter_poses[1] = this->pose;
  flags.Remove(R3_SURFEL_IMAGE_HAS_ROLLING_SHUTTER);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x66fea
leaq 0xf0(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
leaq 0x150(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
andb $-0x2, 0x1c8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetOrientation(gaps::R3Vector const&, gaps::R3Vector const&)
void R3SurfelImage::
SetOrientation(const R3Vector& towards, const R3Vector& up) 
{
  // Set orientation
  this->pose.SetAxes(R3Triad(towards, up));

  // Update rollling shutter poses
  this->rolling_shutter_poses[0] = this->pose;
  this->rolling_shutter_poses[1] = this->pose;
  flags.Remove(R3_SURFEL_IMAGE_HAS_ROLLING_SHUTTER);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x67374
movq %r14, %rdi
movq %r15, %rsi
callq 0x66ff0
leaq 0xf0(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
leaq 0x150(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
andb $-0x2, 0x1c8(%rbx)
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetRollingShutterPoses(gaps::R3CoordSystem const&, gaps::R3CoordSystem const&)
void R3SurfelImage::
SetRollingShutterPoses(const R3CoordSystem& pose0, const R3CoordSystem& pose1) 
{
  // Check if poses are different
  if (pose0 == pose1) {
    SetPose(pose0);
  }
  else {    
    // Set rollling shutter poses
    this->rolling_shutter_poses[0] = pose0;
    this->rolling_shutter_poses[1] = pose1;

    // Update center pose
    this->pose = R3CoordSystemSlerp(pose0, pose1, 0.5);

    // Update flags
    flags.Add(R3_SURFEL_IMAGE_HAS_ROLLING_SHUTTER);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x39458
testl %eax, %eax
je 0x38187
movq (%rbx), %rax
movq 0x58(%rax), %rax
movq %rbx, %rdi
movq %r14, %rsi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
leaq 0xf0(%rbx), %rdi
movq %r14, %rsi
callq 0x28a32
leaq 0x150(%rbx), %rdi
movq %r15, %rsi
callq 0x28a32
leaq 0x8(%rsp), %r12
movsd 0x8ff86(%rip), %xmm0    # 0xc8138
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x670f5
leaq 0x30(%rbx), %rdi
movq %r12, %rsi
callq 0x28a32
orb $0x1, 0x1c8(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TransformFromWorldToCamera(gaps::R3Point const&) const
R3Point R3SurfelImage::
TransformFromWorldToCamera(const R3Point& world_position) const
{
  // Initialize result
  R3Point camera_position = pose.InverseMatrix() * world_position;

  // Check if has rolling shutter
  if (HasRollingShutter()) {
    // Search for x coordinate (there is a different camera pose for every column)
    int column_index = ImageWidth() / 2;
    int last_column_index = column_index;
    for (int i = 0; i < ImageWidth()/2; i++) {
      // Transform world point into column's camera coordinate system
      R3CoordSystem cs = RollingShutterPoseAtImagePosition(R2Point(column_index, 0));
      R3Point camera_p = cs.InverseMatrix() * world_position;
      if (RNIsPositiveOrZero(camera_p.Z())) return camera_position;
      camera_position = camera_p;
      
      // Get/check column index
      R2Point distorted_position = TransformFromCameraToImage(camera_position);
      column_index = (int) (distorted_position.X() + 0.5);
      if (column_index < 0) column_index = 0;
      if (column_index >= ImageWidth()-1) column_index = ImageWidth()-1;
      if (column_index == last_column_index) break;
      last_column_index = column_index;
    }
  }

  // Return camera position
  return camera_position;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
addq $0x30, %rsi
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x66f9c
movq %rbx, (%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, 0x8(%rsp)
movq %r14, %rdx
callq 0x6a31b
testb $0x1, 0x1c8(%r15)
je 0x383ac
movl 0x98(%r15), %ecx
pushq $0x2
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, %ebp
pushq $-0x1
popq %r13
leaq 0x28(%rsp), %r12
leaq 0x10(%rsp), %r14
movl %ecx, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
incl %r13d
cmpl %eax, %r13d
jge 0x383ac
cvtsi2sd %ebp, %xmm0
xorps %xmm1, %xmm1
movq %r12, %rdi
callq 0x93a30
movq %r14, %rbx
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x383c2
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %r14
callq 0x66f9c
movq %rbx, %rdi
movq %r12, %rsi
movq 0x8(%rsp), %rdx
callq 0x6a31b
movsd 0x20(%rsp), %xmm0
leaq 0xec8e0(%rip), %rax     # 0x124c28
movsd (%rax), %xmm1
xorpd 0x9004c(%rip), %xmm1    # 0xc83a0
ucomisd %xmm1, %xmm0
jae 0x383ac
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x784a6
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3843e
movsd 0x28(%rsp), %xmm0
addsd 0x8fdb3(%rip), %xmm0    # 0xc8138
cvttsd2si %xmm0, %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
movl 0x98(%r15), %ecx
leal -0x1(%rcx), %edx
cmpl %edx, %eax
cmovgel %edx, %eax
cmpl %ebp, %eax
movl %eax, %ebp
jne 0x382e1
movq (%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::RollingShutterPoseAtImagePosition(gaps::R2Point const&) const
R3CoordSystem R3SurfelImage::
RollingShutterPoseAtImagePosition(const R2Point& image_position) const
{
  // Check rolling shutter parameters
  if (!HasRollingShutter()) return pose;
  if (image_width <= 1) return rolling_shutter_poses[0];

  // Get interpolation parameter
  double u = (double) image_position.X() / (double) (image_width-1);
  if (u <= 0) return rolling_shutter_poses[0];
  if (u >= 1) return rolling_shutter_poses[1];

  // Return slerped pose
  return R3CoordSystemSlerp(rolling_shutter_poses[0], rolling_shutter_poses[1], u);
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
testb $0x1, 0x1c8(%rsi)
jne 0x383d8
addq $0x30, %rax
jmp 0x38425
movl 0x98(%rax), %ecx
cmpl $0x1, %ecx
jle 0x3841f
movsd (%rdx), %xmm0
decl %ecx
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jae 0x3841f
ucomisd 0x8fd45(%rip), %xmm0    # 0xc8148
jae 0x38435
leaq 0xf0(%rax), %rsi
addq $0x150, %rax            # imm = 0x150
movq %rbx, %rdi
movq %rax, %rdx
callq 0x670f5
jmp 0x38430
addq $0xf0, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x66ee8
movq %rbx, %rax
popq %rbx
retq
addq $0x150, %rax            # imm = 0x150
jmp 0x38425
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TransformFromCameraToImage(gaps::R3Point const&) const
R2Point R3SurfelImage::
TransformFromCameraToImage(const R3Point& camera_position) const
{
  // Project 3D point in camera coordinates into pixels
  const R2Point c = ImageCenter();
  RNCoord x = c.X() + xfocal * camera_position.X() / -camera_position.Z();
  RNCoord y = c.Y() + yfocal * camera_position.Y() / -camera_position.Z();
  R2Point undistorted_image_position(x, y);
  
  // Distort image position
  return DistortImagePosition(undistorted_image_position);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
addq $0xa0, %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x93a3a
movsd 0xb0(%r14), %xmm1
movsd 0xb8(%r14), %xmm2
mulsd (%r15), %xmm1
movsd 0x10(%r15), %xmm3
divsd %xmm3, %xmm1
movsd (%r12), %xmm0
subsd %xmm1, %xmm0
movsd 0x8(%r12), %xmm1
mulsd 0x8(%r15), %xmm2
divsd %xmm3, %xmm2
subsd %xmm2, %xmm1
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x93a30
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3853a
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TransformFromWorldToImage(gaps::R3Point const&) const
R2Point R3SurfelImage::
TransformFromWorldToImage(const R3Point& world_position) const
{
  // Transform into camera coordinates
  R3Point camera_position = TransformFromWorldToCamera(world_position);
  if (RNIsPositiveOrZero(camera_position.Z())) return R2unknown_point;

  // Transform into image coordinates
  return TransformFromCameraToImage(camera_position);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x38272
movsd 0x10(%r15), %xmm0
leaq 0xec72f(%rip), %rax     # 0x124c28
movsd (%rax), %xmm1
xorpd 0x8fe9b(%rip), %xmm1    # 0xc83a0
ucomisd %xmm1, %xmm0
jae 0x3851d
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3843e
jmp 0x3852c
leaq 0x4eee7c(%rip), %rsi    # 0x5273a0
movq %rbx, %rdi
callq 0x93a3a
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TransformFromCameraToWorld(gaps::R3Point const&) const
R3Point R3SurfelImage::
TransformFromCameraToWorld(const R3Point& camera_position) const
{
  // Check if rolling shutter
  if (HasRollingShutter()) {
    // Get projected image position
    R2Point image_position = TransformFromCameraToImage(camera_position);

    // Get rolling shutter pose
    R3CoordSystem rs_pose = RollingShutterPoseAtImagePosition(image_position);

    // Transform 3D point from camera into world coordinate system
    return rs_pose.Matrix() * camera_position;
  }
  else {
    // Transform 3D point from camera into world coordinate system
    return CameraToWorld() * camera_position;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf0, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
testb $0x1, 0x1c8(%rsi)
jne 0x3880c
addq $0x30, %r15
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x66f38
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x38849
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3843e
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x383c2
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x66f38
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6a31b
movq %rbx, %rax
addq $0xf0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TransformFromImageToWorld(gaps::R2Point const&, double) const
R3Point R3SurfelImage::
TransformFromImageToWorld(const R2Point& image_position, RNLength depth) const
{
  // Transform from image to camera coordinates
  R3Point camera_position = TransformFromImageToCamera(image_position, depth);

  // Transform from camera to world coordinates
  if (HasRollingShutter()) {
    // Get rolling shutter pose
    R3CoordSystem rs_pose = RollingShutterPoseAtImagePosition(image_position);

    // Return position in world coordinates
    return rs_pose.Matrix() * camera_position;
  }
  else {
    // Return position in world coordinates
    return TransformFromCameraToWorld(camera_position);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x388e2
testb $0x1, 0x1c8(%r14)
jne 0x3889f
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x387ce
jmp 0x388d0
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x383c2
leaq 0x78(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x66f38
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6a31b
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TransformFromImageToCamera(gaps::R2Point const&, double) const
R3Point R3SurfelImage::
TransformFromImageToCamera(const R2Point& image_position, RNLength depth) const
{
  // Check camera parameters
  if ((xfocal <= 0) || (yfocal <= 0)) return R3unknown_point;

  // Undistort image position
  R2Point undistorted_image_position = UndistortImagePosition(image_position);
  if (undistorted_image_position == R2unknown_point) return R3unknown_point;

  // Get depth
  if (depth < 0) {
    if (channels.NEntries() <= R3_SURFEL_DEPTH_CHANNEL) return R3unknown_point;
    if (!channels[R3_SURFEL_DEPTH_CHANNEL]) return R3unknown_point;
    int ix = image_position.X() + 0.5;
    int iy = image_position.Y() + 0.5;
    depth = channels[R3_SURFEL_DEPTH_CHANNEL]->GridValue(ix, iy);
  }

  // Backproject from pixels into camera coordinate system
  const R2Point c = ImageCenter();
  RNCoord x = (undistorted_image_position.X() - c.X()) * depth / xfocal;
  RNCoord y = (undistorted_image_position.Y() - c.Y()) * depth / yfocal;
  return R3Point(x, y, -depth);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
xorpd %xmm1, %xmm1
ucomisd 0xb0(%rsi), %xmm1
jae 0x38936
movq %rsi, %r14
ucomisd 0xb8(%rsi), %xmm1
jae 0x38936
movq %rdx, %r15
movapd %xmm0, (%rsp)
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x38a12
leaq 0x4eea76(%rip), %rsi    # 0x5273a0
movq %r12, %rdi
callq 0x93d00
testl %eax, %eax
je 0x38954
leaq 0x4ede43(%rip), %rsi    # 0x526780
movq %rbx, %rdi
callq 0x781cc
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorpd %xmm0, %xmm0
movapd (%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x389ae
cmpl $0x3, 0x2c(%r14)
jle 0x38936
movq 0x20(%r14), %rax
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x38936
movsd 0x8f7b9(%rip), %xmm0    # 0xc8138
movsd (%r15), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
addsd 0x8(%r15), %xmm0
cvttsd2si %xmm0, %edx
imull 0xc8(%rax), %edx
movq 0xb8(%rax), %rax
addl %ecx, %edx
movslq %edx, %rcx
movsd (%rax,%rcx,8), %xmm1
movapd %xmm1, (%rsp)
leaq 0xa0(%r14), %rsi
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x93a3a
movsd 0x18(%rsp), %xmm0
subsd (%r15), %xmm0
movapd (%rsp), %xmm2
mulsd %xmm2, %xmm0
divsd 0xb0(%r14), %xmm0
movsd 0x20(%rsp), %xmm1
subsd 0x8(%r15), %xmm1
mulsd %xmm2, %xmm1
divsd 0xb8(%r14), %xmm1
xorpd 0x8f99b(%rip), %xmm2    # 0xc83a0
movq %rbx, %rdi
callq 0x781bc
jmp 0x38945
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::UndistortImagePosition(gaps::R2Point const&) const
R2Point R3SurfelImage::
UndistortImagePosition(const R2Point& distorted_image_position) const
{
  // Check distortion type
  if (distortion_type == R3_SURFEL_NO_DISTORTION)
    return distorted_image_position;

  // Check distortion parameters
  if ((radial_distortion[0] == 0) && (radial_distortion[1] == 0) && (radial_distortion[2] == 0) &&
      (tangential_distortion[0] == 0) && (tangential_distortion[1] == 0))
    return distorted_image_position;

  // Check focal lengths
  if ((xfocal <= 0) || (yfocal <= 0))
    return distorted_image_position;
  
  // Not implemented yet
  RNWarning("R3SurfelImage::UndistortImagePosition not implemented");
  return distorted_image_position;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
cmpl $0x0, 0xc0(%rsi)
je 0x38a87
movupd 0xc8(%rsi), %xmm0
movupd 0xd8(%rsi), %xmm1
xorpd %xmm2, %xmm2
cmpneqpd %xmm2, %xmm1
cmpneqpd %xmm2, %xmm0
shufps $0x88, %xmm1, %xmm0     # xmm0 = xmm0[0,2],xmm1[0,2]
movmskps %xmm0, %eax
testl %eax, %eax
jne 0x38a62
movsd 0xe8(%rsi), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x38a62
jnp 0x38a87
xorps %xmm0, %xmm0
ucomisd 0xb0(%rsi), %xmm0
jae 0x38a87
ucomisd 0xb8(%rsi), %xmm0
jae 0x38a87
leaq 0x90c68(%rip), %rdi     # 0xc96e8
xorl %eax, %eax
callq 0x9cedf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x93a3a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop