// File: /workspace/github_cpp_makefile_star2_O2/readmapping[P]alfalfa/src/sparseSA.cpp
// Function: sparseSA::computeChild()
void sparseSA::computeChild() {
    for(long i = 0; i < N/K; i++){
        CHILD[i] = -1;
    }
    //Compute up and down values
    long lastIndex  = -1;
    stack<long,vector<long> > stapelUD;
    stapelUD.push(0);
    for(long i = 1; i < N/K; i++){
        while(LCP[i] < LCP[stapelUD.top()]){
            lastIndex = stapelUD.top();
            stapelUD.pop();
            if(LCP[i] <= LCP[stapelUD.top()] && LCP[stapelUD.top()] != LCP[lastIndex]){
                CHILD[stapelUD.top()] = lastIndex;
            }
        }
        //now LCP[i] >= LCP[top] holds
        if(lastIndex != -1){
            CHILD[i-1] = lastIndex;
            lastIndex = -1;
        }
        stapelUD.push(i);
    }
    while(0 < LCP[stapelUD.top()]){//last row (fix for last character of sequence not being unique
        lastIndex = stapelUD.top();
        stapelUD.pop();
        if(0 <= LCP[stapelUD.top()] && LCP[stapelUD.top()] != LCP[lastIndex]){
            CHILD[stapelUD.top()] = lastIndex;
        }
    }
    //Compute Next L-index values
    stack<long,vector<long> > stapelNL;
    stapelNL.push(0);
    for(long i = 1; i < N/K; i++){
        while(LCP[i] < LCP[stapelNL.top()])
            stapelNL.pop();
        lastIndex = stapelNL.top();
        if(LCP[i] == LCP[lastIndex]){
            stapelNL.pop();
            CHILD[lastIndex] = i;
        }
        stapelNL.push(i);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0xd0(%rdi), %rcx
cqto
idivq 0xe8(%rdi)
xorl %edx, %edx
testq %rax, %rax
cmovleq %rdx, %rax
cmpq %rdx, %rax
je 0xd7e2
orl $-0x1, (%rcx,%rdx,4)
incq %rdx
jmp 0xd7d4
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x10(%rsp), %rsi
andq $0x0, (%rsi)
callq 0x127d0
leaq 0xa0(%rbx), %r14
pushq $0x1
popq %rsi
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
movq %rsi, 0x10(%rsp)
movq 0x38(%rbx), %rax
cqto
idivq 0xe8(%rbx)
cmpq %rax, %rsi
jge 0xd94f
pushq $-0x1
popq %r13
movq %r14, %rdi
callq 0x10ed8
movl %eax, %ebp
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
cmpl %eax, %ebp
jge 0xd8c8
movq 0x38(%rsp), %rax
movq -0x8(%rax), %r13
addq $-0x8, %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x10ed8
movl %eax, %ebp
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
cmpl %eax, %ebp
jg 0xd8be
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
movl %eax, %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0x10ed8
cmpl %eax, %ebp
je 0xd8be
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rax
movq 0xd0(%rbx), %rcx
movl %r13d, (%rcx,%rax,4)
movq 0x10(%rsp), %rsi
jmp 0xd833
cmpq $-0x1, %r13
je 0xd8df
movq 0x10(%rsp), %rax
movq 0xd0(%rbx), %rcx
movl %r13d, -0x4(%rcx,%rax,4)
movq %r15, %rdi
movq %r12, %rsi
callq 0x12b24
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0xd814
movq 0x38(%rsp), %rax
leaq -0x8(%rax), %rcx
movq -0x8(%rax), %r15
movq %rcx, 0x38(%rsp)
movq -0x10(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
testl %eax, %eax
js 0xd94f
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
movl %eax, %ebp
movq %r14, %rdi
movq %r15, %rsi
callq 0x10ed8
cmpl %eax, %ebp
je 0xd94f
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rax
movq 0xd0(%rbx), %rcx
movl %r15d, (%rcx,%rax,4)
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
testl %eax, %eax
jg 0xd8f7
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
callq 0x127d0
pushq $0x1
popq %rsi
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %rsi, 0x8(%rsp)
movq 0x38(%rbx), %rax
cqto
idivq 0xe8(%rbx)
cmpq %rax, %rsi
jge 0xda2c
movq %r14, %rdi
callq 0x10ed8
movl %eax, %ebp
movq 0x18(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x10ed8
movq 0x18(%rsp), %rcx
addq $-0x8, %rcx
cmpl %eax, %ebp
jge 0xd9de
movq %rcx, 0x18(%rsp)
movq 0x8(%rsp), %rsi
jmp 0xd9aa
movq (%rcx), %r13
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x10ed8
movl %eax, %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0x10ed8
cmpl %eax, %ebp
jne 0xda14
addq $-0x8, 0x18(%rsp)
movl 0x8(%rsp), %eax
movq 0xd0(%rbx), %rcx
movl %eax, (%rcx,%r13,4)
movq %r15, %rdi
movq %r12, %rsi
callq 0x12b24
movq 0x8(%rsp), %rsi
incq %rsi
jmp 0xd98f
leaq 0x10(%rsp), %rdi
callq 0xa3d4
leaq 0x30(%rsp), %rdi
callq 0xa3d4
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xda59
jmp 0xda68
jmp 0xda68
jmp 0xda59
jmp 0xda68
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa3d4
jmp 0xda6b
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xa3d4
movq %rbx, %rdi
callq 0x75e0
nop