// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/apps/parasail_aligner.cpp
// Function: process(unsigned long&, std::set<std::pair<int, int>, std::less<std::pair<int, int>>, std::allocator<std::pair<int, int>>>&, quad const&, int const*, unsigned char const*, int const*, std::vector<int, std::allocator<int>> const&, char const&, int const&)
inline static void process(
        unsigned long &count_generated,
        PairSet &pairs,
        const quad &q,
        const int * const restrict SA,
        const unsigned char * const restrict BWT,
        const int * const restrict SID,
        const vector<int> &DB,
        const char &sentinal,
        const int &cutoff)
{
    const size_t n_children = q.children.size();
    size_t child_index = 0;

    if (q.lcp < cutoff) return;

    if (n_children) {
        for (int i=q.lb; i<=q.rb; ++i) {
            int j = i+1;
            if (child_index < n_children) {
                if (i >= q.children[child_index].lb) {
                    j = q.children[child_index].rb+1;
                    if (i >= q.children[child_index].rb) {
                        ++child_index;
                    }
                }
            }
            for (/*nope*/; j<=q.rb; ++j) {
                pair_check(count_generated, pairs, i, j, SA, BWT, SID, DB, sentinal);
            }
        }
    }
    else {
        for (int i=q.lb; i<=q.rb; ++i) {
            for (int j=i+1; j<=q.rb; ++j) {
                pair_check(count_generated, pairs, i, j, SA, BWT, SID, DB, sentinal);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x18(%rsp)
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
movq 0x70(%rsp), %rdi
movq 0x18(%rdx), %rcx
movq 0x10(%rdx), %rsi
movq %rcx, %rax
subq %rsi, %rax
pushq $0x28
popq %r8
cqto
idivq %r8
movq %rax, 0x20(%rsp)
movl (%r12), %eax
cmpl (%rdi), %eax
jge 0x2a4160
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq %rsi, %rcx
je 0x2a4206
movl 0x4(%r12), %ecx
movl 0x8(%r12), %eax
xorl %edi, %edi
movl %ecx, 0x4(%rsp)
cmpl %eax, %ecx
jg 0x2a4151
leal 0x1(%rcx), %ebx
movl %ebx, (%rsp)
cmpq 0x20(%rsp), %rdi
movl %ebx, 0x14(%rsp)
jae 0x2a41b4
movq 0x10(%r12), %rdx
imulq $0x28, %rdi, %rsi
cmpl 0x4(%rdx,%rsi), %ecx
jl 0x2a41b4
addq %rsi, %rdx
movl 0x8(%rdx), %edx
leal 0x1(%rdx), %ebx
movl %ebx, (%rsp)
xorl %esi, %esi
cmpl %edx, %ecx
setge %sil
addq %rsi, %rdi
movq %rdi, 0x8(%rsp)
cmpl %eax, %ebx
jg 0x2a41f8
subq $0x8, %rsp
movq %rbp, %rdi
movq %r13, %rsi
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r15, %r8
movq %r14, %r9
pushq 0x70(%rsp)
pushq 0x70(%rsp)
pushq 0x30(%rsp)
callq 0x2a581a
addq $0x20, %rsp
incl %ebx
movl %ebx, (%rsp)
movl 0x8(%r12), %eax
jmp 0x2a41b9
movl 0x14(%rsp), %ecx
movq 0x8(%rsp), %rdi
jmp 0x2a4175
movl 0x4(%r12), %ebx
movl 0x8(%r12), %eax
movl %ebx, 0x4(%rsp)
cmpl %eax, %ebx
jg 0x2a4151
movl %ebx, 0x8(%rsp)
movl %ebx, %ecx
leal 0x1(%rcx), %ebx
movl %ebx, (%rsp)
cmpl %eax, %ecx
jge 0x2a4262
subq $0x8, %rsp
movq %rbp, %rdi
movq %r13, %rsi
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r15, %r8
movq %r14, %r9
pushq 0x70(%rsp)
pushq 0x70(%rsp)
pushq 0x30(%rsp)
callq 0x2a581a
addq $0x20, %rsp
movl 0x8(%r12), %eax
jmp 0x2a4220
movl 0x8(%rsp), %ebx
incl %ebx
jmp 0x2a4210