// File: /workspace/github_cpp_makefile_star2_O3/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 0x5b7f(%rip), %rdx      # 0xb52b
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 0xa5ec(%rip), %r15      # 0xffc0
leaq 0x5932(%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 0xa5ba(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa5a6(%rip), %rdi      # 0xffc0
leaq 0x590a(%rip), %rsi      # 0xb32b
movl $0xe, %edx
callq 0x32d0
movq 0xa5ae(%rip), %rdi      # 0xffe0
callq 0x3440
movq 0xa5a2(%rip), %rdi      # 0xffe0
callq 0x30f0
cmpl $0xa, %eax
jne 0x5a56
movq 0xa591(%rip), %rdi      # 0xffe0
callq 0x3440
jmp 0x5a8c
movq 0xa583(%rip), %rdi      # 0xffe0
leaq -0x88(%rbp), %rsi
callq 0x3300
movq -0x88(%rbp), %rdi
callq 0x3360
cmpl $0x2, %eax
je 0x5ad2
cmpl $0x1, %eax
jne 0x5a8c
movb $0x1, %r14b
movq %rbx, %rdi
callq 0x61c4
jmp 0x5a8f
xorl %r14d, %r14d
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x5aa7
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5ac0
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 0xa4e7(%rip), %r15      # 0xffc0
leaq 0x585a(%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 0xa4b5(%rip), %rdi      # 0xffc0
callq 0x3030
movq %rax, %rdi
callq 0x31b0
movq 0xa4c1(%rip), %rdi      # 0xffe0
callq 0x3440
movq 0xa4b5(%rip), %rdi      # 0xffe0
callq 0x30f0
cmpl $0xa, %eax
je 0x5b45
movq 0xa4a4(%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 0x6930
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
callq 0x60d8
movq %rax, %r15
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x5b86
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3290
testq %r15, %r15
je 0x5bb6
movq %r14, %rdi
callq 0x876e
movq %r15, %rdi
callq 0x876e
movq %r14, %rdi
movq %r15, %rsi
callq 0x896e
movb $0x1, %r14b
movq %rbx, %rdi
callq 0x637e
jmp 0x5a8f
movl $0x10, %edi
callq 0x3140
movq %rax, %r15
leaq 0x5792(%rip), %rsi      # 0xb35c
movq %rax, %rdi
callq 0x3460
movq 0xa3ff(%rip), %rsi      # 0xffd8
movq 0xa3e8(%rip), %rdx      # 0xffc8
movq %r15, %rdi
callq 0x3400
movq %rdx, %r14
movq %rax, %rbx
movq %r15, %rdi
callq 0x31d0
jmp 0x5c25
movq %rdx, %r14
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x5c25
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3290
jmp 0x5c25
jmp 0x5c74
movq %rax, %rbx
jmp 0x5ca8
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x5c77
movq %rbx, %rdi
callq 0x3100
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0xa37d(%rip), %rdi      # 0xffc0
movq %rax, %rsi
callq 0x3270
movq %rax, %rdi
callq 0x3130
movb $0x1, %r14b
callq 0x33c0
jmp 0x5a8f
jmp 0x5c74
movq %rax, %rbx
callq 0x33c0
jmp 0x5c77
movq %rax, %rdi
callq 0x6837
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x5c8f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3290
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5ca8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
callq 0x3420