// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: GetProcess(std::basic_ifstream<char, std::char_traits<char>>&)
vector<Process *> GetProcess(ifstream &input_file) {
    vector<Process *> processes;
    string line;
    int process_num;
    int vma_num;
    int s, e, w, f;
    
    SkipComments(input_file, line);
    
    istringstream input(line);
    input >> process_num;
    
    for (int i = 0; i < process_num; i++) {
        SkipComments(input_file, line);
        Process * process = new Process(i);
        istringstream input(line);
        input >> vma_num;
        
        for (int j = 0; j < vma_num; j++) {
            getline(input_file, line);
            istringstream input(line);
            input >> s >> e >> w >> f;
            process->AddVma(s, e, w, f);
        }
        processes.push_back(process);
    }
    return processes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x530, %rsp            # imm = 0x530
movq %rdi, -0x510(%rbp)
movq %rdi, %rax
movq %rax, -0x508(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x5760
leaq -0x38(%rbp), %rdi
movq %rdi, -0x500(%rbp)
callq 0x3280
movq -0x500(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x4f70
jmp 0x41df
leaq -0x1e0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x8, %edx
callq 0x3310
jmp 0x41f6
leaq -0x1e0(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x3140
jmp 0x4208
movl $0x0, -0x1e4(%rbp)
movl -0x1e4(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x4414
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4f70
jmp 0x4230
movl $0x80, %edi
callq 0x31c0
movq %rax, -0x518(%rbp)
jmp 0x4243
movq -0x518(%rbp), %rdi
movl -0x1e4(%rbp), %esi
callq 0x8f20
jmp 0x4257
movq -0x518(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq -0x370(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x8, %edx
callq 0x3310
jmp 0x427c
leaq -0x370(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3140
jmp 0x428e
movl $0x0, -0x374(%rbp)
movl -0x374(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x43d1
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3060
jmp 0x42b6
leaq -0x4f8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x8, %edx
callq 0x3310
jmp 0x42cd
leaq -0x4f8(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x3140
movq %rax, -0x520(%rbp)
jmp 0x42e6
movq -0x520(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3140
movq %rax, -0x528(%rbp)
jmp 0x42ff
movq -0x528(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
callq 0x3140
movq %rax, -0x530(%rbp)
jmp 0x4318
movq -0x530(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
jmp 0x432a
movq -0x1f0(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl -0x50(%rbp), %r8d
callq 0x9050
jmp 0x4345
leaq -0x4f8(%rbp), %rdi
callq 0x3110
movl -0x374(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x374(%rbp)
jmp 0x4298
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4441
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4435
movq -0x518(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
movl $0x80, %esi
callq 0x31d0
jmp 0x4435
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4406
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x4f8(%rbp), %rdi
callq 0x3110
jmp 0x4406
movq -0x510(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x5780
jmp 0x43e6
leaq -0x370(%rbp), %rdi
callq 0x3110
movl -0x1e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e4(%rbp)
jmp 0x4212
leaq -0x370(%rbp), %rdi
callq 0x3110
jmp 0x4435
movb $0x1, -0x11(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x3110
leaq -0x38(%rbp), %rdi
callq 0x3150
testb $0x1, -0x11(%rbp)
jne 0x4464
jmp 0x4458
leaq -0x1e0(%rbp), %rdi
callq 0x3110
leaq -0x38(%rbp), %rdi
callq 0x3150
movq -0x510(%rbp), %rdi
callq 0x53b0
jmp 0x4474
movq -0x510(%rbp), %rdi
callq 0x53b0
movq -0x508(%rbp), %rax
addq $0x530, %rsp            # imm = 0x530
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x3320
nopl (%rax)