// File: /workspace/github_cpp_makefile_star2_O2/AlgoLab[P]bwt-lcp-parallel/bwt_lcp.cpp
// Function: compute_partial_BWT(unsigned char, unsigned int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
void compute_partial_BWT(
    const strlen_t k, const strnum_t m,
    const fnames_t& S_tpl,
    const fnames_t& B_tpl
) {
  const fnames_t N_tpl[] = {
    template_generator("supportfile-N0_%d.tmp", 0, ALPHSIZE),
    template_generator("supportfile-N1_%d.tmp", 0, ALPHSIZE),
  };
  { // B0 (and N0)
    copy_file(S_tpl[0], B_tpl[0]);
    multi_strnum_writer_t N0(N_tpl[0]);
    for (strnum_t i = 0; i < m; ++i) {
      N0.write(0, i);
    }
  }
  { // B1...Bk
    for (strlen_t l = 1; l <= k; ++l) {
      {
        enc_fasta_reader_t Bl1(B_tpl[l-1]);
        multi_strnum_reader_t Nl1(N_tpl[(l + 1) % 2]);
        multi_strnum_writer_t Nl(N_tpl[l % 2]);
        for (strnum_t i = 0; i < m; ++i) {
          Nl.write(Bl1.read(), Nl1.read());
        }
      }
      {
        enc_fasta_rnd_reader_t Sl(S_tpl[l], m);
        multi_strnum_reader_t Nl(N_tpl[l % 2]);
        enc_fasta_writer_t Bl(B_tpl[l]);
        for (strnum_t i = 0; i < m; ++i) {
          const strnum_t Nli = Nl.read();
          const enc_nucl_t SlNli = Sl.read(Nli);
          Bl.write(SlNli);
        }
      }
    }
  }
  // Cleaning
  remove_files(N_tpl[0]);
  remove_files(N_tpl[1]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
movl %esi, 0x4(%rsp)
movl %edi, 0x14(%rsp)
leaq 0x692b(%rip), %rsi      # 0x9020
leaq 0xb0(%rsp), %rbx
leaq 0x98(%rsp), %rdx
movq %rbx, %rdi
callq 0x4ad4
leaq 0x30(%rsp), %r14
pushq $0x6
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x256c
leaq 0x48(%rsp), %r15
leaq 0x6908(%rip), %rsi      # 0x9036
leaq 0x60(%rsp), %rdi
leaq 0x2(%rsp), %rdx
callq 0x4ad4
leaq 0x60(%rsp), %rsi
pushq $0x6
popq %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x256c
leaq 0x60(%rsp), %rdi
callq 0x20d0
leaq 0xb0(%rsp), %rdi
callq 0x20d0
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rsi
callq 0x25e8
leaq 0x68ca(%rip), %rdx      # 0x904c
leaq 0xb0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x4b10
xorl %ebx, %ebx
cmpl %ebx, 0x4(%rsp)
je 0x27af
movq 0xd0(%rsp), %rdi
movl %ebx, %esi
callq 0x662c
incl %ebx
jmp 0x2796
leaq 0xb0(%rsp), %r13
movq %r13, %rdi
callq 0x4b5e
movl 0x4(%rsp), %eax
movq %rax, 0x20(%rsp)
movb $0x1, %cl
leaq 0x687e(%rip), %rbp      # 0x904f
leaq 0x98(%rsp), %r12
leaq 0x2(%rsp), %r14
cmpb 0x14(%rsp), %cl
ja 0x295e
movq 0x8(%rsp), %rax
movq (%rax), %rax
movzbl %cl, %r15d
movl %ecx, %ebx
movl %r15d, %ecx
shll $0x5, %ecx
leaq (%rax,%rcx), %rsi
addq $-0x20, %rsi
movq %r12, %rdi
movq %rbp, %rdx
callq 0x4b74
movb %bl, 0x3(%rsp)
andb $0x1, %bl
movl %ebx, %eax
xorb $0x1, %al
movzbl %al, %eax
imulq $0x18, %rax, %rax
leaq (%rsp,%rax), %rsi
addq $0x30, %rsi
movq %r13, %rdi
movq %rbp, %rdx
callq 0x4bb8
movzbl %bl, %eax
imulq $0x18, %rax, %rax
leaq (%rsp,%rax), %rsi
addq $0x30, %rsi
leaq 0x60(%rsp), %rdi
movq %rsi, 0x28(%rsp)
leaq 0x67f8(%rip), %rdx      # 0x904c
callq 0x4b10
movl 0x4(%rsp), %ebx
subl $0x1, %ebx
jb 0x288c
movq %r12, %rdi
callq 0x4c0c
movl %eax, %ebp
movq %r13, %rdi
callq 0x4c1a
movzbl %bpl, %edi
shll $0x3, %edi
addq 0x80(%rsp), %rdi
movl %eax, %esi
callq 0x662c
jmp 0x285d
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x4b5e
movq %r13, %rdi
callq 0x4c30
movq %r12, %rdi
callq 0x54b0
movl %r15d, %esi
shll $0x5, %esi
movq 0x18(%rsp), %rax
addq (%rax), %rsi
movq %rbx, %rdi
movq 0x20(%rsp), %rdx
callq 0x4c46
movq %r13, %rdi
movq 0x28(%rsp), %rsi
leaq 0x677c(%rip), %rdx      # 0x904f
callq 0x4bb8
shll $0x5, %r15d
movq 0x8(%rsp), %rax
addq (%rax), %r15
movq %r12, %rdi
movq %r15, %rsi
leaq 0x675b(%rip), %rdx      # 0x904c
callq 0x4c8e
movl 0x4(%rsp), %ebx
subl $0x1, %ebx
jb 0x2932
movq %r13, %rdi
callq 0x4c1a
movl %eax, %ecx
shrl %ecx
movq 0x68(%rsp), %rdx
movb (%rdx,%rcx), %dl
notb %al
shlb $0x2, %al
andb $0x4, %al
movl %eax, %ecx
shrb %cl, %dl
andb $0xf, %dl
movb %dl, 0x2(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4ca2
jmp 0x28fa
movq %r12, %rdi
callq 0x4cd4
movq %r13, %rdi
callq 0x4c30
leaq 0x60(%rsp), %rdi
callq 0x4d14
movb 0x3(%rsp), %cl
incb %cl
leaq 0x66f6(%rip), %rbp      # 0x904f
jmp 0x27de
leaq 0x30(%rsp), %rdi
callq 0x269a
leaq 0x48(%rsp), %rdi
callq 0x269a
pushq $0x18
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x30, %rdi
callq 0x4ab2
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x2975
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29f9
jmp 0x29f9
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x20d0
jmp 0x29bc
movq %rax, %rbx
jmp 0x29bc
movq %rax, %rbx
movq %r14, %r15
leaq 0xb0(%rsp), %rdi
callq 0x20d0
cmpq %r15, %r14
je 0x2a87
leaq 0x30(%rsp), %r14
addq $-0x18, %r15
movq %r15, %rdi
callq 0x4ab2
cmpq %r14, %r15
jne 0x29d7
jmp 0x2a87
jmp 0x29f9
movq %rax, %rbx
jmp 0x2a39
movq %rax, %rbx
jmp 0x2a2c
movq %rax, %rbx
jmp 0x2a6c
movq %rax, %rbx
jmp 0x2a5f
movq %rax, %rbx
jmp 0x2a52
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x4b5e
jmp 0x2a6c
jmp 0x2a1c
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x4cd4
leaq 0xb0(%rsp), %rdi
callq 0x4c30
leaq 0x60(%rsp), %rdi
callq 0x4d14
jmp 0x2a6c
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x4b5e
leaq 0xb0(%rsp), %rdi
callq 0x4c30
leaq 0x98(%rsp), %rdi
callq 0x54b0
pushq $0x18
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x30, %rdi
callq 0x4ab2
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x2a70
movq %rbx, %rdi
callq 0x23d0