// File: /workspace/github_cpp_makefile_star2_O3/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 0x16a7(%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 0x3bf5
movq %r12, %rdi
leaq 0x1590(%rip), %rsi      # 0x513b
callq 0x2080
testl %eax, %eax
je 0x3b6d
movq -0x70(%rbp), %rdi
movq %r13, %rsi
callq 0x21d0
testq %rax, %rax
je 0x3b6d
movq %rax, %rdi
callq 0x21c0
movl %eax, -0x44(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x3be6
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x3bf1
movq %r15, %rdi
movq %rbx, %rdx
callq 0x4c70
xorl %edi, %edi
jmp 0x3bb8
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
shrq $0x2, %rax
testl %eax, %eax
movq -0x50(%rbp), %r13
jle 0x3d2c
leaq 0x8(%r13), %r14
movl $0x1, %r15d
xorl %ebx, %ebx
leaq -0x90(%rbp), %r12
movq %r12, %rdi
movl %r15d, %esi
callq 0x2b5a
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x2b6a
movq -0x40(%rbp), %rax
movl (%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b7a
movq -0x40(%rbp), %rax
movl 0x4(%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b62
movq -0x40(%rbp), %rax
movl 0x8(%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b82
movq -0x40(%rbp), %rax
movl 0xc(%rax,%rbx,4), %esi
movq %r12, %rdi
callq 0x2b72
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x10(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b94
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x14(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b8a
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x18(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2b9e
movq -0x40(%rbp), %rax
xorl %esi, %esi
cmpl $0x0, 0x1c(%rax,%rbx,4)
setne %sil
movq %r12, %rdi
callq 0x2ba8
movq %r12, %rdi
xorl %esi, %esi
callq 0x2bb2
movq 0x10(%r13), %rsi
cmpq 0x18(%r13), %rsi
je 0x3d03
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, 0x10(%r13)
jmp 0x3d0e
movq %r14, %rdi
movq %r12, %rdx
callq 0x4da8
incl %r15d
addq $0x8, %rbx
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
shrq $0x2, %rax
cmpl %eax, %ebx
jl 0x3c23
testq %rdi, %rdi
je 0x3d36
callq 0x2140
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d48
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 0x3d92
jmp 0x3d6f
jmp 0x3d6f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3d80
callq 0x2140
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d92
callq 0x2140
leaq -0x2a0(%rbp), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2230