// File: /workspace/github_cpp_makefile_star2_O3/tbonelaforge[P]gradebook/Main.cpp
// Function: handleAddTestGrade(Gradebook&, bool)
void handleAddTestGrade(Gradebook &gradebook, bool idMode) {
    int testNumber, testGrade;
    cout << "Enter test number: (1 - " << gradebook.getNumTests() << ")" << endl;
    cin >> testNumber;
    if (testNumber < 1 || testNumber > gradebook.getNumTests()) {
        cout << "Invalid Test Number." << endl;
        return;
    }
    if (gradebook.getTestRecorded(testNumber)) {
        cout << "Test " << testNumber << " already recorded..." << endl;
        return;
    }
    Student * student;
    if (!idMode) {
        Node * current = gradebook.getIndex();
        while (current != NULL) {
            student = current->student;
            cout << "Enter Test " << testNumber << " Grade for "
                 << student->getLastName() << ", " << student->getFirstName() << endl;
            cin >> testGrade;
            student->setTestGrade(testNumber - 1, testGrade);
            saveGrades(gradebook);
            current = current->next;
        }
    } else {
        student = gradebook.getHead();
        while (student != NULL) {
            cout << "Enter Test " << testNumber << " Grade for "
                 << student->getLastName() << ", " << student->getFirstName() << endl;
            cin >> testGrade;
            student->setTestGrade(testNumber - 1, testGrade);
            saveGrades(gradebook);
            student = student->next;
        }
    }
    gradebook.setTestRecorded(testNumber);
    saveGrades(gradebook);
    handleOutputGrades(gradebook, idMode);
    
    transLog << "Recorded grades for Test: " << testNumber << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %r12d
movq %rdi, %rbx
movq 0x9b6e(%rip), %r14      # 0xcfc8
leaq 0x5ee6(%rip), %rsi      # 0x9347
movl $0x18, %edx
movq %r14, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x531c
movq %r14, %rdi
movl %eax, %esi
callq 0x2300
movq %rax, %r15
leaq 0x5c8b(%rip), %rsi      # 0x9115
movl $0x1, %edx
movq %rax, %rdi
callq 0x2210
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq 0x9b1b(%rip), %rdi      # 0xcfe0
leaq -0x2c(%rbp), %r15
movq %r15, %rsi
callq 0x2110
movl (%r15), %r15d
testl %r15d, %r15d
jle 0x34e6
movq %rbx, %rdi
callq 0x531c
cmpl %eax, %r15d
jle 0x3530
leaq 0x5e73(%rip), %rsi      # 0x9360
movl $0x14, %edx
movq %r14, %rdi
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
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x5f58
testb %al, %al
je 0x357c
movq 0x9a82(%rip), %rbx      # 0xcfc8
leaq 0x5e2e(%rip), %rsi      # 0x937b
movl $0x5, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
leaq 0x5d89(%rip), %rsi      # 0x92f8
movl $0x14, %edx
movq %rax, %rdi
jmp 0x34f5
movl %r12d, -0x74(%rbp)
movq %rbx, %rdi
testb %r12b, %r12b
je 0x36c1
callq 0x58a0
testq %rax, %rax
je 0x37f2
movq %rax, %r15
movq 0x9a24(%rip), %r12      # 0xcfc8
leaq -0x30(%rbp), %r13
movl $0xb, %edx
movq %r12, %rdi
leaq 0x5dbe(%rip), %rsi      # 0x9375
callq 0x2210
movl -0x2c(%rbp), %esi
movq %r12, %rdi
callq 0x2300
movq %rax, %r14
movl $0xb, %edx
movq %rax, %rdi
leaq 0x5d41(%rip), %rsi      # 0x931a
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x62ee
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r14, %rdi
callq 0x2210
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x5d1a(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x62c0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x2210
movq %rax, %r14
movq (%rax), %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 -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3670
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3689
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x9950(%rip), %rdi      # 0xcfe0
movq %r13, %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r15, %rdi
callq 0x636a
movq %rbx, %rdi
callq 0x256c
movq (%r15), %r15
testq %r15, %r15
jne 0x35a8
jmp 0x37f2
callq 0x58aa
testq %rax, %rax
je 0x37f2
movq %rax, %r15
movq 0x98ef(%rip), %r12      # 0xcfc8
movq (%r15), %r14
movl $0xb, %edx
movq %r12, %rdi
leaq 0x5c8a(%rip), %rsi      # 0x9375
callq 0x2210
movl -0x2c(%rbp), %esi
movq %r12, %rdi
callq 0x2300
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x5c0d(%rip), %rsi      # 0x931a
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0x62ee
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r13, %rdi
callq 0x2210
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x5be6(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x62c0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r13, %rdi
callq 0x2210
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x37a4
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x37bd
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x981c(%rip), %rdi      # 0xcfe0
leaq -0x30(%rbp), %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r14, %rdi
callq 0x636a
movq %rbx, %rdi
callq 0x256c
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x36d9
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x5f0e
movq %rbx, %rdi
callq 0x256c
movzbl -0x74(%rbp), %esi
movq %rbx, %rdi
callq 0x2eb9
leaq 0x99d0(%rip), %rbx      # 0xd1e8
leaq 0x5b62(%rip), %rsi      # 0x9381
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
jmp 0x34fa
jmp 0x3845
jmp 0x3845
jmp 0x3845
movq %rax, %rbx
jmp 0x3868
jmp 0x384c
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3868
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3881
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2310