// File: /workspace/github_cpp_makefile_star2_O3/adamnovak[P]rlcsa/rlcsa.cpp
// Function: CSA::RLCSA::RLCSA(unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int, CSA::Sampler*, bool)
RLCSA::RLCSA(uchar* data, usint bytes, usint block_size, usint sa_sample_rate, usint threads, Sampler* sampler, bool delete_data) :
  ok(false),
  alphabet(0),
  sa_samples(0), support_locate(false), support_display(false),
  sample_rate(sa_sample_rate),
  end_points(0)
{
  for(usint c = 0; c < CHARS; c++) { this->array[c] = 0; }

  if(!data || bytes == 0)
  {
    std::cerr << "RLCSA: No input data given!" << std::endl;
    if(delete_data) { delete[] data; }
    return;
  }
  if(block_size < 2 * sizeof(usint) || block_size % sizeof(usint) != 0)
  {
    std::cerr << "RLCSA: Block size must be a multiple of " << sizeof(usint) << " bytes!" << std::endl;
    if(delete_data) { delete[] data; }
    return;
  }
  if(sampler != 0 && sampler->getStatus() != Sampler::SAMPLED)
  {
    std::cerr << "RLCSA: No samples given!" << std::endl;
    if(delete_data) { delete[] data; }
    return;
  }

  this->buildRLCSA(data, 0, bytes, block_size, threads, sampler, false, delete_data);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %ecx, %r14d
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r12
movb 0x48(%rsp), %r13b
movq 0x40(%rsp), %rbp
movb $0x0, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x808(%rdi)
movw $0x0, 0x818(%rdi)
movl %r8d, 0x81c(%rdi)
movq $0x0, 0x828(%rdi)
addq $0x8, %rdi
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x3150
testq %rbx, %rbx
setne %al
testl %r15d, %r15d
setne %cl
testb %cl, %al
jne 0x6507
testq %rbx, %rbx
sete %bpl
movq 0x19b3a(%rip), %r14     # 0x1fff0
leaq 0x11f07(%rip), %rsi     # 0x183c4
movl $0x1b, %edx
movq %r14, %rdi
callq 0x32b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
xorb $0x1, %r13b
orb %bpl, %r13b
je 0x6604
addq $0x8, %rsp
jmp 0x65ae
cmpl $0x8, %r14d
setae %al
testb $0x3, %r14b
sete %cl
testb %cl, %al
je 0x6549
testq %rbp, %rbp
je 0x6585
cmpl $0x2, 0xc(%rbp)
jne 0x65b9
subq $0x8, %rsp
movzbl %r13b, %eax
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl %r15d, %ecx
movl %r14d, %r8d
movl 0xc(%rsp), %r9d
pushq %rax
pushq $0x0
pushq %rbp
jmp 0x65a5
movq 0x19aa0(%rip), %r14     # 0x1fff0
leaq 0x11e89(%rip), %rsi     # 0x183e0
movl $0x28, %edx
movq %r14, %rdi
callq 0x32b0
movl $0x4, %esi
movq %r14, %rdi
callq 0x3180
movq %rax, %r14
leaq 0x11e8e(%rip), %rsi     # 0x18409
movl $0x7, %edx
movq %rax, %rdi
jmp 0x65cf
subq $0x8, %rsp
movzbl %r13b, %eax
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl %r15d, %ecx
movl %r14d, %r8d
movl 0xc(%rsp), %r9d
pushq %rax
pushq $0x0
pushq $0x0
callq 0x5cea
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x19a30(%rip), %r14     # 0x1fff0
leaq 0x11e4a(%rip), %rsi     # 0x18411
movl $0x18, %edx
movq %r14, %rdi
callq 0x32b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
testb %r13b, %r13b
je 0x64fe
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3300