// File: gtonkinhill[P]pairsnp-cpp/src/main.cpp
// Function: main
int main(int argc, char *argv[])
{

  // parse command line parameters
  int opt, quiet=0, csv=0, sparse=0, dist=-1, knn=-1, index=0;
  size_t nthreads=1;
  while ((opt = getopt(argc, argv, "hqsncvid:t:k:")) != -1) {
    switch (opt) {
      case 'h': show_help(EXIT_SUCCESS); break;
      case 'q': quiet=1; break;
      case 'c': csv=1; break;
      case 's': sparse=1; break;
      case 'i': index=1; break;
      case 'd': dist=atoi(optarg); break;
      case 'k': knn=atoi(optarg); break;
      case 't': nthreads=atoi(optarg); break;
      case 'v': printf("%s %s\n", EXENAME, VERSION); exit(EXIT_SUCCESS);
      default : show_help(EXIT_FAILURE);
    }
  }

  char sep = csv ? ',' : '\t';

  // require a filename argument
  if (optind >= argc) {
    show_help(EXIT_FAILURE);
    return 0;
  }
  const char* fasta = argv[optind];

  // say hello
  if (!quiet) fprintf(stderr, "This is %s %s\n", EXENAME, VERSION);

  // open filename and initialise kseq
  int l;
  gzFile fp = gzopen(fasta, "r");
  kseq_t * seq = kseq_init(fp);

  //Initially run through fasta to get SNPS not matching reference
  size_t n_seqs = 0;
  size_t seq_length;

  // initialise roaring bitmaps
  std::vector<std::string> seq_names;
  std::vector<boost::dynamic_bitset<>> A_snps;
  std::vector<boost::dynamic_bitset<>> C_snps;
  std::vector<boost::dynamic_bitset<>> G_snps;
  std::vector<boost::dynamic_bitset<>> T_snps;
  std::string consensus;

  while(true) {
    l = kseq_read(seq);

    if (l == -1)  // end of file
        break;
    if (l == -2) {
        std::cerr << "Error: incorrect FASTA format" << seq->name.s << "\n";
        return 1;
    }
    if (l == -3) {
        std::cerr << "Error reading " << fasta << "\n";
        return 1;
    }

    // check sequence length
    if ((n_seqs>0) && (seq->seq.l != seq_length)){
      std::cerr << "Error: incorrect FASTA format, variable sequence lengths! " << seq->name.s << "\n";
      return 1;
    }
    seq_length = seq->seq.l;

    seq_names.push_back(seq->name.s);
    boost::dynamic_bitset<> As(seq_length);
    boost::dynamic_bitset<> Cs(seq_length);
    boost::dynamic_bitset<> Gs(seq_length);
    boost::dynamic_bitset<> Ts(seq_length);

    for(size_t j=0; j<seq_length; j++){

      seq->seq.s[j] = std::toupper(seq->seq.s[j]);

      switch(seq->seq.s[j]){
        case 'A': As[j] = 1; break;
        case 'C': Cs[j] = 1; break;
        case 'G': Gs[j] = 1; break;
        case 'T': Ts[j] = 1; break;

        // M = A or C
        case 'M': As[j] = 1; 
          Cs[j] = 1;
          break;

        // R = A or G
        case 'R': As[j] = 1; 
          Gs[j] = 1;
          break;

        // W = A or T
        case 'W': As[j] = 1; 
          Ts[j] = 1;
          break;

        // S = C or G
        case 'S': Cs[j] = 1; 
          Gs[j] = 1;
          break;

        // Y = C or T
        case 'Y': Cs[j] = 1; 
          Ts[j] = 1;
          break;

        // K = G or T
        case 'K': Gs[j] = 1; 
          Ts[j] = 1;
          break;

        // V = A,C or G
        case 'V': As[j] = 1; 
          Cs[j] = 1; 
          Gs[j] = 1;
          break;

        // H = A,C or T
        case 'H': As[j] = 1; 
          Cs[j] = 1; 
          Ts[j] = 1;
          break;
        
        // D = A,G or T
        case 'D': As[j] = 1;
          Gs[j] = 1; 
          Ts[j] = 1;
          break;

        // B = C,G or T
        case 'B': Cs[j] = 1;
          Gs[j] = 1; 
          Ts[j] = 1;
          break;

        // N = A,C,G or T
        default:  
          As[j] = 1;
          Cs[j] = 1;
          Gs[j] = 1; 
          Ts[j] = 1;
          break;

      }
    }
    A_snps.push_back(As);
    C_snps.push_back(Cs);
    G_snps.push_back(Gs);
    T_snps.push_back(Ts);

    n_seqs++;
  }
  kseq_destroy(seq);
  gzclose(fp);

  if((knn!=-1) && (knn>=int(n_seqs))){
      fprintf(stderr, "kNN > number of samples. Running in dense mode!\n" );
      knn = -1;
  }
  
  //If sparse output print sequence names in the header
  if (index){
    std::cout << '#' << sep;
    for (size_t j=0; j < n_seqs; j++) {
      std::cout << seq_names[j] << sep;
    }
    std::cout << std::endl;
  }

  #pragma omp parallel for ordered shared(A_snps, C_snps \
    , G_snps, T_snps, seq_length \
    , n_seqs, seq_names, dist, sep, sparse \
    , knn, index) default(none) schedule(static,1) num_threads(nthreads)
  for (size_t i = 0; i < n_seqs; i++) {

    std::vector<int> comp_snps(n_seqs);
    boost::dynamic_bitset<> res(seq_length);

    size_t start;
    if (sparse && (knn<0)){
      start = i+1;
    } else {
      start = 0;
    }
    
    for(size_t j=start; j<n_seqs; j++){

      res = A_snps[i] & A_snps[j];
      res |= C_snps[i] & C_snps[j];
      res |= G_snps[i] & G_snps[j];
      res |= T_snps[i] & T_snps[j];

      comp_snps[j] = seq_length - res.count();

    }

    // if using knn find the distance needed
    if (knn>=0){
      std::vector<int> s_comp = comp_snps;
      std::sort(s_comp.begin(), s_comp.end());
      dist = s_comp[knn+1];
      start=0;
    } else {
      start = i+1;
    }

    // Output the distance matrix to stdout
    #pragma omp ordered //#pragma omp critical
    if (sparse){
      for (size_t j=start; j < n_seqs; j++) {
        if ((dist==-1) || (comp_snps[j] <= dist)){
          if (index) {
            std::printf("%d%c%d%c%d\n", i, sep, j, sep, comp_snps[j]);
          } else {
            std::printf("%s%c%s%c%d\n", seq_names[i].c_str(), sep, seq_names[j].c_str(), sep, comp_snps[j]);
          }
        }
      }
    } else {
      if (index) {
        printf("%d", i);
      } else {
        printf("%s", seq_names[i].c_str());
      }
      for (size_t j=0; j < n_seqs; j++) {
        printf("%c%d", sep, comp_snps[j]);
      }
      printf("\n");
    }
  }

  return 0;

  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x870, %rsp            # imm = 0x870
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x2c(%rbp)
movq $0x1, -0x38(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x8cab(%rip), %rdx      # 0xb2d4
callq 0x2060
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x270d
movl -0x14(%rbp), %eax
addl $-0x63, %eax
movl %eax, %ecx
movq %rcx, -0x510(%rbp)
subl $0x13, %eax
ja 0x26fe
movq -0x510(%rbp), %rax
leaq 0x8a08(%rip), %rcx      # 0xb068
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edi, %edi
callq 0x24c0
jmp 0x2708
movl $0x1, -0x18(%rbp)
jmp 0x2708
movl $0x1, -0x1c(%rbp)
jmp 0x2708
movl $0x1, -0x20(%rbp)
jmp 0x2708
movl $0x1, -0x2c(%rbp)
jmp 0x2708
movq 0xe90d(%rip), %rax      # 0x10fb0
movq (%rax), %rdi
callq 0x22d0
movl %eax, -0x24(%rbp)
jmp 0x2708
movq 0xe8f9(%rip), %rax      # 0x10fb0
movq (%rax), %rdi
callq 0x22d0
movl %eax, -0x28(%rbp)
jmp 0x2708
movq 0xe8e5(%rip), %rax      # 0x10fb0
movq (%rax), %rdi
callq 0x22d0
cltq
movq %rax, -0x38(%rbp)
jmp 0x2708
leaq 0x8c0e(%rip), %rdi      # 0xb2f0
leaq 0x8a37(%rip), %rsi      # 0xb120
leaq 0x8bf2(%rip), %rdx      # 0xb2e2
movb $0x0, %al
callq 0x2030
xorl %edi, %edi
callq 0x2250
movl $0x1, %edi
callq 0x24c0
jmp 0x261b
movl -0x1c(%rbp), %ecx
movb $0x2c, %al
movb $0x9, %dl
movb %dl, -0x512(%rbp)
cmpl $0x0, %ecx
movb %al, -0x511(%rbp)
jne 0x2731
movb -0x512(%rbp), %al
movb %al, -0x511(%rbp)
movb -0x511(%rbp), %al
movb %al, -0x39(%rbp)
movq 0xe88f(%rip), %rax      # 0x10fd0
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jl 0x275e
movl $0x1, %edi
callq 0x24c0
movl $0x0, -0x4(%rbp)
jmp 0x40ee
movq -0x10(%rbp), %rax
movq 0xe867(%rip), %rcx      # 0x10fd0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x27a0
movq 0xe847(%rip), %rax      # 0x10fc8
movq (%rax), %rdi
leaq 0x8b5d(%rip), %rsi      # 0xb2e8
leaq 0x898e(%rip), %rdx      # 0xb120
leaq 0x8b49(%rip), %rcx      # 0xb2e2
movb $0x0, %al
callq 0x2290
movq -0x48(%rbp), %rdi
leaq 0x8b4c(%rip), %rsi      # 0xb2f7
callq 0x22b0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x4110
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4a80
leaq -0xa0(%rbp), %rdi
callq 0x4aa0
leaq -0xb8(%rbp), %rdi
callq 0x4aa0
leaq -0xd0(%rbp), %rdi
callq 0x4aa0
leaq -0xe8(%rbp), %rdi
callq 0x4aa0
leaq -0x108(%rbp), %rdi
callq 0x2280
jmp 0x2813
movq -0x60(%rbp), %rdi
callq 0x4150
movl %eax, -0x518(%rbp)
jmp 0x2824
movl -0x518(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $-0x1, -0x4c(%rbp)
jne 0x284f
jmp 0x380f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x40a4
cmpl $-0x2, -0x4c(%rbp)
jne 0x28b9
movq 0xe794(%rip), %rdi      # 0x10ff0
leaq 0x8a96(%rip), %rsi      # 0xb2f9
callq 0x21b0
movq %rax, -0x520(%rbp)
jmp 0x2871
movq -0x520(%rbp), %rdi
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x21b0
movq %rax, -0x528(%rbp)
jmp 0x288e
movq -0x528(%rbp), %rdi
leaq 0x8af4(%rip), %rsi      # 0xb390
callq 0x21b0
jmp 0x28a3
movl $0x1, -0x4(%rbp)
movl $0x1, -0x118(%rbp)
jmp 0x405a
cmpl $-0x3, -0x4c(%rbp)
jne 0x291f
movq 0xe72a(%rip), %rdi      # 0x10ff0
leaq 0x8a4a(%rip), %rsi      # 0xb317
callq 0x21b0
movq %rax, -0x530(%rbp)
jmp 0x28db
movq -0x530(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x21b0
movq %rax, -0x538(%rbp)
jmp 0x28f4
movq -0x538(%rbp), %rdi
leaq 0x8a8e(%rip), %rsi      # 0xb390
callq 0x21b0
jmp 0x2909
movl $0x1, -0x4(%rbp)
movl $0x1, -0x118(%rbp)
jmp 0x405a
cmpq $0x0, -0x68(%rbp)
jbe 0x2998
movq -0x60(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x70(%rbp), %rax
je 0x2998
movq 0xe6b5(%rip), %rdi      # 0x10ff0
leaq 0x89e4(%rip), %rsi      # 0xb326
callq 0x21b0
movq %rax, -0x540(%rbp)
jmp 0x2950
movq -0x540(%rbp), %rdi
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x21b0
movq %rax, -0x548(%rbp)
jmp 0x296d
movq -0x548(%rbp), %rdi
leaq 0x8a15(%rip), %rsi      # 0xb390
callq 0x21b0
jmp 0x2982
movl $0x1, -0x4(%rbp)
movl $0x1, -0x118(%rbp)
jmp 0x405a
movq -0x60(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x558(%rbp)
leaq -0x139(%rbp), %rdi
movq %rdi, -0x550(%rbp)
callq 0x2330
movq -0x558(%rbp), %rsi
movq -0x550(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x4af0
jmp 0x29e2
leaq -0x88(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x4ac0
jmp 0x29f7
leaq -0x138(%rbp), %rdi
callq 0x20f0
leaq -0x139(%rbp), %rdi
callq 0x2200
movq -0x70(%rbp), %rax
movq %rax, -0x568(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x560(%rbp)
callq 0x4ba0
movq -0x568(%rbp), %rsi
movq -0x560(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x160(%rbp), %rdi
callq 0x4bc0
jmp 0x2a4d
leaq -0x161(%rbp), %rdi
callq 0x4c30
movq -0x70(%rbp), %rax
movq %rax, -0x578(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x570(%rbp)
callq 0x4ba0
movq -0x578(%rbp), %rsi
movq -0x570(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x188(%rbp), %rdi
callq 0x4bc0
jmp 0x2a97
leaq -0x189(%rbp), %rdi
callq 0x4c30
movq -0x70(%rbp), %rax
movq %rax, -0x588(%rbp)
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x580(%rbp)
callq 0x4ba0
movq -0x588(%rbp), %rsi
movq -0x580(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1b0(%rbp), %rdi
callq 0x4bc0
jmp 0x2ae1
leaq -0x1b1(%rbp), %rdi
callq 0x4c30
movq -0x70(%rbp), %rax
movq %rax, -0x598(%rbp)
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x590(%rbp)
callq 0x4ba0
movq -0x598(%rbp), %rsi
movq -0x590(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1d8(%rbp), %rdi
callq 0x4bc0
jmp 0x2b2b
leaq -0x1d9(%rbp), %rdi
callq 0x4c30
movq $0x0, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x3751
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x1e8(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x2350
movb %al, %dl
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x1e8(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x1e8(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, -0x5a0(%rbp)
subl $0x18, %eax
ja 0x35ee
movq -0x5a0(%rbp), %rax
leaq 0x844f(%rip), %rcx      # 0xb004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x2bf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x20f0
leaq -0x139(%rbp), %rdi
callq 0x2200
jmp 0x40a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x161(%rbp), %rdi
callq 0x4c30
jmp 0x40a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x189(%rbp), %rdi
callq 0x4c30
jmp 0x37fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1b1(%rbp), %rdi
callq 0x4c30
jmp 0x37f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1d9(%rbp), %rdi
callq 0x4c30
jmp 0x37e6
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x5b0(%rbp)
movq %rax, -0x5a8(%rbp)
jmp 0x2cb0
movq -0x5b0(%rbp), %rax
movq -0x5a8(%rbp), %rcx
movq %rcx, -0x1f8(%rbp)
movq %rax, -0x1f0(%rbp)
leaq -0x1f8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2cdf
jmp 0x3738
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x4d60
jmp 0x37e6
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x5c0(%rbp)
movq %rax, -0x5b8(%rbp)
jmp 0x2d2a
movq -0x5c0(%rbp), %rax
movq -0x5b8(%rbp), %rcx
movq %rcx, -0x208(%rbp)
movq %rax, -0x200(%rbp)
leaq -0x208(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2d59
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x5d0(%rbp)
movq %rax, -0x5c8(%rbp)
jmp 0x2d81
movq -0x5d0(%rbp), %rax
movq -0x5c8(%rbp), %rcx
movq %rcx, -0x218(%rbp)
movq %rax, -0x210(%rbp)
leaq -0x218(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2db0
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x5e0(%rbp)
movq %rax, -0x5d8(%rbp)
jmp 0x2dd8
movq -0x5e0(%rbp), %rax
movq -0x5d8(%rbp), %rcx
movq %rcx, -0x228(%rbp)
movq %rax, -0x220(%rbp)
leaq -0x228(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2e07
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x5f0(%rbp)
movq %rax, -0x5e8(%rbp)
jmp 0x2e2f
movq -0x5f0(%rbp), %rax
movq -0x5e8(%rbp), %rcx
movq %rcx, -0x238(%rbp)
movq %rax, -0x230(%rbp)
leaq -0x238(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2e5e
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x600(%rbp)
movq %rax, -0x5f8(%rbp)
jmp 0x2e81
movq -0x600(%rbp), %rax
movq -0x5f8(%rbp), %rcx
movq %rcx, -0x248(%rbp)
movq %rax, -0x240(%rbp)
leaq -0x248(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2eb0
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x610(%rbp)
movq %rax, -0x608(%rbp)
jmp 0x2ed8
movq -0x610(%rbp), %rax
movq -0x608(%rbp), %rcx
movq %rcx, -0x258(%rbp)
movq %rax, -0x250(%rbp)
leaq -0x258(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2f07
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x620(%rbp)
movq %rax, -0x618(%rbp)
jmp 0x2f2a
movq -0x620(%rbp), %rax
movq -0x618(%rbp), %rcx
movq %rcx, -0x268(%rbp)
movq %rax, -0x260(%rbp)
leaq -0x268(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2f59
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x630(%rbp)
movq %rax, -0x628(%rbp)
jmp 0x2f81
movq -0x630(%rbp), %rax
movq -0x628(%rbp), %rcx
movq %rcx, -0x278(%rbp)
movq %rax, -0x270(%rbp)
leaq -0x278(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x2fb0
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x640(%rbp)
movq %rax, -0x638(%rbp)
jmp 0x2fd3
movq -0x640(%rbp), %rax
movq -0x638(%rbp), %rcx
movq %rcx, -0x288(%rbp)
movq %rax, -0x280(%rbp)
leaq -0x288(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3002
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x650(%rbp)
movq %rax, -0x648(%rbp)
jmp 0x302a
movq -0x650(%rbp), %rax
movq -0x648(%rbp), %rcx
movq %rcx, -0x298(%rbp)
movq %rax, -0x290(%rbp)
leaq -0x298(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3059
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x660(%rbp)
movq %rax, -0x658(%rbp)
jmp 0x307c
movq -0x660(%rbp), %rax
movq -0x658(%rbp), %rcx
movq %rcx, -0x2a8(%rbp)
movq %rax, -0x2a0(%rbp)
leaq -0x2a8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x30ab
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x670(%rbp)
movq %rax, -0x668(%rbp)
jmp 0x30d3
movq -0x670(%rbp), %rax
movq -0x668(%rbp), %rcx
movq %rcx, -0x2b8(%rbp)
movq %rax, -0x2b0(%rbp)
leaq -0x2b8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3102
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x680(%rbp)
movq %rax, -0x678(%rbp)
jmp 0x3125
movq -0x680(%rbp), %rax
movq -0x678(%rbp), %rcx
movq %rcx, -0x2c8(%rbp)
movq %rax, -0x2c0(%rbp)
leaq -0x2c8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3154
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x690(%rbp)
movq %rax, -0x688(%rbp)
jmp 0x317c
movq -0x690(%rbp), %rax
movq -0x688(%rbp), %rcx
movq %rcx, -0x2d8(%rbp)
movq %rax, -0x2d0(%rbp)
leaq -0x2d8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x31ab
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x6a0(%rbp)
movq %rax, -0x698(%rbp)
jmp 0x31ce
movq -0x6a0(%rbp), %rax
movq -0x698(%rbp), %rcx
movq %rcx, -0x2e8(%rbp)
movq %rax, -0x2e0(%rbp)
leaq -0x2e8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x31fd
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x6b0(%rbp)
movq %rax, -0x6a8(%rbp)
jmp 0x3225
movq -0x6b0(%rbp), %rax
movq -0x6a8(%rbp), %rcx
movq %rcx, -0x2f8(%rbp)
movq %rax, -0x2f0(%rbp)
leaq -0x2f8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3254
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x6c0(%rbp)
movq %rax, -0x6b8(%rbp)
jmp 0x3277
movq -0x6c0(%rbp), %rax
movq -0x6b8(%rbp), %rcx
movq %rcx, -0x308(%rbp)
movq %rax, -0x300(%rbp)
leaq -0x308(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x32a6
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x6d0(%rbp)
movq %rax, -0x6c8(%rbp)
jmp 0x32c9
movq -0x6d0(%rbp), %rax
movq -0x6c8(%rbp), %rcx
movq %rcx, -0x318(%rbp)
movq %rax, -0x310(%rbp)
leaq -0x318(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x32f8
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x6e0(%rbp)
movq %rax, -0x6d8(%rbp)
jmp 0x3320
movq -0x6e0(%rbp), %rax
movq -0x6d8(%rbp), %rcx
movq %rcx, -0x328(%rbp)
movq %rax, -0x320(%rbp)
leaq -0x328(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x334f
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x6f0(%rbp)
movq %rax, -0x6e8(%rbp)
jmp 0x3372
movq -0x6f0(%rbp), %rax
movq -0x6e8(%rbp), %rcx
movq %rcx, -0x338(%rbp)
movq %rax, -0x330(%rbp)
leaq -0x338(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x33a1
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x700(%rbp)
movq %rax, -0x6f8(%rbp)
jmp 0x33c4
movq -0x700(%rbp), %rax
movq -0x6f8(%rbp), %rcx
movq %rcx, -0x348(%rbp)
movq %rax, -0x340(%rbp)
leaq -0x348(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x33f3
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x710(%rbp)
movq %rax, -0x708(%rbp)
jmp 0x341b
movq -0x710(%rbp), %rax
movq -0x708(%rbp), %rcx
movq %rcx, -0x358(%rbp)
movq %rax, -0x350(%rbp)
leaq -0x358(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x344a
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x720(%rbp)
movq %rax, -0x718(%rbp)
jmp 0x346d
movq -0x720(%rbp), %rax
movq -0x718(%rbp), %rcx
movq %rcx, -0x368(%rbp)
movq %rax, -0x360(%rbp)
leaq -0x368(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x349c
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x730(%rbp)
movq %rax, -0x728(%rbp)
jmp 0x34bf
movq -0x730(%rbp), %rax
movq -0x728(%rbp), %rcx
movq %rcx, -0x378(%rbp)
movq %rax, -0x370(%rbp)
leaq -0x378(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x34ee
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x740(%rbp)
movq %rax, -0x738(%rbp)
jmp 0x3516
movq -0x740(%rbp), %rax
movq -0x738(%rbp), %rcx
movq %rcx, -0x388(%rbp)
movq %rax, -0x380(%rbp)
leaq -0x388(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3545
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x750(%rbp)
movq %rax, -0x748(%rbp)
jmp 0x3568
movq -0x750(%rbp), %rax
movq -0x748(%rbp), %rcx
movq %rcx, -0x398(%rbp)
movq %rax, -0x390(%rbp)
leaq -0x398(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3597
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x760(%rbp)
movq %rax, -0x758(%rbp)
jmp 0x35ba
movq -0x760(%rbp), %rax
movq -0x758(%rbp), %rcx
movq %rcx, -0x3a8(%rbp)
movq %rax, -0x3a0(%rbp)
leaq -0x3a8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x35e9
jmp 0x3738
movq -0x1e8(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x770(%rbp)
movq %rax, -0x768(%rbp)
jmp 0x3611
movq -0x770(%rbp), %rax
movq -0x768(%rbp), %rcx
movq %rcx, -0x3b8(%rbp)
movq %rax, -0x3b0(%rbp)
leaq -0x3b8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3640
movq -0x1e8(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x780(%rbp)
movq %rax, -0x778(%rbp)
jmp 0x3663
movq -0x780(%rbp), %rax
movq -0x778(%rbp), %rcx
movq %rcx, -0x3c8(%rbp)
movq %rax, -0x3c0(%rbp)
leaq -0x3c8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3692
movq -0x1e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x790(%rbp)
movq %rax, -0x788(%rbp)
jmp 0x36b5
movq -0x790(%rbp), %rax
movq -0x788(%rbp), %rcx
movq %rcx, -0x3d8(%rbp)
movq %rax, -0x3d0(%rbp)
leaq -0x3d8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x36e4
movq -0x1e8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4c50
movq %rdx, -0x7a0(%rbp)
movq %rax, -0x798(%rbp)
jmp 0x3707
movq -0x7a0(%rbp), %rax
movq -0x798(%rbp), %rcx
movq %rcx, -0x3e8(%rbp)
movq %rax, -0x3e0(%rbp)
leaq -0x3e8(%rbp), %rdi
movl $0x1, %esi
callq 0x4cb0
jmp 0x3736
jmp 0x3738
jmp 0x373a
movq -0x1e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1e8(%rbp)
jmp 0x2b42
leaq -0xa0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x4cf0
jmp 0x3766
leaq -0xb8(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x4cf0
jmp 0x377b
leaq -0xd0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x4cf0
jmp 0x3790
leaq -0xe8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x4cf0
jmp 0x37a5
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x4d60
leaq -0x1b0(%rbp), %rdi
callq 0x4d60
leaq -0x188(%rbp), %rdi
callq 0x4d60
leaq -0x160(%rbp), %rdi
callq 0x4d60
jmp 0x2811
leaq -0x1b0(%rbp), %rdi
callq 0x4d60
leaq -0x188(%rbp), %rdi
callq 0x4d60
leaq -0x160(%rbp), %rdi
callq 0x4d60
jmp 0x40a4
movq -0x60(%rbp), %rdi
callq 0x4510
jmp 0x381a
movq -0x58(%rbp), %rdi
callq 0x2310
jmp 0x3825
cmpl $-0x1, -0x28(%rbp)
je 0x3855
movl -0x28(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl %ecx, %eax
jl 0x3855
movq 0xd78b(%rip), %rax      # 0x10fc8
movq (%rax), %rdi
leaq 0x7b1a(%rip), %rsi      # 0xb361
movb $0x0, %al
callq 0x2290
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
cmpl $0x0, -0x2c(%rbp)
je 0x390d
movq 0xd75a(%rip), %rdi      # 0x10fc0
movl $0x23, %esi
callq 0x2230
movq %rax, -0x7a8(%rbp)
jmp 0x3879
movq -0x7a8(%rbp), %rdi
movsbl -0x39(%rbp), %esi
callq 0x2230
jmp 0x388b
movq $0x0, -0x3f0(%rbp)
movq -0x3f0(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x38f6
movq -0x3f0(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x4dc0
movq %rax, %rsi
movq 0xd700(%rip), %rdi      # 0x10fc0
callq 0x2190
movq %rax, -0x7b0(%rbp)
jmp 0x38ce
movq -0x7b0(%rbp), %rdi
movsbl -0x39(%rbp), %esi
callq 0x2230
jmp 0x38e0
jmp 0x38e2
movq -0x3f0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3f0(%rbp)
jmp 0x3896
movq 0xd6c3(%rip), %rdi      # 0x10fc0
movq 0xd6a4(%rip), %rsi      # 0x10fa8
callq 0x21e0
jmp 0x390b
jmp 0x390d
movq $0x0, -0x3f8(%rbp)
movq -0x3f8(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x4049
movq -0x68(%rbp), %rax
movq %rax, -0x7c0(%rbp)
leaq -0x411(%rbp), %rdi
movq %rdi, -0x7b8(%rbp)
callq 0x4de0
movq -0x7c0(%rbp), %rsi
movq -0x7b8(%rbp), %rdx
leaq -0x410(%rbp), %rdi
callq 0x4e00
jmp 0x3963
leaq -0x411(%rbp), %rdi
callq 0x4e70
movq -0x70(%rbp), %rax
movq %rax, -0x7d0(%rbp)
leaq -0x439(%rbp), %rdi
movq %rdi, -0x7c8(%rbp)
callq 0x4ba0
movq -0x7d0(%rbp), %rsi
movq -0x7c8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x438(%rbp), %rdi
callq 0x4bc0
jmp 0x39ad
leaq -0x439(%rbp), %rdi
callq 0x4c30
cmpl $0x0, -0x20(%rbp)
je 0x3a1f
cmpl $0x0, -0x28(%rbp)
jge 0x3a1f
movq -0x3f8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x448(%rbp)
jmp 0x3a2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x411(%rbp), %rdi
callq 0x4e70
jmp 0x40a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x439(%rbp), %rdi
callq 0x4c30
jmp 0x403b
movq $0x0, -0x448(%rbp)
movq -0x448(%rbp), %rax
movq %rax, -0x450(%rbp)
movq -0x450(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x3cfc
movq -0x3f8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x7e0(%rbp)
callq 0x4f20
movq -0x7e0(%rbp), %rdi
movq %rax, -0x7d8(%rbp)
movq -0x450(%rbp), %rsi
callq 0x4f20
movq -0x7d8(%rbp), %rsi
movq %rax, %rdx
leaq -0x470(%rbp), %rdi
callq 0x4e90
jmp 0x3a95
leaq -0x438(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x4f40
jmp 0x3aaa
leaq -0x470(%rbp), %rdi
callq 0x4d60
movq -0x3f8(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0x4f20
movq -0x7f0(%rbp), %rdi
movq %rax, -0x7e8(%rbp)
movq -0x450(%rbp), %rsi
callq 0x4f20
movq -0x7e8(%rbp), %rsi
movq %rax, %rdx
leaq -0x490(%rbp), %rdi
callq 0x4e90
jmp 0x3b02
leaq -0x438(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x5030
jmp 0x3b17
leaq -0x490(%rbp), %rdi
callq 0x4d60
movq -0x3f8(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x800(%rbp)
callq 0x4f20
movq -0x800(%rbp), %rdi
movq %rax, -0x7f8(%rbp)
movq -0x450(%rbp), %rsi
callq 0x4f20
movq -0x7f8(%rbp), %rsi
movq %rax, %rdx
leaq -0x4b0(%rbp), %rdi
callq 0x4e90
jmp 0x3b6f
leaq -0x438(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0x5030
jmp 0x3b84
leaq -0x4b0(%rbp), %rdi
callq 0x4d60
movq -0x3f8(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x810(%rbp)
callq 0x4f20
movq -0x810(%rbp), %rdi
movq %rax, -0x808(%rbp)
movq -0x450(%rbp), %rsi
callq 0x4f20
movq -0x808(%rbp), %rsi
movq %rax, %rdx
leaq -0x4d0(%rbp), %rdi
callq 0x4e90
jmp 0x3bdc
leaq -0x438(%rbp), %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x5030
jmp 0x3bf1
leaq -0x4d0(%rbp), %rdi
callq 0x4d60
movq -0x70(%rbp), %rax
movq %rax, -0x820(%rbp)
leaq -0x438(%rbp), %rdi
callq 0x50f0
movq %rax, %rcx
movq -0x820(%rbp), %rax
subq %rcx, %rax
movl %eax, -0x814(%rbp)
movq -0x450(%rbp), %rsi
leaq -0x410(%rbp), %rdi
callq 0x5150
movl -0x814(%rbp), %ecx
movl %ecx, (%rax)
movq -0x450(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x450(%rbp)
jmp 0x3a38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x402f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x4d60
jmp 0x402f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x4d60
jmp 0x402f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x4b0(%rbp), %rdi
callq 0x4d60
jmp 0x402f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x4d0(%rbp), %rdi
callq 0x4d60
jmp 0x402f
cmpl $0x0, -0x28(%rbp)
jl 0x3db3
leaq -0x4e8(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x5170
jmp 0x3d1b
leaq -0x4e8(%rbp), %rdi
movq %rdi, -0x828(%rbp)
callq 0x52a0
movq -0x828(%rbp), %rdi
movq %rax, -0x4f0(%rbp)
callq 0x52d0
movq %rax, -0x4f8(%rbp)
movq -0x4f0(%rbp), %rdi
movq -0x4f8(%rbp), %rsi
callq 0x5260
jmp 0x3d5d
movl -0x28(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq -0x4e8(%rbp), %rdi
callq 0x5150
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movq $0x0, -0x448(%rbp)
leaq -0x4e8(%rbp), %rdi
callq 0x5300
jmp 0x3dc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x4e8(%rbp), %rdi
callq 0x5300
jmp 0x402f
movq -0x3f8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x448(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x3f3c
movq -0x448(%rbp), %rax
movq %rax, -0x500(%rbp)
movq -0x500(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x3f37
cmpl $-0x1, -0x24(%rbp)
je 0x3e12
movq -0x500(%rbp), %rsi
leaq -0x410(%rbp), %rdi
callq 0x5150
movl (%rax), %eax
cmpl -0x24(%rbp), %eax
jg 0x3f1e
cmpl $0x0, -0x2c(%rbp)
je 0x3e7a
movq -0x3f8(%rbp), %rax
movq %rax, -0x840(%rbp)
movsbl -0x39(%rbp), %eax
movl %eax, -0x82c(%rbp)
movq -0x500(%rbp), %rsi
movq %rsi, -0x838(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x5150
movq -0x840(%rbp), %rsi
movq -0x838(%rbp), %rcx
movl -0x82c(%rbp), %r8d
movl (%rax), %r9d
leaq 0x7529(%rip), %rdi      # 0xb392
xorl %eax, %eax
movl %r8d, %edx
callq 0x2030
jmp 0x3e75
jmp 0x3f1c
movq -0x3f8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movq %rdi, -0x868(%rbp)
callq 0x4dc0
movq %rax, %rdi
callq 0x20a0
movq -0x868(%rbp), %rdi
movq %rax, -0x860(%rbp)
movsbl -0x39(%rbp), %eax
movl %eax, -0x854(%rbp)
movq -0x500(%rbp), %rsi
callq 0x4dc0
movq %rax, %rdi
callq 0x20a0
movq %rax, -0x850(%rbp)
movsbl -0x39(%rbp), %eax
movl %eax, -0x844(%rbp)
movq -0x500(%rbp), %rsi
leaq -0x410(%rbp), %rdi
callq 0x5150
movq -0x860(%rbp), %rsi
movl -0x854(%rbp), %edx
movq -0x850(%rbp), %rcx
movl -0x844(%rbp), %r8d
movl (%rax), %r9d
leaq 0x748d(%rip), %rdi      # 0xb39e
xorl %eax, %eax
callq 0x2030
jmp 0x3f1a
jmp 0x3f1c
jmp 0x3f1e
jmp 0x3f20
movq -0x500(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x500(%rbp)
jmp 0x3ddd
jmp 0x4000
cmpl $0x0, -0x2c(%rbp)
je 0x3f5b
movq -0x3f8(%rbp), %rsi
leaq 0x745f(%rip), %rdi      # 0xb3af
xorl %eax, %eax
callq 0x2030
jmp 0x3f59
jmp 0x3f8b
movq -0x3f8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x4dc0
movq %rax, %rdi
callq 0x20a0
movq %rax, %rsi
leaq 0x742a(%rip), %rdi      # 0xb3aa
xorl %eax, %eax
callq 0x2030
jmp 0x3f89
jmp 0x3f8b
movq $0x0, -0x508(%rbp)
movq -0x508(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x3fee
movsbl -0x39(%rbp), %eax
movl %eax, -0x86c(%rbp)
movq -0x508(%rbp), %rsi
leaq -0x410(%rbp), %rdi
callq 0x5150
movl -0x86c(%rbp), %esi
movl (%rax), %edx
leaq 0x73de(%rip), %rdi      # 0xb3ad
xorl %eax, %eax
callq 0x2030
jmp 0x3fd8
jmp 0x3fda
movq -0x508(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x508(%rbp)
jmp 0x3f96
leaq 0x739b(%rip), %rdi      # 0xb390
xorl %eax, %eax
callq 0x2030
jmp 0x3ffe
jmp 0x4000
leaq -0x438(%rbp), %rdi
callq 0x4d60
leaq -0x410(%rbp), %rdi
callq 0x5300
movq -0x3f8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3f8(%rbp)
jmp 0x3918
leaq -0x438(%rbp), %rdi
callq 0x4d60
leaq -0x410(%rbp), %rdi
callq 0x5300
jmp 0x40a4
movl $0x0, -0x4(%rbp)
movl $0x1, -0x118(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
callq 0x5360
leaq -0xd0(%rbp), %rdi
callq 0x5360
leaq -0xb8(%rbp), %rdi
callq 0x5360
leaq -0xa0(%rbp), %rdi
callq 0x5360
leaq -0x88(%rbp), %rdi
callq 0x53c0
jmp 0x40ee
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
callq 0x5360
leaq -0xd0(%rbp), %rdi
callq 0x5360
leaq -0xb8(%rbp), %rdi
callq 0x5360
leaq -0xa0(%rbp), %rdi
callq 0x5360
leaq -0x88(%rbp), %rdi
callq 0x53c0
jmp 0x40fa
movl -0x4(%rbp), %eax
addq $0x870, %rsp            # imm = 0x870
popq %rbp
retq
movq -0x110(%rbp), %rdi
callq 0x2320
nopw %cs:(%rax,%rax)