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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x45d4a
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x90(%rax)
testl %eax, %eax
je 0x15c41
movq (%r14), %rax
movq %rsp, %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq *0xa0(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x15c43
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x45d4a
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x15bef
testl %eax, %eax
je 0x15ca3
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 0x15ca5
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0xdcf19(%rip), %rax     # 0xf2c80
movq %rax, (%rdi)
leaq 0x8(%rdi), %rbx
movslq 0x14(%r14), %rax
testq %rax, %rax
jle 0x15d8c
movq (%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x15d6e
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x15d6e
leaq 0x18(%r14), %r15
movslq 0x24(%r14), %rax
testq %rax, %rax
jle 0x15dae
movq (%r15), %rcx
movq -0x8(%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x15d90
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x15d90
movq 0x28(%r14), %rdi
callq 0x11710
movq 0x30(%r14), %rdi
callq 0x11710
movq 0x38(%r14), %rdi
callq 0x11710
movq 0x40(%r14), %rdi
callq 0x11710
movq 0x48(%r14), %rdi
callq 0x11710
movq 0x50(%r14), %rdi
callq 0x11710
movq 0x58(%r14), %rdi
callq 0x11710
addq $0x60, %r14
movq %r14, %rdi
callq 0x3ee72
movq %r15, %rdi
callq 0x6c128
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6c128
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x8(%rsp)
leaq 0xe2d7d(%rip), %rsi     # 0xf8bc0
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x45d5c
xorpd %xmm2, %xmm2
xorl %ebx, %ebx
leaq 0x38(%rsp), %r12
leaq 0x50(%rsp), %r13
movslq 0x24(%r14), %rax
cmpq %rax, %rbx
jge 0x15ec3
movq 0x18(%r14), %rax
movq (%rax,%rbx,8), %rbp
movq %rbp, %rdi
movsd %xmm2, 0x18(%rsp)
callq 0x195f8
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x19622
movq %r13, %rdi
movq %r12, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x464c0
movq %r15, %rdi
movq %r13, %rsi
callq 0x463b6
movq %rbp, %rdi
callq 0x195f8
movsd 0x18(%rsp), %xmm2
addsd %xmm0, %xmm2
incq %rbx
jmp 0x15e60
leaq 0xe1e2e(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm0
movapd 0x9217a(%rip), %xmm1    # 0xa8050
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x15efc
ucomisd %xmm2, %xmm0
jb 0x15efc
leaq 0xe2cd3(%rip), %rsi     # 0xf8bc0
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x45d5c
jmp 0x15f12
leaq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movapd %xmm2, %xmm0
callq 0x464e2
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/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), %eax
movl %eax, 0x10(%rsi)
callq 0x15616
addq $0x60, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1bf2a
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ebc2
leaq 0x8(%rsp), %rdi
callq 0x3ee72
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3ee72
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rdi, 0x8(%rsi)
addq $0x18, %rdi
movl 0x24(%r14), %eax
movl %eax, 0x10(%rsi)
callq 0x15616
addq $0x60, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x19674
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ebc2
leaq 0x8(%rsp), %rdi
callq 0x3ee72
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3ee72
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %r15d, %r15d
movslq 0x14(%r14), %rax
cmpq %rax, %r15
jge 0x16094
movq 0x8(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x88(%rax)
incq %r15
jmp 0x16072
xorl %r15d, %r15d
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jge 0x160b6
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x30(%rax)
incq %r15
jmp 0x16097
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x11650
testq %rax, %rax
je 0x16300
movq %rax, %r15
leaq 0x922c5(%rip), %rsi     # 0xa855c
pushq $0x5
popq %rdx
movq %rax, %rdi
callq 0x112a0
testl %eax, %eax
je 0x16315
leaq 0x922b5(%rip), %rsi     # 0xa8562
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x112a0
testl %eax, %eax
je 0x16325
leaq 0x922a5(%rip), %rsi     # 0xa8568
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x112a0
testl %eax, %eax
je 0x16338
leaq 0x92294(%rip), %rsi     # 0xa856d
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x112a0
testl %eax, %eax
je 0x16349
leaq 0x92283(%rip), %rdi     # 0xa8572
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6e732
jmp 0x16363
leaq 0x92229(%rip), %rdi     # 0xa8530
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x11080
jmp 0x16363
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0x78(%rax)
jmp 0x16358
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0x80(%rax)
jmp 0x16358
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x88(%rax)
jmp 0x16358
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x90(%rax)
testl %eax, %eax
je 0x16361
pushq $0x1
popq %rbp
jmp 0x16363
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/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
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x11650
testq %rax, %rax
je 0x16402
movq %rax, %r15
leaq 0x921c3(%rip), %rsi     # 0xa855c
pushq $0x5
popq %rdx
movq %rax, %rdi
callq 0x112a0
testl %eax, %eax
je 0x16417
leaq 0x921b3(%rip), %rsi     # 0xa8562
pushq $0x5
popq %rdx
movq %r15, %rdi
callq 0x112a0
testl %eax, %eax
je 0x1642a
leaq 0x921e2(%rip), %rsi     # 0xa85a7
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x112a0
testl %eax, %eax
je 0x1643d
leaq 0x921d1(%rip), %rsi     # 0xa85ac
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x112a0
testl %eax, %eax
je 0x16451
leaq 0x921c0(%rip), %rdi     # 0xa85b1
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6e732
jmp 0x1646b
leaq 0x92127(%rip), %rdi     # 0xa8530
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x11080
jmp 0x1646b
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0xa0(%rax)
jmp 0x16460
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0xa8(%rax)
jmp 0x16460
movq (%r14), %rax
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq *0xb0(%rax)
jmp 0x16460
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0xb8(%rax)
testl %eax, %eax
je 0x16469
pushq $0x1
popq %rbp
jmp 0x1646b
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/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 0x98284(%rip), %rsi     # 0xae713
movq %r15, %rdi
callq 0x11700
testq %rax, %rax
je 0x164c2
movq %rax, %r14
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq *0xc0(%rax)
testl %eax, %eax
je 0x164d7
movq %r14, %rdi
callq 0x115b0
pushq $0x1
popq %rbx
jmp 0x164d9
leaq 0x9211e(%rip), %rdi     # 0xa85e7
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x6e732
jmp 0x164d9
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_O2/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 0x9465b(%rip), %rsi     # 0xaab5a
movq %r15, %rdi
callq 0x11700
testq %rax, %rax
je 0x16532
movq %rax, %r14
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq *0xc8(%rax)
testl %eax, %eax
je 0x16547
movq %r14, %rdi
callq 0x115b0
pushq $0x1
popq %rbx
jmp 0x16549
leaq 0x920ae(%rip), %rdi     # 0xa85e7
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x6e732
jmp 0x16549
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_O2/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 0x74d40
xorl %ebx, %ebx
cmpl $0x7, %eax
jne 0x18780
movq %r12, %rdi
movq %r15, %rsi
callq 0x76660
testb %al, %al
je 0x18780
movq %r12, %rdi
movq %r15, %rsi
callq 0x7402c
movq %rax, (%r14)
movq %rax, %rdi
callq 0x74d40
testl %eax, %eax
je 0x18780
movq (%r14), %rdi
callq 0x74d40
cmpl $0x4, %eax
jne 0x1877d
movq (%r14), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x7012a
movq 0x8(%r14), %r15
movq %r14, %rdi
callq 0x11270
testq %r15, %r15
je 0x18780
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x74d40
cmpl $0x6, %eax
jne 0x187cc
movq %r14, %rdi
callq 0x73cc6
cmpl %ebp, %eax
jbe 0x187de
movq %r14, %rdi
movl %ebp, %esi
callq 0x75c04
movq %rax, (%rbx)
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x74d40
leaq 0x905bc(%rip), %rdi     # 0xa8d8f
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x6e732
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::WriteCameraFile(char const*, int) const
int RGBDConfiguration::
WriteCameraFile(const char *filename, int write_every_kth_image) const
{
  // Open file
  FILE *fp = fopen(filename, "w");
  if (!fp) {
    RNFail("Unable to open camera file %s\n", filename);
    return 0;
  }

  // Write images
  for (int i = 0; i < NImages(); i++) {
    if ((write_every_kth_image > 1) && ((i % write_every_kth_image) != 0)) continue;
    RGBDImage *image = Image(i);
    R3Point viewpoint = image->WorldViewpoint();
    R3Vector towards = image->WorldTowards();
    R3Vector up = image->WorldUp();
    RNAngle xfov = image->XFov();
    RNAngle yfov = image->YFov();
    fprintf(fp, "%f %f %f   %f %f %f   %f %f %f  %f %f  1\n",
      viewpoint[0], viewpoint[1], viewpoint[2],
      towards[0], towards[1], towards[2],
      up[0], up[1], up[2],
      xfov, yfov);
  }
  
  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r14
leaq 0x91fef(%rip), %rsi     # 0xaab5a
movq %r12, %rdi
callq 0x11700
testq %rax, %rax
je 0x18c65
movq %rax, %r15
xorl %r12d, %r12d
leaq 0x9016b(%rip), %rbp     # 0xa8cf4
movslq 0x14(%r14), %rax
cmpq %rax, %r12
jge 0x18c58
cmpl $0x2, %ebx
jl 0x18baa
movl %r12d, %eax
xorl %edx, %edx
divl %ebx
testl %edx, %edx
jne 0x18c50
movq 0x8(%r14), %rax
movq (%rax,%r12,8), %r13
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x155fc
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x15686
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x197a6
movq %r13, %rdi
callq 0x19758
movsd %xmm0, 0x18(%rsp)
movq %r13, %rdi
callq 0x197c0
movsd 0x50(%rsp), %xmm8
movsd 0x58(%rsp), %xmm1
movsd 0x60(%rsp), %xmm2
movsd 0x38(%rsp), %xmm3
movsd 0x40(%rsp), %xmm4
movsd 0x48(%rsp), %xmm5
movsd 0x20(%rsp), %xmm6
movsd 0x28(%rsp), %xmm7
movsd 0x30(%rsp), %xmm9
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm9, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movaps %xmm8, %xmm0
movb $0x8, %al
callq 0x118a0
incq %r12
jmp 0x18b89
movq %r15, %rdi
callq 0x115b0
pushq $0x1
popq %rbx
jmp 0x18c78
leaq 0x90069(%rip), %rdi     # 0xa8cd5
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0x6e732
movl %ebx, %eax
addq $0x68, %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/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
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x18fef
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0xf8(%rax)
incq %r14
jmp 0x18fd0
xorl %r14d, %r14d
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x19011
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
incq %r14
jmp 0x18ff2
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x19045
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x148(%rax)
incq %r14
jmp 0x19026
xorl %r14d, %r14d
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x19067
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
incq %r14
jmp 0x19048
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x1909b
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x100(%rax)
incq %r14
jmp 0x1907c
xorl %r14d, %r14d
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x190bd
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
incq %r14
jmp 0x1909e
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x190f1
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x150(%rax)
incq %r14
jmp 0x190d2
xorl %r14d, %r14d
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x19113
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0xb0(%rax)
incq %r14
jmp 0x190f4
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x19147
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x108(%rax)
incq %r14
jmp 0x19128
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x1917b
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x158(%rax)
incq %r14
jmp 0x1915c
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x191af
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x110(%rax)
incq %r14
jmp 0x19190
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x191e3
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x160(%rax)
incq %r14
jmp 0x191c4
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x19217
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x118(%rax)
incq %r14
jmp 0x191f8
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x1924b
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
callq *0x168(%rax)
incq %r14
jmp 0x1922c
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x60(%rdi), %r14
leaq 0xdf07b(%rip), %rsi     # 0xf8348
movq %r14, %rdi
callq 0x1980e
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movslq 0x14(%rbx), %rax
cmpq %rax, %r13
jge 0x19327
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x155fc
movq %r14, %rdi
movq %r15, %rsi
callq 0x3eb10
addq $0x188, %r12            # imm = 0x188
movq %r12, %rdi
callq 0x155d0
testl %eax, %eax
jne 0x19322
movq %r14, %rdi
movq %r12, %rsi
callq 0x3ebc2
incq %r13
jmp 0x192dd
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jge 0x19360
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x19674
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ebc2
movq %r15, %rdi
callq 0x3ee72
incq %r12
jmp 0x1932f
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3ee72
movq %rbx, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movslq 0x14(%rdi), %r15
movq 0x8(%rdi), %r12
xorl %r13d, %r13d
cmpq %r15, %r13
jge 0x193fd
movq (%r12,%r13,8), %r14
movq 0x1d0(%r14), %rdi
testq %rdi, %rdi
je 0x193f8
movq %rbx, %rsi
callq 0x11870
testl %eax, %eax
je 0x19400
incq %r13
jmp 0x193d7
xorl %r14d, %r14d
movq %r14, %rax
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.h
// Function: gaps::RGBDSurface::WorldBBox() const
inline R3Box RGBDSurface::
WorldBBox(void) const
{
  // Return bounding box
  if (rectangle) return rectangle->BBox();
  else if (mesh) return mesh->BBox();
  return R3null_box;
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
movq 0x80(%rsi), %rsi
testq %rsi, %rsi
je 0x19695
movq (%rsi), %rax
movq %rbx, %rdi
callq *0x88(%rax)
jmp 0x196b9
movq 0x88(%rax), %rsi
testq %rsi, %rsi
je 0x196aa
addq $0xf8, %rsi
jmp 0x196b1
leaq 0xdec97(%rip), %rsi     # 0xf8348
movq %rbx, %rdi
callq 0x3e1aa
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/./RGBDImage.h
// Function: gaps::RGBDImage::XFov() const
inline RNAngle RGBDImage::
XFov(void) const
{
  // Return field of view (half angle) in horizontal direction
  RNScalar xfocal = Intrinsics()[0][0];
  if (RNIsZero(xfocal)) return RN_INFINITY;
  else return atan(0.5 * NPixels(RN_X) / xfocal);
}

// Assembly:
movsd 0x140(%rdi), %xmm1
leaq 0xde591(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm0
movapd 0x8e8dd(%rip), %xmm2    # 0xa8050
xorpd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jb 0x1978f
ucomisd %xmm1, %xmm0
jb 0x1978f
leaq 0xde57e(%rip), %rax     # 0xf7d08
movsd (%rax), %xmm0
retq
cvtsi2sdl 0x28(%rdi), %xmm0
mulsd 0x8e87c(%rip), %xmm0    # 0xa8018
divsd %xmm1, %xmm0
jmp 0x114c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/./RGBDImage.h
// Function: gaps::RGBDImage::YFov() const
inline RNAngle RGBDImage::
YFov(void) const
{
  // Return field of view (half angle) in vertical direction
  RNScalar yfocal = Intrinsics()[1][1];
  if (RNIsZero(yfocal)) return RN_INFINITY;
  else return atan(0.5 * NPixels(RN_Y) / yfocal);
}

// Assembly:
movsd 0x160(%rdi), %xmm1
leaq 0xde529(%rip), %rax     # 0xf7cf8
movsd (%rax), %xmm0
movapd 0x8e875(%rip), %xmm2    # 0xa8050
xorpd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jb 0x197f7
ucomisd %xmm1, %xmm0
jb 0x197f7
leaq 0xde516(%rip), %rax     # 0xf7d08
movsd (%rax), %xmm0
retq
cvtsi2sdl 0x2c(%rdi), %xmm0
mulsd 0x8e814(%rip), %xmm0    # 0xa8018
divsd %xmm1, %xmm0
jmp 0x114c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movaps %xmm0, (%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
leaq 0xd9299(%rip), %rax     # 0xf2dd8
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
orl $-0x1, 0x10(%rdi)
leaq 0x18(%rdi), %rbx
movq %rbx, %rdi
callq 0x6c0ba
andq $0x0, 0x28(%r15)
orl $-0x1, 0x30(%r15)
leaq 0x48(%r15), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r15)
movsd 0x8e4ab(%rip), %xmm0    # 0xa8020
movsd 0x8e4c3(%rip), %xmm2    # 0xa8040
movq %r14, %rdi
movapd %xmm0, %xmm1
movapd %xmm2, %xmm3
callq 0x63c42
andl $0x0, 0x70(%r15)
andq $0x0, 0x78(%r15)
movq %r12, 0x80(%r15)
andq $0x0, 0x98(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x88(%r15)
testq %r12, %r12
je 0x19c65
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 0x8e8c7(%rip), %xmm0    # 0xa84b0
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 0x8f210(%rip), %xmm2    # 0xa8e20
cvttpd2dq %xmm2, %xmm1
movd %xmm1, %eax
movq %xmm1, 0x28(%r15)
testl %eax, %eax
jg 0x19c2a
movl $0x1, 0x28(%r15)
pshufd $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movd %xmm1, %eax
testl %eax, %eax
jg 0x19c3f
movl $0x1, 0x2c(%r15)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
leaq 0x10(%rsp), %rdi
callq 0x66640
leaq 0xe0808(%rip), %rsi     # 0xfa460
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x64352
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x19c7a
movq %rax, %r15
jmp 0x19c85
movq %rax, %r15
movq %r14, %rdi
callq 0x643b6
movq %rbx, %rdi
callq 0x6c128
movq %r15, %rdi
callq 0x11a80
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xd8f2e(%rip), %rax     # 0xf2dd8
movq %rax, (%rdi)
callq 0x1b19c
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x19ec4
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x28(%rax)
leaq 0x18(%rbx), %r14
xorl %r12d, %r12d
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jge 0x19efa
movq (%r14), %rax
movq (%rax,%r12,8), %r15
testq %r15, %r15
je 0x19ef5
movq %r15, %rdi
callq 0x589c0
movl $0xd0, %esi
movq %r15, %rdi
callq 0x115d0
incq %r12
jmp 0x19ecb
movq 0x38(%rbx), %rdi
callq 0x11710
movq 0x40(%rbx), %rdi
callq 0x11710
movq 0x90(%rbx), %r15
testq %r15, %r15
je 0x19f2d
movq %r15, %rdi
callq 0x589c0
movl $0xd0, %esi
movq %r15, %rdi
callq 0x115d0
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x19f3f
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x19f51
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x48, %rbx
movq %rbx, %rdi
callq 0x643b6
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x6c128
movq %rax, %rdi
callq 0x195ed
// File: /workspace/github_cpp_makefile_star2_O2/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 0x19fb4
leaq 0xe0566(%rip), %rsi     # 0xfa510
movq %rbx, %rdi
callq 0x6bf14
jmp 0x1a00d
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rsi, %rdi
movl %edx, %esi
movl %ecx, %edx
xorl %ecx, %ecx
callq 0x1b772
movsd %xmm0, 0x10(%rsp)
pushq $0x1
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x1b772
movsd %xmm0, 0x8(%rsp)
pushq $0x2
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x1b772
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/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 %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x80(%rsi), %rsi
testq %rsi, %rsi
je 0x1a10b
addq $0x50, %rsi
jmp 0x1a14a
cmpq $0x0, 0x88(%r14)
je 0x1a143
movq (%r14), %rcx
movq %rsp, %rax
movq %r14, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq *0xe8(%rcx)
testq %rax, %rax
je 0x1a143
movq 0x88(%r14), %rdi
movq %rax, %rsi
callq 0x1ba04
movq %rax, %rsi
jmp 0x1a14a
leaq 0x8fd26(%rip), %rsi     # 0xa9e70
movq %rbx, %rdi
callq 0x4651c
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1a181
leaq 0xe0399(%rip), %rsi     # 0xfa510
movq %rbx, %rdi
callq 0x6bf14
jmp 0x1a1d1
movq %rdx, %r14
movq %rsi, %r15
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x1b7b8
movsd %xmm0, 0x8(%rsp)
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1b7b8
movsd %xmm0, (%rsp)
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1b7b8
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/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 0x6663e
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x40(%rax)
testl %eax, %eax
je 0x1a224
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a15e
jmp 0x1a233
leaq 0xe02e5(%rip), %rsi     # 0xfa510
movq %rbx, %rdi
callq 0x6bf14
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/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
pushq $0x1
popq %rcx
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq *0x18(%rax)
movsd 0x10(%r14), %xmm0
movq (%rbx), %rax
pushq $0x2
popq %rcx
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
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_O2/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 0x1a3e5
testl %ecx, %ecx
js 0x1a3e4
testl %esi, %esi
js 0x1a3e4
cmpl %ecx, 0x24(%rdi)
jle 0x1a3e4
testl %edx, %edx
js 0x1a3e4
cmpl %esi, 0xc0(%rax)
jle 0x1a3e4
cmpl %esi, 0xc4(%rax)
jle 0x1a3e4
movq 0xb8(%rax), %r8
imull 0xc8(%rax), %edx
addl %esi, %edx
movslq %edx, %rax
movsd %xmm0, (%r8,%rax,8)
cmpl $0x2, %ecx
ja 0x1a3e4
movq (%rdi), %rax
jmpq *0xd8(%rax)
retq
leaq 0x8eaa2(%rip), %rdi     # 0xa8e8e
xorl %eax, %eax
jmp 0x6e732
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDSurface.cpp
// Function: gaps::RGBDSurface::SetChannel(int, gaps::R2Grid const&)
void RGBDSurface::
SetChannel(int channel_index, const R2Grid& image)
{
  // Check if color channels are resident
  if ((channel_index >= RGBD_RED_CHANNEL) && (channel_index <= RGBD_BLUE_CHANNEL)) {
    if (color_resident_count == 0) {
      RNFail("Unable to set channel -- it has not been created\n");
      return;
    }
  }

  // Set channel
  *(channels[channel_index]) = image;

  // Set width and height
  this->width = image.XResolution();
  this->height = image.YResolution();

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
cmpl $0x2, %esi
ja 0x1a41d
cmpl $0x0, 0x70(%rbx)
jne 0x1a41d
leaq 0x8eab8(%rip), %rdi     # 0xa8eca
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x6e732
movq 0x18(%rbx), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x5872a
movl 0xc0(%r14), %eax
movl %eax, 0x28(%rbx)
movl 0xc4(%r14), %eax
movl %eax, 0x2c(%rbx)
cmpl $0x2, %ebp
ja 0x1a459
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0xd8(%rax)
popq %rbx
popq %r14
popq %rbp
retq