#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*/ led7_create();
int /*<<< orphan*/ led7_write_digit(int);
int /*<<< orphan*/ timing_configure_systick(int);
int /*<<< orphan*/ timing_delay(int);
int main(void) {
  timing_configure_systick(1000);
  led7_create();
  for (;;) {
    for (int i = 0; i <= 9; ++i) {
      led7_write_digit(i);
      timing_delay(500);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3e8,%edi
call   1030 <timing_configure_systick@plt>
mov    $0x0,%al
call   1050 <led7_create@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     1191 <main+0x51>
mov    -0x8(%rbp),%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <main+0x27>
jmp    1160 <main+0x20>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e8,%edi
call   1030 <timing_configure_systick@plt>
xor    %eax,%eax
call   1050 <led7_create@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x1,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x2,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x3,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x4,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x5,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x6,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x7,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x8,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
mov    $0x9,%edi
call   1040 <led7_write_digit@plt>
mov    $0x1f4,%edi
call   1060 <timing_delay@plt>
jmp    1160 <main+0x20>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @timing_configure_systick(i32 1000)
%2 = tail call i32 (...) @led7_create()
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @led7_write_digit(i32 0)
%5 = tail call i32 @timing_delay(i32 500)
%6 = tail call i32 @led7_write_digit(i32 1)
%7 = tail call i32 @timing_delay(i32 500)
%8 = tail call i32 @led7_write_digit(i32 2)
%9 = tail call i32 @timing_delay(i32 500)
%10 = tail call i32 @led7_write_digit(i32 3)
%11 = tail call i32 @timing_delay(i32 500)
%12 = tail call i32 @led7_write_digit(i32 4)
%13 = tail call i32 @timing_delay(i32 500)
%14 = tail call i32 @led7_write_digit(i32 5)
%15 = tail call i32 @timing_delay(i32 500)
%16 = tail call i32 @led7_write_digit(i32 6)
%17 = tail call i32 @timing_delay(i32 500)
%18 = tail call i32 @led7_write_digit(i32 7)
%19 = tail call i32 @timing_delay(i32 500)
%20 = tail call i32 @led7_write_digit(i32 8)
%21 = tail call i32 @timing_delay(i32 500)
%22 = tail call i32 @led7_write_digit(i32 9)
%23 = tail call i32 @timing_delay(i32 500)
br label %3
}