#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*/ printf(char *, int);
void f(int a[10]) {
  int i = 0;
  for (i = 0; i < 10; i++) {
    a[i] = i;
    printf("%d\n", a[i]);
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1167 <f+0x57>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <f+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,(%rdi)
lea    0xedc(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movl   $0x1,0x4(%rbx)
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movl   $0x2,0x8(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
movl   $0x3,0xc(%rbx)
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
movl   $0x4,0x10(%rbx)
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movl   $0x5,0x14(%rbx)
mov    %r14,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
movl   $0x6,0x18(%rbx)
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
movl   $0x7,0x1c(%rbx)
mov    %r14,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
movl   $0x8,0x20(%rbx)
mov    %r14,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
movl   $0x9,0x24(%rbx)
mov    %r14,%rdi
mov    $0x9,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @f(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
store i32 %8, i32* %12
%13 = load i32*, i32** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %7
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @f(i32* nocapture writeonly %0) {
store i32 0, i32* %0
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = getelementptr inbounds i32, i32* %0, i64 1
store i32 1, i32* %3
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = getelementptr inbounds i32, i32* %0, i64 2
store i32 2, i32* %5
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = getelementptr inbounds i32, i32* %0, i64 3
store i32 3, i32* %7
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = getelementptr inbounds i32, i32* %0, i64 4
store i32 4, i32* %9
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%11 = getelementptr inbounds i32, i32* %0, i64 5
store i32 5, i32* %11
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%13 = getelementptr inbounds i32, i32* %0, i64 6
store i32 6, i32* %13
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%15 = getelementptr inbounds i32, i32* %0, i64 7
store i32 7, i32* %15
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
%17 = getelementptr inbounds i32, i32* %0, i64 8
store i32 8, i32* %17
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%19 = getelementptr inbounds i32, i32* %0, i64 9
store i32 9, i32* %19
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 9)
ret void
}