// File: /workspace/github_cpp_makefile_star2_O1/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 0x9f55(%rip), %r14      # 0xcfc8
leaq 0x623b(%rip), %rsi      # 0x92b5
movl $0x2a, %edx
movq %r14, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x52f8
movq %r14, %rdi
movl %eax, %esi
callq 0x2300
movq %rax, %r15
leaq 0x6072(%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 0x9f02(%rip), %rdi      # 0xcfe0
leaq -0x2c(%rbp), %r15
movq %r15, %rsi
callq 0x2110
movl (%r15), %r15d
testl %r15d, %r15d
jle 0x30ff
movq %rbx, %rdi
callq 0x52f8
cmpl %eax, %r15d
jle 0x3149
leaq 0x61da(%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 0x5f0a
testb %al, %al
je 0x3195
movq 0x9e69(%rip), %rbx      # 0xcfc8
leaq 0x6a10(%rip), %rsi      # 0x9b76
movl $0x8, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
leaq 0x6170(%rip), %rsi      # 0x92f8
movl $0x14, %edx
movq %rax, %rdi
jmp 0x310e
movl %r12d, -0x74(%rbp)
movq %rbx, %rdi
testb %r12b, %r12b
je 0x32b8
callq 0x5862
testq %rax, %rax
je 0x33c7
movq %rax, %r15
movq 0x9e0b(%rip), %r12      # 0xcfc8
leaq -0x30(%rbp), %r14
movl $0x18, %edx
movq %r12, %rdi
leaq 0x613d(%rip), %rsi      # 0x930d
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x62d4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r12, %rdi
callq 0x2210
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x6123(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r15, %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 0x3267
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3280
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x9d59(%rip), %rdi      # 0xcfe0
movq %r14, %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r15, %rdi
callq 0x6330
movq %rbx, %rdi
callq 0x256c
movq (%r15), %r15
testq %r15, %r15
jne 0x31c1
jmp 0x33c7
callq 0x586c
testq %rax, %rax
je 0x33c7
movq %rax, %r15
movq 0x9cf8(%rip), %r12      # 0xcfc8
movq (%r15), %r13
movl $0x18, %edx
movq %r12, %rdi
leaq 0x602b(%rip), %rsi      # 0x930d
callq 0x2210
leaq -0x70(%rbp), %rdi
movq %r13, %rsi
callq 0x62d4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r12, %rdi
callq 0x2210
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x6011(%rip), %rsi      # 0x9326
callq 0x2210
leaq -0x50(%rbp), %rdi
movq %r13, %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 0x3379
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3392
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq 0x9c47(%rip), %rdi      # 0xcfe0
leaq -0x30(%rbp), %rsi
callq 0x2110
movl -0x2c(%rbp), %esi
decl %esi
movl -0x30(%rbp), %edx
movq %r13, %rdi
callq 0x6330
movq %rbx, %rdi
callq 0x256c
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x32d0
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x5ebe
movq %rbx, %rdi
callq 0x256c
movzbl -0x74(%rbp), %esi
movq %rbx, %rdi
callq 0x2edb
leaq 0x9dfb(%rip), %rbx      # 0xd1e8
leaq 0x5f35(%rip), %rsi      # 0x9329
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x2210
movl -0x2c(%rbp), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r14
jmp 0x3113
jmp 0x341a
jmp 0x341a
jmp 0x341a
movq %rax, %rbx
jmp 0x343d
jmp 0x3421
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x343d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3456
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2310