// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/img2pd/img2pd.cpp
// Function: main
int main(int argc, char **argv)
{
  // Parse program arguments
  if (!ParseArgs(argc, argv)) exit(-1);

  // Print message
  RNTime start_time;
  start_time.Read();
  if (print_verbose) {
    printf("Adding images to %s\n", output_pixel_database_filename);
    fflush(stdout);
  }

  // Allocate pixel database
  R2PixelDatabase pd;
    
  // Open pixel database for writing
  if (!pd.OpenFile(output_pixel_database_filename, "w+")) {
    RNFail("Unable to open initial pixel database %s\n", output_pixel_database_filename);
    exit(-1);
  }

  // Add images to pixel database
  for (int i = 0; i < input_image_filenames.NEntries(); i++) {
    const char *image_filename = input_image_filenames.Kth(i);
    if (!AddImageToPixelDatabase(pd, image_filename)) exit(-1);
  }
  
  // Add lists of images to pixel database
  for (int i = 0; i < input_list_filenames.NEntries(); i++) {
    const char *list_filename = input_list_filenames.Kth(i);
    if (!AddListToPixelDatabase(pd, list_filename)) exit(-1);
  }
  
  // Add directories of images to pixel database
  for (int i = 0; i < input_image_directories.NEntries(); i++) {
    const char *image_directory = input_image_directories.Kth(i);
    if (!AddDirectoryToPixelDatabase(pd, image_directory)) exit(-1);
  }

  // Close pixel database
  if (!pd.CloseFile()) {
    RNFail("Unable to close initial pixel database %s\n", output_pixel_database_filename);
    exit(-1);
  }

  // Print message
  if (print_verbose) {
    printf("  Time = %.2f\n", start_time.Elapsed());
    printf("  # Images = %d\n", image_count);
    fflush(stdout);
  }

  // Return success
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movq %rsi, %r13
movl %edi, %r15d
leaq 0x471d3(%rip), %rbp     # 0x4d0cd
cmpl $0x2, %r15d
jl 0x60ca
leaq 0x8(%r13), %r14
leal -0x1(%r15), %ebx
movq (%r14), %r12
cmpb $0x2d, (%r12)
jne 0x5fa7
cmpb $0x76, 0x1(%r12)
jne 0x5f2e
cmpb $0x0, 0x2(%r12)
je 0x6072
movq %r12, %rdi
leaq 0x47159(%rip), %rsi     # 0x4d091
callq 0x54e0
testl %eax, %eax
je 0x604c
movq %r12, %rdi
leaq 0x47149(%rip), %rsi     # 0x4d098
callq 0x54e0
testl %eax, %eax
je 0x6055
movq %r12, %rdi
leaq 0x47138(%rip), %rsi     # 0x4d09e
callq 0x54e0
testl %eax, %eax
je 0x6084
movq %r12, %rdi
leaq 0x47128(%rip), %rsi     # 0x4d0a5
callq 0x54e0
testl %eax, %eax
jne 0x633e
addl $-0x2, %r15d
movq 0x10(%r13), %rsi
addq $0x10, %r13
leaq 0x6a55b(%rip), %rdi     # 0x704f8
callq 0x6452
jmp 0x5efa
movq %r12, %rdi
movq %rbp, %rsi
callq 0x50d0
testq %rax, %rax
je 0x5fc3
movq %r12, 0x6a552(%rip)     # 0x70510
jmp 0x6079
movq %r12, %rdi
leaq 0x47104(%rip), %rsi     # 0x4d0d1
callq 0x50d0
testq %rax, %rax
jne 0x603b
movq %r12, %rdi
leaq 0x470f5(%rip), %rsi     # 0x4d0d6
callq 0x50d0
testq %rax, %rax
jne 0x603b
movq %r12, %rdi
leaq 0x470e6(%rip), %rsi     # 0x4d0db
callq 0x50d0
testq %rax, %rax
jne 0x603b
movq %r12, %rdi
leaq 0x470d8(%rip), %rsi     # 0x4d0e1
callq 0x50d0
testq %rax, %rax
jne 0x603b
movq %r12, %rdi
leaq 0x470ca(%rip), %rsi     # 0x4d0e7
callq 0x50d0
testq %rax, %rax
jne 0x603b
movq %r12, %rdi
leaq 0x470bb(%rip), %rsi     # 0x4d0ec
callq 0x50d0
testq %rax, %rax
je 0x60a1
leaq 0x6a496(%rip), %rdi     # 0x704d8
movq %r12, %rsi
callq 0x6452
jmp 0x6079
movb $0x1, 0x6a4c9(%rip)     # 0x7051c
jmp 0x6079
addl $-0x2, %r15d
movq 0x10(%r13), %rsi
addq $0x10, %r13
leaq 0x6a480(%rip), %rdi     # 0x704e8
callq 0x6452
jmp 0x5efa
movb $0x1, 0x6a48f(%rip)     # 0x70508
movl %ebx, %r15d
movq %r14, %r13
jmp 0x5efa
addl $-0x2, %r15d
movq 0x10(%r13), %rsi
addq $0x10, %r13
leaq 0x6a441(%rip), %rdi     # 0x704d8
callq 0x6452
jmp 0x5efa
movq %r12, %rdi
leaq 0x47046(%rip), %rsi     # 0x4d0f1
callq 0x50d0
testq %rax, %rax
je 0x60be
leaq 0x6a42c(%rip), %rdi     # 0x704e8
jmp 0x6042
leaq 0x6a433(%rip), %rdi     # 0x704f8
jmp 0x6042
movl 0x6a424(%rip), %eax     # 0x704f4
orl 0x6a42e(%rip), %eax     # 0x70504
orl 0x6a408(%rip), %eax     # 0x704e4
setne %al
cmpq $0x0, 0x6a429(%rip)     # 0x70510
je 0x6353
testb %al, %al
je 0x6353
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x1f14e
movq %rbx, %rdi
callq 0x644a
cmpb $0x1, 0x6a3f9(%rip)     # 0x70508
jne 0x6135
movq 0x6a3f8(%rip), %rsi     # 0x70510
leaq 0x46ee5(%rip), %rdi     # 0x4d004
xorl %eax, %eax
callq 0x5060
movq 0x69e83(%rip), %rax     # 0x6ffb0
movq (%rax), %rdi
callq 0x53c0
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x645c
movq 0x6a3c7(%rip), %rsi     # 0x70510
leaq 0x46ec9(%rip), %rdx     # 0x4d019
movq %rbx, %rdi
callq 0x6ca6
testl %eax, %eax
je 0x6363
xorl %r14d, %r14d
leaq 0x10(%rsp), %rbx
movslq 0x6a375(%rip), %rax     # 0x704e4
cmpq %rax, %r14
jge 0x6193
movq 0x6a35d(%rip), %rax     # 0x704d8
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x63b2
incq %r14
testl %eax, %eax
jne 0x6168
jmp 0x6336
leaq 0x47358(%rip), %r14     # 0x4d4f2
leaq 0x70(%rsp), %r15
leaq 0x10(%rsp), %r12
xorl %ebx, %ebx
movslq 0x6a347(%rip), %rax     # 0x704f4
cmpq %rax, %rbx
jge 0x620e
movq 0x6a32f(%rip), %rax     # 0x704e8
movq (%rax,%rbx,8), %rbp
movq %rbp, %rdi
leaq 0x49f1c(%rip), %rsi     # 0x500e3
callq 0x53d0
testq %rax, %rax
je 0x6312
movq %rax, %r13
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5660
cmpl $0x1, %eax
jne 0x6201
movq %r12, %rdi
movq %r15, %rsi
callq 0x63b2
testl %eax, %eax
jne 0x61d8
jmp 0x6336
movq %r13, %rdi
callq 0x5330
incq %rbx
jmp 0x61a6
leaq 0x46f4f(%rip), %rbx     # 0x4d164
leaq 0x70(%rsp), %r14
leaq 0x10(%rsp), %r15
xorl %ebp, %ebp
movslq 0x6a2dc(%rip), %rax     # 0x70504
cmpq %rax, %rbp
jge 0x62a0
movq 0x6a2c4(%rip), %rax     # 0x704f8
movq (%rax,%rbp,8), %r12
movq %r12, %rdi
callq 0x5560
testq %rax, %rax
je 0x6325
movq %rax, %r13
movq %rax, %rdi
callq 0x5570
testq %rax, %rax
je 0x6293
cmpb $0x2e, 0x13(%rax)
je 0x6289
addq $0x13, %rax
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x50b0
movq %r15, %rdi
movq %r14, %rsi
callq 0x63b2
testl %eax, %eax
je 0x6336
movq %r13, %rdi
callq 0x5570
jmp 0x6254
movq %r13, %rdi
callq 0x55d0
incq %rbp
jmp 0x6221
leaq 0x10(%rsp), %rdi
callq 0x6db4
testl %eax, %eax
je 0x637a
cmpb $0x1, 0x6a24f(%rip)     # 0x70508
jne 0x62f4
movq %rsp, %rdi
callq 0x1f188
leaq 0x46da7(%rip), %rdi     # 0x4d071
movb $0x1, %al
callq 0x5060
movl 0x6a241(%rip), %esi     # 0x70518
leaq 0x46da2(%rip), %rdi     # 0x4d080
xorl %eax, %eax
callq 0x5060
movq 0x69cc4(%rip), %rax     # 0x6ffb0
movq (%rax), %rdi
callq 0x53c0
leaq 0x10(%rsp), %rdi
callq 0x651a
xorl %eax, %eax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x46e0c(%rip), %rdi     # 0x4d125
movq %rbp, %rsi
xorl %eax, %eax
callq 0x21972
jmp 0x6336
leaq 0x46e1b(%rip), %rdi     # 0x4d147
movq %r12, %rsi
xorl %eax, %eax
callq 0x21972
pushq $-0x1
popq %rdi
callq 0x53f0
leaq 0x46d6b(%rip), %rdi     # 0x4d0b0
movq %r12, %rsi
xorl %eax, %eax
callq 0x21972
pushq $0x1
jmp 0x6338
leaq 0x46d9c(%rip), %rdi     # 0x4d0f6
xorl %eax, %eax
callq 0x21972
jmp 0x6336
movq 0x6a1a6(%rip), %rsi     # 0x70510
leaq 0x46cab(%rip), %rdi     # 0x4d01c
xorl %eax, %eax
callq 0x21972
jmp 0x6336
movq 0x6a18f(%rip), %rsi     # 0x70510
leaq 0x46cbe(%rip), %rdi     # 0x4d046
xorl %eax, %eax
callq 0x21972
jmp 0x6336
jmp 0x639d
jmp 0x639d
jmp 0x639d
jmp 0x639d
jmp 0x639d
jmp 0x639d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x651a
movq %rbx, %rdi
callq 0x5620