// File: /workspace/github_cpp_makefile_star2_O1/Serfati[P]Heroes-of-Might-and-Magic-3/GameUnit.cpp
// Function: GameUnit::storeMenu(Hero*)
int GameUnit::storeMenu(Hero *me) {
    Creature c;
    string index;
    while ( 1 > 0 ) {
        int choosenType = 0,count = 0,unitPrice = 0;
        cout << "‫‪1. Buy Zombies." << endl;
        cout << "2. Buy Archers." << endl;
        cout << "‫‪3.‬‬ Buy Vampire." << endl;
        cout << "4. Buy Wizard." << endl;
        cout << "‫‪5‬‬.‬‬ Buy Black Dragon." << endl;
        cin >> index;
        int choice = atoi(index.c_str());
        switch ( choice ) {
            case 1:    /*	Buy Zombies 	*/
                choosenType = 0;
                c = Zombie();
                unitPrice = c.getPrice();
                c.showCreature();
                break;
            case 2:    /*  Buy	Archers	   */
                choosenType = 1;
                c = Archer();
                unitPrice = c.getPrice();
                c.showCreature();
                break;
            case 3:     /*	Buy Vampire	   */
                choosenType = 2;
                c = Vampire();
                unitPrice = c.getPrice();
                c.showCreature();
                break;
            case 4:    /*	Buy Wizard	   */
                choosenType = 3;
                c = Wizard();
                unitPrice = c.getPrice();
                c.showCreature();
                break;
            case 5:    /*	Buy Black Dragon  */
                choosenType = 4;
                c = BlackDragon();
                unitPrice = c.getPrice();
                c.showCreature();
                break;
            default:
                cout << "please choose a valid number" << endl;
        }
        cin >> count;
        if ( unitPrice * count > me->getGold()) {
            throw std::invalid_argument("Not enough gold!");
            return 0;
        }
        me->buyCreature(me->getGold(),choosenType,count,unitPrice);
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
leaq -0x48(%rbp), %rdi
callq 0x9ee0
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
movl $0x0, -0x2c(%rbp)
movq 0xa2a6(%rip), %r14      # 0xffc0
leaq 0x564b(%rip), %rsi      # 0xb36c
movl $0x15, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa274(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa260(%rip), %r14      # 0xffc0
leaq 0x561b(%rip), %rsi      # 0xb382
movl $0xf, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa22e(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa21a(%rip), %r14      # 0xffc0
leaq 0x55e5(%rip), %rsi      # 0xb392
movl $0x1b, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa1e8(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa1d4(%rip), %r14      # 0xffc0
leaq 0x55bb(%rip), %rsi      # 0xb3ae
movl $0xe, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa1a2(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa18e(%rip), %r14      # 0xffc0
leaq 0x5584(%rip), %rsi      # 0xb3bd
movl $0x26, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa15c(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa168(%rip), %rdi      # 0xffe0
leaq -0x80(%rbp), %rsi
callq 0x3300
movq -0x80(%rbp), %rdi
callq 0x3360
decl %eax
cmpl $0x4, %eax
ja 0x5fdc
leaq 0x51b8(%rip), %rcx      # 0xb054
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x60(%rbp), %rdi
callq 0xa570
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa628
movq %r14, %rdi
callq 0xa1b6
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f68
jmp 0x6025
leaq -0x60(%rbp), %rdi
callq 0xa1fc
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa2b2
movq %r14, %rdi
callq 0xa1b6
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f68
movl $0x4, %r15d
jmp 0x6028
leaq -0x60(%rbp), %rdi
callq 0xa4b4
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa530
movq %r14, %rdi
callq 0xa1b6
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f68
movl $0x2, %r15d
jmp 0x6028
leaq -0x60(%rbp), %rdi
callq 0xa2dc
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa388
movq %r14, %rdi
callq 0xa1b6
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f68
movl $0x3, %r15d
jmp 0x6028
leaq -0x60(%rbp), %rdi
callq 0xa3b4
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa3e8
movq %r14, %rdi
callq 0xa1b6
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f68
movl $0x1, %r15d
jmp 0x6028
movq 0x9fdd(%rip), %r14      # 0xffc0
leaq 0x5306(%rip), %rsi      # 0xb2f0
movl $0x1c, %edx
movq %r14, %rdi
callq 0x32d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0x9fab(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x9fb1(%rip), %rdi      # 0xffe0
leaq -0x2c(%rbp), %rsi
callq 0x3180
movl -0x2c(%rbp), %r13d
movq %rbx, %rdi
callq 0x7c68
imull %r14d, %r13d
cvtsi2sd %r13d, %xmm1
ucomisd %xmm0, %xmm1
ja 0x6095
movq %rbx, %rdi
callq 0x7c68
movl -0x2c(%rbp), %edx
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %ecx
callq 0x84a2
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x6081
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x3290
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3140
movq %rax, %r14
leaq 0x533b(%rip), %rsi      # 0xb3e4
movq %rax, %rdi
callq 0x3460
movq 0x9f20(%rip), %rsi      # 0xffd8
movq 0x9f09(%rip), %rdx      # 0xffc8
movq %r14, %rdi
callq 0x3400
jmp 0x60e0
jmp 0x60e0
jmp 0x60e0
jmp 0x60e0
jmp 0x60e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x31d0
jmp 0x60e3
jmp 0x60e0
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x60f8
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3420