// File: /workspace/github_cpp_makefile_star2_O1/tbonelaforge[P]gradebook/Main.cpp
// Function: handleAddStudent(Gradebook&)
void handleAddStudent(Gradebook &gradebook) {
    string firstName, lastName;
    int studentId;
    cout << "Enter the new student's first and last name: " << endl;
    cin >> firstName;
    while (firstName.length() > 20){
      cout<< "Error, too many characters, please shorten to less than 20"<<endl;
      cout << "Enter the new student's first name: " << endl;
      cin >> firstName;
    }

    cin >> lastName;
    while (lastName.length() > 20){
      cout<< "Error, too many characters, please shorten to less than 20"<<endl;
      cout << "Enter the new student's last name: " << endl;
      cin >> lastName;
    }

    cout << "Enter the new student's ID number: " << endl;
    cin >> studentId;
    while (studentId>9999 || studentId<1){
      cout<< " Error please enter a value between 1-9999"<< endl;
      cout << "Enter the new student's ID number: " << endl;
      cin >> studentId;
    }

    cout << "Adding " << firstName << " " << lastName << " (" << studentId << ") to the gradebook" << endl;
    try {
        Student * newStudent = gradebook.addStudent(studentId, firstName, lastName);
        cout << "Successfully added student " << newStudent->getId() << ": "
             << newStudent->getFirstName() << " " << newStudent->getLastName() << endl;
        saveGrades(gradebook);
    } catch (const string& reason) {
        cout << "Unable to add new student: " << endl << reason << endl;
    }
    transLog << "Added " << firstName << " " << lastName << " id " << studentId << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, -0x78(%rbp)
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x40(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq 0x8cee(%rip), %rbx      # 0xcfc8
leaq 0x5362(%rip), %rsi      # 0x9643
movl $0x2d, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x8cbc(%rip), %r14      # 0xcfc8
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq 0x8cbd(%rip), %rdi      # 0xcfe0
leaq -0x70(%rbp), %rsi
callq 0x2250
leaq 0x533e(%rip), %r15      # 0x9671
leaq 0x5372(%rip), %rbx      # 0x96ac
movq 0x8c9f(%rip), %r12      # 0xcfe0
leaq -0x70(%rbp), %r13
cmpq $0x15, -0x68(%rbp)
jb 0x43ca
movl $0x3a, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movl $0x24, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq %r12, %rdi
movq %r13, %rsi
callq 0x2250
jmp 0x4345
movq 0x8c0f(%rip), %rdi      # 0xcfe0
leaq -0x50(%rbp), %rsi
callq 0x2250
leaq 0x5290(%rip), %r15      # 0x9671
leaq 0x52e9(%rip), %rbx      # 0x96d1
movq 0x8bf1(%rip), %r12      # 0xcfe0
leaq -0x50(%rbp), %r13
cmpq $0x15, -0x48(%rbp)
jb 0x4478
movl $0x3a, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movl $0x23, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq %r12, %rdi
movq %r13, %rsi
callq 0x2250
jmp 0x43f3
movq 0x8b49(%rip), %rbx      # 0xcfc8
leaq 0x526f(%rip), %rsi      # 0x96f5
movl $0x23, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x8b17(%rip), %r14      # 0xcfc8
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq 0x8b18(%rip), %rdi      # 0xcfe0
leaq -0x2c(%rbp), %rsi
callq 0x2110
movl $0xffffd8f0, %r15d      # imm = 0xFFFFD8F0
leaq 0x5217(%rip), %r12      # 0x96f5
movq 0x8afb(%rip), %r13      # 0xcfe0
leaq -0x2c(%rbp), %rbx
movl -0x2c(%rbp), %eax
addl %r15d, %eax
cmpl %r15d, %eax
ja 0x457a
movl $0x2a, %edx
movq %r14, %rdi
leaq 0x5212(%rip), %rsi      # 0x9719
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movl $0x23, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2110
jmp 0x44e9
movq 0x8a47(%rip), %rdi      # 0xcfc8
leaq 0x51bc(%rip), %rsi      # 0x9744
movl $0x7, %edx
callq 0x2210
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq 0x8a27(%rip), %rdi      # 0xcfc8
callq 0x2210
movq %rax, %rbx
leaq 0x4d77(%rip), %rsi      # 0x9327
movl $0x1, %edx
movq %rax, %rdi
callq 0x2210
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x2210
movq %rax, %rbx
leaq 0x5175(%rip), %rsi      # 0x974c
movl $0x2, %edx
movq %rax, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %rbx
leaq 0x5156(%rip), %rsi      # 0x974f
movl $0x12, %edx
movq %rax, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movl -0x2c(%rbp), %ebx
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %rdi
callq 0x508c
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x508c
leaq -0xf8(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
movq -0x78(%rbp), %rdi
movl %ebx, %esi
callq 0x5314
movq %rax, %r14
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x46ac
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x46c7
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x88fa(%rip), %rdi      # 0xcfc8
leaq 0x508d(%rip), %rsi      # 0x9762
movl $0x1b, %edx
callq 0x2210
movq %r14, %rdi
callq 0x629c
movq 0x88da(%rip), %rdi      # 0xcfc8
movl %eax, %esi
callq 0x2300
movq %rax, %rbx
leaq 0x49ef(%rip), %rsi      # 0x90ee
movl $0x2, %edx
movq %rax, %rdi
callq 0x2210
leaq -0xb8(%rbp), %rdi
movq %r14, %rsi
callq 0x62a6
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq %rbx, %rdi
callq 0x2210
movq %rax, %rbx
leaq 0x4bec(%rip), %rsi      # 0x9327
movl $0x1, %edx
movq %rax, %rdi
callq 0x2210
leaq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x62d4
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq %rbx, %rdi
callq 0x2210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47b6
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47d5
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x78(%rbp), %rdi
callq 0x256c
leaq 0x8a03(%rip), %rdi      # 0xd1e8
leaq 0x4fae(%rip), %rsi      # 0x979a
movl $0x6, %edx
callq 0x2210
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq 0x89e3(%rip), %rdi      # 0xd1e8
callq 0x2210
movq %rax, %rbx
leaq 0x4b13(%rip), %rsi      # 0x9327
movl $0x1, %edx
movq %rax, %rdi
callq 0x2210
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x2210
movq %rax, %rbx
leaq 0x4f66(%rip), %rsi      # 0x97a1
movl $0x4, %edx
movq %rax, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4896
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x48af
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4906
jmp 0x4954
movq %rdx, %r14
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x48f1
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21d0
jmp 0x48f1
movq %rdx, %r14
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x495a
movq -0xe8(%rbp), %rsi
jmp 0x494a
movq %rdx, %r14
movq %rax, %rbx
jmp 0x4933
movq %rdx, %r14
movq %rax, %rbx
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4933
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x495a
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21d0
jmp 0x495a
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x49cd
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
movq 0x8656(%rip), %rdi      # 0xcfc8
leaq 0x4e05(%rip), %rsi      # 0x977e
movl $0x1b, %edx
callq 0x2210
movq 0x863e(%rip), %rdi      # 0xcfc8
callq 0x20d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x2210
movq %rax, %rdi
callq 0x20d0
callq 0x22c0
jmp 0x47de
jmp 0x49ca
movq %rax, %rbx
callq 0x22c0
jmp 0x49cd
movq %rax, %rdi
callq 0x507d
jmp 0x49ca
jmp 0x49ca
jmp 0x49ca
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x49e6
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x49ff
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2310