#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*/ change_blacklight(int, int);
int /*<<< orphan*/ decreases_blacklight();
int /*<<< orphan*/ help(char *);
int /*<<< orphan*/ increases_blacklight();
int /*<<< orphan*/ set_backlight_from_stdin();
int /*<<< orphan*/ show_blacklight();
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  int value = -1, value_percent_ok = 0;
  int n;
  for (n = 1; n < argc; n++) {
    if (!strcmp(argv[n], "--help")) {
      help(argv[0]);
      return 0;
    }
    if (!strcmp(argv[n], "--show")) {
      show_blacklight();
      return 0;
    }
    if (!strcmp(argv[n], "--inc")) {
      increases_blacklight();
      return 0;
    }
    if (!strcmp(argv[n], "--dec")) {
      decreases_blacklight();
      return 0;
    }
    if (!strcmp(argv[n], "--stdin")) {
      set_backlight_from_stdin();
      return 0;
    } else if (argv[n][0] != '-') {
      value = atoi(argv[1]);
    } else if (argv[n][0] != '%' && strlen(argv[n]) == 1) {
      value_percent_ok = 1;
    } else {
      help(argv[0]);
      return 0;
    }
  }
  if (argc == 1) {
    help(argv[0]);
    return 0;
  }
  change_blacklight(value, value_percent_ok);
  return 0;
}


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)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1370 <main+0x1e0>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe26(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1200 <main+0x70>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdf4(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1234 <main+0xa4>
mov    $0x0,%al
call   1030 <show_blacklight@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc7(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1268 <main+0xd8>
mov    $0x0,%al
call   1060 <increases_blacklight@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd99(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    129c <main+0x10c>
mov    $0x0,%al
call   1090 <decreases_blacklight@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd6b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12d0 <main+0x140>
mov    $0x0,%al
call   1040 <set_backlight_from_stdin@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     12fd <main+0x16d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    1358 <main+0x1c8>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
je     133b <main+0x1ab>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
cmp    $0x1,%eax
jne    133b <main+0x1ab>
movl   $0x1,-0x18(%rbp)
jmp    1353 <main+0x1c3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
jmp    1358 <main+0x1c8>
jmp    135d <main+0x1cd>
jmp    1362 <main+0x1d2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bb <main+0x2b>
cmpl   $0x1,-0x8(%rbp)
jne    1392 <main+0x202>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a4 <main+0x214>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <change_blacklight@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
cmp    $0x2,%edi
jl     1268 <main+0xd8>
mov    %r14d,%r12d
movl   $0xffffffff,0x4(%rsp)
ff
xor    %ebp,%ebp
mov    $0x1,%r15d
jmp    11da <main+0x4a>
nop
mov    0x8(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,0x4(%rsp)
add    $0x1,%r15
cmp    %r15,%r12
je     1272 <main+0xe2>
mov    (%rbx,%r15,8),%r13
mov    %r13,%rdi
lea    0xe18(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1278 <main+0xe8>
mov    %r13,%rdi
lea    0xe08(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     128f <main+0xff>
mov    %r13,%rdi
lea    0xdf8(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1298 <main+0x108>
mov    %r13,%rdi
lea    0xdeb(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12a1 <main+0x111>
mov    %r13,%rdi
lea    0xdde(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12aa <main+0x11a>
cmpb   $0x2d,0x0(%r13)
jne    11c0 <main+0x30>
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    $0x1,%ebp
cmp    $0x1,%eax
je     11cd <main+0x3d>
jmp    1278 <main+0xe8>
xor    %ebp,%ebp
movl   $0xffffffff,0x4(%rsp)
ff
cmp    $0x1,%r14d
jne    1282 <main+0xf2>
mov    (%rbx),%rdi
call   10a0 <help@plt>
jmp    12b1 <main+0x121>
mov    0x4(%rsp),%edi
mov    %ebp,%esi
call   1070 <change_blacklight@plt>
jmp    12b1 <main+0x121>
xor    %eax,%eax
call   1030 <show_blacklight@plt>
jmp    12b1 <main+0x121>
xor    %eax,%eax
call   1060 <increases_blacklight@plt>
jmp    12b1 <main+0x121>
xor    %eax,%eax
call   1090 <decreases_blacklight@plt>
jmp    12b1 <main+0x121>
xor    %eax,%eax
call   1040 <set_backlight_from_stdin@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [7 x i8] c"--show\00"
@.str.2 = [6 x i8] c"--inc\00"
@.str.3 = [6 x i8] c"--dec\00"
@.str.4 = [8 x i8] c"--stdin\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
store i32 -1, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %9
9: ; preds = %108, %2
%10 = load i32, i32* %8
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %111
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %13
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @help(i8* %24)
store i32 0, i32* %3
br label %123
26: ; preds = %13
%27 = load i8**, i8*** %5
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %26
%35 = call i32 (...) @show_blacklight()
store i32 0, i32* %3
br label %123
36: ; preds = %26
%37 = load i8**, i8*** %5
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %36
%45 = call i32 (...) @increases_blacklight()
store i32 0, i32* %3
br label %123
46: ; preds = %36
%47 = load i8**, i8*** %5
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %46
%55 = call i32 (...) @decreases_blacklight()
store i32 0, i32* %3
br label %123
56: ; preds = %46
%57 = load i8**, i8*** %5
%58 = load i32, i32* %8
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @strcmp(i8* %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %56
%65 = call i32 (...) @set_backlight_from_stdin()
store i32 0, i32* %3
br label %123
66: ; preds = %56
%67 = load i8**, i8*** %5
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = getelementptr inbounds i8, i8* %71, i64 0
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp ne i32 %74, 45
br i1 %75, label %76, label %81
76: ; preds = %66
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 1
%79 = load i8*, i8** %78
%80 = call i32 @atoi(i8* %79)
store i32 %80, i32* %6
br label %106
81: ; preds = %66
%82 = load i8**, i8*** %5
%83 = load i32, i32* %8
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = getelementptr inbounds i8, i8* %86, i64 0
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp ne i32 %89, 37
br i1 %90, label %91, label %100
91: ; preds = %81
%92 = load i8**, i8*** %5
%93 = load i32, i32* %8
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8*, i8** %92, i64 %94
%96 = load i8*, i8** %95
%97 = call i32 @strlen(i8* %96)
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %100
99: ; preds = %91
store i32 1, i32* %7
br label %105
100: ; preds = %91, %81
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 0
%103 = load i8*, i8** %102
%104 = call i32 @help(i8* %103)
store i32 0, i32* %3
br label %123
105: ; preds = %99
br label %106
106: ; preds = %105, %76
br label %107
107: ; preds = %106
br label %108
108: ; preds = %107
%109 = load i32, i32* %8
%110 = add nsw i32 %109, 1
store i32 %110, i32* %8
br label %9
111: ; preds = %9
%112 = load i32, i32* %4
%113 = icmp eq i32 %112, 1
br i1 %113, label %114, label %119
114: ; preds = %111
%115 = load i8**, i8*** %5
%116 = getelementptr inbounds i8*, i8** %115, i64 0
%117 = load i8*, i8** %116
%118 = call i32 @help(i8* %117)
store i32 0, i32* %3
br label %123
119: ; preds = %111
%120 = load i32, i32* %6
%121 = load i32, i32* %7
%122 = call i32 @change_blacklight(i32 %120, i32 %121)
store i32 0, i32* %3
br label %123
123: ; preds = %119, %114, %100, %64, %54, %44, %34, %21
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [7 x i8] c"--show\00"
@.str.2 = [6 x i8] c"--inc\00"
@.str.3 = [6 x i8] c"--dec\00"
@.str.4 = [8 x i8] c"--stdin\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %55
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %4, %50
%8 = phi i64 [ 1, %4 ], [ %53, %50 ]
%9 = phi i32 [ 0, %4 ], [ %52, %50 ]
%10 = phi i32 [ -1, %4 ], [ %51, %50 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %8
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %7
%16 = load i8*, i8** %1
%17 = tail call i32 @help(i8* %16)
br label %64
18: ; preds = %7
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 (...) @show_blacklight()
br label %64
23: ; preds = %18
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 (...) @increases_blacklight()
br label %64
28: ; preds = %23
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = tail call i32 (...) @decreases_blacklight()
br label %64
33: ; preds = %28
%34 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = tail call i32 (...) @set_backlight_from_stdin()
br label %64
38: ; preds = %33
%39 = load i8, i8* %12
%40 = icmp eq i8 %39, 45
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = load i8*, i8** %5
%43 = tail call i32 @atoi(i8* %42)
br label %50
44: ; preds = %38
%45 = tail call i32 @strlen(i8* %12)
%46 = icmp eq i32 %45, 1
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i8*, i8** %1
%49 = tail call i32 @help(i8* %48)
br label %64
50: ; preds = %44, %41
%51 = phi i32 [ %43, %41 ], [ %10, %44 ]
%52 = phi i32 [ %9, %41 ], [ 1, %44 ]
%53 = add nuw nsw i64 %8, 1
%54 = icmp eq i64 %53, %6
br i1 %54, label %55, label %7
55: ; preds = %50, %2
%56 = phi i32 [ -1, %2 ], [ %51, %50 ]
%57 = phi i32 [ 0, %2 ], [ %52, %50 ]
%58 = icmp eq i32 %0, 1
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = load i8*, i8** %1
%61 = tail call i32 @help(i8* %60)
br label %64
62: ; preds = %55
%63 = tail call i32 @change_blacklight(i32 %56, i32 %57)
br label %64
64: ; preds = %62, %59, %47, %36, %31, %26, %21, %15
ret i32 0
}