// File: Ahhgust[P]STRaitRazor/str8.cpp
// Function: processDNA_Trie(int, unsigned int*, unsigned char*)
void
processDNA_Trie(int id, unsigned *matchIds, unsigned char *matchTypes) {


  int a;
  vector< vector<unsigned> > fpMatches( numStrs, vector<unsigned>(10) ); // forwardflank, positive strand
  vector< vector<unsigned> > rpMatches( numStrs, vector<unsigned>(10) ); // reverse flank, positive strand 
  vector< vector<unsigned> > frMatches( numStrs, vector<unsigned>(10) ); // ditto for negative strand
  vector< vector<unsigned> > rrMatches( numStrs, vector<unsigned>(10) );

  vector<unsigned > lastHitRecord( numStrs, RECSINMEM ); // the index (a in below loop) that yielded a valid hit for a paritcular locus
  vector<unsigned char > validMotif(numStrs, 0); // whether or not there's a valid motif found for a particular STR
  // valid means after a forwardflank or reverseflank_rc (the flanks may not be paired)

  for (a=id ; a < RECSINMEM; a += opt.numThreads) {
    const char *dna = records[a].c_str(); // ascii representation of DNA string
    const char *qvals = qrecords[a].c_str(); // quality scores baby!
    
    unsigned dnalen = records[a].length();


    //    if ((unsigned)a >= LASTREC) // creates a race condition!
    //      break;


    if ((int)dnalen < minFrag)
      continue;    



    bool gotOne=false;
    unsigned stop = dnalen - minLen + 1;
    for (unsigned j=0; j < stop; ++j, ++dna) {
      // this finds demonstrably wrong sequences (less than 'A' or greater than 'T' in the ascii table)
      if (*dna < 65 || *dna > 84) {
        cerr << "Oops! I'm detecting an illegal character in the DNA string. The character is " << *dna << endl <<
          "And the record is " << dna << endl;
        exit(EXIT_FAILURE);
      }


      // if we dont' have a single match (forward or reverse complement of reverse
      // and there isn't enough sequence to get the smallest possible fragment out, then we're done
      if (! gotOne &&
          dnalen - j < (unsigned)minFrag)
        break;

      unsigned numMatches = trie->findPrefixMatch((char*)(dna), maxLen, matchIds, matchTypes);
      
      for (unsigned n = 0; n < numMatches; ++n) {
        unsigned strIndex = matchIds[n];
        unsigned char orientation = matchTypes[n];


#if DEBUG
        //	if (orientation < MOTIF) 
        cerr << "Read offset: " << j << " read # " << 
          a << " Str index " << strIndex << " Orientation " << (unsigned)orientation << endl;
#endif

        if (lastHitRecord[ strIndex ] != (unsigned) a &&
            orientation < MOTIF) { // clear out the vectors for this STR; it's the first time we've seen this marker (in this read)
          fpMatches[strIndex].clear();
          rpMatches[strIndex].clear();
          frMatches[strIndex].clear();
          rrMatches[strIndex].clear();
          validMotif[strIndex]=0; // no valid motifs found
          lastHitRecord[strIndex ] = a;
        }



        if (orientation == MOTIF || orientation == MOTIF_RC) { // common case
          
          if (lastHitRecord[ strIndex ] == (unsigned) a &&  ! validMotif[strIndex]) {  // we have at least one flank found for this locus for this read
            // motifs! (currently the strand is ignored, as per the previous str8razor

            
            // we have at least one (valid) forward flank
            // and not enough reverse flanks
            if (fpMatches[strIndex].size() > 0 && 
                rpMatches[strIndex].size() < (*c)[strIndex].reverseCount) {
              validMotif[strIndex]=1;
              // match is on the negative strand
            } else if (rrMatches[strIndex].size() > 0 && 
                       frMatches[strIndex].size() < (*c)[strIndex].forwardCount) {
              validMotif[strIndex]=1;
	    }

	  }
          // record where the flanks were found, and in which orientation
        } else if (orientation==FORWARDFLANK) {
          
          if (! frMatches[strIndex].empty() &&
              frMatches[strIndex].back()  >= j - (*c)[strIndex].forwardLength) {
	    
            continue; // overlap!
          }

          
          
          fpMatches[ strIndex ].push_back(j + (*c)[strIndex].forwardLength); // the index of the first base of the intervening haplotype
          gotOne=true; 
          
        } else if (orientation == REVERSEFLANK) {
          
          // check to see if this reverse flank that we have is a substring (or overlaps) the forward flank (sadly, this happens. thank you Y chromosome!)
          // if so, let's skip it
          if ( ! fpMatches[strIndex].empty() && 
               fpMatches[strIndex].back()  >= j) {
            continue;
          }
          
          rpMatches[ strIndex ].push_back(j);
          // if specified, stop the search when we find the first STR that appears correct
          if (opt.shortCircuit && 
              rpMatches[ strIndex ].size() == (*c)[strIndex].reverseCount &&
              fpMatches[ strIndex ].size() == (*c)[strIndex].forwardCount)
            break;
          
        } else if (orientation == FORWARDFLANK_RC) {
          
          // and again, but on the negative strand;
          // the 2nd flank overlaps the first flank; let's assume that the second match in the overlap is wrong.
          if (! rrMatches[strIndex].empty() &&
              rrMatches[strIndex].back()  >= j) {
            continue;
          }

          frMatches[ strIndex ].push_back(j);
          if (opt.shortCircuit && 
              rrMatches[ strIndex ].size() == (*c)[strIndex].reverseCount &&
              frMatches[ strIndex ].size() == (*c)[strIndex].forwardCount)
            break;
          
          
        } else if (orientation == REVERSEFLANK_RC) {


          if (! frMatches[strIndex].empty() &&
              frMatches[strIndex].back()  >= j - (*c)[strIndex].reverseLength) {
	    
            continue; // overlap!
          }


          rrMatches[ strIndex ].push_back(j + (*c)[strIndex].reverseLength); // the index of the first base of the intervening haplotype
          gotOne=true; 
          
          // haven't found a valid motif for this STR yet
        } 
        
      }
    } // done reading read
    dna = records[a].c_str(); // reset the pointer
    
    
    if (gotOne) { // is there at least one record
      for (unsigned i = 0; i < numStrs; ++i) {

        if (lastHitRecord[i]== (unsigned) a 
            && validMotif[i]
            ) { // this STR was found for this read
          // positive strand match

          if (fpMatches[i].size() == (*c)[i].forwardCount) {
            if (rpMatches[i].size() == (*c)[i].reverseCount ) {
              // ensure that if it matches once on the positive strand, it doesn't also match on the negative strand (that both if statements below cannot be true)
              if ( rrMatches[i].size() != (*c)[i].reverseCount  ||
                   frMatches[i].size() != (*c)[i].forwardCount ) {
                
#if DEBUG
                cerr << c->at(i).locusName << " STR on forward strand " << i << " fpsize " << fpMatches[i].size() <<
                  " rpsize " << rpMatches[i].size() << endl;
#endif
	      
                if (fpMatches[i].back()  < rpMatches[i].front()) {
                  if (opt.includeAnchors) 
                    makeRecord(dna, qvals, fpMatches[i].front() - (*c)[i].forwardLength, rpMatches[i].back() + (*c)[i].reverseLength, FORWARDFLANK, i, id);
                  else
                    makeRecord(dna, qvals, fpMatches[i].front(), rpMatches[i].back(), FORWARDFLANK, i, id);
                }
                
              }
              
            } else if (opt.verbose && rpMatches[i].size() < (*c)[i].reverseCount ) { // not enough matches for the second anchor
              ++biasCounts[id][i];
            }
            // negative strand match
          }
          if ( rrMatches[i].size() == (*c)[i].reverseCount) {
            if ( frMatches[i].size() == (*c)[i].forwardCount ) {
              
#if DEBUG
              cerr << c->at(i).locusName << " STR on reverse strand " << i << " fpsize " << fpMatches[i].size() <<
                " rpsize " << rpMatches[i].size() << endl;
#endif
              
              if (rrMatches[i].back() < frMatches[i].front() ) {
                if (opt.includeAnchors)
                  makeRecord(dna, qvals, rrMatches[i].front() - (*c)[i].reverseLength , frMatches[i].back()+(*c)[i].forwardLength, REVERSEFLANK, i, id);
                else
                  makeRecord(dna, qvals, rrMatches[i].front(), frMatches[i].back(), REVERSEFLANK, i, id);	      
              }
              
            } else if (opt.verbose && frMatches[i].size() < (*c)[i].forwardCount ) {
              ++biasCounts[id][i]; 
            }
            
          }
        }
      }//for
    } // gotone
  }
  
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl 0x6321a4(%rip), %eax    # 0x637390
movq %rax, -0x1a0(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x8b10
movq -0x198(%rbp), %rdx
leaq -0x50(%rbp), %rdi
movl $0xa, %esi
callq 0x8b30
jmp 0x521a
leaq -0x65(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x8ba0
movq -0x1a0(%rbp), %rsi
movq -0x1a8(%rbp), %rcx
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x8bc0
jmp 0x5247
leaq -0x65(%rbp), %rdi
callq 0x8c40
leaq -0x50(%rbp), %rdi
callq 0x8c60
leaq -0x51(%rbp), %rdi
callq 0x8cc0
movl 0x632128(%rip), %eax    # 0x637390
movq %rax, -0x1b8(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0x8b10
movq -0x1b0(%rbp), %rdx
leaq -0x98(%rbp), %rdi
movl $0xa, %esi
callq 0x8b30
jmp 0x529c
leaq -0x9a(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x8ba0
movq -0x1b8(%rbp), %rsi
movq -0x1c0(%rbp), %rcx
leaq -0x80(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x8bc0
jmp 0x52cf
leaq -0x9a(%rbp), %rdi
callq 0x8c40
leaq -0x98(%rbp), %rdi
callq 0x8c60
leaq -0x99(%rbp), %rdi
callq 0x8cc0
movl 0x632097(%rip), %eax    # 0x637390
movq %rax, -0x1d0(%rbp)
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x8b10
movq -0x1c8(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
movl $0xa, %esi
callq 0x8b30
jmp 0x532d
leaq -0xd2(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x8ba0
movq -0x1d0(%rbp), %rsi
movq -0x1d8(%rbp), %rcx
leaq -0xb8(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x8bc0
jmp 0x5363
leaq -0xd2(%rbp), %rdi
callq 0x8c40
leaq -0xd0(%rbp), %rdi
callq 0x8c60
leaq -0xd1(%rbp), %rdi
callq 0x8cc0
movl 0x632003(%rip), %eax    # 0x637390
movq %rax, -0x1e8(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x8b10
movq -0x1e0(%rbp), %rdx
leaq -0x108(%rbp), %rdi
movl $0xa, %esi
callq 0x8b30
jmp 0x53c1
leaq -0x10a(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x8ba0
movq -0x1e8(%rbp), %rsi
movq -0x1f0(%rbp), %rcx
leaq -0xf0(%rbp), %rdi
leaq -0x108(%rbp), %rdx
callq 0x8bc0
jmp 0x53f7
leaq -0x10a(%rbp), %rdi
callq 0x8c40
leaq -0x108(%rbp), %rdi
callq 0x8c60
leaq -0x109(%rbp), %rdi
callq 0x8cc0
movl 0x631f6f(%rip), %eax    # 0x637390
movq %rax, -0x200(%rbp)
movl $0xc350, -0x12c(%rbp)   # imm = 0xC350
leaq -0x12d(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x8b10
movq -0x200(%rbp), %rsi
movq -0x1f8(%rbp), %rcx
leaq -0x128(%rbp), %rdi
leaq -0x12c(%rbp), %rdx
callq 0x8ce0
jmp 0x5468
leaq -0x12d(%rbp), %rdi
callq 0x8cc0
movl 0x631f16(%rip), %eax    # 0x637390
movq %rax, -0x210(%rbp)
movb $0x0, -0x149(%rbp)
leaq -0x14a(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x8d60
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rcx
leaq -0x148(%rbp), %rdi
leaq -0x149(%rbp), %rdx
callq 0x8d80
jmp 0x54be
leaq -0x14a(%rbp), %rdi
callq 0x8e00
movl -0x4(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0xc350, -0x1c(%rbp)    # imm = 0xC350
jge 0x663c
movq 0x63162c(%rip), %rdi    # 0x636b10
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x3100
movq %rax, -0x158(%rbp)
movq 0x631616(%rip), %rdi    # 0x636b18
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x3100
movq %rax, -0x160(%rbp)
movq 0x6315f0(%rip), %rdi    # 0x636b10
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x33d0
movl %eax, -0x164(%rbp)
movl -0x164(%rbp), %eax
cmpl 0x631e52(%rip), %eax    # 0x637394
jge 0x568a
jmp 0x662b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x5579
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x65(%rbp), %rdi
callq 0x8c40
leaq -0x50(%rbp), %rdi
callq 0x8c60
leaq -0x51(%rbp), %rdi
callq 0x8cc0
jmp 0x66bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x55b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x9a(%rbp), %rdi
callq 0x8c40
leaq -0x98(%rbp), %rdi
callq 0x8c60
leaq -0x99(%rbp), %rdi
callq 0x8cc0
jmp 0x66b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x55fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd2(%rbp), %rdi
callq 0x8c40
leaq -0xd0(%rbp), %rdi
callq 0x8c60
leaq -0xd1(%rbp), %rdi
callq 0x8cc0
jmp 0x66ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x563f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x10a(%rbp), %rdi
callq 0x8c40
leaq -0x108(%rbp), %rdi
callq 0x8c60
leaq -0x109(%rbp), %rdi
callq 0x8cc0
jmp 0x669f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x12d(%rbp), %rdi
callq 0x8cc0
jmp 0x6693
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x14a(%rbp), %rdi
callq 0x8e00
jmp 0x6687
movb $0x0, -0x165(%rbp)
movl -0x164(%rbp), %eax
subl 0x631cfb(%rip), %eax    # 0x637398
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
movl $0x0, -0x170(%rbp)
movl -0x170(%rbp), %eax
cmpl -0x16c(%rbp), %eax
jae 0x5f21
movq -0x158(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x56e4
movq -0x158(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x54, %eax
jle 0x57af
movq 0x16905(%rip), %rdi     # 0x1bff0
leaq 0xead2(%rip), %rsi      # 0x141c4
callq 0x3290
movq %rax, -0x218(%rbp)
jmp 0x5700
movq -0x218(%rbp), %rdi
movq -0x158(%rbp), %rax
movsbl (%rax), %esi
callq 0x3300
movq %rax, -0x220(%rbp)
jmp 0x571f
movq -0x220(%rbp), %rdi
movq 0x1688b(%rip), %rsi     # 0x1bfb8
callq 0x32e0
movq %rax, -0x228(%rbp)
jmp 0x573b
movq -0x228(%rbp), %rdi
leaq 0xeac9(%rip), %rsi      # 0x14212
callq 0x3290
movq %rax, -0x230(%rbp)
jmp 0x5757
movq -0x230(%rbp), %rdi
movq -0x158(%rbp), %rsi
callq 0x3290
movq %rax, -0x238(%rbp)
jmp 0x5773
movq -0x238(%rbp), %rdi
movq 0x16837(%rip), %rsi     # 0x1bfb8
callq 0x32e0
jmp 0x5788
movl $0x1, %edi
callq 0x3330
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x9010
jmp 0x6687
testb $0x1, -0x165(%rbp)
jne 0x57d1
movl -0x164(%rbp), %eax
subl -0x170(%rbp), %eax
cmpl 0x631bca(%rip), %eax    # 0x637394
jae 0x57d1
jmp 0x5f21
movq 0x631bc8(%rip), %rdi    # 0x6373a0
movq -0x158(%rbp), %rsi
movl 0x631bb7(%rip), %edx    # 0x63739c
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
callq 0x11290
movl %eax, -0x23c(%rbp)
jmp 0x57fa
movl -0x23c(%rbp), %eax
movl %eax, -0x174(%rbp)
movl $0x0, -0x178(%rbp)
movl -0x178(%rbp), %eax
cmpl -0x174(%rbp), %eax
jae 0x5ef9
movq -0x10(%rbp), %rax
movl -0x178(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x17c(%rbp)
movq -0x18(%rbp), %rax
movl -0x178(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x17d(%rbp)
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x8e20
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
je 0x591d
movzbl -0x17d(%rbp), %eax
cmpl $0x4, %eax
jge 0x591d
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8e60
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8e60
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8e60
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8e60
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x148(%rbp), %rdi
callq 0x8e80
movb $0x0, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x240(%rbp)
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x8e20
movl -0x240(%rbp), %ecx
movl %ecx, (%rax)
movzbl -0x17d(%rbp), %eax
cmpl $0x4, %eax
je 0x5939
movzbl -0x17d(%rbp), %eax
cmpl $0x5, %eax
jne 0x5a89
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x8e20
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x5a84
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x148(%rbp), %rdi
callq 0x8e80
cmpb $0x0, (%rax)
jne 0x5a84
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
cmpq $0x0, %rax
jbe 0x59fa
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x248(%rbp)
movq 0x6319cd(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x248(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jae 0x59fa
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x148(%rbp), %rdi
callq 0x8e80
movb $0x1, (%rax)
jmp 0x5a82
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
cmpq $0x0, %rax
jbe 0x5a80
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x250(%rbp)
movq 0x631942(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x250(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jae 0x5a80
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x148(%rbp), %rdi
callq 0x8e80
movb $0x1, (%rax)
jmp 0x5a82
jmp 0x5a84
jmp 0x5ee3
movzbl -0x17d(%rbp), %eax
cmpl $0x0, %eax
jne 0x5b8b
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ec0
testb $0x1, %al
jne 0x5b1b
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
movl %eax, -0x254(%rbp)
movl -0x170(%rbp), %eax
movl %eax, -0x258(%rbp)
movq 0x631898(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movl -0x258(%rbp), %ecx
movq %rax, %rdx
movl -0x254(%rbp), %eax
subl 0xa0(%rdx), %ecx
cmpl %ecx, %eax
jb 0x5b1b
jmp 0x5ee5
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, -0x268(%rbp)
movl -0x170(%rbp), %eax
movl %eax, -0x25c(%rbp)
movq 0x631842(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq -0x268(%rbp), %rdi
movq %rax, %rcx
movl -0x25c(%rbp), %eax
movl 0xa0(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x184(%rbp)
leaq -0x184(%rbp), %rsi
callq 0x8f40
jmp 0x5b7f
movb $0x1, -0x165(%rbp)
jmp 0x5ee1
movzbl -0x17d(%rbp), %eax
cmpl $0x3, %eax
jne 0x5cad
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ec0
testb $0x1, %al
jne 0x5be0
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
cmpl -0x170(%rbp), %eax
jb 0x5be0
jmp 0x5ee5
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
leaq -0x170(%rbp), %rsi
callq 0x8f70
jmp 0x5c02
testb $0x1, 0x166d3(%rip)     # 0x1c2dc
je 0x5ca8
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x270(%rbp)
movq 0x631752(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x270(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jne 0x5ca8
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x278(%rbp)
movq 0x631708(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x278(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jne 0x5ca8
jmp 0x5ef9
jmp 0x5edf
movzbl -0x17d(%rbp), %eax
cmpl $0x1, %eax
jne 0x5dde
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ec0
testb $0x1, %al
jne 0x5d08
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
cmpl -0x170(%rbp), %eax
jb 0x5d08
jmp 0x5ee5
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
leaq -0x170(%rbp), %rsi
callq 0x8f70
jmp 0x5d2d
testb $0x1, 0x165a8(%rip)     # 0x1c2dc
je 0x5dd9
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x280(%rbp)
movq 0x631624(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x280(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jne 0x5dd9
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x288(%rbp)
movq 0x6315d7(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x288(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jne 0x5dd9
jmp 0x5ef9
jmp 0x5edd
movzbl -0x17d(%rbp), %eax
cmpl $0x2, %eax
jne 0x5edb
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ec0
testb $0x1, %al
jne 0x5e6d
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
movl %eax, -0x28c(%rbp)
movl -0x170(%rbp), %eax
movl %eax, -0x290(%rbp)
movq 0x631543(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movl -0x290(%rbp), %ecx
movq %rax, %rdx
movl -0x28c(%rbp), %eax
subl 0xa4(%rdx), %ecx
cmpl %ecx, %eax
jb 0x5e6d
jmp 0x5ee5
movl -0x17c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, -0x2a0(%rbp)
movl -0x170(%rbp), %eax
movl %eax, -0x294(%rbp)
movq 0x6314ed(%rip), %rdi    # 0x637388
movl -0x17c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq -0x2a0(%rbp), %rdi
movq %rax, %rcx
movl -0x294(%rbp), %eax
movl 0xa4(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x188(%rbp)
leaq -0x188(%rbp), %rsi
callq 0x8f40
jmp 0x5ed4
movb $0x1, -0x165(%rbp)
jmp 0x5edd
jmp 0x5edf
jmp 0x5ee1
jmp 0x5ee3
jmp 0x5ee5
movl -0x178(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x178(%rbp)
jmp 0x5810
jmp 0x5efb
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
movq -0x158(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x158(%rbp)
jmp 0x56b0
movq 0x630be8(%rip), %rdi    # 0x636b10
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x3100
movq %rax, -0x158(%rbp)
testb $0x1, -0x165(%rbp)
je 0x6629
movl $0x0, -0x18c(%rbp)
movl -0x18c(%rbp), %eax
cmpl 0x63142e(%rip), %eax    # 0x637390
jae 0x6627
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x128(%rbp), %rdi
callq 0x8e20
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x6611
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x148(%rbp), %rdi
callq 0x8e80
cmpb $0x0, (%rax)
je 0x6611
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x2a8(%rbp)
movq 0x6313bd(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x2a8(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jne 0x6319
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x2b0(%rbp)
movq 0x63136f(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x2b0(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jne 0x62a4
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x2b8(%rbp)
movq 0x63131e(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x2b8(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jne 0x60de
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x2c0(%rbp)
movq 0x6312d1(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x2c0(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
je 0x62a2
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
movl %eax, -0x2c4(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8fe0
movq %rax, %rcx
movl -0x2c4(%rbp), %eax
cmpl (%rcx), %eax
jae 0x62a0
testb $0x1, 0x161b0(%rip)     # 0x1c2e0
je 0x6215
movq -0x158(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x2d0(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8fe0
movl (%rax), %eax
movl %eax, -0x2e0(%rbp)
movq 0x63120e(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movl -0x2e0(%rbp), %eax
movl 0xa0(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x2c8(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
movl %eax, -0x2dc(%rbp)
movq 0x6311c2(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movl -0x2dc(%rbp), %ecx
movq -0x2d8(%rbp), %rdi
movq -0x2d0(%rbp), %rsi
movl -0x2c8(%rbp), %edx
movl 0xa4(%rax), %eax
addl %eax, %ecx
movl -0x18c(%rbp), %r9d
movl -0x4(%rbp), %r8d
movq %rsp, %rax
movl %r8d, (%rax)
xorl %r8d, %r8d
callq 0x4c60
jmp 0x6210
jmp 0x629e
movq -0x158(%rbp), %rax
movq %rax, -0x2f8(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8fe0
movl (%rax), %eax
movl %eax, -0x2e4(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movq -0x2f8(%rbp), %rdi
movq -0x2f0(%rbp), %rsi
movl -0x2e4(%rbp), %edx
movl (%rax), %ecx
movl -0x18c(%rbp), %r9d
movl -0x4(%rbp), %r8d
movq %rsp, %rax
movl %r8d, (%rax)
xorl %r8d, %r8d
callq 0x4c60
jmp 0x629c
jmp 0x629e
jmp 0x62a0
jmp 0x62a2
jmp 0x6317
testb $0x1, 0x16032(%rip)     # 0x1c2dd
je 0x6315
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x300(%rbp)
movq 0x6310b4(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x300(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jae 0x6315
movq 0x6310b2(%rip), %rax    # 0x6373b0
movslq -0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x18c(%rbp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x6317
jmp 0x6319
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x308(%rbp)
movq 0x631045(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x308(%rbp), %rax
movzwl 0xb2(%rcx), %ecx
cmpq %rcx, %rax
jne 0x660f
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x310(%rbp)
movq 0x630ff4(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x310(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jne 0x6597
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
movl %eax, -0x314(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8fe0
movq %rax, %rcx
movl -0x314(%rbp), %eax
cmpl (%rcx), %eax
jae 0x6595
testb $0x1, 0x15ecd(%rip)     # 0x1c2e0
je 0x6501
movq -0x158(%rbp), %rax
movq %rax, -0x328(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x320(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8fe0
movl (%rax), %eax
movl %eax, -0x330(%rbp)
movq 0x630f28(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movl -0x330(%rbp), %eax
movl 0xa4(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x318(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movl (%rax), %eax
movl %eax, -0x32c(%rbp)
movq 0x630ed9(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movl -0x32c(%rbp), %ecx
movq -0x328(%rbp), %rdi
movq -0x320(%rbp), %rsi
movl -0x318(%rbp), %edx
movl 0xa0(%rax), %eax
addl %eax, %ecx
movl -0x18c(%rbp), %r9d
movl -0x4(%rbp), %r8d
movq %rsp, %rax
movl %r8d, (%rax)
movl $0x3, %r8d
callq 0x4c60
jmp 0x64fc
jmp 0x6593
movq -0x158(%rbp), %rax
movq %rax, -0x348(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x340(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8fe0
movl (%rax), %eax
movl %eax, -0x334(%rbp)
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8f00
movq -0x348(%rbp), %rdi
movq -0x340(%rbp), %rsi
movl -0x334(%rbp), %edx
movl (%rax), %ecx
movl -0x18c(%rbp), %r9d
movl -0x4(%rbp), %r8d
movq %rsp, %rax
movl %r8d, (%rax)
movl $0x3, %r8d
callq 0x4c60
jmp 0x6591
jmp 0x6593
jmp 0x6595
jmp 0x660d
testb $0x1, 0x15d3f(%rip)     # 0x1c2dd
je 0x660b
movl -0x18c(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8e40
movq %rax, %rdi
callq 0x8ea0
movq %rax, -0x350(%rbp)
movq 0x630dbe(%rip), %rdi    # 0x637388
movl -0x18c(%rbp), %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rcx
movq -0x350(%rbp), %rax
movzwl 0xb0(%rcx), %ecx
cmpq %rcx, %rax
jae 0x660b
movq 0x630dbc(%rip), %rax    # 0x6373b0
movslq -0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x18c(%rbp), %ecx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x660d
jmp 0x660f
jmp 0x6611
jmp 0x6613
movl -0x18c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18c(%rbp)
jmp 0x5f56
jmp 0x6629
jmp 0x662b
movl 0x15cc7(%rip), %eax     # 0x1c2f8
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x54d0
leaq -0x148(%rbp), %rdi
callq 0x9010
leaq -0x128(%rbp), %rdi
callq 0x8c60
leaq -0xf0(%rbp), %rdi
callq 0x9070
leaq -0xb8(%rbp), %rdi
callq 0x9070
leaq -0x80(%rbp), %rdi
callq 0x9070
leaq -0x38(%rbp), %rdi
callq 0x9070
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
leaq -0x128(%rbp), %rdi
callq 0x8c60
leaq -0xf0(%rbp), %rdi
callq 0x9070
leaq -0xb8(%rbp), %rdi
callq 0x9070
leaq -0x80(%rbp), %rdi
callq 0x9070
leaq -0x38(%rbp), %rdi
callq 0x9070
movq -0x60(%rbp), %rdi
callq 0x34a0
nopw %cs:(%rax,%rax)