#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 /*<<< orphan*/ dec_brightness();
int /*<<< orphan*/ inc_brightness();
int /*<<< orphan*/ print_brightness();
int /*<<< orphan*/ print_usage(int, char **);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ zero_brightness();
int main(int argc, char **argv) {
  if (argc != 2) {
    print_usage(argc, argv);
    return 1;
  }
  if (strcmp(argv[1], "up") == 0)
    inc_brightness();
  else if (strcmp(argv[1], "down") == 0)
    dec_brightness();
  else if (strcmp(argv[1], "off") == 0)
    zero_brightness();
  else if (strcmp(argv[1], "print") == 0)
    print_brightness();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1198 <main+0x38>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1251 <main+0xf1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe59(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11c2 <main+0x62>
mov    $0x0,%al
call   1080 <inc_brightness@plt>
jmp    124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ec <main+0x8c>
mov    $0x0,%al
call   1060 <dec_brightness@plt>
jmp    1245 <main+0xe5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1216 <main+0xb6>
mov    $0x0,%al
call   1040 <zero_brightness@plt>
jmp    1240 <main+0xe0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde7(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    123b <main+0xdb>
mov    $0x0,%al
call   1030 <print_brightness@plt>
jmp    1240 <main+0xe0>
jmp    1245 <main+0xe5>
jmp    124a <main+0xea>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    11ca <main+0x6a>
mov    0x8(%rbx),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d9 <main+0x79>
mov    0x8(%rbx),%rdi
lea    0xe7a(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e4 <main+0x84>
mov    0x8(%rbx),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ef <main+0x8f>
mov    0x8(%rbx),%rdi
lea    0xe59(%rip),%rsi
call   1050 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    11f8 <main+0x98>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <print_brightness@plt>
jmp    11f8 <main+0x98>
mov    %rbx,%rsi
call   1070 <print_usage@plt>
mov    $0x1,%ebx
jmp    11f8 <main+0x98>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <inc_brightness@plt>
jmp    11f8 <main+0x98>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <dec_brightness@plt>
jmp    11f8 <main+0x98>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <zero_brightness@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"up\00"
@.str.1 = [5 x i8] c"down\00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [6 x i8] c"print\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @print_usage(i32 %9, i8** %10)
store i32 1, i32* %3
br label %48
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 (...) @inc_brightness()
br label %47
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 (...) @dec_brightness()
br label %46
28: ; preds = %20
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = call i32 (...) @zero_brightness()
br label %45
36: ; preds = %28
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i32 (...) @print_brightness()
br label %44
44: ; preds = %42, %36
br label %45
45: ; preds = %44, %34
br label %46
46: ; preds = %45, %26
br label %47
47: ; preds = %46, %18
store i32 0, i32* %3
br label %48
48: ; preds = %47, %8
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [3 x i8] c"up\00"
@.str.1 = [5 x i8] c"down\00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [6 x i8] c"print\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @print_usage(i32 %0, i8** %1)
br label %31
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 (...) @inc_brightness()
br label %31
13: ; preds = %6
%14 = load i8*, i8** %7
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 (...) @dec_brightness()
br label %31
19: ; preds = %13
%20 = load i8*, i8** %7
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i32 (...) @zero_brightness()
br label %31
25: ; preds = %19
%26 = load i8*, i8** %7
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = tail call i32 (...) @print_brightness()
br label %31
31: ; preds = %11, %23, %29, %25, %17, %4
%32 = phi i32 [ 1, %4 ], [ 0, %17 ], [ 0, %25 ], [ 0, %29 ], [ 0, %23 ], [ 0, %11 ]
ret i32 %32
}