// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %r9, -0x38(%rbp)
movq %r8, -0x40(%rbp)
movq %rcx, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
cmpl $0x3, %edi
jl 0x287d
movq %rsi, %r15
movl %edi, %r12d
leaq 0x293c(%rip), %r14      # 0x5089
leaq -0x90(%rbp), %r13
leaq -0x70(%rbp), %rbx
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2070
cmpl $0x61, %eax
je 0x2784
cmpl $0x66, %eax
je 0x27d7
cmpl $0x6f, %eax
je 0x27b0
cmpl $-0x1, %eax
je 0x27f1
cmpl $0x3f, %eax
jne 0x2758
jmp 0x2866
movq 0x5835(%rip), %rax      # 0x7fc0
movq (%rax), %rsi
movq %r13, %rdi
leaq -0x29(%rbp), %rdx
callq 0x36c0
movq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x21a0
movq %r13, %rdi
callq 0x20f0
jmp 0x2758
movq 0x5809(%rip), %rax      # 0x7fc0
movq (%rax), %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x36c0
movq %rbx, %rdi
callq 0x3483
movq %rbx, %rdi
callq 0x20f0
jmp 0x2758
movq 0x57e2(%rip), %rax      # 0x7fc0
movq (%rax), %rdi
callq 0x2210
movq -0x48(%rbp), %rcx
movl %eax, (%rcx)
jmp 0x2758
movq 0x57e0(%rip), %rax      # 0x7fd8
movslq (%rax), %r13
leal -0x2(%r12), %eax
movl %r12d, %ebx
decl %r12d
movslq %eax, %r14
movslq %r12d, %r12
cmpq %rbx, %r13
jge 0x2857
cmpq %r13, %r14
jne 0x2820
movq (%r15,%r14,8), %rsi
movq -0x40(%rbp), %rdi
jmp 0x282d
cmpq %r13, %r12
jne 0x2834
movq (%r15,%r12,8), %rsi
movq -0x38(%rbp), %rdi
callq 0x2290
jmp 0x2852
movq (%r15,%r13,8), %rsi
leaq 0x2865(%rip), %rdi      # 0x50a4
xorl %eax, %eax
callq 0x2030
leaq 0x28dd(%rip), %rdi      # 0x512a
callq 0x2200
incq %r13
jmp 0x280c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5763(%rip), %rax      # 0x7fd0
movl (%rax), %esi
leaq 0x281a(%rip), %rdi      # 0x5090
xorl %eax, %eax
callq 0x2030
leaq 0x28a6(%rip), %rdi      # 0x512a
callq 0x2200
pushq $0x1
popq %rdi
callq 0x2190