// File: /workspace/github_cpp_makefile_star2_O2/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 $0x598, %rsp            # imm = 0x598
movl %edx, 0x24(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x320(%rsp), %rdi
pushq $0x20
popq %rsi
movl $0x100000, %edx         # imm = 0x100000
callq 0x14e98
leaq 0x2b0(%rsp), %rdi
pushq $0x20
popq %rsi
movl $0x100000, %edx         # imm = 0x100000
callq 0x14e98
movq (%rbx), %rax
movl 0x820(%rax), %eax
movl %eax, 0xc(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x140(%rsp), %r15
leaq 0x138(%rsp), %r12
leaq 0xa0(%rsp), %rbp
movl $0x0, 0x68(%rsp)
movl $0x0, 0x20(%rsp)
xorl %r13d, %r13d
movl $0x0, 0x64(%rsp)
movq %r14, 0x118(%rsp)
movq %r12, %rdi
callq 0x32e0
movq %r12, %rdi
movq %r14, %rsi
callq 0x3200
movq %rax, %rdi
leaq 0x8cd8(%rip), %rsi      # 0x189f3
callq 0x3210
movl 0x10(%rsp), %esi
movq %rax, %rdi
movq %rsi, 0x120(%rsp)
callq 0x3160
movq %rax, %rdi
leaq 0x8cc3(%rip), %rsi      # 0x18a01
callq 0x3210
movq %rbp, %rdi
movq %r15, %rsi
callq 0x33a0
movq 0xa0(%rsp), %rsi
leaq 0x390(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x3450
movq %rbp, %rdi
callq 0x34a8
movq 0x390(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x3b0(%rsp,%rax), %eax
movl %eax, 0x9c(%rsp)
testb $0x5, %al
jne 0x1019c
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
andq $0x0, 0xb0(%rsp)
leaq 0x390(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x15a4e
movq %r14, %rdi
callq 0x3080
movl $0x0, 0x90(%rsp)
movq 0xa0(%rsp), %rdi
movl $0x0, 0x2c(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x6c(%rsp)
movl $0x0, 0x28(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
movl $0x0, 0x38(%rsp)
movq %r13, 0x128(%rsp)
cmpq 0xa8(%rsp), %rdi
je 0x10010
xorps %xmm0, %xmm0
movaps %xmm0, 0xf0(%rsp)
andq $0x0, 0x100(%rsp)
movaps %xmm0, 0xd0(%rsp)
andq $0x0, 0xe0(%rsp)
movq %rdi, 0x130(%rsp)
leaq 0xf0(%rsp), %rsi
pushq $0x2d
popq %rdx
leaq 0xd0(%rsp), %rcx
callq 0xf8ff
movq 0xf0(%rsp), %r13
xorl %ebp, %ebp
cmpq 0xf8(%rsp), %r13
je 0xfebe
movl (%r13), %esi
movq %rbx, %rdi
callq 0x10e24
testb %al, %al
je 0xfeaf
movq (%rbx), %rax
movl 0x820(%rax), %eax
notl %eax
addl (%r13), %eax
movl %eax, 0x30(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xbbce
incl %r14d
movb $0x1, %bpl
jmp 0xfeb8
movb $0x1, %al
movl %eax, 0x90(%rsp)
addq $0x4, %r13
jmp 0xfe63
movq 0x128(%rsp), %r13
leal (%r12,%r13), %esi
leaq 0x320(%rsp), %rdi
callq 0x14f5a
movq 0x48(%rsp), %rsi
subq 0x40(%rsp), %rsi
shrq $0x2, %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x14f5a
xorb $0x1, %bpl
movl 0x2c(%rsp), %eax
orb %bpl, %al
movl %eax, 0x2c(%rsp)
incl 0x28(%rsp)
incl 0xc(%rsp)
andl $0x0, 0x30(%rsp)
xorl %eax, %eax
movq 0xd0(%rsp), %rbp
xorl %ecx, %ecx
pushq $-0x2
popq %rdx
cmpq 0xd8(%rsp), %rbp
je 0xff96
movl (%rbp), %edi
testl %edi, %edi
je 0xff39
movq (%rbx), %rsi
cmpl %edi, 0x820(%rsi)
jae 0xff3e
movb $0x1, %r15b
jmp 0xff90
leal -0x1(%rdi), %esi
movl %esi, 0x1c(%rsp)
addl $0x2, %edx
cmpl %edx, %edi
jne 0xff54
incl %eax
movl %eax, 0x30(%rsp)
jmp 0xff89
testl %eax, %eax
je 0xff67
leaq 0x40(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x9972
leaq 0x40(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x9972
movl $0x1, 0x30(%rsp)
incl 0x38(%rsp)
movl 0x1c(%rsp), %esi
pushq $0x1
popq %rax
incl %r12d
movb $0x1, %cl
movl %esi, %edx
addq $0x4, %rbp
jmp 0xff1d
testb $0x1, %cl
je 0xffb4
leaq 0x40(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x9972
leaq 0xa0(%rsp), %rbp
jmp 0xffe5
movq (%rbx), %rax
movl 0x820(%rax), %eax
movl %eax, 0x1c(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0xd908
leaq 0xa0(%rsp), %rbp
incl %r12d
incl 0x38(%rsp)
movb $0x1, %al
movl %eax, 0x6c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd8ea
leaq 0xf0(%rsp), %rdi
callq 0xd8ea
movq 0x130(%rsp), %rdi
addq $0x20, %rdi
jmp 0xfe06
cmpb $0x0, 0x24(%rsp)
je 0x10155
movq 0x13fae(%rip), %rdi     # 0x23fd0
leaq 0x89dd(%rip), %rsi      # 0x18a06
callq 0x3210
movq %rax, %rdi
movq 0x120(%rsp), %rsi
callq 0x3160
movq %rax, %rdi
leaq 0x81d3(%rip), %rsi      # 0x1821b
callq 0x3210
movl 0x28(%rsp), %esi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
leaq 0x89a9(%rip), %rsi      # 0x18a0c
callq 0x3210
movl %r14d, %esi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
leaq 0x8998(%rip), %rsi      # 0x18a15
callq 0x3210
movl %r12d, %esi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
leaq 0x898d(%rip), %rsi      # 0x18a24
callq 0x3210
movl 0x38(%rsp), %esi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
leaq 0x8984(%rip), %rsi      # 0x18a36
callq 0x3210
movq %rax, %rdi
callq 0x3100
testb $0x1, 0x90(%rsp)
je 0x100e4
movq 0x13f00(%rip), %rdi     # 0x23fd0
leaq 0x88dd(%rip), %rsi      # 0x189b4
callq 0x3210
movq %rax, %rdi
callq 0x3100
testb $0x1, 0x2c(%rsp)
je 0x10106
movq 0x13ede(%rip), %rdi     # 0x23fd0
leaq 0x8943(%rip), %rsi      # 0x18a3c
callq 0x3210
movq %rax, %rdi
callq 0x3100
testb $0x1, %r15b
je 0x10127
movq 0x13ebd(%rip), %rdi     # 0x23fd0
leaq 0x88b8(%rip), %rsi      # 0x189d2
callq 0x3210
movq %rax, %rdi
callq 0x3100
testb $0x1, 0x6c(%rsp)
je 0x10149
movq 0x13e9b(%rip), %rdi     # 0x23fd0
leaq 0x8920(%rip), %rsi      # 0x18a5c
callq 0x3210
movq %rax, %rdi
callq 0x3100
movq 0x13e80(%rip), %rdi     # 0x23fd0
callq 0x3100
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
movl 0x28(%rsp), %eax
addl %eax, 0x68(%rsp)
addl %r14d, 0x20(%rsp)
addl %r13d, %r12d
movl 0x38(%rsp), %eax
addl %eax, 0x64(%rsp)
movq %rbp, %rdi
callq 0x10e48
movl %r12d, %r13d
movq 0x118(%rsp), %r14
leaq 0x140(%rsp), %r15
leaq 0x138(%rsp), %r12
leaq 0x390(%rsp), %rdi
callq 0x30a0
movq %r12, %rdi
callq 0x3090
testb $0x5, 0x9c(%rsp)
je 0xfcfe
leaq 0x390(%rsp), %rdi
callq 0x32e0
leaq 0x390(%rsp), %rdi
movq %r14, %rsi
callq 0x3200
leaq 0x8819(%rip), %rsi      # 0x189fc
movq %rax, %rdi
callq 0x3210
movq 0x10(%rsp), %rcx
leal -0x1(%rcx), %esi
movq %rax, %rdi
callq 0x3160
leaq 0x398(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x33a0
movzbl 0x24(%rsp), %ebp
leaq 0xf0(%rsp), %rdi
leaq 0x70(%rsp), %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0xf9bc
movl %eax, %r15d
cmpl $0x1, %eax
movq 0x10(%rsp), %rax
sbbl $-0x1, %eax
movq %rax, 0x10(%rsp)
leaq 0x805a(%rip), %rdx      # 0x182a0
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x53ed
leaq 0xd0(%rsp), %rdi
leaq 0x70(%rsp), %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0xf9bc
movl %eax, 0xc(%rsp)
cmpl $0x1, 0xc(%rsp)
movq 0x10(%rsp), %rax
sbbl $-0x1, %eax
movq %rax, 0x10(%rsp)
movl %r13d, %eax
movq 0x48(%rsp), %r14
subq 0x40(%rsp), %r14
sarq $0x2, %r14
movq %rax, 0x38(%rsp)
cmpq %rax, %r14
jbe 0x10355
movb $0x0, 0x4a(%rbx)
pushq $0x48
popq %rdi
callq 0x3230
movq %rax, %r14
leaq 0x320(%rsp), %rsi
movq %rax, %rdi
movl %r13d, %edx
callq 0x14958
movq %r14, 0x28(%rbx)
movq (%rbx), %rax
movl 0x820(%rax), %edi
callq 0xbad4
leaq 0x138(%rsp), %rdi
movl %r13d, %esi
movl %eax, %edx
callq 0x12c3a
xorl %eax, %eax
movq 0x40(%rsp), %r13
leaq 0x138(%rsp), %r14
xorl %r12d, %r12d
cmpq 0x48(%rsp), %r13
je 0x103de
testb $0x1, %al
je 0x10329
movl %r15d, %ebp
pushq $0x1
popq %rax
movl %eax, %r15d
cmpl (%r13), %r15d
jae 0x1034a
leal (%r12,%r15), %esi
movq %r14, %rdi
callq 0xbae2
incl %r15d
jmp 0x10312
movl (%r13), %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0xbae2
movl (%r13), %eax
movq (%rbx), %rcx
cmpl 0x820(%rcx), %eax
setne %al
jmp 0x1034f
xorl %eax, %eax
movl %ebp, %r15d
addq $0x4, %r13
jmp 0x102fa
movb $0x1, 0x4a(%rbx)
pushq $0x48
popq %rdi
callq 0x3230
movq %rax, %r12
leaq 0x2b0(%rsp), %rsi
movq %rax, %rdi
movl %r14d, %edx
callq 0x14958
movq %r12, 0x28(%rbx)
movq 0x48(%rsp), %r14
subq 0x40(%rsp), %r14
shrq $0x2, %r14
movq (%rbx), %rax
movl 0x820(%rax), %edi
callq 0xbad4
leaq 0x138(%rsp), %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x12c3a
movq 0x40(%rsp), %r12
leaq 0x138(%rsp), %r14
cmpq 0x48(%rsp), %r12
je 0x103cf
movl (%r12), %esi
movq %r14, %rdi
callq 0xbae2
addq $0x4, %r12
jmp 0x103b6
leaq 0x138(%rsp), %rdi
callq 0x12cf6
jmp 0x103eb
leaq 0x138(%rsp), %rdi
callq 0x12cf6
movq %rax, 0x30(%rbx)
leaq 0x138(%rsp), %rdi
callq 0x12ce2
movq 0x70(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0xbd61
addl %r15d, 0xc(%rsp)
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %rax
movq %rax, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
xorl %edi, %edi
movl %edx, %r14d
xorl %esi, %esi
movl %edi, %edi
cmpq %rdi, %rdx
jbe 0x10450
movl (%rcx,%rdi,8), %r8d
cmpl %r8d, %esi
movl %r8d, %r9d
cmoval %esi, %r9d
addl %r9d, %r14d
subl %esi, %r14d
incl %r8d
incl %edi
movl %r8d, %esi
jmp 0x1042b
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rdx
movl -0x8(%rax), %ebp
addl 0x4(%rcx), %r14d
addl 0x4(%rdx), %r14d
leaq 0x138(%rsp), %rdi
pushq $0x20
popq %rsi
movl $0x100000, %edx         # imm = 0x100000
callq 0x14e98
notl %ebp
addl %ebp, %r14d
movq (%rbx), %rax
movq 0x28(%rbx), %rcx
movl 0x4(%rcx), %edi
addl 0x820(%rax), %edi
callq 0xbad4
leaq 0xa0(%rsp), %rdi
movq %r14, 0x90(%rsp)
movl %r14d, %esi
movl %eax, %edx
callq 0x12c3a
xorl %r12d, %r12d
leaq 0x138(%rsp), %r13
leaq 0xa0(%rsp), %r14
xorl %ebp, %ebp
xorl %r15d, %r15d
movl %ebp, %ebp
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbp, %rdx
jbe 0x1054d
movl (%rax,%rbp,8), %ecx
cmpl %ecx, %r15d
jae 0x10517
movq %r13, %rdi
movl %r12d, %esi
callq 0x14f5a
movq (%rbx), %rax
movq 0x28(%rbx), %rcx
movl 0x4(%rcx), %esi
addl 0x820(%rax), %esi
movq %r14, %rdi
callq 0xbae2
incl %r12d
incl %r15d
movq 0x70(%rsp), %rax
jmp 0x104df
testq %rbp, %rbp
je 0x10524
leal -0x1(%rbp), %edx
cmpl (%rax,%rdx,8), %ecx
je 0x10537
movq %r13, %rdi
movl %r12d, %esi
callq 0x14f5a
incl %r15d
movq 0x70(%rsp), %rax
movl 0x4(%rax,%rbp,8), %esi
movq %r14, %rdi
callq 0xbae2
incl %r12d
incl %ebp
jmp 0x104c4
movl -0x8(%rcx), %ebp
incl %ebp
leaq 0x138(%rsp), %r14
leaq 0xa0(%rsp), %r13
movq 0x90(%rsp), %r15
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movl 0x4(%rcx), %ecx
addl 0x4(%rax), %ecx
cmpl %ecx, %ebp
jae 0x105a6
movq %r14, %rdi
movl %r12d, %esi
callq 0x14f5a
movq (%rbx), %rax
movq 0x28(%rbx), %rcx
movl 0x4(%rcx), %esi
addl 0x820(%rax), %esi
movq %r13, %rdi
callq 0xbae2
incl %r12d
incl %ebp
jmp 0x1056a
pushq $0x48
popq %rdi
callq 0x3230
movq %rax, %r14
leaq 0x138(%rsp), %rsi
movq %rax, %rdi
movl %r15d, %edx
callq 0x14958
movq %r14, 0x38(%rbx)
leaq 0xa0(%rsp), %rdi
callq 0x12cf6
movq %rax, 0x40(%rbx)
cmpb $0x0, 0x24(%rsp)
je 0x106e5
movl 0x10(%rsp), %esi
movq 0x139e1(%rip), %rdi     # 0x23fd0
callq 0x3160
leaq 0x8479(%rip), %rsi      # 0x18a74
movq %rax, %rdi
callq 0x3210
movl 0x68(%rsp), %esi
movq %rax, %rdi
callq 0x3160
leaq 0x83f6(%rip), %rsi      # 0x18a0c
movq %rax, %rdi
callq 0x3210
movl 0x20(%rsp), %esi
movq %rax, %rdi
callq 0x3160
leaq 0x83e4(%rip), %rsi      # 0x18a15
movq %rax, %rdi
callq 0x3210
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x3160
leaq 0x83d7(%rip), %rsi      # 0x18a24
movq %rax, %rdi
callq 0x3210
movl 0x64(%rsp), %esi
movq %rax, %rdi
callq 0x3160
leaq 0x8415(%rip), %rsi      # 0x18a7d
movq %rax, %rdi
callq 0x3210
movl 0xc(%rsp), %esi
movq %rax, %rdi
callq 0x3160
leaq 0x8402(%rip), %rsi      # 0x18a85
movq %rax, %rdi
callq 0x3210
movl 0xc(%rsp), %ecx
addl 0x20(%rsp), %ecx
subl %ecx, %r15d
movq %rax, %rdi
movq %r15, %rsi
callq 0x3160
leaq 0x83eb(%rip), %rsi      # 0x18a93
movq %rax, %rdi
callq 0x3210
movq %rax, %rdi
callq 0x3100
cmpb $0x1, 0x4a(%rbx)
jne 0x106d9
movq 0x1390b(%rip), %rdi     # 0x23fd0
leaq 0x83d8(%rip), %rsi      # 0x18aa4
callq 0x3210
movq %rax, %rdi
callq 0x3100
movq 0x138f0(%rip), %rdi     # 0x23fd0
callq 0x3100
movb $0x1, 0x49(%rbx)
leaq 0xa0(%rsp), %rdi
callq 0x12ce2
leaq 0x138(%rsp), %rdi
callq 0x14ea0
leaq 0xd0(%rsp), %rdi
callq 0x34a8
leaq 0xf0(%rsp), %rdi
callq 0x34a8
leaq 0x390(%rsp), %rdi
callq 0x3090
leaq 0x2b0(%rsp), %rdi
callq 0x14ea0
leaq 0x320(%rsp), %rdi
callq 0x14ea0
leaq 0x40(%rsp), %rdi
callq 0xd8ea
leaq 0x70(%rsp), %rdi
callq 0xc2ac
addq $0x598, %rsp            # imm = 0x598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1081d
jmp 0x1081d
jmp 0x107d1
jmp 0x107d1
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %r12, %rdi
jmp 0x1078c
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x3240
jmp 0x10850
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x3240
jmp 0x10836
movq %rax, %rbx
jmp 0x10843
jmp 0x107d1
jmp 0x107b5
movq %rax, %rbx
jmp 0x1085d
jmp 0x107d6
jmp 0x107e6
movq %rax, %rbx
jmp 0x108c9
movq %rax, %rbx
jmp 0x108d6
movq %rax, %rbx
jmp 0x10850
movq %rax, %rbx
jmp 0x1086a
jmp 0x1081d
jmp 0x10833
jmp 0x1081d
jmp 0x10809
movq %rax, %rbx
jmp 0x108bc
jmp 0x10811
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x34a8
jmp 0x108af
jmp 0x10833
jmp 0x10833
movq %rax, %rbx
jmp 0x10895
movq %rax, %rbx
jmp 0x108af
jmp 0x10878
jmp 0x10878
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
callq 0x12ce2
jmp 0x10850
jmp 0x10878
jmp 0x10878
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x12ce2
leaq 0x138(%rsp), %rdi
callq 0x14ea0
leaq 0xd0(%rsp), %rdi
callq 0x34a8
leaq 0xf0(%rsp), %rdi
callq 0x34a8
leaq 0x390(%rsp), %rdi
jmp 0x108b7
jmp 0x10878
jmp 0x10878
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xd8ea
leaq 0xf0(%rsp), %rdi
callq 0xd8ea
leaq 0xa0(%rsp), %rdi
callq 0x10e48
leaq 0x390(%rsp), %rdi
callq 0x30a0
leaq 0x138(%rsp), %rdi
callq 0x3090
leaq 0x2b0(%rsp), %rdi
callq 0x14ea0
leaq 0x320(%rsp), %rdi
callq 0x14ea0
leaq 0x40(%rsp), %rdi
callq 0xd8ea
leaq 0x70(%rsp), %rdi
callq 0xc2ac
movq %rbx, %rdi
callq 0x3430