// File: jeffreyan11[P]go-engine/board.cpp
// Function: Board::Board(Board const&)
Board::Board(const Board &other) {
    pieces = new Stone[arraySize*arraySize];
    for (int i = 0; i < arraySize*arraySize; i++) {
        pieces[i] = other.pieces[i];
    }

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

    unsigned int numChains = other.chainList.size();
    for (unsigned int i = 0; i < numChains; i++) {
        Chain *node = other.chainList.get(i);
        chainList.add(new Chain(*(node)));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
addq $0x28, %rdi
movq %rdi, -0x48(%rbp)
callq 0x8ad0
movl 0x10776(%rip), %eax     # 0x141f4
imull %eax, %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, -0x40(%rbp)
jmp 0x3a92
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl 0x10747(%rip), %ecx     # 0x141f4
imull 0x10740(%rip), %ecx     # 0x141f4
cmpl %ecx, %eax
jge 0x3af0
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x20(%rbp), %rdx
movl (%rcx,%rdx,4), %edx
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3aa4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x3c3d
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movl 0x106d0(%rip), %eax     # 0x141f4
imull %eax, %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, -0x58(%rbp)
jmp 0x3b38
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x20(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl 0x106a0(%rip), %ecx     # 0x141f4
imull 0x10699(%rip), %ecx     # 0x141f4
cmpl %ecx, %eax
jge 0x3b88
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movl (%rcx,%rdx,4), %edx
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3b4b
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0x8b00
movl %eax, -0x5c(%rbp)
jmp 0x3b9a
movl -0x5c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x3c34
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
movl -0x2c(%rbp), %esi
callq 0x8b20
movq %rax, -0x68(%rbp)
jmp 0x3bc9
movq -0x50(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, -0x38(%rbp)
addq $0x28, %rax
movq %rax, -0x78(%rbp)
movl $0x610, %edi            # imm = 0x610
callq 0x2200
movq %rax, -0x70(%rbp)
jmp 0x3bed
movq -0x70(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x9300
jmp 0x3bfc
movq -0x70(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0x8b40
jmp 0x3c0b
jmp 0x3c0d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3ba7
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x610, %esi            # imm = 0x610
callq 0x2210
jmp 0x3c3d
addq $0x80, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x8af0
movq -0x18(%rbp), %rdi
callq 0x2350
nop