// File: /workspace/github_cpp_makefile_star2_O3/MUST-Quick-Fry[P]Process-Scheduler/scheduler.cpp
// Function: Project::Scheduler::Display(std::queue<Project::Job, std::deque<Project::Job, std::allocator<Project::Job>>>)
void Scheduler::Display(queue<Job> q)
{
    cout<<"Totally " << get_job_num() << " jobs, Time using: " << get_total_time()<<" s\n";
    cout<<"======================================================================="<<'\n';
    cout<<"Gantt Chart"<<'\n';
    cout<<"======================================================================="<<'\n';
    cout << "Time" << setfill(' ') << setw(5) << "|";
     
    for (int i = 0; i <= get_total_time()/ 10; i++)
    {
        cout << i;
        cout << setfill(' ') << setw(20);
    }   
        
    cout << '\n';
    cout << setfill(' ') << setw(9) << '|';
    for (int i = 0; i <= get_total_time() / 10; i++)
    {
        for (int j = 0; j <= 9; j++){ cout << j << ' ';}
    }
    cout << '\n';
    
    int stopindex = 0;
    
    while(!q.empty())
    {
         auto it = q.front();
         q.pop();
         
         cout<<"Job " << it.ID <<setw(4) << "|";
         int arr_time = it.get_arr_time();
         int dur_time = it.get_dur_time();
         for(int i=0; i<arr_time; ++i){ cout << " " << ' ';}
         cout << "." << ' '; // arrive
         for(int i=arr_time + 1; i<=get_total_time(); ++i){ 
             if(i <= stopindex){cout << "." << ' ';}
             else{
                 cout << "#" << ' ';
                 dur_time--;
                 if(dur_time==0){stopindex = i; break;}
             }
         }
         for(int i=stopindex + 1; i<=get_total_time(); ++i){ cout << " " << ' ';}
         cout << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, -0x48(%rbp)
movq %rdi, %r15
movq 0xd13b(%rip), %rbx      # 0x14fc8
leaq 0x8477(%rip), %rsi      # 0x1030b
movl $0x8, %edx
movq %rbx, %rdi
callq 0x22a0
movl 0x58(%r15), %esi
movq %rbx, %rdi
callq 0x23d0
movq %rax, %r14
leaq 0x845d(%rip), %rsi      # 0x10314
movl $0x13, %edx
movq %rax, %rdi
callq 0x22a0
movq %r15, -0x38(%rbp)
movl 0x5c(%r15), %esi
movq %r14, %rdi
callq 0x23d0
leaq 0x844d(%rip), %rsi      # 0x10328
movl $0x3, %edx
movq %rax, %rdi
callq 0x22a0
leaq 0x843d(%rip), %r14      # 0x1032c
movl $0x47, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
movb $0xa, %r12b
leaq -0xa0(%rbp), %r15
movb %r12b, (%r15)
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22a0
leaq 0x8451(%rip), %rsi      # 0x10374
movl $0xb, %edx
movq %rbx, %rdi
callq 0x22a0
movb %r12b, (%r15)
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22a0
movl $0x47, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
movb %r12b, (%r15)
leaq -0xa0(%rbp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x22a0
leaq 0x840f(%rip), %rsi      # 0x10380
movl $0x4, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r14
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x7fab
movq %r14, %rdi
movl $0x20, %esi
callq 0x2260
movb $0x1, 0xe1(%r14)
movq (%rbx), %rax
movb $0x20, 0xe0(%r14)
movq -0x18(%rax), %rax
movq $0x5, 0x10(%rbx,%rax)
leaq 0x83be(%rip), %rsi      # 0x10385
movl $0x1, %edx
movq %rbx, %rdi
callq 0x22a0
movq -0x38(%rbp), %rax
cmpl $-0x9, 0x5c(%rax)
jl 0x8058
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x23d0
movq (%rbx), %rax
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r15
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x801f
movq %r15, %rdi
movl $0x20, %esi
callq 0x2260
movb $0x1, 0xe1(%r15)
movq (%rbx), %rax
movb $0x20, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x14, 0x10(%rbx,%rax)
movq -0x38(%rbp), %rax
movslq 0x5c(%rax), %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
sarl $0x2, %eax
addl %ecx, %eax
cmpl %eax, %r14d
jl 0x7fe4
leaq -0xa0(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
movq -0x18(%rax), %rcx
leaq (%rbx,%rcx), %r14
cmpb $0x0, 0xe1(%rbx,%rcx)
jne 0x809c
movq %r14, %rdi
movl $0x20, %esi
callq 0x2260
movb $0x1, 0xe1(%r14)
movq (%rbx), %rax
movb $0x20, 0xe0(%r14)
movq -0x18(%rax), %rax
movq $0x9, 0x10(%rbx,%rax)
leaq -0xa0(%rbp), %rsi
movb $0x7c, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x22a0
movq -0x38(%rbp), %rax
cmpl $-0x9, 0x5c(%rax)
jl 0x813a
xorl %r12d, %r12d
movq 0xceec(%rip), %rbx      # 0x14fc8
leaq -0xa0(%rbp), %r14
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x23d0
movb $0x20, -0xa0(%rbp)
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x22a0
incl %r15d
cmpl $0xa, %r15d
jne 0x80e6
leal 0x1(%r12), %eax
movq -0x38(%rbp), %rcx
movslq 0x5c(%rcx), %rcx
imulq $0x66666667, %rcx, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
cmpl %ecx, %r12d
movl %eax, %r12d
jl 0x80e3
leaq -0xa0(%rbp), %rsi
movb $0xa, (%rsi)
movq 0xce7d(%rip), %r15      # 0x14fc8
movl $0x1, %edx
movq %r15, %rdi
callq 0x22a0
movq -0x48(%rbp), %r14
movq 0x10(%r14), %rbx
cmpq %rbx, 0x30(%r14)
je 0x8396
movl $0x0, -0x3c(%rbp)
leaq -0x29(%rbp), %r12
leaq -0x90(%rbp), %r13
movq %r13, -0xa0(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x37e4
movq 0x4e(%rbx), %rax
movq %rax, 0x3e(%r13)
movups 0x20(%rbx), %xmm0
movups 0x30(%rbx), %xmm1
movups 0x40(%rbx), %xmm2
movups %xmm2, 0x30(%r13)
movups %xmm1, 0x20(%r13)
movups %xmm0, 0x10(%r13)
movq %r14, %rdi
callq 0xcdea
movl $0x4, %edx
movq %r15, %rdi
leaq 0x81b4(%rip), %rsi      # 0x10387
callq 0x22a0
movl -0x74(%rbp), %esi
movq %r15, %rdi
callq 0x23d0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8183(%rip), %rsi      # 0x10385
callq 0x22a0
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
callq 0x3758
movl %eax, %r13d
movq %rbx, %rdi
callq 0x3762
movl %eax, %r14d
movl %r13d, %ebx
testl %r13d, %r13d
jle 0x8258
movl $0x1, %edx
movq %r15, %rdi
leaq 0x7e87(%rip), %rsi      # 0x100c2
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
decl %ebx
jne 0x822c
movl $0x1, %edx
movq %r15, %rdi
leaq 0x8125(%rip), %rsi      # 0x1038c
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
movq -0x38(%rbp), %rax
movl 0x5c(%rax), %eax
cmpl %eax, %r13d
jge 0x82f2
cmpl -0x3c(%rbp), %r13d
jge 0x82bc
movl $0x1, %edx
movq %r15, %rdi
leaq 0x80eb(%rip), %rsi      # 0x1038c
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
jmp 0x82ed
movl $0x1, %edx
movq %r15, %rdi
leaq 0x80c3(%rip), %rsi      # 0x1038e
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
decl %r14d
je 0x8382
incl %r13d
jmp 0x8280
movq -0x38(%rbp), %r14
movl -0x3c(%rbp), %ecx
movl %ecx, %ebx
cmpl %eax, %ecx
jge 0x832f
movl $0x1, %edx
movq %r15, %rdi
leaq 0x7db4(%rip), %rsi      # 0x100c2
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
incl %ebx
cmpl 0x5c(%r14), %ebx
jl 0x82ff
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x836e
callq 0x2250
movq -0x48(%rbp), %r14
movq 0x10(%r14), %rbx
cmpq %rbx, 0x30(%r14)
jne 0x8175
jmp 0x8396
movq -0x38(%rbp), %r14
movl 0x5c(%r14), %eax
incl %r13d
movl %r13d, -0x3c(%rbp)
jmp 0x82f6
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x83af
jmp 0x83af
jmp 0x83af
jmp 0x83af
jmp 0x83af
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x83ca
callq 0x2250
movq %rbx, %rdi
callq 0x23e0