// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/sflprocess/sflprocess.cpp
// Function: LoadFeatureList(gaps::R3SurfelScene*, char const*)
static int
LoadFeatureList(R3SurfelScene *scene, const char *list_filename)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  int count = 0;

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

  // Read features from file with list
  char buffer[4096];
  char type[1024], name[1024], filename[1024];
  double minimum, maximum, weight;
  while (fgets(buffer, 4096, fp)) {
    if (buffer[0] == '\0') continue;
    if (buffer[0] == '#') continue;
    if (sscanf(buffer, "%s%s%lf%lf%lf%s", type, name, &minimum, &maximum, &weight, filename) == 6) {
      // Create feature of appropriate type
      if (!strcmp(type, "PointSet")) {
        R3SurfelPointSetFeature *feature = new R3SurfelPointSetFeature(name, minimum, maximum, weight);
        scene->InsertFeature(feature);
      }
      else if (!strcmp(type, "OverheadGrid")) {
        R3SurfelOverheadGridFeature *feature = new R3SurfelOverheadGridFeature(filename, name, minimum, maximum, weight);
        scene->InsertFeature(feature);
      }
      else {
        R3SurfelFeature *feature = new R3SurfelFeature(name, minimum, maximum, weight);
        scene->InsertFeature(feature);
      }
      count++;
    }
  }

  // Close file
  fclose(fp);

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

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c38, %rsp           # imm = 0x1C38
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0xc2368
xorl %r14d, %r14d
movq %r12, %rdi
xorl %esi, %esi
callq 0x15a20
leaq 0xfbdf8(%rip), %rsi     # 0x117273
movq %rbx, %rdi
callq 0x15770
testq %rax, %rax
je 0x1b686
movq %rax, %r12
leaq 0xc30(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdx
callq 0x159e0
testq %rax, %rax
je 0x1b625
leaq 0xc30(%rsp), %r13
leaq 0x830(%rsp), %rbp
xorl %r14d, %r14d
movzbl 0xc30(%rsp), %eax
cmpl $0x23, %eax
je 0x1b4d1
testl %eax, %eax
jne 0x1b4eb
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdx
callq 0x159e0
testq %rax, %rax
jne 0x1b4c0
jmp 0x1b625
movq %r13, %rdi
leaq 0xee4f1(%rip), %rsi     # 0x1099e6
leaq 0x30(%rsp), %rdx
leaq 0x430(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x10(%rsp), %r9
xorl %eax, %eax
pushq %rbp
leaq 0x10(%rsp), %r10
pushq %r10
callq 0x155f0
addq $0x10, %rsp
cmpl $0x6, %eax
jne 0x1b620
movq 0x30(%rsp), %rax
movabsq $0x746553746e696f50, %rcx # imm = 0x746553746E696F50
xorq %rcx, %rax
movzbl 0x38(%rsp), %ecx
orq %rax, %rcx
je 0x1b59e
movq 0x30(%rsp), %rax
movabsq $0x646165687265764f, %rcx # imm = 0x646165687265764F
xorq %rcx, %rax
movq 0x35(%rsp), %rcx
movabsq $0x64697247646165, %rdx # imm = 0x64697247646165
xorq %rdx, %rcx
orq %rax, %rcx
je 0x1b5cf
movl $0x48, %edi
callq 0x15610
movq %rax, %rbp
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movq %rax, %rdi
leaq 0x430(%rsp), %rsi
callq 0x3f470
jmp 0x1b606
movl $0x48, %edi
callq 0x15610
movq %rax, %rbp
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movq %rax, %rdi
leaq 0x430(%rsp), %rsi
callq 0x3f8be
jmp 0x1b606
movl $0xa8, %edi
callq 0x15610
movq %rax, %rbp
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movq %rax, %rdi
leaq 0x830(%rsp), %rsi
leaq 0x430(%rsp), %rdx
callq 0x3ff30
movq (%r15), %rax
movq %r15, %rdi
movq %rbp, %rsi
callq *0xb0(%rax)
incl %r14d
leaq 0x830(%rsp), %rbp
jmp 0x1b4d1
movq %r12, %rdi
callq 0x15600
cmpl $0x0, 0x153798(%rip)    # 0x16edcc
je 0x1b67f
leaq 0xee3c2(%rip), %rdi     # 0x1099ff
movq %rbx, %rsi
xorl %eax, %eax
callq 0x15080
leaq 0x20(%rsp), %rdi
callq 0xc23ca
leaq 0xedf61(%rip), %rdi     # 0x1095b9
movb $0x1, %al
callq 0x15080
leaq 0xee031(%rip), %rdi     # 0x109697
movl %r14d, %esi
xorl %eax, %eax
callq 0x15080
movq 0x1528e9(%rip), %rax    # 0x16df60
movq (%rax), %rdi
callq 0x15760
movl $0x1, %ebp
jmp 0x1b699
leaq 0xee18e(%rip), %rdi     # 0x10981b
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc5782
movl %ebp, %eax
addq $0x1c38, %rsp           # imm = 0x1C38
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xa8, %esi
jmp 0x1b6c1
jmp 0x1b6b9
movq %rax, %rbx
movl $0x48, %esi
movq %rbp, %rdi
callq 0x15620
movq %rbx, %rdi
callq 0x15ae0