// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x8(%rdi)
jne 0x2e5a
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movl 0x4(%r14), %eax
movl %eax, (%rsp)
movl $0x0, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2e4f
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, 0x8(%rbx)
jmp 0x2e5a
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x4c8c
movq 0x20(%r14), %r15
movq 0x28(%r14), %r12
cmpq %r12, %r15
je 0x2fb9
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x7, %ecx
callq 0x2fc6
cmpb $0x0, 0x8(%r14)
jne 0x2e98
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x6, %ecx
callq 0x2fc6
cmpb $0x0, 0x8(%r14)
jne 0x2eb6
movl 0x4(%r14), %esi
movq %r15, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x353f
testb %al, %al
jne 0x2ec4
cmpl $0x0, 0x14(%r14)
jle 0x2ed7
cmpl $0x0, 0x18(%r14)
jne 0x2ed7
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x2fc6
cmpb $0x0, 0x8(%r14)
jne 0x2ef8
movl 0x4(%r14), %esi
movq %r15, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x353f
testb %al, %al
jne 0x2f06
cmpl $0x0, 0x14(%r14)
jle 0x2f2c
cmpl $0x1, 0x18(%r14)
jne 0x2f2c
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x2, %ecx
callq 0x2fc6
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x3, %ecx
callq 0x2fc6
cmpb $0x0, 0x8(%r14)
jne 0x2f4d
movl 0x4(%r14), %esi
movq %r15, %rdi
movl $0x2, %edx
movl $0x1, %ecx
callq 0x353f
testb %al, %al
jne 0x2f5b
cmpl $0x0, 0x14(%r14)
jle 0x2f6e
cmpl $0x2, 0x18(%r14)
jne 0x2f6e
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x4, %ecx
callq 0x2fc6
cmpb $0x0, 0x8(%r14)
jne 0x2f8f
movl 0x4(%r14), %esi
movq %r15, %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x353f
testb %al, %al
jne 0x2f9d
cmpl $0x0, 0x14(%r14)
jle 0x2fb0
cmpl $0x3, 0x18(%r14)
jne 0x2fb0
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x5, %ecx
callq 0x2fc6
addq $0x38, %r15
jmp 0x2e62
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop