// File: /workspace/github_cpp_makefile_star2_O1/rozpo[P]enemy/data/game/items/Item.cpp
// Function: Item::openItem(std::shared_ptr<Player>&)
void Item::openItem(std::shared_ptr<Player> &player)
{
    int z = 0;
    do
    {
        print();

        std::cout << player->name << " current weapon ( ";
        if(player->weapon_dmg != 0)
            std::cout << player->weapon_name << " )\n";
        else
            std::cout << "None )\n";

        z = choice();
        switch(z)
        {
            case e_item_dagger:
            {
                if(player->gold >= 50)
                {
                    player->weapon_name = "Dagger";
                    player->weapon_dmg = 5;
                    player->gold-=50;
                }
                else
                    std::cout << "Not enough gold ;(\n";
            }
                break;

            case e_item_shortsword:
            {
                if(player->gold >= 120)
                {
                    player->weapon_name = "Short Sword";
                    player->weapon_dmg = 10;
                    player->gold-=120;
                }
                else
                    std::cout << "Not enough gold ;(\n";
            }
                break;

            case e_item_greataxe:
            {
                if(player->gold >= 299)
                {
                    player->weapon_name = "Great Axe";
                    player->weapon_dmg = 19;
                    player->gold-=299;
                }
                else
                    std::cout << "Not enough gold ;(\n";
            }
                break;

            case e_item_heavyhammer:
            {
                if(player->gold >= 420)
                {
                    player->weapon_name = "Heavy Hammer";
                    player->weapon_dmg = 35;
                    player->gold-=420;
                }
                else
                    std::cout << "Not enough gold ;(\n";
            }
                break;

            case e_item_devilscythe:
            {
                if(player->gold >= 666)
                {
                    player->weapon_name = "Legendary Lucifer's Scythe";
                    player->weapon_dmg = 666;
                    player->gold-=666;
                }
                else
                    std::cout << "Not enough gold ;(\n";
            }
                break;
        }
    }while(z != 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0xadd4(%rip), %r15      # 0x10fd0
leaq 0x53f9(%rip), %r12      # 0xb5fc
leaq 0x53da(%rip), %r13      # 0xb5e4
movq %r14, %rdi
callq 0x7470
movq (%rbx), %rax
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
movq %r15, %rdi
callq 0x3140
movl $0x12, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3140
movq (%rbx), %rax
cmpl $0x0, 0x80(%rax)
je 0x6262
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
movq %r15, %rdi
callq 0x3140
movl $0x3, %edx
movq %rax, %rdi
leaq 0x53b3(%rip), %rsi      # 0xb613
jmp 0x6271
movl $0x7, %edx
movq %r15, %rdi
leaq 0x539e(%rip), %rsi      # 0xb60f
callq 0x3140
movq %r14, %rdi
callq 0x75ea
cmpl $0x5, %eax
ja 0x620a
movl %eax, %ebp
movl %eax, %eax
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq (%rbx), %rdi
cmpl $0x32, 0x3c(%rdi)
jl 0x63d0
movq 0x68(%rdi), %rdx
addq $0x60, %rdi
movl $0x6, %r8d
xorl %esi, %esi
leaq 0x5362(%rip), %rcx      # 0xb617
callq 0x3190
movq (%rbx), %rax
movl $0x5, 0x80(%rax)
addl $-0x32, 0x3c(%rax)
jmp 0x63e4
movq (%rbx), %rdi
cmpl $0x1a4, 0x3c(%rdi)      # imm = 0x1A4
jl 0x63d0
movq 0x68(%rdi), %rdx
addq $0x60, %rdi
movl $0xc, %r8d
xorl %esi, %esi
leaq 0x5351(%rip), %rcx      # 0xb648
callq 0x3190
movq (%rbx), %rax
movl $0x23, 0x80(%rax)
addl $0xfffffe5c, 0x3c(%rax) # imm = 0xFFFFFE5C
jmp 0x63e4
movq (%rbx), %rdi
cmpl $0x78, 0x3c(%rdi)
jl 0x63d0
movq 0x68(%rdi), %rdx
addq $0x60, %rdi
movl $0xb, %r8d
xorl %esi, %esi
leaq 0x52f9(%rip), %rcx      # 0xb632
callq 0x3190
movq (%rbx), %rax
movl $0xa, 0x80(%rax)
addl $-0x78, 0x3c(%rax)
jmp 0x63e4
movq (%rbx), %rdi
cmpl $0x12b, 0x3c(%rdi)      # imm = 0x12B
jl 0x63d0
movq 0x68(%rdi), %rdx
addq $0x60, %rdi
movl $0x9, %r8d
xorl %esi, %esi
leaq 0x52c7(%rip), %rcx      # 0xb63e
callq 0x3190
movq (%rbx), %rax
movl $0x13, 0x80(%rax)
addl $0xfffffed5, 0x3c(%rax) # imm = 0xFFFFFED5
jmp 0x63e4
movq (%rbx), %rdi
cmpl $0x29a, 0x3c(%rdi)      # imm = 0x29A
jl 0x63d0
movq 0x68(%rdi), %rdx
addq $0x60, %rdi
movl $0x1a, %r8d
xorl %esi, %esi
leaq 0x52a0(%rip), %rcx      # 0xb655
callq 0x3190
movq (%rbx), %rax
movl $0x29a, 0x80(%rax)      # imm = 0x29A
addl $0xfffffd66, 0x3c(%rax) # imm = 0xFFFFFD66
jmp 0x63e4
movl $0x13, %edx
movq %r15, %rdi
leaq 0x523f(%rip), %rsi      # 0xb61e
callq 0x3140
testl %ebp, %ebp
jne 0x620a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop