// File: /workspace/github_cpp_makefile_star2_O3/grogers0[P]dots_and_boxes/BasicMoveDeciders.cpp
// Function: Board::decide_move_nocheap()
Edge Board::decide_move_nocheap()
{
    std::vector<Edge> take_square_moves, give_square_moves, other_moves;

    std::for_each(edge_begin(), edge_end(), [&] (Edge edge)
            {
                if (!this->is_move_valid(edge))
                    return;
                bool take_square = false, give_square = false;
                this->for_each_adjacent_node(edge, [&] (const Node &node)
                    {
                        switch (this->degree(node)) {
                            case 3: take_square = true; break;
                            case 2: give_square = true; break;
                        }
                    });
                if (take_square) {
                    take_square_moves.push_back(edge);
                } else if (give_square) {
                    give_square_moves.push_back(edge);
                } else {
                    other_moves.push_back(edge);
                }
            });

    if (!take_square_moves.empty()) {
        return take_square_moves.front();
    } else {
        int r = 0;

        int fd = open("/dev/urandom", O_RDONLY);
        read(fd, &r, sizeof(r));
        close(fd);

        if (!other_moves.empty()) {
            return other_moves[r % other_moves.size()];
        } else {
            assert(!give_square_moves.empty());
            return give_square_moves[r % give_square_moves.size()];
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x68(%rsp), %rax
movaps %xmm0, -0x8(%rax)
xorl %r13d, %r13d
movq %r13, 0x8(%rax)
leaq 0x48(%rsp), %rax
movq %r13, 0x8(%rax)
movaps %xmm0, -0x8(%rax)
leaq 0x28(%rsp), %rax
movq %r13, 0x8(%rax)
movaps %xmm0, -0x8(%rax)
movl (%rdi), %eax
movl 0x4(%rdi), %ecx
shlq $0x20, %rax
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movl %ecx, 0x8(%r14)
leaq 0xf(%rsp), %r12
movl 0x10(%rsp), %ebp
movl %ebp, 0x1c(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2890
testb %al, %al
je 0x422d
movb %r13b, 0xf(%rsp)
movb %r13b, 0xe(%rsp)
testb $0x1, %bpl
jne 0x4173
movswl %bp, %r15d
movl %r15d, %eax
shrl $0x8, %eax
testw %ax, %ax
jle 0x4148
movsbl %bpl, %eax
shrl %eax
movl %ebp, %ecx
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
andl %edx, %ecx
movzbl %al, %esi
orl %ecx, %esi
addl %edx, %esi
movq %rbx, %rdi
callq 0x2b3c
movq %r12, %rcx
cmpl $0x3, %eax
je 0x4145
cmpl $0x2, %eax
jne 0x4148
leaq 0xe(%rsp), %rcx
movb $0x1, (%rcx)
sarl $0x8, %r15d
cmpl %r15d, 0x4(%rbx)
jle 0x41e1
movsbl %bpl, %eax
shrl %eax
movl %ebp, %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
movzbl %al, %esi
orl %ecx, %esi
movq %rbx, %rdi
callq 0x2b3c
jmp 0x41cc
movsbl %bpl, %r15d
movl %r15d, %eax
shrl %eax
sarl %r15d
testw %ax, %ax
jle 0x41b2
leal -0x1(%r15), %eax
movl %ebp, %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
movzbl %al, %esi
orl %ecx, %esi
movq %rbx, %rdi
callq 0x2b3c
movq %r12, %rcx
cmpl $0x3, %eax
je 0x41af
cmpl $0x2, %eax
jne 0x41b2
leaq 0xe(%rsp), %rcx
movb $0x1, (%rcx)
cmpl %r15d, (%rbx)
jle 0x41e1
movl %ebp, %eax
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
movzbl %r15b, %esi
orl %eax, %esi
movq %rbx, %rdi
callq 0x2b3c
movq %r12, %rcx
cmpl $0x3, %eax
je 0x41de
cmpl $0x2, %eax
jne 0x41e1
leaq 0xe(%rsp), %rcx
movb $0x1, (%rcx)
cmpb $0x1, 0xf(%rsp)
jne 0x4206
movq 0x68(%rsp), %rsi
leaq 0x60(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq 0x70(%rsp), %rsi
je 0x4223
movl %ebp, (%rsi)
addq $0x4, (%rax)
jmp 0x422d
cmpb $0x1, 0xe(%rsp)
jne 0x424e
movq 0x48(%rsp), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq 0x50(%rsp), %rsi
jne 0x41fe
leaq 0x1c(%rsp), %rdx
callq 0x440c
movq %r14, %rdi
callq 0x43a4
movzwl 0x10(%rsp), %eax
cmpw $-0x2, %ax
setb %cl
orb %al, %cl
testb $0x1, %cl
jne 0x40dc
jmp 0x4266
movq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rsi
jne 0x41fe
jmp 0x4223
movq 0x60(%rsp), %rax
cmpq 0x68(%rsp), %rax
je 0x427b
movl (%rax), %ebx
movq 0x20(%rsp), %rdi
jmp 0x42e2
movl $0x0, 0x10(%rsp)
leaq 0x108e(%rip), %rdi      # 0x5318
xorl %esi, %esi
xorl %eax, %eax
callq 0x2160
movl %eax, %ebx
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
movl %eax, %edi
callq 0x2290
movl %ebx, %edi
callq 0x23b0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rdi, %rcx
cmpq %rsi, %rdi
jne 0x42ce
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rsi
cmpq %rsi, %rcx
je 0x4333
movslq 0x10(%rsp), %rax
subq %rcx, %rsi
sarq $0x2, %rsi
xorl %edx, %edx
divq %rsi
movl (%rcx,%rdx,4), %ebx
testq %rdi, %rdi
je 0x42f4
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x430b
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4322
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfeb(%rip), %rdi       # 0x5325
leaq 0xfff(%rip), %rsi       # 0x5340
leaq 0x100e(%rip), %rcx      # 0x5356
movl $0x56, %edx
callq 0x2120
jmp 0x4354
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x436e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x4385
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x439c
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2350