// File: /workspace/github_cpp_makefile_star2_O1/IncredibleHannes[P]QMUL-ChessGame/src/Model/Chessman/Knight.cpp
// Function: Knight::getPossibleMoves[abi:cxx11](Board const&) const
std::list<Move> Knight::getPossibleMoves(const Board &board) const {
  std::list<Move> moves;
  if (!isCaptured()) {
    int x = this->getCurrentPosition().getX();
    int y = this->getCurrentPosition().getY();
    std::list<Position> positions = {
      Position(x + 2, y - 1), Position(x + 1, y - 2), Position(x + 2, y + 1),
      Position(x + 1, y + 2), Position(x - 2, y - 1), Position(x - 1, y - 2),
      Position(x - 2, y + 1),  Position(x - 1, y + 2)
    };

    for (Position p : positions) {
      if (p.isValid())
      { moves.push_back(Move(Position(x, y), p)); }
    }
  }
  return moves;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
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 0x2d69
movq %r14, %rdi
callq 0x3852
leaq -0x90(%rbp), %rdi
movq %rax, (%rdi)
callq 0x2956
movq %rax, -0x30(%rbp)
movq %r14, %rdi
callq 0x3852
leaq -0x90(%rbp), %rdi
movq %rax, (%rdi)
callq 0x295e
movl %eax, %r15d
movq -0x30(%rbp), %rax
leal 0x2(%rax), %r14d
leal -0x1(%r15), %r13d
leaq -0x90(%rbp), %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x291e
leaq -0x88(%rbp), %rdi
movq -0x30(%rbp), %rax
leal 0x1(%rax), %r12d
leal -0x2(%r15), %edx
movl %r12d, %esi
movl %edx, -0x38(%rbp)
callq 0x291e
leaq -0x80(%rbp), %rdi
leal 0x1(%r15), %edx
movl %r14d, %esi
movl %edx, -0x44(%rbp)
callq 0x291e
leaq -0x78(%rbp), %rdi
leal 0x2(%r15), %r14d
movl %r12d, %esi
movl %r14d, %edx
callq 0x291e
leaq -0x70(%rbp), %rdi
movq -0x30(%rbp), %rax
leal -0x2(%rax), %r12d
movl %r12d, %esi
movl %r13d, %edx
callq 0x291e
leaq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rax
leal -0x1(%rax), %r13d
movl %r13d, %esi
movl -0x38(%rbp), %edx
callq 0x291e
leaq -0x60(%rbp), %rdi
movl %r12d, %esi
movl -0x44(%rbp), %edx
callq 0x291e
leaq -0x58(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x291e
movq %r15, -0x38(%rbp)
leaq -0xa8(%rbp), %r12
leaq -0x90(%rbp), %rsi
leaq -0x40(%rbp), %rcx
movl $0x8, %edx
movq %r12, %rdi
callq 0x2dce
movq -0xa8(%rbp), %r15
cmpq %r12, %r15
je 0x2d4d
leaq -0x40(%rbp), %r13
leaq -0x90(%rbp), %r14
movq 0x10(%r15), %rax
movq %rax, -0x40(%rbp)
movq %r13, %rdi
callq 0x2968
testb %al, %al
je 0x2d45
leaq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x291e
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x4058
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2e78
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq %r14, %rdi
callq 0x40d8
movq (%r15), %r15
cmpq %r12, %r15
jne 0x2cee
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d69
movq (%rdi), %r14
callq 0x2100
movq %r14, %rdi
cmpq %r12, %r14
jne 0x2d59
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d86
jmp 0x2d86
jmp 0x2d86
jmp 0x2d86
movq %rax, %r14
jmp 0x2dbd
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x40d8
jmp 0x2da1
jmp 0x2d9e
movq %rax, %r14
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2dbd
movq (%rdi), %r15
callq 0x2100
movq %r15, %rdi
cmpq %r12, %r15
jne 0x2dad
movq %rbx, %rdi
callq 0x2b00
movq %r14, %rdi
callq 0x21d0
nop