// File: /workspace/github_cpp_makefile_star2_O3/lvandeve[P]lodepng/pngdetail.cpp
// Function: main
int main(int argc, char *argv[]) {
  Options options;
  bool options_chosen = false;

  std::vector<std::string> filenames;
  for (int i = 1; i < argc; i++) {
    std::string s = argv[i];
    if(s.size() > 1 && s[0] == '-' && s[1] != '-') {
      // anything that chooses actual set disables the defaults
      if(s != "-x" && s != "-v" && s != "-t") options_chosen = true;
      for(size_t j = 1; j < s.size(); j++) {
        char c = s[j];
        if(c == 'o') options.show_one_line_summary = true;
        else if(c == 'H') options.show_header = true;
        else if(c == 'i') options.show_icc_details = true;
        else if(c == 'I') options.show_icc_hex = true;
        else if(c == 'e') options.show_exif = true;
        else if(c == 'E') options.show_exif_hex = true;
        else if(c == 'v') options.verbose = true;
        else if(c == 't') options.expand_long_texts = true;
        else if(c == 's') options.show_color_stats = true;
        else if(c == 'a') options.show_errors = true;
        else if(c == 'p') options.show_header = options.show_png_info = true;
        else if(c == 'r') options.show_render = true;
        else if(c == 'l') options.show_palette = true;
        else if(c == 'L') options.show_palette_pixels = true;
        else if(c == 'c') options.show_chunks = true;
        else if(c == 'C') options.show_chunks2 = true;
        else if(c == 'f') options.show_filters = true;
        else if(c == 'z') options.show_zlib_info = true;
        else if(c == 'x') {
          options.use_hex = true;
          std::cout << std::hex;
        } else {
          if(s != "--help" && c != 'h' && c != '?') std::cout << "Unknown flag: " << c << ". Use -h for help" << std::endl;
          showHelp();
          return 0;
        }

      }
    } else if(s.size() > 1 && s[0] == '-' && s[1] == '-') {
      size_t eqpos = 2;
      while(eqpos < s.size() && s[eqpos] != '=') eqpos++;
      std::string key = s.substr(2, eqpos - 2);
      std::string value = (eqpos + 1) < s.size() ? s.substr(eqpos + 1) : "";
      if(key == "help") {
        showHelp();
        return 0;
      }
      if(key == "mode") {
        if(value == "ascii") options.rendermode = RM_ASCII;
        else if(value == "hex") options.rendermode = RM_HEX;
        else if(value == "hex16") options.rendermode = RM_HEX16;
        else if(value == "palette") options.rendermode = RM_PAL;
      }
      if(key == "size") {
        int size = strtoval<int>(value);
        if(size >= 1 && size <= 4096) options.rendersize = size;
      }
      if(key == "format") {
        if(value == "mix") options.hexformat = HF_MIX;
        else if(value == "hex") options.hexformat = HF_HEX;
        else if(value == "bin") options.hexformat = HF_BIN;
      }
    }
    else filenames.push_back(s);
  }

  if(filenames.empty()) {
    std::cout << "Please provide a filename to preview" << std::endl;
    showHelp();
    return 0;
  }

  if(!options_chosen) {
    //fill in defaults
    options.show_header = true;
    options.show_png_info = true;
    options.show_chunks2 = true;
    // verbose lets individual sections show more, and in addition adds more default unlocked sections if no specific one chosen
    if(options.verbose) {
      options.show_chunks2 = false;
      options.show_chunks = true;
    }
  }

  for(size_t i = 0; i < filenames.size(); i++) {
    if(filenames.size() > 1) {
      if(i > 0 && !options.show_one_line_summary) std::cout << std::endl;
      std::cout << filenames[i] << ":";
      if(!options.show_one_line_summary) std::cout << std::endl; else std::cout << " ";
    }
    Data data(filenames[i]);
    showInfos(data, options);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
xorl %eax, %eax
movq %rax, 0x15(%rsp)
movq %rax, 0x10(%rsp)
movl $0x1, 0x20(%rsp)
movb %al, 0x24(%rsp)
movabsq $0x5000000000, %rcx     # imm = 0x5000000000
movq %rcx, 0x28(%rsp)
movb %al, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
cmpl $0x2, %edi
jl 0x1de2b
movq %rsi, %r14
movl %edi, %eax
movq %rax, 0xb0(%rsp)
movl $0x1, %ebx
movl $0x0, 0x3c(%rsp)
leaq 0xb8(%rsp), %r15
leaq 0x88(%rsp), %rbp
leaq 0x5c03(%rip), %r12      # 0x2322c
movq %rsi, 0x80(%rsp)
movq (%r14,%rbx,8), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x20c0
movq 0xc0(%rsp), %rax
cmpq $0x2, %rax
jb 0x1d6ca
movq 0xb8(%rsp), %rcx
cmpb $0x2d, (%rcx)
jne 0x1d6ca
cmpb $0x2d, 0x1(%rcx)
jne 0x1d713
cmpb $0x2d, 0x1(%rcx)
jne 0x1d6ca
movl $0x2, %r13d
cmpq $0x2, %rax
je 0x1d689
cmpb $0x3d, (%rcx,%r13)
je 0x1d689
incq %r13
cmpq %r13, %rax
jne 0x1d677
movq %rax, %r13
leaq -0x2(%r13), %rcx
movl $0x2, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2260
incq %r13
cmpq 0xc0(%rsp), %r13
jae 0x1d9b6
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
movq $-0x1, %rcx
callq 0x2260
jmp 0x1d9d4
movb $0x1, %r13b
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x14ca2
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x1d6f4
callq 0x2210
testb %r13b, %r13b
je 0x1de76
incq %rbx
cmpq 0xb0(%rsp), %rbx
jne 0x1d631
jmp 0x1dc81
movq %r15, %rdi
leaq 0x6fe6(%rip), %rsi      # 0x24703
callq 0x2090
testl %eax, %eax
je 0x1d757
movq %r15, %rdi
leaq 0x6fd6(%rip), %rsi      # 0x24706
callq 0x2090
testl %eax, %eax
je 0x1d757
movq %r15, %rdi
leaq 0x6fc6(%rip), %rsi      # 0x24709
callq 0x2090
testl %eax, %eax
setne %al
movl 0x3c(%rsp), %ecx
orb %al, %cl
movl %ecx, 0x3c(%rsp)
movq 0xc0(%rsp), %r8
movb 0x30(%rsp), %dl
movb 0x10(%rsp), %al
movb 0x24(%rsp), %cl
cmpq $0x2, %r8
jb 0x1d9a2
movq 0xb8(%rsp), %r13
movq 0xd84c(%rip), %rsi      # 0x2afd0
movq (%rsi), %rsi
movq %rsi, 0xa8(%rsp)
movb 0x34(%rsp), %sil
movb %sil, 0x8(%rsp)
movb 0x33(%rsp), %sil
movb %sil, 0xa(%rsp)
movb 0x32(%rsp), %sil
movb %sil, 0xb(%rsp)
movb 0x31(%rsp), %sil
movb %sil, 0x4(%rsp)
movb 0x1c(%rsp), %sil
movb %sil, 0x5(%rsp)
movb 0x1b(%rsp), %sil
movb %sil, 0xc(%rsp)
movb 0x1a(%rsp), %sil
movb %sil, 0x9(%rsp)
movb 0x11(%rsp), %sil
movb %sil, 0xf(%rsp)
movb 0x13(%rsp), %r11b
movb 0x14(%rsp), %sil
movb %sil, 0xd(%rsp)
movb 0x19(%rsp), %sil
movb %sil, 0xe(%rsp)
movb 0x18(%rsp), %sil
movb %sil, 0x6(%rsp)
movb 0x17(%rsp), %sil
movb %sil, 0x7(%rsp)
movb 0x16(%rsp), %sil
movb %sil, 0x3(%rsp)
movl $0x1, %esi
movb 0x15(%rsp), %r9b
movb (%r13,%rsi), %bpl
movzbl %bpl, %r14d
leal -0x61(%r14), %edi
cmpl $0x19, %edi
ja 0x1d845
movslq (%r12,%rdi,4), %rdi
addq %r12, %rdi
jmpq *%rdi
movb $0x1, 0xd(%rsp)
jmp 0x1d8fa
leal -0x43(%r14), %edi
cmpl $0x9, %edi
ja 0x1da83
leaq 0x59ab(%rip), %r10      # 0x23204
movslq (%r10,%rdi,4), %rdi
addq %r10, %rdi
jmpq *%rdi
movb $0x1, 0x4(%rsp)
jmp 0x1d8fa
movq 0xa8(%rsp), %rdi
movq -0x18(%rdi), %rdi
movq 0xd751(%rip), %r14      # 0x2afd0
movl 0x18(%r14,%rdi), %ebp
andl $-0x4b, %ebp
orl $0x8, %ebp
movl %ebp, 0x18(%r14,%rdi)
movb $0x1, 0x8(%rsp)
jmp 0x1d8fa
movb $0x1, %al
jmp 0x1d8fa
movb $0x1, %cl
jmp 0x1d8fa
movb $0x1, 0xc(%rsp)
jmp 0x1d8fa
movb $0x1, %r11b
movb $0x1, 0x9(%rsp)
jmp 0x1d8fa
movb $0x1, 0xf(%rsp)
jmp 0x1d8fa
movb $0x1, %r9b
jmp 0x1d8fa
movb $0x1, 0xe(%rsp)
jmp 0x1d8fa
movb $0x1, 0xb(%rsp)
jmp 0x1d8fa
movb $0x1, %dl
jmp 0x1d8fa
movb $0x1, 0x7(%rsp)
jmp 0x1d8fa
movb $0x1, 0xa(%rsp)
jmp 0x1d8fa
movb $0x1, 0x12(%rsp)
jmp 0x1d8fa
movb $0x1, 0x3(%rsp)
jmp 0x1d8fa
movb $0x1, 0x6(%rsp)
jmp 0x1d8fa
movb $0x1, %r11b
jmp 0x1d8fa
movb $0x1, 0x5(%rsp)
incq %rsi
cmpq %rsi, %r8
jne 0x1d820
movb 0x3(%rsp), %sil
movb %sil, 0x16(%rsp)
movb %r9b, 0x15(%rsp)
movb 0x7(%rsp), %sil
movb %sil, 0x17(%rsp)
movb 0x8(%rsp), %sil
movb %sil, 0x34(%rsp)
movb 0xa(%rsp), %sil
movb %sil, 0x33(%rsp)
movb 0xb(%rsp), %sil
movb %sil, 0x32(%rsp)
movb 0x4(%rsp), %sil
movb %sil, 0x31(%rsp)
movb 0x5(%rsp), %sil
movb %sil, 0x1c(%rsp)
movb 0xc(%rsp), %sil
movb %sil, 0x1b(%rsp)
movb 0x9(%rsp), %sil
movb %sil, 0x1a(%rsp)
movb %r11b, 0x13(%rsp)
movb 0xd(%rsp), %sil
movb %sil, 0x14(%rsp)
movb 0xe(%rsp), %sil
movb %sil, 0x19(%rsp)
movb 0xf(%rsp), %sil
movb %sil, 0x11(%rsp)
movb 0x6(%rsp), %sil
movb %sil, 0x18(%rsp)
movq 0x80(%rsp), %r14
leaq 0x88(%rsp), %rbp
movb %dl, 0x30(%rsp)
movb %cl, 0x24(%rsp)
movb %al, 0x10(%rsp)
movb $0x1, %r13b
jmp 0x1d6da
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x6a14(%rip), %rdx      # 0x243e0
movq %rdx, %rsi
callq 0x14ece
movq %rbp, %rdi
leaq 0x6d51(%rip), %rsi      # 0x2472f
callq 0x2090
testl %eax, %eax
setne %r13b
je 0x1da68
movq %rbp, %rdi
leaq 0x6d3f(%rip), %rsi      # 0x24734
callq 0x2090
testl %eax, %eax
jne 0x1dbb8
leaq 0x40(%rsp), %rdi
leaq 0x6d2b(%rip), %rsi      # 0x24739
callq 0x2090
testl %eax, %eax
je 0x1da72
leaq 0x40(%rsp), %rdi
leaq 0x68ba(%rip), %rsi      # 0x242dd
callq 0x2090
testl %eax, %eax
je 0x1da79
leaq 0x40(%rsp), %rdi
leaq 0x6d07(%rip), %rsi      # 0x2473f
callq 0x2090
testl %eax, %eax
je 0x1dbaf
leaq 0x40(%rsp), %rdi
leaq 0x503d(%rip), %rsi      # 0x22a8e
callq 0x2090
testl %eax, %eax
jne 0x1dbb8
movl $0x3, %eax
jmp 0x1dbb4
callq 0x16170
jmp 0x1dc4a
xorl %eax, %eax
jmp 0x1dbb4
movl $0x1, %eax
jmp 0x1dbb4
movb 0x3(%rsp), %sil
movb %sil, 0x16(%rsp)
movb %r9b, 0x15(%rsp)
movb 0x7(%rsp), %sil
movb %sil, 0x17(%rsp)
movb 0x8(%rsp), %sil
movb %sil, 0x34(%rsp)
movb 0xa(%rsp), %sil
movb %sil, 0x33(%rsp)
movb 0xb(%rsp), %sil
movb %sil, 0x32(%rsp)
movb 0x4(%rsp), %sil
movb %sil, 0x31(%rsp)
movb 0x5(%rsp), %sil
movb %sil, 0x1c(%rsp)
movb 0xc(%rsp), %sil
movb %sil, 0x1b(%rsp)
movb 0x9(%rsp), %sil
movb %sil, 0x1a(%rsp)
movb %r11b, 0x13(%rsp)
movb 0xd(%rsp), %sil
movb %sil, 0x14(%rsp)
movb 0xe(%rsp), %sil
movb %sil, 0x19(%rsp)
movb 0xf(%rsp), %sil
movb %sil, 0x11(%rsp)
movb 0x6(%rsp), %sil
movb %sil, 0x18(%rsp)
movb %dl, 0x30(%rsp)
movb %cl, 0x24(%rsp)
movb %al, 0x10(%rsp)
movq %r15, %rdi
leaq 0x6be7(%rip), %rsi      # 0x2470c
callq 0x2090
testl %eax, %eax
je 0x1db92
cmpl $0x3f, %r14d
je 0x1db92
cmpl $0x68, %r14d
je 0x1db92
movl $0xe, %edx
movq 0xd48a(%rip), %rdi      # 0x2afd0
leaq 0x6bc6(%rip), %rsi      # 0x24713
callq 0x2290
movb %bpl, 0x88(%rsp)
movl $0x1, %edx
movq 0xd46a(%rip), %rdi      # 0x2afd0
leaq 0x88(%rsp), %rsi
callq 0x2290
movq %rax, %r13
movl $0x11, %edx
movq %rax, %rdi
leaq 0x6b9d(%rip), %rsi      # 0x24722
callq 0x2290
movq %r13, %rdi
callq 0x2100
callq 0x16170
xorl %r13d, %r13d
movq 0x80(%rsp), %r14
leaq 0x88(%rsp), %rbp
jmp 0x1d6da
movl $0x2, %eax
movl %eax, 0x28(%rsp)
movq %rbp, %rdi
leaq 0x419e(%rip), %rsi      # 0x21d60
callq 0x2090
testl %eax, %eax
jne 0x1dbe4
leaq 0x40(%rsp), %rdi
callq 0x1e65f
leal -0x1(%rax), %ecx
cmpl $0xfff, %ecx            # imm = 0xFFF
ja 0x1dbe4
movl %eax, 0x2c(%rsp)
movq %rbp, %rdi
leaq 0x690f(%rip), %rsi      # 0x244fd
callq 0x2090
testl %eax, %eax
jne 0x1dc4a
leaq 0x40(%rsp), %rdi
leaq 0x6b42(%rip), %rsi      # 0x24745
callq 0x2090
testl %eax, %eax
je 0x1dc3d
leaq 0x40(%rsp), %rdi
leaq 0x66c5(%rip), %rsi      # 0x242dd
callq 0x2090
testl %eax, %eax
je 0x1dc44
leaq 0x40(%rsp), %rdi
leaq 0x6b1c(%rip), %rsi      # 0x24749
callq 0x2090
testl %eax, %eax
jne 0x1dc4a
movl $0x2, %eax
jmp 0x1dc46
movl $0x1, %eax
jmp 0x1dc46
xorl %eax, %eax
movl %eax, 0x20(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x1dc5e
callq 0x2210
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x1d6da
callq 0x2210
jmp 0x1d6da
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
cmpq %rcx, %rax
je 0x1de2b
testb $0x1, 0x3c(%rsp)
jne 0x1dcb6
movb $0x1, %dl
movb %dl, 0x13(%rsp)
movb %dl, 0x1a(%rsp)
movb %dl, 0x31(%rsp)
cmpb %dl, 0x10(%rsp)
jne 0x1dcb6
movw $0x1, 0x30(%rsp)
subq %rax, %rcx
leaq 0x110(%rsp), %r14
cmpq $0x21, %rcx
setae %cl
xorl %ebx, %ebx
leaq 0x5dfe(%rip), %r15      # 0x23acf
leaq 0xb8(%rsp), %r13
leaq 0x10(%rsp), %rbp
xorl %r12d, %r12d
testb $0x1, %cl
je 0x1dda5
testq %r12, %r12
je 0x1dd2d
cmpb $0x0, 0x12(%rsp)
jne 0x1dd2d
movq 0xd2d3(%rip), %rcx      # 0x2afd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq 0xd2b5(%rip), %rdi      # 0x2afd0
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq 0x60(%rsp), %rax
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
movq 0xd293(%rip), %rdi      # 0x2afd0
callq 0x2290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2290
cmpb $0x0, 0x12(%rsp)
je 0x1dd73
movl $0x1, %edx
movq 0xd26b(%rip), %rdi      # 0x2afd0
leaq 0x65a0(%rip), %rsi      # 0x2430c
callq 0x2290
jmp 0x1dda5
movq 0xd256(%rip), %rcx      # 0x2afd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq 0xd238(%rip), %rdi      # 0x2afd0
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq 0x60(%rsp), %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq 0x1e56a
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1d4a3
movq %r14, %rdi
callq 0xd350
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x1ddda
callq 0x2210
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x1ddec
callq 0x2210
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x1de06
callq 0x2210
incq %r12
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
addq $0x20, %rbx
movb $0x1, %cl
cmpq %rdx, %r12
jb 0x1dce1
jmp 0x1de76
movq 0xd19e(%rip), %rbx      # 0x2afd0
leaq 0x6914(%rip), %rsi      # 0x2474d
movl $0x24, %edx
movq %rbx, %rdi
callq 0x2290
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq 0xd16c(%rip), %rdi      # 0x2afd0
callq 0x2040
movq %rax, %rdi
callq 0x2170
callq 0x16170
leaq 0x60(%rsp), %rdi
callq 0x1e2e2
xorl %eax, %eax
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1df10
jmp 0x1dea1
jmp 0x1de9a
movq %rax, %rbx
jmp 0x1deb8
jmp 0x1df10
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x1deb8
callq 0x2210
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
jne 0x1df07
jmp 0x1df13
jmp 0x1df2f
jmp 0x1df2f
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x1e5f6
jmp 0x1df32
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x1defa
callq 0x2210
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x1df13
callq 0x2210
jmp 0x1df13
jmp 0x1df2f
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x1df32
callq 0x2210
jmp 0x1df32
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x1e2e2
movq %rbx, %rdi
callq 0x23a0
movq %rax, %rdi
callq 0x14c96