// File: /workspace/github_cpp_makefile_star2_O3/ttencate[P]pickomino/game.cc
// Function: Game::takeTurn(Strategy&) const
Dice Game::takeTurn(Strategy &strategy) const {
  strategy.prepareTurn(*this);
  Dice taken;
  while (canRoll(taken) && strategy.chooseWhetherToRoll(*this, taken)) {
    Dice roll = randomRoll(NUM_DICE - taken.count());
    cout << currentPlayer().name() << " rolled " << roll << '\n';

    if (!canTakeAny(taken, roll)) {
      cout << currentPlayer().name() << " died\n";
      return Dice();
    }

    DieSide const *side = strategy.chooseSideToTake(*this, taken, roll);
    taken[side] = roll[side];
    cout << currentPlayer().name() << " took " << side->toString() << ", now has " << taken << '\n';
  }
  cout << "Quit\n";
  return taken;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, 0x38(%rsp)
movq (%rdx), %rax
movq %rdx, %rdi
callq *0x10(%rax)
xorps %xmm0, %xmm0
movq %rsp, %rbp
movaps %xmm0, (%rbp)
movq $0x0, 0x10(%rbp)
leaq 0x84ad(%rip), %r12      # 0xb1f0
leaq 0x20(%rsp), %rbx
movq %r15, 0x40(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
movaps (%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq (%r12), %rax
movq 0x8(%r12), %rcx
cmpq %rcx, %rax
je 0x2d8b
xorl %edx, %edx
movq (%rax), %rsi
movl (%rsi), %esi
addl 0x20(%rsp,%rsi,4), %edx
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x2d70
cmpl $0x7, %edx
jg 0x2fce
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq *0x18(%rax)
testb %al, %al
je 0x2fce
movq (%r12), %rax
movq 0x8(%r12), %rcx
movq %r12, %r15
cmpq %rcx, %rax
je 0x2dd2
xorl %edx, %edx
movq (%rax), %rsi
movl (%rsi), %esi
addl (%rsp,%rsi,4), %edx
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x2db5
movq %rbx, %r12
movl $0x8, %esi
subl %edx, %esi
jmp 0x2dda
movq %rbx, %r12
movl $0x8, %esi
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x6012
movl 0x18(%r14), %eax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x81cb(%rip), %rdi      # 0xafd0
callq 0x2180
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
leaq 0x42e7(%rip), %rsi      # 0x7103
callq 0x2180
movq %r13, %rdi
movq %rbx, %rsi
callq 0x275c
movb $0xa, 0x20(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rbx
movq %r12, %rsi
callq 0x2180
movq 0x10(%rsp), %rax
movq %rax, 0x70(%rsp)
movaps (%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %r15, %r12
movq (%r15), %rax
movq 0x8(%r15), %rcx
cmpq %rcx, %rax
movq 0x40(%rsp), %r15
je 0x2f75
movq (%rax), %rdx
movl (%rdx), %edx
cmpl $0x0, 0x20(%rsp,%rdx,4)
jle 0x2e96
cmpl $0x0, 0x60(%rsp,%rdx,4)
jle 0x2ea4
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x2e83
jmp 0x2f75
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
leaq 0x48(%rsp), %rcx
callq *0x20(%rax)
movq %rax, %r13
movl (%rax), %eax
movl 0x48(%rsp,%rax,4), %ecx
movl %ecx, (%rsp,%rax,4)
movl 0x18(%r14), %eax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x80ee(%rip), %rdi      # 0xafd0
callq 0x2180
movq %rax, %rbp
movl $0x6, %edx
movq %rax, %rdi
leaq 0x421a(%rip), %rsi      # 0x7113
callq 0x2180
movq 0x8(%r13), %r13
testq %r13, %r13
je 0x2f1f
movq %r13, %rdi
callq 0x2080
movq %rbp, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x2f39
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %rbp, %rdi
addq %rax, %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x2220
movl $0xa, %edx
movq %rbp, %rdi
leaq 0x41d2(%rip), %rsi      # 0x711a
callq 0x2180
movq %rbp, %rdi
movq %rsp, %rbp
movq %rbp, %rsi
callq 0x275c
movb $0xa, 0x20(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
jmp 0x2d4d
movl 0x18(%r14), %eax
movq (%r14), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x803d(%rip), %rdi      # 0xafd0
callq 0x2180
leaq 0x416d(%rip), %rsi      # 0x710c
movl $0x6, %edx
movq %rax, %rdi
callq 0x2180
xorps %xmm0, %xmm0
movq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7ffb(%rip), %rdi      # 0xafd0
leaq 0x4149(%rip), %rsi      # 0x7125
movl $0x5, %edx
callq 0x2180
movaps (%rsp), %xmm0
movq 0x38(%rsp), %rax
movups %xmm0, (%rax)
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x2fbf
nop