// File: tomfunkhouser[P]gaps/apps/conf2conf/conf2conf.cpp
// Function: ReadConfigurationFile(char const*)
static RGBDConfiguration *
ReadConfigurationFile(const char *filename) 
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  if (print_verbose) {
    printf("Reading configuration from %s ...\n", filename);
    fflush(stdout);
  }

  // Allocate configuration
  RGBDConfiguration *configuration = new RGBDConfiguration();
  if (!configuration) {
    RNFail("Unable to allocate configuration for %s\n", filename);
    return NULL;
  }
  
  // Read file
  if (!configuration->ReadFile(filename)) {
    RNFail("Unable to read configuration from %s\n", filename);
    return NULL;
  }

  // Set input directories if specified on command line
  if (input_depth_directory) configuration->SetDepthDirectory(input_depth_directory);
  if (input_color_directory) configuration->SetColorDirectory(input_color_directory);
  if (input_texture_directory) configuration->SetTextureDirectory(input_texture_directory);

  // Delete unwanted images
  if (!DeleteUnwantedImages(configuration)) return NULL;

  // Print statistics
  if (print_verbose) {
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  # Images = %d\n", configuration->NImages());
    printf("  # Surfaces = %d\n", configuration->NSurfaces());
    fflush(stdout);
  }

  // Return configuration
  return configuration;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
leaq 0x28(%rsp), %rdi
callq 0xdaa10
leaq 0x28(%rsp), %rdi
callq 0x19c20
cmpl $0x0, 0x19aeb4(%rip)    # 0x1b1fe8
je 0x17158
movq 0x38(%rsp), %rsi
leaq 0x14f13e(%rip), %rdi    # 0x166280
movb $0x0, %al
callq 0x12090
movq 0x199e40(%rip), %rax    # 0x1b0f90
movq (%rax), %rdi
callq 0x12850
movl $0x98, %edi
callq 0x126d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
callq 0x1af80
jmp 0x17174
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x171c9
movq 0x38(%rsp), %rsi
leaq 0x14f111(%rip), %rdi    # 0x1662a3
movb $0x0, %al
callq 0xdf990
movq $0x0, 0x40(%rsp)
jmp 0x172e0
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x18(%rsp)
movl %eax, 0x14(%rsp)
movl $0x98, %esi
callq 0x126e0
jmp 0x172ea
movq 0x20(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq (%rdi), %rax
movl $0x1, %edx
callq *0x70(%rax)
cmpl $0x0, %eax
jne 0x17204
movq 0x38(%rsp), %rsi
leaq 0x14f0dd(%rip), %rdi    # 0x1662cc
movb $0x0, %al
callq 0xdf990
movq $0x0, 0x40(%rsp)
jmp 0x172e0
cmpq $0x0, 0x19ade4(%rip)    # 0x1b1ff0
je 0x17220
movq 0x20(%rsp), %rdi
movq 0x19add6(%rip), %rsi    # 0x1b1ff0
movq (%rdi), %rax
callq *0x48(%rax)
cmpq $0x0, 0x19add0(%rip)    # 0x1b1ff8
je 0x1723c
movq 0x20(%rsp), %rdi
movq 0x19adc2(%rip), %rsi    # 0x1b1ff8
movq (%rdi), %rax
callq *0x40(%rax)
cmpq $0x0, 0x19adbc(%rip)    # 0x1b2000
je 0x17258
movq 0x20(%rsp), %rdi
movq 0x19adae(%rip), %rsi    # 0x1b2000
movq (%rdi), %rax
callq *0x60(%rax)
movq 0x20(%rsp), %rdi
callq 0x18250
cmpl $0x0, %eax
jne 0x17272
movq $0x0, 0x40(%rsp)
jmp 0x172e0
cmpl $0x0, 0x19ad6f(%rip)    # 0x1b1fe8
je 0x172d6
leaq 0x28(%rsp), %rdi
callq 0xdaad0
leaq 0x14f066(%rip), %rdi    # 0x1662f2
movb $0x1, %al
callq 0x12090
movq 0x20(%rsp), %rdi
callq 0x19c40
movl %eax, %esi
leaq 0x14f063(%rip), %rdi    # 0x166309
movb $0x0, %al
callq 0x12090
movq 0x20(%rsp), %rdi
callq 0x19c60
movl %eax, %esi
leaq 0x14f05a(%rip), %rdi    # 0x16631a
movb $0x0, %al
callq 0x12090
movq 0x199cc2(%rip), %rax    # 0x1b0f90
movq (%rax), %rdi
callq 0x12850
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
movq 0x18(%rsp), %rdi
callq 0x12c20
nopw %cs:(%rax,%rax)