// File: /workspace/github_cpp_makefile_star2_O1/czinn[P]homeworlds/game.cc
// Function: Game::remove_ship(int, Ship const&)
Ship Game::remove_ship(int system_id, const Ship& ship) {
  auto system = find_if(systems_.begin(), systems_.end(),
      [system_id](const System& s) {
        return s.id == system_id;
      });
  const auto& it = find_if(system->ships.begin(), system->ships.end(),
      [&ship](const Ship& ship2) {
        return ship == ship2;
      });
  if (it != system->ships.end()) {
    stash_[ship.pyramid]++;
    system->ships.erase(it);
  }
  return ship;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq 0x20(%rdi), %r15
movq 0x28(%rdi), %rax
movq %rax, %rdx
subq %r15, %rdx
sarq $0x3, %rdx
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rdx
sarq $0x2, %rdx
testq %rdx, %rdx
jle 0x3aa0
imulq $0xe0, %rdx, %r8
addq %r15, %r8
incq %rdx
addq $0x70, %r15
cmpl %esi, -0x70(%r15)
je 0x3adb
cmpl %esi, -0x38(%r15)
je 0x3ae1
cmpl %esi, (%r15)
je 0x3af0
cmpl %esi, 0x38(%r15)
je 0x3aec
decq %rdx
addq $0xe0, %r15
cmpq $0x1, %rdx
jg 0x3a76
movq %r8, %r15
movq %rax, %rdx
subq %r15, %rdx
sarq $0x3, %rdx
imulq %rcx, %rdx
cmpq $0x1, %rdx
je 0x3ad2
cmpq $0x2, %rdx
je 0x3ac9
cmpq $0x3, %rdx
jne 0x3ae7
cmpl %esi, (%r15)
je 0x3af0
addq $0x38, %r15
cmpl %esi, (%r15)
je 0x3af0
addq $0x38, %r15
cmpl %esi, (%r15)
cmovneq %rax, %r15
jmp 0x3af0
addq $-0x70, %r15
jmp 0x3af0
addq $-0x38, %r15
jmp 0x3af0
movq %rax, %r15
jmp 0x3af0
addq $0x38, %r15
movq 0x20(%r15), %rcx
movq 0x28(%r15), %rax
movq %rax, %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rsi
sarq $0x2, %rsi
testq %rsi, %rsi
jle 0x3ba4
movl (%rbx), %r8d
movl 0x4(%rbx), %r10d
leaq (%rsi,%rsi,2), %r9
shlq $0x4, %r9
addq %rcx, %r9
movl 0x8(%rbx), %r11d
incq %rsi
addq $0x18, %rcx
movq %rcx, %r14
cmpl -0x18(%r14), %r8d
jne 0x3b53
cmpl -0x14(%r14), %r10d
jne 0x3b53
cmpl -0x10(%r14), %r11d
je 0x3c1b
cmpl -0xc(%r14), %r8d
jne 0x3b69
cmpl -0x8(%r14), %r10d
jne 0x3b69
cmpl -0x4(%r14), %r11d
je 0x3c21
cmpl (%r14), %r8d
jne 0x3b7e
cmpl 0x4(%r14), %r10d
jne 0x3b7e
cmpl 0x8(%r14), %r11d
je 0x3c2b
cmpl 0xc(%r14), %r8d
jne 0x3b94
cmpl 0x10(%r14), %r10d
jne 0x3b94
cmpl 0x14(%r14), %r11d
je 0x3c27
decq %rsi
addq $0x30, %r14
cmpq $0x1, %rsi
jg 0x3b3d
movq %r9, %rcx
movq %rax, %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
imulq %rdx, %rsi
cmpq $0x1, %rsi
je 0x3bfb
cmpq $0x2, %rsi
je 0x3be1
movq %rax, %r14
cmpq $0x3, %rsi
jne 0x3c2b
movl (%rbx), %edx
cmpl (%rcx), %edx
jne 0x3bdd
movl 0x4(%rbx), %edx
cmpl 0x4(%rcx), %edx
jne 0x3bdd
movl 0x8(%rcx), %edx
cmpl %edx, 0x8(%rbx)
je 0x3c16
addq $0xc, %rcx
movl (%rbx), %edx
cmpl (%rcx), %edx
jne 0x3bf7
movl 0x4(%rbx), %edx
cmpl 0x4(%rcx), %edx
jne 0x3bf7
movl 0x8(%rcx), %edx
cmpl %edx, 0x8(%rbx)
je 0x3c16
addq $0xc, %rcx
movl (%rbx), %edx
movq %rax, %r14
cmpl (%rcx), %edx
jne 0x3c2b
movl 0x4(%rbx), %edx
xorl 0x4(%rcx), %edx
movl 0x8(%rcx), %esi
xorl 0x8(%rbx), %esi
orl %edx, %esi
cmovneq %rax, %rcx
movq %rcx, %r14
jmp 0x3c2b
addq $-0x18, %r14
jmp 0x3c2b
addq $-0xc, %r14
jmp 0x3c2b
addq $0xc, %r14
cmpq %rax, %r14
je 0x3c5c
addq $0x38, %rdi
leaq 0x4(%rbx), %rsi
callq 0x434e
incl (%rax)
leaq 0xc(%r14), %rsi
movq 0x28(%r15), %rdx
cmpq %rdx, %rsi
je 0x3c57
subq %rsi, %rdx
movq %r14, %rdi
callq 0x2280
addq $-0xc, 0x28(%r15)
movq (%rbx), %rax
movl 0x8(%rbx), %edx
popq %rbx
popq %r14
popq %r15
retq