// File: /workspace/github_cpp_makefile_star2_O1/czinn[P]homeworlds/negamax.cc
// Function: Negamax::get_turns(Game const*)
std::vector<Turn*> Negamax::get_turns(const Game *game) {
  std::unordered_map<int, Turn*> result;
  std::vector<Action> actions;
  game->legal_actions(actions);

  for (Action& action : actions) {
    if (action.type == PASS) {
      Game *g = new Game(*game);
      g->perform_action(action);
      result.emplace(g->hash(), new Turn{g, std::deque<Action>({action})});
      continue;
    }

    Game *g = new Game(*game);
    g->perform_action(action);
    for (Turn *turn : get_turns(g)) {
      if (result.count(turn->game->hash()) == 0) {
        turn->actions.push_front(action);
        result.emplace(turn->game->hash(), turn);
      } else {
        delete turn;
      }
    }
    delete g;
  }

  std::vector<Turn*> real_result;
  for (const auto& p : result) {
    real_result.push_back(p.second);
  }
  return real_result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, 0x68(%rsp)
movq %rdi, 0x18(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0x50(%rsp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rdx, 0x10(%rsp)
movq %rdx, %rdi
callq 0x2dfc
movq 0x50(%rsp), %r12
movq 0x58(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq %rax, %r12
je 0x5f34
movq 0x10(%rsp), %rax
leaq 0x20(%rax), %rcx
movq %rcx, 0x28(%rsp)
addq $0x38, %rax
movq %rax, 0x20(%rsp)
cmpl $0x0, 0x4(%r12)
je 0x5e5b
movl $0x68, %edi
callq 0x21c0
movq %rax, %rbp
movq 0x10(%rsp), %rax
movups (%rax), %xmm0
movups 0xc(%rax), %xmm1
movups %xmm1, 0xc(%rbp)
movups %xmm0, (%rbp)
leaq 0x20(%rbp), %rbx
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0x6ff4
movq %rbp, %r14
addq $0x38, %r14
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x713a
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3644
movq %rbx, 0x78(%rsp)
leaq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq %rbp, %rdx
callq 0x5c5c
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %r13
cmpq %r13, %r15
je 0x5e20
movq (%r15), %rax
movq %rax, 0x8(%rsp)
movq (%rax), %rdi
callq 0x2a0c
movl %eax, 0x4(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x7da4
movq 0x8(%rsp), %rbx
testq %rax, %rax
je 0x5dbc
testq %rbx, %rbx
je 0x5e17
movq %rbx, %rdi
callq 0x59cc
movl $0x58, %esi
movq %rbx, %rdi
callq 0x21d0
jmp 0x5e17
movq 0x18(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0x5de0
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, -0x10(%rax)
movups %xmm0, -0x20(%rax)
addq $-0x20, 0x18(%rbx)
jmp 0x5def
addq $0x8, %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7dd8
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x2a0c
movl %eax, 0x4(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x7ff6
addq $0x8, %r15
jmp 0x5d67
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5e37
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq %r14, %rdi
callq 0x45a4
movq 0x78(%rsp), %rdi
callq 0x43d8
movl $0x68, %esi
movq %rbp, %rdi
callq 0x21d0
jmp 0x5f25
movl $0x68, %edi
callq 0x21c0
movq %rax, %rbx
movq 0x10(%rsp), %rax
movups (%rax), %xmm0
movups 0xc(%rax), %xmm1
movups %xmm1, 0xc(%rbx)
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %r14
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x6ff4
movq %rbx, %rdi
addq $0x38, %rdi
movq 0x20(%rsp), %rsi
callq 0x713a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3644
movq %rbx, %rdi
callq 0x2a0c
movl %eax, 0x4(%rsp)
movl $0x58, %edi
callq 0x21c0
movq %rax, %r14
movq %rbx, (%rax)
movq %rax, %rbx
addq $0x8, %rbx
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rax)
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x28(%rax)
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x78aa
movq %r14, 0x8(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x7ab6
addq $0x20, %r12
cmpq 0x70(%rsp), %r12
jne 0x5ce9
xorps %xmm0, %xmm0
movq 0x18(%rsp), %r14
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movq 0x90(%rsp), %rbx
testq %rbx, %rbx
je 0x5f7d
leaq 0x10(%rbx), %rdx
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x5f70
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r14)
jmp 0x5f78
movq %r14, %rdi
callq 0x80c4
movq (%rbx), %rbx
jmp 0x5f50
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5f94
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x80(%rsp), %rdi
callq 0x72e4
movq %r14, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x602c
movq %rax, %r15
movq %rbx, %rdi
callq 0x7354
movb $0x1, %al
jmp 0x5fea
jmp 0x602c
movq %rax, %r15
movq %r14, %rdi
callq 0x43d8
jmp 0x5fdb
jmp 0x602c
movq %rax, %r15
movl $0x68, %esi
movq %rbx, %rdi
jmp 0x604a
movq %rax, %r15
xorl %eax, %eax
testb %al, %al
je 0x604f
movl $0x58, %esi
movq %r14, %rdi
jmp 0x604a
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x604f
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
jmp 0x6047
jmp 0x602c
movq %rax, %r15
jmp 0x6020
movq %rax, %r15
movq %rbx, %rdi
callq 0x43d8
movl $0x68, %esi
movq %rbp, %rdi
jmp 0x604a
jmp 0x602c
movq %rax, %r15
jmp 0x604f
jmp 0x6035
jmp 0x6035
movq %rax, %r15
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x604f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x6066
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x80(%rsp), %rdi
callq 0x72e4
movq %r15, %rdi
callq 0x22d0
nop