// File: /workspace/github_cpp_makefile_star2_O1/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 0x9b4c(%rip), %r14      # 0xcfc8
leaq 0x5ec4(%rip), %rsi      # 0x9347
movl $0x18, %edx
movq %r14, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x5300
movq %r14, %rdi
movl %eax, %esi
callq 0x2300
movq %rax, %r15
leaq 0x5c69(%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 0x9af9(%rip), %rdi      # 0xcfe0
leaq -0x2c(%rbp), %r15
movq %r15, %rsi
callq 0x2110
movl (%r15), %r15d
testl %r15d, %r15d
jle 0x3508
movq %rbx, %rdi
callq 0x5300
cmpl %eax, %r15d
jle 0x3552
leaq 0x5e51(%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 0x5f1a
testb %al, %al
je 0x359e
movq 0x9a60(%rip), %rbx      # 0xcfc8
leaq 0x5e0c(%rip), %rsi      # 0x937b
movl $0x5, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
leaq 0x5d67(%rip), %rsi      # 0x92f8
movl $0x14, %edx
movq %rax, %rdi
jmp 0x3517
movl %r12d, -0x74(%rbp)
movq %rbx, %rdi
testb %r12b, %r12b
je 0x36e3
callq 0x5862
testq %rax, %rax
je 0x3814
movq %rax, %r15
movq 0x9a02(%rip), %r12      # 0xcfc8
leaq -0x30(%rbp), %r13
movl $0xb, %edx
movq %r12, %rdi
leaq 0x5d9c(%rip), %rsi      # 0x9375
callq 0x2210
movl -0x2c(%rbp), %esi
movq %r12, %rdi
callq 0x2300
movq %rax, %r14
movl $0xb, %edx
movq %rax, %rdi
leaq 0x5d1f(%rip), %rsi      # 0x931a
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x62d4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r14, %rdi
callq 0x2210
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x5cf8(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x62a6
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 0x3692
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x36ab
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x992e(%rip), %rdi      # 0xcfe0
movq %r13, %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r15, %rdi
callq 0x6350
movq %rbx, %rdi
callq 0x256c
movq (%r15), %r15
testq %r15, %r15
jne 0x35ca
jmp 0x3814
callq 0x586c
testq %rax, %rax
je 0x3814
movq %rax, %r15
movq 0x98cd(%rip), %r12      # 0xcfc8
movq (%r15), %r14
movl $0xb, %edx
movq %r12, %rdi
leaq 0x5c68(%rip), %rsi      # 0x9375
callq 0x2210
movl -0x2c(%rbp), %esi
movq %r12, %rdi
callq 0x2300
movq %rax, %r13
movl $0xb, %edx
movq %rax, %rdi
leaq 0x5beb(%rip), %rsi      # 0x931a
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0x62d4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r13, %rdi
callq 0x2210
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x5bc4(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x62a6
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 0x37c6
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x37df
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x97fa(%rip), %rdi      # 0xcfe0
leaq -0x30(%rbp), %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r14, %rdi
callq 0x6350
movq %rbx, %rdi
callq 0x256c
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x36fb
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x5ed0
movq %rbx, %rdi
callq 0x256c
movzbl -0x74(%rbp), %esi
movq %rbx, %rdi
callq 0x2edb
leaq 0x99ae(%rip), %rbx      # 0xd1e8
leaq 0x5b40(%rip), %rsi      # 0x9381
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
jmp 0x351c
jmp 0x3867
jmp 0x3867
jmp 0x3867
movq %rax, %rbx
jmp 0x388a
jmp 0x386e
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x388a
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x38a3
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2310