// File: /workspace/github_cpp_makefile_star2_O1/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
cqto
idivq 0xe8(%rdi)
testq %rax, %rax
jle 0x10665
movq 0xd0(%rbx), %rdi
shlq $0x2, %rax
movl $0xff, %esi
movq %rax, %rdx
callq 0x7180
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rsi
testq %rsi, %rsi
je 0x10695
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x106a4
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x173e4
movq $0x1, 0x10(%rsp)
movq 0x38(%rbx), %rax
cqto
idivq 0xe8(%rbx)
cmpq $0x2, %rax
jl 0x107dc
leaq 0xa0(%rbx), %r14
movq $-0x1, %r13
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r12
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x15b7a
movl %eax, %ebp
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
cmpl %eax, %ebp
jge 0x10771
movq 0x38(%rsp), %rax
movq -0x8(%rax), %r13
addq $-0x8, %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x15b7a
movl %eax, %ebp
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
cmpl %eax, %ebp
jg 0x106dc
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
movl %eax, %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0x15b7a
cmpl %eax, %ebp
je 0x106dc
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rax
movq 0xd0(%rbx), %rcx
movl %r13d, (%rcx,%rax,4)
jmp 0x106dc
cmpq $-0x1, %r13
je 0x10788
movq 0x10(%rsp), %rax
movq 0xd0(%rbx), %rcx
movl %r13d, -0x4(%rcx,%rax,4)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x107a7
movq 0x10(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x107b2
movq %r15, %rdi
movq %r12, %rdx
callq 0x17764
movq 0x10(%rsp), %rcx
incq %rcx
movq %rcx, 0x10(%rsp)
movq 0x38(%rbx), %rax
cqto
idivq 0xe8(%rbx)
movq $-0x1, %r13
cmpq %rax, %rcx
jl 0x106dc
leaq 0xa0(%rbx), %r14
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
testl %eax, %eax
jle 0x10852
movq 0x38(%rsp), %rax
leaq -0x8(%rax), %rcx
movq -0x8(%rax), %r15
movq %rcx, 0x38(%rsp)
movq -0x10(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
testl %eax, %eax
js 0x107e3
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
movl %eax, %ebp
movq %r14, %rdi
movq %r15, %rsi
callq 0x15b7a
cmpl %eax, %ebp
je 0x107e3
movq 0x38(%rsp), %rax
movq -0x8(%rax), %rax
movq 0xd0(%rbx), %rcx
movl %r15d, (%rcx,%rax,4)
jmp 0x107e3
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x10882
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x10891
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x173e4
movq $0x1, 0x8(%rsp)
movq 0x38(%rbx), %rax
cqto
idivq 0xe8(%rbx)
cmpq $0x2, %rax
jl 0x10972
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x15b7a
movl %eax, %ebp
movq 0x18(%rsp), %rax
movq -0x8(%rax), %rsi
movq %r14, %rdi
callq 0x15b7a
movq 0x18(%rsp), %rcx
addq $-0x8, %rcx
cmpl %eax, %ebp
jge 0x108ef
movq %rcx, 0x18(%rsp)
jmp 0x108bb
movq (%rcx), %r13
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x15b7a
movl %eax, %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0x15b7a
cmpl %eax, %ebp
jne 0x10925
addq $-0x8, 0x18(%rsp)
movl 0x8(%rsp), %eax
movq 0xd0(%rbx), %rcx
movl %eax, (%rcx,%r13,4)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x10944
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x1094f
movq %r15, %rdi
movq %r12, %rdx
callq 0x17764
movq 0x8(%rsp), %rcx
incq %rcx
movq %rcx, 0x8(%rsp)
movq 0x38(%rbx), %rax
cqto
idivq 0xe8(%rbx)
cmpq %rax, %rcx
jl 0x108bb
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x10989
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x109a0
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x109b7
jmp 0x109d5
jmp 0x109d5
jmp 0x109b7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x109d8
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
jmp 0x109d8
jmp 0x109d5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x109ef
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x72f0
movq %rbx, %rdi
callq 0x7600
nop