#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 check_button();
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int button_status;
  while (1) {
    button_status = check_button();
    if (button_status == 1) {
      system("echo 0 > /sys/class/leds/wifi\:led/brightness");
    } else if (button_status == 2) {
      system("echo 1 > /sys/class/leds/wifi\:led/brightness");
    }
    usleep(100000);
  }
}


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)
mov    $0x0,%al
call   1040 <check_button@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    116b <main+0x3b>
lea    0xe9f(%rip),%rdi
call   1030 <system@plt>
jmp    1186 <main+0x56>
cmpl   $0x2,-0x14(%rbp)
jne    1181 <main+0x51>
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
jmp    1186 <main+0x56>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rbx
lea    0xeeb(%rip),%r14
jmp    115f <main+0x2f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <system@plt>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
xor    %eax,%eax
call   1040 <check_button@plt>
mov    %rbx,%rdi
cmp    $0x1,%eax
je     1150 <main+0x20>
cmp    $0x2,%eax
jne    1155 <main+0x25>
mov    %r14,%rdi
jmp    1150 <main+0x20>

LLVM IR (-O0):
@.str = [45 x i8] c"echo 0 > /sys/class/leds/wifi:led/brightness\00"
@.str.1 = [45 x i8] c"echo 1 > /sys/class/leds/wifi:led/brightness\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %2, %19
%8 = call i32 (...) @check_button()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @system(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %19
13: ; preds = %7
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @system(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
br label %19
19: ; preds = %18, %11
%20 = call i32 @usleep(i32 100000)
br label %7
}

LLVM IR (-O2):
@.str = [45 x i8] c"echo 0 > /sys/class/leds/wifi:led/brightness\00"
@.str.1 = [45 x i8] c"echo 1 > /sys/class/leds/wifi:led/brightness\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %9, %2
%4 = tail call i32 (...) @check_button()
switch i32 %4, label %9 [
i32 1, label %6
i32 2, label %5
]
5: ; preds = %3
br label %6
6: ; preds = %3, %5
%7 = phi i8* [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), %3 ]
%8 = tail call i32 @system(i8* %7)
br label %9
9: ; preds = %6, %3
%10 = tail call i32 @usleep(i32 100000)
br label %3
}