// File: /workspace/github_cpp_makefile_star2_O3/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 0x37c2
testb %al, %al
jne 0x2d76
movq %r14, %rdi
callq 0x384e
leaq -0x90(%rbp), %rdi
movq %rax, (%rdi)
callq 0x2962
movq %rax, -0x30(%rbp)
movq %r14, %rdi
callq 0x384e
leaq -0x90(%rbp), %rdi
movq %rax, (%rdi)
callq 0x296a
movl %eax, %ecx
movq -0x30(%rbp), %rax
leal 0x2(%rax), %r13d
movq %rcx, -0x38(%rbp)
leal -0x1(%rcx), %r15d
leaq -0x90(%rbp), %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0x292a
leaq -0x88(%rbp), %rdi
movq -0x30(%rbp), %rax
leal 0x1(%rax), %r14d
movq -0x38(%rbp), %rax
leal -0x2(%rax), %edx
movl %r14d, %esi
movl %edx, -0x44(%rbp)
callq 0x292a
leaq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rax
leal 0x1(%rax), %r12d
movl %r13d, %esi
movl %r12d, %edx
callq 0x292a
leaq -0x78(%rbp), %rdi
movq -0x38(%rbp), %rax
leal 0x2(%rax), %r13d
movl %r14d, %esi
movl %r13d, %edx
callq 0x292a
leaq -0x70(%rbp), %rdi
movq -0x30(%rbp), %rax
leal -0x2(%rax), %r14d
movl %r14d, %esi
movl %r15d, %edx
callq 0x292a
leaq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rax
leal -0x1(%rax), %r15d
movl %r15d, %esi
movl -0x44(%rbp), %edx
callq 0x292a
leaq -0x60(%rbp), %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x292a
leaq -0x58(%rbp), %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x292a
leaq -0xa8(%rbp), %r12
leaq -0x90(%rbp), %rsi
leaq -0x40(%rbp), %rcx
movl $0x8, %edx
movq %r12, %rdi
callq 0x2dda
movq -0xa8(%rbp), %r13
cmpq %r12, %r13
je 0x2d5d
leaq -0x40(%rbp), %r14
leaq -0x90(%rbp), %r15
movq 0x10(%r13), %rax
movq %rax, -0x40(%rbp)
movq %r14, %rdi
callq 0x2974
testb %al, %al
je 0x2d4d
leaq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x292a
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0x4040
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2e84
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq %r15, %rdi
callq 0x40c0
movq (%r13), %r13
cmpq %r12, %r13
jne 0x2cf6
movq -0xa8(%rbp), %r13
cmpq %r12, %r13
je 0x2d76
movq (%r13), %r14
movq %r13, %rdi
callq 0x2100
movq %r14, %r13
cmpq %r12, %r14
jne 0x2d62
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d93
jmp 0x2d93
jmp 0x2d93
jmp 0x2d93
movq %rax, %r14
jmp 0x2dca
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x40c0
jmp 0x2dae
jmp 0x2dab
movq %rax, %r14
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2dca
movq (%rdi), %r15
callq 0x2100
movq %r15, %rdi
cmpq %r12, %r15
jne 0x2dba
movq %rbx, %rdi
callq 0x2b06
movq %r14, %rdi
callq 0x21d0