LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDTransform.cpp
// Function: gaps::RGBDTransformImageToSurface(gaps::R2Point const&, gaps::R2Point&, gaps::RGBDImage const*, gaps::RGBDSurface const*)
int RGBDTransformImageToSurface(const R2Point& image_position, R2Point& surface_position, const RGBDImage *image, const RGBDSurface *surface)
{
  // Transform from position in image coordinates to surface coordinates
  R3Point world_position;
  if (!RGBDTransformImageToWorld(image_position, world_position, image)) return 0;
  if (!RGBDTransformWorldToSurface(world_position, surface_position, surface)) return 0;
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x4be44
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x16443
testl %eax, %eax
je 0x164f7
movq (%r14), %rax
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq *0x50(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x164f9
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::~RGBDConfiguration()
RGBDConfiguration::
~RGBDConfiguration(void)
{
  // Delete everything
  while (NImages() > 0) delete Image(NImages()-1);
  while (NSurfaces() > 0) delete Surface(NSurfaces()-1);

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

  // Delete directory names
  if (color_directory) free(color_directory);
  if (depth_directory) free(depth_directory);
  if (category_directory) free(category_directory);
  if (instance_directory) free(instance_directory);
  if (texture_directory) free(texture_directory);

  // Delete dataset format
  if (dataset_format) free(dataset_format);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xeb6a5(%rip), %rax     # 0x101c60
movq %rax, (%rdi)
movl 0x14(%rdi), %eax
testl %eax, %eax
jle 0x165f6
movq 0x8(%rbx), %rcx
movl %eax, %eax
movq -0x8(%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x165db
movq (%rdi), %rax
callq *0x8(%rax)
movl 0x14(%rbx), %eax
jmp 0x165c1
movq 0x18(%rbx), %rcx
movl %eax, %eax
movq -0x8(%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x165f6
movq (%rdi), %rax
callq *0x8(%rax)
movl 0x24(%rbx), %eax
testl %eax, %eax
jg 0x165e0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x1660b
callq 0x11720
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x16619
callq 0x11720
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x16627
callq 0x11720
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x16635
callq 0x11720
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x16643
callq 0x11720
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x16651
callq 0x11720
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x1665f
callq 0x11720
leaq 0x60(%rbx), %rdi
callq 0x444d0
leaq 0x18(%rbx), %rdi
callq 0x7627e
addq $0x8, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x7627e
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::WorldCentroid() const
R3Point RGBDConfiguration::
WorldCentroid(void) const
{
  // Compute weighed sum of surface centroids
  RNArea weight = 0;
  R3Point position = R3zero_point;
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    position += surface->WorldArea() * surface->WorldCentroid();
    weight += surface->WorldArea();
  }

  // Return weighted average
  if (RNIsZero(weight)) return R3zero_point;
  return position / weight;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
leaq 0xf14fd(%rip), %rsi     # 0x107bb0
leaq 0x20(%rsp), %rdi
callq 0x4be56
cmpl $0x0, 0x24(%r14)
jle 0x167b8
xorpd %xmm2, %xmm2
xorl %r15d, %r15d
leaq 0x38(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rbx
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
movsd %xmm2, 0x18(%rsp)
je 0x16700
movq (%rdi), %rax
callq *0x58(%rax)
jmp 0x16716
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x16713
callq 0x2c0d8
jmp 0x16716
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x80(%rbx), %rsi
testq %rsi, %rsi
je 0x16733
movq (%rsi), %rax
movq %r12, %rdi
callq *0x68(%rax)
jmp 0x16755
movq 0x88(%rbx), %rsi
movq %r12, %rdi
testq %rsi, %rsi
je 0x16749
callq 0x2bf14
jmp 0x16755
leaq 0xf1460(%rip), %rsi     # 0x107bb0
callq 0x4be56
movq %r13, %rdi
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x4c890
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4c786
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x16785
movq (%rdi), %rax
callq *0x58(%rax)
jmp 0x1679c
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x16798
callq 0x2c0d8
jmp 0x1679c
xorpd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm2
addsd %xmm0, %xmm2
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x166de
jmp 0x167bc
xorpd %xmm2, %xmm2
leaq 0xf0525(%rip), %rax     # 0x106ce8
movsd (%rax), %xmm0
movapd 0xa6881(%rip), %xmm1    # 0xbd050
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x167f5
ucomisd %xmm2, %xmm0
jb 0x167f5
leaq 0xf13ca(%rip), %rsi     # 0x107bb0
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4be56
jmp 0x1680b
leaq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm2, %xmm0
callq 0x4c8b2
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::InsertImage(gaps::RGBDImage*)
void RGBDConfiguration::
InsertImage(RGBDImage *image)
{
  // Just checking
  assert(image);
  assert(image->configuration == NULL);
  assert(image->configuration_index == -1);

  // Insert image into configuration
  image->configuration = this;
  image->configuration_index = images.NEntries();
  images.Insert(image);

  // Update bounding box
  world_bbox.Union(image->WorldBBox());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rdi, 0x8(%rsi)
addq $0x8, %rdi
movl 0x14(%r14), %edx
movl %edx, 0x10(%rsi)
callq 0x762aa
addq $0x60, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1d50c
movq %r14, %rdi
movq %r15, %rsi
callq 0x44160
leaq 0x8(%rsp), %rdi
callq 0x444d0
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x444d0
movq %rbx, %rdi
callq 0x11a70
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::RemoveImage(gaps::RGBDImage*)
void RGBDConfiguration::
RemoveImage(RGBDImage *image)
{
  // Just checking
  assert(image);
  assert(image->configuration == this);
  assert(image->configuration_index >= 0);
  assert(images.Kth(image->configuration_index) == image);

  // Remove image from configuration
  RNArrayEntry *entry = images.KthEntry(image->configuration_index);
  RGBDImage *tail = images.Tail();
  tail->configuration_index = image->configuration_index;
  images.EntryContents(entry) = tail;
  images.RemoveTail();
  image->configuration_index = -1;
  image->configuration = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x8(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x8(%rdi), %rdx
movslq 0x14(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movl %ecx, 0x10(%rdi)
movq %rdi, (%rdx,%rcx,8)
decl %esi
movq %rax, %rdi
callq 0x7641e
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::InsertSurface(gaps::RGBDSurface*)
void RGBDConfiguration::
InsertSurface(RGBDSurface *surface)
{
  // Just checking
  assert(surface);
  assert(surface->configuration == NULL);
  assert(surface->configuration_index == -1);

  // Insert surface into configuration
  surface->configuration = this;
  surface->configuration_index = surfaces.NEntries();
  surfaces.Insert(surface);

  // Update bounding box
  world_bbox.Union(surface->WorldBBox());
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsi)
addq $0x18, %rdi
movl 0x24(%rbx), %edx
movl %edx, 0x10(%rsi)
callq 0x762aa
addq $0x60, %rbx
movq 0x80(%r14), %rsi
testq %rsi, %rsi
je 0x16904
movq (%rsi), %rax
movq %rsp, %rdi
callq *0x88(%rax)
jmp 0x16928
movq 0x88(%r14), %rsi
testq %rsi, %rsi
je 0x16919
addq $0xf8, %rsi
jmp 0x16920
leaq 0xf0a18(%rip), %rsi     # 0x107338
movq %rsp, %rdi
callq 0x43678
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x44160
movq %rsp, %rdi
callq 0x444d0
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x444d0
movq %rbx, %rdi
callq 0x11a70
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::RemoveSurface(gaps::RGBDSurface*)
void RGBDConfiguration::
RemoveSurface(RGBDSurface *surface)
{
  // Just checking
  assert(surface);
  assert(surface->configuration == this);
  assert(surface->configuration_index >= 0);
  assert(surfaces.Kth(surface->configuration_index) == surface);

  // Remove surface from configuration
  RNArrayEntry *entry = surfaces.KthEntry(surface->configuration_index);
  RGBDSurface *tail = surfaces.Tail();
  tail->configuration_index = surface->configuration_index;
  surfaces.EntryContents(entry) = tail;
  surfaces.RemoveTail();
  surface->configuration_index = -1;
  surface->configuration = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x18(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x18(%rdi), %rdx
movslq 0x24(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movl %ecx, 0x10(%rdi)
movq %rdi, (%rdx,%rcx,8)
decl %esi
movq %rax, %rdi
callq 0x7641e
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::Transform(gaps::R3Transformation const&)
void RGBDConfiguration::
Transform(const R3Transformation& transformation)
{
  // Transform images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->Transform(transformation);
  }
  
  // Transform surfaces
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    surface->Transform(transformation);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0x14(%rdi)
jle 0x169c6
xorl %r15d, %r15d
movq 0x8(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x88(%rax)
incq %r15
movslq 0x14(%r14), %rax
cmpq %rax, %r15
jl 0x169a6
cmpl $0x0, 0x24(%r14)
jle 0x169ed
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x30(%rax)
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x169d0
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadFile(char const*, int)
int RGBDConfiguration::
ReadFile(const char *filename, int read_every_kth_image)
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .conf)\n", filename);
    return 0;
  }

  // Read file of appropriate type
  if (!strncmp(extension, ".conf", 5)) {
    if (!ReadConfigurationFile(filename, read_every_kth_image)) return 0;
  }
  else if (!strncmp(extension, ".json", 5)) {
    if (!ReadNeRFFile(filename, read_every_kth_image)) return 0;
  }
  else if (!strncmp(extension, ".seg", 4)) {
    if (!ReadSegmentationFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".obb", 4)) {
    if (!ReadOrientedBoxFile(filename)) return 0;
  }
  else {
    RNFail("Unable to read file %s (unrecognized extension: %s)\n", filename, extension);
    return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x11640
testq %rax, %rax
je 0x16c88
movq %rax, %r15
leaq 0xa69c5(%rip), %rsi     # 0xbd5dc
movl $0x5, %edx
movq %rax, %rdi
callq 0x11290
testl %eax, %eax
je 0x16c9d
leaq 0xa69b3(%rip), %rsi     # 0xbd5e2
movl $0x5, %edx
movq %r15, %rdi
callq 0x11290
testl %eax, %eax
je 0x16cad
leaq 0xa69a1(%rip), %rsi     # 0xbd5e8
movl $0x4, %edx
movq %r15, %rdi
callq 0x11290
testl %eax, %eax
je 0x16cc0
leaq 0xa698e(%rip), %rsi     # 0xbd5ed
movl $0x4, %edx
movq %r15, %rdi
callq 0x11290
testl %eax, %eax
je 0x16cd1
leaq 0xa697b(%rip), %rdi     # 0xbd5f2
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x79092
jmp 0x16ced
leaq 0xa6921(%rip), %rdi     # 0xbd5b0
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x11080
jmp 0x16ced
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0x78(%rax)
jmp 0x16ce0
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0x80(%rax)
jmp 0x16ce0
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x88(%rax)
jmp 0x16ce0
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x90(%rax)
testl %eax, %eax
je 0x16ceb
movl $0x1, %ebp
jmp 0x16ced
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::WriteFile(char const*, int) const
int RGBDConfiguration::
WriteFile(const char *filename, int write_every_kth_image) const
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .conf)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".conf", 5)) {
    if (!WriteConfigurationFile(filename, write_every_kth_image)) return 0;
  }
  else if (!strncmp(extension, ".json", 5)) {
    if (!WriteNeRFFile(filename, write_every_kth_image)) return 0;
  }
  else if (!strncmp(extension, ".cam", 4)) {
    if (!WriteCameraFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".obj", 4)) {
    if (!WriteObjFile(filename)) return 0;
  }
  else {
    RNFail("Unable to write file %s (unrecognized extension: %s)\n", filename, extension);
    return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x11640
testq %rax, %rax
je 0x16d96
movq %rax, %r15
leaq 0xa68b7(%rip), %rsi     # 0xbd5dc
movl $0x5, %edx
movq %rax, %rdi
callq 0x11290
testl %eax, %eax
je 0x16dab
leaq 0xa68a5(%rip), %rsi     # 0xbd5e2
movl $0x5, %edx
movq %r15, %rdi
callq 0x11290
testl %eax, %eax
je 0x16dbe
leaq 0xa68d2(%rip), %rsi     # 0xbd627
movl $0x4, %edx
movq %r15, %rdi
callq 0x11290
testl %eax, %eax
je 0x16dd1
leaq 0xa68bf(%rip), %rsi     # 0xbd62c
movl $0x4, %edx
movq %r15, %rdi
callq 0x11290
testl %eax, %eax
je 0x16de7
leaq 0xa68ac(%rip), %rdi     # 0xbd631
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x79092
jmp 0x16e03
leaq 0xa6813(%rip), %rdi     # 0xbd5b0
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x11080
jmp 0x16e03
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0xa0(%rax)
jmp 0x16df6
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0xa8(%rax)
jmp 0x16df6
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq *0xb0(%rax)
jmp 0x16df6
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0xb8(%rax)
testl %eax, %eax
je 0x16e01
movl $0x1, %ebp
jmp 0x16e03
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadConfigurationFile(char const*, int)
int RGBDConfiguration::
ReadConfigurationFile(const char *filename, int read_every_kth_image)
{
  // Open file
  FILE *fp = fopen(filename, "r");
  if (!fp) {
    RNFail("Unable to open configuration file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadConfigurationStream(fp, read_every_kth_image)) return 0;
  
  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
leaq 0xacc0c(%rip), %rsi     # 0xc3a33
movq %r15, %rdi
callq 0x11710
testq %rax, %rax
je 0x16e5c
movq %rax, %r14
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq *0xc0(%rax)
testl %eax, %eax
je 0x16e71
movq %r14, %rdi
callq 0x115a0
movl $0x1, %ebx
jmp 0x16e73
leaq 0xa6804(%rip), %rdi     # 0xbd667
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x79092
jmp 0x16e73
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::WriteConfigurationFile(char const*, int) const
int RGBDConfiguration::
WriteConfigurationFile(const char *filename, int write_every_kth_image) const
{
#if 0
  // Create directories
  char cmd[4096];
  if (color_directory) { sprintf(cmd, "mkdir -p %s", color_directory); system(cmd); }
  if (depth_directory) { sprintf(cmd, "mkdir -p %s", depth_directory); system(cmd); }
  if (category_directory) { sprintf(cmd, "mkdir -p %s", category_directory); system(cmd); }
  if (instance_directory) { sprintf(cmd, "mkdir -p %s", instance_directory); system(cmd); }
  if (texture_directory) { sprintf(cmd, "mkdir -p %s", texture_directory); system(cmd); }
#endif

  // Open file
  FILE *fp = fopen(filename, "w");
  if (!fp) {
    RNFail("Unable to open configuration file %s\n", filename);
    return 0;
  }

  // Write file
  if (!WriteConfigurationStream(fp, write_every_kth_image)) return 0;

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
leaq 0xa8db1(%rip), %rsi     # 0xbfc4a
movq %r15, %rdi
callq 0x11710
testq %rax, %rax
je 0x16ece
movq %rax, %r14
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq *0xc8(%rax)
testl %eax, %eax
je 0x16ee3
movq %r14, %rdi
callq 0x115a0
movl $0x1, %ebx
jmp 0x16ee5
leaq 0xa6792(%rip), %rdi     # 0xbd667
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x79092
jmp 0x16ee5
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::GetJsonObjectMember(Json::Value*&, Json::Value*, char const*, int)
static int
GetJsonObjectMember(Json::Value *&result, Json::Value *object, const char *str, int expected_type = 0)
{
  // Check object type
  if (object->type() != Json::objectValue) {
    // RNFail("JSON: not an object\n");
    return 0;
  }

  // Check object member
  if (!object->isMember(str)) {
    // RNFail("JSON object has no member named %s\n", str);
    return 0;
  }

  // Get object member
  result = &((*object)[str]);
  if (result->type() == Json::nullValue) {
    // RNFail("JSON object has null member named %s\n", str);
    return 0;
  }

  // Check member type
  if (expected_type > 0) {
    if (result->type() != expected_type) {
      // RNFail("JSON object member %s has unexpected type %d (rather than %d)\n", str, result->type(), expected_type);
      return 0;
    }
  }
  
  // Check for empty strings
  if (result->type() == Json::stringValue) {
    if (result->asString().length() == 0) {
      // RNFail("JSON object has zero length string named %s\n", str);
      return 0;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x82596
xorl %ebx, %ebx
cmpl $0x7, %eax
jne 0x1985c
movq %r12, %rdi
movq %r15, %rsi
callq 0x849ec
testb %al, %al
je 0x1985c
movq %r12, %rdi
movq %r15, %rsi
callq 0x815cc
movq %rax, (%r14)
movq %rax, %rdi
callq 0x82596
testl %eax, %eax
je 0x1985c
movq (%r14), %rdi
callq 0x82596
cmpl $0x4, %eax
jne 0x19857
movq (%r14), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x7b3a0
movq (%r14), %rdi
movq 0x8(%r14), %r14
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x19852
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x115c0
testq %r14, %r14
je 0x1985c
movl $0x1, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::GetJsonArrayEntry(Json::Value*&, Json::Value*, unsigned int, int)
static int
GetJsonArrayEntry(Json::Value *&result, Json::Value *array, unsigned int k, int expected_type = -1)
{
  // Check array type
  if (array->type() != Json::arrayValue) {
    RNFail("JSON: not an array\n");
    return 0;
  }

  // Check array size
  if (array->size() <= k) {
    // RNFail("JSON array has no member %d\n", k);
    return 0;
  }

  // Get entry
  result = &((*array)[k]);
  if (result->type() == Json::nullValue) {
    // RNFail("JSON array has null member %d\n", k);
    return 0;
  }

  // Check entry type
  if (expected_type > 0) {
    if (result->type() != expected_type) {
      // RNFail("JSON array entry %d has unexpected type %d (rather than %d)\n", k, result->type(), expected_type);
      return 0;
    }
  }
  
  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x82596
cmpl $0x6, %eax
jne 0x198a8
movq %r14, %rdi
callq 0x80e7c
cmpl %ebp, %eax
jbe 0x198ba
movq %r14, %rdi
movl %ebp, %esi
callq 0x83824
movq %rax, (%rbx)
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x82596
leaq 0xa4560(%rip), %rdi     # 0xbde0f
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x79092
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadChannels()
int RGBDConfiguration::
ReadChannels(void)
{
  // Read images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReadChannels();
  }

  // Read surfaces
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    surface->ReadChannels();
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x14(%rdi)
jle 0x1a217
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0xf8(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a1fa
cmpl $0x0, 0x24(%rbx)
jle 0x1a23d
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x1a220
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReleaseChannels()
int RGBDConfiguration::
ReleaseChannels(void)
{
  // Release images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReleaseChannels();
  }

  // Release surfaces
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    surface->ReleaseChannels();
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x14(%rdi)
jle 0x1a277
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x148(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a25a
cmpl $0x0, 0x24(%rbx)
jle 0x1a29d
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x1a280
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadColorChannels()
int RGBDConfiguration::
ReadColorChannels(void)
{
  // Read images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReadColorChannels();
  }

  // Read surfaces
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    surface->ReadColorChannels();
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x14(%rdi)
jle 0x1a2d7
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x100(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a2ba
cmpl $0x0, 0x24(%rbx)
jle 0x1a2fd
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x1a2e0
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReleaseColorChannels()
int RGBDConfiguration::
ReleaseColorChannels(void)
{
  // Release images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReleaseColorChannels();
  }

  // Release surfaces
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    surface->ReleaseColorChannels();
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x14(%rdi)
jle 0x1a337
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x150(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a31a
cmpl $0x0, 0x24(%rbx)
jle 0x1a35d
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0xb0(%rax)
incq %r14
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jl 0x1a340
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadDepthChannels()
int RGBDConfiguration::
ReadDepthChannels(void)
{
  // Read images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReadDepthChannel();
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x1a39e
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x108(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a37a
addq $0x8, %rsp
popq %rbx
popq %r14
movl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReleaseDepthChannels()
int RGBDConfiguration::
ReleaseDepthChannels(void)
{
  // Release images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReleaseDepthChannel();
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x1a3d8
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x158(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a3b4
addq $0x8, %rsp
popq %rbx
popq %r14
movl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadCategoryChannels()
int RGBDConfiguration::
ReadCategoryChannels(void)
{
  // Read images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReadCategoryChannel();
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x1a412
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x110(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a3ee
addq $0x8, %rsp
popq %rbx
popq %r14
movl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReleaseCategoryChannels()
int RGBDConfiguration::
ReleaseCategoryChannels(void)
{
  // Release images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReleaseCategoryChannel();
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x1a44c
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x160(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a428
addq $0x8, %rsp
popq %rbx
popq %r14
movl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadInstanceChannels()
int RGBDConfiguration::
ReadInstanceChannels(void)
{
  // Read images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReadInstanceChannel();
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x1a486
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x118(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a462
addq $0x8, %rsp
popq %rbx
popq %r14
movl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReleaseInstanceChannels()
int RGBDConfiguration::
ReleaseInstanceChannels(void)
{
  // Release images
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    image->ReleaseInstanceChannel();
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x1a4c0
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x168(%rax)
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x1a49c
addq $0x8, %rsp
popq %rbx
popq %r14
movl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::UpdateWorldBBox()
void RGBDConfiguration::
UpdateWorldBBox(void)
{
  // Initialize bounding box
  world_bbox = R3null_box;

  // Union image bounding boxes
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    world_bbox.Union(image->WorldViewpoint());
    if (!image->world_bbox.IsEmpty()) {
      world_bbox.Union(image->world_bbox);
    }
  }

  // Union surface bounding boxes
  for (int i = 0; i < NSurfaces(); i++) {
    RGBDSurface *surface = Surface(i);
    world_bbox.Union(surface->WorldBBox());
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x60(%rdi), %r14
addq $0x68, %rdi
leaq 0xecdf6(%rip), %r15     # 0x107338
leaq 0x8(%r15), %rsi
callq 0x4c1b4
leaq 0x80(%rbx), %rdi
addq $0x20, %r15
movq %r15, %rsi
callq 0x4c1b4
cmpl $0x0, 0x14(%rbx)
jle 0x1a5f0
xorl %ebp, %ebp
leaq 0xed63f(%rip), %r15     # 0x107bb0
movq %rsp, %r12
movq 0x8(%rbx), %rax
movq (%rax,%rbp,8), %r13
leaq 0x38(%r13), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4a83e
movq %r14, %rdi
movq %r12, %rsi
callq 0x44096
movsd 0x190(%r13), %xmm0
ucomisd 0x1a8(%r13), %xmm0
ja 0x1a5e4
movsd 0x198(%r13), %xmm0
ucomisd 0x1b0(%r13), %xmm0
ja 0x1a5e4
movsd 0x1a0(%r13), %xmm0
ucomisd 0x1b8(%r13), %xmm0
ja 0x1a5e4
addq $0x188, %r13            # imm = 0x188
movq %r14, %rdi
movq %r13, %rsi
callq 0x44160
incq %rbp
movslq 0x14(%rbx), %rax
cmpq %rax, %rbp
jl 0x1a574
cmpl $0x0, 0x24(%rbx)
jle 0x1a667
xorl %r13d, %r13d
leaq 0xecd38(%rip), %r15     # 0x107338
movq %rsp, %r12
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rax
movq 0x80(%rax), %rsi
testq %rsi, %rsi
je 0x1a625
movq (%rsi), %rax
movq %r12, %rdi
callq *0x88(%rax)
jmp 0x1a648
movq 0x88(%rax), %rsi
testq %rsi, %rsi
je 0x1a63d
addq $0xf8, %rsi
movq %r12, %rdi
jmp 0x1a643
movq %r12, %rdi
movq %r15, %rsi
callq 0x43678
movq %r14, %rdi
movq %r12, %rsi
callq 0x44160
movq %r12, %rdi
callq 0x444d0
incq %r13
movslq 0x24(%rbx), %rax
cmpq %rax, %r13
jl 0x1a603
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x444d0
movq %rbx, %rdi
callq 0x11a70
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::FindImage(char const*) const
RGBDImage *RGBDConfiguration::
FindImage(const char *name) const
{
  // Find image with matching name
  for (int i = 0; i < NImages(); i++) {
    RGBDImage *image = Image(i);
    if (image->Name() && !strcmp(image->Name(), name)) return image;
  }

  // Image not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x14(%rdi), %r15
testq %r15, %r15
jle 0x1a715
movq %rsi, %rbx
movq 0x8(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x1d0(%rbp), %rdi
testq %rdi, %rdi
je 0x1a700
movq %rbx, %rsi
callq 0x11850
testl %eax, %eax
je 0x1a704
movb $0x1, %al
jmp 0x1a709
xorl %eax, %eax
movq %rbp, %r14
testb %al, %al
je 0x1a718
incq %r13
cmpq %r13, %r15
jne 0x1a6e4
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::RGBDSurface(char const*, gaps::R3Rectangle*, double)
RGBDSurface::
RGBDSurface(const char *texture_filename, R3Rectangle *rectangle, RNLength texel_spacing)
  : configuration(NULL),
    configuration_index(-1),
    channels(),
    width(0), height(0),
    opengl_texture_id(-1),
    texture_filename(NULL),
    mesh_filename(NULL),
    surface_bbox(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX),
    color_resident_count(0),
    data(NULL),
    rectangle(rectangle),
    mesh(NULL),
    mesh_face_index(NULL),
    thickness(0)
{
  // Check rectangle
  if (!rectangle) return;
  
  // Set texture filename
  SetTextureFilename(texture_filename);

  // Compute coordinate stuff
  RNLength xlength = 2*rectangle->Radius(0);
  RNLength ylength = 2*rectangle->Radius(1);
  if (texel_spacing <= 0) texel_spacing = 0.01;
  width = (int) (xlength / texel_spacing + 0.5);
  height = (int) (ylength / texel_spacing + 0.5);
  if (width <= 0) width = 1;
  if (height <= 0) height = 1;

  // Compute bounding box of surface coordinates
  surface_bbox.Reset(R2zero_point, R2Point(xlength, ylength));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movaps %xmm0, (%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
leaq 0xe7114(%rip), %rax     # 0x101db8
movq %rax, (%rdi)
xorl %r14d, %r14d
movq %r14, 0x8(%rdi)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, 0x10(%rdi)
leaq 0x18(%rdi), %rbx
movq %rbx, %rdi
callq 0x76214
movq %r14, 0x28(%r15)
movl %ebp, 0x30(%r15)
leaq 0x48(%r15), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r15)
movsd 0xa2352(%rip), %xmm0    # 0xbd030
movsd 0xa235a(%rip), %xmm2    # 0xbd040
movq %r14, %rdi
movapd %xmm0, %xmm1
movapd %xmm2, %xmm3
callq 0x6d1d4
movl $0x0, 0x70(%r15)
xorl %eax, %eax
movq %rax, 0x78(%r15)
movq %r12, 0x80(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x88(%r15)
movq %rax, 0x98(%r15)
testq %r12, %r12
je 0x1add1
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
callq *0xc0(%rax)
xorpd %xmm0, %xmm0
movapd (%rsp), %xmm2
movapd %xmm2, %xmm1
cmpnlesd %xmm0, %xmm1
andpd %xmm1, %xmm2
movsd 0xa275b(%rip), %xmm0    # 0xbd4b0
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movupd 0x68(%r12), %xmm0
addpd %xmm0, %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movapd %xmm0, %xmm2
divpd %xmm1, %xmm2
addpd 0xa3124(%rip), %xmm2    # 0xbdea0
cvttpd2dq %xmm2, %xmm1
movd %xmm1, %eax
movq %xmm1, 0x28(%r15)
testl %eax, %eax
jg 0x1ad96
movl $0x1, 0x28(%r15)
pshufd $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movd %xmm1, %eax
testl %eax, %eax
jg 0x1adab
movl $0x1, 0x2c(%r15)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
leaq 0x18(%rsp), %rdi
callq 0x6fee6
leaq 0xee68c(%rip), %rsi     # 0x109450
leaq 0x18(%rsp), %rdx
movq %r14, %rdi
callq 0x6d9fe
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1ade7
movq %rax, %r15
jmp 0x1adf2
movq %rax, %r15
movq %r14, %rdi
callq 0x6da54
movq %rbx, %rdi
callq 0x7627e
movq %r15, %rdi
callq 0x11a70
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::~RGBDSurface()
RGBDSurface::
~RGBDSurface(void)
{
  // Delete opengl texture
  InvalidateOpenGL();
  
  // Remove from configuration
  if (configuration) {
    configuration->RemoveSurface(this);
  }

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

  // Delete filenames
  if (texture_filename) free(texture_filename);
  if (mesh_filename) free(mesh_filename);

  // Delete mesh face index
  if (mesh_face_index) delete mesh_face_index;

  // Delete geometry stuff
  if (rectangle) delete rectangle;
  if (mesh) delete mesh;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xe6d96(%rip), %rax     # 0x101db8
movq %rax, (%rdi)
movl 0x30(%rdi), %eax
testl %eax, %eax
jle 0x1b03d
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movl $0x1, %edi
callq 0x11810
movl $0xffffffff, 0x30(%rbx) # imm = 0xFFFFFFFF
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1b056
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x28(%rax)
leaq 0x18(%rbx), %r14
cmpl $0x0, 0x24(%rbx)
jle 0x1b090
xorl %r12d, %r12d
movq (%r14), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x1b084
movq %r15, %rdi
callq 0x60ff0
movl $0xd0, %esi
movq %r15, %rdi
callq 0x115c0
incq %r12
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jl 0x1b063
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x1b09e
callq 0x11720
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x1b0ac
callq 0x11720
movq 0x90(%rbx), %r15
testq %r15, %r15
je 0x1b0cd
movq %r15, %rdi
callq 0x60ff0
movl $0xd0, %esi
movq %r15, %rdi
callq 0x115c0
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x1b0df
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x1b0f1
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x48, %rbx
movq %rbx, %rdi
callq 0x6da54
movq %r14, %rdi
callq 0x7627e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x1a90d
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::TexelColor(int, int) const
RNRgb RGBDSurface::
TexelColor(int ix, int iy) const
{
  // Return color of pixel
  if (NChannels() < 3) return RNblack_rgb;
  RNScalar r = TexelChannelValue(ix, iy, RGBD_RED_CHANNEL);
  RNScalar g = TexelChannelValue(ix, iy, RGBD_GREEN_CHANNEL);
  RNScalar b = TexelChannelValue(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 0x1b159
leaq 0xee3b4(%rip), %rsi     # 0x109500
movq %rbx, %rdi
callq 0x7606a
jmp 0x1b248
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq 0x18(%rsi), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x1b189
movq 0xb8(%rax), %rcx
movl 0xc8(%rax), %eax
imull %ebp, %eax
addl %r14d, %eax
cltq
movsd (%rcx,%rax,8), %xmm0
jmp 0x1b19f
leaq 0xa2d7e(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
callq 0x79092
movsd 0xa1e79(%rip), %xmm0    # 0xbd018
movq 0x18(%r15), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x1b1c8
movq 0xb8(%rax), %rcx
movl 0xc8(%rax), %eax
imull %ebp, %eax
addl %r14d, %eax
cltq
movsd (%rcx,%rax,8), %xmm1
jmp 0x1b1ea
leaq 0xa2d3f(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
movsd %xmm0, 0x8(%rsp)
callq 0x79092
movsd 0x8(%rsp), %xmm0
movsd 0xa1e2e(%rip), %xmm1    # 0xbd018
movq 0x18(%r15), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x1b212
imull 0xc8(%rax), %ebp
movq 0xb8(%rax), %rax
addl %r14d, %ebp
movslq %ebp, %rcx
movsd (%rax,%rcx,8), %xmm2
jmp 0x1b240
leaq 0xa2cf5(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, 0x10(%rsp)
callq 0x79092
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
movsd 0xa1dd8(%rip), %xmm2    # 0xbd018
movq %rbx, %rdi
callq 0x76088
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::TexelWorldNormal(gaps::R2Point const&) const
R3Vector RGBDSurface::
TexelWorldNormal(const R2Point& texture_position) const
{
  // Return surface normal
  if (rectangle) {
    return rectangle->Normal();
  }
  else if (mesh) {
    double barycentrics[3];
    R3MeshFace *face = SearchMeshFaceIndex(texture_position, barycentrics);
    if (!face) return R3zero_vector;
    else return mesh->FaceNormal(face);
  }
  else {
    return R3zero_vector;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x80(%rsi), %rsi
testq %rsi, %rsi
je 0x1b35e
addq $0x50, %rsi
movq %rbx, %rdi
jmp 0x1b3bd
cmpq $0x0, 0x88(%r14)
je 0x1b3a7
movq (%r14), %rcx
movq %rsp, %rax
movq %r14, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq *0xe8(%rcx)
testq %rax, %rax
je 0x1b3b0
movq %rax, %r15
testb $0x4, 0xa8(%rax)
jne 0x1b3a1
movq 0x88(%r14), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x2c8(%rax)
addq $0x38, %r15
jmp 0x1b3b7
leaq 0xa3b92(%rip), %rsi     # 0xbef40
jmp 0x1b359
leaq 0xa3b89(%rip), %r15     # 0xbef40
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4c8ee
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::TexelColor(gaps::R2Point const&) const
RNRgb RGBDSurface::
TexelColor(const R2Point& texture_position) const
{
  // Return color of pixel
  if (NChannels() < 3) return RNblack_rgb;
  RNScalar r = TexelChannelValue(texture_position, RGBD_RED_CHANNEL);
  RNScalar g = TexelChannelValue(texture_position, RGBD_GREEN_CHANNEL);
  RNScalar b = TexelChannelValue(texture_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 0x1b3f6
leaq 0xee117(%rip), %rsi     # 0x109500
movq %rbx, %rdi
callq 0x7606a
jmp 0x1b4bb
movq %rdx, %r14
movq %rsi, %r15
movq 0x18(%rsi), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1b41a
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0x6174e
jmp 0x1b430
leaq 0xa2aed(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
callq 0x79092
movsd 0xa1be8(%rip), %xmm0    # 0xbd018
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r15), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x1b455
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0x6174e
jmp 0x1b46b
leaq 0xa2ab2(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
callq 0x79092
movsd 0xa1bad(%rip), %xmm0    # 0xbd018
movsd %xmm0, (%rsp)
movq 0x18(%r15), %rax
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b492
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
callq 0x6174e
movaps %xmm0, %xmm2
jmp 0x1b4a8
leaq 0xa2a75(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
callq 0x79092
movsd 0xa1b70(%rip), %xmm2    # 0xbd018
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0x76088
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::SurfelColor(gaps::R2Point const&) const
RNRgb RGBDSurface::
SurfelColor(const R2Point& surface_position) const
{
  // Return color of texture at surface point
  R2Point texture_position;
  if (!TransformSurfaceToTexture(surface_position, texture_position)) return RNblack_rgb;
  return TexelColor(texture_position);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x6fee4
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x40(%rax)
testl %eax, %eax
je 0x1b50e
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1b3d0
jmp 0x1b51d
leaq 0xedfeb(%rip), %rsi     # 0x109500
movq %rbx, %rdi
callq 0x7606a
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::SurfelChannelValue(gaps::R2Point const&, int) const
RNScalar RGBDSurface::
SurfelChannelValue(const R2Point& surface_position, int channel_index) const
{
  // Return
  R2Point texture_position;
  if (!TransformSurfaceToTexture(surface_position, texture_position)) return 0;
  return TexelChannelValue(texture_position, channel_index);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x6fee4
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x40(%rax)
testl %eax, %eax
je 0x1b616
movq 0x18(%r14), %rax
movslq %ebx, %rcx
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0x1b61b
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
callq 0x6174e
jmp 0x1b631
xorps %xmm0, %xmm0
jmp 0x1b631
leaq 0xa28ec(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
callq 0x79092
movsd 0xa19e7(%rip), %xmm0    # 0xbd018
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::SetTexelColor(int, int, gaps::RNRgb const&)
void RGBDSurface::
SetTexelColor(int ix, int iy, const RNRgb& color)
{
  // Set pixel red, green, and blue
  SetTexelChannelValue(ix, iy, RGBD_RED_CHANNEL, color.R());
  SetTexelChannelValue(ix, iy, RGBD_GREEN_CHANNEL, color.G());
  SetTexelChannelValue(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 *0x18(%rax)
movsd 0x8(%r14), %xmm0
movq (%rbx), %rax
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
movl $0x1, %ecx
callq *0x18(%rax)
movsd 0x10(%r14), %xmm0
movq (%rbx), %rax
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
movl $0x2, %ecx
callq *0x18(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0xd8(%rax)
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/../../pkgs/RNBasics/RNArray.hh
// Function: gaps::RGBDSurface::SetTexelChannelValue(int, int, int, double)
inline void *&RNVArray::
operator[](int k)
{
    // Return reference to kth data element
    assert(entries);
    assert(nentries >= 0);
    assert((k >= 0) && (k < nentries));
    return entries[k];
}

// Assembly:
movq 0x18(%rdi), %rax
movslq %ecx, %r8
movq (%rax,%r8,8), %rax
testq %rax, %rax
je 0x1b6fd
testl %ecx, %ecx
js 0x1b6fc
testl %esi, %esi
js 0x1b6fc
cmpl %ecx, 0x24(%rdi)
jle 0x1b6fc
testl %edx, %edx
js 0x1b6fc
cmpl %esi, 0xc0(%rax)
jle 0x1b6fc
cmpl %esi, 0xc4(%rax)
jle 0x1b6fc
movq 0xb8(%rax), %r8
imull 0xc8(%rax), %edx
addl %esi, %edx
movslq %edx, %rax
movsd %xmm0, (%r8,%rax,8)
cmpl $0x2, %ecx
jg 0x1b6fc
movq (%rdi), %rax
jmpq *0xd8(%rax)
retq
leaq 0xa280a(%rip), %rdi     # 0xbdf0e
xorl %eax, %eax
jmp 0x79092
nop