// File: /workspace/github_cpp_makefile_star2_O1/cauimsouza[P]rikudo-solver/src/rikudo_solver/graph.cpp
// Function: Graph::ham_cycle_bt(bool, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> const&)
std::vector< std::vector<int> >&
Graph::ham_cycle_bt(bool count,
                    const std::vector< std::pair<int,int> >& map,
                    const std::vector< std::pair<int,int> >& diamonds)
{   
    int min_deg_v = INT_MAX;
    int min_deg = -1;
    for(int i = 0; i < adj_list.size(); i++){
        if(adj_list[i].size() < min_deg){
            min_deg = adj_list[i].size();
            min_deg_v = i;
        }
    }
    std::vector< std::vector<int> > sol;

    for(int source : adj_list[min_deg_v]){
        paths = ham_path_bt(source, min_deg_v, count, map, diamonds);
        for(auto candidate : paths)
            if(valid(candidate, map, diamonds)){
                sol.push_back(candidate);
                if(count) break;
            }
        if(!count && !sol.empty())  break;
    }
    
    paths = sol;
    return paths;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %r14
movq %rdx, %r15
movl %esi, -0x2c(%rbp)
movq %rdi, %r12
movq 0x38(%rdi), %rax
movq 0x40(%rdi), %rdx
subq %rax, %rdx
je 0x65b8
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
leaq 0x8(%rax), %r9
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %edi, %edi
movq (%r9), %r8
subq -0x8(%r9), %r8
sarq $0x2, %r8
movslq %esi, %rsi
cmpq %rsi, %r8
cmovbl %r8d, %esi
cmovbl %edi, %edx
incq %rdi
addq $0x18, %r9
cmpq %rdi, %rcx
jne 0x6592
jmp 0x65bd
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movslq %edx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rsi
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
cmpq %rax, %rsi
je 0x66d7
leaq 0x78(%r12), %rax
movq %rax, -0x78(%rbp)
movzbl -0x2c(%rbp), %eax
movl %eax, -0x34(%rbp)
leaq -0x90(%rbp), %rbx
movq %r12, -0x40(%rbp)
movl %edx, -0x30(%rbp)
movq %rsi, -0x50(%rbp)
movl (%rsi), %esi
movq %r12, %rdi
movl -0x34(%rbp), %ecx
movq %r15, %r8
movq %r14, %r9
callq 0x6426
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x7530
movq 0x78(%r12), %r13
movq 0x80(%r12), %r12
cmpq %r12, %r13
je 0x6693
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3364
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x378c
testb %al, %al
je 0x666b
leaq -0x70(%rbp), %rdi
movq %rbx, %rsi
callq 0x74f4
cmpb $0x0, -0x2c(%rbp)
jne 0x6682
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x667c
callq 0x21d0
addq $0x18, %r13
jmp 0x6637
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x6693
callq 0x21d0
cmpb $0x0, -0x2c(%rbp)
je 0x66b4
movq -0x50(%rbp), %rsi
addq $0x4, %rsi
cmpq -0x48(%rbp), %rsi
movq -0x40(%rbp), %r12
movl -0x30(%rbp), %edx
jne 0x6607
jmp 0x66d7
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
movq -0x40(%rbp), %r12
movl -0x30(%rbp), %edx
movq -0x50(%rbp), %rsi
jne 0x66d7
addq $0x4, %rsi
cmpq -0x48(%rbp), %rsi
jne 0x6607
addq $0x78, %r12
leaq -0x70(%rbp), %rsi
movq %r12, %rdi
callq 0x7530
leaq -0x70(%rbp), %rdi
callq 0x3136
movq %r12, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x671c
jmp 0x671c
movq %rax, %rbx
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x671f
callq 0x21d0
jmp 0x671f
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3136
movq %rbx, %rdi
callq 0x2380