// File: grogers0[P]dots_and_boxes/BruteForce.cpp
// Function: brute_force(Board const&)
void brute_force(const Board &oldboard)
{
    std::vector<Edge> edges;

    std::for_each(oldboard.edge_begin(), oldboard.edge_end(), [&] (Edge edge)
            { if (oldboard.is_move_valid(edge)) edges.push_back(edge); });

    std::vector<std::pair<Edge, short>> table;
    table.resize(((unsigned long)1) << oldboard.num_edges(), std::make_pair(Edge(), SHRT_MAX));
    table.back().second = 0; // initialize the final state

    std::sort(edges.begin(), edges.end());
    for (std::vector<Edge>::iterator middle = --edges.end();
            middle != edges.begin(); --middle) {
        do_brute_force_one_level(oldboard, table, edges.begin(), middle, edges.end());
    }

    do_brute_force_one_level(oldboard, table, edges.begin(), edges.begin(), edges.end());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7a30
movq -0x8(%rbp), %rdi
callq 0x7a50
movl %edx, -0x144(%rbp)
movq %rax, -0x140(%rbp)
jmp 0x8ed0
movl -0x144(%rbp), %eax
movq -0x140(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7ab0
movl %edx, -0x154(%rbp)
movq %rax, -0x150(%rbp)
jmp 0x8f0a
movl -0x154(%rbp), %eax
movq -0x150(%rbp), %rcx
movq %rcx, -0x70(%rbp)
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movl -0x88(%rbp), %esi
movl -0x58(%rbp), %eax
movl %eax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdx
movl -0x98(%rbp), %ecx
movq -0x80(%rbp), %r8
movq -0x78(%rbp), %r9
callq 0x9260
movq %rdx, -0x168(%rbp)
movq %rax, -0x160(%rbp)
jmp 0x8f9b
movq -0x168(%rbp), %rax
movq -0x160(%rbp), %rcx
movq %rcx, -0xb0(%rbp)
movq %rax, -0xa8(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x96f0
movq -0x8(%rbp), %rdi
callq 0x2ff0
movl %eax, -0x16c(%rbp)
jmp 0x8fd4
movl -0x16c(%rbp), %eax
movb %al, %cl
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x178(%rbp)
leaq -0xdc(%rbp), %rdi
callq 0x4eb0
jmp 0x8ff9
movl $0x7fff, -0xe0(%rbp)    # imm = 0x7FFF
leaq -0xdc(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x97c0
movq %rax, -0x180(%rbp)
jmp 0x901f
movq -0x180(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x97f0
jmp 0x9042
movq -0x178(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x9710
jmp 0x905e
leaq -0xc8(%rbp), %rdi
callq 0x9820
movw $0x0, 0x4(%rax)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x84d0
movq -0x188(%rbp), %rdi
movq %rax, -0xe8(%rbp)
callq 0x8360
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
callq 0x9860
jmp 0x90af
leaq -0x20(%rbp), %rdi
callq 0x8360
movq %rax, -0x100(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x98a0
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x84d0
movq %rax, -0x108(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x98c0
testb $0x1, %al
jne 0x9101
jmp 0x91af
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x84d0
movq -0x198(%rbp), %rdi
movq %rax, -0x110(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x118(%rbp)
callq 0x8360
movq -0x190(%rbp), %rdi
movq %rax, -0x120(%rbp)
movq -0x110(%rbp), %rdx
movq -0x118(%rbp), %rcx
movq -0x120(%rbp), %r8
leaq -0xc8(%rbp), %rsi
callq 0x8a60
jmp 0x916e
jmp 0x9170
leaq -0xf8(%rbp), %rdi
callq 0x98a0
jmp 0x90d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x923f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x9900
jmp 0x923f
movq -0x8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x84d0
movq -0x1a8(%rbp), %rdi
movq %rax, -0x128(%rbp)
callq 0x84d0
movq -0x1a8(%rbp), %rdi
movq %rax, -0x130(%rbp)
callq 0x8360
movq -0x1a0(%rbp), %rdi
movq %rax, -0x138(%rbp)
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rcx
movq -0x138(%rbp), %r8
leaq -0xc8(%rbp), %rsi
callq 0x8a60
jmp 0x9221
leaq -0xc8(%rbp), %rdi
callq 0x9900
leaq -0x20(%rbp), %rdi
callq 0x7b50
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x7b50
movq -0x38(%rbp), %rdi
callq 0x2320
nopw %cs:(%rax,%rax)