// File: /workspace/github_cpp_makefile_star2_O3/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 0xc0cf4
xorl %r14d, %r14d
movq %r12, %rdi
xorl %esi, %esi
callq 0x15a10
leaq 0xfa0a6(%rip), %rsi     # 0x115273
movq %rbx, %rdi
callq 0x15760
testq %rax, %rax
je 0x1b3d8
movq %rax, %r12
leaq 0xc30(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdx
callq 0x159d0
testq %rax, %rax
je 0x1b377
leaq 0xc30(%rsp), %r13
leaq 0x830(%rsp), %rbp
xorl %r14d, %r14d
movzbl 0xc30(%rsp), %eax
cmpl $0x23, %eax
je 0x1b223
testl %eax, %eax
jne 0x1b23d
movq %r13, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdx
callq 0x159d0
testq %rax, %rax
jne 0x1b212
jmp 0x1b377
movq %r13, %rdi
leaq 0xec798(%rip), %rsi     # 0x1079df
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 0x1b372
movq 0x30(%rsp), %rax
movabsq $0x746553746e696f50, %rcx # imm = 0x746553746E696F50
xorq %rcx, %rax
movzbl 0x38(%rsp), %ecx
orq %rax, %rcx
je 0x1b2f0
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 0x1b321
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 0x3efe8
jmp 0x1b358
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 0x3f436
jmp 0x1b358
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 0x3fad6
movq (%r15), %rax
movq %r15, %rdi
movq %rbp, %rsi
callq *0xb0(%rax)
incl %r14d
leaq 0x830(%rsp), %rbp
jmp 0x1b223
movq %r12, %rdi
callq 0x15600
cmpl $0x0, 0x151a36(%rip)    # 0x16cdbc
je 0x1b3d1
leaq 0xec669(%rip), %rdi     # 0x1079f8
movq %rbx, %rsi
xorl %eax, %eax
callq 0x15080
leaq 0x20(%rsp), %rdi
callq 0xc0d56
leaq 0xec208(%rip), %rdi     # 0x1075b2
movb $0x1, %al
callq 0x15080
leaq 0xec2d8(%rip), %rdi     # 0x107690
movl %r14d, %esi
xorl %eax, %eax
callq 0x15080
movq 0x150b97(%rip), %rax    # 0x16bf60
movq (%rax), %rdi
callq 0x15750
movl $0x1, %ebp
jmp 0x1b3eb
leaq 0xec435(%rip), %rdi     # 0x107814
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc3e02
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 0x1b413
jmp 0x1b40b
movq %rax, %rbx
movl $0x48, %esi
movq %rbp, %rdi
callq 0x15620
movq %rbx, %rdi
callq 0x15ad0