// File: /workspace/github_cpp_makefile_star2_O1/IncredibleHannes[P]QMUL-ChessGame/src/Model/Chessman/Pawn.cpp
// Function: Pawn::getPossibleMoves[abi:cxx11](Board const&) const
std::list<Move> Pawn::getPossibleMoves(const Board &board) const {
  std::list<Move> moves;
  if (!isCaptured()) {
    int x = this->position.getX();
    int y = this->position.getY();
    if (this->colour == Chessman::Colour::White) {
      if (board.getChessman(Position(x + 1, y)) == nullptr)
      { moves.push_back(Move(Position(x, y), Position(x + 1, y))); }
      //can move 2 fields!
      if (x == 1) {
        if (board.getChessman(Position(x + 1, y)) == nullptr &&
            board.getChessman(Position(x + 2, y)) == nullptr) {
          moves.push_back(Move(Position(x, y), Position(x + 2, y)));
        }
      }
      if(0 <= y - 1 && board.getChessman(Position(x + 1, y - 1)) != nullptr) {
        moves.push_back(Move(Position(x, y), Position(x + 1, y - 1)));
      }
      if(y + 1 < 8 && board.getChessman(Position(x + 1, y + 1)) != nullptr) {
        moves.push_back(Move(Position(x, y), Position(x + 1, y + 1)));
      }
    } else {
      if (board.getChessman(Position(x - 1, y)) == nullptr) {
        moves.push_back(Move(Position(x, y), Position(x - 1, y)));
      }
      //can move 2 fields!
      if (x == 6) {
        if (board.getChessman(Position(x - 1, y)) == nullptr &&
            board.getChessman(Position(x - 2, y)) == nullptr)
        { moves.push_back(Move(Position(x, y), Position(x - 2, y))); }
      }
      if(0 <= y - 1 && board.getChessman(Position(x - 1, y - 1)) != nullptr) {
        moves.push_back(Move(Position(x, y), Position(x - 1, y - 1)));
      }
      if(y + 1 < 8 && board.getChessman(Position(x - 1, y + 1)) != nullptr) {
        moves.push_back(Move(Position(x, y), Position(x - 1, y + 1)));
      }
    }
  }
  return moves;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0x37c6
testb %al, %al
jne 0x35a3
leaq 0x10(%r14), %r12
movq %r12, %rdi
callq 0x2956
movq %rax, -0x30(%rbp)
movq %r12, %rdi
callq 0x295e
movl %eax, %r12d
cmpb $0x1, 0x8(%r14)
jne 0x336b
movq -0x30(%rbp), %rax
leal 0x1(%rax), %r13d
leaq -0x120(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x291e
movq -0x120(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
jne 0x31a4
leaq -0x118(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x291e
leaq -0x110(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x291e
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2e78
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x40d8
cmpl $0x1, -0x30(%rbp)
jne 0x3250
leaq -0x108(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x291e
movq -0x108(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
jne 0x3250
leaq -0x100(%rbp), %rdi
movl $0x3, %esi
movl %r12d, %edx
callq 0x291e
movq -0x100(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
jne 0x3250
leaq -0xf8(%rbp), %rdi
movl $0x1, %esi
movl %r12d, %edx
callq 0x291e
leaq -0xf0(%rbp), %rdi
movl $0x3, %esi
movl %r12d, %edx
callq 0x291e
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x35fc
leaq -0x50(%rbp), %rdi
callq 0x40d8
testl %r12d, %r12d
jle 0x32e4
leal -0x1(%r12), %r14d
leaq -0xe8(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0xe8(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
je 0x32e4
leaq -0xe0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x291e
leaq -0xd8(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2e78
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x40d8
cmpl $0x6, %r12d
jg 0x35a3
movl %r12d, %r14d
incl %r14d
leaq -0xd0(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0xd0(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
je 0x35a3
leaq -0xc8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x291e
leaq -0xc0(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2e78
jmp 0x358b
movq -0x30(%rbp), %rax
leal -0x1(%rax), %r13d
leaq -0xb8(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x291e
movq -0xb8(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
jne 0x33f9
leaq -0xb0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x291e
leaq -0xa8(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x291e
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2e78
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x40d8
cmpl $0x6, -0x30(%rbp)
jne 0x34a5
leaq -0xa0(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x291e
movq -0xa0(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
jne 0x34a5
leaq -0x98(%rbp), %rdi
movl $0x4, %esi
movl %r12d, %edx
callq 0x291e
movq -0x98(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
jne 0x34a5
leaq -0x90(%rbp), %rdi
movl $0x6, %esi
movl %r12d, %edx
callq 0x291e
leaq -0x88(%rbp), %rdi
movl $0x4, %esi
movl %r12d, %edx
callq 0x291e
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x35fc
leaq -0x50(%rbp), %rdi
callq 0x40d8
testl %r12d, %r12d
jle 0x3523
leal -0x1(%r12), %r14d
leaq -0x80(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0x80(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
je 0x3523
leaq -0x78(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x291e
leaq -0x70(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2e78
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x40d8
cmpl $0x6, %r12d
jg 0x35a3
movl %r12d, %r14d
incl %r14d
leaq -0x68(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0x68(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
testq %rax, %rax
je 0x35a3
leaq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %r12d, %edx
callq 0x291e
leaq -0x58(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4058
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2e78
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x40d8
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35ca
jmp 0x35ca
jmp 0x35e8
jmp 0x35e8
jmp 0x35ca
jmp 0x35ca
jmp 0x35ca
jmp 0x35ca
jmp 0x35ca
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x40d8
jmp 0x35eb
jmp 0x35e8
jmp 0x35e8
jmp 0x35e8
jmp 0x35e8
jmp 0x35e8
jmp 0x35e8
jmp 0x35e8
jmp 0x35e8
movq %rax, %r14
movq %rbx, %rdi
callq 0x2b00
movq %r14, %rdi
callq 0x21d0
nop