// File: AlgoLab[P]bwt-lcp-parallel/bwt_lcp.cpp
// Function: worker_Qp(std::atomic<unsigned long>&, unsigned char, unsigned int, std::vector<std::array<unsigned long, 6ul>, std::allocator<std::array<unsigned long, 6ul>>> 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&, 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 worker_Qp(std::atomic<luint_t>& shared_l,
               const strlen_t k, const strnum_t m,
               const occ_countv_t& occv,
               const fnames_t& B_tpl,
               const fnames_t& prevQ_tpl,
               const fnames_t& currQ_tpl
               ) {
  luint_t l;
  while ((l = shared_l.fetch_add(1)) <= k) {
    assert(l <= k);
    enc_fasta_reader_t Bl1(B_tpl[l]);
    plain_fasta_reader_t Ql1(prevQ_tpl[l-1]);
    create_empty_file<enc_nucl_t>(currQ_tpl[l], m);
    mmap_writer_t<enc_nucl_t, ALPHSIZE> Ql(currQ_tpl[l]);
    luint_t cumsum = 0;
    for (enc_nucl_t sigma = 0; sigma < ALPHSIZE; ++sigma) {
      Ql.seek(sigma, cumsum);
      cumsum += occv[l][sigma];
    }
    for (strnum_t i = 0; i < m; ++i) {
      const enc_nucl_t Ql1i = Ql1.read();
      const enc_nucl_t Bl1i = Bl1.read();
      Ql.write(Bl1i, Ql1i);
    }
    remove_file(prevQ_tpl[l-1]);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movb %sil, %al
movq 0x10(%rbp), %rsi
movq %rdi, -0x30(%rbp)
movb %al, -0x31(%rbp)
movl %edx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movq %r8, -0x48(%rbp)
movq %r9, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq $0x1, -0x10(%rbp)
movl $0x5, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x150(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movq %rcx, -0x20(%rbp)
decl %eax
movl %eax, %ecx
movq %rcx, -0x148(%rbp)
subl $0x4, %eax
ja 0x4b8c
movq -0x148(%rbp), %rax
leaq 0x14481(%rip), %rcx     # 0x19004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x150(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x4bf8
movq -0x150(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x4bf8
movq -0x150(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x4bf8
movq -0x150(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
jmp 0x4bf8
movq -0x150(%rbp), %rcx
movq -0x20(%rbp), %rax
lock
xaddq %rax, (%rcx)
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movzbl -0x31(%rbp), %ecx
cmpq %rcx, %rax
ja 0x4e61
movq -0x58(%rbp), %rax
movzbl -0x31(%rbp), %ecx
cmpq %rcx, %rax
ja 0x4c1c
jmp 0x4c3b
leaq 0x14427(%rip), %rdi     # 0x1904a
leaq 0x14427(%rip), %rsi     # 0x19051
movl $0x13a, %edx            # imm = 0x13A
leaq 0x14427(%rip), %rcx     # 0x1905d
callq 0x3180
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x8080
movq %rax, %rsi
leaq 0x143f5(%rip), %rdx     # 0x19047
movq %rdx, -0x158(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x8190
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
decq %rsi
callq 0x8080
movq -0x158(%rbp), %rdx
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
callq 0x96a0
jmp 0x4c87
movq 0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x8080
movq %rax, %rdi
movl -0x38(%rbp), %eax
movl %eax, %esi
callq 0x9750
jmp 0x4ca3
movq 0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x8080
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x128(%rbp), %rdi
callq 0x8ad0
jmp 0x4cc5
movq $0x0, -0x130(%rbp)
movb $0x0, -0x131(%rbp)
movzbl -0x131(%rbp), %eax
cmpl $0x6, %eax
jge 0x4d93
movzbl -0x131(%rbp), %esi
movq -0x130(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0x8ec0
jmp 0x4d03
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x88a0
movq %rax, %rdi
movzbl -0x131(%rbp), %eax
movl %eax, %esi
callq 0x88c0
movq (%rax), %rax
addq -0x130(%rbp), %rax
movq %rax, -0x130(%rbp)
movb -0x131(%rbp), %al
addb $0x1, %al
movb %al, -0x131(%rbp)
jmp 0x4cd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x4e56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x4e4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x9570
jmp 0x4e4d
movl $0x0, -0x138(%rbp)
movl -0x138(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x4e11
leaq -0x80(%rbp), %rdi
callq 0x97a0
movb %al, -0x159(%rbp)
jmp 0x4db9
movb -0x159(%rbp), %al
movb %al, -0x139(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x8300
movb %al, -0x15a(%rbp)
jmp 0x4dd6
movb -0x15a(%rbp), %al
movb %al, -0x13a(%rbp)
movzbl -0x13a(%rbp), %esi
movzbl -0x139(%rbp), %edx
leaq -0x128(%rbp), %rdi
callq 0x9230
jmp 0x4dfe
jmp 0x4e00
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
jmp 0x4d9d
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
subq $0x1, %rsi
callq 0x8080
movq %rax, %rdi
callq 0x3830
leaq -0x128(%rbp), %rdi
callq 0x9570
leaq -0x80(%rbp), %rdi
callq 0x97e0
leaq -0x70(%rbp), %rdi
callq 0x8390
jmp 0x4b38
leaq -0x80(%rbp), %rdi
callq 0x97e0
leaq -0x70(%rbp), %rdi
callq 0x8390
jmp 0x4e6a
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x3480
nopw %cs:(%rax,%rax)