// File: /workspace/github_cpp_makefile_star2_O1/Serfati[P]Heroes-of-Might-and-Magic-3/GameUnit.cpp
// Function: GameUnit::attackMenu(Hero*)
bool GameUnit::attackMenu(Hero *me) {
    Hero *ptr = nullptr;
    string heroToAttack = "",index;
    while ( true ) {
        cout << "‫‪1. Show me my opponents" << endl;
        cout << "2. Attack Hero";
        std::cin.ignore();
        if ( std::cin.peek() != '\n' )
            cin >> index;
        else {
            std::cin.ignore();
            return 0;
        }

        int choice = atoi(index.c_str());
        switch ( choice ) {
            case 1:    /*	Show me my opponents	*/
                showHeroes();
                return 1;
            case 2:    /*  Attack Hero by name	   */
                try {
                    cout << "Please insert your opponent name:" << endl;
                    std::cin.ignore();
                    if ( std::cin.peek() != '\n' )
                        cin >> heroToAttack;
                    ptr = getHeroByName(heroToAttack);
                    if ( NULL == ptr )
                        throw std::invalid_argument("Hero not found!");

                } catch( std::invalid_argument &e ) {
                    cout << e.what() << endl;
                    return 1;
                }
                me->showHeroFight();
                ptr->showHeroFight();
                me->attackEnemy(*ptr);
                eraseKilled();
                return 1;
            default:
                return 0;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x5b71(%rip), %rdx      # 0xb545
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x39b0
leaq -0x78(%rbp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0xa5c4(%rip), %r15      # 0xffc0
leaq 0x590a(%rip), %rsi      # 0xb30d
movl $0x1d, %edx
movq %r15, %rdi
callq 0x32d0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa592(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa57e(%rip), %rdi      # 0xffc0
leaq 0x58e2(%rip), %rsi      # 0xb32b
movl $0xe, %edx
callq 0x32d0
movq 0xa586(%rip), %rdi      # 0xffe0
callq 0x3440
movq 0xa57a(%rip), %rdi      # 0xffe0
callq 0x30f0
cmpl $0xa, %eax
jne 0x5a7e
movq 0xa569(%rip), %rdi      # 0xffe0
callq 0x3440
jmp 0x5ab4
movq 0xa55b(%rip), %rdi      # 0xffe0
leaq -0x88(%rbp), %rsi
callq 0x3300
movq -0x88(%rbp), %rdi
callq 0x3360
cmpl $0x2, %eax
je 0x5afa
cmpl $0x1, %eax
jne 0x5ab4
movb $0x1, %r14b
movq %rbx, %rdi
callq 0x61e8
jmp 0x5ab7
xorl %r14d, %r14d
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x5acf
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5ae8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa4bf(%rip), %r15      # 0xffc0
leaq 0x5832(%rip), %rsi      # 0xb33a
movl $0x21, %edx
movq %r15, %rdi
callq 0x32d0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq 0xa48d(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa499(%rip), %rdi      # 0xffe0
callq 0x3440
movq 0xa48d(%rip), %rdi      # 0xffe0
callq 0x30f0
cmpl $0xa, %eax
je 0x5b6d
movq 0xa47c(%rip), %rdi      # 0xffe0
leaq -0x48(%rbp), %rsi
callq 0x3300
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x693a
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
callq 0x6100
movq %rax, %r15
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x5bae
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3290
testq %r15, %r15
je 0x5bde
movq %r14, %rdi
callq 0x878c
movq %r15, %rdi
callq 0x878c
movq %r14, %rdi
movq %r15, %rsi
callq 0x898c
movb $0x1, %r14b
movq %rbx, %rdi
callq 0x638e
jmp 0x5ab7
movl $0x10, %edi
callq 0x3140
movq %rax, %r15
leaq 0x576a(%rip), %rsi      # 0xb35c
movq %rax, %rdi
callq 0x3460
movq 0xa3d7(%rip), %rsi      # 0xffd8
movq 0xa3c0(%rip), %rdx      # 0xffc8
movq %r15, %rdi
callq 0x3400
movq %rdx, %r14
movq %rax, %rbx
movq %r15, %rdi
callq 0x31d0
jmp 0x5c4d
movq %rdx, %r14
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x5c4d
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x5c4d
jmp 0x5c9c
movq %rax, %rbx
jmp 0x5cd0
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x5c9f
movq %rbx, %rdi
callq 0x3100
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0xa355(%rip), %rdi      # 0xffc0
movq %rax, %rsi
callq 0x3270
movq %rax, %rdi
callq 0x3130
movb $0x1, %r14b
callq 0x33c0
jmp 0x5ab7
jmp 0x5c9c
movq %rax, %rbx
callq 0x33c0
jmp 0x5c9f
movq %rax, %rdi
callq 0x6841
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x5cb7
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5cd0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3420