// File: /workspace/github_cpp_makefile_star2_O3/tbonelaforge[P]gradebook/Main.cpp
// Function: handleAddProgramGrade(Gradebook&, bool)
void handleAddProgramGrade(Gradebook &gradebook, bool idMode) {
    int programNumber, programGrade;
    cout << "Enter programming assignment number: (1 - " << gradebook.getNumPrograms() << ")" << endl;
    cin >> programNumber;
    if (programNumber < 1 || programNumber > gradebook.getNumPrograms()) {
        cout << "Invalid Program Number." << endl;
        return;
    }
    if (gradebook.getProgramRecorded(programNumber)) {
        cout << "Program " << programNumber << " already recorded..." << endl;
        return;
    }
    Student * student;
    if (!idMode) {
        Node * current = gradebook.getIndex();
        while (current != NULL) {
            student = current->student;
            cout << "Enter Program Grade for "
                 << student->getLastName() << ", " << student->getFirstName() << endl;
            cin >> programGrade;
            student->setProgramGrade(programNumber - 1, programGrade);
            saveGrades(gradebook);
            current = current->next;
        }
    } else {
        student = gradebook.getHead();
        while (student != NULL) {
            cout << "Enter Program Grade for "
                 << student->getLastName() << ", " << student->getFirstName() << endl;
            cin >> programGrade;
            student->setProgramGrade(programNumber - 1, programGrade);
            saveGrades(gradebook);
            student = student->next;
        }
    }
    gradebook.setProgramRecorded(programNumber);
    saveGrades(gradebook);
    handleOutputGrades(gradebook, idMode);
    
    transLog << "Recorded grades for Program: " << programNumber << 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 0x9f77(%rip), %r14      # 0xcfc8
leaq 0x625d(%rip), %rsi      # 0x92b5
movl $0x2a, %edx
movq %r14, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x5314
movq %r14, %rdi
movl %eax, %esi
callq 0x2300
movq %rax, %r15
leaq 0x6094(%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 0x9f24(%rip), %rdi      # 0xcfe0
leaq -0x2c(%rbp), %r15
movq %r15, %rsi
callq 0x2110
movl (%r15), %r15d
testl %r15d, %r15d
jle 0x30dd
movq %rbx, %rdi
callq 0x5314
cmpl %eax, %r15d
jle 0x3127
leaq 0x61fc(%rip), %rsi      # 0x92e0
movl $0x17, %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 0x5f48
testb %al, %al
je 0x3173
movq 0x9e8b(%rip), %rbx      # 0xcfc8
leaq 0x6a32(%rip), %rsi      # 0x9b76
movl $0x8, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
leaq 0x6192(%rip), %rsi      # 0x92f8
movl $0x14, %edx
movq %rax, %rdi
jmp 0x30ec
movl %r12d, -0x74(%rbp)
movq %rbx, %rdi
testb %r12b, %r12b
je 0x3296
callq 0x58a0
testq %rax, %rax
je 0x33a5
movq %rax, %r15
movq 0x9e2d(%rip), %r12      # 0xcfc8
leaq -0x30(%rbp), %r14
movl $0x18, %edx
movq %r12, %rdi
leaq 0x615f(%rip), %rsi      # 0x930d
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x62ee
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r12, %rdi
callq 0x2210
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x6145(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r15, %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 0x3245
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x325e
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x9d7b(%rip), %rdi      # 0xcfe0
movq %r14, %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r15, %rdi
callq 0x634a
movq %rbx, %rdi
callq 0x256c
movq (%r15), %r15
testq %r15, %r15
jne 0x319f
jmp 0x33a5
callq 0x58aa
testq %rax, %rax
je 0x33a5
movq %rax, %r15
movq 0x9d1a(%rip), %r12      # 0xcfc8
movq (%r15), %r13
movl $0x18, %edx
movq %r12, %rdi
leaq 0x604d(%rip), %rsi      # 0x930d
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r13, %rsi
callq 0x62ee
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r12, %rdi
callq 0x2210
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x6033(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r13, %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 0x3357
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3370
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x9c69(%rip), %rdi      # 0xcfe0
leaq -0x30(%rbp), %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r13, %rdi
callq 0x634a
movq %rbx, %rdi
callq 0x256c
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x32ae
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x5efc
movq %rbx, %rdi
callq 0x256c
movzbl -0x74(%rbp), %esi
movq %rbx, %rdi
callq 0x2eb9
leaq 0x9e1d(%rip), %rbx      # 0xd1e8
leaq 0x5f57(%rip), %rsi      # 0x9329
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
jmp 0x30f1
jmp 0x33f8
jmp 0x33f8
jmp 0x33f8
movq %rax, %rbx
jmp 0x341b
jmp 0x33ff
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x341b
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3434
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2310