#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*/ busy_wait();
int /*<<< orphan*/ led_init();
int /*<<< orphan*/ led_out(int);
int main(void) {
  led_init();
  for (;;) {
    int i;
    for (i = 0x00000000; i < 0x00000010; i++) {
      led_out(i);
      busy_wait();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <led_init@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    1174 <main+0x44>
mov    -0x8(%rbp),%edi
call   1050 <led_out@plt>
mov    $0x0,%al
call   1030 <busy_wait@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <led_init@plt>
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x1,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x2,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x3,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x4,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x5,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x6,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x7,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x8,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0x9,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0xa,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0xb,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0xc,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0xd,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0xe,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
mov    $0xf,%edi
call   1050 <led_out@plt>
xor    %eax,%eax
call   1030 <busy_wait@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @led_init()
br label %4
4: ; preds = %15, %0
store i32 0, i32* %2
br label %5
5: ; preds = %12, %4
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %2
%10 = call i32 @led_out(i32 %9)
%11 = call i32 (...) @busy_wait()
br label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %5
15: ; preds = %5
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @led_init()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 @led_out(i32 0)
%4 = tail call i32 (...) @busy_wait()
%5 = tail call i32 @led_out(i32 1)
%6 = tail call i32 (...) @busy_wait()
%7 = tail call i32 @led_out(i32 2)
%8 = tail call i32 (...) @busy_wait()
%9 = tail call i32 @led_out(i32 3)
%10 = tail call i32 (...) @busy_wait()
%11 = tail call i32 @led_out(i32 4)
%12 = tail call i32 (...) @busy_wait()
%13 = tail call i32 @led_out(i32 5)
%14 = tail call i32 (...) @busy_wait()
%15 = tail call i32 @led_out(i32 6)
%16 = tail call i32 (...) @busy_wait()
%17 = tail call i32 @led_out(i32 7)
%18 = tail call i32 (...) @busy_wait()
%19 = tail call i32 @led_out(i32 8)
%20 = tail call i32 (...) @busy_wait()
%21 = tail call i32 @led_out(i32 9)
%22 = tail call i32 (...) @busy_wait()
%23 = tail call i32 @led_out(i32 10)
%24 = tail call i32 (...) @busy_wait()
%25 = tail call i32 @led_out(i32 11)
%26 = tail call i32 (...) @busy_wait()
%27 = tail call i32 @led_out(i32 12)
%28 = tail call i32 (...) @busy_wait()
%29 = tail call i32 @led_out(i32 13)
%30 = tail call i32 (...) @busy_wait()
%31 = tail call i32 @led_out(i32 14)
%32 = tail call i32 (...) @busy_wait()
%33 = tail call i32 @led_out(i32 15)
%34 = tail call i32 (...) @busy_wait()
br label %2
}