#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*/ LED_set(int);
void LED_blink(unsigned int led) {
  volatile int i, j;
  for (i = 0; i < 5; i++) {
    LED_set((1 << led) & 0x7);
    for (j = 0; j < 200000; j++)
      ;
    LED_set(0);
    for (j = 0; j < 200000; j++)
      ;
  }
}


x86 assembly (clang, -O0):
<LED_blink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x5,%eax
jge    11aa <LED_blink+0x9a>
mov    -0x4(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
and    $0x7,%edi
call   1030 <LED_set@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x30d40,%eax
jge    1168 <LED_blink+0x58>
jmp    115a <LED_blink+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <LED_blink+0x37>
xor    %edi,%edi
call   1030 <LED_set@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x30d40,%eax
jge    1197 <LED_blink+0x87>
jmp    1189 <LED_blink+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <LED_blink+0x66>
jmp    119c <LED_blink+0x8c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <LED_blink+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LED_blink>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    0xc(%rsp),%eax
cmp    $0x4,%eax
jg     11b2 <LED_blink+0xa2>
mov    $0x1,%ebx
mov    %edi,%ecx
shl    %cl,%ebx
and    $0x7,%ebx
jmp    114e <LED_blink+0x3e>
nopl   0x0(%rax,%rax,1)
addl   $0x1,0xc(%rsp)
mov    0xc(%rsp),%eax
cmp    $0x5,%eax
jge    11b2 <LED_blink+0xa2>
mov    %ebx,%edi
call   1030 <LED_set@plt>
movl   $0x0,0x8(%rsp)
mov    0x8(%rsp),%eax
cmp    $0x30d3f,%eax
jg     1180 <LED_blink+0x70>
nopl   0x0(%rax,%rax,1)
addl   $0x1,0x8(%rsp)
mov    0x8(%rsp),%eax
cmp    $0x30d40,%eax
jl     1170 <LED_blink+0x60>
xor    %edi,%edi
call   1030 <LED_set@plt>
movl   $0x0,0x8(%rsp)
mov    0x8(%rsp),%eax
cmp    $0x30d3f,%eax
jg     1140 <LED_blink+0x30>
nopw   0x0(%rax,%rax,1)
addl   $0x1,0x8(%rsp)
mov    0x8(%rsp),%eax
cmp    $0x30d40,%eax
jl     11a0 <LED_blink+0x90>
jmp    1140 <LED_blink+0x30>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @LED_blink(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store volatile i32 0, i32* %3
br label %5
5: ; preds = %30, %1
%6 = load volatile i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %33
8: ; preds = %5
%9 = load i32, i32* %2
%10 = shl i32 1, %9
%11 = and i32 %10, 7
%12 = call i32 @LED_set(i32 %11)
store volatile i32 0, i32* %4
br label %13
13: ; preds = %17, %8
%14 = load volatile i32, i32* %4
%15 = icmp slt i32 %14, 200000
br i1 %15, label %16, label %20
16: ; preds = %13
br label %17
17: ; preds = %16
%18 = load volatile i32, i32* %4
%19 = add nsw i32 %18, 1
store volatile i32 %19, i32* %4
br label %13
20: ; preds = %13
%21 = call i32 @LED_set(i32 0)
store volatile i32 0, i32* %4
br label %22
22: ; preds = %26, %20
%23 = load volatile i32, i32* %4
%24 = icmp slt i32 %23, 200000
br i1 %24, label %25, label %29
25: ; preds = %22
br label %26
26: ; preds = %25
%27 = load volatile i32, i32* %4
%28 = add nsw i32 %27, 1
store volatile i32 %28, i32* %4
br label %22
29: ; preds = %22
br label %30
30: ; preds = %29
%31 = load volatile i32, i32* %3
%32 = add nsw i32 %31, 1
store volatile i32 %32, i32* %3
br label %5
33: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @LED_blink(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store volatile i32 0, i32* %2
%6 = load volatile i32, i32* %2
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %34
8: ; preds = %1
%9 = shl nuw i32 1, %0
%10 = and i32 %9, 7
br label %11
11: ; preds = %8, %29
%12 = tail call i32 @LED_set(i32 %10)
store volatile i32 0, i32* %3
%13 = load volatile i32, i32* %3
%14 = icmp slt i32 %13, 200000
br i1 %14, label %15, label %20
15: ; preds = %11, %15
%16 = load volatile i32, i32* %3
%17 = add nsw i32 %16, 1
store volatile i32 %17, i32* %3
%18 = load volatile i32, i32* %3
%19 = icmp slt i32 %18, 200000
br i1 %19, label %15, label %20
20: ; preds = %15, %11
%21 = tail call i32 @LED_set(i32 0)
store volatile i32 0, i32* %3
%22 = load volatile i32, i32* %3
%23 = icmp slt i32 %22, 200000
br i1 %23, label %24, label %29
24: ; preds = %20, %24
%25 = load volatile i32, i32* %3
%26 = add nsw i32 %25, 1
store volatile i32 %26, i32* %3
%27 = load volatile i32, i32* %3
%28 = icmp slt i32 %27, 200000
br i1 %28, label %24, label %29
29: ; preds = %24, %20
%30 = load volatile i32, i32* %2
%31 = add nsw i32 %30, 1
store volatile i32 %31, i32* %2
%32 = load volatile i32, i32* %2
%33 = icmp slt i32 %32, 5
br i1 %33, label %11, label %34
34: ; preds = %29, %1
ret void
}