// File: /workspace/github_cpp_makefile_star2_O3/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 0x2dc6
movq 0x50(%rsp), %r12
movq 0x58(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq %rax, %r12
je 0x5e65
movq 0x10(%rsp), %rax
leaq 0x20(%rax), %rcx
movq %rcx, 0x28(%rsp)
addq $0x38, %rax
movq %rax, 0x20(%rsp)
cmpl $0x0, 0x4(%r12)
je 0x5d8c
movl $0x68, %edi
callq 0x21c0
movq %rax, %r15
movq 0x10(%rsp), %rax
movups (%rax), %xmm0
movups 0xc(%rax), %xmm1
movups %xmm1, 0xc(%r15)
movups %xmm0, (%r15)
leaq 0x20(%r15), %rbx
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0x6e36
movq %r15, %r14
addq $0x38, %r14
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x6f7c
movq %r15, %rdi
movq %r12, %rsi
callq 0x357c
movq %rbx, 0x78(%rsp)
leaq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq %r15, %rdx
callq 0x5b52
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbx
cmpq %rbx, %r13
je 0x5d53
movq (%r13), %rax
movq %rax, 0x8(%rsp)
movq (%rax), %rdi
callq 0x29de
movl %eax, %ecx
cltq
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %r8
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x5ce4
movq %rdx, %rsi
movq (%rax), %r9
cmpl 0x8(%r9), %ecx
je 0x5cc3
movq (%r9), %r9
testq %r9, %r9
je 0x5ce4
movslq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rsi, %rdx
jne 0x5ce4
cmpl %edi, %ecx
jne 0x5ca6
movq 0x8(%rsp), %rbp
testq %rbp, %rbp
je 0x5cd5
movq %rbp, %rdi
callq 0x58d8
movl $0x58, %esi
movq %rbp, %rdi
callq 0x21d0
jmp 0x5d41
movq 0x8(%rsp), %rdi
movq 0x18(%rdi), %rax
cmpq 0x20(%rdi), %rax
je 0x5d0d
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm1, -0x10(%rax)
movups %xmm0, -0x20(%rax)
addq $-0x20, 0x18(%rdi)
jmp 0x5d1e
addq $0x8, %rdi
movq %r12, %rsi
callq 0x7bca
movq 0x8(%rsp), %rdi
movq (%rdi), %rdi
callq 0x29de
movl %eax, 0x4(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x7de8
addq $0x8, %r13
cmpq %rbx, %r13
jne 0x5c67
movq 0x30(%rsp), %r13
testq %r13, %r13
je 0x5d68
movq 0x40(%rsp), %rsi
subq %r13, %rsi
movq %r13, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x44c2
movq 0x78(%rsp), %rdi
callq 0x4300
movl $0x68, %esi
movq %r15, %rdi
callq 0x21d0
jmp 0x5e56
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), %r15
movq %r15, %rdi
movq 0x28(%rsp), %rsi
callq 0x6e36
movq %rbx, %rdi
addq $0x38, %rdi
movq 0x20(%rsp), %rsi
callq 0x6f7c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x357c
movq %rbx, %rdi
callq 0x29de
movl %eax, 0x4(%rsp)
movl $0x58, %edi
callq 0x21c0
movq %rax, %r15
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 0x771e
movq %r15, 0x8(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x792a
addq $0x20, %r12
cmpq 0x70(%rsp), %r12
jne 0x5bdf
xorps %xmm0, %xmm0
movq 0x18(%rsp), %r15
movups %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movq 0x90(%rsp), %rbx
testq %rbx, %rbx
je 0x5eae
leaq 0x10(%rbx), %rdx
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x5ea1
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0x5ea9
movq %r15, %rdi
callq 0x7eae
movq (%rbx), %rbx
jmp 0x5e81
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5ec5
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x80(%rsp), %rdi
callq 0x7126
movq %r15, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5f4f
movq %rax, %r14
movq %rbx, %rdi
callq 0x7196
movl $0x58, %esi
jmp 0x5f46
jmp 0x5f4f
movq %rax, %r14
movq %r15, %rdi
callq 0x4300
jmp 0x5f0f
jmp 0x5f4f
movq %rax, %r14
movl $0x68, %esi
movq %rbx, %rdi
jmp 0x5f6d
jmp 0x5f4f
movq %rax, %r14
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5f72
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
jmp 0x5f6a
movq %rax, %r14
jmp 0x5f41
movq %rax, %r14
movq %rbx, %rdi
callq 0x4300
movl $0x68, %esi
movq %r15, %rdi
jmp 0x5f6d
jmp 0x5f4f
jmp 0x5f4f
movq %rax, %r14
jmp 0x5f72
jmp 0x5f58
jmp 0x5f58
movq %rax, %r14
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5f72
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5f89
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
leaq 0x80(%rsp), %rdi
callq 0x7126
movq %r14, %rdi
callq 0x22d0