// File: 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
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x21a0
movl %eax, %edi
callq 0x21b0
leaq -0x30(%rbp), %rdi
callq 0x2260
leaq -0x58(%rbp), %rdi
callq 0x2260
movb $0x0, -0x59(%rbp)
movb $0x0, -0x5a(%rbp)
movb $0x0, -0x5b(%rbp)
jmp 0x264a
leaq -0x9(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x4680
jmp 0x2659
cmpl $0x0, -0x10(%rbp)
jne 0x2675
jmp 0x2ca2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2cbd
cmpl $0x1, -0x10(%rbp)
jne 0x29c9
movq 0x594a(%rip), %rdi      # 0x7fd0
leaq 0x2977(%rip), %rsi      # 0x5004
callq 0x21c0
movq %rax, -0x1c8(%rbp)
jmp 0x269b
movq -0x1c8(%rbp), %rdi
movq 0x5917(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x26b0
movq 0x5929(%rip), %rdi      # 0x7fe0
leaq -0x34(%rbp), %rsi
callq 0x20f0
jmp 0x26c2
callq 0x2de0
movq %rax, %rsi
movq 0x590f(%rip), %rdi      # 0x7fe0
movl $0xa, %edx
callq 0x2110
jmp 0x26dd
cmpl $0x11, -0x34(%rbp)
jge 0x2719
movq 0x58e6(%rip), %rdi      # 0x7fd0
leaq 0x2943(%rip), %rsi      # 0x5034
callq 0x21c0
movq %rax, -0x1d0(%rbp)
jmp 0x26ff
movq -0x1d0(%rbp), %rdi
movq 0x58b3(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x2714
jmp 0x2648
movq 0x58b0(%rip), %rdi      # 0x7fd0
movq 0x5899(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x272e
movq 0x589b(%rip), %rdi      # 0x7fd0
leaq 0x2989(%rip), %rsi      # 0x50c5
callq 0x21c0
movq %rax, -0x1d8(%rbp)
jmp 0x274a
movq -0x1d8(%rbp), %rdi
movq 0x5868(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x275f
movq 0x587a(%rip), %rdi      # 0x7fe0
leaq -0x30(%rbp), %rsi
callq 0x2050
jmp 0x2771
leaq -0x30(%rbp), %rdi
callq 0x22a0
testb $0x1, %al
jne 0x2780
jmp 0x27b6
movq 0x5849(%rip), %rdi      # 0x7fd0
leaq 0x294f(%rip), %rsi      # 0x50dd
callq 0x21c0
movq %rax, -0x1e0(%rbp)
jmp 0x279c
movq -0x1e0(%rbp), %rdi
movq 0x5816(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x27b1
jmp 0x2648
movq 0x5813(%rip), %rdi      # 0x7fd0
movq 0x57fc(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x27cb
movq 0x57fe(%rip), %rdi      # 0x7fd0
leaq 0x291c(%rip), %rsi      # 0x50f5
callq 0x21c0
movq %rax, -0x1e8(%rbp)
jmp 0x27e7
movq -0x1e8(%rbp), %rdi
movq 0x57cb(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x27fc
movq 0x57dd(%rip), %rdi      # 0x7fe0
leaq -0x58(%rbp), %rsi
callq 0x2050
jmp 0x280e
leaq -0x58(%rbp), %rdi
callq 0x22a0
testb $0x1, %al
jne 0x281d
jmp 0x2853
movq 0x57ac(%rip), %rdi      # 0x7fd0
leaq 0x28e4(%rip), %rsi      # 0x510f
callq 0x21c0
movq %rax, -0x1f0(%rbp)
jmp 0x2839
movq -0x1f0(%rbp), %rdi
movq 0x5779(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x284e
jmp 0x2648
movq 0x5776(%rip), %rdi      # 0x7fd0
movq 0x575f(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x2868
leaq 0x28ba(%rip), %rsi      # 0x5129
leaq -0x58(%rbp), %rdi
callq 0x2df0
movb %al, -0x1f1(%rbp)
jmp 0x2880
movb -0x1f1(%rbp), %al
testb $0x1, %al
jne 0x288c
jmp 0x2892
movb $0x1, -0x59(%rbp)
jmp 0x28e8
leaq 0x2899(%rip), %rsi      # 0x5132
leaq -0x58(%rbp), %rdi
callq 0x2df0
movb %al, -0x1f2(%rbp)
jmp 0x28aa
movb -0x1f2(%rbp), %al
testb $0x1, %al
jne 0x28b6
jmp 0x28bc
movb $0x1, -0x5b(%rbp)
jmp 0x28e6
leaq 0x287b(%rip), %rsi      # 0x513e
leaq -0x58(%rbp), %rdi
callq 0x2df0
movb %al, -0x1f3(%rbp)
jmp 0x28d4
movb -0x1f3(%rbp), %al
testb $0x1, %al
jne 0x28e0
jmp 0x28e4
movb $0x1, -0x5a(%rbp)
jmp 0x28e6
jmp 0x28e8
leaq -0xd8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20b0
jmp 0x28fa
movl -0x34(%rbp), %eax
movl %eax, -0x1f8(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x20b0
jmp 0x2915
movl -0x1f8(%rbp), %edx
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0xf8(%rbp), %rcx
callq 0x4420
jmp 0x2937
leaq -0xf8(%rbp), %rdi
callq 0x2100
leaq -0xd8(%rbp), %rdi
callq 0x2100
movq -0x1c0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2e20
jmp 0x2964
leaq -0xb8(%rbp), %rdi
callq 0x44c0
jmp 0x2c9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x299b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x2100
leaq -0xd8(%rbp), %rdi
callq 0x2100
jmp 0x2cbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x44c0
jmp 0x2cbd
cmpl $0x2, -0x10(%rbp)
jne 0x2c5e
movq -0x1c0(%rbp), %rdi
callq 0x2d60
cmpq $0x3, %rax
jb 0x2c5e
testb $0x1, -0x59(%rbp)
je 0x2c5e
testb $0x1, -0x5b(%rbp)
je 0x2c5e
testb $0x1, -0x5a(%rbp)
je 0x2c5e
movq -0x1c0(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0x2e90
jmp 0x2a1c
leaq -0x131(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x22d0
movq -0x200(%rbp), %rdx
leaq 0x26ec(%rip), %rsi      # 0x5129
leaq -0x130(%rbp), %rdi
callq 0x2f80
jmp 0x2a4b
movq -0x1c0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x130(%rbp), %rdx
callq 0x2540
jmp 0x2a67
leaq -0x130(%rbp), %rdi
callq 0x2100
leaq -0x131(%rbp), %rdi
callq 0x2210
leaq -0x110(%rbp), %rdi
callq 0x2d00
movq -0x1c0(%rbp), %rsi
leaq -0x150(%rbp), %rdi
callq 0x2e90
jmp 0x2aa0
leaq -0x171(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x22d0
movq -0x208(%rbp), %rdx
leaq 0x2671(%rip), %rsi      # 0x5132
leaq -0x170(%rbp), %rdi
callq 0x2f80
jmp 0x2acf
movq -0x1c0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x2540
jmp 0x2aeb
leaq -0x170(%rbp), %rdi
callq 0x2100
leaq -0x171(%rbp), %rdi
callq 0x2210
leaq -0x150(%rbp), %rdi
callq 0x2d00
movq -0x1c0(%rbp), %rsi
leaq -0x190(%rbp), %rdi
callq 0x2e90
jmp 0x2b24
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x22d0
movq -0x210(%rbp), %rdx
leaq 0x25f9(%rip), %rsi      # 0x513e
leaq -0x1b0(%rbp), %rdi
callq 0x2f80
jmp 0x2b53
movq -0x1c0(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
callq 0x2540
jmp 0x2b6f
leaq -0x1b0(%rbp), %rdi
callq 0x2100
leaq -0x1b1(%rbp), %rdi
callq 0x2210
leaq -0x190(%rbp), %rdi
callq 0x2d00
jmp 0x2c99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2bbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x2100
leaq -0x131(%rbp), %rdi
callq 0x2210
leaq -0x110(%rbp), %rdi
callq 0x2d00
jmp 0x2cbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2c01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x2100
leaq -0x171(%rbp), %rdi
callq 0x2210
leaq -0x150(%rbp), %rdi
callq 0x2d00
jmp 0x2cbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2c44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2100
leaq -0x1b1(%rbp), %rdi
callq 0x2210
leaq -0x190(%rbp), %rdi
callq 0x2d00
jmp 0x2cbd
cmpl $0x2, -0x10(%rbp)
jne 0x2c97
movq 0x5365(%rip), %rdi      # 0x7fd0
leaq 0x24d7(%rip), %rsi      # 0x5149
callq 0x21c0
movq %rax, -0x218(%rbp)
jmp 0x2c80
movq -0x218(%rbp), %rdi
movq 0x5332(%rip), %rsi      # 0x7fc0
callq 0x21f0
jmp 0x2c95
jmp 0x2c97
jmp 0x2c99
jmp 0x2c9b
jmp 0x2c9d
jmp 0x2648
leaq -0x58(%rbp), %rdi
callq 0x2100
leaq -0x30(%rbp), %rdi
callq 0x2100
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0x2100
leaq -0x30(%rbp), %rdi
callq 0x2100
movq -0x68(%rbp), %rdi
callq 0x22c0
nopl (%rax,%rax)