// File: /workspace/github_cpp_makefile_star2_O3/kongrigoriou[P]Text-Based-RPG/src/Heroes.cpp
// Function: Hero::usePotion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Hero::usePotion(string potion_name){

    int flag = 0;
    list<Potion*> :: iterator pt;
    for(pt = Potions.begin(); pt != Potions.end(); ++pt){

        if( (*pt)->get_name() == potion_name) {
            flag = 1;
            break;
        }
    }

    if(flag == 1){
        if( (*pt)->get_statname() == "MagicPower"){

            MagicPower += (*pt)->get_buff();

        }else if( (*pt)->get_statname() == "HealthPower"){

            HealthPower = HealthPower + (*pt)->get_buff()*HealthPower/100;


        }else if((*pt)->get_statname() == "Strength"){

            Strength = Strength + (*pt)->get_buff()*Strength/100;


        }else if((*pt)->get_statname() == "Agility"){

            Agility = Agility + (*pt)->get_buff()*Agility/100;


        }else if((*pt)->get_statname() == "Dexterity"){

            Dexterity = Dexterity + (*pt)->get_buff()*Dexterity/100;

        }
        Potions.remove(*pt);

    }else{

         cout << "You dont have that potion in your inventory" << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
leaq 0xb0(%rdi), %r14
leaq -0x50(%rbp), %r13
movq %r14, -0x58(%rbp)
movq (%r14), %r14
cmpq -0x58(%rbp), %r14
je 0x65a0
movq 0x10(%r14), %rsi
movq %r13, %rdi
callq 0xc812
movq -0x48(%rbp), %rdx
cmpq 0x8(%r12), %rdx
jne 0x63ff
movq -0x50(%rbp), %r15
testq %rdx, %rdx
je 0x6407
movq (%r12), %rsi
movq %r15, %rdi
callq 0x31a0
testl %eax, %eax
sete %bl
jmp 0x6409
movq -0x50(%rbp), %r15
xorl %ebx, %ebx
jmp 0x6409
movb $0x1, %bl
leaq -0x40(%rbp), %rax
cmpq %rax, %r15
je 0x6421
movq -0x40(%rbp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x3190
testb %bl, %bl
je 0x63bf
movq 0x10(%r14), %rsi
leaq -0x50(%rbp), %r12
movq %r12, %rdi
callq 0xce28
leaq 0x805d(%rip), %rsi      # 0xe499
movq %r12, %rdi
callq 0x30a0
movl %eax, %r15d
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x6460
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
addq $0x10, %r14
testl %r15d, %r15d
je 0x65e7
movq (%r14), %rsi
movq %r12, %rdi
callq 0xce28
leaq 0x8025(%rip), %rsi      # 0xe4a4
movq %r12, %rdi
callq 0x30a0
movl %eax, %r15d
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x64a3
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r15d, %r15d
je 0x65fc
movq (%r14), %rsi
movq %r12, %rdi
callq 0xce28
leaq 0x7ff2(%rip), %rsi      # 0xe4b0
movq %r12, %rdi
callq 0x30a0
movl %eax, %r15d
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x64e2
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r15d, %r15d
je 0x6630
movq (%r14), %rsi
movq %r12, %rdi
callq 0xce28
leaq 0x7fbc(%rip), %rsi      # 0xe4b9
movq %r12, %rdi
callq 0x30a0
movl %eax, %r15d
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x6521
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r15d, %r15d
je 0x6664
movq (%r14), %rsi
movq %r12, %rdi
callq 0xce28
leaq 0x7f85(%rip), %rsi      # 0xe4c1
movq %r12, %rdi
callq 0x30a0
movl %eax, %r15d
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x6560
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3190
testl %r15d, %r15d
jne 0x6696
movq -0x30(%rbp), %r15
movl 0x40(%r15), %ebx
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x40(%r15), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %ebx, %eax
movl %eax, 0x40(%r15)
jmp 0x6696
movq 0xda29(%rip), %rbx      # 0x13fd0
leaq 0x7f1d(%rip), %rsi      # 0xe4cb
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x31c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3100
jmp 0x66a2
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x30(%rbp), %rcx
addl %eax, 0x34(%rcx)
jmp 0x6696
movq -0x30(%rbp), %r15
movl 0x2c(%r15), %ebx
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x2c(%r15), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %ebx, %eax
movl %eax, 0x2c(%r15)
jmp 0x6696
movq -0x30(%rbp), %r15
movl 0x38(%r15), %ebx
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x38(%r15), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %ebx, %eax
movl %eax, 0x38(%r15)
jmp 0x6696
movq -0x30(%rbp), %r15
movl 0x3c(%r15), %ebx
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
imull 0x3c(%r15), %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl %ebx, %eax
movl %eax, 0x3c(%r15)
movq -0x58(%rbp), %rdi
movq %r14, %rsi
callq 0x6f28
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop