#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*/ printf(char *, char *);
int /*<<< orphan*/ writeToFile(char *, char *);
int main(int argc, char **argv) {
  if (argc == 2 && (argv[1][0] == '0' || argv[1][0] == '1')) {
    writeToFile("/sys/class/leds/led0/trigger", "none");
    if (argv[1][0] == '1')
      writeToFile("/sys/class/leds/led0/brightness", "1");
    else if (argv[1][0] == '0')
      writeToFile("/sys/class/leds/led0/brightness", "0");
  } else
    printf("Usage: %s [0|1]\n", argv[0]);
  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)
jne    11d8 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
je     1168 <main+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jne    11d8 <main+0xb8>
lea    0xe91(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1030 <writeToFile@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jne    11a7 <main+0x87>
lea    0xe8c(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1030 <writeToFile@plt>
jmp    11d3 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11ce <main+0xae>
lea    0xe60(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1030 <writeToFile@plt>
jmp    11d3 <main+0xb3>
jmp    11eb <main+0xcb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    116b <main+0x4b>
mov    0x8(%rbx),%rax
mov    (%rax),%al
and    $0xfe,%al
cmp    $0x30,%al
jne    116b <main+0x4b>
lea    0xec4(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1030 <writeToFile@plt>
mov    0x8(%rbx),%rax
mov    (%rax),%al
cmp    $0x30,%al
je     117e <main+0x5e>
cmp    $0x31,%al
jne    117a <main+0x5a>
lea    0xec5(%rip),%rdi
lea    0xede(%rip),%rsi
call   1030 <writeToFile@plt>
jmp    117a <main+0x5a>
mov    (%rbx),%rsi
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe9d(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <writeToFile@plt>
jmp    117a <main+0x5a>

LLVM IR (-O0):
@.str = [29 x i8] c"/sys/class/leds/led0/trigger\00"
@.str.1 = [5 x i8] c"none\00"
@.str.2 = [32 x i8] c"/sys/class/leds/led0/brightness\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [17 x i8] c"Usage: %s [0|1]\0A\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 eq i32 %6, 2
br i1 %7, label %8, label %47
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 48
br i1 %15, label %24, label %16
16: ; preds = %8
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 49
br i1 %23, label %24, label %47
24: ; preds = %16, %8
%25 = call i32 @writeToFile(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 49
br i1 %32, label %33, label %35
33: ; preds = %24
%34 = call i32 @writeToFile(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %46
35: ; preds = %24
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 48
br i1 %42, label %43, label %45
43: ; preds = %35
%44 = call i32 @writeToFile(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %43, %35
br label %46
46: ; preds = %45, %33
br label %52
47: ; preds = %16, %2
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %47, %46
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"/sys/class/leds/led0/trigger\00"
@.str.1 = [5 x i8] c"none\00"
@.str.2 = [32 x i8] c"/sys/class/leds/led0/brightness\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [17 x i8] c"Usage: %s [0|1]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = and i8 %7, -2
%9 = icmp eq i8 %8, 48
br i1 %9, label %10, label %18
10: ; preds = %4
%11 = tail call i32 @writeToFile(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
switch i8 %13, label %21 [
i8 49, label %14
i8 48, label %16
]
14: ; preds = %10
%15 = tail call i32 @writeToFile(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %21
16: ; preds = %10
%17 = tail call i32 @writeToFile(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %21
18: ; preds = %4, %2
%19 = load i8*, i8** %1
%20 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %10, %14, %16, %18
ret i32 0
}