// File: /workspace/github_cpp_makefile_star2_O1/ttencate[P]pickomino/pickomino.cc
// Function: main
int main(int argc, char const *const *argv) {
  // for (Roll roll : Roll::allWithDice(2)) {
  //   cout << roll.dice() << ' ' << roll.probability() << '\n';
  // }
  // for (int i = 1; i <= 8; i++) {
  //   cout << i << ' ' << Roll::allWithDice(i).size() << '\n';
  // }
  // return 0;

  int games = 1;
  if (argc > 1) {
    games = atoi(argv[1]);
  }
  if (argc > 2) {
    seedRandom(atoi(argv[2]));
  }

  int optimalWins = 0;
  int simpleWins = 0;
  int ties = 0;
  while (games--) {
    vector<shared_ptr<Strategy>> strategies;
    strategies.push_back(shared_ptr<Strategy>(new OptimalBot("Alice")));
    strategies.push_back(shared_ptr<Strategy>(new SimpleBot("Bob")));
    Game game(strategies, games % 2);
    game.playToEnd();
    switch (game.winner()) {
      case 0:
        optimalWins++;
        break;
      case 1:
        simpleWins++;
        break;
      default:
        ties++;
        break;
    }
  }
  cout << '\n';
  cout << "Alice wins " << optimalWins << " times\n";
  cout << "Bob wins " << simpleWins << " times\n";
  if (ties) {
    cout << "There were " << ties << " ties\n";
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movl $0x1, %r14d
cmpl $0x2, %edi
jl 0x4e7d
movq 0x8(%rbx), %rdi
callq 0x21e0
movl %eax, %r14d
cmpl $0x3, %ebp
jl 0x4e92
movq 0x10(%rbx), %rdi
callq 0x21e0
movl %eax, %edi
callq 0x608a
testl %r14d, %r14d
je 0x5067
decl %r14d
movl $0x0, 0x4(%rsp)
leaq 0x50(%rsp), %rbp
leaq 0x70(%rsp), %rbx
leaq 0xc0(%rsp), %r12
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0xa0, %edi
callq 0x2160
movq %rax, %r13
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rbp, %rdi
leaq 0x25bc(%rip), %rsi      # 0x74b6
leaq 0x25ba(%rip), %rdx      # 0x74bb
callq 0x5ab2
movq %rbp, %rsi
movb $0x1, %bpl
movq %r13, %rdi
movq %rsi, %r15
callq 0x520a
movq %r13, 0x70(%rsp)
xorl %ebp, %ebp
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
callq 0x5b42
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x5bde
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
leaq 0x30(%rsp), %rbp
je 0x4f4c
callq 0x55da
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x4f60
callq 0x2140
movl $0x28, %edi
callq 0x2160
movq %rax, %r13
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rbp, %rdi
leaq 0x253b(%rip), %rsi      # 0x74bc
leaq 0x2537(%rip), %rdx      # 0x74bf
callq 0x5ab2
movq %rbp, %rsi
movb $0x1, %bpl
movq %r13, %rdi
callq 0x52e0
movq %r13, 0x70(%rsp)
xorl %ebp, %ebp
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
callq 0x5d88
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x5bde
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
movq %r15, %rbp
je 0x4fce
callq 0x55da
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4fe2
callq 0x2140
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x5372
movl %r14d, %eax
shrl $0x1f, %eax
addl %r14d, %eax
andl $-0x2, %eax
movl %r14d, %edx
subl %eax, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5410
movq %r12, %rdi
callq 0x559a
movq %rbx, %rdi
callq 0x33b8
movq %rbx, %rdi
callq 0x3512
testl %eax, %eax
je 0x5032
cmpl $0x1, %eax
jne 0x5038
incl 0xc(%rsp)
jmp 0x503c
incl 0x8(%rsp)
jmp 0x503c
incl 0x4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x365e
movq %rbx, %rdi
callq 0x566e
leaq 0x10(%rsp), %rdi
callq 0x559a
addl $-0x1, %r14d
jb 0x4ec8
jmp 0x507f
movl $0x0, 0x8(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x4(%rsp)
leaq 0x70(%rsp), %rsi
movb $0xa, (%rsi)
movq 0x5f42(%rip), %rbx      # 0xafd0
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2180
leaq 0x241e(%rip), %rsi      # 0x74c0
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2180
movq %rbx, %rdi
movl 0x8(%rsp), %esi
callq 0x2230
leaq 0x240a(%rip), %r14      # 0x74cc
movl $0x7, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
leaq 0x23fb(%rip), %rsi      # 0x74d4
movl $0x9, %edx
movq %rbx, %rdi
callq 0x2180
movq %rbx, %rdi
movl 0xc(%rsp), %esi
callq 0x2230
movl $0x7, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
movl 0x4(%rsp), %ebp
testl %ebp, %ebp
je 0x5143
movq 0x5ebf(%rip), %rbx      # 0xafd0
leaq 0x23c6(%rip), %rsi      # 0x74de
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2180
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2230
leaq 0x23b4(%rip), %rsi      # 0x74ea
movl $0x6, %edx
movq %rax, %rdi
callq 0x2180
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5191
jmp 0x5173
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x516d
callq 0x55da
xorl %ebp, %ebp
jmp 0x51c7
jmp 0x5191
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x51ea
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x518d
callq 0x55da
xorl %ebp, %ebp
jmp 0x51d6
movq %rax, %rbx
jmp 0x51f7
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x559a
jmp 0x51f7
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x365e
leaq 0x70(%rsp), %rdi
callq 0x566e
jmp 0x51f7
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
jmp 0x51e0
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x51ea
callq 0x2140
testb %bpl, %bpl
je 0x51f7
movq %r13, %rdi
callq 0x2140
leaq 0x10(%rsp), %rdi
callq 0x559a
movq %rbx, %rdi
callq 0x2240
nop