// File: /workspace/github_cpp_makefile_star2_O3/czinn[P]homeworlds/game.cc
// Function: Game::legal_actions(std::vector<Action, std::allocator<Action>>&) const
void Game::legal_actions(std::vector<Action>& result) const {
  if (done_main_action_) {
    result.push_back(Action{cur_player_, PASS});
  }

  for (const System& system : systems_) {
    legal_system_actions(result, system, CATASTROPHE);

    if (!done_main_action_) {
      legal_system_actions(result, system, SACRIFICE);
    }

    if ((!done_main_action_ && colour_available(system, cur_player_, RED)) ||
        (sacrifice_actions_ > 0 && sacrifice_colour_ == RED)) {
      legal_system_actions(result, system, ATTACK);
    }

    if ((!done_main_action_ && colour_available(system, cur_player_, YELLOW)) ||
        (sacrifice_actions_ > 0 && sacrifice_colour_ == YELLOW)) {
      legal_system_actions(result, system, DISCOVER);
      legal_system_actions(result, system, TRAVEL);
    }

    if ((!done_main_action_ && colour_available(system, cur_player_, GREEN)) ||
        (sacrifice_actions_ > 0 && sacrifice_colour_ == GREEN)) {
      legal_system_actions(result, system, BUILD);
    }

    if ((!done_main_action_ && colour_available(system, cur_player_, BLUE)) ||
        (sacrifice_actions_ > 0 && sacrifice_colour_ == BLUE)) {
      legal_system_actions(result, system, TRADE);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x8(%rdi)
jne 0x2e2a
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
movl 0x4(%r14), %eax
movl %eax, (%rsp)
movl $0x0, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2e1f
movups (%rsp), %xmm0
movups 0x10(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, 0x8(%rbx)
jmp 0x2e2a
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x4b9c
movq 0x20(%r14), %r15
movq 0x28(%r14), %r12
cmpq %r12, %r15
je 0x2f97
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x7, %ecx
callq 0x2fa4
movb 0x8(%r14), %bpl
testb %bpl, %bpl
jne 0x2e6e
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x6, %ecx
callq 0x2fa4
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2e8b
movl 0x4(%r14), %esi
movq %r15, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x34c7
testb %al, %al
jne 0x2e99
cmpl $0x0, 0x14(%r14)
jle 0x2eb0
cmpl $0x0, 0x18(%r14)
jne 0x2eb0
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x2fa4
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2ed0
movl 0x4(%r14), %esi
movq %r15, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x34c7
testb %al, %al
jne 0x2ede
cmpl $0x0, 0x14(%r14)
jle 0x2f08
cmpl $0x1, 0x18(%r14)
jne 0x2f08
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x2, %ecx
callq 0x2fa4
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x3, %ecx
callq 0x2fa4
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2f28
movl 0x4(%r14), %esi
movq %r15, %rdi
movl $0x2, %edx
movl $0x1, %ecx
callq 0x34c7
testb %al, %al
jne 0x2f36
cmpl $0x0, 0x14(%r14)
jle 0x2f4d
cmpl $0x2, 0x18(%r14)
jne 0x2f4d
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x4, %ecx
callq 0x2fa4
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2f6d
movl 0x4(%r14), %esi
movq %r15, %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x34c7
testb %al, %al
jne 0x2f7b
cmpl $0x0, 0x14(%r14)
jle 0x2f8e
cmpl $0x3, 0x18(%r14)
jne 0x2f8e
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x5, %ecx
callq 0x2fa4
addq $0x38, %r15
jmp 0x2e32
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq