// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: GetPager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<int, std::allocator<int>>, int)
Pager * GetPager(string algo, vector<int> randoms, int num_frames) {
    if (algo == "f") {
        return new FifoPager();
    } else if (algo == "r") {
        return new RandomPager(randoms);
    } else if (algo == "c") {
        return new ClockPager();
    } else if (algo == "e") {
        return new NruPager(a_option);
    } else if (algo == "a") {
        return new AgingPager(a_option, num_frames);
    } else if (algo == "w") {
        return new WorkingSetPager(a_option);
    }
    
    printf("Wrong Pager Specification: %s\n", algo.c_str());
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x60(%rbp)
movq %rsi, -0x58(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
leaq 0xa28f(%rip), %rsi      # 0xe144
callq 0x5700
testb $0x1, %al
jne 0x3ec0
jmp 0x3f07
movl $0x10, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
callq 0xaa70
jmp 0x3edb
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x416b
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x31d0
jmp 0x4178
movq -0x60(%rbp), %rdi
leaq 0xa234(%rip), %rsi      # 0xe146
callq 0x5700
testb $0x1, %al
jne 0x3f20
jmp 0x3fa8
movl $0x28, %edi
callq 0x31c0
movq -0x58(%rbp), %rsi
movq %rax, -0x70(%rbp)
movb $0x1, -0x49(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5170
jmp 0x3f41
movq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xab50
jmp 0x3f50
movq -0x70(%rbp), %rax
movb $0x0, -0x49(%rbp)
movq %rax, -0x8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5260
jmp 0x416b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3f8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5260
testb $0x1, -0x49(%rbp)
jne 0x3f95
jmp 0x3fa3
movq -0x70(%rbp), %rdi
movl $0x28, %esi
callq 0x31d0
jmp 0x4178
movq -0x60(%rbp), %rdi
leaq 0xa327(%rip), %rsi      # 0xe2da
callq 0x5700
testb $0x1, %al
jne 0x3fbe
jmp 0x4005
movl $0x10, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
callq 0xac80
jmp 0x3fd9
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x416b
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x31d0
jmp 0x4178
movq -0x60(%rbp), %rdi
leaq 0xa138(%rip), %rsi      # 0xe148
callq 0x5700
testb $0x1, %al
jne 0x401b
jmp 0x4068
movl $0x18, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
movl 0x111cb(%rip), %esi     # 0x15200
callq 0xae60
jmp 0x403c
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x416b
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x18, %esi
callq 0x31d0
jmp 0x4178
movq -0x60(%rbp), %rdi
leaq 0xa0d7(%rip), %rsi      # 0xe14a
callq 0x5700
testb $0x1, %al
jne 0x407e
jmp 0x40d7
movl $0x28, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
movl 0x11165(%rip), %esi     # 0x15200
movl -0x1c(%rbp), %edx
callq 0xb140
jmp 0x40a5
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x416b
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x28, %esi
callq 0x31d0
jmp 0x4178
movq -0x60(%rbp), %rdi
leaq 0xa06a(%rip), %rsi      # 0xe14c
callq 0x5700
testb $0x1, %al
jne 0x40ed
jmp 0x413d
movl $0x18, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movl 0x110f6(%rip), %esi     # 0x15200
callq 0xb590
jmp 0x4111
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x416b
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x18, %esi
callq 0x31d0
jmp 0x4178
jmp 0x413f
jmp 0x4141
jmp 0x4143
jmp 0x4145
jmp 0x4147
movq -0x60(%rbp), %rdi
callq 0x30e0
movq %rax, %rsi
leaq 0x9ff4(%rip), %rdi      # 0xe14e
movb $0x0, %al
callq 0x3030
movl $0x1, %edi
callq 0x3220
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3320
nopw %cs:(%rax,%rax)