// File: jsteemann[P]jshund/src/jshund.cpp
// Function: main
int main (int argc, char* argv[]) {
  if (argc < 2) {
    // not enough arguments
    Bark();
    std::cout << "usage: " << argv[0] << " <file>" << std::endl;
    return EXIT_FAILURE;
  }
 
  // parse options
  bool colors  = true;
  bool globals = true; 
  bool debug   = false; 

  for (int i = 1; i < argc; ++i) {
    const std::string argument(argv[i]);

    if (argument.size() > 2 && argument.substr(0, 2) == "--") { 
      if (argument == "--colors") {
        colors = true;
      }
      else if (argument == "--no-colors") {
        colors = false;
      }
      else if (argument == "--globals") {
        globals = true;
      }
      else if (argument == "--no-globals") {
        globals = false;
      }
      else if (argument == "--debug") {
        debug = true;
      }
      else if (argument == "--help" || argument == "--version" || argument == "--bark") {
        Bark();
        return EXIT_SUCCESS;
      }
    }
  }

  // add files
  std::vector<std::string> files = AddFiles(argc, argv);

  int errors = ProcessFiles(files, colors, globals, debug);

  // return status code based on whether there were any errors
  if (errors == 0) {
    return EXIT_SUCCESS;
  }

  return EXIT_FAILURE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x3660
callq 0x3a00
movq 0x149b5(%rip), %rdi     # 0x17fd0
leaq 0xd9e2(%rip), %rsi      # 0x11004
callq 0x3240
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x3240
movq %rax, %rdi
leaq 0xd9cc(%rip), %rsi      # 0x1100c
callq 0x3240
movq %rax, %rdi
movq 0x14971(%rip), %rsi     # 0x17fc0
callq 0x32a0
movl $0x1, -0x4(%rbp)
jmp 0x39ea
movb $0x1, -0x11(%rbp)
movb $0x1, -0x12(%rbp)
movb $0x0, -0x13(%rbp)
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x3949
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x3470
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0x4060
jmp 0x36bb
leaq -0x39(%rbp), %rdi
callq 0x32c0
leaq -0x38(%rbp), %rdi
callq 0x31b0
movq %rax, %rcx
movb $0x0, -0x71(%rbp)
xorl %eax, %eax
cmpq $0x2, %rcx
movb %al, -0xa9(%rbp)
jbe 0x3724
xorl %eax, %eax
movl %eax, %edx
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x2, %ecx
callq 0x3280
jmp 0x36fa
movb $0x1, -0x71(%rbp)
leaq 0xdada(%rip), %rsi      # 0x111df
leaq -0x70(%rbp), %rdi
callq 0x4110
movb %al, -0xaa(%rbp)
jmp 0x3716
movb -0xaa(%rbp), %al
movb %al, -0xa9(%rbp)
jmp 0x3724
movb -0xa9(%rbp), %al
movb %al, -0xab(%rbp)
testb $0x1, -0x71(%rbp)
jne 0x3738
jmp 0x3741
leaq -0x70(%rbp), %rdi
callq 0x3170
movb -0xab(%rbp), %al
testb $0x1, %al
jne 0x3750
jmp 0x390d
leaq 0xd8bd(%rip), %rsi      # 0x11014
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xac(%rbp)
jmp 0x3768
movb -0xac(%rbp), %al
testb $0x1, %al
jne 0x3774
jmp 0x37ca
movb $0x1, -0x11(%rbp)
jmp 0x390b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x32c0
jmp 0x39f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x393b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x71(%rbp)
jne 0x37bc
jmp 0x37c5
leaq -0x70(%rbp), %rdi
callq 0x3170
jmp 0x393b
leaq 0xd84c(%rip), %rsi      # 0x1101d
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xad(%rbp)
jmp 0x37e2
movb -0xad(%rbp), %al
testb $0x1, %al
jne 0x37ee
jmp 0x37f7
movb $0x0, -0x11(%rbp)
jmp 0x3909
leaq 0xd82b(%rip), %rsi      # 0x11029
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xae(%rbp)
jmp 0x380f
movb -0xae(%rbp), %al
testb $0x1, %al
jne 0x381b
jmp 0x3824
movb $0x1, -0x12(%rbp)
jmp 0x3907
leaq 0xd808(%rip), %rsi      # 0x11033
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xaf(%rbp)
jmp 0x383c
movb -0xaf(%rbp), %al
testb $0x1, %al
jne 0x3848
jmp 0x3851
movb $0x0, -0x12(%rbp)
jmp 0x3905
leaq 0xd7e8(%rip), %rsi      # 0x11040
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xb0(%rbp)
jmp 0x3869
movb -0xb0(%rbp), %al
testb $0x1, %al
jne 0x3875
jmp 0x387e
movb $0x1, -0x13(%rbp)
jmp 0x3903
leaq 0xd7c3(%rip), %rsi      # 0x11048
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xb1(%rbp)
jmp 0x3896
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x38ea
jmp 0x38a2
leaq 0xd7a6(%rip), %rsi      # 0x1104f
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xb2(%rbp)
jmp 0x38ba
movb -0xb2(%rbp), %al
testb $0x1, %al
jne 0x38ea
jmp 0x38c6
leaq 0xd78c(%rip), %rsi      # 0x11059
leaq -0x38(%rbp), %rdi
callq 0x4110
movb %al, -0xb3(%rbp)
jmp 0x38de
movb -0xb3(%rbp), %al
testb $0x1, %al
jne 0x38ea
jmp 0x3901
callq 0x3a00
jmp 0x38f1
movl $0x0, -0x4(%rbp)
movl $0x1, -0x78(%rbp)
jmp 0x3914
jmp 0x3903
jmp 0x3905
jmp 0x3907
jmp 0x3909
jmp 0x390b
jmp 0x390d
movl $0x0, -0x78(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3170
movl -0x78(%rbp), %eax
testl %eax, %eax
je 0x392b
jmp 0x3926
jmp 0x39ea
jmp 0x392d
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3673
leaq -0x38(%rbp), %rdi
callq 0x3170
jmp 0x39f6
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq -0x90(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x3af0
movq -0xc0(%rbp), %rdi
movzbl -0x13(%rbp), %ecx
movzbl -0x12(%rbp), %edx
movzbl -0x11(%rbp), %esi
andl $0x1, %esi
andl $0x1, %edx
andl $0x1, %ecx
callq 0x3d20
movb %al, -0xb4(%rbp)
jmp 0x398c
movb -0xb4(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
jne 0x39d0
movl $0x0, -0x4(%rbp)
movl $0x1, -0x78(%rbp)
jmp 0x39de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4140
jmp 0x39f6
movl $0x1, -0x4(%rbp)
movl $0x1, -0x78(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4140
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3460
nop