// File: joakimkistowski[P]amd-disable-c6/amd-disable-c6.cpp
// Function: parse_op_mode(int, char const**)
op_mode parse_op_mode(const int argc, const char *argv[]) {
    if (argc <= 1) {
        std::cout << "Disabling C6 state. Run with \"-h\" to display other options." << std::endl;
        return DISABLE;
    }
    std::string argument(argv[1]);
    if (argument == FLAG_HELP0 || argument == FLAG_HELP1) {
        print_help();
        return NONE;
    } else if (argument == FLAG_LIST0 || argument == FLAG_LIST1) {
        return LIST;
    } else if (argument == FLAG_DISABLE) {
        return DISABLE;
    } else if (argument == FLAG_DISABLE_RETRY) {
        return RETRYDISABLE;
    } else if (argument == FLAG_ENABLE) {
        return ENABLE;
    }
    std::cerr << "Error, unknown parameter: " << argument << std::endl;
    return ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jg 0x3663
movq 0x598c(%rip), %rdi      # 0x8fc8
leaq 0x2c3f(%rip), %rsi      # 0x6282
callq 0x21b0
movq %rax, %rdi
movq 0x595e(%rip), %rsi      # 0x8fb0
callq 0x21f0
movl $0x0, -0x4(%rbp)
jmp 0x381f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x23a0
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x3ed0
jmp 0x368f
leaq -0x31(%rbp), %rdi
callq 0x2210
leaq -0x30(%rbp), %rdi
leaq 0x5b9d(%rip), %rsi      # 0x9240
callq 0x4460
testb $0x1, %al
jne 0x36c2
leaq -0x30(%rbp), %rdi
leaq 0x5ba9(%rip), %rsi      # 0x9260
callq 0x4460
testb $0x1, %al
jne 0x36c2
jmp 0x3710
callq 0x3450
jmp 0x36c9
movl $0x4, -0x4(%rbp)
movl $0x1, -0x48(%rbp)
jmp 0x3816
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x2210
jmp 0x3828
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2428
jmp 0x3828
leaq -0x30(%rbp), %rdi
leaq 0x5bc5(%rip), %rsi      # 0x92e0
callq 0x4460
testb $0x1, %al
jne 0x373a
leaq -0x30(%rbp), %rdi
leaq 0x5bd1(%rip), %rsi      # 0x9300
callq 0x4460
testb $0x1, %al
jne 0x373a
jmp 0x374d
movl $0x3, -0x4(%rbp)
movl $0x1, -0x48(%rbp)
jmp 0x3816
leaq -0x30(%rbp), %rdi
leaq 0x5b28(%rip), %rsi      # 0x9280
callq 0x4460
testb $0x1, %al
jne 0x3763
jmp 0x3776
movl $0x0, -0x4(%rbp)
movl $0x1, -0x48(%rbp)
jmp 0x3816
leaq -0x30(%rbp), %rdi
leaq 0x5b1f(%rip), %rsi      # 0x92a0
callq 0x4460
testb $0x1, %al
jne 0x378c
jmp 0x379c
movl $0x1, -0x4(%rbp)
movl $0x1, -0x48(%rbp)
jmp 0x3816
leaq -0x30(%rbp), %rdi
leaq 0x5b19(%rip), %rsi      # 0x92c0
callq 0x4460
testb $0x1, %al
jne 0x37b2
jmp 0x37c2
movl $0x2, -0x4(%rbp)
movl $0x1, -0x48(%rbp)
jmp 0x3816
jmp 0x37c4
jmp 0x37c6
jmp 0x37c8
jmp 0x37ca
movq 0x581f(%rip), %rdi      # 0x8ff0
leaq 0x2ae6(%rip), %rsi      # 0x62be
callq 0x21b0
movq %rax, -0x60(%rbp)
jmp 0x37e3
movq -0x60(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x21a0
movq %rax, -0x68(%rbp)
jmp 0x37f6
movq -0x68(%rbp), %rdi
movq 0x57af(%rip), %rsi      # 0x8fb0
callq 0x21f0
jmp 0x3808
movl $0x5, -0x4(%rbp)
movl $0x1, -0x48(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2428
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2390
nopw %cs:(%rax,%rax)