// File: /workspace/github_cpp_makefile_star2_O1/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 0xd0df(%rip), %rbx      # 0x14fc8
leaq 0x841b(%rip), %rsi      # 0x1030b
movl $0x8, %edx
movq %rbx, %rdi
callq 0x22a0
movl 0x58(%r15), %esi
movq %rbx, %rdi
callq 0x23d0
movq %rax, %r14
leaq 0x8401(%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 0x83f1(%rip), %rsi      # 0x10328
movl $0x3, %edx
movq %rax, %rdi
callq 0x22a0
leaq 0x83e1(%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 0x83f5(%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 0x83b3(%rip), %rsi      # 0x10380
movl $0x4, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %r14
cmpb $0x0, 0xe1(%rbx,%rax)
jne 0x800b
movq %r14, %rdi
movl $0x20, %esi
callq 0x2260
movb %al, 0xe0(%r14)
movb $0x1, 0xe1(%r14)
movb $0x20, 0xe0(%r14)
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x5, 0x10(%rbx,%rax)
leaq 0x835b(%rip), %rsi      # 0x10385
movl $0x1, %edx
movq %rbx, %rdi
callq 0x22a0
movq -0x38(%rbp), %rax
cmpl $-0x9, 0x5c(%rax)
jl 0x80c6
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x23d0
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %r15
cmpb $0x0, 0xe1(%rbx,%rax)
jne 0x808a
movq %r15, %rdi
movl $0x20, %esi
callq 0x2260
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq (%rbx), %rax
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 0x804b
leaq -0xa0(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %r14
cmpb $0x0, 0xe1(%rbx,%rax)
jne 0x810e
movq %r14, %rdi
movl $0x20, %esi
callq 0x2260
movb %al, 0xe0(%r14)
movb $0x1, 0xe1(%r14)
movb $0x20, 0xe0(%r14)
movq (%rbx), %rax
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 0x81af
xorl %r12d, %r12d
movq 0xce77(%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 0x815b
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 0x8158
leaq -0xa0(%rbp), %rsi
movb $0xa, (%rsi)
movq 0xce08(%rip), %r15      # 0x14fc8
movl $0x1, %edx
movq %r15, %rdi
callq 0x22a0
movq -0x48(%rbp), %r14
movq 0x10(%r14), %rbx
cmpq %rbx, 0x30(%r14)
je 0x83f8
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 0x37c8
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 0xce58
movl $0x4, %edx
movq %r15, %rdi
leaq 0x813f(%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 0x810e(%rip), %rsi      # 0x10385
callq 0x22a0
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
callq 0x373c
movl %eax, %r13d
movq %rbx, %rdi
callq 0x3746
movl %eax, %r14d
movl %r13d, %ebx
testl %r13d, %r13d
jle 0x82cd
movl $0x1, %edx
movq %r15, %rdi
leaq 0x7e12(%rip), %rsi      # 0x100c2
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
decl %ebx
jne 0x82a1
movl $0x1, %edx
movq %r15, %rdi
leaq 0x80b0(%rip), %rsi      # 0x1038c
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
movq -0x38(%rbp), %rax
cmpl 0x5c(%rax), %r13d
jge 0x8368
cmpl -0x3c(%rbp), %r13d
jge 0x832f
movl $0x1, %edx
movq %r15, %rdi
leaq 0x8078(%rip), %rsi      # 0x1038c
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
jmp 0x835c
movl $0x1, %edx
movq %r15, %rdi
leaq 0x8050(%rip), %rsi      # 0x1038e
callq 0x22a0
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22a0
decl %r14d
je 0x8361
incl %r13d
jmp 0x82f5
incl %r13d
movl %r13d, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, %ebx
movq -0x38(%rbp), %r14
cmpl 0x5c(%r14), %eax
jge 0x83a7
movl $0x1, %edx
movq %r15, %rdi
leaq 0x7d3c(%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 0x8377
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 0x83e6
callq 0x2250
movq -0x48(%rbp), %r14
movq 0x10(%r14), %rbx
cmpq %rbx, 0x30(%r14)
jne 0x81ea
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8411
jmp 0x8411
jmp 0x8411
jmp 0x8411
jmp 0x8411
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x842c
callq 0x2250
movq %rbx, %rdi
callq 0x23e0