#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 */
scalar_t__ key_1();
scalar_t__ key_2();
scalar_t__ key_3();
scalar_t__ key_4();
int /*<<< orphan*/ key_init();
int /*<<< orphan*/ leds_OFF(int);
int /*<<< orphan*/ leds_OFF_all();
int /*<<< orphan*/ leds_ON(int);
int /*<<< orphan*/ leds_init();
int main() {
  leds_init();
  key_init();
  leds_OFF_all();
  while (1) {
    if (key_1())
      leds_OFF(1);
    else
      leds_ON(1);
    if (key_2())
      leds_OFF(2);
    else
      leds_ON(2);
    if (key_3())
      leds_OFF(3);
    else
      leds_ON(3);
    if (key_4())
      leds_OFF(4);
    else
      leds_ON(4);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <leds_init@plt>
mov    $0x0,%al
call   1040 <key_init@plt>
mov    $0x0,%al
call   1080 <leds_OFF_all@plt>
mov    $0x0,%al
call   10a0 <key_1@plt>
cmp    $0x0,%rax
je     11d4 <main+0x44>
mov    $0x1,%edi
call   10b0 <leds_OFF@plt>
jmp    11de <main+0x4e>
mov    $0x1,%edi
call   1030 <leds_ON@plt>
mov    $0x0,%al
call   1060 <key_2@plt>
cmp    $0x0,%rax
je     11fe <main+0x6e>
mov    $0x2,%edi
call   10b0 <leds_OFF@plt>
jmp    1208 <main+0x78>
mov    $0x2,%edi
call   1030 <leds_ON@plt>
mov    $0x0,%al
call   1090 <key_3@plt>
cmp    $0x0,%rax
je     1228 <main+0x98>
mov    $0x3,%edi
call   10b0 <leds_OFF@plt>
jmp    1232 <main+0xa2>
mov    $0x3,%edi
call   1030 <leds_ON@plt>
mov    $0x0,%al
call   1050 <key_4@plt>
cmp    $0x0,%rax
je     1252 <main+0xc2>
mov    $0x4,%edi
call   10b0 <leds_OFF@plt>
jmp    125c <main+0xcc>
mov    $0x4,%edi
call   1030 <leds_ON@plt>
jmp    11b4 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <leds_init@plt>
xor    %eax,%eax
call   1040 <key_init@plt>
xor    %eax,%eax
call   1080 <leds_OFF_all@plt>
jmp    11b5 <main+0x25>
nopl   0x0(%rax,%rax,1)
call   10b0 <leds_OFF@plt>
xor    %eax,%eax
call   10a0 <key_1@plt>
mov    $0x1,%edi
test   %rax,%rax
je     11d0 <main+0x40>
call   10b0 <leds_OFF@plt>
jmp    11d5 <main+0x45>
nopl   (%rax)
call   1030 <leds_ON@plt>
xor    %eax,%eax
call   1060 <key_2@plt>
mov    $0x2,%edi
test   %rax,%rax
je     11f0 <main+0x60>
call   10b0 <leds_OFF@plt>
jmp    11f5 <main+0x65>
nopl   (%rax)
call   1030 <leds_ON@plt>
xor    %eax,%eax
call   1090 <key_3@plt>
mov    $0x3,%edi
test   %rax,%rax
je     1210 <main+0x80>
call   10b0 <leds_OFF@plt>
jmp    1215 <main+0x85>
nopl   (%rax)
call   1030 <leds_ON@plt>
xor    %eax,%eax
call   1050 <key_4@plt>
mov    $0x4,%edi
test   %rax,%rax
jne    11b0 <main+0x20>
call   1030 <leds_ON@plt>
jmp    11b5 <main+0x25>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @leds_init()
%3 = call i32 (...) @key_init()
%4 = call i32 (...) @leds_OFF_all()
br label %5
5: ; preds = %0, %33
%6 = call i64 (...) @key_1()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @leds_OFF(i32 1)
br label %12
10: ; preds = %5
%11 = call i32 @leds_ON(i32 1)
br label %12
12: ; preds = %10, %8
%13 = call i64 (...) @key_2()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @leds_OFF(i32 2)
br label %19
17: ; preds = %12
%18 = call i32 @leds_ON(i32 2)
br label %19
19: ; preds = %17, %15
%20 = call i64 (...) @key_3()
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @leds_OFF(i32 3)
br label %26
24: ; preds = %19
%25 = call i32 @leds_ON(i32 3)
br label %26
26: ; preds = %24, %22
%27 = call i64 (...) @key_4()
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @leds_OFF(i32 4)
br label %33
31: ; preds = %26
%32 = call i32 @leds_ON(i32 4)
br label %33
33: ; preds = %31, %29
br label %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @leds_init()
%2 = tail call i32 (...) @key_init()
%3 = tail call i32 (...) @leds_OFF_all()
br label %4
4: ; preds = %32, %0
%5 = tail call i64 (...) @key_1()
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @leds_OFF(i32 1)
br label %11
9: ; preds = %4
%10 = tail call i32 @leds_ON(i32 1)
br label %11
11: ; preds = %9, %7
%12 = tail call i64 (...) @key_2()
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @leds_OFF(i32 2)
br label %18
16: ; preds = %11
%17 = tail call i32 @leds_ON(i32 2)
br label %18
18: ; preds = %16, %14
%19 = tail call i64 (...) @key_3()
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @leds_OFF(i32 3)
br label %25
23: ; preds = %18
%24 = tail call i32 @leds_ON(i32 3)
br label %25
25: ; preds = %23, %21
%26 = tail call i64 (...) @key_4()
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 @leds_OFF(i32 4)
br label %32
30: ; preds = %25
%31 = tail call i32 @leds_ON(i32 4)
br label %32
32: ; preds = %30, %28
br label %4
}