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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x10,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    115c <main+0x3c>
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1136 <main+0x16>
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1030 <f@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    119b <main+0x7b>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116f <main+0x4f>
mov    -0x28(%rbp),%esi
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x8,0x10(%rsp)
mov    %rsp,%rdi
mov    $0x10,%esi
call   1030 <f@plt>
mov    (%rsp),%esi
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

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

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