// File: /workspace/github_cpp_makefile_star2_O3/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 0x9ea8
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
movl $0x0, -0x2c(%rbp)
movq 0xa2ce(%rip), %r14      # 0xffc0
leaq 0x5673(%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 0xa29c(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa288(%rip), %r14      # 0xffc0
leaq 0x5643(%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 0xa256(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa242(%rip), %r14      # 0xffc0
leaq 0x560d(%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 0xa210(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa1fc(%rip), %r14      # 0xffc0
leaq 0x55e3(%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 0xa1ca(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa1b6(%rip), %r14      # 0xffc0
leaq 0x55ac(%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 0xa184(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa190(%rip), %rdi      # 0xffe0
leaq -0x80(%rbp), %rsi
callq 0x3300
movq -0x80(%rbp), %rdi
callq 0x3360
decl %eax
cmpl $0x4, %eax
ja 0x5fb4
leaq 0x51e0(%rip), %rcx      # 0xb054
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x60(%rbp), %rdi
callq 0xa538
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa5f0
movq %r14, %rdi
callq 0xa17e
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f30
jmp 0x5ffd
leaq -0x60(%rbp), %rdi
callq 0xa1c4
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa27a
movq %r14, %rdi
callq 0xa17e
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f30
movl $0x4, %r15d
jmp 0x6000
leaq -0x60(%rbp), %rdi
callq 0xa47c
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa4f8
movq %r14, %rdi
callq 0xa17e
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f30
movl $0x2, %r15d
jmp 0x6000
leaq -0x60(%rbp), %rdi
callq 0xa2a4
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa350
movq %r14, %rdi
callq 0xa17e
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f30
movl $0x3, %r15d
jmp 0x6000
leaq -0x60(%rbp), %rdi
callq 0xa37c
leaq -0x60(%rbp), %rdi
movupd 0x8(%rdi), %xmm0
leaq -0x48(%rbp), %r14
movupd %xmm0, 0x8(%r14)
callq 0xa3b0
movq %r14, %rdi
callq 0xa17e
movl %eax, %r14d
leaq -0x48(%rbp), %rdi
callq 0x9f30
movl $0x1, %r15d
jmp 0x6000
movq 0xa005(%rip), %r14      # 0xffc0
leaq 0x532e(%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 0x9fd3(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x9fd9(%rip), %rdi      # 0xffe0
leaq -0x2c(%rbp), %rsi
callq 0x3180
movl -0x2c(%rbp), %r13d
movq %rbx, %rdi
callq 0x7c44
imull %r14d, %r13d
cvtsi2sd %r13d, %xmm1
ucomisd %xmm0, %xmm1
ja 0x606d
movq %rbx, %rdi
callq 0x7c44
movl -0x2c(%rbp), %edx
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %ecx
callq 0x8484
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x6059
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 0x5363(%rip), %rsi      # 0xb3e4
movq %rax, %rdi
callq 0x3460
movq 0x9f48(%rip), %rsi      # 0xffd8
movq 0x9f31(%rip), %rdx      # 0xffc8
movq %r14, %rdi
callq 0x3400
jmp 0x60b8
jmp 0x60b8
jmp 0x60b8
jmp 0x60b8
jmp 0x60b8
movq %rax, %rbx
movq %r14, %rdi
callq 0x31d0
jmp 0x60bb
jmp 0x60b8
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x60d0
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3420