// File: /workspace/github_cpp_makefile_star2_O3/VanAndelInstitute[P]intent/main.cpp
// Function: main
int main(int argc, char *argv[]) {
  int c, distance = 2 ;
  bool expanded = false;
  bool v2 = false;
  std::set<std::string>::iterator it_bc1;
  std::set<std::string>::iterator it_bc2;
  int format = FORMAT_V3;

  while( ( c = getopt (argc, argv, "xthvd:") ) != -1 )
  {
      switch(c)
      {
          case 'h':
              usage();
              exit(0);
          case 'v':
              std::cout << "\n  intent version " << VERSION << "\n\n";
              exit(0);
          case 'x':
              expanded = true;
              format = FORMAT_EXTENDED;
              break;
          case 'd':
              if(optarg) {
                distance = std::atoi(optarg);
              } else {
                std::cout << "The -d flag requires a value.\n\n";
              }
              break;
          case 't':
              v2 = true;
              format = FORMAT_V3;
              break;
      }
  }

  if(expanded && v2) {
    std::cout << "The -x and -t flags are mutually exclusive. Please select only 1.\n\n";
  }

  if (argv[optind] == NULL || argv[optind + 1]  == NULL) {
    usage();
    exit(0);
  }

  std::string pathR1 = argv[optind];
  std::string pathR2 = argv[optind + 1];
  std::string pathR1_out, pathR2_out;
  auto start_time = std::chrono::steady_clock::now();

  // note R1 and R2 are swapped to mimic 10X libraries
  pathR1_out = reformatFileName(pathR2, "intent_R1.fastq.gz");
  pathR2_out = reformatFileName(pathR1, "intent_R2.fastq.gz");

  std::fstream r1_fs, r2_fs; //, r1_out_fs, r2_out_fs;

  r1_fs.open(pathR1, std::ios::in);
  r2_fs.open(pathR2, std::ios::in);
  //r1_out_fs.open(pathR1_out, std::ios::out);
  //r2_out_fs.open(pathR2_out, std::ios::out);

  zstr::istream r1(r1_fs),
                r2(r2_fs);

  zstr::ofstream r1_out(pathR1_out);
  zstr::ofstream r2_out(pathR2_out);
  
  int in = 0, ok = 0, bad_w1 = 0, other = 0, shortread = 0, bad_barcode = 0, corrected = 0;
  init_stats_table();

  while(r2.peek() != EOF ) {
    in++;
    if((in % 10000) == 0)
       update_stats(start_time, in, ok, bad_w1, shortread, corrected, bad_barcode);

    std::vector<std::string> lines_r1, lines_r2;
    std::vector<int> coords;
    lines_r1 = readFour(r1);
    lines_r2 = readFour(r2);
    ParsedBarcode bc = extract_v2_barcodes(lines_r2[1], lines_r2[3], 2, true);

    if(bc.status == BC_ERROR_SHORTREAD) {
      shortread++;
    } else if(bc.status == BC_ERROR_BAD_W1) {
      bad_w1++;
    } else if(bc.status == BC_ERROR_BAD_BARCODE) {
      bad_barcode++;
    } else if(bc.status == BC_ERROR) {
      other++;
      std::cout << "An undefined error occurred processing this read: \n" << 
      lines_r2[0] << std::endl << 
      lines_r2[1] << std::endl << 
      lines_r2[2] << std::endl << 
      lines_r2[3] << std::endl; 
    } else if(bc.status == BC_OK) {
      ok++;
      if(bc.bc_fixed) {
        corrected++;
      }
      FastqRead r = format_barcode(bc, lines_r2[0], lines_r2[2], format);

      writeFour(r1_out, {r.id,
                         r.read,
                         r.direction,
                         r.quality
                        });
      writeFour(r2_out, lines_r1);

    } else {
      std::cout << "An unknown error occurred processing this read: \n" << 
      lines_r2[0] << std::endl << 
      lines_r2[1] << std::endl << 
      lines_r2[2] << std::endl << 
      lines_r2[3] << std::endl; 
      other++;
    }
  }
  r1_fs.close();
  r2_fs.close();
  //r1_out_fs.close();
  //r2_out_fs.close();

  std::cout << "\n\nComplete. Job summary: " << std::endl <<
        "Reads: " << in <<std:: endl <<
        "OK: " << ok << std::endl <<
        "Poor W1 alignment: " << bad_w1 << std::endl <<
        "Barcode or UMI too short: " << shortread <<std::endl <<
        "Barcode succesfully corrected: " << corrected << std::endl <<
        "Barcode not recognized: " << bad_barcode << std::endl;
  if(other > 0) {
        std::cout << "Unknown errors (!!): " << other << std::endl;
  }
  std::cout << std::endl;
  return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1158, %rsp           # imm = 0x1158
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x198f9(%rip), %rdx     # 0x323bc
callq 0x60c0
cmpl $-0x1, %eax
je 0x18b74
movl $0x1, 0x14(%rsp)
xorl %r13d, %r13d
leaq 0x198d9(%rip), %r14     # 0x323bc
leaq 0x18556(%rip), %r15     # 0x31040
xorl %r12d, %r12d
addl $-0x64, %eax
rorl %eax
cmpl $0xa, %eax
ja 0x18b3f
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq 0x27471(%rip), %rax     # 0x3ff78
cmpq $0x0, (%rax)
jne 0x18b3f
movl $0x1f, %edx
movq 0x2749f(%rip), %rdi     # 0x3ffb8
leaq 0x198b6(%rip), %rsi     # 0x323d6
callq 0x6450
jmp 0x18b3f
movb $0x1, %r12b
movl $0x1, 0x14(%rsp)
jmp 0x18b3f
movb $0x1, %r13b
movl $0x2, 0x14(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x60c0
cmpl $-0x1, %eax
jne 0x18aed
andb %r12b, %r13b
testb $0x1, %r13b
je 0x18b7c
movq 0x27457(%rip), %rdi     # 0x3ffb8
leaq 0x1988e(%rip), %rsi     # 0x323f6
movl $0x43, %edx
callq 0x6450
jmp 0x18b7c
movl $0x1, 0x14(%rsp)
movq 0x2743d(%rip), %r14     # 0x3ffc0
movslq (%r14), %rax
movq (%rbx,%rax,8), %rsi
testq %rsi, %rsi
je 0x19c21
cmpq $0x0, 0x8(%rbx,%rax,8)
je 0x19c21
leaq 0x170(%rsp), %rdi
leaq 0x718(%rsp), %rdx
callq 0x1a0b8
movslq (%r14), %rax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x150(%rsp), %rdi
leaq 0x718(%rsp), %rdx
callq 0x1a0b8
leaq 0x118(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x78(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
callq 0x6520
movq %rax, 0x138(%rsp)
leaq 0x280(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x150(%rsp), %rsi
movq 0x158(%rsp), %rdx
addq %rsi, %rdx
leaq 0x270(%rsp), %rdi
callq 0x1c190
leaq 0x260(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x197f9(%rip), %rsi     # 0x3243a
leaq 0x19804(%rip), %rdx     # 0x3244c
leaq 0x250(%rsp), %rdi
callq 0x1bde6
leaq 0x718(%rsp), %rdi
leaq 0x270(%rsp), %rsi
leaq 0x250(%rsp), %rdx
callq 0x1893d
leaq 0x108(%rsp), %rdi
leaq 0x718(%rsp), %rbx
movq %rbx, %rsi
callq 0x64d0
movq (%rbx), %rdi
leaq 0x728(%rsp), %r15
cmpq %r15, %rdi
je 0x18caa
movq 0x728(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x250(%rsp), %rdi
cmpq %r12, %rdi
je 0x18cc7
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x270(%rsp), %rdi
cmpq %r14, %rdi
je 0x18ce4
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x240(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x170(%rsp), %rsi
movq 0x178(%rsp), %rdx
addq %rsi, %rdx
leaq 0x230(%rsp), %rdi
callq 0x1c190
leaq 0x220(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x19729(%rip), %rsi     # 0x3244d
leaq 0x19734(%rip), %rdx     # 0x3245f
leaq 0x210(%rsp), %rdi
callq 0x1bde6
leaq 0x718(%rsp), %rdi
leaq 0x230(%rsp), %rsi
leaq 0x210(%rsp), %rdx
callq 0x1893d
leaq 0x68(%rsp), %rdi
leaq 0x718(%rsp), %rbx
movq %rbx, %rsi
callq 0x64d0
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x18d82
movq 0x728(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x210(%rsp), %rdi
cmpq %r12, %rdi
je 0x18d9f
movq 0x220(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x230(%rsp), %rdi
cmpq %r14, %rdi
je 0x18dbc
movq 0x240(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0xc38(%rsp), %rdi
callq 0x64a0
leaq 0xa28(%rsp), %rdi
callq 0x64a0
leaq 0xc38(%rsp), %rdi
leaq 0x170(%rsp), %rsi
movl $0x8, %edx
callq 0x6560
leaq 0xa28(%rsp), %rdi
leaq 0x150(%rsp), %rsi
movl $0x8, %edx
callq 0x6560
leaq 0x600(%rsp), %rdi
leaq 0xc38(%rsp), %rsi
callq 0x1a2a2
leaq 0x4e8(%rsp), %rdi
leaq 0xa28(%rsp), %rsi
callq 0x1a2a2
leaq 0x718(%rsp), %rdi
leaq 0x108(%rsp), %rsi
movl $0x10, %edx
callq 0x1a3be
leaq 0xe48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movl $0x10, %edx
callq 0x1a3be
movq 0x2714c(%rip), %rdi     # 0x3ffb8
leaq 0x19483(%rip), %rsi     # 0x322f6
movl $0x4c, %edx
callq 0x6450
movq 0x27134(%rip), %rdi     # 0x3ffb8
leaq 0x194b8(%rip), %rsi     # 0x32343
movl $0x4a, %edx
callq 0x6450
movl $0xb8, %eax
leaq 0x3e8(%rsp), %rcx
leaq (%rcx,%rax), %rdx
movq %rdx, 0x130(%rsp)
movl $0x98, %edx
addq %rdx, %rcx
movq %rcx, 0x128(%rsp)
leaq 0x310(%rsp), %r13
addq %r13, %rax
movq %rax, 0x148(%rsp)
addq %r13, %rdx
movq %rdx, 0x140(%rsp)
leaq 0x190(%rsp), %r14
xorl %r15d, %r15d
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x28(%rsp)
xorl %ebp, %ebp
movl $0x0, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x18(%rsp)
leaq 0x4e8(%rsp), %rdi
callq 0x6180
cmpl $-0x1, %eax
je 0x19837
incl %r15d
imull $0x3afb7e91, %r15d, %eax # imm = 0x3AFB7E91
rorl $0x4, %eax
cmpl $0x68db8, %eax          # imm = 0x68DB8
ja 0x18f64
movl 0x20(%rsp), %eax
movl %eax, (%rsp)
movq 0x138(%rsp), %rdi
movl %r15d, %esi
movl 0x1c(%rsp), %edx
movl 0x28(%rsp), %ecx
movl 0x24(%rsp), %r8d
movl 0x18(%rsp), %r9d
callq 0x18a17
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %r14, %rdi
leaq 0x600(%rsp), %rsi
callq 0x18741
movq 0x60(%rsp), %rax
movaps 0x190(%rsp), %xmm0
movq 0x1a0(%rsp), %rcx
movq %rcx, 0x60(%rsp)
movaps 0x50(%rsp), %xmm1
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x310(%rsp)
movq %rax, 0x320(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x190(%rsp)
movq $0x0, 0x1a0(%rsp)
movq %r13, %rdi
callq 0x1a1bc
movq %r14, %rdi
callq 0x1a1bc
movq %r14, %rdi
leaq 0x4e8(%rsp), %rsi
callq 0x18741
movq 0x40(%rsp), %rax
movaps 0x190(%rsp), %xmm0
movq 0x1a0(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movaps 0x30(%rsp), %xmm1
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x310(%rsp)
movq %rax, 0x320(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x190(%rsp)
movq $0x0, 0x1a0(%rsp)
movq %r13, %rdi
callq 0x1a1bc
movq %r14, %rdi
callq 0x1a1bc
movq 0x30(%rsp), %rax
leaq 0xb8(%rsp), %rcx
movq %rcx, 0xa8(%rsp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x1c190
movq 0x30(%rsp), %rax
leaq 0xf8(%rsp), %rcx
movq %rcx, 0xe8(%rsp)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1c190
movq %r13, %rdi
leaq 0xa8(%rsp), %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movl $0x1, %r8d
callq 0x2e355
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x190f3
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x19118
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x63c0
movl 0x310(%rsp), %eax
cmpq $0x4, %rax
ja 0x1962d
leaq 0x17f3c(%rip), %rcx     # 0x3106c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %ebp, %ebx
movzbl 0x3d8(%rsp), %ebp
leaq 0x3e8(%rsp), %rdi
movq %r13, %rsi
callq 0x1a4f4
movq 0x30(%rsp), %rax
leaq 0x98(%rsp), %rcx
movq %rcx, 0x88(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x1c190
movq 0x30(%rsp), %rax
leaq 0xd8(%rsp), %rcx
movq %rcx, 0xc8(%rsp)
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %r12
movq %r12, %rdi
callq 0x1c190
movq %r14, %rdi
leaq 0x3e8(%rsp), %rsi
leaq 0x88(%rsp), %rdx
movq %r12, %rcx
movl 0x14(%rsp), %r8d
callq 0x2ecc0
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x191f4
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x19219
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x490(%rsp), %rdi
cmpq 0x130(%rsp), %rdi
je 0x1923b
movq 0x4a0(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x470(%rsp), %rdi
cmpq 0x128(%rsp), %rdi
je 0x1925d
movq 0x480(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x450(%rsp), %rdi
leaq 0x460(%rsp), %rax
cmpq %rax, %rdi
je 0x19282
movq 0x460(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x430(%rsp), %rdi
leaq 0x440(%rsp), %rax
cmpq %rax, %rdi
je 0x192a7
movq 0x440(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x410(%rsp), %rdi
leaq 0x420(%rsp), %rax
cmpq %rax, %rdi
je 0x192cc
movq 0x420(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x3f0(%rsp), %rdi
leaq 0x400(%rsp), %rax
cmpq %rax, %rdi
je 0x192f1
movq 0x400(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x2a0(%rsp), %rax
movq %rax, 0x290(%rsp)
movq 0x190(%rsp), %rsi
movq 0x198(%rsp), %rdx
addq %rsi, %rdx
leaq 0x290(%rsp), %rdi
callq 0x1c190
leaq 0x2c0(%rsp), %rax
movq %rax, 0x2b0(%rsp)
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x2b0(%rsp), %rdi
movq %rdi, %r12
callq 0x1c190
leaq 0x2e0(%rsp), %rax
movq %rax, 0x2d0(%rsp)
movq 0x1d0(%rsp), %rsi
movq 0x1d8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x2d0(%rsp), %rdi
movq %rdi, %r12
callq 0x1c190
leaq 0x300(%rsp), %rax
movq %rax, 0x2f0(%rsp)
movq 0x1f0(%rsp), %rsi
movq 0x1f8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x2f0(%rsp), %rdi
movq %rdi, %r12
callq 0x1c190
movl $0x4, %edx
leaq 0x4d0(%rsp), %r12
movq %r12, %rdi
leaq 0x290(%rsp), %rsi
leaq 0x2f(%rsp), %rcx
callq 0x1a774
leaq 0x718(%rsp), %rdi
movq %r12, %rsi
callq 0x18886
incl 0x1c(%rsp)
addl %ebp, 0x18(%rsp)
movq %r12, %rdi
callq 0x1a1bc
movq $-0x80, %r12
leaq 0x300(%rsp), %rbp
movq -0x10(%rbp), %rdi
cmpq %rdi, %rbp
je 0x19420
movq (%rbp), %rsi
incq %rsi
callq 0x63c0
addq $-0x20, %rbp
addq $0x20, %r12
jne 0x1940b
leaq 0x4b8(%rsp), %r12
movq %r12, %rdi
leaq 0x50(%rsp), %rsi
callq 0x1a7bc
leaq 0xe48(%rsp), %rdi
movq %r12, %rsi
callq 0x18886
movl %ebx, %ebp
movq %r12, %rdi
callq 0x1a1bc
movq 0x1f0(%rsp), %rdi
leaq 0x200(%rsp), %rax
cmpq %rax, %rdi
je 0x1947e
movq 0x200(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x1d0(%rsp), %rdi
leaq 0x1e0(%rsp), %rax
cmpq %rax, %rdi
je 0x194a3
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %rax
cmpq %rax, %rdi
je 0x194c8
movq 0x1c0(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x190(%rsp), %rdi
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rdi
je 0x19746
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19746
incl 0x20(%rsp)
jmp 0x19746
incl 0x28(%rsp)
jmp 0x19746
incl 0x24(%rsp)
jmp 0x19746
movl $0x33, %edx
movq 0x26a9b(%rip), %rdi     # 0x3ffb8
leaq 0x18f3c(%rip), %rsi     # 0x32460
callq 0x6450
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x26a7c(%rip), %rdi     # 0x3ffb8
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x30(%rsp), %rcx
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
movq %rax, %rdi
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x30(%rsp), %rcx
movq 0x40(%rcx), %rsi
movq 0x48(%rcx), %rdx
movq %rax, %rdi
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x30(%rsp), %rcx
movq 0x60(%rcx), %rsi
movq 0x68(%rcx), %rdx
movq %rax, %rdi
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
jmp 0x19744
movl $0x31, %edx
movq 0x2697f(%rip), %rdi     # 0x3ffb8
leaq 0x18e54(%rip), %rsi     # 0x32494
callq 0x6450
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x26960(%rip), %rdi     # 0x3ffb8
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x30(%rsp), %rcx
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
movq %rax, %rdi
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x30(%rsp), %rcx
movq 0x40(%rcx), %rsi
movq 0x48(%rcx), %rdx
movq %rax, %rdi
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq 0x30(%rsp), %rcx
movq 0x60(%rcx), %rsi
movq 0x68(%rcx), %rdx
movq %rax, %rdi
callq 0x6450
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
incl %ebp
movq 0x3b8(%rsp), %rdi
cmpq 0x148(%rsp), %rdi
je 0x19768
movq 0x3c8(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x398(%rsp), %rdi
cmpq 0x140(%rsp), %rdi
je 0x1978a
movq 0x3a8(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x378(%rsp), %rdi
leaq 0x388(%rsp), %rax
cmpq %rax, %rdi
je 0x197af
movq 0x388(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x358(%rsp), %rdi
leaq 0x368(%rsp), %rax
cmpq %rax, %rdi
je 0x197d4
movq 0x368(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x338(%rsp), %rdi
leaq 0x348(%rsp), %rax
cmpq %rax, %rdi
je 0x197f9
movq 0x348(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x318(%rsp), %rdi
leaq 0x328(%rsp), %rax
cmpq %rax, %rdi
je 0x1981e
movq 0x328(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x30(%rsp), %rdi
callq 0x1a1bc
leaq 0x50(%rsp), %rdi
callq 0x1a1bc
jmp 0x18f11
leaq 0xc38(%rsp), %rdi
callq 0x6080
leaq 0xa28(%rsp), %rdi
callq 0x6080
movq 0x26760(%rip), %rbx     # 0x3ffb8
leaq 0x18c67(%rip), %rsi     # 0x324c6
movl $0x19, %edx
movq %rbx, %rdi
callq 0x6450
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq 0x2672e(%rip), %rbx     # 0x3ffb8
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r14
leaq 0x18c3c(%rip), %rsi     # 0x324e0
movl $0x7, %edx
movq %rax, %rdi
callq 0x6450
movq %r14, %rdi
movl %r15d, %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r14
leaq 0x18bf8(%rip), %rsi     # 0x324e8
movl $0x4, %edx
movq %rax, %rdi
callq 0x6450
movq %r14, %rdi
movl 0x1c(%rsp), %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r14
leaq 0x18bb0(%rip), %rsi     # 0x324ed
movl $0x13, %edx
movq %rax, %rdi
callq 0x6450
movq %r14, %rdi
movl 0x28(%rsp), %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r14
leaq 0x18b77(%rip), %rsi     # 0x32501
movl $0x1a, %edx
movq %rax, %rdi
callq 0x6450
movq %r14, %rdi
movl 0x24(%rsp), %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r14
leaq 0x18b45(%rip), %rsi     # 0x3251c
movl $0x1f, %edx
movq %rax, %rdi
callq 0x6450
movq %r14, %rdi
movl 0x18(%rsp), %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq %rax, %r14
leaq 0x18b18(%rip), %rsi     # 0x3253c
movl $0x18, %edx
movq %rax, %rdi
callq 0x6450
movq %r14, %rdi
movl 0x20(%rsp), %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
testl %ebp, %ebp
jle 0x19abb
movq 0x26546(%rip), %rdi     # 0x3ffb8
leaq 0x18adc(%rip), %rsi     # 0x32555
movl $0x15, %edx
callq 0x6450
movq 0x2652e(%rip), %rdi     # 0x3ffb8
movl %ebp, %esi
callq 0x6650
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x62a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6390
movsbl %al, %esi
movq 0x264df(%rip), %rdi     # 0x3ffb8
callq 0x6040
movq %rax, %rdi
callq 0x62a0
leaq 0x25d13(%rip), %rbx     # 0x3f800
leaq 0xe48(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1c0c8
movl $0x208, %r14d           # imm = 0x208
addq %r14, %r15
movq %r15, %rdi
callq 0x6140
leaq 0x718(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1c0c8
addq %r14, %r15
movq %r15, %rdi
callq 0x6140
leaq 0x25b1a(%rip), %rbx     # 0x3f650
leaq 0x4e8(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c136
leaq 0x4f8(%rsp), %rdi
callq 0x6140
leaq 0x600(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c136
leaq 0x610(%rsp), %rdi
callq 0x6140
leaq 0xa28(%rsp), %rdi
callq 0x60b0
leaq 0xc38(%rsp), %rdi
callq 0x60b0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x19ba6
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x19bcb
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x160(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19bec
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19c0d
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x63c0
xorl %eax, %eax
addq $0x1158, %rsp           # imm = 0x1158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x184bc
jmp 0x19c59
movq 0x26389(%rip), %rdi     # 0x3ffb8
leaq 0x1878d(%rip), %rsi     # 0x323c3
callq 0x63a0
leaq 0x26bf6(%rip), %rsi     # 0x40838
movq %rax, %rdi
callq 0x6370
leaq 0x187e6(%rip), %rsi     # 0x32437
movq %rax, %rdi
callq 0x63a0
xorl %edi, %edi
callq 0x64c0
movq %rax, %rbx
jmp 0x19ed2
movq %rax, %rbx
jmp 0x19ef3
movq %rax, %rbx
jmp 0x19f14
jmp 0x19d27
movq %rax, %rbx
jmp 0x19f42
jmp 0x19d17
movq %rax, %rbx
movq 0x210(%rsp), %rdi
cmpq %r12, %rdi
je 0x19caf
movq 0x220(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19caf
movq %rax, %rbx
movq 0x230(%rsp), %rdi
cmpq %r14, %rdi
je 0x19f4f
movq 0x240(%rsp), %rsi
jmp 0x19d0a
jmp 0x19d17
movq %rax, %rbx
movq 0x250(%rsp), %rdi
cmpq %r12, %rdi
je 0x19cf1
movq 0x260(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19cf1
movq %rax, %rbx
movq 0x270(%rsp), %rdi
cmpq %r14, %rdi
je 0x19f4f
movq 0x280(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19f4f
movq %rax, %rbx
jmp 0x19f4f
movq %rax, %rbx
jmp 0x19fb1
movq %rax, %rbx
jmp 0x19f35
movq %rax, %rbx
leaq 0x4b8(%rsp), %rdi
callq 0x1a1bc
jmp 0x19e1a
jmp 0x19d91
movq %rax, %rbx
leaq 0x4d0(%rsp), %rdi
callq 0x1a1bc
jmp 0x19d5b
movq %rax, %rbx
leaq 0x300(%rsp), %r14
xorl %r15d, %r15d
movq 0x2f0(%rsp,%r15), %rdi
leaq (%r14,%r15), %rax
cmpq %rdi, %rax
je 0x19d82
movq (%rax), %rsi
incq %rsi
callq 0x63c0
addq $-0x20, %r15
cmpq $-0x80, %r15
jne 0x19d66
jmp 0x19e1a
movq %rax, %rbx
jmp 0x19e1a
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x19dc6
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19dc6
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x19df0
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19df0
movq %rax, %rbx
leaq 0x3e8(%rsp), %rdi
callq 0x1a6d0
jmp 0x19e90
jmp 0x19e8d
movq %rax, %rbx
leaq 0x290(%rsp), %rsi
movq %r12, %rdi
callq 0x6710
leaq 0x190(%rsp), %rdi
callq 0x1a846
jmp 0x19e90
jmp 0x19e2d
jmp 0x19e2d
movq %rax, %rbx
jmp 0x19e9d
movq %rax, %rbx
jmp 0x19e5f
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x19e5f
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x19e9d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x63c0
jmp 0x19e9d
jmp 0x19e88
movq %rax, %rbx
jmp 0x19eb1
movq %rax, %rbx
leaq 0x310(%rsp), %rdi
callq 0x1a6d0
leaq 0x30(%rsp), %rdi
callq 0x1a1bc
leaq 0x50(%rsp), %rdi
callq 0x1a1bc
leaq 0x25948(%rip), %rsi     # 0x3f800
leaq 0xe48(%rsp), %rdi
callq 0x1c0c8
leaq 0x1050(%rsp), %rdi
callq 0x6140
leaq 0x25927(%rip), %rsi     # 0x3f800
leaq 0x718(%rsp), %rdi
callq 0x1c0c8
leaq 0x920(%rsp), %rdi
callq 0x6140
leaq 0x25756(%rip), %rsi     # 0x3f650
leaq 0x4e8(%rsp), %rdi
callq 0x1c136
leaq 0x4f8(%rsp), %rdi
callq 0x6140
leaq 0x25735(%rip), %rsi     # 0x3f650
leaq 0x600(%rsp), %rdi
callq 0x1c136
leaq 0x610(%rsp), %rdi
callq 0x6140
leaq 0xa28(%rsp), %rdi
callq 0x60b0
leaq 0xc38(%rsp), %rdi
callq 0x60b0
leaq 0x78(%rsp), %rax
movq 0x68(%rsp), %rdi
cmpq %rax, %rdi
je 0x19f6b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x63c0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x19f90
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x160(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19fb1
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x63c0
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19fd2
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x63c0
movq %rbx, %rdi
callq 0x6660