// File: /workspace/github_cpp_makefile_star2_O1/marcellapantarotto[P]pseudoSO/scheduler.cpp
// Function: Scheduler::readFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Scheduler::readFile(string filename) {
	fstream txt;	// realiza operações de E/S em algum arquivo
	txt.open(filename.c_str());		// abrindo arquivo .txt
	string data;
	vector<int> tmp;
	char *ptr;
	Process p;
	int id = 1;

	while(getline(txt, data)) 	{
		if(data != "") {
			ptr = strtok((char*)data.c_str(),"\t ,");	// divide string em tokens
			while(ptr != NULL) {
				tmp.push_back(atoi(ptr));
				ptr = strtok(NULL,"\t ,");
			}
		}
	}

	// atibuição dos valores do processo a instancia
	for(int i = 0; i < (int)tmp.size(); i += 8) {
		p.setPID(id);
		p.setMemoryOffset(-1);
		p.setInitTime(tmp[i]);
		p.setPriority(tmp[i+1]);
		p.setExecutionTime(tmp[i+2]);
		p.setAmoutBlocks(tmp[i+3]);
		p.setPrinter(tmp[i+4]);
		p.setScanner(tmp[i+5]);
		p.setModem(tmp[i+6]);
		p.setSata(tmp[i+7]);
		p.setBlockedResource(WITHOUT_RESOURCES);
		processes.push_back(p);
		id++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rsi, %rbx
movq %rdi, -0x50(%rbp)
leaq -0x2a0(%rbp), %r14
movq %r14, %rdi
callq 0x2190
movq (%rbx), %rsi
movq %r14, %rdi
movl $0x18, %edx
callq 0x2120
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
leaq -0x40(%rbp), %r15
movq %rax, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq -0x70(%rbp), %r12
leaq 0x16b5(%rip), %r13      # 0x5210
leaq -0x44(%rbp), %rbx
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2240
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3be7
movq %r12, %rdi
leaq 0x159e(%rip), %rsi      # 0x513b
callq 0x2080
testl %eax, %eax
je 0x3b5f
movq -0x70(%rbp), %rdi
movq %r13, %rsi
callq 0x21d0
testq %rax, %rax
je 0x3b5f
movq %rax, %rdi
callq 0x21c0
movl %eax, -0x44(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x3bd8
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x3be3
movq %r15, %rdi
movq %rbx, %rdx
callq 0x4c72
xorl %edi, %edi
jmp 0x3baa
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
shrq $0x2, %rax
testl %eax, %eax
movq -0x50(%rbp), %r13
jle 0x3d1e
leaq 0x8(%r13), %r14
movl $0x1, %r15d
xorl %ebx, %ebx
leaq -0x90(%rbp), %r12
movq %r12, %rdi
movl %r15d, %esi
callq 0x2b4e
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x2b5e
movq -0x40(%rbp), %rax
movl (%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b6e
movq -0x40(%rbp), %rax
movl 0x4(%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b56
movq -0x40(%rbp), %rax
movl 0x8(%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b76
movq -0x40(%rbp), %rax
movl 0xc(%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b66
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x10(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b88
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x14(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b7e
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x18(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b92
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x1c(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b9c
movq %r12, %rdi
xorl %esi, %esi
callq 0x2ba6
movq 0x10(%r13), %rsi
cmpq 0x18(%r13), %rsi
je 0x3cf5
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, 0x10(%r13)
jmp 0x3d00
movq %r14, %rdi
movq %r12, %rdx
callq 0x4daa
incl %r15d
addq $0x8, %rbx
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
shrq $0x2, %rax
cmpl %eax, %ebx
jl 0x3c15
testq %rdi, %rdi
je 0x3d28
callq 0x2140
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d3a
callq 0x2140
leaq -0x2a0(%rbp), %rdi
callq 0x2040
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3d84
jmp 0x3d61
jmp 0x3d61
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3d72
callq 0x2140
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d84
callq 0x2140
leaq -0x2a0(%rbp), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2230