// File: /workspace/github_cpp_makefile_star2_O3/Juan313[P]RockPaperScissor/play_game.cpp
// Function: main
int main()
{
// human tool choice
  char humanChoice; 
// computer tool choice
  char computerChoice; 
  RPSGame* game;
/*******************************
   hr: human rock strength
   hp: human paper strength
   hs: human scissor strength
   cr: computer rock strength
   cp: computer paper strength
   cs: computer scissor strength
**********************************************************/
  int hr,hp,hs,cr,cp,cs;

  // 'n' if the strength for all the tools are 1; 'y' if use customized strength 
  char strengthChoice = Menu::customizeStrength();

  if (strengthChoice =='y')
  {
    // initialized game with all customized strength 
    Menu::getStrength(hr,hp,hs,cr,cp,cs);
    game = new RPSGame(hr,hp,hs,cr,cp,cs);
    std::cout<<"initialized game with customized strength "<<std::endl;
    
    std::cout<<"human rock strength is "<<hr <<std::endl;
    std::cout<<"human paper strength is "<<hp <<std::endl;
    std::cout<<"human scissor strength is "<<hs <<std::endl;
    std::cout<<"computer rock strength is "<<cr <<std::endl;
    std::cout<<"computer paper strength is "<<cp <<std::endl;
    std::cout<<"computer scissor strength is "<<cs <<std::endl;
  }
  else 
  {
    // initialized game with all tools strength equal to 1
    game = new RPSGame(1,1,1,1,1,1);
    std::cout<<"initialized game with all tools strength equal to 1"<<std::endl;
  }

  humanChoice = Menu::getChoice();
  while (humanChoice != 'e') 
  {
    std::string toolName;
    computerChoice = game->computerChoice();
    toolName = getFullName(computerChoice);
    std::cout<<"Computer chose "<<toolName<<std::endl;
    int result = game->play(humanChoice, computerChoice);
    //std::cout << "RESULT: " << result << std::endl;
    if (result == 1) 
    { 
      std::cout<<"Human wins!"<<std::endl; 
    }
    if (result == 2) 
    { 
      std::cout<<"Computer wins!"<<std::endl; 
    }
    if (result == 3) 
    { 
      std::cout<<"It's a tie!"<<std::endl; 
    }
    // display score so far. Need to interface with RPSGame
    game->print_stats();
    humanChoice = Menu::getChoice();
    
  }
  std::cout<<"Thanks for playing. Goodbye! "<<std::endl;
  delete game;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
callq 0x34f8
cmpb $0x79, %al
jne 0x39f2
leaq 0x24(%rsp), %r14
leaq 0x20(%rsp), %r15
leaq 0x1c(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x14(%rsp), %rbp
leaq 0x10(%rsp), %r9
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x35d1
movl $0x48, %edi
callq 0x2170
movq %rax, %rbx
movl (%r14), %esi
movl (%r15), %edx
movl (%r12), %ecx
movl (%r13), %r8d
movl (%rbp), %r9d
leaq 0x10(%rsp), %rax
movl (%rax), %eax
movl %eax, (%rsp)
movq %rbx, %rdi
callq 0x271e
movq 0x37b3(%rip), %r14      # 0x6fd0
leaq 0xa9d(%rip), %rsi       # 0x42c1
movl $0x2a, %edx
movq %r14, %rdi
callq 0x2190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0xa8d(%rip), %rsi       # 0x42ec
movl $0x17, %edx
movq %r14, %rdi
callq 0x2190
movl 0x24(%rsp), %esi
movq %r14, %rdi
callq 0x2230
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0xa5b(%rip), %rsi       # 0x4304
movl $0x18, %edx
movq %r14, %rdi
callq 0x2190
movl 0x20(%rsp), %esi
movq %r14, %rdi
callq 0x2230
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0xa2a(%rip), %rsi       # 0x431d
movl $0x1a, %edx
movq %r14, %rdi
callq 0x2190
movl 0x1c(%rsp), %esi
movq %r14, %rdi
callq 0x2230
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x9fb(%rip), %rsi       # 0x4338
movl $0x1a, %edx
movq %r14, %rdi
callq 0x2190
movl 0x18(%rsp), %esi
movq %r14, %rdi
callq 0x2230
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x9cc(%rip), %rsi       # 0x4353
movl $0x1b, %edx
movq %r14, %rdi
callq 0x2190
movl 0x14(%rsp), %esi
movq %r14, %rdi
callq 0x2230
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x99e(%rip), %rsi       # 0x436f
movl $0x1d, %edx
movq %r14, %rdi
callq 0x2190
movl 0x10(%rsp), %esi
movq %r14, %rdi
callq 0x2230
movq %rax, %r14
movq (%rax), %rax
jmp 0x3a47
movl $0x48, %edi
callq 0x2170
movq %rax, %rbx
movl $0x1, (%rsp)
movq %rax, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x271e
movq 0x35a0(%rip), %r14      # 0x6fd0
leaq 0x956(%rip), %rsi       # 0x438d
movl $0x33, %edx
movq %r14, %rdi
callq 0x2190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
callq 0x372f
cmpb $0x65, %al
je 0x3bc4
movl %eax, %ebp
leaq 0x48(%rsp), %r14
movq 0x354a(%rip), %r12      # 0x6fd0
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq %rbx, %rdi
callq 0x26a0
movsbl %al, %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x3c66
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x21b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x3ade
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2180
movl $0xf, %edx
movq %r12, %rdi
leaq 0x8d4(%rip), %rsi       # 0x43c1
callq 0x2190
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r12, %rdi
callq 0x2190
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movsbl %bpl, %esi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x289a
decl %eax
cmpl $0x3, %eax
jae 0x3b8f
movl %eax, %eax
leaq 0x8e3(%rip), %rcx       # 0x4430
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
leaq 0x8e5(%rip), %rcx       # 0x4440
movq (%rcx,%rax,8), %rdx
movq %r12, %rdi
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x294a
callq 0x372f
movl %eax, %ebp
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3bba
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2180
cmpb $0x65, %bpl
jne 0x3a86
movq 0x3405(%rip), %r14      # 0x6fd0
leaq 0x826(%rip), %rsi       # 0x43f8
movl $0x1d, %edx
movq %r14, %rdi
callq 0x2190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x283a
movl $0x48, %esi
movq %rbx, %rdi
callq 0x2180
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c2e
movq %rax, %r14
movl $0x48, %esi
movq %rbx, %rdi
jmp 0x3c59
jmp 0x3c3f
jmp 0x3c3f
movq %rax, %r14
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3c5e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2180
movq %r14, %rdi
callq 0x2240