// File: /workspace/github_cpp_makefile_star2_O3/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 0xc0cf4
movq %r14, %rdi
xorl %esi, %esi
callq 0x15a10
movl 0x151da3(%rip), %r15d   # 0x16cdbc
movl 0x151da1(%rip), %eax    # 0x16cdc0
movl %eax, 0x151d97(%rip)    # 0x16cdbc
leaq 0xfa247(%rip), %rsi     # 0x115273
movq %rbx, %rdi
callq 0x15760
testq %rax, %rax
je 0x1b16c
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 0x159d0
testq %rax, %rax
je 0x1b108
cmpb $0x23, 0x620(%rsp)
je 0x1b04e
movq %r14, %rdi
leaq 0xf526a(%rip), %rsi     # 0x1102e5
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x155f0
cmpl $0x1, %eax
jne 0x1b04e
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 0x1b0d7
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 0x1abaf
incl %ebp
testq %rax, %rax
jne 0x1b04e
xorl %r14d, %r14d
jmp 0x1b180
movq %r13, %rdi
callq 0x15600
movl %r15d, 0x151ca5(%rip)   # 0x16cdbc
movl $0x1, %r14d
testl %r15d, %r15d
je 0x1b180
leaq 0xec6bd(%rip), %rdi     # 0x1077e6
movq %rbx, %rsi
xorl %eax, %eax
callq 0x15080
leaq 0x10(%rsp), %rdi
callq 0xc0d56
leaq 0xec46e(%rip), %rdi     # 0x1075b2
movb $0x1, %al
callq 0x15080
leaq 0xec6d5(%rip), %rdi     # 0x107827
movl %ebp, %esi
xorl %eax, %eax
callq 0x15080
movq 0x150dfe(%rip), %rax    # 0x16bf60
movq (%rax), %rdi
callq 0x15750
jmp 0x1b180
leaq 0xec6a1(%rip), %rdi     # 0x107814
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc3e02
movl %r14d, %eax
addq $0x1628, %rsp           # imm = 0x1628
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq