// File: /workspace/github_cpp_makefile_star2_O2/UBOdin[P]jitd-cpp/src/driver.cpp
// Function: main
int main(int argc, char **argv)
{
  istream *src;
  TestMode mode = JITD_TEST;
  int i, t = 0;
  bool interactive;
  JITD<Record, PureLocalPolicy<Record>> jitd;
  
  srand(time(NULL));
//  sleep(1);
  for(i = 1; i < argc; i++){
    ifstream srcF;
    if((strlen(argv[i]) > 1) && (argv[i][0] == '-')){
      string flag(argv[i]);
      if(string("-c") == flag){ mode = COG_TEST; }
      else if(string("-j") == flag){ mode = JITD_TEST; }
      else if(string("-m") == flag){ mode = MAP_TEST; }
      else {
        cerr << "Invalid command line switch: " << flag << endl;
        exit(-1);
      }
    } else {
      if(string("-") == string(argv[i])){
        src = &cin;
        interactive = true;
      } else {
        srcF.open(argv[i], std::ios_base::in);
        src = &srcF;
        interactive = false;
      }
      switch(mode){
        case COG_TEST:
          cog_test(*src);
          break;
        case JITD_TEST:
          t = jitd_test(jitd, *src, interactive, 0);
          cout << "Time[" << argv[i] << "]: " << t << " s" << endl;
          break;
        case MAP_TEST:
          ds_test(*src);
      }
    }
  }
//  sleep(60);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, -0x38(%rbp)
movl %edi, %r14d
leaq -0xd8(%rbp), %rdi
callq 0xd58a
xorl %edi, %edi
callq 0x4230
movl %eax, %edi
callq 0x4250
movslq %r14d, %rax
movq %rax, -0x48(%rbp)
pushq $0x1
popq %r12
pushq $0x1
popq %r15
leaq -0x68(%rbp), %r13
cmpq -0x48(%rbp), %r15
jge 0xd4f9
leaq -0x2e0(%rbp), %rdi
callq 0x42b0
movq -0x38(%rbp), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0x40f0
cmpq $0x2, %rax
jb 0xd3ce
cmpb $0x2d, (%r14)
jne 0xd3ce
movq %r13, %rdi
movq %r14, %rsi
leaq -0x88(%rbp), %r14
movq %r14, %rdx
callq 0x40d0
movq %r14, %rdi
leaq 0x1ba3(%rip), %rsi      # 0xeed9
leaq -0x29(%rbp), %rdx
callq 0x40d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x5850
movl %eax, %ebx
movq %r14, %rdi
callq 0x4110
xorl %r12d, %r12d
testb %bl, %bl
jne 0xd3c1
movq %r14, %rdi
leaq 0x1b77(%rip), %rsi      # 0xeedc
leaq -0x29(%rbp), %rdx
callq 0x40d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x5850
movl %eax, %ebx
movq %r14, %rdi
callq 0x4110
pushq $0x1
popq %r12
testb %bl, %bl
jne 0xd3c1
movq %r14, %rdi
leaq 0x1b4a(%rip), %rsi      # 0xeedf
leaq -0x29(%rbp), %rdx
callq 0x40d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x5850
movq %r14, %rdi
movl %eax, %r14d
callq 0x4110
pushq $0x2
popq %r12
testb %r14b, %r14b
je 0xd519
movq %r13, %rdi
callq 0x4110
jmp 0xd4e5
movq %r13, %rdi
leaq 0xcb6(%rip), %rsi       # 0xe08e
leaq -0x29(%rbp), %rdx
callq 0x40d0
movq -0x38(%rbp), %rax
movq (%rax,%r15,8), %rsi
leaq -0x88(%rbp), %r14
movq %r14, %rdi
leaq -0x2a(%rbp), %rdx
callq 0x40d0
movq %r13, %rdi
movq %r14, %rsi
callq 0x5850
movq %r14, %rdi
movl %eax, %r14d
callq 0x4110
movq %r13, %rdi
callq 0x4110
movq 0x8bb7(%rip), %rsi      # 0x15fd8
testb %r14b, %r14b
jne 0xd451
movq -0x38(%rbp), %rax
movq (%rax,%r15,8), %rsi
movq %r15, -0x40(%rbp)
movq %r13, %rbx
leaq -0x2e0(%rbp), %r13
movq %r13, %rdi
pushq $0x8
popq %rdx
callq 0x4170
movq %r13, %rsi
movq %rbx, %r13
movq -0x40(%rbp), %r15
cmpl $0x2, %r12d
je 0xd4cc
cmpl $0x1, %r12d
jne 0xd4da
movzbl %r14b, %edx
leaq -0xd8(%rbp), %rdi
xorl %ecx, %ecx
callq 0x8364
movl %eax, %r14d
movq 0x8b4f(%rip), %rdi      # 0x15fc8
leaq 0x114e(%rip), %rsi      # 0xe5ce
callq 0x4260
movq -0x38(%rbp), %rcx
movq (%rcx,%r15,8), %rsi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
leaq 0x1135(%rip), %rsi      # 0xe5d4
callq 0x4260
movq %rax, %rdi
movl %r14d, %esi
callq 0x43d0
movq %rax, %rdi
leaq 0x111f(%rip), %rsi      # 0xe5d8
callq 0x4260
movq %rax, %rdi
callq 0x4140
pushq $0x1
popq %r12
jmp 0xd4e5
movq %rsi, %rdi
callq 0xc8fc
pushq $0x2
popq %r12
jmp 0xd4e5
xorl %r12d, %r12d
movq %rsi, %rdi
callq 0x4be7
leaq -0x2e0(%rbp), %rdi
callq 0x4060
incq %r15
jmp 0xd2dd
leaq -0xd8(%rbp), %rdi
callq 0xd704
xorl %eax, %eax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8ad0(%rip), %rdi      # 0x15ff0
leaq 0x19bb(%rip), %rsi      # 0xeee2
callq 0x4260
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
callq 0x4140
pushq $-0x1
popq %rdi
callq 0x42d0
jmp 0xd552
jmp 0xd552
jmp 0xd552
jmp 0xd552
jmp 0xd567
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x4110
jmp 0xd56a
jmp 0xd567
movq %rax, %rbx
jmp 0xd576
movq %rax, %rbx
leaq -0x2e0(%rbp), %rdi
callq 0x4060
leaq -0xd8(%rbp), %rdi
callq 0xd704
movq %rbx, %rdi
callq 0x43e0