// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %rsi, 0x20(%rsp)
movq %rdi, 0x28(%rsp)
movl (%rdx), %eax
cmpl 0x90(%rsp), %eax
jl 0x301436
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq 0x88(%rsp), %r10
movq 0x80(%rsp), %rbp
movq 0x18(%rdx), %rcx
movq 0x10(%rdx), %rdx
movslq 0x4(%r12), %r11
movl 0x8(%r12), %eax
cmpq %rdx, %rcx
movq %r9, 0x18(%rsp)
je 0x30135c
cmpl %eax, %r11d
jg 0x301436
subq %rdx, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rdx
movq %rdx, 0x38(%rsp)
xorl %edi, %edi
movq %r11, %r8
incq %r11
cmpq 0x38(%rsp), %rdi
jae 0x301253
movq 0x10(%r12), %rcx
leaq (%rdi,%rdi,4), %rdx
movslq 0x4(%rcx,%rdx,8), %rsi
cmpq %rsi, %r8
jge 0x301258
movl %r11d, %ecx
jmp 0x30126f
leaq (%rcx,%rdx,8), %rcx
movslq 0x8(%rcx), %rdx
leal 0x1(%rdx), %ecx
xorl %esi, %esi
cmpq %rdx, %r8
setge %sil
addq %rsi, %rdi
movq %rdi, 0x40(%rsp)
cmpl %eax, %ecx
movq %r8, 0x30(%rsp)
jle 0x301285
movslq %eax, %rcx
jmp 0x301347
movzbl (%r14,%r8), %r13d
movslq %ecx, %rbx
decq %rbx
movq %r11, 0x10(%rsp)
movq (%rbp), %rdx
movq 0x8(%rbp), %r8
cmpb 0x1(%r14,%rbx), %r13b
jne 0x3012b1
movsbl (%r10), %eax
cmpl %eax, %r13d
jne 0x301333
movslq 0x4(%r15,%rbx,4), %rcx
movq 0x30(%rsp), %rax
movslq (%r15,%rax,4), %rax
movslq (%r9,%rax,4), %rsi
movl %esi, %eax
movslq (%r9,%rcx,4), %rdi
movl %edi, %ecx
cmpq %r8, %rdx
je 0x3012f6
cmpl %ecx, %eax
je 0x301333
movl (%rdx,%rsi,4), %esi
cmpl (%rdx,%rdi,4), %esi
je 0x301333
movq 0x28(%rsp), %rdx
incq (%rdx)
cmpl %ecx, %eax
jg 0x301306
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, 0x8(%rsp)
jmp 0x301312
cmpl %ecx, %eax
je 0x301333
movq 0x28(%rsp), %rdx
incq (%rdx)
cmpl %edi, %esi
jge 0x3012e8
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3041f0
movq 0x18(%rsp), %r9
movq 0x88(%rsp), %r10
movq 0x10(%rsp), %r11
movl 0x8(%r12), %eax
movslq %eax, %rcx
incq %rbx
cmpq %rcx, %rbx
jl 0x301295
cmpq %rcx, 0x30(%rsp)
movq 0x40(%rsp), %rdi
jl 0x301233
jmp 0x301436
cmpl %eax, %r11d
jg 0x301436
movslq %eax, %rcx
cmpq %rcx, %r11
jge 0x301426
movzbl (%r14,%r11), %ebx
movq %r11, %r13
movq %r11, 0x10(%rsp)
movq (%rbp), %rdx
movq 0x8(%rbp), %r8
cmpb 0x1(%r14,%r13), %bl
jne 0x301395
movsbl (%r10), %eax
cmpl %eax, %ebx
jne 0x301412
movslq 0x4(%r15,%r13,4), %rcx
movslq (%r15,%r11,4), %rax
movslq (%r9,%rax,4), %rsi
movl %esi, %eax
movslq (%r9,%rcx,4), %rdi
movl %edi, %ecx
cmpq %r8, %rdx
je 0x3013d5
cmpl %ecx, %eax
je 0x301412
movl (%rdx,%rsi,4), %esi
cmpl (%rdx,%rdi,4), %esi
je 0x301412
movq 0x28(%rsp), %rdx
incq (%rdx)
cmpl %ecx, %eax
jg 0x3013e5
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, 0x8(%rsp)
jmp 0x3013f1
cmpl %ecx, %eax
je 0x301412
movq 0x28(%rsp), %rdx
incq (%rdx)
cmpl %edi, %esi
jge 0x3013c7
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3041f0
movq 0x18(%rsp), %r9
movq 0x88(%rsp), %r10
movq 0x10(%rsp), %r11
incq %r13
movl 0x8(%r12), %eax
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x30137e
leaq 0x1(%r11), %rdx
cmpq %rcx, %r11
movq %rdx, %r11
jl 0x301365
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq