#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*/ foo(int, int *);
main() {
  int array[4], i;
  for (i = 0; i < 5; i++) {
    array[0] = 5;
    array[1] = 6;
    array[2] = 7;
    array[3] = 8;
    foo(i, array);
  }
  array[0] = 5;
  array[1] = 6;
  array[2] = 7;
  array[3] = 8;
  foo(0xffffffffu, array);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1166 <main+0x56>
movl   $0x5,-0x20(%rbp)
movl   $0x6,-0x1c(%rbp)
movl   $0x7,-0x18(%rbp)
movl   $0x8,-0x14(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <foo@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1126 <main+0x16>
movl   $0x5,-0x20(%rbp)
movl   $0x6,-0x1c(%rbp)
movl   $0x7,-0x18(%rbp)
movl   $0x8,-0x14(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0xffffffff,%edi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
movaps 0xecc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x2,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
movaps 0xe84(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x4,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
movaps 0xe6c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
store i32 5, i32* %8
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
store i32 6, i32* %9
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
store i32 7, i32* %10
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
store i32 8, i32* %11
%12 = load i32, i32* %3
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%14 = call i32 @foo(i32 %12, i32* %13)
br label %15
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %4
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
store i32 5, i32* %19
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
store i32 6, i32* %20
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
store i32 7, i32* %21
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
store i32 8, i32* %22
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%24 = call i32 @foo(i32 -1, i32* %23)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca <4 x i32>
%2 = bitcast <4 x i32>* %1 to i8*
%3 = getelementptr inbounds <4 x i32>, <4 x i32>* %1, i64 0, i64 0
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %1
%4 = call i32 @foo(i32 0, i32* %3)
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %1
%5 = call i32 @foo(i32 1, i32* %3)
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %1
%6 = call i32 @foo(i32 2, i32* %3)
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %1
%7 = call i32 @foo(i32 3, i32* %3)
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %1
%8 = call i32 @foo(i32 4, i32* %3)
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %1
%9 = call i32 @foo(i32 -1, i32* %3)
ret i32 0
}