// File: /workspace/github_cpp_makefile_star2_O1/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 0xc2368
movq %r14, %rdi
xorl %esi, %esi
callq 0x15a20
movl 0x153b0d(%rip), %r15d   # 0x16edcc
movl 0x153b0b(%rip), %eax    # 0x16edd0
movl %eax, 0x153b01(%rip)    # 0x16edcc
leaq 0xfbfa1(%rip), %rsi     # 0x117273
movq %rbx, %rdi
callq 0x15770
testq %rax, %rax
je 0x1b41a
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 0x159e0
testq %rax, %rax
je 0x1b3b6
cmpb $0x23, 0x620(%rsp)
je 0x1b2f4
movq %r14, %rdi
leaq 0xf6fd8(%rip), %rsi     # 0x1122f9
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x155f0
cmpl $0x1, %eax
jne 0x1b2f4
leaq 0x20(%rsp), %rdi
movl $0x2f, %esi
callq 0x156a0
leaq 0x1(%rax), %rsi
testq %rax, %rax
leaq 0x20(%rsp), %rax
cmoveq %rax, %rsi
movl $0x3ff, %edx            # imm = 0x3FF
leaq 0x220(%rsp), %rdi
callq 0x15300
leaq 0x220(%rsp), %rdi
movl $0x2e, %esi
callq 0x156a0
testq %rax, %rax
je 0x1b37d
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 0x1ae6d
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
addl %ecx, %ebp
testq %rax, %rax
jne 0x1b2f4
xorl %r14d, %r14d
jmp 0x1b42e
movq %r13, %rdi
callq 0x15600
movl %r15d, 0x153a07(%rip)   # 0x16edcc
movl $0x1, %r14d
testl %r15d, %r15d
je 0x1b42e
leaq 0xee416(%rip), %rdi     # 0x1097ed
movq %rbx, %rsi
xorl %eax, %eax
callq 0x15080
leaq 0x10(%rsp), %rdi
callq 0xc23ca
leaq 0xee1c7(%rip), %rdi     # 0x1095b9
movb $0x1, %al
callq 0x15080
leaq 0xee42e(%rip), %rdi     # 0x10982e
movl %ebp, %esi
xorl %eax, %eax
callq 0x15080
movq 0x152b50(%rip), %rax    # 0x16df60
movq (%rax), %rdi
callq 0x15760
jmp 0x1b42e
leaq 0xee3fa(%rip), %rdi     # 0x10981b
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc5782
movl %r14d, %eax
addq $0x1628, %rsp           # imm = 0x1628
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq