// File: IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::Board(Board const&)
Board::Board(const Board &b) {
  this->board = new Chessman**[8];

  for (int x = 0; x < 8; x++) {
    this->board[x] = new Chessman*[8];
    for (int y = 0; y < 8; y++) {
      if (b.getChessman(Position(x,y)) != nullptr) {
        this->board[x][y] = b.getChessman(Position(x,y))->clone();
      }
    }
  }
  for(Chessman* c : b.capturedChessmen) {
    this->capturedChessmen.push_back(c->clone());
  }
  for(Move* m : b.previousMoves) {
    this->previousMoves.push_back(new Move(*m));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x10, %rdi
movq %rdi, -0xa8(%rbp)
callq 0x9130
movq -0xa0(%rbp), %rdi
addq $0x28, %rdi
movq %rdi, -0x98(%rbp)
callq 0x9150
movl $0x40, %edi
callq 0x2030
movq %rax, -0x90(%rbp)
jmp 0x7af8
movq -0xa0(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rcx, (%rax)
movl $0x0, -0x20(%rbp)
cmpl $0x8, -0x20(%rbp)
jge 0x7c3e
movl $0x40, %edi
callq 0x2030
movq %rax, -0xb0(%rbp)
jmp 0x7b2d
movq -0xb0(%rbp), %rdx
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x24(%rbp)
cmpl $0x8, -0x24(%rbp)
jge 0x7c2e
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
leaq -0x2c(%rbp), %rdi
callq 0x2e50
jmp 0x7b73
movq -0xb8(%rbp), %rdi
movq -0x2c(%rbp), %rsi
callq 0x7de0
movq %rax, -0xc0(%rbp)
jmp 0x7b8c
movq -0xc0(%rbp), %rax
cmpq $0x0, %rax
je 0x7c1e
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
leaq -0x34(%rbp), %rdi
callq 0x2e50
jmp 0x7bb9
movq -0xc8(%rbp), %rdi
movq -0x34(%rbp), %rsi
callq 0x7de0
movq %rax, -0xd0(%rbp)
jmp 0x7bd2
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movq %rax, -0xd8(%rbp)
jmp 0x7bea
movq -0xd8(%rbp), %rdx
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x7c1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x7db7
jmp 0x7c20
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7b4d
jmp 0x7c30
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7b10
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9220
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9250
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x9280
testb $0x1, %al
jne 0x7c77
jmp 0x7cdb
leaq -0x48(%rbp), %rdi
callq 0x92b0
movq %rax, %rcx
movq -0xa0(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x58(%rbp)
addq $0x10, %rax
movq %rax, -0xe8(%rbp)
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movq %rax, -0xe0(%rbp)
jmp 0x7cb1
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x92e0
jmp 0x7cce
jmp 0x7cd0
leaq -0x48(%rbp), %rdi
callq 0x9320
jmp 0x7c64
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9340
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
callq 0x9370
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x93a0
testb $0x1, %al
jne 0x7d17
jmp 0x7dae
leaq -0x70(%rbp), %rdi
callq 0x93d0
movq %rax, %rcx
movq -0xa0(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x80(%rbp)
addq $0x28, %rax
movq %rax, -0xf8(%rbp)
movl $0x20, %edi
callq 0x2160
movq %rax, -0xf0(%rbp)
jmp 0x7d4f
movq -0xf0(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x6930
jmp 0x7d61
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x9400
jmp 0x7d84
jmp 0x7d86
leaq -0x70(%rbp), %rdi
callq 0x9440
jmp 0x7d01
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x2140
jmp 0x7db7
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x2bb0
movq -0xa8(%rbp), %rdi
callq 0x9170
movq -0x18(%rbp), %rdi
callq 0x2260
nopl (%rax,%rax)