// File: /workspace/github_cpp_makefile_star2_O2/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, %r15d
movq %rdi, %r14
movq 0x8205(%rip), %rdi      # 0xafc8
leaq 0x457d(%rip), %rsi      # 0x7347
callq 0x2170
movq %rax, %rbx
movq %r14, %rdi
callq 0x41de
movq %rbx, %rdi
movl %eax, %esi
callq 0x22c0
leaq 0x432a(%rip), %rsi      # 0x7115
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq 0x81de(%rip), %rdi      # 0xafe0
leaq -0x2c(%rbp), %rbx
movq %rbx, %rsi
callq 0x20e0
movl (%rbx), %ebx
testl %ebx, %ebx
jle 0x2e20
movq %r14, %rdi
callq 0x41de
cmpl %eax, %ebx
jle 0x2e4a
movq 0x81a1(%rip), %rdi      # 0xafc8
leaq 0x4532(%rip), %rsi      # 0x7360
callq 0x2170
movq %rax, %rdi
callq 0x20b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x2c(%rbp), %esi
movq %r14, %rdi
callq 0x4a5e
testb %al, %al
je 0x2e83
movq 0x8168(%rip), %rdi      # 0xafc8
leaq 0x4514(%rip), %rsi      # 0x737b
callq 0x2170
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x22c0
leaq 0x447a(%rip), %rsi      # 0x72f8
movq %rax, %rdi
jmp 0x2e2e
movl %r15d, -0x3c(%rbp)
testb %r15b, %r15b
movq %r14, -0x38(%rbp)
movq %r14, %rdi
je 0x2f6a
callq 0x45a8
movq %rax, %r15
leaq -0x80(%rbp), %r12
leaq -0x60(%rbp), %r13
leaq -0x30(%rbp), %r14
testq %r15, %r15
je 0x303e
movq 0x810d(%rip), %rdi      # 0xafc8
leaq 0x44b3(%rip), %rsi      # 0x7375
callq 0x2170
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x22c0
movq %rax, %rdi
leaq 0x443e(%rip), %rsi      # 0x731a
callq 0x2170
movq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4d5e
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2160
movq %rax, %rdi
leaq 0x4422(%rip), %rsi      # 0x7326
callq 0x2170
movq %rax, %rbx
movq %r13, %rdi
movq %r15, %rsi
callq 0x4d42
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2160
movq %rax, %rdi
callq 0x20b0
movq %r13, %rdi
callq 0x2358
movq %r12, %rdi
callq 0x2358
movq 0x809f(%rip), %rdi      # 0xafe0
movq %r14, %rsi
callq 0x20e0
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r15, %rdi
callq 0x4dc8
movq -0x38(%rbp), %rdi
callq 0x255c
movq (%r15), %r15
jmp 0x2eab
callq 0x45b2
movq %rax, %r15
leaq -0x80(%rbp), %r12
leaq -0x60(%rbp), %r14
testq %r15, %r15
je 0x303e
movq (%r15), %r13
movq 0x803b(%rip), %rdi      # 0xafc8
leaq 0x43e1(%rip), %rsi      # 0x7375
callq 0x2170
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x22c0
movq %rax, %rdi
leaq 0x436c(%rip), %rsi      # 0x731a
callq 0x2170
movq %rax, %rbx
movq %r12, %rdi
movq %r13, %rsi
callq 0x4d5e
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2160
movq %rax, %rdi
leaq 0x4350(%rip), %rsi      # 0x7326
callq 0x2170
movq %rax, %rbx
movq %r14, %rdi
movq %r13, %rsi
callq 0x4d42
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movq %rax, %rdi
callq 0x20b0
movq %r14, %rdi
callq 0x2358
movq %r12, %rdi
callq 0x2358
movq 0x7fcd(%rip), %rdi      # 0xafe0
leaq -0x30(%rbp), %rsi
callq 0x20e0
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r13, %rdi
callq 0x4dc8
movq -0x38(%rbp), %rdi
callq 0x255c
movq 0x8(%r15), %r15
jmp 0x2f7a
movl -0x2c(%rbp), %esi
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x4a14
movq %rbx, %rdi
callq 0x255c
movzbl -0x3c(%rbp), %esi
movq %rbx, %rdi
callq 0x29fe
leaq 0x8170(%rip), %rdi      # 0xb1d8
leaq 0x4312(%rip), %rsi      # 0x7381
callq 0x2170
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x22c0
jmp 0x2e33
jmp 0x309a
jmp 0x309a
jmp 0x308a
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2358
jmp 0x309d
jmp 0x309a
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x22d0