// File: readmapping[P]alfalfa/src/sparseSA.cpp
// Function: sparseSA::top_down_child(char, interval_t&) const
bool sparseSA::top_down_child(char c, interval_t &cur) const{
    long left = cur.start;
    long right = CHILD[cur.end];
    if(cur.start >= right || right > cur.end)
        right = CHILD[cur.start];
    //now left and right point to first child
    if(S[SA[cur.start]+cur.depth] == c){
        cur.end = right-1;
        return true;
    }
    left = right;
    //while has next L-index
    while(CHILD[right] > right && LCP[right] == LCP[CHILD[right]]){
        right = CHILD[right];
        if(S[SA[left]+cur.depth] == c){
            cur.start = left; cur.end = right - 1;
            return true;
        }
        left = right;
    }
    //last interval
    if(S[SA[left]+cur.depth] == c){
            cur.start = left;
            return true;
    }
    return false;
}

// Assembly:
subq $0x68, %rsp
movb %sil, %al
movq %rdi, 0x58(%rsp)
movb %al, 0x57(%rsp)
movq %rdx, 0x48(%rsp)
movq 0x58(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
addq $0xd0, %rdi
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x237b0
movslq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
cmpq 0x38(%rsp), %rax
jge 0x23838
movq 0x38(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jle 0x23859
movq 0x30(%rsp), %rdi
addq $0xd0, %rdi
movq 0x48(%rsp), %rax
movq (%rax), %rsi
callq 0x237b0
movslq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, %rax
addq $0x50, %rax
movq %rax, 0x28(%rsp)
addq $0x70, %rdi
movq 0x48(%rsp), %rax
movq (%rax), %rsi
callq 0x1fb90
movq 0x28(%rsp), %rdi
movl (%rax), %eax
movq 0x48(%rsp), %rcx
addl 0x10(%rcx), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x8410
movsbl (%rax), %eax
movsbl 0x57(%rsp), %ecx
cmpl %ecx, %eax
jne 0x238bb
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x8(%rax)
movb $0x1, 0x67(%rsp)
jmp 0x23a44
movq 0x38(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rsp), %rdi
addq $0xd0, %rdi
movq 0x38(%rsp), %rsi
callq 0x237b0
movslq (%rax), %rcx
xorl %eax, %eax
cmpq 0x38(%rsp), %rcx
movb %al, 0x27(%rsp)
jle 0x23945
movq 0x30(%rsp), %rdi
addq $0xa0, %rdi
movq 0x38(%rsp), %rsi
callq 0x1ed20
movq 0x30(%rsp), %rdi
movl %eax, 0x20(%rsp)
movq %rdi, %rax
addq $0xa0, %rax
movq %rax, 0x18(%rsp)
addq $0xd0, %rdi
movq 0x38(%rsp), %rsi
callq 0x237b0
movq 0x18(%rsp), %rdi
movslq (%rax), %rsi
callq 0x1ed20
movl %eax, %ecx
movl 0x20(%rsp), %eax
cmpl %ecx, %eax
sete %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x23952
jmp 0x239e8
movq 0x30(%rsp), %rdi
addq $0xd0, %rdi
movq 0x38(%rsp), %rsi
callq 0x237b0
movq 0x30(%rsp), %rdi
movslq (%rax), %rax
movq %rax, 0x38(%rsp)
movq %rdi, %rax
addq $0x50, %rax
movq %rax, 0x10(%rsp)
addq $0x70, %rdi
movq 0x40(%rsp), %rsi
callq 0x1fb90
movq 0x10(%rsp), %rdi
movl (%rax), %eax
movq 0x48(%rsp), %rcx
addl 0x10(%rcx), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x8410
movsbl (%rax), %eax
movsbl 0x57(%rsp), %ecx
cmpl %ecx, %eax
jne 0x239d9
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x8(%rax)
movb $0x1, 0x67(%rsp)
jmp 0x23a44
movq 0x38(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x238c5
movq 0x30(%rsp), %rdi
movq %rdi, %rax
addq $0x50, %rax
movq %rax, 0x8(%rsp)
addq $0x70, %rdi
movq 0x40(%rsp), %rsi
callq 0x1fb90
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movq 0x48(%rsp), %rcx
addl 0x10(%rcx), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x8410
movsbl (%rax), %eax
movsbl 0x57(%rsp), %ecx
cmpl %ecx, %eax
jne 0x23a3f
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movb $0x1, 0x67(%rsp)
jmp 0x23a44
movb $0x0, 0x67(%rsp)
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
nop