// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/sflprocess/sflprocess.cpp
// Function: LoadSurfelsList(gaps::R3SurfelScene*, char const*, char const*, char const*)
static int
LoadSurfelsList(R3SurfelScene *scene, const char *list_filename, 
  const char *parent_object_name, const char *parent_node_name)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  int saved_print_verbose = print_verbose;
  print_verbose = print_debug;

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

  // Read objects/nodes from file with list
  int count = 0;
  char buffer[4096];
  char node_filename[512];
  while (fgets(buffer, 4096, fp)) {
    if (buffer[0] == '#') continue;
    if (sscanf(buffer, "%s", node_filename) == (unsigned int) 1) {
      char *start = strrchr(node_filename, '/');
      start = (start) ? start+1 : node_filename;
      char node_name[1024];
      strncpy(node_name, start, 1023);
      char *end = strrchr(node_name, '.');
      if (end) *end = '\0';
      if (!LoadSurfels(scene, node_filename, node_name, parent_object_name, node_name, parent_node_name)) return 0;
      count++;
    }
  }

  // Close file
  fclose(fp);

  // Print statistics
  print_verbose = saved_print_verbose;
  if (print_verbose) {
    printf("Loaded surfels from %s ...\n", list_filename);
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  # Files = %d\n", count);
    fflush(stdout);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1628, %rsp           # imm = 0x1628
movq %rcx, %rbp
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xaf4d6
movq %r14, %rdi
callq 0x1d806
movl 0x13d0f0(%rip), %r15d   # 0x159ddc
movl 0x13d0ee(%rip), %eax    # 0x159de0
movl %eax, 0x13d0e4(%rip)    # 0x159ddc
leaq 0xdd214(%rip), %rsi     # 0xf9f13
movq %rbx, %rdi
callq 0x15760
testq %rax, %rax
je 0x1ce39
movq %rax, %r13
movq %rbp, (%rsp)
leaq 0x620(%rsp), %r14
xorl %ebp, %ebp
movq %r14, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdx
callq 0x159f0
testq %rax, %rax
je 0x1cdd7
cmpb $0x23, 0x620(%rsp)
je 0x1cd21
movq %r14, %rdi
leaq 0xd84a7(%rip), %rsi     # 0xf51f5
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x155f0
cmpl $0x1, %eax
jne 0x1cd21
leaq 0x20(%rsp), %rdi
pushq $0x2f
popq %rsi
callq 0x156b0
leaq 0x1(%rax), %rsi
testq %rax, %rax
leaq 0x20(%rsp), %rax
cmoveq %rax, %rsi
movl $0x3ff, %edx            # imm = 0x3FF
leaq 0x220(%rsp), %rdi
callq 0x15310
leaq 0x220(%rsp), %rdi
pushq $0x2e
popq %rsi
callq 0x156b0
testq %rax, %rax
je 0x1cda6
movb $0x0, (%rax)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x220(%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %rdx, %r8
movq (%rsp), %r9
callq 0x1c8ee
incl %ebp
testq %rax, %rax
jne 0x1cd21
xorl %r14d, %r14d
jmp 0x1ce4d
movq %r13, %rdi
callq 0x15610
movl %r15d, 0x13cff6(%rip)   # 0x159ddc
pushq $0x1
popq %r14
testl %r15d, %r15d
je 0x1ce4d
leaq 0xcf9df(%rip), %rdi     # 0xec7d5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x15080
leaq 0x10(%rsp), %rdi
callq 0xaf510
leaq 0xcf790(%rip), %rdi     # 0xec5a1
movb $0x1, %al
callq 0x15080
leaq 0xcf9f7(%rip), %rdi     # 0xec816
movl %ebp, %esi
xorl %eax, %eax
callq 0x15080
movq 0x13c151(%rip), %rax    # 0x158f80
movq (%rax), %rdi
callq 0x15750
jmp 0x1ce4d
leaq 0xcf9c3(%rip), %rdi     # 0xec803
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb2096
movl %r14d, %eax
addq $0x1628, %rsp           # imm = 0x1628
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq