// File: /workspace/github_cpp_makefile_star2_O2/AlanReviews[P]Goblet-of-fire/Control.cc
// Function: Control::launch()
void Control::launch(void) {
    // Initialize the random seed
    srand( (unsigned)time( NULL ) );
    // Create a View object
    View view;
    // Declare and initialize the choice
    int choice;
    // Declare and initialize the student attributes: name, age, and school
    std::string name;
    int age;
    std::string school;
    // Declare and initialize has a school booleans
    bool hasHogwarts = false;
    bool hasDurmstrang = false;
    bool hasBeauxbatons = false;

    // Display the main menu
    while (1) {
        view.displayMenu(choice);
        // Get out of the program
        if (choice == 0) {
            break;
        }
        // Add a participant to the Goblet of fire
        else if (choice == 1) {
            // Prompt the user to input their age.
            cout << "You are at the age line. Please enter your age:" << endl;
            cin >> age;
            // Clear the buffer
            std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
            // If the user is under 17, go back to the main menu
            if (age < 17) {
                cout << "You are not allowed to participate in the Triwizard Tournament. Even if you look older or are under the aging potion, you are still not allowed." << endl;
                continue;
            }
            cout << endl;
            // Prompt the user to add a name and school
            cout << "Please enter your name:" << endl;
            std::getline(std::cin,name);
            if (name.empty()) {
                cout << "You didn't enter a name" << endl;
                continue;
            }
            cout << endl;
            cout << "Please enter your school:" << endl;
            std::getline(std::cin,school);
            if (school.empty()) {
                cout << "You didn't enter a school" << endl;
                continue;
            }
            cout << endl;
            // If there is a Hogwarts, Beauxbatons, or Durmstrang student added to the list, match the appropriate boolean variable to true
            if (school == "Hogwarts") {
                hasHogwarts = true;
            }
            else if (school == "Beauxbatons") {
                hasBeauxbatons = true;
            }
            else if (school == "Durmstrang") {
                hasDurmstrang = true;
            }
            // Statically allocate a participant object
            Participant p = Participant(name, age, school);
            // Add the participant object to the vector
            participants.push_back(p);
        }
        // Drawing out characters
        else if (choice == 2 && participants.size() >= 3 && (hasHogwarts && hasBeauxbatons && hasDurmstrang))  {
            // Pick a student from Hogwarts
            drawParticipant(participants, "Hogwarts");
            // Pick a student from Beauxbatons
            drawParticipant(participants, "Beauxbatons");
            // Pick a student from Durmstrang
            drawParticipant(participants, "Durmstrang");
            // Mentioning Harry Potter
            // cout << "Harry Potter, (14) from Hogwarts" << endl;
        }
        else if (choice == 2) {
            cout << "Not enough participants" << endl;
        }
    } // while(1)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, 0x8(%rsp)
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x2160
movl %eax, %edi
callq 0x2170
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %bl, (%rax)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %bl, (%rax)
leaq 0x7(%rsp), %r14
leaq 0x24(%rsp), %r15
movq 0x3b1f(%rip), %r12      # 0x5fd0
movq 0x3b28(%rip), %rbp      # 0x5fe0
leaq 0x1b75(%rip), %r13      # 0x4034
xorl %eax, %eax
xorl %ecx, %ecx
movq %rbx, 0x30(%rsp)
movl %ebx, %edx
movq %rcx, 0x28(%rsp)
andb %cl, %dl
movq %rax, 0x18(%rsp)
andb %al, %dl
movb %dl, (%rsp)
pushq $0xa
popq %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2fa8
movl 0x24(%rsp), %eax
cmpl $0x1, %eax
jne 0x25c3
movq %r12, %rdi
leaq 0x1b04(%rip), %rsi      # 0x4004
callq 0x2180
movq %rax, %rdi
callq 0x20c0
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x20f0
movq %rbp, %rdi
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
movl %ebx, %edx
callq 0x2100
cmpl $0x10, 0x14(%rsp)
movq %r13, %rsi
jle 0x25ae
movq %r12, %rdi
callq 0x20c0
movq %r12, %rdi
leaq 0x1b7b(%rip), %rsi      # 0x40c5
callq 0x2180
movq %rax, %rdi
callq 0x20c0
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x2030
cmpq $0x0, 0x60(%rsp)
leaq 0x1b6c(%rip), %rsi      # 0x40dd
je 0x25ae
movq %r12, %rdi
callq 0x20c0
movq %r12, %rdi
leaq 0x1b70(%rip), %rsi      # 0x40f5
callq 0x2180
movq %rax, %rdi
callq 0x20c0
movq %rbp, %rdi
leaq 0x38(%rsp), %rsi
callq 0x2030
cmpq $0x0, 0x40(%rsp)
leaq 0x1b63(%rip), %rsi      # 0x410f
jne 0x2616
movq %r12, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20c0
jmp 0x24de
testl %eax, %eax
je 0x280b
cmpl $0x2, %eax
jne 0x24de
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
cqto
pushq $0x48
popq %rcx
idivq %rcx
cmpq $0x3, %rax
setae %al
andb (%rsp), %al
cmpb $0x1, %al
je 0x2707
movq %r12, %rdi
leaq 0x1b45(%rip), %rsi      # 0x4149
callq 0x2180
movq %rax, %rdi
callq 0x20c0
jmp 0x24de
movq %r12, %rdi
callq 0x20c0
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1afc(%rip), %rsi      # 0x4129
callq 0x2917
testb %al, %al
je 0x263f
movb $0x1, %al
movq %rax, 0x30(%rsp)
jmp 0x2676
movq %rbx, %rdi
leaq 0x1ae9(%rip), %rsi      # 0x4132
callq 0x2917
testb %al, %al
je 0x265b
movb $0x1, %al
movq %rax, 0x28(%rsp)
jmp 0x2676
movq %rbx, %rdi
leaq 0x1ad9(%rip), %rsi      # 0x413e
callq 0x2917
movq 0x18(%rsp), %rcx
orb %al, %cl
movq %rcx, 0x18(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x21b0
movl 0x14(%rsp), %eax
movl %eax, (%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x21b0
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
leaq 0xe0(%rsp), %rsi
movl (%rsp), %edx
leaq 0xc0(%rsp), %rcx
callq 0x2e42
leaq 0xc0(%rsp), %rdi
callq 0x20b0
leaq 0xe0(%rsp), %rdi
callq 0x20b0
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2924
movq %rbx, %rdi
callq 0x2eb0
movq 0x30(%rsp), %rbx
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
jmp 0x24c3
leaq 0xa8(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x2950
leaq 0x188(%rsp), %rbx
movq %rbx, %rdi
leaq 0x19fe(%rip), %rsi      # 0x4129
leaq 0x100(%rsp), %rdx
callq 0x29aa
leaq 0xa8(%rsp), %rsi
movq %rbx, %rdx
callq 0x23ce
movq %rbx, %rdi
callq 0x20b0
leaq 0xa8(%rsp), %rdi
callq 0x28ec
leaq 0x90(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x2950
leaq 0x168(%rsp), %rbx
movq %rbx, %rdi
leaq 0x19b1(%rip), %rsi      # 0x4132
leaq 0x100(%rsp), %rdx
callq 0x29aa
leaq 0x90(%rsp), %rsi
movq %rbx, %rdx
callq 0x23ce
movq %rbx, %rdi
callq 0x20b0
leaq 0x90(%rsp), %rdi
callq 0x28ec
leaq 0x78(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x2950
leaq 0x148(%rsp), %rbx
movq %rbx, %rdi
leaq 0x196a(%rip), %rsi      # 0x413e
leaq 0x100(%rsp), %rdx
callq 0x29aa
leaq 0x78(%rsp), %rsi
movq %rbx, %rdx
callq 0x23ce
movq %rbx, %rdi
callq 0x20b0
leaq 0x78(%rsp), %rdi
callq 0x28ec
movb $0x1, %bl
movb $0x1, %al
movb $0x1, %cl
jmp 0x24c3
leaq 0x38(%rsp), %rdi
callq 0x20b0
leaq 0x58(%rsp), %rdi
callq 0x20b0
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x20b0
jmp 0x2846
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x2889
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x20b0
jmp 0x2862
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x2889
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x20b0
jmp 0x2881
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x28ec
jmp 0x28cf
movq %rax, %rbx
jmp 0x28a5
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x20b0
leaq 0xe0(%rsp), %rdi
callq 0x20b0
jmp 0x28cf
jmp 0x28cc
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x2eb0
jmp 0x28cf
jmp 0x28cc
jmp 0x28cc
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x20b0
leaq 0x58(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2200
nop