// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x8(%rdi)
jne 0x2c57
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %rsi
movups %xmm0, 0x8(%rsi)
andq $0x0, 0x18(%rsi)
movl 0x4(%r14), %eax
movl %eax, (%rsi)
andl $0x0, 0x4(%rsi)
movq %rbx, %rdi
callq 0x484c
movq 0x20(%r14), %r15
movq 0x28(%r14), %r13
pushq $0x1
popq %r12
cmpq %r13, %r15
je 0x2dac
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
pushq $0x7
popq %rcx
callq 0x2dbc
movb 0x8(%r14), %bpl
testb %bpl, %bpl
jne 0x2c9b
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
pushq $0x6
popq %rcx
callq 0x2dbc
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2cb6
movl 0x4(%r14), %esi
movq %r15, %rdi
xorl %edx, %edx
movl %r12d, %ecx
callq 0x3243
testb %al, %al
jne 0x2cc4
cmpl $0x0, 0x14(%r14)
jle 0x2cd9
cmpl $0x0, 0x18(%r14)
jne 0x2cd9
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x2dbc
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2cf5
movl 0x4(%r14), %esi
movq %r15, %rdi
movl %r12d, %edx
movl %r12d, %ecx
callq 0x3243
testb %al, %al
jne 0x2d03
cmpl $0x0, 0x14(%r14)
jle 0x2d29
cmpl $0x1, 0x18(%r14)
jne 0x2d29
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
pushq $0x2
popq %rcx
callq 0x2dbc
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
pushq $0x3
popq %rcx
callq 0x2dbc
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2d45
movl 0x4(%r14), %esi
movq %r15, %rdi
pushq $0x2
popq %rdx
movl %r12d, %ecx
callq 0x3243
testb %al, %al
jne 0x2d53
cmpl $0x0, 0x14(%r14)
jle 0x2d68
cmpl $0x2, 0x18(%r14)
jne 0x2d68
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
pushq $0x4
popq %rcx
callq 0x2dbc
movb 0x8(%r14), %bpl
testb $0x1, %bpl
jne 0x2d84
movl 0x4(%r14), %esi
movq %r15, %rdi
pushq $0x3
popq %rdx
movl %r12d, %ecx
callq 0x3243
testb %al, %al
jne 0x2d92
cmpl $0x0, 0x14(%r14)
jle 0x2da3
cmpl $0x3, 0x18(%r14)
jne 0x2da3
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
pushq $0x5
popq %rcx
callq 0x2dbc
addq $0x38, %r15
jmp 0x2c63
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop