// File: zeeev[P]DASVC/src/chain.cpp
// Function: chain::traceback(std::vector<int, std::allocator<int>>&)
bool chain::traceback(std::vector<int> & alns){

    if(last != nodes.front() && last != nodes.back() ){
        alns.push_back(last->index);
    }

    if( last->children.empty() ){
        return false;
    }

    double max = last->children.front()->overallScore;
    node * current = last->children.front();

    for(std::vector<node *>::iterator it = last->children.begin();
        it != last->children.end(); it++){

        if((*it)->overallScore > max ){

            max       = (*it)->overallScore;
            current   =  *it ;
        }
    }



    std::cerr << "  best child : "
              << " " << current->index
              << " " << current->start
              << " " << current->end
              << " " << current->matches
              << " " << current->overallScore
              << std::endl;




    last = current;

    return traceback(alns);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x50(%rbp)
movq 0x8(%rdi), %rax
movq %rax, -0x48(%rbp)
addq $0x10, %rdi
callq 0x1ba90
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq (%rcx), %rax
je 0x1b5bb
movq -0x50(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0x58(%rbp)
addq $0x10, %rdi
callq 0x1ba10
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq (%rcx), %rax
je 0x1b5bb
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rdi
movq 0x8(%rax), %rsi
addq $0x18, %rsi
callq 0x1bac0
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x20, %rdi
callq 0x1bb30
testb $0x1, %al
jne 0x1b5d2
jmp 0x1b5db
movb $0x0, -0x1(%rbp)
jmp 0x1b77a
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x20, %rdi
callq 0x1ba90
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq (%rcx), %rcx
movsd 0x8(%rcx), %xmm0
movsd %xmm0, -0x20(%rbp)
movq 0x8(%rax), %rdi
addq $0x20, %rdi
callq 0x1ba90
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rdi
addq $0x20, %rdi
callq 0x1b8a0
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x20, %rdi
callq 0x1b910
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1b8d0
testb $0x1, %al
jne 0x1b654
jmp 0x1b6a5
leaq -0x30(%rbp), %rdi
callq 0x1b940
movq (%rax), %rax
movsd 0x8(%rax), %xmm0
ucomisd -0x20(%rbp), %xmm0
jbe 0x1b692
leaq -0x30(%rbp), %rdi
callq 0x1b940
movq (%rax), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1b940
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x1b694
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x1b980
movq %rax, -0x40(%rbp)
jmp 0x1b62c
movq 0x92944(%rip), %rdi     # 0xadff0
leaq 0x64bc3(%rip), %rsi     # 0x80276
callq 0x6560
movq %rax, %rdi
leaq 0x6654e(%rip), %rsi     # 0x81c10
callq 0x6560
movq %rax, %rdi
movq -0x28(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x6a00
movq %rax, %rdi
leaq 0x66530(%rip), %rsi     # 0x81c10
callq 0x6560
movq %rax, %rdi
movq -0x28(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x6a00
movq %rax, %rdi
leaq 0x66512(%rip), %rsi     # 0x81c10
callq 0x6560
movq %rax, %rdi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x6a00
movq %rax, %rdi
leaq 0x664f4(%rip), %rsi     # 0x81c10
callq 0x6560
movq %rax, %rdi
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
callq 0x6ad0
movq %rax, %rdi
leaq 0x664d5(%rip), %rsi     # 0x81c10
callq 0x6560
movq %rax, %rdi
movq -0x28(%rbp), %rax
movsd 0x8(%rax), %xmm0
callq 0x6ad0
movq %rax, %rdi
movq 0x9284d(%rip), %rsi     # 0xadfa8
callq 0x65c0
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, 0x8(%rdi)
movq -0x18(%rbp), %rsi
callq 0x1b550
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop