// File: jeffreyan11[P]go-engine/board.cpp
// Function: Board::init()
void Board::init() {
    pieces = new Stone[arraySize*arraySize];
    // Initialize the board to empty
    for (int i = 0; i < arraySize*arraySize; i++)
        pieces[i] = EMPTY;

    // Initialize the edges to -1
    for (int i = 0; i < arraySize; i++) {
        pieces[index(0, i)] = -1;
        pieces[index(arraySize-1, i)] = -1;
        pieces[index(i, 0)] = -1;
        pieces[index(i, arraySize-1)] = -1;
    }

    blackCaptures = 0;
    whiteCaptures = 0;
    zobristKey = 0;
    nextID = 1;
    chainID = new int[arraySize*arraySize];
    for (int i = 0; i < arraySize*arraySize; i++)
        chainID[i] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movl 0x1097a(%rip), %eax     # 0x141f4
imull 0x10973(%rip), %eax     # 0x141f4
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl 0x10936(%rip), %ecx     # 0x141f4
imull 0x1092f(%rip), %ecx     # 0x141f4
cmpl %ecx, %eax
jge 0x38e6
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x38b5
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x108fe(%rip), %eax     # 0x141f4
jge 0x39ac
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movl -0x10(%rbp), %esi
xorl %edi, %edi
callq 0x8bc0
movq -0x40(%rbp), %rcx
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq %edx, %rdx
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movl 0x108c2(%rip), %edi     # 0x141f4
subl $0x1, %edi
movl -0x10(%rbp), %esi
callq 0x8bc0
movq -0x38(%rbp), %rcx
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq %edx, %rdx
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x10(%rbp), %edi
xorl %esi, %esi
callq 0x8bc0
movq -0x30(%rbp), %rcx
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq %edx, %rdx
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x10(%rbp), %edi
movl 0x1086e(%rip), %esi     # 0x141f4
subl $0x1, %esi
callq 0x8bc0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x38ed
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
movl $0x0, 0xc(%rax)
movq $0x0, 0x10(%rax)
movl $0x1, 0x18(%rax)
movl 0x10821(%rip), %eax     # 0x141f4
imull 0x1081a(%rip), %eax     # 0x141f4
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl 0x107dc(%rip), %ecx     # 0x141f4
imull 0x107d5(%rip), %ecx     # 0x141f4
cmpl %ecx, %eax
jge 0x3a41
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3a0f
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)