// File: /workspace/github_cpp_makefile_star2_O2/tbonelaforge[P]gradebook/Main.cpp
// Function: handleAddFinalExamGrade(Gradebook&, bool)
void handleAddFinalExamGrade(Gradebook &gradebook, bool idMode) {
    int finalExamGrade;
    Student * student;
    if (gradebook.getFinalExamRecorded()) {
        cout << "Final Exam Already Recorded..." << endl;
        return;
    }
    if (!idMode) {
        Node * current = gradebook.getIndex();
        while (current != NULL) {
            student = current->student;
            cout << "Enter Final Exam Grade for "
                 << student->getLastName() << ", " << student->getFirstName() << endl;
            cin >> finalExamGrade;
            student->setFinalExamGrade(finalExamGrade);
            saveGrades(gradebook);
            current = current->next;
        }
    } else {
        student = gradebook.getHead();
        while (student != NULL) {
            cout << "Enter Final Exam Grade for "
                 << student->getLastName() << ", " << student->getFirstName() << endl;
            cin >> finalExamGrade;
            student->setFinalExamGrade(finalExamGrade);
            saveGrades(gradebook);
            student = student->next;
        }
    }
    gradebook.setFinalExamRecorded();
    saveGrades(gradebook);
    handleOutputGrades(gradebook, idMode);
    
    transLog << "Recorded grades for Final" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %ebx
movq %rdi, -0x38(%rbp)
callq 0x4a6e
testb %al, %al
je 0x30f7
movq 0x7ef3(%rip), %rdi      # 0xafc8
leaq 0x42c0(%rip), %rsi      # 0x739c
callq 0x2170
movq %rax, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movl %ebx, -0x3c(%rbp)
testb %bl, %bl
je 0x31ba
movq -0x38(%rbp), %rdi
callq 0x45a8
movq %rax, %r15
leaq -0x80(%rbp), %r13
leaq -0x60(%rbp), %r14
leaq -0x2c(%rbp), %r12
testq %r15, %r15
je 0x3273
movq 0x7e9e(%rip), %rdi      # 0xafc8
leaq 0x428a(%rip), %rsi      # 0x73bb
callq 0x2170
movq %rax, %rbx
movq %r13, %rdi
movq %r15, %rsi
callq 0x4d5e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2160
movq %rax, %rdi
leaq 0x41cd(%rip), %rsi      # 0x7326
callq 0x2170
movq %rax, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d42
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movq %rax, %rdi
callq 0x20b0
movq %r14, %rdi
callq 0x2358
movq %r13, %rdi
callq 0x2358
movq 0x7e4a(%rip), %rdi      # 0xafe0
movq %r12, %rsi
callq 0x20e0
movl -0x2c(%rbp), %esi
movq %r15, %rdi
callq 0x4de2
movq -0x38(%rbp), %rdi
callq 0x255c
movq (%r15), %r15
jmp 0x311a
movq -0x38(%rbp), %rdi
callq 0x45b2
movq %rax, %r15
leaq -0x80(%rbp), %r14
leaq -0x60(%rbp), %r13
testq %r15, %r15
je 0x3273
movq (%r15), %r12
movq 0x7de7(%rip), %rdi      # 0xafc8
leaq 0x41d3(%rip), %rsi      # 0x73bb
callq 0x2170
movq %rax, %rbx
movq %r14, %rdi
movq %r12, %rsi
callq 0x4d5e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movq %rax, %rdi
leaq 0x4116(%rip), %rsi      # 0x7326
callq 0x2170
movq %rax, %rbx
movq %r13, %rdi
movq %r12, %rsi
callq 0x4d42
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2160
movq %rax, %rdi
callq 0x20b0
movq %r13, %rdi
callq 0x2358
movq %r14, %rdi
callq 0x2358
movq 0x7d93(%rip), %rdi      # 0xafe0
leaq -0x2c(%rbp), %rsi
callq 0x20e0
movl -0x2c(%rbp), %esi
movq %r12, %rdi
callq 0x4de2
movq -0x38(%rbp), %rdi
callq 0x255c
movq 0x8(%r15), %r15
jmp 0x31ce
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x4a26
movq %rbx, %rdi
callq 0x255c
movzbl -0x3c(%rbp), %esi
movq %rbx, %rdi
callq 0x29fe
leaq 0x7f3e(%rip), %rdi      # 0xb1d8
leaq 0x4136(%rip), %rsi      # 0x73d7
callq 0x2170
movq %rax, %rdi
callq 0x20b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x32d3
jmp 0x32d3
jmp 0x32c3
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2358
jmp 0x32d6
jmp 0x32d3
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2358
movq %rbx, %rdi
callq 0x22d0