// File: /workspace/github_cpp_makefile_star2_O3/adamnovak[P]rlcsa/docarray.cpp
// Function: CSA::DocArray::readRules(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void
DocArray::readRules(const std::string& name_prefix, bool print)
{
  std::vector<pair_type> occurrences; // (block_id, rule_id)
  std::vector<usint> docs;
  SuccinctVector::Encoder rb_encoder(RULE_BLOCK_SIZE);
  SuccinctVector::Encoder rb_encoder_rle(RULE_BLOCK_SIZE);
  usint files = 0, current_rule = this->getNumberOfDocuments();
  usint total_rules = 0, total_occs = 0, total_size = 0, total_runs = 0;


  // Parse the individual files containing rules / bicliques.
  while(true)
  {
    std::ostringstream fn;
    fn << name_prefix << "-biclique-it-" << files << ".txt";
    std::ifstream input(fn.str().c_str(), std::ios_base::binary);
    if(!input) { break; }

    std::vector<std::string> rows;
    readRows(input, rows, true);
    input.close();

    bool invalid_blocks = false, nonoccurring_rules = false, invalid_docs = false, empty_rules = false;
    usint curr_rules = 0, curr_occs = 0, curr_size = 0, curr_runs = 0;
    for(std::vector<std::string>::iterator siter = rows.begin(); siter != rows.end(); ++siter)
    {
      std::vector<usint> before, after;
      parseLine(*siter, before, '-', after);

      // Block ids.
      bool occurs = false;
      for(std::vector<usint>::iterator iter = before.begin(); iter != before.end(); ++iter)
      {
        if(this->nodeIsBlock(*iter))
        {
          occurrences.push_back(pair_type(this->nodeToBlock(*iter), current_rule));
          curr_occs++; occurs = true;
        }
        else { invalid_blocks = true; }
      }
      if(!occurs) { nonoccurring_rules = true; }
      curr_rules++; current_rule++;

      // Document ids.
      rb_encoder.addBit(total_size + curr_size);
      rb_encoder_rle.addBit(docs.size());
      occurs = false;
      usint prev_doc = WORD_MAX - 1, run_length = 0;
      for(std::vector<usint>::iterator iter = after.begin(); iter != after.end(); ++iter)
      {
        if(this->nodeIsDoc(*iter))
        {
          usint doc_id = this->nodeToDoc(*iter);
          if(doc_id == prev_doc + 1) { run_length++; prev_doc++; }
          else
          {
            if(run_length > 0) { docs.push_back(run_length); }
            docs.push_back(doc_id); run_length = 1; curr_runs++;
            prev_doc = doc_id;
          }
          curr_size++; occurs = true;
        }
        else { invalid_docs = true; }
      }
      if(!occurs)
      {
        docs.push_back(this->getNumberOfDocuments());
        curr_size++; curr_runs++; empty_rules = true;
      }
      else { docs.push_back(run_length); }
    }

    if(print)
    {
      std::cout << "File " << files << ": "
        << curr_rules << " rules, "
        << curr_occs << " occurrences, "
        << curr_size << " document ids in "
        << curr_runs << " runs" << std::endl;
      if(invalid_blocks)     { std::cout << "There were invalid block ids." << std::endl; }
      if(nonoccurring_rules) { std::cout << "There were non-occurring rules." << std::endl; }
      if(invalid_docs)       { std::cout << "There were invalid document ids." << std::endl; }
      if(empty_rules)        { std::cout << "There were empty rules." << std::endl; }
      std::cout << std::endl;
    }
    files++;
    total_rules += curr_rules; total_occs += curr_occs; total_size += curr_size; total_runs += curr_runs;
  }


  // Parse the singleton file and the remaining part of the graph.
  usint total_singletons = 0, temp = 0;

  std::ostringstream ffn;
  ffn << name_prefix << "-it-" << (files - 1);
  std::string remainder_name = ffn.str();
  temp = parseSingletonFile(remainder_name, *this, occurrences, print);
  if(temp > 0) { total_singletons += temp; files++; }

  std::string singleton_name = name_prefix + ".singletons";
  temp = parseSingletonFile(singleton_name, *this, occurrences, print);
  if(temp > 0) { total_singletons += temp; files++; }


  // Build the structures.
  if(total_size < docs.size())
  {
    this->uses_rle = false;
    this->rule_borders = new SuccinctVector(rb_encoder, total_size);
    WriteBuffer rbuf(total_size, length(this->getNumberOfDocuments()));
    bool need_run_length = false; usint prev = 0;
    for(std::vector<usint>::iterator iter = docs.begin(); iter != docs.end(); ++iter)
    {
      if(!need_run_length)
      {
        prev = *iter;
        rbuf.writeItem(*iter);
        need_run_length = (*iter != this->getNumberOfDocuments());
      }
      else
      {
        for(usint i = 1; i < *iter; i++) { rbuf.writeItem(prev + i); }
        need_run_length = false;
      }
    }
    this->rules = rbuf.getReadBuffer();
  }
  else
  {
    this->uses_rle = true;
    this->rule_borders = new SuccinctVector(rb_encoder_rle, docs.size());
    WriteBuffer rbuf(docs.size(), length(this->getNumberOfDocuments()));
    for(std::vector<usint>::iterator iter = docs.begin(); iter != docs.end(); ++iter)
    {
      rbuf.writeItem(*iter);
    }
    this->rules = rbuf.getReadBuffer();
  }

  parallelSort(occurrences.begin(), occurrences.end());
  usint real_occs = occurrences.size();
  for(usint i = 0, looking_for = 0; i < occurrences.size(); i++)
  {
    while(looking_for < occurrences[i].first) { real_occs++; looking_for++; }
    looking_for = occurrences[i].first + 1;
  }
  real_occs += this->getNumberOfNodes() - 1 - occurrences.rbegin()->first;

  SuccinctVector::Encoder bb_encoder(BLOCK_BLOCK_SIZE);
  WriteBuffer bbuf(real_occs, length(this->maxInteger()));
  usint pos = 0;
  for(usint i = 0, looking_for = 0; i < occurrences.size(); i++)
  {
    while(looking_for < occurrences[i].first)
    {
      bb_encoder.addBit(pos);
      bbuf.writeItem(this->maxInteger()); pos++;
      looking_for++;
    }
    if(i == 0 || occurrences[i].first != occurrences[i - 1].first)
    {
      bb_encoder.addBit(pos);
      looking_for++;
    }
    bbuf.writeItem(occurrences[i].second); pos++;
  }
  for(usint i = occurrences.rbegin()->first + 1; i < this->getNumberOfNodes(); i++)
  {
    bb_encoder.addBit(pos);
    bbuf.writeItem(this->maxInteger()); pos++;
  }
  this->block_borders = new SuccinctVector(bb_encoder, real_occs);
  this->blocks = bbuf.getReadBuffer();

  if(print)
  {
    std::cout << files << " files: "
      << total_rules << " rules, "
      << total_occs << " occurrences, "
      << total_size << " document ids in "
      << total_runs << " runs, "
      << total_singletons << " singletons, "
      << (real_occs - total_occs - total_singletons) << " complete blocks" << std::endl;
    if(this->usesRLE()) { std::cout << "Using run-length encoded rules." << std::endl; }
    std::cout << std::endl;
  }
  this->has_grammar = true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x578, %rsp            # imm = 0x578
movl %edx, 0x74(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
movq %rax, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
leaq 0x300(%rsp), %rdi
movl $0x20, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x1b21c
leaq 0x290(%rsp), %rdi
movl $0x20, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x1b21c
movq (%rbx), %rax
movl 0x820(%rax), %eax
movl %eax, 0x8(%rsp)
leaq 0x118(%rsp), %r15
movq $0x0, 0x60(%rsp)
movl $0x0, 0xbc(%rsp)
movl $0x0, 0x70(%rsp)
movq $0x0, 0xb0(%rsp)
movl $0x0, 0xb8(%rsp)
movq %r14, 0x108(%rsp)
movq %r15, %rdi
callq 0x3310
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x32b0
movq %rax, %r13
movl $0xd, %edx
movq %rax, %rdi
leaq 0xbcae(%rip), %rsi      # 0x1ea33
callq 0x32b0
movl 0x60(%rsp), %r15d
movq %r13, %rdi
movq %r15, %rsi
callq 0x3180
movl $0x4, %edx
movq %rax, %rdi
leaq 0xbc98(%rip), %rsi      # 0x1ea41
callq 0x32b0
leaq 0x30(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x33c0
movq 0x30(%rsp), %rsi
leaq 0x370(%rsp), %rdi
movl $0x4, %edx
callq 0x3480
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x12df3
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x370(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x390(%rsp,%rax), %ebp
testb $0x5, %bpl
movl %ebp, 0x104(%rsp)
jne 0x13460
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x370(%rsp), %r14
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0x1bfef
movq %r14, %rdi
callq 0x3080
movq %r15, 0x110(%rsp)
movq 0x30(%rsp), %r13
cmpq 0x38(%rsp), %r13
je 0x13171
movl $0x0, 0x4(%rsp)
xorl %r14d, %r14d
movl $0x0, 0x88(%rsp)
xorl %ebp, %ebp
movl $0x0, 0x78(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x6c(%rsp)
xorl %r12d, %r12d
xorps %xmm0, %xmm0
movaps %xmm0, 0xe0(%rsp)
xorl %eax, %eax
movq %rax, 0xf0(%rsp)
movq %rax, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movq %r13, %rdi
leaq 0xe0(%rsp), %rsi
movl $0x2d, %edx
leaq 0xc0(%rsp), %rcx
callq 0x1278d
movl %ebp, 0x7c(%rsp)
movq 0xe0(%rsp), %rbp
movq 0xe8(%rsp), %rcx
cmpq %rcx, %rbp
je 0x12f66
xorl %eax, %eax
movl (%rbp), %edx
movq (%rbx), %rsi
movl 0x820(%rsi), %esi
cmpl %edx, %esi
jae 0x12f12
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r8
movl 0x4(%rdi), %edi
addl %esi, %edi
addl 0x4(%r8), %edi
cmpl %edx, %edi
jae 0x12f17
movb $0x1, %r12b
jmp 0x12f53
notl %esi
addl %esi, %edx
movl %edx, 0x80(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x84(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xdb56
incl 0x88(%rsp)
movb $0x1, %al
movq 0xe8(%rsp), %rcx
addq $0x4, %rbp
cmpq %rcx, %rbp
jne 0x12eed
xorb $0x1, %al
orb 0x6c(%rsp), %al
movl %eax, %ebp
jmp 0x12f69
movb $0x1, %bpl
movq 0xb0(%rsp), %rax
leal (%r14,%rax), %esi
leaq 0x300(%rsp), %rdi
callq 0x1b2e8
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
shrq $0x2, %rsi
leaq 0x290(%rsp), %rdi
callq 0x1b2e8
movl %ebp, 0x6c(%rsp)
movl $0x0, 0x80(%rsp)
movq 0xc0(%rsp), %rbp
movq 0xc8(%rsp), %rcx
cmpq %rcx, %rbp
je 0x130c6
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
xorl %eax, %eax
xorl %esi, %esi
movl (%rbp), %r8d
testl %r8d, %r8d
je 0x12fe3
movq (%rbx), %rdi
cmpl %r8d, 0x820(%rdi)
jae 0x12feb
movb $0x1, %r15b
jmp 0x13092
leal -0x1(%r8), %edi
movl %edi, 0xc(%rsp)
addl $0x2, %edx
cmpl %edx, %r8d
jne 0x13009
incl %eax
movl %eax, 0x80(%rsp)
jmp 0x1308a
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rcx
testl %eax, %eax
je 0x13045
cmpq %rcx, %rsi
je 0x13029
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13045
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xbe04
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rcx
cmpq %rcx, %rsi
je 0x1305b
movl 0xc(%rsp), %edi
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x1306e
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xbe04
movl 0xc(%rsp), %edi
movl $0x1, 0x80(%rsp)
incl 0x4(%rsp)
movl $0x1, %eax
movq 0xc8(%rsp), %rcx
incl %r14d
movb $0x1, %sil
movl %edi, %edx
addq $0x4, %rbp
cmpq %rcx, %rbp
jne 0x12fce
testb $0x1, %sil
je 0x130c6
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
movl 0x7c(%rsp), %ebp
je 0x1315d
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x1310c
movl 0x7c(%rsp), %ebp
movq (%rbx), %rax
movl 0x820(%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x130f0
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x130ff
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xfe24
incl %r14d
incl 0x4(%rsp)
movb $0x1, %al
movl %eax, 0x78(%rsp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x13129
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x13146
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
incl %ebp
incl 0x8(%rsp)
addq $0x20, %r13
cmpq 0x38(%rsp), %r13
jne 0x12e90
jmp 0x1319f
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xbe04
jmp 0x1310c
xorl %r12d, %r12d
movl $0x0, 0x6c(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x78(%rsp)
xorl %ebp, %ebp
movl $0x0, 0x88(%rsp)
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
cmpb $0x0, 0x74(%rsp)
je 0x13415
movl $0x5, %edx
movq 0x14e1a(%rip), %rdi     # 0x27fd0
leaq 0xb889(%rip), %rsi      # 0x1ea46
callq 0x32b0
movq 0x14e07(%rip), %rdi     # 0x27fd0
movq 0x110(%rsp), %rsi
callq 0x3180
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0xb02e(%rip), %rsi      # 0x1e216
callq 0x32b0
movl %ebp, %esi
movq %r13, %rdi
callq 0x3180
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
leaq 0xb843(%rip), %rsi      # 0x1ea4c
callq 0x32b0
movl 0x88(%rsp), %esi
movq %r13, %rdi
callq 0x3180
movq %rax, %r13
movl $0xe, %edx
movq %rax, %rdi
leaq 0xb826(%rip), %rsi      # 0x1ea55
callq 0x32b0
movl %r14d, %esi
movq %r13, %rdi
callq 0x3180
movq %rax, %r13
movl $0x11, %edx
movq %rax, %rdi
leaq 0xb813(%rip), %rsi      # 0x1ea64
callq 0x32b0
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0x3180
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
leaq 0xb802(%rip), %rsi      # 0x1ea76
callq 0x32b0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
testb $0x1, %r12b
je 0x132f1
movl $0x1d, %edx
movq 0x14d1d(%rip), %rdi     # 0x27fd0
leaq 0xb73a(%rip), %rsi      # 0x1e9f4
callq 0x32b0
movq 0x14d0a(%rip), %rcx     # 0x27fd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x14cec(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
testb $0x1, 0x6c(%rsp)
je 0x13342
movl $0x1f, %edx
movq 0x14ccc(%rip), %rdi     # 0x27fd0
leaq 0xb771(%rip), %rsi      # 0x1ea7c
callq 0x32b0
movq 0x14cb9(%rip), %rcx     # 0x27fd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x14c9b(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
testb $0x1, %r15b
je 0x13392
movl $0x20, %edx
movq 0x14c7c(%rip), %rdi     # 0x27fd0
leaq 0xb6b7(%rip), %rsi      # 0x1ea12
callq 0x32b0
movq 0x14c69(%rip), %rcx     # 0x27fd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x14c4b(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
testb $0x1, 0x78(%rsp)
je 0x133e3
movl $0x17, %edx
movq 0x14c2b(%rip), %rdi     # 0x27fd0
leaq 0xb6f0(%rip), %rsi      # 0x1ea9c
callq 0x32b0
movq 0x14c18(%rip), %rcx     # 0x27fd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x14bfa(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x14be6(%rip), %rcx     # 0x27fd0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x14bc8(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x60(%rsp), %rax
incl %eax
movq %rax, 0x60(%rsp)
addl %ebp, 0xbc(%rsp)
movl 0x88(%rsp), %eax
addl %eax, 0x70(%rsp)
addl 0xb0(%rsp), %r14d
movl 0x4(%rsp), %eax
addl %eax, 0xb8(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x14752
movq %r14, 0xb0(%rsp)
movq 0x108(%rsp), %r14
leaq 0x370(%rsp), %rdi
callq 0x3090
leaq 0x118(%rsp), %r15
movq %r15, %rdi
movq 0x14b49(%rip), %rsi     # 0x27fc8
callq 0x3140
leaq 0x188(%rsp), %rdi
callq 0x30d0
testb $0x5, 0x104(%rsp)
je 0x12d5c
leaq 0x370(%rsp), %rdi
callq 0x3310
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq 0x370(%rsp), %rdi
callq 0x32b0
movq %rax, %r14
leaq 0xb572(%rip), %rsi      # 0x1ea3c
movl $0x4, %edx
movq %rax, %rdi
callq 0x32b0
movq 0x60(%rsp), %rax
leal -0x1(%rax), %esi
movq %r14, %rdi
callq 0x3180
leaq 0x378(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x33c0
movzbl 0x74(%rsp), %ebp
leaq 0xe0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x128d6
movq 0x108(%rsp), %rcx
movl %eax, %r14d
cmpl $0x1, %eax
movq 0x60(%rsp), %rax
sbbl $-0x1, %eax
movq %rax, 0x60(%rsp)
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %rdi
callq 0x64a2
leaq 0xad3b(%rip), %rsi      # 0x1e29b
leaq 0xc0(%rsp), %rdi
callq 0x34a0
leaq 0xc0(%rsp), %rdi
leaq 0x90(%rsp), %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x128d6
movl %eax, 0x8(%rsp)
cmpl $0x1, 0x8(%rsp)
movq 0x60(%rsp), %rax
sbbl $-0x1, %eax
movq %rax, 0x60(%rsp)
movl 0xb0(%rsp), %eax
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
sarq $0x2, %r13
movq %rax, 0x88(%rsp)
cmpq %rax, %r13
movl %r14d, 0x4(%rsp)
jbe 0x137a1
movb $0x0, 0x4a(%rbx)
movl $0x48, %edi
callq 0x3260
movq %rax, %r13
leaq 0x300(%rsp), %rsi
movq %rax, %rdi
movq 0xb0(%rsp), %r14
movl %r14d, %edx
callq 0x1a958
movq %r13, 0x28(%rbx)
movq (%rbx), %rax
movl 0x820(%rax), %eax
bsrl %eax, %edx
xorl $-0x20, %edx
addl $0x21, %edx
testl %eax, %eax
cmovel %eax, %edx
leaq 0x118(%rsp), %rdi
movl %r14d, %esi
callq 0x17002
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdi
cmpq %rdi, %rsi
je 0x1378f
movq 0x118(%rsp), %r8
movq (%rbx), %r9
xorl %r10d, %r10d
xorl %eax, %eax
movl (%rsi), %r11d
testb $0x1, %al
je 0x136f6
cmpl $0x2, %r11d
jb 0x136ec
movl $0x1, %r11d
movq 0x118(%rsp), %r14
leal (%r10,%r11), %ebp
movl 0x124(%rsp), %ecx
movl 0x134(%rsp), %edx
movl %ecx, %eax
subl %edx, %eax
jae 0x13681
movl %ecx, %eax
jmp 0x136b5
movl %ebp, %r15d
movl %eax, %ecx
shrl %cl, %r15d
negb %dl
movl %edx, %ecx
shll %cl, %r15d
shrl %cl, %r15d
movl 0x130(%rsp), %ecx
orl %r15d, (%r14,%rcx,4)
incl 0x130(%rsp)
movl $0x20, 0x134(%rsp)
movl $0x20, %edx
testl %eax, %eax
je 0x136d9
subl %eax, %edx
movl %edx, 0x134(%rsp)
negb %al
movl %eax, %ecx
shll %cl, %ebp
shrl %cl, %ebp
movl %edx, %ecx
shll %cl, %ebp
movl 0x130(%rsp), %eax
orl %ebp, (%r14,%rax,4)
incl 0x138(%rsp)
incl %r11d
cmpl (%rsi), %r11d
jb 0x13665
xorl %eax, %eax
movl %r10d, %r11d
jmp 0x1377f
movl 0x124(%rsp), %ecx
movl 0x134(%rsp), %edx
movl %ecx, %eax
subl %edx, %eax
jae 0x1370e
movl %ecx, %eax
jmp 0x13742
movl %r11d, %r10d
movl %eax, %ecx
shrl %cl, %r10d
negb %dl
movl %edx, %ecx
shll %cl, %r10d
shrl %cl, %r10d
movl 0x130(%rsp), %ecx
orl %r10d, (%r8,%rcx,4)
incl 0x130(%rsp)
movl $0x20, 0x134(%rsp)
movl $0x20, %edx
testl %eax, %eax
je 0x1376c
subl %eax, %edx
movl %edx, 0x134(%rsp)
negb %al
movl %r11d, %r10d
movl %eax, %ecx
shll %cl, %r10d
shrl %cl, %r10d
movl %edx, %ecx
shll %cl, %r10d
movl 0x130(%rsp), %eax
orl %r10d, (%r8,%rax,4)
incl 0x138(%rsp)
movl (%rsi), %eax
cmpl 0x820(%r9), %eax
setne %al
addq $0x4, %rsi
movl %r11d, %r10d
cmpq %rdi, %rsi
jne 0x13642
leaq 0x118(%rsp), %rdi
callq 0x170c6
jmp 0x138ad
movb $0x1, 0x4a(%rbx)
movl $0x48, %edi
callq 0x3260
movq %rax, %r12
leaq 0x290(%rsp), %rsi
movq %rax, %rdi
movl %r13d, %edx
callq 0x1a958
movq %r12, 0x28(%rbx)
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
shrq $0x2, %rsi
movq (%rbx), %rax
movl 0x820(%rax), %eax
bsrl %eax, %edx
xorl $-0x20, %edx
addl $0x21, %edx
testl %eax, %eax
cmovel %eax, %edx
leaq 0x118(%rsp), %rdi
callq 0x17002
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdi
cmpq %rdi, %rsi
je 0x138a0
movq 0x118(%rsp), %r8
movl (%rsi), %r9d
movl 0x124(%rsp), %ecx
movl 0x134(%rsp), %edx
movl %ecx, %eax
subl %edx, %eax
jae 0x13831
movl %ecx, %eax
jmp 0x13865
movl %r9d, %r10d
movl %eax, %ecx
shrl %cl, %r10d
negb %dl
movl %edx, %ecx
shll %cl, %r10d
shrl %cl, %r10d
movl 0x130(%rsp), %ecx
orl %r10d, (%r8,%rcx,4)
incl 0x130(%rsp)
movl $0x20, 0x134(%rsp)
movl $0x20, %edx
testl %eax, %eax
je 0x1388c
subl %eax, %edx
movl %edx, 0x134(%rsp)
negb %al
movl %eax, %ecx
shll %cl, %r9d
shrl %cl, %r9d
movl %edx, %ecx
shll %cl, %r9d
movl 0x130(%rsp), %eax
orl %r9d, (%r8,%rax,4)
incl 0x138(%rsp)
addq $0x4, %rsi
cmpq %rdi, %rsi
jne 0x13816
leaq 0x118(%rsp), %rdi
callq 0x170c6
movq %rax, 0x30(%rbx)
leaq 0x118(%rsp), %rdi
callq 0x170b2
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0xdad9
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %rax
movq %rax, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rcx, %rax
je 0x13925
xorl %edi, %edi
movl $0x1, %esi
movl %edx, %r8d
movl -0x8(%rcx,%rsi,8), %r9d
leal (%r8,%r9), %r12d
subl %edi, %r12d
cmpl %r9d, %edi
cmovael %r8d, %r12d
incl %r9d
movl %esi, %r10d
incq %rsi
movl %r9d, %edi
movl %r12d, %r8d
cmpq %r10, %rdx
ja 0x138fc
jmp 0x13928
movl %edx, %r12d
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdx
movl -0x8(%rax), %ebp
addl 0x4(%rcx), %r12d
addl 0x4(%rdx), %r12d
leaq 0x118(%rsp), %rdi
movl $0x20, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x1b21c
notl %ebp
addl %ebp, %r12d
movq (%rbx), %rax
movq 0x28(%rbx), %rcx
movl 0x4(%rcx), %ecx
addl 0x820(%rax), %ecx
bsrl %ecx, %edx
xorl $-0x20, %edx
addl $0x21, %edx
testl %ecx, %ecx
cmovel %ecx, %edx
leaq 0x30(%rsp), %rdi
movl %r12d, %esi
callq 0x17002
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rax
cmpq %rsi, %rax
je 0x13afe
xorl %r15d, %r15d
leaq 0x118(%rsp), %rbp
xorl %r14d, %r14d
xorl %r13d, %r13d
movl (%rsi,%r15,8), %eax
cmpl %eax, %r14d
jae 0x13a4a
movq %rbp, %rdi
movl %r13d, %esi
callq 0x1b2e8
movq (%rbx), %rax
movq 0x28(%rbx), %rcx
movl 0x4(%rcx), %esi
addl 0x820(%rax), %esi
movl 0x3c(%rsp), %ecx
movl 0x4c(%rsp), %edx
movl %ecx, %eax
subl %edx, %eax
jae 0x139e6
movl %ecx, %eax
jmp 0x13a11
movl %esi, %edi
movl %eax, %ecx
shrl %cl, %edi
negb %dl
movl %edx, %ecx
shll %cl, %edi
shrl %cl, %edi
movq 0x30(%rsp), %rcx
movl 0x48(%rsp), %edx
orl %edi, (%rcx,%rdx,4)
incl 0x48(%rsp)
movl $0x20, 0x4c(%rsp)
movl $0x20, %edx
testl %eax, %eax
je 0x13a33
subl %eax, %edx
movl %edx, 0x4c(%rsp)
negb %al
movl %eax, %ecx
shll %cl, %esi
shrl %cl, %esi
movl %edx, %ecx
shll %cl, %esi
movq 0x30(%rsp), %rax
movl 0x48(%rsp), %ecx
orl %esi, (%rax,%rcx,4)
incl 0x50(%rsp)
incl %r13d
incl %r14d
movq 0x90(%rsp), %rsi
jmp 0x139ac
testl %r15d, %r15d
je 0x13a58
leal -0x1(%r15), %ecx
cmpl (%rsi,%rcx,8), %eax
je 0x13a6e
movq %rbp, %rdi
movl %r13d, %esi
callq 0x1b2e8
incl %r14d
movq 0x90(%rsp), %rsi
movl 0x4(%rsi,%r15,8), %edi
movl 0x3c(%rsp), %ecx
movl 0x4c(%rsp), %edx
movl %ecx, %eax
subl %edx, %eax
jae 0x13a85
movl %ecx, %eax
jmp 0x13ab5
movl %edi, %r8d
movl %eax, %ecx
shrl %cl, %r8d
negb %dl
movl %edx, %ecx
shll %cl, %r8d
shrl %cl, %r8d
movq 0x30(%rsp), %rcx
movl 0x48(%rsp), %edx
orl %r8d, (%rcx,%rdx,4)
incl 0x48(%rsp)
movl $0x20, 0x4c(%rsp)
movl $0x20, %edx
testl %eax, %eax
je 0x13ad7
subl %eax, %edx
movl %edx, 0x4c(%rsp)
negb %al
movl %eax, %ecx
shll %cl, %edi
shrl %cl, %edi
movl %edx, %ecx
shll %cl, %edi
movq 0x30(%rsp), %rax
movl 0x48(%rsp), %ecx
orl %edi, (%rax,%rcx,4)
incl 0x50(%rsp)
incl %r13d
incl %r15d
movq 0x98(%rsp), %rax
movq %rax, %rcx
subq %rsi, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x139ac
jmp 0x13b01
xorl %r13d, %r13d
movl -0x8(%rax), %r14d
incl %r14d
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movl 0x4(%rcx), %ecx
addl 0x4(%rax), %ecx
cmpl %ecx, %r14d
jae 0x13bc2
leaq 0x118(%rsp), %rbp
movq %rbp, %rdi
movl %r13d, %esi
callq 0x1b2e8
movq (%rbx), %rax
movq 0x28(%rbx), %rcx
movl 0x4(%rcx), %esi
addl 0x820(%rax), %esi
movl 0x3c(%rsp), %ecx
movl 0x4c(%rsp), %edx
movl %ecx, %eax
subl %edx, %eax
jae 0x13b54
movl %ecx, %eax
jmp 0x13b7f
movl %esi, %edi
movl %eax, %ecx
shrl %cl, %edi
negb %dl
movl %edx, %ecx
shll %cl, %edi
shrl %cl, %edi
movq 0x30(%rsp), %rcx
movl 0x48(%rsp), %edx
orl %edi, (%rcx,%rdx,4)
incl 0x48(%rsp)
movl $0x20, 0x4c(%rsp)
movl $0x20, %edx
testl %eax, %eax
je 0x13ba1
subl %eax, %edx
movl %edx, 0x4c(%rsp)
negb %al
movl %eax, %ecx
shll %cl, %esi
shrl %cl, %esi
movl %edx, %ecx
shll %cl, %esi
movq 0x30(%rsp), %rax
movl 0x48(%rsp), %ecx
orl %esi, (%rax,%rcx,4)
incl 0x50(%rsp)
incl %r13d
incl %r14d
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movl 0x4(%rcx), %ecx
addl 0x4(%rax), %ecx
cmpl %ecx, %r14d
jb 0x13b27
movl $0x48, %edi
callq 0x3260
movq %rax, %r13
leaq 0x118(%rsp), %rsi
movq %rax, %rdi
movl %r12d, %edx
callq 0x1a958
movq %r13, 0x38(%rbx)
leaq 0x30(%rsp), %rdi
callq 0x170c6
movq %rax, 0x40(%rbx)
cmpb $0x0, 0x74(%rsp)
je 0x13db2
movl 0x60(%rsp), %esi
movq 0x143c6(%rip), %r13     # 0x27fd0
movq %r13, %rdi
callq 0x3180
movq %rax, %rbp
leaq 0xae98(%rip), %rsi      # 0x1eab4
movl $0x8, %edx
movq %rax, %rdi
callq 0x32b0
movl 0xbc(%rsp), %esi
movq %rbp, %rdi
callq 0x3180
movq %rax, %rbp
leaq 0xae0a(%rip), %rsi      # 0x1ea4c
movl $0x8, %edx
movq %rax, %rdi
callq 0x32b0
movl 0x70(%rsp), %esi
movq %rbp, %rdi
callq 0x3180
movq %rax, %rbp
leaq 0xadf0(%rip), %rsi      # 0x1ea55
movl $0xe, %edx
movq %rax, %rdi
callq 0x32b0
movq %rbp, %rdi
movq 0x88(%rsp), %rsi
callq 0x3180
movq %rax, %r15
leaq 0xadd8(%rip), %rsi      # 0x1ea64
movl $0x11, %edx
movq %rax, %rdi
callq 0x32b0
movl 0xb8(%rsp), %esi
movq %r15, %rdi
callq 0x3180
movq %rax, %r15
leaq 0xae0b(%rip), %rsi      # 0x1eabd
movl $0x7, %edx
movq %rax, %rdi
callq 0x32b0
movl 0x8(%rsp), %eax
addl 0x4(%rsp), %eax
movl %eax, %ebp
movl %eax, %esi
movq %r15, %rdi
callq 0x3180
movq %rax, %r15
leaq 0xade8(%rip), %rsi      # 0x1eac5
movl $0xd, %edx
movq %rax, %rdi
callq 0x32b0
addl 0x70(%rsp), %ebp
subl %ebp, %r12d
movq %r15, %rdi
movq %r12, %rsi
callq 0x3180
movq %rax, %r14
leaq 0xadcd(%rip), %rsi      # 0x1ead3
movl $0x10, %edx
movq %rax, %rdi
callq 0x32b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
cmpb $0x1, 0x4a(%rbx)
jne 0x13d86
movq 0x14289(%rip), %r14     # 0x27fd0
leaq 0xad96(%rip), %rsi      # 0x1eae4
movl $0x1f, %edx
movq %r14, %rdi
callq 0x32b0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x14257(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x1422b(%rip), %rdi     # 0x27fd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
movb $0x1, 0x49(%rbx)
leaq 0x30(%rsp), %rdi
callq 0x170b2
leaq 0x118(%rsp), %rdi
callq 0x1b224
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x13df2
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13e13
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x141ae(%rip), %rsi     # 0x27fc8
leaq 0x370(%rsp), %rdi
callq 0x3140
leaq 0x3e0(%rsp), %rdi
callq 0x30d0
leaq 0x290(%rsp), %rdi
callq 0x1b224
leaq 0x300(%rsp), %rdi
callq 0x1b224
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13e65
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x13e82
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
addq $0x578, %rsp            # imm = 0x578
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13e96
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x170b2
jmp 0x13f90
jmp 0x13f10
jmp 0x13f10
movq %rax, %rbx
movl $0x48, %esi
movq %r12, %rdi
jmp 0x13ec7
movq %rax, %rbx
movl $0x48, %esi
movq %r13, %rdi
callq 0x3270
jmp 0x13f90
movq %rax, %rbx
movl $0x48, %esi
movq %r13, %rdi
callq 0x3270
jmp 0x13f79
movq %rax, %rbx
jmp 0x13f83
jmp 0x13f10
jmp 0x13f10
jmp 0x13ef4
movq %rax, %rbx
jmp 0x13fb5
jmp 0x13f15
jmp 0x13f2a
movq %rax, %rbx
jmp 0x1407a
movq %rax, %rbx
jmp 0x1409e
movq %rax, %rbx
jmp 0x13f90
movq %rax, %rbx
jmp 0x13fd6
jmp 0x13f76
jmp 0x13f76
jmp 0x13f76
jmp 0x13f69
jmp 0x13ff8
movq %rax, %rbx
jmp 0x1406d
jmp 0x13f61
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x1404c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x1404c
jmp 0x13ff8
movq %rax, %rbx
jmp 0x1404c
movq %rax, %rbx
jmp 0x14035
jmp 0x13ff8
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x170b2
leaq 0x118(%rsp), %rdi
callq 0x1b224
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x13fb5
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13fd6
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x13feb(%rip), %rsi     # 0x27fc8
leaq 0x370(%rsp), %rdi
callq 0x3140
leaq 0x3e0(%rsp), %rdi
jmp 0x14068
jmp 0x13ff8
jmp 0x13ff8
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x14018
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x14035
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x30(%rsp), %rdi
callq 0x14752
leaq 0x370(%rsp), %rdi
callq 0x3090
movq 0x13f75(%rip), %rsi     # 0x27fc8
leaq 0x118(%rsp), %rdi
callq 0x3140
leaq 0x188(%rsp), %rdi
callq 0x30d0
leaq 0x290(%rsp), %rdi
callq 0x1b224
leaq 0x300(%rsp), %rdi
callq 0x1b224
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1409e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x140bb
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x3460
nop