// File: giovifazi[P]knossos-bloodbath/ClassPlayer.cpp
// Function: Player::diceRoll_or()
int Player::diceRoll_or() 
{
   srand(time(0));
   int roll = (rand()%20) +1;
   switch(roll)
   {
      case 1: case 2: case 3: case 4: case 5:
      // non succede niente
      return roll;

      // trovato scudo oro
      case 6:
         shield = "gold";
      return roll;

      // se scudo oro trovata pozione curativa
      // scudo argento altrimenti
      case 7: 
            hp += 8;
            return 71;
         
     case 8:   
            hp -=8;
            return 72;
   
      // se senza scudo trovo scudo bronzo
      // piccola arma altrimenti
      case 9: case 10: case 11: case 12:
         if (shield == "")
         {
            shield = "bronze";
            return 91;
         }
         else
         {
            atk += 1;
            return 92;
         }
      break;
   
      // trappola, danno incodizionato
      case 13: case 14: case 15: case 16: case 17:
         hp -= 4;
      return roll;
   
      // trovata spada argento
      case 18: case 19:
         atk+=4;
      return roll;

      // trovata spada magica
      case 20:
         hp += 5;
         atk += 5;
      return roll;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x2180
movl %eax, %edi
callq 0x2190
callq 0x2070
movl %eax, %ecx
movslq %ecx, %rax
imulq $0x66666667, %rax, %rdx # imm = 0x66666667
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x23, %rdx
addl %eax, %edx
shll $0x2, %edx
movl %edx, %eax
leal (%rax,%rax,4), %edx
movl %ecx, %eax
negl %edx
movl %edx, %ecx
leal 0x1(%rax,%rcx), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x13, %eax
ja 0x97c8
movq -0x20(%rbp), %rax
leaq 0x731e(%rip), %rcx      # 0x109f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
leaq 0x7359(%rip), %rsi      # 0x10a52
callq 0x22b0
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rax
movl (%rax), %ecx
addl $0x8, %ecx
movl %ecx, (%rax)
movl $0x47, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rax
movl (%rax), %ecx
subl $0x8, %ecx
movl %ecx, (%rax)
movl $0x48, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
leaq 0x7234(%rip), %rsi      # 0x1097a
callq 0x97e0
testb $0x1, %al
jne 0x9751
jmp 0x976e
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
leaq 0x72e4(%rip), %rsi      # 0x10a44
callq 0x22b0
movl $0x5b, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movl $0x5c, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rax
movl (%rax), %ecx
subl $0x4, %ecx
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x4, %ecx
movl %ecx, 0x4(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x97ca
movq -0x28(%rbp), %rax
movl (%rax), %ecx
addl $0x5, %ecx
movl %ecx, (%rax)
movl 0x4(%rax), %ecx
addl $0x5, %ecx
movl %ecx, 0x4(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x97ca
ud2
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)