// File: /workspace/github_cpp_makefile_star2_O1/MUST-Quick-Fry[P]Process-Scheduler/scheduler.cpp
// Function: Project::Scheduler::driveSJF2()
void Scheduler::driveSJF2(){

    // create a schedule
    queue<Job> pq_arr; 
    priority_queue<Job,vector<Job>,greater<Job> > wait_q; 
    int len = get_job_num();

    // clear -1
    for(int i = 0; i < len; ++i){
        if(job_queue[i].get_dur_time()==-1){ 
            int t = 0;
            find_dur_time(job_queue[i], t);
            //cout << t << endl;
            job_queue[i].set_dur_time(t);
        }
    }
         
    sort(job_queue.begin(), job_queue.end(), [](const Job &a, const Job &b)->bool
    {   if(a.get_arr_time() == b.get_arr_time()){return a.get_dur_time() < b.get_dur_time();}
        else{return a.get_arr_time() < b.get_arr_time();}
    });
         
    for(int i = 0; i < len; ++i){
        pq_arr.emplace(job_queue[i]);  
    }
       
      
    int time = 0;
    Job con;
    con.ID = 0;
    unordered_map<int, int> jobmap;
    Job lastjob = con;
    
    while(true){                                          
        while(!pq_arr.empty() && time == pq_arr.front().get_arr_time()){
            Job tmp = pq_arr.front();
            pq_arr.pop(); 
            
            if(!wait_q.empty() && tmp.get_dur_time() < wait_q.top().get_dur_time() && wait_q.top().ID == lastjob.ID)
                wait_q.pop();
            wait_q.emplace(tmp);         
        }
        
   
        if(!wait_q.empty()){
            
            Job it = wait_q.top();
            wait_q.pop();
            
            if(lastjob.ID == it.ID || lastjob.ID == 0){
            
                if(jobmap[it.ID] == 0){
                    scheduler.emplace(it);
                    jobmap[it.ID] = 1;
                }
            
                it.has_exp_time++;
                it.set_dur_time(it.get_dur_time()-1);
                           
                if(it.get_dur_time() == 0){
                    scheduler.back().set_dur_time(it.has_exp_time);
                    scheduler.back().service_time_left = 2;
                    //cout << scheduler.back().ID << " arr " << scheduler.back().get_arr_time() << " dur "<< scheduler.back().get_dur_time()<< endl;
                    jobmap[it.ID] = 0;
                    lastjob = con;
                }
                else{ 
                    if(wait_q.empty() || it.get_dur_time() < wait_q.top().get_dur_time())
                        wait_q.emplace(it); 
                        
                    lastjob = it;
                }
                
            }
            else{
                scheduler.back().set_dur_time(lastjob.has_exp_time);
                //cout << scheduler.back().ID << " arr " << scheduler.back().get_arr_time() << " dur "<< scheduler.back().get_dur_time()<< endl;
                jobmap[lastjob.ID] = 0;
                lastjob.has_exp_time = 0;
                lastjob.set_arr_time(time);
                wait_q.emplace(lastjob);
                
             
                if(jobmap[it.ID] == 0){
                    scheduler.emplace(it);
                    jobmap[it.ID] = 1;
                }
            
                it.has_exp_time++;
                it.set_dur_time(it.get_dur_time()-1);
                
                
                if(it.get_dur_time() == 0){
                    scheduler.back().set_dur_time(it.has_exp_time);
                    scheduler.back().service_time_left = 2;
                    //cout << scheduler.back().ID << " arr " << scheduler.back().get_arr_time() << " dur "<< scheduler.back().get_dur_time()<< endl;
                    jobmap[it.ID] = 0;
                    lastjob = con;
                }
                else{ 
                    if(wait_q.empty() || it.get_dur_time() < wait_q.top().get_dur_time())
                        wait_q.emplace(it); 
                        
                    lastjob = it;
                }            
                
            }
                
                
        }
        
        time++;
        //cout << "now is " << time << " " << wait_q.size() << endl;
        if(wait_q.empty() && pq_arr.empty()){break;}    
    }
    
       
    // copy
    set_total_time(time);
    real_job_queue = scheduler;
    cout << endl;
    cout << endl;
    cout << endl;
    
    // execute
    cout << "==================================================="<< endl;
    cout << "Now start the Scheduler !!!"<< endl;
    cout << "==================================================="<< endl;
    
    int realtime = 0;
    int pid = 1;
   
    while(!stop_flag){
     
        cout << "now time: " << realtime << " s" << endl;    
        
        while(!scheduler.empty() && realtime >= scheduler.front().get_arr_time()){
            auto it = scheduler.front();
            scheduler.pop();
                        
            if(monitor_map[it.ID]==0){
                pid = fork();
                if(pid == 0){
                    Monitor* monitor = new Monitor(it);                       
                    cout << "Terminate the Parent Process: " << getpid() <<endl;     
                    
                    //kill(getpid(), SIGKILL);
                    exit(0);
  
                }
                else{ 
                    monitor_map[it.ID]=pid;
                }
            }
            
            
            if(pid !=0){     
                                           
                     if(allow_preem){                 
                         allow_preem = false;                                  
                         this_job = it;
                         
                         kill(monitor_map[it.ID], SIGCONT);
                         signal(SIGALRM, signal_preemSJF);
                         alarm(it.get_dur_time());
 
                     }
                     else{
                         wait_queue.emplace(it);
                         kill(monitor_map[it.ID], SIGTSTP);
                         std::cout<<"Child Process Suspend" << std::endl;
                     }
                 
             }
        }
        
        
        if(pid!=0){       
             sleep(1); 
             realtime++;
                          
        }
                        
    }
    
    if(pid !=0){ 
        cout << "now time: " << realtime << " s" << endl;       
        sleep(2);
        cout << endl;
        cout << endl;
        
        // draw Gantt diagram
        Display(real_job_queue);

    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq -0x1a0(%rbp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x3550
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq %rbx, -0xb8(%rbp)
movslq 0x58(%rbx), %rax
movq %rax, -0xb0(%rbp)
testq %rax, %rax
jle 0x6640
leaq -0x298(%rbp), %r15
imulq $0x58, -0xb0(%rbp), %r13
xorl %r12d, %r12d
leaq -0x2a8(%rbp), %rbx
movq 0xf299(%rip), %rdi      # 0x15830
addq %r12, %rdi
callq 0x3746
cmpl $-0x1, %eax
jne 0x6633
movl $0x0, -0x1f8(%rbp)
movq 0xf277(%rip), %r14      # 0x15830
movq %r15, -0x2a8(%rbp)
movq (%r14,%r12), %rsi
movq 0x8(%r14,%r12), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x37c8
movq 0x4e(%r14,%r12), %rax
movq %rax, 0x3e(%r15)
movups 0x20(%r14,%r12), %xmm0
movups 0x30(%r14,%r12), %xmm1
movups 0x40(%r14,%r12), %xmm2
movups %xmm2, 0x30(%r15)
movups %xmm1, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movq %rbx, %rsi
leaq -0x1f8(%rbp), %rdx
callq 0x521a
movq -0x2a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x661e
callq 0x2250
movq 0xf20b(%rip), %rdi      # 0x15830
addq %r12, %rdi
movl -0x1f8(%rbp), %esi
callq 0x36fc
addq $0x58, %r12
cmpq %r12, %r13
jne 0x6590
movq 0xf1e9(%rip), %r14      # 0x15830
movq 0xf1ea(%rip), %rbx      # 0x15838
cmpq %rbx, %r14
movq -0xb0(%rbp), %r12
je 0x66c6
movq %rbx, %r15
subq %r14, %r15
movq %r15, %rax
sarq $0x3, %rax
movabsq $0x2e8ba2e8ba2e8ba3, %rcx # imm = 0x2E8BA2E8BA2E8BA3
imulq %rax, %rcx
bsrq %rcx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x964d
cmpq $0x581, %r15            # imm = 0x581
jl 0x66bb
leaq 0x580(%r14), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xa23d
cmpq %rbx, %r15
je 0x66c6
movq %r15, %rdi
callq 0xa3fc
addq $0x58, %r15
jmp 0x66a8
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa23d
testl %r12d, %r12d
jle 0x66f4
imulq $0x58, %r12, %r14
xorl %r15d, %r15d
leaq -0x1a0(%rbp), %rbx
movq 0xf150(%rip), %rsi      # 0x15830
addq %r15, %rsi
movq %rbx, %rdi
callq 0xe8c8
addq $0x58, %r15
cmpq %r15, %r14
jne 0x66d9
leaq -0x1e8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
xorl %eax, %eax
movq %rax, -0x8(%rdx)
movb $0x0, (%rdx)
movq %rax, 0x18(%rdx)
leaq -0x118(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq -0x100(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x110(%rbp), %rdi
movq %rdx, %rsi
callq 0x37c8
leaq -0xf0(%rbp), %rcx
leaq -0x1d8(%rbp), %rdx
movq 0x2e(%rdx), %rax
movq %rax, 0x2e(%rcx)
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
leaq -0x88(%rbp), %r15
leaq -0xa8(%rbp), %r13
leaq -0x50(%rbp), %rbx
xorl %r12d, %r12d
movq -0x190(%rbp), %rdi
cmpq %rdi, -0x170(%rbp)
je 0x6879
callq 0x373c
cmpl %eax, %r12d
jne 0x6879
movq -0x190(%rbp), %r14
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x37c8
movq 0x4e(%r14), %rax
movq %rax, 0x2e(%r15)
movups 0x20(%r14), %xmm0
movups 0x30(%r14), %xmm1
movups 0x40(%r14), %xmm2
movups %xmm2, 0x20(%r15)
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
leaq -0x1a0(%rbp), %rdi
callq 0xce58
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x6840
movq %r13, %rdi
callq 0x3746
movl %eax, %r14d
movq -0x50(%rbp), %rdi
callq 0x3746
cmpl %eax, %r14d
jge 0x6840
movq -0x50(%rbp), %rax
movl 0x2c(%rax), %eax
cmpl -0xe4(%rbp), %eax
jne 0x6840
movq %rbx, %rdi
callq 0xa6d8
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa656
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xeef3
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x678c
callq 0x2250
jmp 0x678c
movq -0x50(%rbp), %r14
cmpq -0x48(%rbp), %r14
je 0x6ba3
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x37c8
movq 0x4e(%r14), %rax
movq %rax, 0x2e(%r15)
movups 0x20(%r14), %xmm0
movups 0x30(%r14), %xmm1
movups 0x40(%r14), %xmm2
movups %xmm2, 0x20(%r15)
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movq %rbx, %rdi
callq 0xa6d8
movl -0xe4(%rbp), %eax
testl %eax, %eax
je 0x69fd
cmpl -0x7c(%rbp), %eax
je 0x69fd
movq 0xef86(%rip), %rdi      # 0x15878
cmpq 0xef87(%rip), %rdi      # 0x15880
jne 0x690e
movq 0xef8e(%rip), %rax      # 0x15890
movq -0x8(%rax), %rdi
movl $0x1b8, %eax            # imm = 0x1B8
addq %rax, %rdi
addq $-0x58, %rdi
movl -0xdc(%rbp), %esi
callq 0x36fc
leaq -0x148(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0xcdb0
xorl %ecx, %ecx
movl %ecx, (%rax)
movl %ecx, -0xdc(%rbp)
leaq -0x110(%rbp), %rdi
movl %r12d, %esi
callq 0x36f2
movq %rbx, %rdi
leaq -0x110(%rbp), %rsi
callq 0xa656
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xeef3
leaq -0x148(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
cmpl $0x0, (%rax)
jne 0x699f
leaq 0xeec7(%rip), %rdi      # 0x15848
movq %r13, %rsi
callq 0xe8c8
leaq -0x148(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
movl $0x1, (%rax)
incl -0x74(%rbp)
movq %r13, %rdi
callq 0x3746
decl %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x36fc
movq %r13, %rdi
callq 0x3746
testl %eax, %eax
je 0x6add
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x69ed
movq %r13, %rdi
callq 0x3746
movl %eax, %r14d
movq -0x50(%rbp), %rdi
callq 0x3746
cmpl %eax, %r14d
jge 0x6a95
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa656
jmp 0x6a88
leaq -0x148(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
cmpl $0x0, (%rax)
jne 0x6a37
leaq 0xee2f(%rip), %rdi      # 0x15848
movq %r13, %rsi
callq 0xe8c8
leaq -0x148(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
movl $0x1, (%rax)
incl -0x74(%rbp)
movq %r13, %rdi
callq 0x3746
decl %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x36fc
movq %r13, %rdi
callq 0x3746
testl %eax, %eax
je 0x6aac
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
je 0x6a7d
movq %r13, %rdi
callq 0x3746
movl %eax, %r14d
movq -0x50(%rbp), %rdi
callq 0x3746
cmpl %eax, %r14d
jge 0x6a95
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa656
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xeef3
leaq -0x110(%rbp), %rdi
movq %r13, %rsi
callq 0x2150
movq %r15, %rax
jmp 0x6b66
movq 0xedc5(%rip), %rdi      # 0x15878
cmpq 0xedc6(%rip), %rdi      # 0x15880
jne 0x6acf
movq 0xedcd(%rip), %rax      # 0x15890
movq -0x8(%rax), %rdi
movl $0x1b8, %eax            # imm = 0x1B8
addq %rax, %rdi
addq $-0x58, %rdi
movl -0x74(%rbp), %esi
callq 0x36fc
jmp 0x6b0c
movq 0xed94(%rip), %rdi      # 0x15878
cmpq 0xed95(%rip), %rdi      # 0x15880
jne 0x6b00
movq 0xed9c(%rip), %rax      # 0x15890
movq -0x8(%rax), %rdi
movl $0x1b8, %eax            # imm = 0x1B8
addq %rax, %rdi
addq $-0x58, %rdi
movl -0x74(%rbp), %esi
callq 0x36fc
movq 0xed65(%rip), %rax      # 0x15878
cmpq 0xed66(%rip), %rax      # 0x15880
jne 0x6b2f
movq 0xed6d(%rip), %rax      # 0x15890
movq -0x8(%rax), %rax
movl $0x1b8, %ecx            # imm = 0x1B8
addq %rcx, %rax
movl $0x2, -0x28(%rax)
leaq -0x148(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
movl $0x0, (%rax)
leaq -0x110(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x2150
leaq -0x1d8(%rbp), %rax
movq 0x2e(%rax), %rcx
leaq -0xf0(%rbp), %rdx
movq %rcx, 0x2e(%rdx)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rdx)
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x6ba3
callq 0x2250
incl %r12d
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x678c
movq -0x170(%rbp), %rax
cmpq -0x190(%rbp), %rax
jne 0x678c
movq -0xb8(%rbp), %rax
movl %r12d, 0x5c(%rax)
leaq 0xed0e(%rip), %rdi      # 0x158e8
leaq 0xec67(%rip), %rsi      # 0x15848
callq 0xa7ca
movq 0xe3db(%rip), %rdi      # 0x14fc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe3c0(%rip), %rbx      # 0x14fc8
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe392(%rip), %rbx      # 0x14fc8
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe364(%rip), %rdi      # 0x14fc8
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq 0xe350(%rip), %rbx      # 0x14fc8
leaq 0x96c1(%rip), %rsi      # 0x10340
movl $0x33, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe31e(%rip), %rdi      # 0x14fc8
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq 0xe30a(%rip), %rbx      # 0x14fc8
leaq 0x95e7(%rip), %rsi      # 0x102ac
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe2d8(%rip), %rdi      # 0x14fc8
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq 0xe2c4(%rip), %rbx      # 0x14fc8
leaq 0x9635(%rip), %rsi      # 0x10340
movl $0x33, %edx
movq %rbx, %rdi
callq 0x22a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe292(%rip), %rdi      # 0x14fc8
callq 0x2040
movq %rax, %rdi
callq 0x2190
xorl %ebx, %ebx
cmpb $0x0, 0xec5c(%rip)      # 0x159a8
jne 0x6fa8
leaq -0x88(%rbp), %r15
xorl %ebx, %ebx
leaq -0xa8(%rbp), %r12
leaq 0xec07(%rip), %r13      # 0x15970
movl $0xa, %edx
movq 0xe253(%rip), %rdi      # 0x14fc8
leaq 0x954c(%rip), %rsi      # 0x102c8
callq 0x22a0
movq 0xe240(%rip), %rdi      # 0x14fc8
movl %ebx, %esi
callq 0x23d0
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x9532(%rip), %rsi      # 0x102d3
callq 0x22a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq 0xea84(%rip), %rdi      # 0x15858
cmpq %rdi, 0xea9d(%rip)      # 0x15878
je 0x6f8f
callq 0x373c
cmpl %eax, %ebx
jl 0x6f8f
movq 0xea63(%rip), %r14      # 0x15858
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x37c8
movq 0x4e(%r14), %rax
movq %rax, 0x2e(%r15)
movups 0x20(%r14), %xmm0
movups 0x30(%r14), %xmm1
movups 0x40(%r14), %xmm2
movups %xmm2, 0x20(%r15)
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
leaq 0xea07(%rip), %rdi      # 0x15848
callq 0xce58
movq %r13, %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
cmpl $0x0, (%rax)
jne 0x6e76
callq 0x20a0
testl %eax, %eax
je 0x7107
movl %eax, %r14d
movq %r13, %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
movl %r14d, (%rax)
cmpb $0x0, 0xeb2c(%rip)      # 0x159a9
je 0x6ef2
leaq 0xea12(%rip), %rdi      # 0x15898
movq %r12, %rsi
callq 0xe8c8
movq %r13, %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
movl (%rax), %edi
movl $0x14, %esi
callq 0x2310
movl $0x15, %edx
movq 0xe116(%rip), %rdi      # 0x14fc8
leaq 0x943c(%rip), %rsi      # 0x102f5
callq 0x22a0
movq 0xe103(%rip), %rcx      # 0x14fc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xe0e5(%rip), %rdi      # 0x14fc8
callq 0x2040
movq %rax, %rdi
callq 0x2190
jmp 0x6f6e
movb $0x1, 0xeab0(%rip)      # 0x159a9
leaq 0xe8d8(%rip), %rdi      # 0x157d8
movq %r12, %rsi
callq 0x2150
movq 0x2e(%r15), %rax
movq %rax, 0xe913(%rip)      # 0x15826
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0xe8f0(%rip)     # 0x15818
movups %xmm1, 0xe8d9(%rip)     # 0x15808
movups %xmm0, 0xe8c2(%rip)     # 0x157f8
movq %r13, %rdi
leaq -0x7c(%rbp), %rsi
callq 0xcdb0
movl (%rax), %edi
movl $0x12, %esi
callq 0x2310
movl $0xe, %edi
leaq 0x1652(%rip), %rsi      # 0x85ac
callq 0x22b0
movq %r12, %rdi
callq 0x3746
movl %eax, %edi
callq 0x2410
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x6dcd
callq 0x2250
jmp 0x6dcd
movl $0x1, %edi
callq 0x21f0
incl %ebx
cmpb $0x1, 0xea06(%rip)      # 0x159a8
jne 0x6d69
movq 0xe019(%rip), %rdi      # 0x14fc8
leaq 0x9312(%rip), %rsi      # 0x102c8
movl $0xa, %edx
callq 0x22a0
movq 0xe001(%rip), %r14      # 0x14fc8
movq %r14, %rdi
movl %ebx, %esi
callq 0x23d0
movq %rax, %rbx
leaq 0x92f8(%rip), %rsi      # 0x102d3
movl $0x2, %edx
movq %rax, %rdi
callq 0x22a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2190
movl $0x2, %edi
callq 0x21f0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xdf91(%rip), %rbx      # 0x14fc8
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2260
movsbl %al, %esi
movq 0xdf63(%rip), %rdi      # 0x14fc8
callq 0x2040
movq %rax, %rdi
callq 0x2190
leaq 0xe86f(%rip), %rsi      # 0x158e8
leaq -0x2f8(%rbp), %rdi
callq 0xcc34
leaq -0x2f8(%rbp), %rsi
movq -0xb8(%rbp), %rdi
callq 0x7eca
leaq -0x2f8(%rbp), %rdi
callq 0x336e
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x70bc
callq 0x2250
leaq -0x148(%rbp), %rdi
callq 0x34da
movq -0x1f8(%rbp), %rdi
leaq -0x1e8(%rbp), %rax
cmpq %rax, %rdi
je 0x70e0
callq 0x2250
leaq -0x50(%rbp), %rdi
callq 0x32fe
leaq -0x1a0(%rbp), %rdi
callq 0x336e
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xd0, %edi
callq 0x2280
movq %rax, %r14
leaq -0x240(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x250(%rbp), %rdi
callq 0x37c8
movq 0x2e(%r15), %rax
leaq -0x250(%rbp), %rsi
movq %rax, 0x4e(%rsi)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0x40(%rsi)
movups %xmm1, 0x30(%rsi)
movups %xmm0, 0x20(%rsi)
movq %r14, %rdi
callq 0x3a52
movq -0x250(%rbp), %rdi
cmpq %r12, %rdi
je 0x717f
callq 0x2250
movq 0xde42(%rip), %rdi      # 0x14fc8
leaq 0x9149(%rip), %rsi      # 0x102d6
movl $0x1e, %edx
callq 0x22a0
callq 0x2340
movq 0xde25(%rip), %rdi      # 0x14fc8
movl %eax, %esi
callq 0x23d0
movq %rax, %rdi
callq 0x2120
xorl %edi, %edi
callq 0x22c0
movq %rax, %rbx
leaq -0x2f8(%rbp), %rdi
callq 0x336e
jmp 0x7251
movq %rax, %rbx
jmp 0x7269
jmp 0x721a
jmp 0x721a
movq %rax, %rbx
movq -0x250(%rbp), %rdi
cmpq %r12, %rdi
je 0x720c
callq 0x2250
jmp 0x720c
movq %rax, %rbx
movq -0x2a8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x7288
jmp 0x728d
jmp 0x722f
movq %rax, %rbx
movq %r14, %rdi
callq 0x2250
jmp 0x7239
jmp 0x721a
jmp 0x721a
movq %rax, %rbx
jmp 0x728d
jmp 0x722f
jmp 0x7236
jmp 0x722f
jmp 0x722f
jmp 0x722f
jmp 0x722f
jmp 0x7236
jmp 0x722f
movq %rax, %rbx
jmp 0x7251
jmp 0x7236
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x7251
callq 0x2250
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x7269
callq 0x2250
leaq -0x148(%rbp), %rdi
callq 0x34da
movq -0x1f8(%rbp), %rdi
leaq -0x1e8(%rbp), %rax
cmpq %rax, %rdi
je 0x728d
callq 0x2250
leaq -0x50(%rbp), %rdi
callq 0x32fe
leaq -0x1a0(%rbp), %rdi
callq 0x336e
movq %rbx, %rdi
callq 0x23e0