// File: /workspace/github_cpp_makefile_star2_O3/Matteo-Grellier[P]RPG/main.cpp
// Function: main
int main(int argc, char const *argv[])
{
    srand(time(NULL));

    try {

        Menu::start();

        //characters
        Mage mage("Mage");
        Barbarian barbarian("Barbarian");
        Priest priest("Priest");
        Monster monster1("monster1");
        Monster monster2("monster2");
        Monster monster3("monster3");

        Potion bigPotion(1, 300);
        Potion mediumPotion(3, 100);
        Potion littlePotion(6, 50);
        Character::potionsList.push_back(&bigPotion);
        Character::potionsList.push_back(&mediumPotion);
        Character::potionsList.push_back(&littlePotion);

        string characterName;
        string charactersType[3] = {"Mage", "Barbarian", "Priest"};

        //create characters and select names
        for (int i = 0; i < 3; i++) {
            Menu::devToScreen(
                "",
                "Select a name for your " + charactersType[i] + " character",
                ""
            );

            cout << Menu::endLine;
            cin >> characterName;

            if (i == 0) {
                mage.name = characterName;

            } else if (i == 1) {
                barbarian.name = characterName;

            } else {
                priest.name = characterName;
            }
        }

        
        //faire des tours tant que tt le monde n'est pas mort
        while(!Menu::isEndOfCombat()) {
            Menu::turn();
        }
    }
    catch(IllegalFury& illegalF){
        cout << "An illegal barbarian fury operation occured : " << illegalF.what() << endl;
    }
    catch(EmptyPotion& ep){
        cout << "An illegal drink operation occured : " << ep.what() << endl;
    }
    catch(std::exception& e){
        cout << "An exception occured : " << e.what() << endl;
    }

    Menu::devToScreen("","End of combat","");

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
xorl %edi, %edi
callq 0x2170
movl %eax, %edi
callq 0x2180
callq 0x6b4a
leaq -0x1e8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6abb(%rip), %rsi      # 0x9020
leaq 0x6ab8(%rip), %rdx      # 0x9024
leaq -0x1f8(%rbp), %rdi
callq 0x33fc
leaq -0x350(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x3132
movq -0x1f8(%rbp), %rdi
cmpq %r15, %rdi
je 0x25a6
movq -0x1e8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x1c8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6a6d(%rip), %rsi      # 0x9025
leaq 0x6a6f(%rip), %rdx      # 0x902e
leaq -0x1d8(%rbp), %rdi
callq 0x33fc
leaq -0x300(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x5988
movq -0x1d8(%rbp), %rdi
cmpq %r15, %rdi
je 0x25f9
movq -0x1c8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x1a8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6a24(%rip), %rsi      # 0x902f
leaq 0x6a23(%rip), %rdx      # 0x9035
leaq -0x1b8(%rbp), %rdi
callq 0x33fc
leaq -0x2b0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x62d8
movq -0x1b8(%rbp), %rdi
cmpq %r15, %rdi
je 0x264c
movq -0x1a8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x188(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x69d8(%rip), %rsi      # 0x9036
leaq 0x69d9(%rip), %rdx      # 0x903e
leaq -0x198(%rbp), %rdi
callq 0x33fc
leaq -0x428(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x31f2
movq -0x198(%rbp), %rdi
cmpq %r15, %rdi
je 0x269f
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x168(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x698e(%rip), %rsi      # 0x903f
leaq 0x698f(%rip), %rdx      # 0x9047
leaq -0x178(%rbp), %rdi
callq 0x33fc
leaq -0x3e0(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x31f2
movq -0x178(%rbp), %rdi
cmpq %r15, %rdi
je 0x26f2
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x148(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6944(%rip), %rsi      # 0x9048
leaq 0x6945(%rip), %rdx      # 0x9050
leaq -0x158(%rbp), %rdi
callq 0x33fc
leaq -0x398(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x31f2
movq -0x158(%rbp), %rdi
cmpq %r15, %rdi
je 0x2745
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x21c0
movabsq $0x12c00000001, %rax    # imm = 0x12C00000001
leaq -0x200(%rbp), %rcx
movq %rax, (%rcx)
movabsq $0x6400000003, %rax     # imm = 0x6400000003
movq %rax, -0xb8(%rbp)
movabsq $0x3200000006, %rax     # imm = 0x3200000006
movq %rax, -0xb0(%rbp)
leaq -0x260(%rbp), %rsi
movq %rcx, (%rsi)
leaq 0xaa1c(%rip), %rdi      # 0xd1a8
callq 0x349a
leaq -0xb8(%rbp), %rax
leaq -0x260(%rbp), %rsi
movq %rax, (%rsi)
leaq 0xa9ff(%rip), %rdi      # 0xd1a8
callq 0x349a
leaq -0xb0(%rbp), %rax
leaq -0x260(%rbp), %rsi
movq %rax, (%rsi)
leaq 0xa9e2(%rip), %rdi      # 0xd1a8
callq 0x349a
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x250(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x6830(%rip), %rsi      # 0x9020
leaq 0x682d(%rip), %rdx      # 0x9024
leaq -0x260(%rbp), %r15
movq %r15, %rdi
callq 0x33fc
leaq -0x240(%rbp), %r12
leaq -0x230(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x6806(%rip), %rsi      # 0x9025
leaq 0x6808(%rip), %rdx      # 0x902e
movq %r12, %rdi
callq 0x33fc
leaq -0x220(%rbp), %r12
leaq -0x210(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x67e8(%rip), %rsi      # 0x902f
leaq 0x67e7(%rip), %rdx      # 0x9035
movq %r12, %rdi
callq 0x33fc
xorl %r12d, %r12d
leaq 0x6cd2(%rip), %rbx      # 0x9532
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x33fc
leaq -0x138(%rbp), %r14
movq %r14, %rdi
leaq 0x67c3(%rip), %rsi      # 0x9051
movq %r15, %rdx
callq 0x32be
movq %r14, %rdi
leaq 0x67c9(%rip), %rsi      # 0x9069
callq 0x2290
leaq -0x58(%rbp), %rsi
movq %rsi, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x28c9
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x28cf
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x60(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x33fc
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movq %r14, %rdx
callq 0x71d4
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x293e
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2957
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2979
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x2995
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0xa834(%rip), %rax      # 0xd1d0
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0xa61e(%rip), %rdi      # 0xcfc8
callq 0x21e0
movq 0xa622(%rip), %rdi      # 0xcfd8
leaq -0x48(%rbp), %rsi
callq 0x2200
leaq -0x2f8(%rbp), %rdi
cmpl $0x1, %r12d
je 0x29df
leaq -0x348(%rbp), %rdi
testl %r12d, %r12d
je 0x29df
leaq -0x2a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x20f0
incq %r12
addq $0x20, %r15
cmpq $0x3, %r12
jne 0x2860
leaq -0x38(%rbp), %r12
callq 0x760e
testb %al, %al
jne 0x2a0d
callq 0x740e
jmp 0x29fd
movq $-0x60, %rbx
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x2a29
movq (%r13), %rsi
incq %rsi
callq 0x21c0
addq $-0x20, %r13
addq $0x20, %rbx
jne 0x2a14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2a48
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0xa1b9(%rip), %rbx      # 0xcc08
addq $0x10, %rbx
leaq -0x380(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2a76
movq -0x380(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x3c8(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2a99
movq -0x3c8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x410(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2abc
movq -0x410(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x298(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2adf
movq -0x298(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x2e8(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b02
movq -0x2e8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x338(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b25
movq -0x338(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x108(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x69fb(%rip), %rdx      # 0x9532
leaq -0x118(%rbp), %rdi
movq %rdx, %rsi
callq 0x33fc
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6589(%rip), %rsi      # 0x90e1
leaq 0x658f(%rip), %rdx      # 0x90ee
leaq -0xf8(%rbp), %rdi
callq 0x33fc
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x69b4(%rip), %rdx      # 0x9532
leaq -0xd8(%rbp), %rdi
movq %rdx, %rsi
callq 0x33fc
leaq -0x118(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x71d4
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2bc2
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2bdd
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x2bf8
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x21c0
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c0e
movq %rdx, %r14
movq %rax, %rbx
addq $-0x10, %r12
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x2c2e
movq (%r12), %rsi
incq %rsi
callq 0x21c0
leaq -0x20(%r12), %rax
addq $-0x10, %r12
cmpq %r15, %r12
movq %rax, %r12
jne 0x2c18
jmp 0x2c47
movq %rdx, %r14
movq %rax, %rbx
leaq -0x38(%rbp), %r12
jmp 0x2eae
jmp 0x2c54
jmp 0x2c54
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2ec3
movq %rdx, %r14
movq %rax, %rbx
movq -0x158(%rbp), %rdi
cmpq %r15, %rdi
je 0x2ef1
movq -0x148(%rbp), %rsi
jmp 0x2ee9
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2ef1
movq %rdx, %r14
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f1f
movq -0x168(%rbp), %rsi
jmp 0x2f17
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f1f
movq %rdx, %r14
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f4d
movq -0x188(%rbp), %rsi
jmp 0x2f45
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f4d
movq %rdx, %r14
movq %rax, %rbx
movq -0x1b8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f7b
movq -0x1a8(%rbp), %rsi
jmp 0x2f73
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f7b
movq %rdx, %r14
movq %rax, %rbx
movq -0x1d8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2fa9
movq -0x1c8(%rbp), %rsi
jmp 0x2fa1
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2fa9
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d85
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2d85
movq %rdx, %r14
movq %rax, %rbx
movq -0x1f8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2fd7
movq -0x1e8(%rbp), %rsi
jmp 0x2fcf
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2da7
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2da7
jmp 0x2dca
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x2dc2
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2fd7
jmp 0x2e7b
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e55
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e33
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e1a
movq %rdx, %r14
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2e1a
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2e33
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2e55
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x2e81
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2e81
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e85
movq %rdx, %r14
movq %rax, %rbx
leaq -0x38(%rbp), %r12
xorl %r15d, %r15d
movq -0x220(%rbp,%r15), %rdi
leaq (%r15,%r13), %rax
cmpq %rdi, %rax
je 0x2ea4
movq (%rax), %rsi
incq %rsi
callq 0x21c0
addq $-0x20, %r15
cmpq $-0x60, %r15
jne 0x2e88
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2ec3
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9d3e(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x380(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2ef1
movq -0x380(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9d10(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x3c8(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f1f
movq -0x3c8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9ce2(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x410(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f4d
movq -0x410(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9cb4(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x298(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f7b
movq -0x298(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9c86(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x2e8(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2fa9
movq -0x2e8(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9c58(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x338(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2fd7
movq -0x338(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpl $0x3, %r14d
jne 0x3025
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x9fd9(%rip), %rdi      # 0xcfc8
leaq 0x60bc(%rip), %rsi      # 0x90b2
movl $0x2e, %edx
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x9fb8(%rip), %rdi      # 0xcfc8
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20c0
jmp 0x30bd
cmpl $0x2, %r14d
jne 0x3070
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x9f8b(%rip), %rdi      # 0xcfc8
leaq 0x6048(%rip), %rsi      # 0x908c
movl $0x25, %edx
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x9f6a(%rip), %rdi      # 0xcfc8
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20c0
jmp 0x30bd
cmpl $0x1, %r14d
jne 0x2dc2
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x9f3c(%rip), %rdi      # 0xcfc8
leaq 0x5fe1(%rip), %rsi      # 0x9074
movl $0x17, %edx
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x9f1b(%rip), %rdi      # 0xcfc8
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20c0
callq 0x2250
jmp 0x2b25
movq %rax, %rbx
callq 0x2250
jmp 0x2dc2
movq %rax, %rbx
callq 0x2250
jmp 0x2dc2
movq %rax, %rbx
callq 0x2250
jmp 0x2dc2
movq %rax, %rdi
callq 0x3350