// File: MUST-Quick-Fry[P]Process-Scheduler/scheduler.cpp
// Function: Project::Scheduler::splitToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Scheduler::splitToken(string str)
{
    int cnt = 0;
    char *strBuf = const_cast<char *>(str.c_str());

    char *token = strtok(strBuf, "\t\n");
    Job job = Job();
    while (token != NULL)
    {
        cnt++;
        if (cnt % 3 == 1)
        {
            job.ID = 1 + cnt/3; // assign job id
            Utils::arg_check(token);
            string buf(token);
            job.set_arr_time(stoi(buf));
        }
        else if (cnt % 3 == 2)
        {
            string buf(token);
            job.set_cmd(buf);
        }
        else
        {
            Utils::arg_check(token);
            string buf(token);
            job.set_dur_time(stoi(buf));
            job_queue.push_back(job);
        }
        token = strtok(NULL, "\t\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rsi, -0x130(%rbp)
movq %rdi, %rax
movq -0x130(%rbp), %rdi
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
callq 0x30e0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x104eb(%rip), %rsi     # 0x1925a
callq 0x33c0
movq %rax, -0x28(%rbp)
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x3140
leaq -0x80(%rbp), %rdi
callq 0x4160
cmpq $0x0, -0x28(%rbp)
je 0x90c7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x8ec9
movslq -0x14(%rbp), %rax
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x20, %rcx
movl %ecx, %edx
shrq $0x3f, %rax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4030
jmp 0x8de7
movq -0x28(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x3460
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x3340
jmp 0x8e21
leaq -0xb1(%rbp), %rdi
callq 0x32a0
xorl %eax, %eax
movl %eax, %esi
leaq -0xb0(%rbp), %rdi
movl $0xa, %edx
callq 0x42c0
movl %eax, -0x144(%rbp)
jmp 0x8e4a
movl -0x144(%rbp), %esi
leaq -0x80(%rbp), %rdi
callq 0x5a80
jmp 0x8e5b
leaq -0xb0(%rbp), %rdi
callq 0x3170
jmp 0x90ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x90d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0x32a0
jmp 0x90d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3170
jmp 0x90d9
movl -0x14(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x2, %edx
jne 0x8fcd
movq -0x28(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x3460
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0x3340
jmp 0x8f17
leaq -0xd9(%rbp), %rdi
callq 0x32a0
leaq -0x100(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x3100
jmp 0x8f38
leaq -0x80(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x5a60
jmp 0x8f4a
leaq -0x100(%rbp), %rdi
callq 0x3170
leaq -0xd8(%rbp), %rdi
callq 0x3170
jmp 0x90ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd9(%rbp), %rdi
callq 0x32a0
jmp 0x90d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x8fbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x3170
leaq -0xd8(%rbp), %rdi
callq 0x3170
jmp 0x90d9
movq -0x28(%rbp), %rdi
callq 0x4030
jmp 0x8fd8
movq -0x28(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0x121(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x3460
movq -0x168(%rbp), %rsi
movq -0x160(%rbp), %rdx
leaq -0x120(%rbp), %rdi
callq 0x3340
jmp 0x9012
leaq -0x121(%rbp), %rdi
callq 0x32a0
xorl %eax, %eax
movl %eax, %esi
leaq -0x120(%rbp), %rdi
movl $0xa, %edx
callq 0x42c0
movl %eax, -0x16c(%rbp)
jmp 0x903b
movl -0x16c(%rbp), %esi
leaq -0x80(%rbp), %rdi
callq 0x5aa0
jmp 0x904c
leaq 0x1a82d(%rip), %rdi     # 0x23880
leaq -0x80(%rbp), %rsi
callq 0xf600
jmp 0x905e
leaq -0x120(%rbp), %rdi
callq 0x3170
jmp 0x90ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x121(%rbp), %rdi
callq 0x32a0
jmp 0x90d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x3170
jmp 0x90d9
jmp 0x90ae
xorl %eax, %eax
movl %eax, %edi
leaq 0x101a1(%rip), %rsi     # 0x1925a
callq 0x33c0
movq %rax, -0x28(%rbp)
jmp 0x8d91
leaq -0x80(%rbp), %rdi
callq 0x4190
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0x4190
movq -0x88(%rbp), %rdi
callq 0x3450
nop