// File: isabellab3[P]OS-Simulation/./OS.h
// Function: OperatingSystem::OperatingSystem(int&, unsigned int&, unsigned int&)
OperatingSystem(int & number_of_hard_disks_, unsigned int & RAM_, unsigned int & page_size_) : 
            CPU(1), 
            number_of_processes(1), 
            timestamp(0), 
            number_of_hard_disks(number_of_hard_disks_), 
            page_size(page_size_), 
            RAM(RAM_),
            number_of_frames(RAM_ / page_size_), 
            ready_queue(0), 
            hard_disks(number_of_hard_disks_), 
            frames(0) {
                
            // Creates initial process
            PCB* process_1 = new PCB{ number_of_processes };
            process_1->SetParent(1); //First process has no parent
            all_processes[number_of_processes] = process_1;

            // Initialize hard disks
            for (int i = 0; i < number_of_hard_disks; i++) {
                HardDisk* disk_ = new HardDisk{};
                hard_disks[i] = disk_;
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x1, (%rax)
movl $0x1, 0x4(%rax)
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, 0x14(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
xorl %edx, %edx
movl %edx, -0x64(%rbp)
divl %ecx
movl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x18(%rax)
addq $0x20, %rax
movq %rax, -0x60(%rbp)
leaq -0x21(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x3d50
movl -0x64(%rbp), %eax
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movl %eax, %esi
callq 0x3d70
jmp 0x2b17
leaq -0x21(%rbp), %rdi
callq 0x3e00
movq -0x70(%rbp), %rax
addq $0x38, %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x80(%rbp)
leaq -0x35(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x3e20
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x3e40
jmp 0x2b5d
leaq -0x35(%rbp), %rdi
callq 0x3eb0
movq -0x70(%rbp), %rdi
addq $0x50, %rdi
movq %rdi, -0xa0(%rbp)
callq 0x3ed0
movq -0x70(%rbp), %rax
subq $-0x80, %rax
movq %rax, -0x98(%rbp)
leaq -0x36(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x3ef0
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x3f10
jmp 0x2bb2
leaq -0x36(%rbp), %rdi
callq 0x3f80
movl $0x28, %edi
callq 0x21e0
movq %rax, -0xa8(%rbp)
jmp 0x2bce
movq -0xa8(%rbp), %rdi
movq -0x70(%rbp), %rsi
addq $0x4, %rsi
callq 0x3fa0
jmp 0x2be4
movq -0xa8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movl $0x1, %esi
callq 0x4030
jmp 0x2bff
movq -0x70(%rbp), %rsi
movq -0x40(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %rsi, %rdi
addq $0x50, %rdi
addq $0x4, %rsi
callq 0x4050
movq %rax, -0xb0(%rbp)
jmp 0x2c27
movq -0xb0(%rbp), %rax
movq -0xb8(%rbp), %rcx
movq %rcx, (%rax)
movl $0x0, -0x44(%rbp)
movq -0x70(%rbp), %rcx
movl -0x44(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0x2d43
movl $0x40, %edi
callq 0x21e0
movq %rax, -0xc0(%rbp)
jmp 0x2c62
movq -0xc0(%rbp), %rdi
callq 0x4130
jmp 0x2c70
movq -0x70(%rbp), %rdi
movq -0xc0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq $0x38, %rdi
movslq -0x44(%rbp), %rsi
callq 0x4200
movq -0xc8(%rbp), %rcx
movq %rcx, (%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2c3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x21(%rbp), %rdi
callq 0x3e00
jmp 0x2d79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x35(%rbp), %rdi
callq 0x3eb0
jmp 0x2d70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x36(%rbp), %rdi
callq 0x3f80
jmp 0x2d58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d4c
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x28, %esi
callq 0x21f0
jmp 0x2d4c
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x40, %esi
callq 0x21f0
jmp 0x2d4c
addq $0xd0, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x4220
movq -0xa0(%rbp), %rdi
callq 0x4280
movq -0x88(%rbp), %rdi
callq 0x42a0
movq -0x60(%rbp), %rdi
callq 0x4300
movq -0x30(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)
nopl (%rax)