// File: 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
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x4530
movq -0xb0(%rbp), %rdx
leaq 0xc1a7(%rip), %rsi      # 0x1352b
leaq -0x40(%rbp), %rdi
callq 0x4c10
jmp 0x738f
leaq -0x41(%rbp), %rdi
callq 0x4360
leaq -0x78(%rbp), %rdi
callq 0x4420
jmp 0x73a3
movq 0x14c16(%rip), %rdi     # 0x1bfc0
leaq 0xbf5c(%rip), %rsi      # 0x1330d
callq 0x4310
movq %rax, -0xc0(%rbp)
jmp 0x73bf
movq -0xc0(%rbp), %rdi
movq 0x14be3(%rip), %rsi     # 0x1bfb0
callq 0x4340
jmp 0x73d4
movq 0x14be5(%rip), %rdi     # 0x1bfc0
leaq 0xbf49(%rip), %rsi      # 0x1332b
callq 0x4310
jmp 0x73e9
movq 0x14bf0(%rip), %rdi     # 0x1bfe0
callq 0x4560
jmp 0x73f7
movq 0x14be2(%rip), %rdi     # 0x1bfe0
callq 0x4110
movl %eax, -0xc4(%rbp)
jmp 0x740b
movl -0xc4(%rbp), %eax
cmpl $0xa, %eax
je 0x7455
movq 0x14bc3(%rip), %rdi     # 0x1bfe0
leaq -0x78(%rbp), %rsi
callq 0x43e0
jmp 0x7428
jmp 0x7473
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x4360
jmp 0x7714
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x7702
movq 0x14b84(%rip), %rdi     # 0x1bfe0
callq 0x4560
jmp 0x7463
movb $0x0, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
jmp 0x76e2
leaq -0x78(%rbp), %rdi
callq 0x4140
movq %rax, %rdi
callq 0x4480
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0xc8(%rbp)
subl $0x1, %eax
je 0x74a7
jmp 0x7497
movl -0xc8(%rbp), %eax
subl $0x2, %eax
je 0x74c5
jmp 0x76d7
movq -0xb8(%rbp), %rdi
callq 0x7d60
jmp 0x74b5
movb $0x1, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
jmp 0x76e2
movq 0x14af4(%rip), %rdi     # 0x1bfc0
leaq 0xbe67(%rip), %rsi      # 0x1333a
callq 0x4310
movq %rax, -0xd0(%rbp)
jmp 0x74e1
movq -0xd0(%rbp), %rdi
movq 0x14ac1(%rip), %rsi     # 0x1bfb0
callq 0x4340
jmp 0x74f6
movq 0x14ae3(%rip), %rdi     # 0x1bfe0
callq 0x4560
jmp 0x7504
movq 0x14ad5(%rip), %rdi     # 0x1bfe0
callq 0x4110
movl %eax, -0xd4(%rbp)
jmp 0x7518
movl -0xd4(%rbp), %eax
cmpl $0xa, %eax
je 0x7548
movq 0x14ab6(%rip), %rdi     # 0x1bfe0
leaq -0x40(%rbp), %rsi
callq 0x43e0
jmp 0x7535
jmp 0x7548
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x760f
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4150
jmp 0x755a
movq -0xb8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7c30
movq %rax, -0xe0(%rbp)
jmp 0x7576
movq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4200
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
jne 0x767e
movl $0x10, %edi
callq 0x41a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe8(%rbp)
leaq 0xbda5(%rip), %rsi      # 0x1335c
callq 0x4590
jmp 0x75be
movq -0xe8(%rbp), %rdi
movq 0x14a0c(%rip), %rsi     # 0x1bfd8
movq 0x149f5(%rip), %rdx     # 0x1bfc8
callq 0x44f0
jmp 0x7725
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4200
jmp 0x760f
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
callq 0x4250
movl -0x54(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x7702
movq -0x50(%rbp), %rdi
callq 0x4130
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, %rsi
movq 0x14977(%rip), %rdi     # 0x1bfc0
callq 0x4310
movq %rax, -0xf0(%rbp)
jmp 0x7657
movq -0xf0(%rbp), %rdi
movq 0x1494b(%rip), %rsi     # 0x1bfb0
callq 0x4340
jmp 0x766c
movb $0x1, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
callq 0x44c0
jmp 0x7693
jmp 0x7697
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
callq 0x44c0
jmp 0x7695
jmp 0x76e2
jmp 0x7702
movq -0x18(%rbp), %rdi
callq 0xff00
jmp 0x76a2
movq -0x20(%rbp), %rdi
callq 0xff00
jmp 0x76ad
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x10130
jmp 0x76bc
movq -0xb8(%rbp), %rdi
callq 0x7f40
jmp 0x76ca
movb $0x1, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
jmp 0x76e2
movb $0x0, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4200
leaq -0x40(%rbp), %rdi
callq 0x4200
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x4200
leaq -0x40(%rbp), %rdi
callq 0x4200
movq -0x50(%rbp), %rdi
callq 0x4520
movq %rax, %rdi
callq 0x4f20
nopw %cs:(%rax,%rax)