#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();
scalar_t__ isdigit(char);
int /*<<< orphan*/ set_backlight_from_stdin();
int /*<<< orphan*/ show_blacklight();
int /*<<< orphan*/ strcmp(char *, 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 (!strcmp(argv[n], "%")) {
      value_percent_ok = 1;
    } else if (isdigit(argv[n][0])) {
      value = atoi(argv[n]);
    } 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    1369 <main+0x1d9>
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    139d <main+0x20d>
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    139d <main+0x20d>
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    139d <main+0x20d>
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    139d <main+0x20d>
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   1050 <set_backlight_from_stdin@plt>
movl   $0x0,-0x4(%rbp)
jmp    139d <main+0x20d>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd3f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12fd <main+0x16d>
movl   $0x1,-0x18(%rbp)
jmp    1351 <main+0x1c1>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     1334 <main+0x1a4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    134c <main+0x1bc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    139d <main+0x20d>
jmp    1351 <main+0x1c1>
jmp    1356 <main+0x1c6>
jmp    135b <main+0x1cb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bb <main+0x2b>
cmpl   $0x1,-0x8(%rbp)
jne    138b <main+0x1fb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    139d <main+0x20d>
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,%ebp
cmp    $0x2,%edi
jl     128f <main+0xff>
mov    %ebp,%r15d
mov    $0xffffffff,%r13d
movl   $0x0,0x4(%rsp)
mov    $0x1,%r14d
jmp    11e5 <main+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x1,0x4(%rsp)
add    $0x1,%r14
cmp    %r14,%r15
je     129d <main+0x10d>
mov    (%rbx,%r14,8),%r12
mov    %r12,%rdi
lea    0xe0d(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12a2 <main+0x112>
mov    %r12,%rdi
lea    0xdfd(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12ba <main+0x12a>
mov    %r12,%rdi
lea    0xded(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12c3 <main+0x133>
mov    %r12,%rdi
lea    0xddc(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12cc <main+0x13c>
mov    %r12,%rdi
lea    0xdcb(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12d5 <main+0x145>
mov    %r12,%rdi
lea    0xdc0(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     11d0 <main+0x40>
movsbl (%r12),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     12a2 <main+0x112>
mov    (%rbx,%r14,8),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r13d
jmp    11d8 <main+0x48>
movl   $0x0,0x4(%rsp)
mov    $0xffffffff,%r13d
cmp    $0x1,%ebp
jne    12ac <main+0x11c>
mov    (%rbx),%rdi
call   10a0 <help@plt>
jmp    12dc <main+0x14c>
mov    %r13d,%edi
mov    0x4(%rsp),%esi
call   1070 <change_blacklight@plt>
jmp    12dc <main+0x14c>
xor    %eax,%eax
call   1030 <show_blacklight@plt>
jmp    12dc <main+0x14c>
xor    %eax,%eax
call   1060 <increases_blacklight@plt>
jmp    12dc <main+0x14c>
xor    %eax,%eax
call   1090 <decreases_blacklight@plt>
jmp    12dc <main+0x14c>
xor    %eax,%eax
call   1050 <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"
@.str.5 = [2 x i8] c"%\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 = %100, %2
%10 = load i32, i32* %8
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %103
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 %115
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 %115
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 %115
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 %115
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 %115
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 = call i32 @strcmp(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%73 = icmp ne i32 %72, 0
br i1 %73, label %75, label %74
74: ; preds = %66
store i32 1, i32* %7
br label %98
75: ; preds = %66
%76 = load i8**, i8*** %5
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
%81 = getelementptr inbounds i8, i8* %80, i64 0
%82 = load i8, i8* %81
%83 = call i64 @isdigit(i8 signext %82)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %92
85: ; preds = %75
%86 = load i8**, i8*** %5
%87 = load i32, i32* %8
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @atoi(i8* %90)
store i32 %91, i32* %6
br label %97
92: ; preds = %75
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 0
%95 = load i8*, i8** %94
%96 = call i32 @help(i8* %95)
store i32 0, i32* %3
br label %115
97: ; preds = %85
br label %98
98: ; preds = %97, %74
br label %99
99: ; preds = %98
br label %100
100: ; preds = %99
%101 = load i32, i32* %8
%102 = add nsw i32 %101, 1
store i32 %102, i32* %8
br label %9
103: ; preds = %9
%104 = load i32, i32* %4
%105 = icmp eq i32 %104, 1
br i1 %105, label %106, label %111
106: ; preds = %103
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 0
%109 = load i8*, i8** %108
%110 = call i32 @help(i8* %109)
store i32 0, i32* %3
br label %115
111: ; preds = %103
%112 = load i32, i32* %6
%113 = load i32, i32* %7
%114 = call i32 @change_blacklight(i32 %112, i32 %113)
store i32 0, i32* %3
br label %115
115: ; preds = %111, %106, %92, %64, %54, %44, %34, %21
%116 = load i32, i32* %3
ret i32 %116
}

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"
@.str.5 = [2 x i8] c"%\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 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %50
%7 = phi i64 [ 1, %4 ], [ %53, %50 ]
%8 = phi i32 [ 0, %4 ], [ %52, %50 ]
%9 = phi i32 [ -1, %4 ], [ %51, %50 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %7
%11 = load i8*, i8** %10
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = load i8*, i8** %1
%16 = tail call i32 @help(i8* %15)
br label %64
17: ; preds = %6
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 (...) @show_blacklight()
br label %64
22: ; preds = %17
%23 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 (...) @increases_blacklight()
br label %64
27: ; preds = %22
%28 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = tail call i32 (...) @decreases_blacklight()
br label %64
32: ; preds = %27
%33 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = tail call i32 (...) @set_backlight_from_stdin()
br label %64
37: ; preds = %32
%38 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %50, label %40
40: ; preds = %37
%41 = load i8, i8* %11
%42 = tail call i64 @isdigit(i8 signext %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %40
%45 = load i8*, i8** %10
%46 = tail call i32 @atoi(i8* %45)
br label %50
47: ; preds = %40
%48 = load i8*, i8** %1
%49 = tail call i32 @help(i8* %48)
br label %64
50: ; preds = %37, %44
%51 = phi i32 [ %46, %44 ], [ %9, %37 ]
%52 = phi i32 [ %8, %44 ], [ 1, %37 ]
%53 = add nuw nsw i64 %7, 1
%54 = icmp eq i64 %53, %5
br i1 %54, label %55, label %6
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, %35, %30, %25, %20, %14
ret i32 0
}