// File: 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
subq $0x420, %rsp            # imm = 0x420
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x1ef40
xorl %eax, %eax
movl %eax, %edi
callq 0x4260
movl %eax, %edi
callq 0x4270
movl $0x1, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x1ef10
leaq -0x280(%rbp), %rdi
callq 0x42e0
jmp 0x1e941
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x40f0
cmpq $0x1, %rax
jbe 0x1ec5e
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1ec5e
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x390(%rbp)
leaq -0x2b1(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x4430
movq -0x390(%rbp), %rsi
movq -0x388(%rbp), %rdx
leaq -0x2b0(%rbp), %rdi
callq 0x4340
jmp 0x1e9b6
leaq -0x2b1(%rbp), %rdi
callq 0x42d0
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x4430
movq -0x398(%rbp), %rdx
leaq 0x2632(%rip), %rsi      # 0x21015
leaq -0x2d8(%rbp), %rdi
callq 0x4340
jmp 0x1e9f1
leaq -0x2d8(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x7690
movb %al, -0x399(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x4180
leaq -0x2d9(%rbp), %rdi
callq 0x42d0
movb -0x399(%rbp), %al
testb $0x1, %al
jne 0x1ea2e
jmp 0x1ea97
movl $0x0, -0x1c(%rbp)
jmp 0x1ec3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
jmp 0x1ef25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
leaq -0x2b1(%rbp), %rdi
callq 0x42d0
jmp 0x1ef02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
leaq -0x2d9(%rbp), %rdi
callq 0x42d0
jmp 0x1ec4d
leaq -0x301(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x4430
movq -0x3a8(%rbp), %rdx
leaq 0x2560(%rip), %rsi      # 0x21018
leaq -0x300(%rbp), %rdi
callq 0x4340
jmp 0x1eac6
leaq -0x300(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x7690
movb %al, -0x3a9(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x4180
leaq -0x301(%rbp), %rdi
callq 0x42d0
movb -0x3a9(%rbp), %al
testb $0x1, %al
jne 0x1eb03
jmp 0x1eb32
movl $0x1, -0x1c(%rbp)
jmp 0x1ec3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
leaq -0x301(%rbp), %rdi
callq 0x42d0
jmp 0x1ec4d
leaq -0x329(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x4430
movq -0x3b8(%rbp), %rdx
leaq 0x24c8(%rip), %rsi      # 0x2101b
leaq -0x328(%rbp), %rdi
callq 0x4340
jmp 0x1eb61
leaq -0x328(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x7690
movb %al, -0x3b9(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x4180
leaq -0x329(%rbp), %rdi
callq 0x42d0
movb -0x3b9(%rbp), %al
testb $0x1, %al
jne 0x1eb9e
jmp 0x1ebcd
movl $0x2, -0x1c(%rbp)
jmp 0x1ec38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
leaq -0x329(%rbp), %rdi
callq 0x42d0
jmp 0x1ec4d
movq 0x1141c(%rip), %rdi     # 0x2fff0
leaq 0x2443(%rip), %rsi      # 0x2101e
callq 0x4280
movq %rax, -0x3c8(%rbp)
jmp 0x1ebe9
movq -0x3c8(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x4240
movq %rax, -0x3d0(%rbp)
jmp 0x1ec05
movq -0x3d0(%rbp), %rdi
movq 0x1138d(%rip), %rsi     # 0x2ffa0
callq 0x42c0
jmp 0x1ec1a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4300
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
jmp 0x1ec4d
jmp 0x1ec3a
jmp 0x1ec3c
leaq -0x2b0(%rbp), %rdi
callq 0x4180
jmp 0x1eee8
leaq -0x2b0(%rbp), %rdi
callq 0x4180
jmp 0x1ef02
leaq -0x351(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x4430
movq -0x3d8(%rbp), %rdx
leaq 0x1477(%rip), %rsi      # 0x200f6
leaq -0x350(%rbp), %rdi
callq 0x4340
jmp 0x1ec8d
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x3e8(%rbp)
leaq -0x379(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x4430
movq -0x3e8(%rbp), %rsi
movq -0x3e0(%rbp), %rdx
leaq -0x378(%rbp), %rdi
callq 0x4340
jmp 0x1eccf
leaq -0x350(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x7690
movb %al, -0x3e9(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x4180
leaq -0x379(%rbp), %rdi
callq 0x42d0
leaq -0x350(%rbp), %rdi
callq 0x4180
leaq -0x351(%rbp), %rdi
callq 0x42d0
movb -0x3e9(%rbp), %al
testb $0x1, %al
jne 0x1ed24
jmp 0x1ed87
movq 0x112ad(%rip), %rax     # 0x2ffd8
movq %rax, -0x18(%rbp)
movb $0x1, -0x25(%rbp)
jmp 0x1edce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
jmp 0x1ed76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
leaq -0x379(%rbp), %rdi
callq 0x42d0
leaq -0x350(%rbp), %rdi
callq 0x4180
leaq -0x351(%rbp), %rdi
callq 0x42d0
jmp 0x1ef02
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x280(%rbp), %rdi
movl $0x8, %edx
callq 0x4190
jmp 0x1eda6
leaq -0x280(%rbp), %rax
movq %rax, -0x18(%rbp)
movb $0x0, -0x25(%rbp)
jmp 0x1edce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x288(%rbp)
movl %eax, -0x28c(%rbp)
jmp 0x1ef02
movl -0x1c(%rbp), %eax
movl %eax, -0x3f0(%rbp)
testl %eax, %eax
je 0x1edfe
jmp 0x1eddd
movl -0x3f0(%rbp), %eax
subl $0x1, %eax
je 0x1ee0e
jmp 0x1edea
movl -0x3f0(%rbp), %eax
subl $0x2, %eax
je 0x1eed9
jmp 0x1eee6
movq -0x18(%rbp), %rdi
callq 0x5d90
jmp 0x1ee09
jmp 0x1eee6
movq -0x18(%rbp), %rsi
movzbl -0x25(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
xorl %ecx, %ecx
callq 0xfb10
movl %eax, -0x3f4(%rbp)
jmp 0x1ee2c
movl -0x3f4(%rbp), %eax
movl %eax, -0x24(%rbp)
movq 0x1118c(%rip), %rdi     # 0x2ffc8
leaq 0x1983(%rip), %rsi      # 0x207c6
callq 0x4280
movq %rax, -0x400(%rbp)
jmp 0x1ee51
movq -0x400(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4280
movq %rax, -0x408(%rbp)
jmp 0x1ee72
movq -0x408(%rbp), %rdi
leaq 0x194c(%rip), %rsi      # 0x207cc
callq 0x4280
movq %rax, -0x410(%rbp)
jmp 0x1ee8e
movq -0x410(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x4410
movq %rax, -0x418(%rbp)
jmp 0x1eea6
movq -0x418(%rbp), %rdi
leaq 0x191c(%rip), %rsi      # 0x207d0
callq 0x4280
movq %rax, -0x420(%rbp)
jmp 0x1eec2
movq -0x420(%rbp), %rdi
movq 0x110d0(%rip), %rsi     # 0x2ffa0
callq 0x42c0
jmp 0x1eed7
jmp 0x1eee6
movq -0x18(%rbp), %rdi
callq 0x1c390
jmp 0x1eee4
jmp 0x1eee6
jmp 0x1eee8
leaq -0x280(%rbp), %rdi
callq 0x4060
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1e927
leaq -0x280(%rbp), %rdi
callq 0x4060
jmp 0x1ef25
leaq -0x78(%rbp), %rdi
callq 0x1f120
movl -0x4(%rbp), %eax
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x1f120
movq -0x288(%rbp), %rdi
callq 0x4420
nopw (%rax,%rax)