// File: czinn[P]homeworlds/game.cc
// Function: Game::hash_string[abi:cxx11]() const
std::string Game::hash_string() const {
  std::string h = "";
  // maximum compression! fails for more than 7 players
  // TODO: adapt for more than 7 players, or forbid games from having more than
  // 7 players
  h += (char)(num_players_ << 4 | cur_player_);
  h += (char)(done_main_action_ << 7 | homeworlds_built_ << 4 |
              sacrifice_actions_ << 2 | sacrifice_colour_);
  std::set<std::string> system_hashes;
  for (const System& system : systems_) {
    system_hashes.insert(::hash_string(system));
  }
  for (std::string str : system_hashes) {
    h += str;
  }
  return h;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0xf0(%rbp)
movq %rdi, %rax
movq %rax, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
movb $0x0, -0x11(%rbp)
leaq -0x12(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x33d0
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rdx
leaq 0x200ad(%rip), %rsi     # 0x24255
callq 0x8d40
jmp 0x41af
leaq -0x12(%rbp), %rdi
callq 0x3280
movq -0xf8(%rbp), %rcx
movq -0xf0(%rbp), %rdi
movl (%rcx), %eax
movl 0x4(%rcx), %ecx
shll $0x4, %eax
orl %ecx, %eax
movsbl %al, %esi
callq 0x3170
jmp 0x41da
movq -0xf0(%rbp), %rdi
movq -0xf8(%rbp), %rcx
movl 0x8(%rcx), %eax
movl 0xc(%rcx), %edx
shll $0x7, %eax
shll $0x4, %edx
orl %edx, %eax
movl 0x14(%rcx), %edx
shll $0x2, %edx
orl %edx, %eax
movl 0x18(%rcx), %ecx
orl %ecx, %eax
movsbl %al, %esi
callq 0x3170
jmp 0x420d
leaq -0x58(%rbp), %rdi
callq 0x8df0
movq -0xf8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x8ae0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x8b10
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x8b40
testb $0x1, %al
jne 0x4255
jmp 0x4320
leaq -0x68(%rbp), %rdi
callq 0x8b80
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x4430
jmp 0x4274
leaq -0x58(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x8e10
movb %dl, -0x109(%rbp)
movq %rax, -0x108(%rbp)
jmp 0x4293
movb -0x109(%rbp), %al
movq -0x108(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
movb %al, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3160
leaq -0x68(%rbp), %rdi
callq 0x8c40
jmp 0x423f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x3280
jmp 0x4418
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x440c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x43e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3160
jmp 0x43e5
leaq -0x58(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x8e60
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x8e90
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x8ec0
testb $0x1, %al
jne 0x436a
jmp 0x43d0
leaq -0xb8(%rbp), %rdi
callq 0x8ef0
movq %rax, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x30d0
jmp 0x4387
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x32f0
jmp 0x439c
leaq -0xe0(%rbp), %rdi
callq 0x3160
leaq -0xb8(%rbp), %rdi
callq 0x8f10
jmp 0x4351
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x3160
jmp 0x43e5
movb $0x1, -0x11(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8f40
testb $0x1, -0x11(%rbp)
jne 0x43fc
jmp 0x43f0
leaq -0x58(%rbp), %rdi
callq 0x8f40
jmp 0x440c
movq -0xf0(%rbp), %rdi
callq 0x3160
movq -0x100(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0xf0(%rbp), %rdi
callq 0x3160
movq -0x20(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)