#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*/ decrease_brightness();
int get_brightness(int /*<<< orphan*/);
int /*<<< orphan*/ increase_brightness();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    usage(argv[0]);
  } else if (!(strncmp(argv[1], "-c", 2))) {
    printf("Current setting: %d\n", get_brightness(0));
  } else if (!(strncmp(argv[1], "-i", 2))) {
    increase_brightness();
  } else if (!(strncmp(argv[1], "-d", 2))) {
    decrease_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)
jge    1191 <main+0x31>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <usage@plt>
jmp    1233 <main+0xd3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe60(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    11cd <main+0x6d>
xor    %edi,%edi
call   1080 <get_brightness@plt>
mov    %eax,%esi
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
jmp    122e <main+0xce>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3c(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    11fb <main+0x9b>
mov    $0x0,%al
call   1030 <increase_brightness@plt>
jmp    1229 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe11(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1224 <main+0xc4>
mov    $0x0,%al
call   1060 <decrease_brightness@plt>
jmp    1229 <main+0xc9>
jmp    122e <main+0xce>
jmp    1233 <main+0xd3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1173 <main+0x13>
mov    (%rbx),%rdi
call   1070 <usage@plt>
jmp    11e5 <main+0x85>
mov    0x8(%rbx),%rdi
lea    0xe82(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     11c7 <main+0x67>
mov    0x8(%rbx),%rdi
lea    0xe81(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     11de <main+0x7e>
mov    0x8(%rbx),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    11e5 <main+0x85>
xor    %eax,%eax
call   1060 <decrease_brightness@plt>
jmp    11e5 <main+0x85>
xor    %edi,%edi
call   1080 <get_brightness@plt>
lea    0xe2e(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
jmp    11e5 <main+0x85>
xor    %eax,%eax
call   1030 <increase_brightness@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-c\00"
@.str.1 = [21 x i8] c"Current setting: %d\0A\00"
@.str.2 = [3 x i8] c"-i\00"
@.str.3 = [3 x i8] c"-d\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 slt i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @usage(i8* %11)
br label %41
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %13
%20 = call i32 @get_brightness(i32 0)
%21 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %40
22: ; preds = %13
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strncmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %22
%29 = call i32 (...) @increase_brightness()
br label %39
30: ; preds = %22
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @strncmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%35 = icmp ne i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %30
%37 = call i32 (...) @decrease_brightness()
br label %38
38: ; preds = %36, %30
br label %39
39: ; preds = %38, %28
br label %40
40: ; preds = %39, %19
br label %41
41: ; preds = %40, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-c\00"
@.str.1 = [21 x i8] c"Current setting: %d\0A\00"
@.str.2 = [3 x i8] c"-i\00"
@.str.3 = [3 x i8] c"-d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %27
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @get_brightness(i32 0)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %27
15: ; preds = %7
%16 = load i8*, i8** %8
%17 = tail call i32 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 (...) @increase_brightness()
br label %27
21: ; preds = %15
%22 = load i8*, i8** %8
%23 = tail call i32 @strncmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 (...) @decrease_brightness()
br label %27
27: ; preds = %12, %21, %25, %19, %4
ret i32 0
}