// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
movq (%rdx), %rax
movq %rdx, %rdi
callq *0x10(%rax)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rbp
movaps %xmm0, (%rbp)
movq $0x0, 0x10(%rbp)
leaq 0x8481(%rip), %rbx      # 0xb1f0
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x2dac
xorl %edx, %edx
movq (%rax), %rsi
movl (%rsi), %esi
addl 0x10(%rsp,%rsi,4), %edx
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x2d91
cmpl $0x8, %edx
jge 0x2fe7
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq *0x18(%rax)
testb %al, %al
je 0x2fe7
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x2dec
xorl %edx, %edx
movq (%rax), %rsi
movl (%rsi), %esi
addl 0x30(%rsp,%rsi,4), %edx
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x2dd1
movl $0x8, %esi
subl %edx, %esi
jmp 0x2df1
movl $0x8, %esi
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x60f5
movl 0x18(%r15), %eax
movq (%r15), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x81b4(%rip), %rdi      # 0xafd0
callq 0x2180
movq %rax, %r12
movl $0x8, %edx
movq %rax, %rdi
leaq 0x42e0(%rip), %rsi      # 0x7113
callq 0x2180
movq %r12, %rdi
movq %r13, %rsi
callq 0x275c
movb $0xa, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2180
movq 0x40(%rsp), %rax
movq %rax, 0x70(%rsp)
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
setne %r13b
je 0x2eab
movq (%rax), %rdx
movl (%rdx), %edx
cmpl $0x0, 0x10(%rsp,%rdx,4)
jle 0x2ea5
cmpl $0x0, 0x60(%rsp,%rdx,4)
jle 0x2eab
addq $0x8, %rax
jmp 0x2e89
testb $0x1, %r13b
je 0x2f35
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rbx
movq %rbp, %rdx
leaq 0x48(%rsp), %rcx
callq *0x20(%rax)
movq %rax, %r12
movl (%rax), %eax
movl 0x48(%rsp,%rax,4), %ecx
movl %ecx, 0x30(%rsp,%rax,4)
movl 0x18(%r15), %eax
movq (%r15), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x80d9(%rip), %rdi      # 0xafd0
callq 0x2180
movq %rax, %rbp
movl $0x6, %edx
movq %rax, %rdi
leaq 0x4215(%rip), %rsi      # 0x7123
callq 0x2180
movq 0x8(%r12), %r12
testq %r12, %r12
je 0x2f81
movq %r12, %rdi
callq 0x2080
movq %rbp, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x2f9b
movl 0x18(%r15), %eax
movq (%r15), %rcx
leaq (%rax,%rax,4), %rax
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq 0x807d(%rip), %rdi      # 0xafd0
callq 0x2180
movl $0x6, %edx
movq %rax, %rdi
leaq 0x41b5(%rip), %rsi      # 0x711c
callq 0x2180
movq 0x8(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
jmp 0x2fdb
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 0x4180(%rip), %rsi      # 0x712a
callq 0x2180
movq %rbp, %rdi
movq %rbx, %rbp
movq %rbx, %rsi
callq 0x275c
movb $0xa, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2180
leaq 0x8215(%rip), %rbx      # 0xb1f0
testb $0x1, %r13b
jne 0x2d6f
jmp 0x3015
movq 0x7fe2(%rip), %rdi      # 0xafd0
leaq 0x4140(%rip), %rsi      # 0x7135
movl $0x5, %edx
callq 0x2180
movaps 0x30(%rsp), %xmm0
movq 0x8(%rsp), %rcx
movups %xmm0, (%rcx)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rcx)
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop