// File: adamnovak[P]rlcsa/rlcsa.cpp
// Function: CSA::RLCSA::buildRLCSA(unsigned char*, unsigned int*, unsigned int, unsigned int, unsigned int, CSA::Sampler*, bool, bool)
void
RLCSA::buildRLCSA(uchar* data, usint* ranks, usint bytes, usint block_size, usint threads, Sampler* sampler, bool multiple_sequences, bool delete_data)
{
  threads = std::max(threads, (usint)1);
  #ifdef MULTITHREAD_SUPPORT
  omp_set_num_threads(threads);
  #endif


  // Do we store SA samples?
  bool sample_sa = true;
  if(this->sample_rate == 0)
  {
    sample_sa = false; this->sample_rate = 1;
  }


  // Determine the number of sequences and mark their end points.
  DeltaEncoder endings(RLCSA::ENDPOINT_BLOCK_SIZE);
  if(multiple_sequences)
  {
    this->number_of_sequences = 0;
    usint marker = 0;
    usint padding = 0, chars_encountered = 0;

    for(usint i = 0; i < bytes; i++)
    {
      if(data[i] == 0)
      {
        if(i == marker) { break; }  // Empty sequence.
        this->number_of_sequences++;
        marker = i + 1;
        usint pos = chars_encountered + padding - 1;
        endings.setBit(pos);
        padding = ((pos + this->sample_rate) / this->sample_rate) * this->sample_rate - chars_encountered;
      }
      else { chars_encountered++; }
    }

    if(this->number_of_sequences == 0 || marker != bytes)
    {
      std::cerr << "RLCSA: Collection must consist of 0-terminated nonempty sequences!" << std::endl;
      if(delete_data) { delete[] data; }
      return;
    }
    this->end_points = new DeltaVector(endings, chars_encountered + padding);
  }
  else
  {
    this->number_of_sequences = 1;
    DeltaEncoder endings(RLCSA::ENDPOINT_BLOCK_SIZE, RLCSA::ENDPOINT_BLOCK_SIZE);
    endings.setBit(bytes - 1);
    this->end_points = new DeltaVector(endings, bytes);
  }


  // Build character tables etc.
  usint distribution[CHARS];
  for(usint c = 0; c < CHARS; c++) { distribution[c] = 0; }
  for(usint i = 0; i < bytes; i++) { distribution[(usint)data[i]]++; }
  if(multiple_sequences) { distribution[0] = 0; } // \0 is an end marker
  this->alphabet = new Alphabet(distribution); this->data_size = this->alphabet->getDataSize();


  // Build suffix array.
  short_pair* sa = 0;
  if(multiple_sequences)
  {
    if(ranks == 0) { sa = simpleSuffixSort(data, bytes, this->number_of_sequences, threads); }
    else           { sa = simpleSuffixSort(ranks, bytes, threads); }
  }
  else
  {
    bytes++;
    sa = new short_pair[bytes];
    #pragma omp parallel for schedule(static)
    for(usint i = 0; i < bytes - 1; i++) { sa[i].second = data[i] + 1; }
    sa[bytes - 1].second = 0;
    simpleSuffixSort(sa, bytes, threads);
  }
  if(delete_data) { delete[] data; }


  // Sample SA.
  if(sample_sa)
  {
    if(sampler != 0) { this->sa_samples = new SASamples(sa, sampler, threads); }
    else             { this->sa_samples = new SASamples(sa, this->end_points, this->data_size, this->sample_rate, threads); }
    this->support_locate = this->sa_samples->supportsLocate();
    this->support_display = this->sa_samples->supportsDisplay();
  }


  // Build Psi.
  #pragma omp parallel for schedule(static)
  for(usint i = 0; i < bytes; i++) { sa[i].first = sa[(sa[i].first + 1) % bytes].second; }


  // Build RLCSA.
  #pragma omp parallel for schedule(dynamic, 1)
  for(usint c = 0; c < CHARS; c++)
  {
    if(!(this->alphabet->hasChar(c))) { this->array[c] = 0; continue; }

    short_pair* curr = sa + this->alphabet->cumulative(c) + this->number_of_sequences;
    short_pair* limit = curr + this->alphabet->countOf(c);
    PsiVector::Encoder encoder(block_size);
    pair_type run((*curr).first, 1); ++curr;

    for(; curr < limit; ++curr)
    {
      if((*curr).first == run.first + run.second) { run.second++; }
      else
      {
        encoder.addRun(run.first, run.second);
        run = pair_type((*curr).first, 1);
      }
    }
    encoder.addRun(run.first, run.second);
    encoder.flush();

    this->array[c] = new PsiVector(encoder, this->data_size + this->number_of_sequences);
  }
  delete[] sa;


  this->ok = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6f0, %rsp            # imm = 0x6F0
movl %ecx, -0x61c(%rbp)
movq %rdx, %rax
movl -0x61c(%rbp), %edx
movq %rax, -0x618(%rbp)
movq %rsi, %rax
movq -0x618(%rbp), %rsi
movq %rax, -0x610(%rbp)
movq %rdi, %r10
movq -0x610(%rbp), %rdi
movb 0x20(%rbp), %al
movb 0x18(%rbp), %cl
movq 0x10(%rbp), %r11
movq %r10, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
andb $0x1, %cl
movb %cl, -0x25(%rbp)
andb $0x1, %al
movb %al, -0x26(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x608(%rbp)
movl $0x1, -0x2c(%rbp)
leaq -0x24(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x6360
movq %rax, %rcx
movq -0x608(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0x24(%rbp)
movb $0x1, -0x2d(%rbp)
cmpl $0x0, 0x81c(%rax)
jne 0x7538
movq -0x608(%rbp), %rax
movb $0x0, -0x2d(%rbp)
movl $0x1, 0x81c(%rax)
leaq -0xa0(%rbp), %rdi
movl $0x10, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x206f0
testb $0x1, -0x25(%rbp)
je 0x777f
movq -0x608(%rbp), %rax
movl $0x0, 0x820(%rax)
movl $0x0, -0xa4(%rbp)
movl $0x0, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
movl $0x0, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x7687
movq -0x10(%rbp), %rax
movl -0xb0(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x7662
movl -0xb0(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jne 0x75ca
jmp 0x7687
movq -0x608(%rbp), %rax
movl 0x820(%rax), %ecx
incl %ecx
movl %ecx, 0x820(%rax)
movl -0xb0(%rbp), %eax
incl %eax
movl %eax, -0xa4(%rbp)
movl -0xac(%rbp), %edx
movl -0xa8(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0x1(%rax,%rcx), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %esi
leaq -0xa0(%rbp), %rdi
callq 0x20740
jmp 0x761b
movq -0x608(%rbp), %rcx
movl -0xb4(%rbp), %eax
addl 0x81c(%rcx), %eax
xorl %edx, %edx
divl 0x81c(%rcx)
imull 0x81c(%rcx), %eax
subl -0xac(%rbp), %eax
movl %eax, -0xa8(%rbp)
jmp 0x7671
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8034
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x7673
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x7591
movq -0x608(%rbp), %rax
cmpl $0x0, 0x820(%rax)
je 0x76a2
movl -0xa4(%rbp), %eax
cmpl -0x1c(%rbp), %eax
je 0x7707
movq 0x30947(%rip), %rdi     # 0x37ff0
leaq 0x21fed(%rip), %rsi     # 0x2969d
callq 0x32a0
movq %rax, -0x628(%rbp)
jmp 0x76be
movq -0x628(%rbp), %rdi
movq 0x308e4(%rip), %rsi     # 0x37fb0
callq 0x3300
jmp 0x76d3
testb $0x1, -0x26(%rbp)
je 0x76f8
movq -0x10(%rbp), %rax
movq %rax, -0x630(%rbp)
cmpq $0x0, %rax
je 0x76f6
movq -0x630(%rbp), %rdi
callq 0x33e0
jmp 0x76f8
movl $0x1, -0xc8(%rbp)
jmp 0x801f
movl $0x48, %edi
callq 0x32c0
movq %rax, -0x638(%rbp)
jmp 0x771a
movq -0x638(%rbp), %rdi
movl -0xac(%rbp), %edx
movl -0xa8(%rbp), %eax
addl %eax, %edx
leaq -0xa0(%rbp), %rsi
callq 0x20020
jmp 0x773d
movq -0x608(%rbp), %rax
movq -0x638(%rbp), %rcx
movq %rcx, 0x828(%rax)
jmp 0x784e
movq -0x638(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
movl $0x48, %esi
callq 0x32d0
jmp 0x8034
movq -0x608(%rbp), %rax
movl $0x1, 0x820(%rax)
leaq -0x138(%rbp), %rdi
movl $0x10, %edx
movl %edx, %esi
callq 0x206f0
jmp 0x77a5
movl -0x1c(%rbp), %esi
decl %esi
leaq -0x138(%rbp), %rdi
callq 0x20740
jmp 0x77b8
movl $0x48, %edi
callq 0x32c0
movq %rax, -0x640(%rbp)
jmp 0x77cb
movq -0x640(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq -0x138(%rbp), %rsi
callq 0x20020
jmp 0x77e3
movq -0x608(%rbp), %rax
movq -0x640(%rbp), %rcx
movq %rcx, 0x828(%rax)
leaq -0x138(%rbp), %rdi
callq 0x20720
jmp 0x784e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x783d
movq -0x640(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
movl $0x48, %esi
callq 0x32d0
leaq -0x138(%rbp), %rdi
callq 0x20720
jmp 0x8034
movl $0x0, -0x544(%rbp)
cmpl $0x100, -0x544(%rbp)    # imm = 0x100
jae 0x7886
movl -0x544(%rbp), %eax
movl $0x0, -0x540(%rbp,%rax,4)
movl -0x544(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x544(%rbp)
jmp 0x7858
movl $0x0, -0x548(%rbp)
movl -0x548(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x78cd
movq -0x10(%rbp), %rax
movl -0x548(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, %eax
movl -0x540(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x540(%rbp,%rax,4)
movl -0x548(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x548(%rbp)
jmp 0x7890
testb $0x1, -0x25(%rbp)
je 0x78dd
movl $0x0, -0x540(%rbp)
movl $0x1010, %edi           # imm = 0x1010
callq 0x32c0
movq %rax, -0x648(%rbp)
jmp 0x78f0
movq -0x648(%rbp), %rdi
leaq -0x540(%rbp), %rsi
callq 0x16dc0
jmp 0x7905
movq -0x608(%rbp), %rax
movq -0x648(%rbp), %rcx
movq %rcx, 0x808(%rax)
movq 0x808(%rax), %rdi
callq 0xd440
movl %eax, -0x64c(%rbp)
jmp 0x792e
movq -0x608(%rbp), %rax
movl -0x64c(%rbp), %ecx
movl %ecx, 0x4(%rax)
movq $0x0, -0x550(%rbp)
testb $0x1, -0x25(%rbp)
je 0x79e2
cmpq $0x0, -0x18(%rbp)
jne 0x79b7
movq -0x608(%rbp), %rax
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl 0x820(%rax), %edx
movl -0x24(%rbp), %ecx
callq 0x24470
movq %rax, -0x658(%rbp)
jmp 0x797f
movq -0x658(%rbp), %rax
movq %rax, -0x550(%rbp)
jmp 0x79dd
movq -0x648(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
movl $0x1010, %esi           # imm = 0x1010
callq 0x32d0
jmp 0x8034
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x240d0
movq %rax, -0x660(%rbp)
jmp 0x79cf
movq -0x660(%rbp), %rax
movq %rax, -0x550(%rbp)
jmp 0x7b24
movl -0x1c(%rbp), %eax
incl %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, %edi
movq %rdi, -0x678(%rbp)
shlq $0x3, %rdi
movq %rdi, -0x670(%rbp)
callq 0x3030
movq %rax, -0x668(%rbp)
jmp 0x7a0f
movq -0x678(%rbp), %rax
cmpq $0x0, %rax
je 0x7a75
movq -0x668(%rbp), %rax
movq -0x678(%rbp), %rdx
shlq $0x3, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x688(%rbp)
movq %rax, -0x680(%rbp)
movq -0x680(%rbp), %rdi
movq %rdi, -0x690(%rbp)
callq 0xe530
jmp 0x7a57
movq -0x688(%rbp), %rcx
movq -0x690(%rbp), %rax
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x680(%rbp)
jne 0x7a42
movq -0x668(%rbp), %rax
movq %rax, -0x550(%rbp)
movl $0x0, -0x554(%rbp)
movl -0x554(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x7afa
movq -0x10(%rbp), %rax
movl -0x554(%rbp), %ecx
movzbl (%rax,%rcx), %edx
addl $0x1, %edx
movq -0x550(%rbp), %rax
movl -0x554(%rbp), %ecx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x554(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x554(%rbp)
jmp 0x7a8d
movq -0x670(%rbp), %rsi
movq -0x668(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
callq 0x3590
jmp 0x8034
movq -0x550(%rbp), %rax
movl -0x1c(%rbp), %ecx
decl %ecx
movl $0x0, 0x4(%rax,%rcx,8)
movq -0x550(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x24340
jmp 0x7b22
jmp 0x7b24
testb $0x1, -0x26(%rbp)
je 0x7b49
movq -0x10(%rbp), %rax
movq %rax, -0x698(%rbp)
cmpq $0x0, %rax
je 0x7b47
movq -0x698(%rbp), %rdi
callq 0x33e0
jmp 0x7b49
testb $0x1, -0x2d(%rbp)
je 0x7ca9
cmpq $0x0, 0x10(%rbp)
je 0x7bcb
movl $0x30, %edi
callq 0x32c0
movq %rax, -0x6a0(%rbp)
jmp 0x7b6d
movq -0x6a0(%rbp), %rdi
movq -0x550(%rbp), %rsi
movq 0x10(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x13ca0
jmp 0x7b89
movq -0x608(%rbp), %rax
movq -0x6a0(%rbp), %rcx
movq %rcx, 0x810(%rax)
jmp 0x7c4e
movq -0x6a0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
movl $0x30, %esi
callq 0x32d0
jmp 0x8034
movl $0x30, %edi
callq 0x32c0
movq %rax, -0x6a8(%rbp)
jmp 0x7bde
movq -0x6a8(%rbp), %rdi
movq -0x608(%rbp), %rax
movq -0x550(%rbp), %rsi
movq 0x828(%rax), %rdx
movl 0x4(%rax), %ecx
movl 0x81c(%rax), %r8d
movl -0x24(%rbp), %r9d
callq 0x13800
jmp 0x7c0f
movq -0x608(%rbp), %rax
movq -0x6a8(%rbp), %rcx
movq %rcx, 0x810(%rax)
jmp 0x7c4e
movq -0x6a8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
movl $0x30, %esi
callq 0x32d0
jmp 0x8034
movq -0x608(%rbp), %rax
movq 0x810(%rax), %rdi
callq 0xd4c0
movb %al, -0x6a9(%rbp)
jmp 0x7c69
movq -0x608(%rbp), %rax
movb -0x6a9(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x818(%rax)
movq 0x810(%rax), %rdi
callq 0xd4e0
movb %al, -0x6aa(%rbp)
jmp 0x7c93
movq -0x608(%rbp), %rax
movb -0x6aa(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x819(%rax)
movl $0x0, -0x558(%rbp)
movl -0x558(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x7d12
movq -0x550(%rbp), %rax
movq %rax, -0x6b8(%rbp)
movq -0x550(%rbp), %rax
movl -0x558(%rbp), %ecx
movl (%rax,%rcx,8), %eax
addl $0x1, %eax
xorl %edx, %edx
divl -0x1c(%rbp)
movq -0x6b8(%rbp), %rax
movl %edx, %ecx
movl 0x4(%rax,%rcx,8), %edx
movq -0x550(%rbp), %rax
movl -0x558(%rbp), %ecx
movl %edx, (%rax,%rcx,8)
movl -0x558(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x558(%rbp)
jmp 0x7cb3
movl $0x0, -0x55c(%rbp)
cmpl $0x100, -0x55c(%rbp)    # imm = 0x100
jae 0x7feb
movq -0x608(%rbp), %rax
movq 0x808(%rax), %rdi
movl -0x55c(%rbp), %esi
callq 0xd460
movb %al, -0x6b9(%rbp)
jmp 0x7d4d
movb -0x6b9(%rbp), %al
testb $0x1, %al
jne 0x7d74
jmp 0x7d59
movq -0x608(%rbp), %rax
movl -0x55c(%rbp), %ecx
movq $0x0, 0x8(%rax,%rcx,8)
jmp 0x7fa6
movq -0x608(%rbp), %rax
movq -0x550(%rbp), %rcx
movq %rcx, -0x6c8(%rbp)
movq 0x808(%rax), %rdi
movl -0x55c(%rbp), %esi
callq 0xdc20
movl %eax, -0x6c0(%rbp)
jmp 0x7da3
movq -0x608(%rbp), %rax
movq -0x6c8(%rbp), %rcx
movl -0x6c0(%rbp), %edx
movl %edx, %edx
leaq (%rcx,%rdx,8), %rcx
movl 0x820(%rax), %edx
leaq (%rcx,%rdx,8), %rcx
movq %rcx, -0x568(%rbp)
movq -0x568(%rbp), %rcx
movq %rcx, -0x6d8(%rbp)
movq 0x808(%rax), %rdi
movl -0x55c(%rbp), %esi
callq 0xd520
movl %eax, -0x6cc(%rbp)
jmp 0x7df6
movq -0x6d8(%rbp), %rax
movl -0x6cc(%rbp), %ecx
movl %ecx, %ecx
leaq (%rax,%rcx,8), %rax
movq %rax, -0x570(%rbp)
movl -0x20(%rbp), %esi
leaq -0x5e8(%rbp), %rdi
movl $0x100000, %edx         # imm = 0x100000
callq 0x21340
jmp 0x7e26
movq -0x568(%rbp), %rsi
movl $0x1, -0x5f4(%rbp)
leaq -0x5f0(%rbp), %rdi
leaq -0x5f4(%rbp), %rdx
callq 0xe9d0
jmp 0x7e4c
movq -0x568(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rax
cmpq -0x570(%rbp), %rax
jae 0x7f1f
movq -0x568(%rbp), %rax
movl (%rax), %eax
movl -0x5f0(%rbp), %ecx
addl -0x5ec(%rbp), %ecx
cmpl %ecx, %eax
jne 0x7eb3
movl -0x5ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5ec(%rbp)
jmp 0x7f06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7fdd
movl -0x5f0(%rbp), %esi
movl -0x5ec(%rbp), %edx
leaq -0x5e8(%rbp), %rdi
callq 0x21590
jmp 0x7ecd
movq -0x568(%rbp), %rsi
movl $0x1, -0x600(%rbp)
leaq -0x5fc(%rbp), %rdi
leaq -0x600(%rbp), %rdx
callq 0xe9d0
jmp 0x7ef3
leaq -0x5f0(%rbp), %rdi
leaq -0x5fc(%rbp), %rsi
callq 0xdb70
jmp 0x7f08
movq -0x568(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x568(%rbp)
jmp 0x7e5e
movl -0x5f0(%rbp), %esi
movl -0x5ec(%rbp), %edx
leaq -0x5e8(%rbp), %rdi
callq 0x21590
jmp 0x7f39
leaq -0x5e8(%rbp), %rdi
callq 0x21630
jmp 0x7f47
movl $0x48, %edi
callq 0x32c0
movq %rax, -0x6e0(%rbp)
jmp 0x7f5a
movq -0x6e0(%rbp), %rdi
movq -0x608(%rbp), %rax
movl 0x4(%rax), %edx
movl 0x820(%rax), %eax
addl %eax, %edx
leaq -0x5e8(%rbp), %rsi
callq 0x20a10
jmp 0x7f81
movq -0x608(%rbp), %rax
movq -0x6e0(%rbp), %rdx
movl -0x55c(%rbp), %ecx
movq %rdx, 0x8(%rax,%rcx,8)
leaq -0x5e8(%rbp), %rdi
callq 0x21380
movl -0x55c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x55c(%rbp)
jmp 0x7d1c
movq -0x6e0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
movl $0x48, %esi
callq 0x32d0
leaq -0x5e8(%rbp), %rdi
callq 0x21380
jmp 0x8034
movq -0x550(%rbp), %rax
movq %rax, -0x6e8(%rbp)
cmpq $0x0, %rax
je 0x800b
movq -0x6e8(%rbp), %rdi
callq 0x33e0
movq -0x608(%rbp), %rax
movb $0x1, (%rax)
movl $0x0, -0xc8(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x20720
addq $0x6f0, %rsp            # imm = 0x6F0
popq %rbp
retq
leaq -0xa0(%rbp), %rdi
callq 0x20720
movq -0xc0(%rbp), %rdi
callq 0x3530
nopl (%rax)