// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movq %rcx, %r13
movq %rdx, 0x70(%rsp)
movl %esi, 0x10(%rsp)
movl %edi, 0x14(%rsp)
leaq 0x48(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x680a(%rip), %rsi      # 0x9020
leaq 0x6818(%rip), %rdx      # 0x9035
leaq 0x38(%rsp), %rdi
callq 0x6ed6
leaq 0xb0(%rsp), %r14
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
movl $0x6, %ecx
callq 0x268c
leaq 0xc8(%rsp), %r14
leaq 0x88(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x67d7(%rip), %rsi      # 0x9036
leaq 0x67e5(%rip), %rdx      # 0x904b
leaq 0x78(%rsp), %rdi
callq 0x6ed6
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
movl $0x6, %ecx
callq 0x268c
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x289e
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2260
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x28b5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2260
movq 0x70(%rsp), %rax
movq (%rax), %rdi
movq (%r13), %rsi
callq 0x270d
movl 0x10(%rsp), %r14d
leaq 0x677a(%rip), %rdx      # 0x904c
leaq 0x38(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x583e
testl %r14d, %r14d
je 0x2915
xorl %ebp, %ebp
leaq 0x78(%rsp), %rbx
movq 0x58(%rsp), %rax
movl %ebp, 0x78(%rsp)
movq (%rax), %rcx
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2070
incl %ebp
cmpl %ebp, %r14d
jne 0x28f0
leaq 0x58(%rsp), %rdi
callq 0x6a6e
leaq 0x38(%rsp), %rdi
callq 0x57a4
cmpb $0x0, 0x14(%rsp)
je 0x2bb4
movl %r14d, %eax
movq %rax, 0xe0(%rsp)
movb $0x1, %r15b
leaq 0x6706(%rip), %r12      # 0x904f
leaq 0x38(%rsp), %rbx
movq %r13, 0xe8(%rsp)
movq (%r13), %rax
movzbl %r15b, %r14d
movl %r14d, %ebp
shll $0x5, %ebp
leaq (%rax,%rbp), %rsi
addq $-0x20, %rsi
leaq 0x18(%rsp), %rdi
movq %r12, %rdx
callq 0x588e
movb %r15b, 0xf(%rsp)
andb $0x1, %r15b
movl %r15d, %eax
xorb $0x1, %al
movzbl %al, %eax
leaq (%rax,%rax,2), %rax
leaq (%rsp,%rax,8), %rsi
addq $0xb0, %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x58d8
movzbl %r15b, %eax
leaq (%rax,%rax,2), %rax
leaq (%rsp,%rax,8), %rsi
addq $0xb0, %rsi
leaq 0x78(%rsp), %rdi
movq %rsi, 0xf0(%rsp)
leaq 0x6681(%rip), %rdx      # 0x904c
callq 0x583e
movl 0x10(%rsp), %eax
movl %eax, %r15d
testl %eax, %eax
je 0x2a3b
movzbl 0x2d(%rsp), %r13d
leaq 0x18(%rsp), %rdi
callq 0x7356
movq %rbx, %rdi
callq 0x7448
movl 0x68(%rsp), %r12d
movq 0x60(%rsp), %rcx
movl $0x4, %esi
movl $0x1, %edx
leaq 0x68(%rsp), %rdi
callq 0x22e0
movq 0x98(%rsp), %rax
movl %r12d, 0x34(%rsp)
movq (%rax,%r13,8), %rcx
movl $0x4, %esi
movl $0x1, %edx
leaq 0x34(%rsp), %rdi
callq 0x2070
decl %r15d
jne 0x29db
leaq 0x98(%rsp), %rdi
callq 0x6a6e
leaq 0x78(%rsp), %rdi
callq 0x57a4
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2a61
callq 0x2240
movq %rbx, %rdi
callq 0x57a4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
movq 0xe8(%rsp), %r13
movl 0x10(%rsp), %r15d
leaq 0x68(%rsp), %r12
je 0x2a8a
callq 0x2240
movq 0x70(%rsp), %rax
addq (%rax), %rbp
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
movq 0xe0(%rsp), %rdx
callq 0x5948
movq %rbx, %rdi
movq 0xf0(%rsp), %rsi
leaq 0x6596(%rip), %rdx      # 0x904f
callq 0x58d8
movq (%r13), %rax
shll $0x5, %r14d
movq (%rax,%r14), %rdi
leaq 0x657b(%rip), %rsi      # 0x904c
callq 0x22a0
movq %rax, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movb $0x0, 0x24(%rsp)
movl %r15d, %r14d
testl %r15d, %r15d
movb 0xf(%rsp), %r15b
je 0x2b74
movq %rbx, %rdi
callq 0x7448
movl 0x68(%rsp), %ebp
movq 0x60(%rsp), %rcx
movl $0x4, %esi
movl $0x1, %edx
movq %r12, %rdi
callq 0x22e0
movl %ebp, %eax
shrl %eax
movq 0x80(%rsp), %rcx
movb (%rcx,%rax), %dl
notb %bpl
shlb $0x2, %bpl
andb $0x4, %bpl
movl %ebp, %ecx
shrb %cl, %dl
andb $0xf, %dl
movb 0x24(%rsp), %al
shlb $0x4, %al
orb %dl, %al
movb %al, 0x24(%rsp)
movl 0x20(%rsp), %ecx
incl %ecx
movl %ecx, 0x20(%rsp)
cmpl $0x2, %ecx
jne 0x2b6f
movzbl %al, %edi
movq 0x18(%rsp), %rsi
callq 0x20b0
movl $0x0, 0x20(%rsp)
movb $0x0, 0x24(%rsp)
decl %r14d
jne 0x2af5
leaq 0x18(%rsp), %rdi
callq 0x59d0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2b8d
callq 0x2240
movq %rbx, %rdi
callq 0x57a4
leaq 0x78(%rsp), %rdi
callq 0x5a14
incb %r15b
cmpb 0x14(%rsp), %r15b
leaq 0x64a1(%rip), %r12      # 0x904f
jbe 0x2956
movq 0xb0(%rsp), %rbx
movq 0xb8(%rsp), %r14
cmpq %r14, %rbx
je 0x2bd7
movq (%rbx), %rdi
callq 0x2400
addq $0x20, %rbx
jmp 0x2bc4
movq 0xc8(%rsp), %rbx
movq 0xd0(%rsp), %r14
cmpq %r14, %rbx
je 0x2bfa
movq (%rbx), %rdi
callq 0x2400
addq $0x20, %rbx
jmp 0x2be7
movl $0x18, %ebx
leaq (%rsp,%rbx), %rdi
addq $0xb0, %rdi
callq 0x57a4
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x2bff
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ca5
jmp 0x2ca5
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c53
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2260
jmp 0x2c53
jmp 0x2c50
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x2c77
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2260
jmp 0x2c77
movq %rax, %rbx
leaq 0xb0(%rsp), %r14
leaq 0xb0(%rsp), %r15
cmpq %r14, %r15
je 0x2d2a
addq $-0x18, %r14
movq %r14, %rdi
callq 0x57a4
cmpq %r15, %r14
jne 0x2c88
jmp 0x2d2a
jmp 0x2ca5
movq %rax, %rbx
jmp 0x2ccb
movq %rax, %rbx
jmp 0x2d0a
movq %rax, %rbx
jmp 0x2cfb
movq %rax, %rbx
jmp 0x2cf1
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x59d0
leaq 0x38(%rsp), %rdi
callq 0x592c
leaq 0x78(%rsp), %rdi
callq 0x5a14
jmp 0x2d0a
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x6a6e
leaq 0x78(%rsp), %rdi
callq 0x57a4
leaq 0x38(%rsp), %rdi
callq 0x592c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2d0a
callq 0x2240
movl $0x18, %r14d
leaq (%rsp,%r14), %rdi
addq $0xb0, %rdi
callq 0x57a4
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x2d10
movq %rbx, %rdi
callq 0x23d0