#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_off();
int /*<<< orphan*/ led_on();
void led_blink(void) {
  int i = 0;
  int waiting = 0;
  for (i = 0; i < 10; i++) {
    led_on();
    for (waiting = 0; waiting < 1000; waiting++)
      ;
    led_off();
    for (waiting = 0; waiting < 1000; waiting++)
      ;
  }
}


x86 assembly (clang, -O0):
<led_blink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11b6 <led_blink+0x96>
mov    $0x0,%al
call   1040 <led_on@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1175 <led_blink+0x55>
jmp    1167 <led_blink+0x47>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <led_blink+0x35>
mov    $0x0,%al
call   1030 <led_off@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11a3 <led_blink+0x83>
jmp    1195 <led_blink+0x75>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1183 <led_blink+0x63>
jmp    11a8 <led_blink+0x88>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <led_blink+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_blink>:
push   %rax
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
xor    %eax,%eax
call   1040 <led_on@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <led_off@plt>

LLVM IR (-O0):
define void @led_blink() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %1
br label %3
3: ; preds = %25, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %28
6: ; preds = %3
%7 = call i32 (...) @led_on()
store i32 0, i32* %2
br label %8
8: ; preds = %12, %6
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 1000
br i1 %10, label %11, label %15
11: ; preds = %8
br label %12
12: ; preds = %11
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %8
15: ; preds = %8
%16 = call i32 (...) @led_off()
store i32 0, i32* %2
br label %17
17: ; preds = %21, %15
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 1000
br i1 %19, label %20, label %24
20: ; preds = %17
br label %21
21: ; preds = %20
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %17
24: ; preds = %17
br label %25
25: ; preds = %24
%26 = load i32, i32* %1
%27 = add nsw i32 %26, 1
store i32 %27, i32* %1
br label %3
28: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @led_blink() {
%1 = tail call i32 (...) @led_on()
%2 = tail call i32 (...) @led_off()
%3 = tail call i32 (...) @led_on()
%4 = tail call i32 (...) @led_off()
%5 = tail call i32 (...) @led_on()
%6 = tail call i32 (...) @led_off()
%7 = tail call i32 (...) @led_on()
%8 = tail call i32 (...) @led_off()
%9 = tail call i32 (...) @led_on()
%10 = tail call i32 (...) @led_off()
%11 = tail call i32 (...) @led_on()
%12 = tail call i32 (...) @led_off()
%13 = tail call i32 (...) @led_on()
%14 = tail call i32 (...) @led_off()
%15 = tail call i32 (...) @led_on()
%16 = tail call i32 (...) @led_off()
%17 = tail call i32 (...) @led_on()
%18 = tail call i32 (...) @led_off()
%19 = tail call i32 (...) @led_on()
%20 = tail call i32 (...) @led_off()
ret void
}