LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::SetColorChannels(gaps::R2Image const&)
void RGBDSurface::
SetColorChannels(const R2Image& image)
{
  // Check if color channels are resident
  if (color_resident_count == 0) {
    RNFail("Unable to set color channels -- they have not been created\n");
    return;
  }

  // Copy color values
  for (int iy = 0; iy < image.Height(); iy++) {
    for (int ix = 0; ix < image.Width(); ix++) {
      RNRgb color = image.PixelRGB(ix, iy);
      channels[RGBD_RED_CHANNEL]->SetGridValue(ix, iy, color.R());      
      channels[RGBD_GREEN_CHANNEL]->SetGridValue(ix, iy, color.G());      
      channels[RGBD_BLUE_CHANNEL]->SetGridValue(ix, iy, color.B());
    }
  }

  // Set width and height
  this->width = image.Width();
  this->height = image.Height();

  // Invalidate opengl
  InvalidateOpenGL();
  
}

// Assembly:
cmpl $0x0, 0x70(%rdi)
je 0x1a551
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorl %r15d, %r15d
movq %rsp, %r12
movl 0x4(%r14), %eax
cmpl %eax, %r15d
jge 0x1a52d
movslq %r15d, %rbp
xorl %r13d, %r13d
cmpl (%r14), %r13d
jge 0x1a525
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl %r15d, %ecx
callq 0x67422
movq 0x18(%rbx), %rax
movq (%rax), %rcx
movsd (%rsp), %xmm0
movq 0xb8(%rcx), %rdx
movslq 0xc8(%rcx), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rdx,%rcx,8)
movq 0x8(%rax), %rcx
movsd 0x8(%rsp), %xmm0
movq 0xb8(%rcx), %rdx
movslq 0xc8(%rcx), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rdx,%rcx,8)
movq 0x10(%rax), %rax
movsd 0x10(%rsp), %xmm0
movq 0xb8(%rax), %rcx
movslq 0xc8(%rax), %rax
imulq %rbp, %rax
addq %r13, %rax
movsd %xmm0, (%rcx,%rax,8)
incq %r13
jmp 0x1a495
incl %r15d
jmp 0x1a482
movl (%r14), %ecx
movl %ecx, 0x28(%rbx)
movl %eax, 0x2c(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xd8(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e9a4(%rip), %rdi     # 0xa8efc
xorl %eax, %eax
jmp 0x6e732
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::SetWorldTexelSpacing(double)
void RGBDSurface::
SetWorldTexelSpacing(RNLength texel_spacing)
{
  // Compute new width and height
  if (texel_spacing > 0) {
    width = surface_bbox.XLength() / texel_spacing;
    height = surface_bbox.YLength() / texel_spacing;
  }
  
  // Resample channels
  for (int i = 0; i < NChannels(); i++) {
    R2Grid *channel = Channel(i);
    if (channel) channel->Resample(width, height);
  }

  // Invalidate mesh face index
  InvalidateMeshFaceIndex();
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1a60b
movupd 0x50(%rbx), %xmm1
movupd 0x60(%rbx), %xmm2
subpd %xmm1, %xmm2
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm2
cvttpd2dq %xmm2, %xmm0
movlpd %xmm0, 0x28(%rbx)
xorl %ebp, %ebp
cmpl 0x24(%rbx), %ebp
jge 0x1a635
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1b7e6
testq %rax, %rax
je 0x1a631
movl 0x28(%rbx), %esi
movl 0x2c(%rbx), %edx
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x5cf5e
incl %ebp
jmp 0x1a60d
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *0xf0(%rax)
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::TransformTextureToSurface(gaps::R2Point const&, gaps::R2Point&) const
int RGBDSurface::
TransformTextureToSurface(const R2Point& texture_position, R2Point& surface_position) const
{
  // Transform from position in texture coordinates to surface coordinates
  if ((width == 0) || (height == 0)) return 0;
  RNScalar xlength = surface_bbox.XLength();
  RNScalar ylength = surface_bbox.YLength();
  surface_position[0] = surface_bbox[0][0] + xlength * texture_position[0] / width;
  surface_position[1] = surface_bbox[0][1] + ylength * texture_position[1] / height;
  return 1;
}

// Assembly:
movl 0x28(%rdi), %r8d
xorl %eax, %eax
testl %r8d, %r8d
je 0x1a6e7
movl 0x2c(%rdi), %ecx
testl %ecx, %ecx
je 0x1a6e7
movsd 0x50(%rdi), %xmm0
movsd 0x60(%rdi), %xmm1
subsd %xmm0, %xmm1
movsd 0x68(%rdi), %xmm2
subsd 0x58(%rdi), %xmm2
mulsd (%rsi), %xmm1
cvtsi2sd %r8d, %xmm3
divsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rdx)
mulsd 0x8(%rsi), %xmm2
cvtsi2sd %ecx, %xmm0
divsd %xmm0, %xmm2
addsd 0x58(%rdi), %xmm2
movsd %xmm2, 0x8(%rdx)
pushq $0x1
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::TransformSurfaceToWorld(gaps::R2Point const&, gaps::R3Point&) const
int RGBDSurface::
TransformSurfaceToWorld(const R2Point& surface_position, R3Point& world_position) const
{
  // Transform from position in surface coordinates to world coordinates
  if (rectangle) {
    world_position = rectangle->Corner(0,0);
    world_position += surface_position[0] * rectangle->Axis(0);
    world_position += surface_position[1] * rectangle->Axis(1);
  }
  else if (mesh) {
    R2Point texture_position;
    double barycentrics[3];
    if (!TransformSurfaceToTexture(surface_position, texture_position)) return 0;
    R3MeshFace *face = SearchMeshFaceIndex(texture_position, barycentrics);
    if (face) world_position = mesh->FacePoint(face, barycentrics);
    else return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x80(%rdi), %rsi
testq %rsi, %rsi
je 0x1a7e0
movq %rsp, %r12
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1b80a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x46036
movsd (%r15), %xmm0
movq 0x80(%r14), %rsi
addq $0x20, %rsi
movq %rsp, %r12
movq %r12, %rdi
callq 0x46c02
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4609c
movsd 0x8(%r15), %xmm0
movq 0x80(%r14), %rsi
addq $0x38, %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x46c02
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4609c
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rbp
cmpq $0x0, 0x88(%r14)
je 0x1a7d1
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x6663e
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x40(%rax)
testl %eax, %eax
je 0x1a84d
movq (%r14), %rax
leaq 0x18(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq *0xe8(%rax)
testq %rax, %rax
je 0x1a84d
movq 0x88(%r14), %rsi
leaq 0x28(%rsp), %r14
movq %rsp, %rcx
movq %r14, %rdi
movq %rax, %rdx
callq 0x2a644
movq %rbx, %rdi
movq %r14, %rsi
callq 0x46036
jmp 0x1a7d1
xorl %ebp, %ebp
jmp 0x1a7d1
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::TransformWorldToSurface(gaps::R3Point const&, gaps::R2Point&) const
int RGBDSurface::
TransformWorldToSurface(const R3Point& world_position, R2Point& surface_position) const
{
  // Transform from position in world coordinates to surface coordinates
  if (rectangle) {
    R3Point origin = rectangle->Corner(0,0);
    surface_position[0] = (world_position - origin).Dot(rectangle->Axis(0));;
    surface_position[1] = (world_position - origin).Dot(rectangle->Axis(1));;
  }
  else {
    return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r15
movq 0x80(%rdi), %rsi
testq %rsi, %rsi
je 0x1a8db
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x18(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1b80a
movq %rsp, %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x45f29
movq 0x80(%r14), %rsi
addq $0x20, %rsi
movq %r13, %rdi
callq 0x46786
movsd %xmm0, (%rbx)
movq %rsp, %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x45f29
movq 0x80(%r14), %rsi
addq $0x38, %rsi
movq %r13, %rdi
callq 0x46786
movsd %xmm0, 0x8(%rbx)
pushq $0x1
popq %rax
jmp 0x1a8dd
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::DrawVertices(int) const
void RGBDSurface::
DrawVertices(int color_scheme) const
{
  // Load color
  if (color_scheme == RGBD_NO_COLOR_SCHEME) LoadColor(color_scheme);
  else if (color_scheme == RGBD_HIGHLIGHT_COLOR_SCHEME) LoadColor(color_scheme);
  else LoadColor(RGBD_INDEX_COLOR_SCHEME);

  // Draw vertices
  if (rectangle) {
    RNGrfxBegin(RN_GRFX_POINTS);
    for (int i = 0; i < 4; i++) {
      R3Point position = rectangle->Corner(i);
      R3LoadPoint(position);
    }
    RNGrfxEnd();
  }
  else if (mesh) {
    RNGrfxBegin(RN_GRFX_POINTS);
    for (int i = 0; i < mesh->NVertices(); i++) {
      R3MeshVertex *vertex = mesh->Vertex(i);
      const R3Point& position = mesh->VertexPosition(vertex);
      R3LoadPoint(position);
    }
    RNGrfxEnd();
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
xorl %ecx, %ecx
cmpl $0x4, %esi
sete %cl
addl $0x3, %ecx
testl %esi, %esi
cmovnel %ecx, %esi
callq *0x80(%rax)
cmpq $0x0, 0x80(%rbx)
je 0x1ab14
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x11150
leaq 0x8(%rsp), %r14
cmpl $0x4, %ebp
je 0x1ab06
movq 0x80(%rbx), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x1b8ce
movq %r14, %rdi
callq 0x11170
incl %ebp
jmp 0x1aae4
callq 0x117d0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
cmpq $0x0, 0x88(%rbx)
je 0x1ab0b
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x11150
movq 0x88(%rbx), %rax
movslq 0x14(%rax), %rcx
cmpq %rcx, %r14
jge 0x1ab4e
movq 0x8(%rax), %rax
movq (%rax,%r14,8), %rdi
addq $0x18, %rdi
callq 0x11170
incq %r14
jmp 0x1ab28
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x117d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::LoadColor(int) const
void RGBDSurface::
LoadColor(int color_scheme) const
{
  // Check color scheme
  if (color_scheme == RGBD_INDEX_COLOR_SCHEME) {
    // Load color encoding index
    int k = 255.0 * (ConfigurationIndex()+1) / configuration->NSurfaces();
    unsigned char r = k;
    unsigned char g = 0;
    unsigned char b = 0;
    RNLoadRgb(r, g, b);
  }
  else if (color_scheme == RGBD_PHOTO_COLOR_SCHEME) {
    // Load white 
    RNLoadRgb(1.0, 1.0, 1.0);
  }
  else if (color_scheme == RGBD_RENDER_COLOR_SCHEME) {
    // Load white 
    RNLoadRgb(1.0, 1.0, 1.0);
  }
  else if (color_scheme == RGBD_HIGHLIGHT_COLOR_SCHEME) {
    // Load highlight color
    RNLoadRgb(1.0, 1.0, 0.0);
  }
}

// Assembly:
decl %esi
cmpl $0x3, %esi
ja 0x1aded
leaq 0x8e0b0(%rip), %rax     # 0xa8e40
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movsd 0x8d287(%rip), %xmm0    # 0xa8028
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
jmp 0x11910
movl 0x10(%rdi), %eax
incl %eax
cvtsi2sd %eax, %xmm0
mulsd 0x8e05b(%rip), %xmm0    # 0xa8e18
movq 0x8(%rdi), %rax
cvtsi2sdl 0x24(%rax), %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl %al, %edi
xorl %esi, %esi
xorl %edx, %edx
jmp 0x11580
movsd 0x8d246(%rip), %xmm0    # 0xa8028
xorps %xmm2, %xmm2
movaps %xmm0, %xmm1
jmp 0x11910
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::ReadColorChannels()
int RGBDSurface::
ReadColorChannels(void)
{
  // Initialize image
  R2Image rgb_image(width, height);

  // Check filename
  if (texture_filename) {
    // Get full filename
    char full_filename[4096];
    const char *dirname = (configuration) ? configuration->TextureDirectory() : NULL;
    if (dirname) sprintf(full_filename, "%s/%s", dirname, texture_filename);
    else sprintf(full_filename, "%s", texture_filename);
    if (!RNFileExists(full_filename)) return 0;
  
    // Read color image
    if (!rgb_image.Read(full_filename)) return 0;

    // Check image dimensions
    if ((rgb_image.Width() != width) || (rgb_image.Height() != height)) {
      RNFail("Mismatching image dimensions (%d,%d) vs (%d,%d) in %s\n",
        rgb_image.Width(), rgb_image.Height(), width, height, texture_filename);
      // return 0;
    }
  }

  // Create color channels
  return CreateColorChannels(rgb_image);
}

// Assembly:
pushq %rbx
subq $0x1020, %rsp           # imm = 0x1020
movq %rdi, %rbx
movl 0x28(%rdi), %esi
movl 0x2c(%rdi), %edx
leaq 0x8(%rsp), %rdi
pushq $0x3
popq %rcx
callq 0x671d2
movq 0x38(%rbx), %rcx
testq %rcx, %rcx
je 0x1aeb2
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x1ae56
movq 0x50(%rax), %rdx
testq %rdx, %rdx
je 0x1ae56
leaq 0x8e0f0(%rip), %rsi     # 0xa8f38
leaq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x11110
jmp 0x1ae63
leaq 0x20(%rsp), %rdi
movq %rcx, %rsi
callq 0x11540
leaq 0x20(%rsp), %rdi
callq 0x6dd04
testl %eax, %eax
je 0x1aec7
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x66ee4
testl %eax, %eax
je 0x1aec7
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
movl 0x28(%rbx), %ecx
movl 0x2c(%rbx), %r8d
movl %esi, %eax
xorl %ecx, %eax
movl %edx, %edi
xorl %r8d, %edi
orl %eax, %edi
je 0x1aeb2
movq 0x38(%rbx), %r9
leaq 0x8e093(%rip), %rdi     # 0xa8f3e
xorl %eax, %eax
callq 0x6e732
movq (%rbx), %rax
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq *0xb8(%rax)
movl %eax, %ebx
jmp 0x1aec9
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x67414
movl %ebx, %eax
addq $0x1020, %rsp           # imm = 0x1020
popq %rbx
retq
jmp 0x1aee0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x67414
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::WriteColorChannels()
int RGBDSurface::
WriteColorChannels(void)
{
  // Check filename
  if (NChannels() <= RGBD_BLUE_CHANNEL) return 0;

  // Create texture filename, if there is none
  if (!texture_filename) {
    char buffer[4096];
    sprintf(buffer, "t%06d.jpg", ConfigurationIndex());
    SetTextureFilename(buffer);
  }

  // Get full filename
  char full_filename[4096];
  const char *dirname = (configuration) ? configuration->TextureDirectory() : NULL;
  if (dirname) sprintf(full_filename, "%s/%s", dirname, texture_filename);
  else sprintf(full_filename, "%s", texture_filename);

  // Compute color image
  R2Image rgb_image(width, height, 3);
  for (int iy = 0; iy < height; iy++) {
    for (int ix = 0; ix < width; ix++) {
      RNRgb rgb = TexelColor(ix, iy);
      rgb_image.SetPixelRGB(ix, iy, rgb);
    }
  }

  // Write color image
  if (!rgb_image.Write(full_filename)) return 0;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1030, %rsp           # imm = 0x1030
xorl %ebp, %ebp
cmpl $0x3, 0x24(%rdi)
jl 0x1b004
movq %rdi, %rbx
cmpq $0x0, 0x38(%rdi)
jne 0x1af59
movl 0x10(%rbx), %edx
leaq 0x8e03a(%rip), %rsi     # 0xa8f75
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x11110
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0xc0(%rax)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x1af84
movq 0x50(%rax), %rdx
movq 0x38(%rbx), %rcx
testq %rdx, %rdx
je 0x1af88
leaq 0x8dfc2(%rip), %rsi     # 0xa8f38
leaq 0x30(%rsp), %rdi
xorl %eax, %eax
callq 0x11110
jmp 0x1af95
movq 0x38(%rbx), %rcx
leaq 0x30(%rsp), %rdi
movq %rcx, %rsi
callq 0x11540
movl 0x28(%rbx), %esi
movl 0x2c(%rbx), %edx
movq %rsp, %r14
pushq $0x3
popq %rcx
movq %r14, %rdi
callq 0x671d2
xorl %ebp, %ebp
leaq 0x18(%rsp), %r15
cmpl 0x2c(%rbx), %ebp
jge 0x1afe7
xorl %r12d, %r12d
cmpl 0x28(%rbx), %r12d
jge 0x1afe3
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movl %ebp, %ecx
callq 0x19f90
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
movq %r15, %rcx
callq 0x67560
incl %r12d
jmp 0x1afb8
incl %ebp
jmp 0x1afb0
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x68e0a
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
movq %rsp, %rdi
callq 0x67414
movl %ebp, %eax
addq $0x1030, %rsp           # imm = 0x1030
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1b018
movq %rax, %rbx
movq %rsp, %rdi
callq 0x67414
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::ReleaseColorChannels()
int RGBDSurface::
ReleaseColorChannels(void)
{
  // Check/update read count
  if (--color_resident_count > 0) return 1;

  // Write color channel before release???
  // WriteColorChannels();
  
  // Delete color channels
  for (int channel_index = RGBD_RED_CHANNEL; channel_index <= RGBD_BLUE_CHANNEL; channel_index++) {
    if (NChannels() <= channel_index) break;
    if (!channels[channel_index]) continue;
    delete channels[channel_index];
    channels[channel_index] = NULL;
  }

  // Return success;
  return 1;
}

// Assembly:
movl 0x70(%rdi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x70(%rdi)
cmpl $0x1, %eax
jg 0x1b09f
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r15d, %r15d
cmpq $0x2, %r15
ja 0x1b09a
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jge 0x1b09a
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x1b095
movq %r14, %rdi
callq 0x589c0
movl $0xd0, %esi
movq %r14, %rdi
callq 0x115d0
movq 0x18(%rbx), %rax
andq $0x0, (%rax,%r15,8)
incq %r15
jmp 0x1b05b
popq %rbx
popq %r14
popq %r15
pushq $0x1
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::CreateColorChannels(gaps::R2Image const&)
int RGBDSurface::
CreateColorChannels(const R2Image& image)
{
  // Check/update read count
  if (color_resident_count++ > 0) return 1;

  // Create color channels
  while (channels.NEntries() <= RGBD_BLUE_CHANNEL) channels.Insert(NULL);
  if (!channels[RGBD_RED_CHANNEL]) channels[RGBD_RED_CHANNEL] = new R2Grid(image.Width(), image.Height());
  if (!channels[RGBD_GREEN_CHANNEL]) channels[RGBD_GREEN_CHANNEL] = new R2Grid(image.Width(), image.Height());
  if (!channels[RGBD_BLUE_CHANNEL]) channels[RGBD_BLUE_CHANNEL] = new R2Grid(image.Width(), image.Height());

  // Initialize color channels
  SetColorChannels(image);

  // Set width and height
  this->width = image.Width();
  this->height = image.Height();

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x70(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x70(%rdi)
testl %eax, %eax
jg 0x1b171
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rdi), %r15
cmpl $0x2, 0x24(%rbx)
jg 0x1b0d9
movq %r15, %rdi
xorl %esi, %esi
callq 0x15616
jmp 0x1b0c7
movq (%r15), %rax
cmpq $0x0, (%rax)
jne 0x1b107
movl $0xd0, %edi
callq 0x115c0
movq %rax, %r12
movl (%r14), %esi
movl 0x4(%r14), %edx
movq %rax, %rdi
callq 0x57e7c
movq (%r15), %rax
movq %r12, (%rax)
movq (%r15), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1b134
movl $0xd0, %edi
callq 0x115c0
movq %rax, %r12
movl (%r14), %esi
movl 0x4(%r14), %edx
movq %rax, %rdi
callq 0x57e7c
movq (%r15), %rax
movq %r12, 0x8(%rax)
movq (%r15), %rax
cmpq $0x0, 0x10(%rax)
jne 0x1b15e
movl $0xd0, %edi
callq 0x115c0
movq %rax, %r12
movl (%r14), %esi
movl 0x4(%r14), %edx
movq %rax, %rdi
callq 0x57e7c
movq (%r15), %rax
movq %r12, 0x10(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x28(%rax)
movq (%r14), %rax
movq %rax, 0x28(%rbx)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1b184
jmp 0x1b184
movq %rax, %rbx
movl $0xd0, %esi
movq %r12, %rdi
callq 0x115d0
movq %rbx, %rdi
callq 0x11a80
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::InvalidateOpenGL()
void RGBDSurface::
InvalidateOpenGL(void) 
{
  // Delete opengl texture
  if (opengl_texture_id > 0) {
    GLuint i = opengl_texture_id;
    glDeleteTextures(1, &i);
  }

  // Reset opengl identifier
  opengl_texture_id = -1;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x30(%rdi), %eax
testl %eax, %eax
jle 0x1b1ba
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
pushq $0x1
popq %rdi
callq 0x11810
orl $-0x1, 0x30(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::UpdateMeshFaceIndex()
void RGBDSurface::
UpdateMeshFaceIndex(void)
{
  // Check everything
  if (!mesh) return;
  if (width == 0) return;
  if (height == 0) return;
  if (RNIsZero(surface_bbox.Area())) return;
  
  // Create face index
  mesh_face_index = new R2Grid(width, height, surface_bbox);

  // Update mesh face index grid
  mesh_face_index->Clear(R2_GRID_UNKNOWN_VALUE);
  for (int i = 0; i < mesh->NFaces(); i++) {
    R3MeshFace *face = mesh->Face(i);
    R3MeshVertex *v0 = mesh->VertexOnFace(face, 0);
    R3MeshVertex *v1 = mesh->VertexOnFace(face, 1);
    R3MeshVertex *v2 = mesh->VertexOnFace(face, 2);
    R2Point s0 = mesh->VertexTextureCoords(v0);
    R2Point s1 = mesh->VertexTextureCoords(v1);
    R2Point s2 = mesh->VertexTextureCoords(v2);
    mesh_face_index->RasterizeWorldTriangle(s0, s1, s2, i, R2_GRID_REPLACE_OPERATION);
  }

  // For debugging
  // mesh_face_index->WriteFile("mesh_face_index.pfm");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpq $0x0, 0x88(%rdi)
je 0x1b65a
movq %rdi, %rbx
cmpl $0x0, 0x28(%rdi)
je 0x1b65a
cmpl $0x0, 0x2c(%rbx)
je 0x1b65a
leaq 0x48(%rbx), %r14
movq %r14, %rdi
callq 0x63ff8
leaq 0xdc6ba(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm1
movapd 0x8ca06(%rip), %xmm2    # 0xa8050
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x1b669
ucomisd %xmm0, %xmm1
jb 0x1b669
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xd0, %edi
callq 0x115c0
movq %rax, %r15
movl 0x28(%rbx), %esi
movl 0x2c(%rbx), %edx
movq %rax, %rdi
movq %r14, %rcx
callq 0x57f52
movq %r15, 0x90(%rbx)
movsd 0x8c97a(%rip), %xmm0    # 0xa8010
movq %r15, %rdi
callq 0x59dcc
xorl %r14d, %r14d
movq 0x88(%rbx), %rax
movslq 0x34(%rax), %rcx
cmpq %rcx, %r14
jge 0x1b65a
movq 0x28(%rax), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %r13
movq 0x18(%rax), %rbp
addq $0x48, %rsi
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x6664a
addq $0x48, %r13
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x6664a
addq $0x48, %rbp
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6664a
movq 0x90(%rbx), %rdi
cvtsi2sd %r14d, %xmm0
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
pushq $0x2
popq %r8
callq 0x1b97e
incq %r14
jmp 0x1b6a1
movq %rax, %rbx
movl $0xd0, %esi
movq %r15, %rdi
callq 0x115d0
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/../../pkgs/RNBasics/RNArray.hh
// Function: gaps::RGBDSurface::TexelChannelValue(int, int, int) const
inline void *RNVArray::
Kth(int k) const
{
    // Return kth data element
    assert(entries);
    assert(nentries >= 0);
    assert((k >= 0) && (k < nentries));
    return entries[k];
}

// Assembly:
movq 0x18(%rdi), %rax
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0x1b79b
imull 0xc8(%rax), %edx
movq 0xb8(%rax), %rax
addl %esi, %edx
movslq %edx, %rcx
movsd (%rax,%rcx,8), %xmm0
retq
pushq %rax
leaq 0x8d6eb(%rip), %rdi     # 0xa8e8e
xorl %eax, %eax
callq 0x6e732
movsd 0x8c85e(%rip), %xmm0    # 0xa8010
addq $0x8, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/../../pkgs/R2Shapes/R2Grid.h
// Function: gaps::R2Grid::RasterizeGridTriangle(gaps::R2Point const&, gaps::R2Point const&, gaps::R2Point const&, double, double, double, int)
inline void R2Grid::
RasterizeGridTriangle(const R2Point& p1, const R2Point& p2, const R2Point& p3, RNScalar value1, RNScalar value2, RNScalar value3, int operation)
{
  // Splat value everywhere inside grid triangle
  int i1[2] = { (int) (p1[0] + 0.5), (int) (p1[1] + 0.5) };
  int i2[2] = { (int) (p2[0] + 0.5), (int) (p2[1] + 0.5) };
  int i3[2] = { (int) (p3[0] + 0.5), (int) (p3[1] + 0.5) };
  RasterizeGridTriangle(i1, i2, i3, value1, value2, value3, operation);
}

// Assembly:
subq $0x18, %rsp
movupd (%rsi), %xmm3
movapd 0x8d3ea(%rip), %xmm4    # 0xa8e20
addpd %xmm4, %xmm3
cvttpd2dq %xmm3, %xmm3
leaq 0x10(%rsp), %rsi
movlpd %xmm3, (%rsi)
movupd (%rdx), %xmm3
addpd %xmm4, %xmm3
cvttpd2dq %xmm3, %xmm3
leaq 0x8(%rsp), %rdx
movlpd %xmm3, (%rdx)
movupd (%rcx), %xmm3
addpd %xmm4, %xmm3
cvttpd2dq %xmm3, %xmm3
movq %rsp, %rcx
movlpd %xmm3, (%rcx)
callq 0x5d762
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::~RGBDImage()
RGBDImage::
~RGBDImage(void)
{
  // Delete opengl texture
  if (opengl_texture_id >= 0) {
    GLuint i = opengl_texture_id;
    glDeleteTextures(1, &i);
  }
  
  // Remove from configuration
  if (configuration) {
    configuration->RemoveImage(this);
  }

  // Delete channels
  for (int i = 0; i < channels.NEntries(); i++) {
    if (channels[i]) delete channels[i];
  }

  // Delete filenames
  if (name) free(name);
  if (color_filename) free(color_filename);
  if (depth_filename) free(depth_filename);
  if (category_filename) free(category_filename);
  if (instance_filename) free(instance_filename);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xd71b4(%rip), %rax     # 0xf2ef8
movq %rax, (%rdi)
movl 0x1c8(%rdi), %eax
testl %eax, %eax
js 0x1bd60
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
pushq $0x1
popq %rdi
callq 0x11810
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1bd72
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
leaq 0x18(%rbx), %r14
xorl %r12d, %r12d
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jge 0x1bda8
movq (%r14), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x1bda3
movq %r15, %rdi
callq 0x589c0
movl $0xd0, %esi
movq %r15, %rdi
callq 0x115d0
incq %r12
jmp 0x1bd79
movq 0x1d0(%rbx), %rdi
callq 0x11710
movq 0x1d8(%rbx), %rdi
callq 0x11710
movq 0x1e0(%rbx), %rdi
callq 0x11710
movq 0x1e8(%rbx), %rdi
callq 0x11710
movq 0x1f0(%rbx), %rdi
callq 0x11710
leaq 0x188(%rbx), %rdi
callq 0x3ee72
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x40d2e
movq %r14, %rdi
callq 0x6c128
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x195ed
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::ProjectionMatrix(double, double) const
R4Matrix RGBDImage::
ProjectionMatrix(RNScalar neardist, RNScalar fardist) const
{
  // Return projection transformation from camera coordinates to normalized image coordinates
  RNScalar fx = Intrinsics()[0][0];
  RNScalar fy = Intrinsics()[1][1];
  RNScalar cx = Intrinsics()[0][2];
  RNScalar cy = Intrinsics()[1][2];
  RNScalar W = NPixels(RN_X);
  RNScalar H = NPixels(RN_Y);
  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 0x160(%rsi), %xmm5
movsd 0x140(%rsi), %xmm0
movsd 0x150(%rsi), %xmm4
cvtsi2sdl 0x28(%rsi), %xmm2
cvtsi2sdl 0x2c(%rsi), %xmm7
movsd 0x168(%rsi), %xmm8
addsd %xmm0, %xmm0
divsd %xmm2, %xmm0
divsd %xmm2, %xmm4
addsd %xmm4, %xmm4
movsd 0x8c197(%rip), %xmm6    # 0xa8028
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 0x8c195(%rip), %xmm4    # 0xa8050
subsd %xmm8, %xmm6
movapd %xmm1, %xmm7
subsd %xmm3, %xmm7
divsd %xmm7, %xmm4
mulsd 0x8d0e4(%rip), %xmm3    # 0xa8fb8
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 0x42cf0
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::PixelColor(int, int) const
RNRgb RGBDImage::
PixelColor(int ix, int iy) const
{
  // Return color of pixel
  if (NChannels() < 3) return RNblack_rgb;
  RNScalar r = PixelChannelValue(ix, iy, RGBD_RED_CHANNEL);
  RNScalar g = PixelChannelValue(ix, iy, RGBD_GREEN_CHANNEL);
  RNScalar b = PixelChannelValue(ix, iy, RGBD_BLUE_CHANNEL);
  return RNRgb(r, g, b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpl $0x2, 0x24(%rsi)
jg 0x1c342
leaq 0xde1d8(%rip), %rsi     # 0xfa510
movq %rbx, %rdi
callq 0x6bf14
jmp 0x1c39b
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rsi, %rdi
movl %edx, %esi
movl %ecx, %edx
xorl %ecx, %ecx
callq 0x1fa56
movsd %xmm0, 0x10(%rsp)
pushq $0x1
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x1fa56
movsd %xmm0, 0x8(%rsp)
pushq $0x2
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x1fa56
movaps %xmm0, %xmm2
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x6bf32
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::PixelColor(gaps::R2Point const&) const
RNRgb RGBDImage::
PixelColor(const R2Point& image_position) const
{
  // Return color of pixel
  if (NChannels() < 3) return RNblack_rgb;
  RNScalar r = PixelChannelValue(image_position, RGBD_RED_CHANNEL);
  RNScalar g = PixelChannelValue(image_position, RGBD_GREEN_CHANNEL);
  RNScalar b = PixelChannelValue(image_position, RGBD_BLUE_CHANNEL);
  return RNRgb(r, g, b);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x2, 0x24(%rsi)
jg 0x1c5a7
leaq 0xddf73(%rip), %rsi     # 0xfa510
movq %rbx, %rdi
callq 0x6bf14
jmp 0x1c5f7
movq %rdx, %r14
movq %rsi, %r15
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x1563c
movsd %xmm0, 0x8(%rsp)
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1563c
movsd %xmm0, (%rsp)
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1563c
movaps %xmm0, %xmm2
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0x6bf32
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::PixelWorldRay(gaps::R2Point const&) const
R3Ray RGBDImage::
PixelWorldRay(const R2Point& image_position) const
{
  // Get/check intrinsics matrix
  const R3Matrix& intrinsics_matrix = Intrinsics();
  if (RNIsZero(intrinsics_matrix[0][0])) return R3null_ray;
  if (RNIsZero(intrinsics_matrix[1][1])) return R3null_ray;

  // Get point at depth 1.0 along ray in camera coordinates
  R3Point camera_position;
  camera_position[0] = (image_position[0] - intrinsics_matrix[0][2]) / intrinsics_matrix[0][0];
  camera_position[1] = (image_position[1] - intrinsics_matrix[1][2]) / intrinsics_matrix[1][1];
  camera_position[2] = -1.0;

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

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movsd 0x140(%rsi), %xmm2
leaq 0xdb69d(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm0
movapd 0x8b9e9(%rip), %xmm1    # 0xa8050
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x1c677
ucomisd %xmm2, %xmm0
jae 0x1c68c
movsd 0x160(%r14), %xmm2
ucomisd %xmm1, %xmm2
jb 0x1c69d
ucomisd %xmm2, %xmm0
jb 0x1c69d
leaq 0xdc28d(%rip), %rsi     # 0xf8920
movq %rbx, %rdi
callq 0x45958
jmp 0x1c70f
movq %rsp, %r12
movq %r12, %rdi
callq 0x45d4a
movupd 0x140(%r14), %xmm0
movupd 0x150(%r14), %xmm1
movhpd 0x168(%r14), %xmm1      # xmm1 = xmm1[0],mem[0]
movupd (%r15), %xmm2
subpd %xmm1, %xmm2
movhpd 0x160(%r14), %xmm0      # xmm0 = xmm0[0],mem[0]
divpd %xmm0, %xmm2
movapd %xmm2, (%r12)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x10(%r12)
leaq 0xdc4cb(%rip), %rsi     # 0xf8bc0
movq %rbx, %rdi
movq %r12, %rdx
callq 0x45964
addq $0x30, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x45a12
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::SetNPixels(int, int)
void RGBDImage::
SetNPixels(int nx, int ny)
{
  // Resample color channels
  for (int i = RGBD_RED_CHANNEL; i <= RGBD_BLUE_CHANNEL; i++) {
    if (channels.NEntries() <= i) continue;
    if (channels[i]) channels[i]->Resample(nx, ny);
  }

  // Resample other channels (without interpolation)
  for (int i = RGBD_DEPTH_CHANNEL; i < channels.NEntries(); i++) {
    if (channels.NEntries() <= i) continue;
    R3Matrix tmp(R3identity_matrix);
    if (channels[i]) RGBDResampleDepthImage(*(channels[i]), tmp, nx, ny);
  }

  // Update intrinsics 
  double xscale = (nx > 0) ? (double) width / (double) nx : 1;
  double yscale = (ny > 0) ? (double) height / (double) ny : 1;
  this->intrinsics[0][0] /= xscale;
  this->intrinsics[0][2] /= xscale;
  this->intrinsics[1][1] /= yscale;
  this->intrinsics[1][2] /= yscale;

  // Update width and height of image
  this->width = nx;
  this->height = ny;

  // Invalidate opengl
  InvalidateOpenGL();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x1c764
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jge 0x1c75f
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x1c75f
movl %r14d, %esi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x5cf5e
incq %r15
jmp 0x1c737
pushq $0x3
popq %r13
leaq 0x8ea61(%rip), %r15     # 0xab1d0
movq %rsp, %r12
movslq 0x24(%rbx), %rax
cmpq %rax, %r13
jge 0x1c7a5
movq %r12, %rdi
movq %r15, %rsi
callq 0x648fc
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x1c7a0
movq %r12, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x21bc6
incq %r13
jmp 0x1c772
movsd 0x8b87b(%rip), %xmm0    # 0xa8028
testl %r14d, %r14d
jg 0x1c7b8
movapd %xmm0, %xmm1
jmp 0x1c7c6
cvtsi2sdl 0x28(%rbx), %xmm1
cvtsi2sd %r14d, %xmm2
divsd %xmm2, %xmm1
testl %ebp, %ebp
jle 0x1c7d7
cvtsi2sdl 0x2c(%rbx), %xmm0
cvtsi2sd %ebp, %xmm2
divsd %xmm2, %xmm0
movsd 0x140(%rbx), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x140(%rbx)
movsd 0x150(%rbx), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x150(%rbx)
movupd 0x160(%rbx), %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
movupd %xmm1, 0x160(%rbx)
movl %r14d, 0x28(%rbx)
movl %ebp, 0x2c(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x1c8(%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::SetPixelColor(int, int, gaps::RNRgb const&)
void RGBDImage::
SetPixelColor(int ix, int iy, const RNRgb& color)
{
  // Set pixel red, green, and blue
  SetPixelChannelValue(ix, iy, RGBD_RED_CHANNEL, color.R());
  SetPixelChannelValue(ix, iy, RGBD_GREEN_CHANNEL, color.G());
  SetPixelChannelValue(ix, iy, RGBD_BLUE_CHANNEL, color.B());

  // Invalidate opengl
  InvalidateOpenGL();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
movsd (%rcx), %xmm0
movq (%rdi), %rax
xorl %ecx, %ecx
callq *0x38(%rax)
movsd 0x8(%r14), %xmm0
movq (%rbx), %rax
pushq $0x1
popq %rcx
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq *0x38(%rax)
movsd 0x10(%r14), %xmm0
movq (%rbx), %rax
pushq $0x2
popq %rcx
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq *0x38(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0x1c8(%rax)
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::SetPixelDepth(int, int, double)
void RGBDImage::
SetPixelDepth(int ix, int iy, RNScalar depth)
{
  // Set pixel depth
  SetPixelChannelValue(ix, iy, RGBD_DEPTH_CHANNEL, depth);

  // Update bounding box
  R3Point world_position;
  R2Point image_position(ix+0.5, iy+0.5);
  if (RGBDTransformImageToWorld(image_position, world_position, this)) {
    world_bbox.Union(world_position);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rax
pushq $0x3
popq %rcx
callq *0x38(%rax)
movq %rsp, %r15
movq %r15, %rdi
callq 0x45d4a
cvtsi2sd %r14d, %xmm0
movsd 0x8b749(%rip), %xmm2    # 0xa8018
addsd %xmm2, %xmm0
cvtsi2sd %ebp, %xmm1
addsd %xmm2, %xmm1
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x66640
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x15bef
testl %eax, %eax
je 0x1c90c
addq $0x188, %rbx            # imm = 0x188
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3eb10
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::SetPixelChannelValue(int, int, int, double)
void RGBDImage::
SetPixelChannelValue(int ix, int iy, int channel_index, RNScalar value)
{
  // Check channel
  if (!channels[channel_index]) {
    RNFail("RGBD channel is not resident in memory -- cannot set value\n");
    return;
  }
  
  // Set channel value at pixel
  if ((channel_index < 0) || (channel_index >= channels.NEntries())) return;
  if ((ix < 0) || (ix >= channels[channel_index]->XResolution())) return;
  if ((iy < 0) || (iy >= channels[channel_index]->YResolution())) return;
  channels[channel_index]->SetGridValue(ix, iy, value);

  // Update bounding box
  if (channel_index == RGBD_DEPTH_CHANNEL) {
    R3Point world_position;
    R2Point image_position(ix+0.5, iy+0.5);
    if (RGBDTransformImageToWorld(image_position, world_position, this)) {
      world_bbox.Union(world_position);
    }
  }

  // Invalidate opengl
  if ((channel_index >= RGBD_RED_CHANNEL) && (channel_index <= RGBD_BLUE_CHANNEL)) InvalidateOpenGL();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq 0x18(%rdi), %rax
movslq %ecx, %rdx
movq (%rax,%rdx,8), %rax
testq %rax, %rax
je 0x1ca06
testl %ecx, %ecx
js 0x1ca36
movl %esi, %r14d
testl %esi, %esi
js 0x1ca36
movq %rdi, %rbx
cmpl %ecx, 0x24(%rdi)
jle 0x1ca36
testl %ebp, %ebp
js 0x1ca36
cmpl %r14d, 0xc0(%rax)
jle 0x1ca36
cmpl %ebp, 0xc4(%rax)
jle 0x1ca36
movq 0xb8(%rax), %rdx
movl 0xc8(%rax), %eax
imull %ebp, %eax
addl %r14d, %eax
cltq
movsd %xmm0, (%rdx,%rax,8)
cmpl $0x3, %ecx
jne 0x1ca1e
movq %rsp, %r15
movq %r15, %rdi
callq 0x45d4a
cvtsi2sd %r14d, %xmm0
movsd 0x8b651(%rip), %xmm2    # 0xa8018
addsd %xmm2, %xmm0
cvtsi2sd %ebp, %xmm1
addsd %xmm2, %xmm1
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x66640
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x15bef
testl %eax, %eax
je 0x1ca36
addq $0x188, %rbx            # imm = 0x188
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x3eb10
jmp 0x1ca36
leaq 0x8c63d(%rip), %rdi     # 0xa904a
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6e732
jae 0x1ca36
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0x1c8(%rax)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::SetChannel(int, gaps::R2Grid const&)
void RGBDImage::
SetChannel(int channel_index, const R2Grid& image)
{
  // Check channel
  if (!channels[channel_index]) {
    RNFail("RGBD channel is not resident in memory -- cannot set\n");
    return;
  }
  
  // Copy channel
  *(channels[channel_index]) = image;
  
  // Set width and height
  this->width = image.XResolution();
  this->height = image.YResolution();

  // Invalidate bounding box
  if (channel_index == RGBD_DEPTH_CHANNEL) InvalidateWorldBBox();

  // Invalidate opengl
  if ((channel_index >= RGBD_RED_CHANNEL) && (channel_index <= RGBD_BLUE_CHANNEL)) InvalidateOpenGL();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0x1ca8f
movq %rdx, %r14
movl %esi, %ebp
movq %rdx, %rsi
callq 0x5872a
movl 0xc0(%r14), %eax
movl %eax, 0x28(%rbx)
movl 0xc4(%r14), %eax
movl %eax, 0x2c(%rbx)
cmpl $0x3, %ebp
jne 0x1caa1
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0x1c0(%rax)
leaq 0x8c5f0(%rip), %rdi     # 0xa9086
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x6e732
jae 0x1cab3
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0x1c8(%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::Transform(gaps::R3Transformation const&)
void RGBDImage::
Transform(const R3Transformation& transformation)
{
  // Update camera_to_world transformation
  R3Affine t = R3identity_affine;
  t.Transform(transformation);
  t.Transform(camera_to_world);
  camera_to_world = t;

  // Invalidate bounding box
  InvalidateWorldBBox();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xdb7e3(%rip), %rsi     # 0xf84b0
movq %rsp, %r15
movq %r15, %rdi
callq 0x156c8
movq %r15, %rdi
movq %r14, %rsi
callq 0x412d6
leaq 0x30(%rbx), %r14
movq %rsp, %rdi
movq %r14, %rsi
callq 0x40e9a
movq %rsp, %rsi
movq %r14, %rdi
callq 0x1fa9c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x1c0(%rax)
movq %rsp, %rdi
callq 0x40d2e
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x40d2e
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::TransformImageToCamera(gaps::R2Point const&, gaps::R3Point&) const
int RGBDImage::
TransformImageToCamera(const R2Point& image_position, R3Point& camera_position) const
{
  // Check image position
  int ix = (int) image_position[0];
  if ((ix < 0) || (ix >= NPixels(RN_X))) return 0; 
  int iy = (int) image_position[1];
  if ((iy < 0) || (iy >= NPixels(RN_Y))) return 0; 
  
  // Get/check depth (point sample to avoid interpolation)
  RNScalar depth = PixelDepth(ix, iy);
  if ((RNIsZero(depth)) || (depth == R2_GRID_UNKNOWN_VALUE)) return 0;

  // Get/check intrinsics matrix
  const R3Matrix& intrinsics_matrix = Intrinsics();
  if (RNIsZero(intrinsics_matrix[0][0])) return 0;
  if (RNIsZero(intrinsics_matrix[1][1])) return 0;
  
  // Transform from position in image coordinates to camera coordinates (where camera is looking down -Z, up is +Y, right is +X)
  camera_position[0] = (image_position[0] - intrinsics_matrix[0][2]) * depth / intrinsics_matrix[0][0];
  camera_position[1] = (image_position[1] - intrinsics_matrix[1][2]) * depth / intrinsics_matrix[1][1];
  camera_position[2] = -depth;

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
cvttsd2si (%rsi), %esi
xorl %ebx, %ebx
testl %esi, %esi
js 0x1ce3e
movq %rdi, %r15
cmpl %esi, 0x28(%rdi)
jle 0x1ce3e
movq %rdx, %r14
cvttsd2si 0x8(%r12), %edx
testl %edx, %edx
js 0x1ce3e
cmpl %edx, 0x2c(%r15)
jle 0x1ce3e
movq %r15, %rdi
callq 0x1fade
ucomisd 0x8b28d(%rip), %xmm0    # 0xa8010
jne 0x1cd8b
jnp 0x1ce3e
leaq 0xdaf66(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm1
movapd 0x8b2b2(%rip), %xmm3    # 0xa8050
xorpd %xmm1, %xmm3
movapd %xmm0, %xmm2
cmplepd %xmm1, %xmm2
movapd %xmm3, %xmm4
cmplepd %xmm0, %xmm4
andpd %xmm2, %xmm4
movd %xmm4, %eax
testb $0x1, %al
jne 0x1ce3e
movsd 0x140(%r15), %xmm2
ucomisd %xmm3, %xmm2
jb 0x1cdd5
ucomisd %xmm2, %xmm1
jae 0x1ce3e
movsd 0x160(%r15), %xmm4
ucomisd %xmm3, %xmm4
jb 0x1cdea
ucomisd %xmm4, %xmm1
jae 0x1ce3e
movsd (%r12), %xmm1
subsd 0x150(%r15), %xmm1
mulsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, (%r14)
movsd 0x8(%r12), %xmm1
subsd 0x168(%r15), %xmm1
mulsd %xmm0, %xmm1
divsd 0x160(%r15), %xmm1
movsd %xmm1, 0x8(%r14)
movapd 0x8b21f(%rip), %xmm1    # 0xa8050
xorpd %xmm0, %xmm1
movlpd %xmm1, 0x10(%r14)
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::TransformCameraToWorld(gaps::R3Point const&, gaps::R3Point&) const
int RGBDImage::
TransformCameraToWorld(const R3Point& camera_position, R3Point& world_position) const
{
  // Transform from camera coordinates to world coordinates
  world_position = camera_position;
  world_position.Transform(CameraToWorld());
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq %rdx, %rdi
callq 0x46036
addq $0x30, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x46392
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::TransformWorldToCamera(gaps::R3Point const&, gaps::R3Point&) const
int RGBDImage::
TransformWorldToCamera(const R3Point& world_position, R3Point& camera_position) const
{
  // Transform from position in world coordinates to camera coordinates
  camera_position = world_position;
  camera_position.InverseTransform(CameraToWorld());
  if (RNIsPositiveOrZero(camera_position[2])) return 0;
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq %rdx, %rdi
callq 0x46036
addq $0x30, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x463a4
movsd 0x10(%rbx), %xmm0
leaq 0xdad91(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm1
xorpd 0x8b0dd(%rip), %xmm1    # 0xa8050
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setb %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::DrawCamera(int, double) const
void RGBDImage::
DrawCamera(int color_scheme, RNLength radius) const
{
  // Get useful variables
  R3Point viewpoint = WorldViewpoint();
  R3Vector towards = WorldTowards();
  R3Vector up = WorldUp();

  // Load color
  if (color_scheme == RGBD_NO_COLOR_SCHEME) LoadColor(color_scheme);
  else if (color_scheme == RGBD_HIGHLIGHT_COLOR_SCHEME) LoadColor(color_scheme);
  else if (color_scheme != RGBD_NO_COLOR_SCHEME) LoadColor(RGBD_INDEX_COLOR_SCHEME);

  // Draw camera
  RNGrfxBegin(RN_GRFX_LINES);
  R3LoadPoint(viewpoint);
  R3LoadPoint(viewpoint + radius * towards);
  R3LoadPoint(viewpoint);
  R3LoadPoint(viewpoint + 0.5*radius * up);
  RNGrfxEnd();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
movsd %xmm0, (%rsp)
movl %esi, %ebp
movq %rdi, %r12
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x155fc
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x15686
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x197a6
movq (%r12), %rax
xorl %esi, %esi
cmpl $0x4, %ebp
sete %sil
addl $0x3, %esi
testl %ebp, %ebp
cmovel %ebp, %esi
movq %r12, %rdi
callq *0xf0(%rax)
pushq $0x1
popq %rdi
callq 0x11150
movq %rbx, %rdi
callq 0x11170
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x46c02
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x46013
movq %r15, %rdi
callq 0x11170
movq %rbx, %rdi
callq 0x11170
movsd (%rsp), %xmm0
mulsd 0x8af64(%rip), %xmm0    # 0xa8018
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x46c02
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x46013
movq %r14, %rdi
callq 0x11170
callq 0x117d0
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::DrawBBox(int) const
void RGBDImage::
DrawBBox(int color_scheme) const
{
  // Load color
  if (color_scheme == RGBD_NO_COLOR_SCHEME) LoadColor(color_scheme);
  else if (color_scheme == RGBD_HIGHLIGHT_COLOR_SCHEME) LoadColor(color_scheme);
  else if (color_scheme != RGBD_NO_COLOR_SCHEME) LoadColor(RGBD_INDEX_COLOR_SCHEME);

  // Outline bounding box
  WorldBBox().Outline();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
xorl %ecx, %ecx
cmpl $0x4, %esi
sete %cl
addl $0x3, %ecx
testl %esi, %esi
cmovnel %ecx, %esi
callq *0xf0(%rax)
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1bf2a
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x3f334
movq %rsp, %rdi
callq 0x3ee72
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3ee72
movq %rbx, %rdi
callq 0x11a80
nop