#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*/ delay(int);
int /*<<< orphan*/ led(int);
int main(void) {
  int i;
  while (1) {
    for (i = 1; i < 5; i++) {
      led(i);
      delay(1);
      led(0);
      delay(1);
    }
    for (i = 1; i < 4; i++) {
      led(i);
      led(i + 1);
      delay(1);
      led(0);
      delay(1);
    }
    for (i = 1; i < 3; i++) {
      led(i);
      led(i + 1);
      led(i + 2);
      delay(1);
      led(0);
      delay(1);
    }
    led(1);
    led(2);
    led(3);
    led(4);
    delay(1);
    led(0);
    delay(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1171 <main+0x51>
mov    -0x8(%rbp),%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11be <main+0x9e>
mov    -0x8(%rbp),%edi
call   1030 <led@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1178 <main+0x58>
movl   $0x1,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1216 <main+0xf6>
mov    -0x8(%rbp),%edi
call   1030 <led@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <led@plt>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c5 <main+0xa5>
mov    $0x1,%edi
call   1030 <led@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x4,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x4,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <led@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x4,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <led@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x4,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <led@plt>
mov    $0x2,%edi
call   1030 <led@plt>
mov    $0x3,%edi
call   1030 <led@plt>
mov    $0x4,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
xor    %edi,%edi
call   1030 <led@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %51
store i32 1, i32* %2
br label %4
4: ; preds = %13, %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @led(i32 %8)
%10 = call i32 @delay(i32 1)
%11 = call i32 @led(i32 0)
%12 = call i32 @delay(i32 1)
br label %13
13: ; preds = %7
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %4
16: ; preds = %4
store i32 1, i32* %2
br label %17
17: ; preds = %29, %16
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i32, i32* %2
%22 = call i32 @led(i32 %21)
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
%25 = call i32 @led(i32 %24)
%26 = call i32 @delay(i32 1)
%27 = call i32 @led(i32 0)
%28 = call i32 @delay(i32 1)
br label %29
29: ; preds = %20
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %17
32: ; preds = %17
store i32 1, i32* %2
br label %33
33: ; preds = %48, %32
%34 = load i32, i32* %2
%35 = icmp slt i32 %34, 3
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32, i32* %2
%38 = call i32 @led(i32 %37)
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
%41 = call i32 @led(i32 %40)
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 2
%44 = call i32 @led(i32 %43)
%45 = call i32 @delay(i32 1)
%46 = call i32 @led(i32 0)
%47 = call i32 @delay(i32 1)
br label %48
48: ; preds = %36
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %33
51: ; preds = %33
%52 = call i32 @led(i32 1)
%53 = call i32 @led(i32 2)
%54 = call i32 @led(i32 3)
%55 = call i32 @led(i32 4)
%56 = call i32 @delay(i32 1)
%57 = call i32 @led(i32 0)
%58 = call i32 @delay(i32 1)
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @led(i32 1)
%3 = tail call i32 @delay(i32 1)
%4 = tail call i32 @led(i32 0)
%5 = tail call i32 @delay(i32 1)
%6 = tail call i32 @led(i32 2)
%7 = tail call i32 @delay(i32 1)
%8 = tail call i32 @led(i32 0)
%9 = tail call i32 @delay(i32 1)
%10 = tail call i32 @led(i32 3)
%11 = tail call i32 @delay(i32 1)
%12 = tail call i32 @led(i32 0)
%13 = tail call i32 @delay(i32 1)
%14 = tail call i32 @led(i32 4)
%15 = tail call i32 @delay(i32 1)
%16 = tail call i32 @led(i32 0)
%17 = tail call i32 @delay(i32 1)
%18 = tail call i32 @led(i32 1)
%19 = tail call i32 @led(i32 2)
%20 = tail call i32 @delay(i32 1)
%21 = tail call i32 @led(i32 0)
%22 = tail call i32 @delay(i32 1)
%23 = tail call i32 @led(i32 2)
%24 = tail call i32 @led(i32 3)
%25 = tail call i32 @delay(i32 1)
%26 = tail call i32 @led(i32 0)
%27 = tail call i32 @delay(i32 1)
%28 = tail call i32 @led(i32 3)
%29 = tail call i32 @led(i32 4)
%30 = tail call i32 @delay(i32 1)
%31 = tail call i32 @led(i32 0)
%32 = tail call i32 @delay(i32 1)
%33 = tail call i32 @led(i32 1)
%34 = tail call i32 @led(i32 2)
%35 = tail call i32 @led(i32 3)
%36 = tail call i32 @delay(i32 1)
%37 = tail call i32 @led(i32 0)
%38 = tail call i32 @delay(i32 1)
%39 = tail call i32 @led(i32 2)
%40 = tail call i32 @led(i32 3)
%41 = tail call i32 @led(i32 4)
%42 = tail call i32 @delay(i32 1)
%43 = tail call i32 @led(i32 0)
%44 = tail call i32 @delay(i32 1)
%45 = tail call i32 @led(i32 1)
%46 = tail call i32 @led(i32 2)
%47 = tail call i32 @led(i32 3)
%48 = tail call i32 @led(i32 4)
%49 = tail call i32 @delay(i32 1)
%50 = tail call i32 @led(i32 0)
%51 = tail call i32 @delay(i32 1)
br label %1
}