// File: DaSnek[P]TicTacToe-AI/./board.hpp
// Function: Board::check_for_win() const
int check_for_win() const {
        for (int i = 0; i < 3; i++) {
            if (board[i][0] == board[i][1] && board[i][2] == board[i][0]) {
                if (board[i][0])
                    return board[i][0];
            }
        }
		
		for (int i = 0; i < 3; i++) {
            if (board[0][i] == board[1][i] && board[2][i] == board[0][i]) {
                if (board[0][i])
                    return board[0][i];
            }
        }

        if ((board[0][0] == board[1][1] && board[2][2] == board[0][0])
                || (board[2][0] == board[1][1] && board[1][1] == board[0][2])) {
            if (board[1][1])
                return board[1][1];
        }
        return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0x17b8
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x24(%rbp)
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
movl $0x1, %esi
callq 0x31d0
movq %rax, %rcx
movl -0x24(%rbp), %eax
cmpl (%rcx), %eax
jne 0x17a8
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
movl $0x2, %esi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x28(%rbp)
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
movq %rax, %rcx
movl -0x28(%rbp), %eax
cmpl (%rcx), %eax
jne 0x17a8
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
cmpl $0x0, (%rax)
je 0x17a6
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1a45
jmp 0x17a8
jmp 0x17aa
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16bb
movl $0x0, -0x18(%rbp)
cmpl $0x3, -0x18(%rbp)
jge 0x18bc
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
addq $0x8, %rdi
movl $0x1, %esi
callq 0x31b0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x31d0
movq %rax, %rcx
movl -0x2c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x18ac
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl $0x2, %esi
callq 0x31b0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x30(%rbp)
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x31d0
movq %rax, %rcx
movl -0x30(%rbp), %eax
cmpl (%rcx), %eax
jne 0x18ac
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x31d0
cmpl $0x0, (%rax)
je 0x18aa
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x31d0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1a45
jmp 0x18ac
jmp 0x18ae
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x17bf
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x34(%rbp)
addq $0x8, %rdi
movl $0x1, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x1, %esi
callq 0x31d0
movq %rax, %rcx
movl -0x34(%rbp), %eax
cmpl (%rcx), %eax
jne 0x1956
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl $0x2, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x2, %esi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x38(%rbp)
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
movq %rax, %rcx
movl -0x38(%rbp), %eax
cmpl (%rcx), %eax
je 0x19f2
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl $0x2, %esi
callq 0x31b0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
addq $0x8, %rdi
movl $0x1, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x1, %esi
callq 0x31d0
movq %rax, %rcx
movl -0x3c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x1a3e
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x1, %esi
callq 0x31d0
movq -0x20(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x40(%rbp)
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x2, %esi
callq 0x31d0
movq %rax, %rcx
movl -0x40(%rbp), %eax
cmpl (%rcx), %eax
jne 0x1a3e
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x1, %esi
callq 0x31d0
cmpl $0x0, (%rax)
je 0x1a3c
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x31b0
movq %rax, %rdi
movl $0x1, %esi
callq 0x31d0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1a45
jmp 0x1a3e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop