#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ seteuid(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ sys_cpu_pstate(int, int, int);
scalar_t__ sys_cpu_setall(char *, char *);
int /*<<< orphan*/ sys_cpufreq_set(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    fprintf(stderr, "Invalid command. Syntax:\n");
    fprintf(
        stderr,
        "\tcpuclock_sysfs <frequency|governor> <freq-level|governor-name>\n");
    fprintf(stderr, "\tcpuclock_sysfs <pstate> <min> <max> <turbo>\n");
    return 1;
  }
  if (seteuid(0)) {
    fprintf(stderr, "%s %s\n", argv[0], argv[1]);
    fprintf(stderr, "Unable to assume root privileges\n");
    return 1;
  }
  if (!strcmp(argv[1], "frequency")) {
    if (sys_cpu_setall("scaling_setspeed", argv[2]) == 0) {
      fprintf(stderr, "Unable to open frequency interface for writing.\n");
      return 1;
    }
    return 0;
  } else if (!strcmp(argv[1], "governor")) {
    if (sys_cpu_setall("scaling_governor", argv[2]) == 0) {
      fprintf(stderr, "Unable to open governor interface for writing.\n");
      return 1;
    }
    if (!strcmp(argv[2], "ondemand"))
      sys_cpufreq_set("ondemand/ignore_nice_load", "0");
    else if (!strcmp(argv[2], "conservative"))
      sys_cpufreq_set("conservative/ignore_nice_load", "0");
    return 0;
  } else if (!strcmp(argv[1], "pstate")) {
    int min, max, turbo;
    if (argc < 5) {
      fprintf(stderr, "Invalid number of arguments.\n");
      return 1;
    }
    min = atoi(argv[2]);
    max = atoi(argv[3]);
    turbo = atoi(argv[4]);
    if ((min < 0) || (min > 100) || (max < 0) || (max > 100) || (turbo < 0) ||
        (turbo > 1)) {
      fprintf(stderr, "Invalid pstate values.\n");
      return 1;
    }
    sys_cpu_pstate(min, max, turbo);
    return 0;
  } else {
    fprintf(stderr, "Unknown command.\n");
    return 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11e1 <main+0x71>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148a <main+0x31a>
xor    %edi,%edi
call   1090 <seteuid@plt>
cmp    $0x0,%rax
je     123b <main+0xcb>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12a5 <main+0x135>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe55(%rip),%rdi
call   1050 <sys_cpu_setall@plt>
cmp    $0x0,%rax
jne    1299 <main+0x129>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148a <main+0x31a>
movl   $0x0,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1379 <main+0x209>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe2d(%rip),%rdi
call   1050 <sys_cpu_setall@plt>
cmp    $0x0,%rax
jne    1303 <main+0x193>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe2d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1338 <main+0x1c8>
lea    0xe21(%rip),%rdi
lea    0xe34(%rip),%rsi
call   1070 <sys_cpufreq_set@plt>
jmp    136d <main+0x1fd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe1d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1368 <main+0x1f8>
lea    0xe15(%rip),%rdi
lea    0xdff(%rip),%rsi
call   1070 <sys_cpufreq_set@plt>
jmp    136d <main+0x1fd>
movl   $0x0,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe07(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    146c <main+0x2fc>
cmpl   $0x5,-0x8(%rbp)
jge    13c3 <main+0x253>
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     142f <main+0x2bf>
cmpl   $0x64,-0x14(%rbp)
jg     142f <main+0x2bf>
cmpl   $0x0,-0x18(%rbp)
jl     142f <main+0x2bf>
cmpl   $0x64,-0x18(%rbp)
jg     142f <main+0x2bf>
cmpl   $0x0,-0x1c(%rbp)
jl     142f <main+0x2bf>
cmpl   $0x1,-0x1c(%rbp)
jle    1452 <main+0x2e2>
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1060 <sys_cpu_pstate@plt>
movl   $0x0,-0x4(%rbp)
jmp    148a <main+0x31a>
mov    0x2b6d(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jg     11ab <main+0x3b>
mov    0x2e60(%rip),%rbx
mov    (%rbx),%edi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe81(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeb2(%rip),%rsi
jmp    11e5 <main+0x75>
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1090 <seteuid@plt>
test   %rax,%rax
je     11f8 <main+0x88>
mov    0x2e1d(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
mov    0x8(%rbx),%rcx
lea    0xeb5(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xeab(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x8(%rbx),%r14
lea    0xeaf(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     124b <main+0xdb>
lea    0xef0(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1277 <main+0x107>
lea    0xf66(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     12d8 <main+0x168>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xf83(%rip),%rsi
jmp    11e5 <main+0x75>
mov    0x10(%rbx),%rsi
lea    0xe66(%rip),%rdi
call   1050 <sys_cpu_setall@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    11f1 <main+0x81>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
jmp    11e5 <main+0x75>
mov    0x10(%rbx),%rsi
lea    0xe7c(%rip),%rdi
call   1050 <sys_cpu_setall@plt>
test   %rax,%rax
je     12f2 <main+0x182>
mov    0x10(%rbx),%rbx
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1352 <main+0x1e2>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
jne    11f1 <main+0x81>
lea    0xeaa(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1070 <sys_cpufreq_set@plt>
jmp    11f1 <main+0x81>
cmp    $0x4,%ebp
ja     1307 <main+0x197>
mov    0x2cfc(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
jmp    11e5 <main+0x75>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
jmp    11e5 <main+0x75>
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rdi
call   1080 <atoi@plt>
cmp    $0x64,%r14d
ja     136c <main+0x1fc>
test   %ebp,%ebp
js     136c <main+0x1fc>
cmp    $0x64,%ebp
jg     136c <main+0x1fc>
test   %eax,%eax
js     136c <main+0x1fc>
cmp    $0x2,%eax
jge    136c <main+0x1fc>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1060 <sys_cpu_pstate@plt>
xor    %ebx,%ebx
jmp    11f1 <main+0x81>
lea    0xdef(%rip),%rdi
lea    0xe02(%rip),%rsi
call   1070 <sys_cpufreq_set@plt>
xor    %ebx,%ebx
jmp    11f1 <main+0x81>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
jmp    11e5 <main+0x75>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid command. Syntax:\0A\00"
@.str.1 = [65 x i8] c"\09cpuclock_sysfs <frequency|governor> <freq-level|governor-name>\0A\00"
@.str.2 = [46 x i8] c"\09cpuclock_sysfs <pstate> <min> <max> <turbo>\0A\00"
@.str.3 = [7 x i8] c"%s %s\0A\00"
@.str.4 = [34 x i8] c"Unable to assume root privileges\0A\00"
@.str.5 = [10 x i8] c"frequency\00"
@.str.6 = [17 x i8] c"scaling_setspeed\00"
@.str.7 = [49 x i8] c"Unable to open frequency interface for writing.\0A\00"
@.str.8 = [9 x i8] c"governor\00"
@.str.9 = [17 x i8] c"scaling_governor\00"
@.str.10 = [48 x i8] c"Unable to open governor interface for writing.\0A\00"
@.str.11 = [9 x i8] c"ondemand\00"
@.str.12 = [26 x i8] c"ondemand/ignore_nice_load\00"
@.str.13 = [2 x i8] c"0\00"
@.str.14 = [13 x i8] c"conservative\00"
@.str.15 = [30 x i8] c"conservative/ignore_nice_load\00"
@.str.16 = [7 x i8] c"pstate\00"
@.str.17 = [30 x i8] c"Invalid number of arguments.\0A\00"
@.str.18 = [24 x i8] c"Invalid pstate values.\0A\00"
@.str.19 = [18 x i8] c"Unknown command.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %134
18: ; preds = %2
%19 = call i64 @seteuid(i32 0)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %32
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* %28)
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %134
32: ; preds = %18
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @strcmp(i8* %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%37 = icmp ne i32 %36, 0
br i1 %37, label %48, label %38
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i64 @sys_cpu_setall(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %38
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %134
47: ; preds = %38
store i32 0, i32* %3
br label %134
48: ; preds = %32
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %81, label %54
54: ; preds = %48
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call i64 @sys_cpu_setall(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %134
63: ; preds = %54
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 2
%66 = load i8*, i8** %65
%67 = call i32 @strcmp(i8* %66, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%68 = icmp ne i32 %67, 0
br i1 %68, label %71, label %69
69: ; preds = %63
%70 = call i32 @sys_cpufreq_set(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
br label %80
71: ; preds = %63
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 2
%74 = load i8*, i8** %73
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %71
%78 = call i32 @sys_cpufreq_set(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
br label %79
79: ; preds = %77, %71
br label %80
80: ; preds = %79, %69
store i32 0, i32* %3
br label %134
81: ; preds = %48
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = call i32 @strcmp(i8* %84, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
%86 = icmp ne i32 %85, 0
br i1 %86, label %131, label %87
87: ; preds = %81
%88 = load i32, i32* %4
%89 = icmp slt i32 %88, 5
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
store i32 1, i32* %3
br label %134
93: ; preds = %87
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 2
%96 = load i8*, i8** %95
%97 = call i32 @atoi(i8* %96)
store i32 %97, i32* %6
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 3
%100 = load i8*, i8** %99
%101 = call i32 @atoi(i8* %100)
store i32 %101, i32* %7
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 4
%104 = load i8*, i8** %103
%105 = call i32 @atoi(i8* %104)
store i32 %105, i32* %8
%106 = load i32, i32* %6
%107 = icmp slt i32 %106, 0
br i1 %107, label %123, label %108
108: ; preds = %93
%109 = load i32, i32* %6
%110 = icmp sgt i32 %109, 100
br i1 %110, label %123, label %111
111: ; preds = %108
%112 = load i32, i32* %7
%113 = icmp slt i32 %112, 0
br i1 %113, label %123, label %114
114: ; preds = %111
%115 = load i32, i32* %7
%116 = icmp sgt i32 %115, 100
br i1 %116, label %123, label %117
117: ; preds = %114
%118 = load i32, i32* %8
%119 = icmp slt i32 %118, 0
br i1 %119, label %123, label %120
120: ; preds = %117
%121 = load i32, i32* %8
%122 = icmp sgt i32 %121, 1
br i1 %122, label %123, label %126
123: ; preds = %120, %117, %114, %111, %108, %93
%124 = load i32, i32* @stderr
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
store i32 1, i32* %3
br label %134
126: ; preds = %120
%127 = load i32, i32* %6
%128 = load i32, i32* %7
%129 = load i32, i32* %8
%130 = call i32 @sys_cpu_pstate(i32 %127, i32 %128, i32 %129)
store i32 0, i32* %3
br label %134
131: ; preds = %81
%132 = load i32, i32* @stderr
%133 = call i32 (i32, i8*, ...) @fprintf(i32 %132, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0))
store i32 1, i32* %3
br label %134
134: ; preds = %131, %126, %123, %90, %80, %60, %47, %44, %21, %11
%135 = load i32, i32* %3
ret i32 %135
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid command. Syntax:\0A\00"
@.str.1 = [65 x i8] c"\09cpuclock_sysfs <frequency|governor> <freq-level|governor-name>\0A\00"
@.str.2 = [46 x i8] c"\09cpuclock_sysfs <pstate> <min> <max> <turbo>\0A\00"
@.str.3 = [7 x i8] c"%s %s\0A\00"
@.str.4 = [34 x i8] c"Unable to assume root privileges\0A\00"
@.str.5 = [10 x i8] c"frequency\00"
@.str.6 = [17 x i8] c"scaling_setspeed\00"
@.str.7 = [49 x i8] c"Unable to open frequency interface for writing.\0A\00"
@.str.8 = [9 x i8] c"governor\00"
@.str.9 = [17 x i8] c"scaling_governor\00"
@.str.10 = [48 x i8] c"Unable to open governor interface for writing.\0A\00"
@.str.11 = [9 x i8] c"ondemand\00"
@.str.12 = [26 x i8] c"ondemand/ignore_nice_load\00"
@.str.13 = [2 x i8] c"0\00"
@.str.14 = [13 x i8] c"conservative\00"
@.str.15 = [30 x i8] c"conservative/ignore_nice_load\00"
@.str.16 = [7 x i8] c"pstate\00"
@.str.17 = [30 x i8] c"Invalid number of arguments.\0A\00"
@.str.18 = [24 x i8] c"Invalid pstate values.\0A\00"
@.str.19 = [18 x i8] c"Unknown command.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %92
11: ; preds = %2
%12 = tail call i64 @seteuid(i32 0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %16, i8* %18)
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %92
22: ; preds = %11
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @strcmp(i8* dereferenceable(1) %24, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %22
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = tail call i64 @sys_cpu_setall(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %92
32: ; preds = %27
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
br label %92
35: ; preds = %22
%36 = tail call i32 @strcmp(i8* dereferenceable(1) %24, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %57
38: ; preds = %35
%39 = getelementptr inbounds i8*, i8** %1, i64 2
%40 = load i8*, i8** %39
%41 = tail call i64 @sys_cpu_setall(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0))
br label %92
46: ; preds = %38
%47 = load i8*, i8** %39
%48 = tail call i32 @strcmp(i8* dereferenceable(1) %47, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = tail call i32 @sys_cpufreq_set(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
br label %92
52: ; preds = %46
%53 = tail call i32 @strcmp(i8* dereferenceable(1) %47, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %92
55: ; preds = %52
%56 = tail call i32 @sys_cpufreq_set(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
br label %92
57: ; preds = %35
%58 = tail call i32 @strcmp(i8* dereferenceable(1) %24, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %89
60: ; preds = %57
%61 = icmp ult i32 %0, 5
br i1 %61, label %62, label %65
62: ; preds = %60
%63 = load i32, i32* @stderr
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
br label %92
65: ; preds = %60
%66 = getelementptr inbounds i8*, i8** %1, i64 2
%67 = load i8*, i8** %66
%68 = tail call i32 @atoi(i8* %67)
%69 = getelementptr inbounds i8*, i8** %1, i64 3
%70 = load i8*, i8** %69
%71 = tail call i32 @atoi(i8* %70)
%72 = getelementptr inbounds i8*, i8** %1, i64 4
%73 = load i8*, i8** %72
%74 = tail call i32 @atoi(i8* %73)
%75 = icmp ugt i32 %68, 100
%76 = icmp slt i32 %71, 0
%77 = select i1 %75, i1 true, i1 %76
%78 = icmp sgt i32 %71, 100
%79 = select i1 %77, i1 true, i1 %78
%80 = icmp slt i32 %74, 0
%81 = select i1 %79, i1 true, i1 %80
%82 = icmp sgt i32 %74, 1
%83 = select i1 %81, i1 true, i1 %82
br i1 %83, label %84, label %87
84: ; preds = %65
%85 = load i32, i32* @stderr
%86 = tail call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
br label %92
87: ; preds = %65
%88 = tail call i32 @sys_cpu_pstate(i32 %68, i32 %71, i32 %74)
br label %92
89: ; preds = %57
%90 = load i32, i32* @stderr
%91 = tail call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.19, i64 0, i64 0))
br label %92
92: ; preds = %62, %84, %87, %50, %55, %52, %27, %89, %43, %32, %14, %4
%93 = phi i32 [ 1, %4 ], [ 1, %14 ], [ 1, %89 ], [ 1, %43 ], [ 1, %32 ], [ 0, %27 ], [ 0, %52 ], [ 0, %55 ], [ 0, %50 ], [ 1, %62 ], [ 1, %84 ], [ 0, %87 ]
ret i32 %93
}