// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %r14
movq 0xbacb(%rip), %r15      # 0x11fc0
leaq 0x5dcc(%rip), %rsi      # 0xc2c8
movq %r15, %rdi
callq 0x2230
movl 0x58(%r14), %esi
movq %rax, %rdi
callq 0x23a0
leaq 0x5dba(%rip), %rsi      # 0xc2d1
movq %rax, %rdi
callq 0x2230
movl 0x5c(%r14), %esi
movq %rax, %rdi
callq 0x23a0
leaq 0x5db3(%rip), %rsi      # 0xc2e5
movq %rax, %rdi
callq 0x2230
leaq 0x5da8(%rip), %r12      # 0xc2e9
movq %r15, %rdi
movq %r12, %rsi
callq 0x2230
pushq $0xa
popq %rbx
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
leaq 0x5dd1(%rip), %rsi      # 0xc331
movq %r15, %rdi
callq 0x2230
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
movq %r15, %rdi
movq %r12, %rsi
callq 0x2230
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
leaq 0x5daf(%rip), %rsi      # 0xc33d
movq %r15, %rdi
callq 0x2230
pushq $0x20
popq %r12
movq %rax, %rdi
movl %r12d, %esi
callq 0x2330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x5, 0x10(%rax,%rcx)
leaq 0x5d86(%rip), %rsi      # 0xc342
movq %rax, %rdi
callq 0x2230
xorl %r13d, %r13d
movl 0x5c(%r14), %eax
cltd
idivl %ebx
cmpl %eax, %r13d
jg 0x65fe
movq %r15, %rdi
movl %r13d, %esi
callq 0x23a0
movq %r15, %rdi
movl %r12d, %esi
callq 0x2330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x14, 0x10(%rax,%rcx)
incl %r13d
jmp 0x65c7
movq 0xb9bb(%rip), %r15      # 0x11fc0
movq %r15, %rdi
movl %ebx, %esi
callq 0x2250
pushq $0x20
popq %r12
movq %r15, %rdi
movl %r12d, %esi
callq 0x2330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x9, 0x10(%rax,%rcx)
pushq $0x7c
popq %rsi
movq %rax, %rdi
callq 0x2250
xorl %ebx, %ebx
movl 0x5c(%r14), %eax
cltd
pushq $0xa
popq %rcx
idivl %ecx
cmpl %eax, %ebx
jg 0x6671
xorl %r13d, %r13d
cmpl $0xa, %r13d
je 0x666d
movq %r15, %rdi
movl %r13d, %esi
callq 0x23a0
movq %rax, %rdi
movl %r12d, %esi
callq 0x2250
incl %r13d
jmp 0x664c
incl %ebx
jmp 0x663b
movq 0xb948(%rip), %r15      # 0x11fc0
pushq $0xa
popq %rsi
movq %r15, %rdi
callq 0x2250
pushq $0x20
popq %rbx
xorl %r12d, %r12d
movq -0x38(%rbp), %r13
movq 0x10(%r13), %rsi
cmpq %rsi, 0x30(%r13)
je 0x67e8
leaq -0x90(%rbp), %rdi
callq 0x350a
movq %r13, %rdi
callq 0xa080
movq %r15, %rdi
leaq 0x5c8b(%rip), %rsi      # 0xc344
callq 0x2230
movl -0x64(%rbp), %esi
movq %rax, %rdi
callq 0x23a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq %rax, %rdi
leaq 0x5c5f(%rip), %rsi      # 0xc342
callq 0x2230
leaq -0x90(%rbp), %r13
movq %r13, %rdi
callq 0x34b4
movl %eax, -0x2c(%rbp)
movq %r13, %rdi
callq 0x34be
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %r13d
testl %r13d, %r13d
movl $0x0, %eax
cmovlel %eax, %r13d
subl $0x1, %r13d
jb 0x6736
movq %r15, %rdi
leaq 0x5973(%rip), %rsi      # 0xc098
callq 0x2230
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
jmp 0x6715
movq %r15, %rdi
leaq 0x5c09(%rip), %rsi      # 0xc349
callq 0x2230
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
movl -0x2c(%rbp), %eax
movl %eax, %r13d
cmpl 0x5c(%r14), %r13d
jge 0x67a6
cmpl %r12d, %r13d
jge 0x677e
movq %r15, %rdi
leaq 0x5bdf(%rip), %rsi      # 0xc349
callq 0x2230
incl %r13d
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
jmp 0x6755
movq %r15, %rdi
leaq 0x5bc3(%rip), %rsi      # 0xc34b
callq 0x2230
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
leal 0x1(%r13), %eax
decl -0x30(%rbp)
jne 0x6752
incl %r13d
movl %r13d, %r12d
leal -0x1(%r12), %r13d
incl %r13d
cmpl 0x5c(%r14), %r13d
jge 0x67cf
movq %r15, %rdi
leaq 0x58da(%rip), %rsi      # 0xc098
callq 0x2230
movq %rax, %rdi
movl %ebx, %esi
callq 0x2250
jmp 0x67ab
movq %r15, %rdi
callq 0x2110
leaq -0x90(%rbp), %rdi
callq 0x2100
jmp 0x6689
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6803
jmp 0x6803
jmp 0x6803
jmp 0x6803
jmp 0x6803
jmp 0x6803
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x23b0