#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, int);
main() {
  static int a[5] = {2, 4, 6, 8, 10};
  int i, b = 5;
  for (i = 0; i < 5; i++) {
    f(a[i], &b);
    printf("%d %d\n", a[i], b);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1189 <main+0x69>
movslq -0x8(%rbp),%rcx
lea    0x2eee(%rip),%rax
mov    (%rax,%rcx,4),%edi
lea    -0xc(%rbp),%rsi
call   1030 <f@plt>
movslq -0x8(%rbp),%rcx
lea    0x2ed7(%rip),%rax
mov    (%rax,%rcx,4),%esi
mov    -0xc(%rbp),%edx
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x5,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    $0x2,%edi
mov    %r14,%rsi
call   1030 <f@plt>
mov    0x4(%rsp),%edx
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    $0x4,%edi
mov    %r14,%rsi
call   1030 <f@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    $0x6,%edi
mov    %r14,%rsi
call   1030 <f@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
mov    $0x8,%edi
mov    %r14,%rsi
call   1030 <f@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1030 <f@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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