// File: /workspace/github_cpp_makefile_star2_O3/NFAcz[P]compareQC/main.cpp
// Function: main
int main(int argc, char** argv) {

  if(cmdOptionExists(argv, argv+argc, "-h"))
  {
    help(argv[0]);
    return 0;
  }

  char * filename1 = getCmdOption(argv, argv + argc, "-a");
  char * filename2 = getCmdOption(argv, argv + argc, "-b");
  char * thresh = getCmdOption(argv, argv + argc, "-t");
  char * jump = getCmdOption(argv, argv + argc, "-s");
  char * verbose = getCmdOption(argv, argv + argc, "-v");

  float THRESHOLD = 7.5;
  int JUMP = 1;
  int something = 0;

  float lowest = 1024.0;
  float index = 0;
  string TCindex;

  int hours = 0;
  int minutes = 0;
  int seconds = 0;
  int frames = 0;

  bool DEBUG = false;

  if(verbose){
    DEBUG = true;
  }

  // parse -t
  if(thresh){
    std::string ts(thresh);
    THRESHOLD = float(strtof(ts.c_str(),NULL));
  }

  //parse -s
  if(jump){
    std::string ts(jump);
    JUMP = int(strtof(ts.c_str(),NULL));
  }

  //parse -a and -b (no file existance check so far)
  if (filename1 && filename2){
    std::vector<float> a,b;
    if(DEBUG)
      std::cout << "loading file A: " << filename1 << std::endl;

    if(is_match(filename1,".xml.gz")){
      a = load(filename1,JUMP);
    }else if(is_match(filename1,".txt")){
      a = loadFromTxt(filename1,JUMP);
    }

    if(DEBUG)
      std::cout << "loaded " << a.size() << " frames of total " << (JUMP * a.size()) << " (skip "<< JUMP <<")" << std::endl;


    if(DEBUG)
      std::cout << "loading file B: " << filename2 << std::endl;

    if(is_match(filename2,".xml.gz")){
      b = load(filename2,JUMP);
    }else if(is_match(filename2,".txt")){
      b = loadFromTxt(filename2,JUMP);
    }

    if(DEBUG)
      std::cout << "loaded " << b.size() << " frames of total " << (JUMP * b.size()) << " (skip "<< JUMP <<")" << std::endl;

    if(DEBUG)
      std::cout << "detected FPS: " << FPS << std::endl;

    if(DEBUG)
      std::cout << "comparing..." << std::endl;

    if(a.size()>b.size()){
      std::cerr << yellow << "Note: input file A should be shorter than B file ("<<filename2<<")" << reset << std::endl;
      return 1;
    }

    // sample comparation main loop
    for(int i = 0 ; i < b.size() - a.size() ; i++){


      // timecode estimation
      //
      if(frames * JUMP >= FPS){
        frames = 0;
        seconds++;
      }

      if(seconds > 59){
        seconds = 0;
        minutes++;
      }

      if(minutes > 59){
        minutes = 0;
        hours++;
      }

      stringstream tc;
      tc << setfill('0') << std::setw(2) << hours;
      tc << ":";
      tc << setfill('0') << std::setw(2) << minutes;
      tc << ":";
      tc << setfill('0') << std::setw(2) << seconds;
      tc << ":";
      tc << setfill('0') << std::setw(2) << frames;
      string TC = tc.str();



      // weird placement but if match is perfect it needs to be broken here
      if(something==2){
        break;
      }

      // if the diff of first sample of B is whitin threshold do seek more samples
      if(fabs(b[i]-a[0])<THRESHOLD){

        float avg = 0;

        // compute average diffenrence
        int cnt = 0;

        for(int ii = 0 ; ii < a.size() ; ii++){
          avg = avg + ( fabs( b[ii+i] - a[ii] ));
          cnt++;
        }
        avg = avg / cnt;

        // this means perfect match
        if(avg==0.0){
          something = 2;
          index = i * JUMP;
          TCindex = TC;
        }

        // record if avg in range
        if(avg < THRESHOLD && something !=2 ){
          something = 1;
          index = i * JUMP;
          TCindex = TC;
        }

        // collect the best fitting record
        if(avg < lowest){
          lowest = avg;
          index = i * JUMP;
          TCindex = TC;
        }

      }

      frames+=1;
    }

  }else{
    help(argv[0]);
    return 0;
  }

  if(something==0){
    if(DEBUG)
    std::cout << "NO match, threshold is " << THRESHOLD << ", best: " << yellow << lowest << reset << " (" << filename2 << ")" << std::endl;
    //std::cout << "FR: " << index << std::endl;
    //std::cout << "TC: " << TCindex << std::endl;
    return 1;
  }

  if(something==1){
    std::cout << green << "close MATCH found" << reset << " whitin threshold of " << THRESHOLD << ", it scores: " << yellow << lowest << reset << std::endl;
    std::cout << filename2 << std::endl;
    std::cout << "FR: " << index << std::endl;
    std::cout << "TC: " << TCindex << std::endl;
  }

  if(something==2){
    std::cout << green << "complete MATCH!" << reset << " file " << filename1 << " and " << filename2 << " are the same @:" << std::endl;
    std::cout << "FR: " << index << std::endl;
    std::cout << "TC: " << TCindex << std::endl;
    return 0;
  }
  return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, %rbx
movl %edi, %r14d
leaq -0x268(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x807d(%rip), %rsi      # 0xe137
leaq 0x8078(%rip), %rdx      # 0xe139
leaq -0x278(%rbp), %rdi
callq 0x7c44
movslq %r14d, %rax
leaq (%rbx,%rax,8), %r14
leaq -0x278(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ce2
movq %rax, %r15
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x6104
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
cmpq %r14, %r15
je 0x6151
movq (%rbx), %rsi
leaq -0x2d8(%rbp), %rdi
leaq -0x278(%rbp), %rdx
callq 0x78fc
leaq -0x2d8(%rbp), %rdi
callq 0x5fc5
leaq -0x2c8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x614a
movq -0x2c8(%rbp), %rsi
incq %rsi
callq 0x5280
xorl %ebx, %ebx
jmp 0x76e3
leaq -0x278(%rbp), %rdi
movq %r12, (%rdi)
leaq 0x7fd8(%rip), %rsi      # 0xe13a
leaq 0x7fd3(%rip), %rdx      # 0xe13c
callq 0x7c44
leaq -0x278(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ce2
cmpq %r14, %rax
je 0x6193
addq $0x8, %rax
cmpq %r14, %rax
je 0x6193
movq (%rax), %r12
jmp 0x6196
xorl %r12d, %r12d
movq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x61b8
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
leaq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
movq %rax, (%rdi)
leaq 0x7f6d(%rip), %rsi      # 0xe13d
leaq 0x7f68(%rip), %rdx      # 0xe13f
callq 0x7c44
leaq -0x278(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ce2
cmpq %r14, %rax
je 0x6205
addq $0x8, %rax
cmpq %r14, %rax
je 0x6205
movq (%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x620d
movq $0x0, -0x58(%rbp)
movq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x622f
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
leaq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
movq %rax, (%rdi)
leaq 0x7ef9(%rip), %rsi      # 0xe140
leaq 0x7ef4(%rip), %rdx      # 0xe142
callq 0x7c44
leaq -0x278(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ce2
cmpq %r14, %rax
je 0x6278
addq $0x8, %rax
cmpq %r14, %rax
je 0x6278
movq (%rax), %r15
jmp 0x627b
xorl %r15d, %r15d
movq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x629d
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
leaq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
movq %rax, (%rdi)
leaq 0x7e8e(%rip), %rsi      # 0xe143
leaq 0x7e89(%rip), %rdx      # 0xe145
callq 0x7c44
leaq -0x278(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ce2
cmpq %r14, %rax
movq %r12, -0xc0(%rbp)
je 0x62ed
addq $0x8, %rax
cmpq %r14, %rax
je 0x62ed
movq (%rax), %r13
jmp 0x62f0
xorl %r13d, %r13d
movq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x6312
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
leaq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
movq %rax, (%rdi)
leaq 0x7e1c(%rip), %rsi      # 0xe146
leaq 0x7e17(%rip), %rdx      # 0xe148
callq 0x7c44
leaq -0x278(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ce2
movb $0x1, -0x29(%rbp)
cmpq %r14, %rax
je 0x6362
addq $0x8, %rax
cmpq %r14, %rax
je 0x6362
cmpq $0x0, (%rax)
sete -0x29(%rbp)
movq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x6384
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
leaq -0xd8(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
testq %r15, %r15
je 0x63f7
leaq -0x278(%rbp), %r14
leaq -0x268(%rbp), %r12
movq %r12, (%r14)
movq %r15, %rdi
callq 0x5110
leaq (%rax,%r15), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x7c44
movq -0x278(%rbp), %rdi
xorl %esi, %esi
callq 0x5320
movss %xmm0, -0x6c(%rbp)
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x6404
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
jmp 0x6404
movss 0x7c09(%rip), %xmm0     # 0xe008
movss %xmm0, -0x6c(%rbp)
testq %r13, %r13
je 0x6478
leaq -0x278(%rbp), %r14
leaq -0x268(%rbp), %r12
movq %r12, (%r14)
movq %r13, %rdi
callq 0x5110
leaq (%rax,%r13), %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x7c44
movq -0x278(%rbp), %rdi
xorl %esi, %esi
callq 0x5320
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
movq -0xc0(%rbp), %r15
movb -0x29(%rbp), %r13b
je 0x646f
movq -0x268(%rbp), %rsi
incq %rsi
movss %xmm0, -0x68(%rbp)
callq 0x5280
movss -0x68(%rbp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x3c(%rbp)
jmp 0x6491
movl $0x1, -0x3c(%rbp)
movq -0xc0(%rbp), %r15
leaq -0x268(%rbp), %r12
movb -0x29(%rbp), %r13b
testq %r15, %r15
je 0x6666
cmpq $0x0, -0x58(%rbp)
je 0x6666
testb %r13b, %r13b
jne 0x65ae
movq $0x0, -0x48(%rbp)
movq 0xeaeb(%rip), %rdi      # 0x14fa8
leaq 0x7c85(%rip), %rsi      # 0xe149
movl $0x10, %edx
movq $0x0, -0x38(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
callq 0x52d0
movq %r15, %rdi
callq 0x5110
movq $0x0, -0x48(%rbp)
movq 0xeaab(%rip), %rbx      # 0x14fa8
movq $0x0, -0x38(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x52d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movq $0x0, -0x48(%rbp)
movsbl %al, %esi
movq 0xea3f(%rip), %rdi      # 0x14fa8
movq $0x0, -0x38(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
callq 0x5030
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
movq %rax, %rdi
callq 0x5190
leaq -0x278(%rbp), %rbx
movq %r12, (%rbx)
movq %r15, %rdi
callq 0x5110
leaq (%rax,%r15), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7c44
leaq -0x90(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x7b79(%rip), %rsi      # 0xe15a
leaq 0x7b79(%rip), %rdx      # 0xe161
leaq -0xa0(%rbp), %rdi
callq 0x7c44
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rcx
leaq -0x278(%rbp), %rdi
xorl %edx, %edx
callq 0x5440
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x662e
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x5280
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x6649
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
cmpq $-0x1, %rbx
je 0x66ae
leaq -0x278(%rbp), %rdi
movq %r15, %rsi
movl -0x3c(%rbp), %edx
callq 0x5ae4
jmp 0x675d
movq (%rbx), %rsi
leaq -0x2b8(%rbp), %rdi
leaq -0x278(%rbp), %rdx
callq 0x78fc
leaq -0x2b8(%rbp), %rdi
callq 0x5fc5
leaq -0x2a8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66a7
movq -0x2a8(%rbp), %rsi
incq %rsi
callq 0x5280
xorl %ebx, %ebx
jmp 0x76c1
leaq -0x278(%rbp), %rbx
movq %r12, (%rbx)
movq %r15, %rdi
callq 0x5110
leaq (%rax,%r15), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7c44
leaq -0xa0(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x7a82(%rip), %rsi      # 0xe162
leaq 0x7a7f(%rip), %rdx      # 0xe166
callq 0x7c44
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rcx
leaq -0x278(%rbp), %rdi
xorl %edx, %edx
callq 0x5440
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x6726
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x5280
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x6741
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
cmpq $-0x1, %rbx
je 0x76f7
leaq -0x278(%rbp), %rdi
movq %r15, %rsi
movl -0x3c(%rbp), %edx
callq 0x5956
movq -0x278(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x270(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x268(%rbp), %rax
movq %rax, -0x78(%rbp)
testb %r13b, %r13b
jne 0x699e
movq $0x0, -0x48(%rbp)
movq 0xe80f(%rip), %rdi      # 0x14fa8
leaq 0x79c7(%rip), %rsi      # 0xe167
movl $0x7, %edx
movq $0x0, -0x38(%rbp)
callq 0x52d0
movq -0xb0(%rbp), %rbx
subq -0x50(%rbp), %rbx
sarq $0x2, %rbx
movq $0x0, -0x48(%rbp)
movq 0xe7d8(%rip), %rdi      # 0x14fa8
movq $0x0, -0x38(%rbp)
movq %rbx, %rsi
callq 0x5180
movq %rax, %r14
movq $0x0, -0x48(%rbp)
leaq 0x797d(%rip), %rsi      # 0xe16f
movl $0x11, %edx
movq $0x0, -0x38(%rbp)
movq %rax, %rdi
callq 0x52d0
movslq -0x3c(%rbp), %rax
imulq %rax, %rbx
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5180
movq %rax, %rbx
movq $0x0, -0x48(%rbp)
leaq 0x7945(%rip), %rsi      # 0xe181
movl $0x7, %edx
movq $0x0, -0x38(%rbp)
movq %rax, %rdi
callq 0x52d0
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq %rbx, %rdi
movl -0x3c(%rbp), %esi
callq 0x5430
movq %rax, %rbx
movq $0x0, -0x48(%rbp)
leaq 0x8040(%rip), %rsi      # 0xe8be
movl $0x1, %edx
movq $0x0, -0x38(%rbp)
movq %rax, %rdi
callq 0x52d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movl $0xa, %esi
callq 0x5250
movq $0x0, -0x48(%rbp)
movsbl %al, %esi
movq $0x0, -0x38(%rbp)
movq %rbx, %rdi
callq 0x5030
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq %rax, %rdi
callq 0x5190
movq $0x0, -0x48(%rbp)
movq 0xe6af(%rip), %rdi      # 0x14fa8
leaq 0x7889(%rip), %rsi      # 0xe189
movl $0x10, %edx
movq $0x0, -0x38(%rbp)
callq 0x52d0
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x5110
movq $0x0, -0x48(%rbp)
movq 0xe67b(%rip), %rbx      # 0x14fa8
movq $0x0, -0x38(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x52d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movq $0x0, -0x48(%rbp)
movsbl %al, %esi
movq 0xe62f(%rip), %rdi      # 0x14fa8
movq $0x0, -0x38(%rbp)
callq 0x5030
movq $0x0, -0x48(%rbp)
movq $0x0, -0x38(%rbp)
movq %rax, %rdi
callq 0x5190
leaq -0x278(%rbp), %rbx
movq %r12, (%rbx)
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x5110
leaq (%rax,%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7c44
leaq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %r14
movq %r14, (%rdi)
leaq 0x777f(%rip), %rsi      # 0xe15a
leaq 0x777f(%rip), %rdx      # 0xe161
callq 0x7c44
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rcx
leaq -0x278(%rbp), %rdi
xorl %edx, %edx
callq 0x5440
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x6a21
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x5280
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x6a3c
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
cmpq $-0x1, %rbx
je 0x6a5a
leaq -0x278(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x3c(%rbp), %edx
callq 0x5ae4
jmp 0x6b15
leaq -0x278(%rbp), %rbx
movq %r12, (%rbx)
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x5110
leaq (%rax,%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7c44
leaq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %r14
movq %r14, (%rdi)
leaq 0x76cb(%rip), %rsi      # 0xe162
leaq 0x76c8(%rip), %rdx      # 0xe166
callq 0x7c44
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rcx
leaq -0x278(%rbp), %rdi
xorl %edx, %edx
callq 0x5440
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x6add
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x5280
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x6af8
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x5280
cmpq $-0x1, %rbx
je 0x7717
leaq -0x278(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x3c(%rbp), %edx
callq 0x5956
movq -0x278(%rbp), %rcx
movq -0x270(%rbp), %r12
movq -0x268(%rbp), %rax
movq %rax, -0x48(%rbp)
testb %r13b, %r13b
movq %rcx, -0x38(%rbp)
je 0x6b43
subq %rcx, %r12
sarq $0x2, %r12
jmp 0x6c95
movq 0xe45e(%rip), %rdi      # 0x14fa8
leaq 0x7616(%rip), %rsi      # 0xe167
movl $0x7, %edx
callq 0x52d0
subq -0x38(%rbp), %r12
sarq $0x2, %r12
movq 0xe43e(%rip), %rdi      # 0x14fa8
movq %r12, %rsi
callq 0x5180
movq %rax, %rbx
leaq 0x75f3(%rip), %rsi      # 0xe16f
movl $0x11, %edx
movq %rax, %rdi
callq 0x52d0
movslq -0x3c(%rbp), %rsi
imulq %r12, %rsi
movq %rbx, %rdi
callq 0x5180
movq %rax, %rbx
leaq 0x75de(%rip), %rsi      # 0xe181
movl $0x7, %edx
movq %rax, %rdi
callq 0x52d0
movq %rbx, %rdi
movl -0x3c(%rbp), %esi
callq 0x5430
movq %rax, %rbx
leaq 0x7cf9(%rip), %rsi      # 0xe8be
movl $0x1, %edx
movq %rax, %rdi
callq 0x52d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq 0xe3a8(%rip), %rdi      # 0x14fa8
leaq 0x7593(%rip), %rsi      # 0xe19a
movl $0xe, %edx
callq 0x52d0
cvtss2sd 0xe65f(%rip), %xmm0     # 0x15278
movq 0xe388(%rip), %rdi      # 0x14fa8
callq 0x53d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq 0xe352(%rip), %rbx      # 0x14fa8
leaq 0x754c(%rip), %rsi      # 0xe1a9
movl $0xc, %edx
movq %rbx, %rdi
callq 0x52d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq 0xe320(%rip), %rdi      # 0x14fa8
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq -0xb0(%rbp), %rax
movq -0x50(%rbp), %r14
subq %r14, %rax
sarq $0x2, %rax
cmpq %rax, %r12
movq %rax, -0x288(%rbp)
jae 0x6d79
movq 0xe622(%rip), %rsi      # 0x152e0
movq 0xe623(%rip), %rdx      # 0x152e8
movq 0xe31c(%rip), %rdi      # 0x14fe8
callq 0x52d0
movq %rax, %rbx
leaq 0x74db(%rip), %rsi      # 0xe1b6
movl $0x32, %edx
movq %rax, %rdi
callq 0x52d0
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x5110
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x52d0
leaq 0x7bb5(%rip), %rsi      # 0xe8be
movl $0x1, %edx
movq %rbx, %rdi
callq 0x52d0
movq 0xe623(%rip), %rsi      # 0x15340
movq 0xe624(%rip), %rdx      # 0x15348
movq %rbx, %rdi
callq 0x52d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movl $0x1, %ebx
xorl %r13d, %r13d
movsd 0x72b2(%rip), %xmm0     # 0xe018
movsd %xmm0, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x50(%rbp), %r14
jmp 0x6da2
movq %r12, %rcx
subq %rax, %rcx
movq %rcx, -0x298(%rbp)
jne 0x6dab
xorl %r13d, %r13d
movsd 0x7285(%rip), %xmm0     # 0xe018
movsd %xmm0, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
xorl %ebx, %ebx
movq -0x38(%rbp), %rdi
jmp 0x723b
movq %r12, -0x280(%rbp)
cmpq $0x1, %rax
adcq $0x0, %rax
movq %rax, -0x290(%rbp)
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0xc4(%rbp)
movss 0x7234(%rip), %xmm0     # 0xe00c
movss %xmm0, -0x70(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq $0x0, -0xa8(%rbp)
movl $0x0, -0x60(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x7c(%rbp)
movl $0x0, -0x68(%rbp)
xorl %ebx, %ebx
xorl %r12d, %r12d
movl $0x0, -0xb8(%rbp)
movl -0x68(%rbp), %edx
movl %edx, %eax
imull -0x3c(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss 0xe448(%rip), %xmm1     # 0x15278
ucomiss %xmm1, %xmm0
sbbl $-0x1, %ebx
ucomiss %xmm1, %xmm0
movl $0x0, %ecx
cmovael %ecx, %edx
movl %edx, -0x68(%rbp)
xorl %eax, %eax
cmpl $0x3c, %ebx
setge %al
cmovgel %ecx, %ebx
addl %eax, %r12d
xorl %r14d, %r14d
cmpl $0x3c, %r12d
setge %r15b
cmovgel %ecx, %r12d
leaq -0x278(%rbp), %rdi
callq 0x51b0
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rcx
leaq -0x268(%rbp), %rdx
leaq (%rdx,%rcx), %r13
cmpb $0x0, -0x187(%rbp,%rcx)
jne 0x6ea9
movq %r13, %rdi
movl $0x20, %esi
callq 0x5250
movb $0x1, 0xe1(%r13)
movq -0x268(%rbp), %rax
movb %r15b, %r14b
movl -0xb8(%rbp), %esi
addl %r14d, %esi
movb $0x30, 0xe0(%r13)
movq -0x18(%rax), %rax
movq $0x2, -0x258(%rbp,%rax)
leaq -0x268(%rbp), %r14
movq %r14, %rdi
movl %esi, -0xb8(%rbp)
callq 0x5430
movl $0x1, %edx
movq %r14, %rdi
leaq 0x7385(%rip), %rsi      # 0xe276
callq 0x52d0
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r13
cmpb $0x0, -0x187(%rbp,%rcx)
jne 0x6f2b
movq %r13, %rdi
movl $0x20, %esi
callq 0x5250
movb $0x1, 0xe1(%r13)
movq -0x268(%rbp), %rax
movb $0x30, 0xe0(%r13)
movq -0x18(%rax), %rax
movq $0x2, -0x258(%rbp,%rax)
movq %r14, %rdi
movl %r12d, %esi
callq 0x5430
movl $0x1, %edx
movq %r14, %rdi
leaq 0x7319(%rip), %rsi      # 0xe276
callq 0x52d0
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r13
cmpb $0x0, -0x187(%rbp,%rcx)
jne 0x6f97
movq %r13, %rdi
movl $0x20, %esi
callq 0x5250
movb $0x1, 0xe1(%r13)
movq -0x268(%rbp), %rax
movb $0x30, 0xe0(%r13)
movq -0x18(%rax), %rax
movq $0x2, -0x258(%rbp,%rax)
movq %r14, %rdi
movl %ebx, %esi
callq 0x5430
movl $0x1, %edx
movq %r14, %rdi
leaq 0x72ae(%rip), %rsi      # 0xe276
callq 0x52d0
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r13
cmpb $0x0, -0x187(%rbp,%rcx)
jne 0x7002
movq %r13, %rdi
movl $0x20, %esi
callq 0x5250
movb $0x1, 0xe1(%r13)
movq -0x268(%rbp), %rax
movb $0x30, 0xe0(%r13)
movq -0x18(%rax), %rax
movq $0x2, -0x258(%rbp,%rax)
leaq -0x268(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x5430
leaq -0xa0(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x53c0
movl $0x2, %r13d
cmpl $0x2, -0x60(%rbp)
je 0x7198
movq -0x38(%rbp), %rax
movq -0xa8(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x50(%rbp), %rax
subss (%rax), %xmm0
andps 0x6fb5(%rip), %xmm0     # 0xe020
movss -0x6c(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x7109
cmpq %rax, -0xb0(%rbp)
je 0x7109
xorps %xmm2, %xmm2
xorl %eax, %eax
movq -0x50(%rbp), %rcx
movq -0x290(%rbp), %rdx
movaps 0x6f83(%rip), %xmm1     # 0xe020
movq -0xf0(%rbp), %rsi
movss (%rsi,%rax,4), %xmm0
subss (%rcx,%rax,4), %xmm0
andps %xmm1, %xmm0
addss %xmm0, %xmm2
incq %rax
cmpq %rax, %rdx
jne 0x70a4
divss -0xc4(%rbp), %xmm2
ucomiss 0x6f44(%rip), %xmm2     # 0xe010
movss %xmm2, -0xb4(%rbp)
jne 0x7114
jp 0x7114
leaq -0xe8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5160
movl -0x3c(%rbp), %eax
imull -0xa8(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x7c(%rbp)
movl $0x2, %r13d
jmp 0x7151
movss -0x70(%rbp), %xmm0
movl -0x60(%rbp), %r13d
jmp 0x7190
movss -0x6c(%rbp), %xmm0
ucomiss %xmm2, %xmm0
movl -0x60(%rbp), %r13d
jbe 0x7151
leaq -0xe8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5160
movl -0x3c(%rbp), %eax
imull -0xa8(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x7c(%rbp)
movl $0x1, %r13d
movss -0x70(%rbp), %xmm0
ucomiss -0xb4(%rbp), %xmm0
jbe 0x7190
leaq -0xe8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5160
movl -0x3c(%rbp), %eax
imull -0xa8(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x7c(%rbp)
movss -0xb4(%rbp), %xmm0
incl -0x68(%rbp)
movss %xmm0, -0x70(%rbp)
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x71ba
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x5280
leaq -0x278(%rbp), %rdi
movq 0xdd98(%rip), %rsi      # 0x14f60
callq 0x51e0
leaq -0x1f8(%rbp), %rdi
callq 0x50c0
cmpl $0x2, -0x60(%rbp)
je 0x7209
movq -0xa8(%rbp), %rcx
incq %rcx
addq $0x4, -0xf0(%rbp)
movl %r13d, -0x60(%rbp)
movq %rcx, -0xa8(%rbp)
cmpq -0x298(%rbp), %rcx
jne 0x6e18
xorps %xmm0, %xmm0
cvtss2sd -0x7c(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
xorps %xmm0, %xmm0
cvtss2sd -0x70(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
xorl %ebx, %ebx
movq -0xc0(%rbp), %r15
movq -0x50(%rbp), %r14
movq -0x38(%rbp), %rdi
movq -0x280(%rbp), %r12
testq %rdi, %rdi
je 0x724c
movq -0x48(%rbp), %rsi
subq %rdi, %rsi
callq 0x5280
testq %r14, %r14
je 0x7260
movq -0x78(%rbp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x5280
cmpq -0x288(%rbp), %r12
jb 0x76c1
cmpl $0x2, %r13d
je 0x7456
cmpl $0x1, %r13d
jne 0x75e9
movq 0xe038(%rip), %rsi      # 0x152c0
movq 0xe039(%rip), %rdx      # 0x152c8
movq 0xdd12(%rip), %rdi      # 0x14fa8
callq 0x52d0
movq %rax, %rbx
leaq 0x6f65(%rip), %rsi      # 0xe20a
movl $0x11, %edx
movq %rax, %rdi
callq 0x52d0
movq 0xe087(%rip), %rsi      # 0x15340
movq 0xe088(%rip), %rdx      # 0x15348
movq %rbx, %rdi
callq 0x52d0
movq %rax, %rbx
leaq 0x6f4a(%rip), %rsi      # 0xe21c
movl $0x15, %edx
movq %rax, %rdi
callq 0x52d0
xorps %xmm0, %xmm0
cvtss2sd -0x6c(%rbp), %xmm0
movq %rbx, %rdi
callq 0x53d0
movq %rax, %rbx
leaq 0x6f39(%rip), %rsi      # 0xe232
movl $0xd, %edx
movq %rax, %rdi
callq 0x52d0
movq 0xdfd3(%rip), %rsi      # 0x152e0
movq 0xdfd4(%rip), %rdx      # 0x152e8
movq %rbx, %rdi
callq 0x52d0
movq %rax, %rdi
movsd -0x60(%rbp), %xmm0
callq 0x53d0
movq 0xe010(%rip), %rsi      # 0x15340
movq 0xe011(%rip), %rdx      # 0x15348
movq %rax, %rdi
callq 0x52d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x5110
movq 0xdc2c(%rip), %rbx      # 0x14fa8
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x52d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq 0xdc00(%rip), %rdi      # 0x14fa8
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq 0xdbec(%rip), %rdi      # 0x14fa8
leaq 0x6e7d(%rip), %rsi      # 0xe240
movl $0x4, %edx
callq 0x52d0
movq 0xdbd4(%rip), %rdi      # 0x14fa8
movsd -0x68(%rbp), %xmm0
callq 0x53d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq 0xdb99(%rip), %rdi      # 0x14fa8
leaq 0x6e2f(%rip), %rsi      # 0xe245
movl $0x4, %edx
callq 0x52d0
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq 0xdb73(%rip), %rdi      # 0x14fa8
callq 0x52d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
jmp 0x75cf
movq 0xde63(%rip), %rsi      # 0x152c0
movq 0xde64(%rip), %rdx      # 0x152c8
movq 0xdb3d(%rip), %rdi      # 0x14fa8
callq 0x52d0
movq %rax, %rbx
leaq 0x6dd0(%rip), %rsi      # 0xe24a
movl $0xf, %edx
movq %rax, %rdi
callq 0x52d0
movq 0xdeb2(%rip), %rsi      # 0x15340
movq 0xdeb3(%rip), %rdx      # 0x15348
movq %rbx, %rdi
callq 0x52d0
movq %rax, %rbx
leaq 0x6db3(%rip), %rsi      # 0xe25a
movl $0x6, %edx
movq %rax, %rdi
callq 0x52d0
movq %r15, %rdi
callq 0x5110
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x52d0
leaq 0x6d90(%rip), %rsi      # 0xe261
movl $0x5, %edx
movq %rbx, %rdi
callq 0x52d0
movq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x5110
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x52d0
leaq 0x6d68(%rip), %rsi      # 0xe267
movl $0x10, %edx
movq %rbx, %rdi
callq 0x52d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq 0xda6e(%rip), %rdi      # 0x14fa8
leaq 0x6cff(%rip), %rsi      # 0xe240
movl $0x4, %edx
callq 0x52d0
movq 0xda56(%rip), %rdi      # 0x14fa8
movsd -0x68(%rbp), %xmm0
callq 0x53d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5190
movq 0xda1b(%rip), %rdi      # 0x14fa8
leaq 0x6cb1(%rip), %rsi      # 0xe245
movl $0x4, %edx
callq 0x52d0
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq 0xd9f5(%rip), %rdi      # 0x14fa8
callq 0x52d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x5190
jmp 0x76c1
movl $0x1, %ebx
cmpb $0x0, -0x29(%rbp)
jne 0x76c1
movq 0xd9a9(%rip), %rdi      # 0x14fa8
leaq 0x6be3(%rip), %rsi      # 0xe1e9
movl $0x17, %edx
callq 0x52d0
xorps %xmm0, %xmm0
cvtss2sd -0x6c(%rbp), %xmm0
movq 0xd989(%rip), %rdi      # 0x14fa8
callq 0x53d0
movq %rax, %r14
leaq 0x6bd3(%rip), %rsi      # 0xe201
movl $0x8, %edx
movq %rax, %rdi
callq 0x52d0
movq 0xdc9e(%rip), %rsi      # 0x152e0
movq 0xdc9f(%rip), %rdx      # 0x152e8
movq %r14, %rdi
callq 0x52d0
movq %rax, %rdi
movsd -0x60(%rbp), %xmm0
callq 0x53d0
movq 0xdcdb(%rip), %rsi      # 0x15340
movq 0xdcdc(%rip), %rdx      # 0x15348
movq %rax, %rdi
callq 0x52d0
movq %rax, %r14
leaq 0x6b68(%rip), %rsi      # 0xe1e6
movl $0x2, %edx
movq %rax, %rdi
callq 0x52d0
movq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x5110
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x52d0
leaq 0x7212(%rip), %rsi      # 0xe8be
movl $0x1, %edx
movq %r14, %rdi
callq 0x52d0
movq %r14, %rdi
callq 0x5120
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x76e3
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x5280
movl %ebx, %eax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, -0x78(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0x50(%rbp)
jmp 0x6781
movq $0x0, -0x48(%rbp)
xorl %r12d, %r12d
xorl %ecx, %ecx
jmp 0x6b2e
jmp 0x7767
jmp 0x7878
jmp 0x7742
jmp 0x7767
jmp 0x776f
jmp 0x7878
jmp 0x7767
jmp 0x7878
movq %r12, %rcx
movq %rax, %r12
movq -0x278(%rbp), %rdi
cmpq %rcx, %rdi
je 0x78bb
movq -0x268(%rbp), %rsi
incq %rsi
jmp 0x78b6
movq %rax, %r12
jmp 0x78bb
movq %r12, %rcx
movq %rax, %r12
movq -0x278(%rbp), %rdi
cmpq %rcx, %rdi
je 0x78d2
movq -0x268(%rbp), %rsi
jmp 0x77b1
jmp 0x7878
movq %rax, %r12
leaq -0x2a8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x78d2
movq -0x2a8(%rbp), %rsi
incq %rsi
jmp 0x78cd
jmp 0x7878
jmp 0x7878
jmp 0x7878
jmp 0x77dd
jmp 0x786c
jmp 0x77dd
jmp 0x786c
jmp 0x77dd
jmp 0x786c
movq %rax, %r12
movq -0x278(%rbp), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
jne 0x7860
jmp 0x78f4
jmp 0x786c
jmp 0x784a
jmp 0x786c
movq %rax, %r12
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x7885
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x5280
jmp 0x7885
movq %rax, %r12
leaq -0x2c8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x78f4
movq -0x2c8(%rbp), %rsi
jmp 0x78ec
jmp 0x786c
movq %r12, %rcx
movq %rax, %r12
movq -0x278(%rbp), %rdi
cmpq %rcx, %rdi
je 0x78f4
movq -0x268(%rbp), %rsi
jmp 0x78ec
movq %rax, %r12
jmp 0x78f4
jmp 0x787d
jmp 0x7882
movq %rax, %r12
jmp 0x78d2
movq %rax, %r12
jmp 0x78a4
movq %rax, %r12
movq 0xd6d4(%rip), %rsi      # 0x14f60
leaq -0x278(%rbp), %rdi
callq 0x51e0
leaq -0x1f8(%rbp), %rdi
callq 0x50c0
cmpq $0x0, -0x38(%rbp)
je 0x78bb
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rdi
subq %rdi, %rsi
callq 0x5280
cmpq $0x0, -0x50(%rbp)
je 0x78d2
movq -0x78(%rbp), %rsi
movq -0x50(%rbp), %rdi
subq %rdi, %rsi
callq 0x5280
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x78f4
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x5280
movq %r12, %rdi
callq 0x5450