// File: /workspace/github_cpp_makefile_star2_O1/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 0x6b62
leaq -0x1e8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6abb(%rip), %rsi      # 0x9020
leaq 0x6ab8(%rip), %rdx      # 0x9024
leaq -0x1f8(%rbp), %rdi
callq 0x340c
leaq -0x358(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x3146
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 0x340c
leaq -0x308(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x5998
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 0x340c
leaq -0x2b8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x62ec
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 0x340c
leaq -0x430(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x3206
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 0x340c
leaq -0x3e8(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x3206
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 0x340c
leaq -0x3a0(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x3206
movq -0x158(%rbp), %rdi
cmpq %r15, %rdi
je 0x2745
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x21c0
movabsq $0x12c00000001, %rax    # imm = 0x12C00000001
leaq -0x268(%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 0x34a6
leaq -0xb8(%rbp), %rax
leaq -0x260(%rbp), %rsi
movq %rax, (%rsi)
leaq 0xa9ff(%rip), %rdi      # 0xd1a8
callq 0x34a6
leaq -0xb0(%rbp), %rax
leaq -0x260(%rbp), %rsi
movq %rax, (%rsi)
leaq 0xa9e2(%rip), %rdi      # 0xd1a8
callq 0x34a6
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), %r12
movq %r12, %rdi
callq 0x340c
leaq -0x240(%rbp), %r15
leaq -0x230(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x6806(%rip), %rsi      # 0x9025
leaq 0x6808(%rip), %rdx      # 0x902e
movq %r15, %rdi
callq 0x340c
leaq -0x220(%rbp), %r15
leaq -0x210(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x67e8(%rip), %rsi      # 0x902f
leaq 0x67e7(%rip), %rdx      # 0x9035
movq %r15, %rdi
callq 0x340c
leaq -0x260(%rbp), %rbx
xorl %r12d, %r12d
leaq 0x6ccb(%rip), %r14      # 0x9532
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x340c
leaq -0x138(%rbp), %r15
movq %r15, %rdi
leaq 0x67bc(%rip), %rsi      # 0x9051
movq %rbx, %rdx
callq 0x32d2
movq %r15, %rdi
leaq 0x67c2(%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 0x28d0
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x28d6
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), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x340c
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movq %r15, %rdx
callq 0x71ec
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2945
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x295e
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2980
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x299c
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0xa82d(%rip), %rax      # 0xd1d0
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0xa617(%rip), %rdi      # 0xcfc8
callq 0x21e0
movq 0xa61b(%rip), %rdi      # 0xcfd8
leaq -0x48(%rbp), %rsi
callq 0x2200
leaq -0x300(%rbp), %rdi
cmpl $0x1, %r12d
je 0x29e6
leaq -0x350(%rbp), %rdi
testl %r12d, %r12d
je 0x29e6
leaq -0x2b0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x20f0
incq %r12
addq $0x20, %rbx
cmpq $0x3, %r12
jne 0x2867
leaq -0x38(%rbp), %r12
callq 0x7620
testb %al, %al
jne 0x2a14
callq 0x7426
jmp 0x2a04
movq $-0x60, %rbx
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x2a30
movq (%r13), %rsi
incq %rsi
callq 0x21c0
addq $-0x20, %r13
addq $0x20, %rbx
jne 0x2a1b
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2a4f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0xa1b2(%rip), %rbx      # 0xcc08
addq $0x10, %rbx
leaq -0x388(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2a7d
movq -0x388(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x3d0(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2aa0
movq -0x3d0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x418(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ac3
movq -0x418(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x2a0(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ae6
movq -0x2a0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x2f0(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b09
movq -0x2f0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x340(%rbp), %rax
movq %rbx, -0x18(%rax)
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b2c
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x108(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x69f4(%rip), %rdx      # 0x9532
leaq -0x118(%rbp), %rdi
movq %rdx, %rsi
callq 0x340c
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6582(%rip), %rsi      # 0x90e1
leaq 0x6588(%rip), %rdx      # 0x90ee
leaq -0xf8(%rbp), %rdi
callq 0x340c
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x69ad(%rip), %rdx      # 0x9532
leaq -0xd8(%rbp), %rdi
movq %rdx, %rsi
callq 0x340c
leaq -0x118(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x71ec
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2bc9
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2be4
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x2bff
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 0x2c15
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2c26
movq %rdx, %r14
movq %rax, %rbx
movq %r12, %r15
cmpq %r15, %r12
je 0x2c5a
addq $-0x10, %r15
leaq -0x260(%rbp), %r12
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x2c4a
movq (%r15), %rsi
incq %rsi
callq 0x21c0
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r12, %r15
movq %rax, %r15
jne 0x2c36
leaq -0x38(%rbp), %r12
jmp 0x2ec1
jmp 0x2c67
jmp 0x2c67
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2ed6
movq %rdx, %r14
movq %rax, %rbx
movq -0x158(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f04
movq -0x148(%rbp), %rsi
jmp 0x2efc
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f04
movq %rdx, %r14
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f32
movq -0x168(%rbp), %rsi
jmp 0x2f2a
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f32
movq %rdx, %r14
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f60
movq -0x188(%rbp), %rsi
jmp 0x2f58
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f60
movq %rdx, %r14
movq %rax, %rbx
movq -0x1b8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f8e
movq -0x1a8(%rbp), %rsi
jmp 0x2f86
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2f8e
movq %rdx, %r14
movq %rax, %rbx
movq -0x1d8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2fbc
movq -0x1c8(%rbp), %rsi
jmp 0x2fb4
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2fbc
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x2d98
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2d98
movq %rdx, %r14
movq %rax, %rbx
movq -0x1f8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2fea
movq -0x1e8(%rbp), %rsi
jmp 0x2fe2
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x2dba
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2dba
jmp 0x2ddd
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x2dd5
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2fea
jmp 0x2e8e
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e68
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e46
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e2d
movq %rdx, %r14
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2e2d
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2e46
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2e68
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x2e94
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2e94
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2e98
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 0x2eb7
movq (%rax), %rsi
incq %rsi
callq 0x21c0
addq $-0x20, %r15
cmpq $-0x60, %r15
jne 0x2e9b
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x2ed6
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9d2b(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x388(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f04
movq -0x388(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9cfd(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x3d0(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f32
movq -0x3d0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9ccf(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x418(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f60
movq -0x418(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9ca1(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x2a0(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2f8e
movq -0x2a0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9c73(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x2f0(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2fbc
movq -0x2f0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq 0x9c45(%rip), %rax      # 0xcc08
addq $0x10, %rax
leaq -0x340(%rbp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x2fea
movq -0x340(%rbp), %rsi
incq %rsi
callq 0x21c0
cmpl $0x3, %r14d
jne 0x3038
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x9fc6(%rip), %rdi      # 0xcfc8
leaq 0x60a9(%rip), %rsi      # 0x90b2
movl $0x2e, %edx
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x9fa5(%rip), %rdi      # 0xcfc8
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20c0
jmp 0x30d0
cmpl $0x2, %r14d
jne 0x3083
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x9f78(%rip), %rdi      # 0xcfc8
leaq 0x6035(%rip), %rsi      # 0x908c
movl $0x25, %edx
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x9f57(%rip), %rdi      # 0xcfc8
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20c0
jmp 0x30d0
cmpl $0x1, %r14d
jne 0x2dd5
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x9f29(%rip), %rdi      # 0xcfc8
leaq 0x5fce(%rip), %rsi      # 0x9074
movl $0x17, %edx
callq 0x21e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x9f08(%rip), %rdi      # 0xcfc8
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20c0
callq 0x2250
jmp 0x2b2c
movq %rax, %rbx
callq 0x2250
jmp 0x2dd5
movq %rax, %rbx
callq 0x2250
jmp 0x2dd5
movq %rax, %rbx
callq 0x2250
jmp 0x2dd5
movq %rax, %rdi
callq 0x3364
nop