#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 i;
int /*<<< orphan*/ sleep(int);
int main(void) {
  static char *mesg[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
  int display(char *), i;
  for (i = 0; i < 10; ++i)
    display(mesg[i]);
  sleep(2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1162 <main+0x42>
movslq -0x8(%rbp),%rcx
lea    0x2ef5(%rip),%rax
mov    (%rax,%rcx,8),%rdi
call   1030 <display@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    $0x2,%edi
call   1040 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <display@plt>
lea    0xece(%rip),%rdi
call   1030 <display@plt>
lea    0xec4(%rip),%rdi
call   1030 <display@plt>
lea    0xeba(%rip),%rdi
call   1030 <display@plt>
lea    0xeb0(%rip),%rdi
call   1030 <display@plt>
lea    0xea6(%rip),%rdi
call   1030 <display@plt>
lea    0xe9c(%rip),%rdi
call   1030 <display@plt>
lea    0xe92(%rip),%rdi
call   1030 <display@plt>
lea    0xe88(%rip),%rdi
call   1030 <display@plt>
lea    0xe7e(%rip),%rdi
call   1030 <display@plt>
mov    $0x2,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@main.mesg = internal global [10 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0)]
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"6\00"
@.str.7 = [2 x i8] c"7\00"
@.str.8 = [2 x i8] c"8\00"
@.str.9 = [2 x i8] c"9\00"
@i = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [10 x i8*], [10 x i8*]* @main.mesg, i64 0, i64 %8
%10 = load i8*, i8** %9
%11 = call i32 @display(i8* %10)
br label %12
12: ; preds = %6
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %3
15: ; preds = %3
%16 = call i32 @sleep(i32 2)
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"6\00"
@.str.7 = [2 x i8] c"7\00"
@.str.8 = [2 x i8] c"8\00"
@.str.9 = [2 x i8] c"9\00"
@i = global i32 0
define i32 @main() {
%1 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%10 = tail call i32 @display(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%11 = tail call i32 @sleep(i32 2)
ret i32 0
}