// File: /workspace/github_cpp_makefile_star2_O3/eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: ParseCommand(int, char**, int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void ParseCommand(int argc, char * argv[], int &num_frames, string &algo, string &input_filename, string &rand_filename) {
    
    if (argc < 3) {
        printf("Use this to run: ./mmu –f<num_frames> -a<algo> [-o<options>] inputfile randomfile\n");
        exit (EXIT_FAILURE);
    }
    
    int c;
    while ((c = getopt (argc, argv, "a:f:o:")) != -1) {
        switch(c) {
            case 'f':
                num_frames = atoi(optarg);
                break;
            case 'a':
                algo = string(optarg);
                break;
            case 'o':
                ParseOptions(string(optarg));
                break;
            case '?':
                printf("Unknown Option -%c\n", optopt);
                printf("Use this to run: ./mmu –f<num_frames> -a<algo> [-o<options>] inputfile randomfile\n");
                exit (EXIT_FAILURE);
                break;
        }
    }
    
    for (int index = optind; index < argc; index++) {
        if (index == argc - 2) {
            input_filename = argv[index];
        } else if (index == argc - 1) {
            rand_filename = argv[index];
        } else {
            printf("Non-option argument %s\n", argv[index]);
            printf("Use this to run: ./mmu –f<num_frames> -a<algo> [-o<options>] inputfile randomfile\n");
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, -0x58(%rbp)
movq %r8, -0x70(%rbp)
movq %rcx, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
cmpl $0x3, %edi
jl 0x2a2d
movq %rsi, %r15
movl %edi, %r12d
leaq 0x374c(%rip), %r14      # 0x6089
movq 0x6674(%rip), %rbx      # 0x8fb8
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2060
cmpl $0x65, %eax
jle 0x2971
cmpl $0x6f, %eax
je 0x29ba
cmpl $0x66, %eax
jne 0x2944
movq (%rbx), %rdi
callq 0x21e0
movq -0x38(%rbp), %rcx
movl %eax, (%rcx)
jmp 0x2944
cmpl $0x61, %eax
jne 0x2a08
movq (%rbx), %rsi
leaq -0x90(%rbp), %r13
movq %r13, %rdi
leaq -0x29(%rbp), %rdx
callq 0x3c38
movq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x2170
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x2944
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2944
movq %rbx, %r13
movq (%rbx), %rsi
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x90(%rbp), %rdx
callq 0x3c38
movq %rbx, %rdi
callq 0x39b7
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x2a00
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2150
movq %r13, %rbx
jmp 0x2944
cmpl $-0x1, %eax
je 0x2a43
cmpl $0x3f, %eax
jne 0x2944
movq 0x65b3(%rip), %rax      # 0x8fd0
movl (%rax), %esi
leaq 0x366a(%rip), %rdi      # 0x6090
xorl %eax, %eax
callq 0x2030
leaq 0x36f6(%rip), %rdi      # 0x612a
callq 0x21c0
movl $0x1, %edi
callq 0x2160
movq 0x658e(%rip), %rax      # 0x8fd8
movslq (%rax), %rax
cmpl %eax, %r12d
jle 0x2b20
leal -0x2(%r12), %ecx
leal -0x1(%r12), %edx
movslq %edx, %rdx
movslq %ecx, %rsi
movq %rsi, -0x68(%rbp)
subq %rax, %rsi
movq %rsi, -0x40(%rbp)
movq %rdx, -0x50(%rbp)
subq %rax, %rdx
movq %rdx, -0x60(%rbp)
leaq (%r15,%rax,8), %rcx
movq %rcx, -0x48(%rbp)
subl %eax, %r12d
xorl %r14d, %r14d
cmpq %r14, -0x40(%rbp)
jne 0x2aba
movq -0x68(%rbp), %rax
movq (%r15,%rax,8), %r13
movq -0x70(%rbp), %rbx
movq 0x8(%rbx), %rax
movq %rax, -0x38(%rbp)
movq %r13, %rdi
callq 0x20c0
movq %rbx, %rdi
xorl %esi, %esi
movq -0x38(%rbp), %rdx
movq %r13, %rcx
jmp 0x2ae8
cmpq %r14, -0x60(%rbp)
jne 0x2af2
movq -0x50(%rbp), %rax
movq (%r15,%rax,8), %rbx
movq -0x58(%rbp), %r13
movq 0x8(%r13), %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
callq 0x20c0
movq %r13, %rdi
xorl %esi, %esi
movq -0x38(%rbp), %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x21d0
jmp 0x2b14
movq -0x48(%rbp), %rax
movq (%rax,%r14,8), %rsi
leaq 0x35a3(%rip), %rdi      # 0x60a4
xorl %eax, %eax
callq 0x2030
leaq 0x361b(%rip), %rdi      # 0x612a
callq 0x21c0
incq %r14
cmpl %r14d, %r12d
jne 0x2a8a
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq