// File: /workspace/github_cpp_makefile_star2_O2/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, 0x48(%rsp)
movq %rdi, 0x40(%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 0x60(%rsp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %rdx, 0x18(%rsp)
movq %rdx, %rdi
callq 0x2c1a
movq 0x60(%rsp), %r12
movq 0x68(%rsp), %rax
movq %rax, 0x50(%rsp)
pushq $0x68
popq %rbp
leaq 0x80(%rsp), %r13
leaq 0x8(%rsp), %r15
cmpq 0x50(%rsp), %r12
je 0x5c49
cmpl $0x0, 0x4(%r12)
je 0x5bc0
movq %rbp, %rdi
callq 0x21e0
movq %rax, %rbx
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x69d0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32e0
leaq 0x20(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rbx, 0x58(%rsp)
movq %rbx, %rdx
callq 0x5a42
movq 0x20(%rsp), %rbp
movq 0x28(%rsp), %r14
cmpq %r14, %rbp
je 0x5b96
movq (%rbp), %rax
movq %rax, 0x10(%rsp)
movq (%rax), %rdi
callq 0x28d0
movl %eax, 0x8(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x7b80
movq 0x10(%rsp), %rbx
testq %rax, %rax
je 0x5b60
testq %rbx, %rbx
je 0x5b53
movq %rbx, %rdi
callq 0x57f0
movq %rbx, %rdi
pushq $0x58
popq %rsi
callq 0x21f0
jmp 0x5b90
addq $0x8, %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6a6a
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x28d0
movl %eax, 0x8(%rsp)
movq %r13, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x7dcc
addq $0x8, %rbp
jmp 0x5b17
leaq 0x20(%rsp), %rdi
callq 0x6ee6
movq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x691c
movq %rbx, %rdi
pushq $0x68
popq %rbp
movq %rbp, %rsi
callq 0x21f0
jmp 0x5c40
movq %rbp, %rdi
callq 0x21e0
movq %rax, %r14
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x69d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x32e0
movq %r14, %rdi
callq 0x28d0
movl %eax, 0x8(%rsp)
pushq $0x58
popq %rdi
callq 0x21e0
movq %rax, %rbx
movq %r14, (%rax)
movq %rax, %rdi
addq $0x8, %rdi
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
leaq 0x20(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x6a26
movq %rbx, 0x10(%rsp)
movq %r13, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x783c
addq $0x20, %r12
jmp 0x5abc
xorps %xmm0, %xmm0
movq 0x40(%rsp), %rbx
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x90(%rsp), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x5c77
leaq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x6a8e
jmp 0x5c61
leaq 0x60(%rsp), %rdi
callq 0x6eae
leaq 0x80(%rsp), %rdi
callq 0x6d52
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5cd9
movq %rax, %r15
pushq $0x58
jmp 0x5cc4
jmp 0x5cd9
movq %rax, %r15
pushq $0x68
popq %rsi
movq %r14, %rdi
jmp 0x5cc8
jmp 0x5cd9
jmp 0x5cd9
jmp 0x5cd9
movq %rax, %r15
pushq $0x68
popq %rsi
movq %rbx, %rdi
callq 0x21f0
jmp 0x5cef
jmp 0x5cd9
movq %rax, %r15
movq %rbx, %rdi
jmp 0x5cea
movq %rax, %r15
jmp 0x5cef
jmp 0x5ce2
jmp 0x5ce2
movq %rax, %r15
leaq 0x20(%rsp), %rdi
callq 0x6ee6
leaq 0x60(%rsp), %rdi
callq 0x6eae
leaq 0x80(%rsp), %rdi
callq 0x6d52
movq %r15, %rdi
callq 0x2300