#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 *, size_t, int);
int /*<<< orphan*/ puts(char *);
void automaticArrayInit() {
  int array2[3] = {1, 2, 3};
  size_t i;
  puts("\n\nValues on entering automaticArrayInit:");
  for (i = 0; i <= 2; ++i) {
    printf("array2[ %u ] = %d  ", i, array2[i] += 5);
  }
}


x86 assembly (clang, -O0):
<automaticArrayInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x2,-0x18(%rbp)
ja     118b <automaticArrayInit+0x6b>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp,%rax,4),%edx
add    $0x5,%edx
mov    %edx,-0xc(%rbp,%rax,4)
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1150 <automaticArrayInit+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<automaticArrayInit>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1040 <printf@plt>
mov    $0x1,%esi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1040 <printf@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
mov    $0x8,%edx
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@__const.automaticArrayInit.array2 = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [41 x i8] c"\0A\0AValues on entering automaticArrayInit:\00"
@.str.1 = [20 x i8] c"array2[ %u ] = %d \00"
define void @automaticArrayInit() {
%1 = alloca [3 x i32]
%2 = alloca i64
%3 = bitcast [3 x i32]* %1 to i8*
%4 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %2
br label %5
5: ; preds = %15, %0
%6 = load i64, i64* %2
%7 = icmp ule i64 %6, 2
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i64, i64* %2
%10 = load i64, i64* %2
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 5
store i32 %13, i32* %11
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 %9, i32 %13)
br label %15
15: ; preds = %8
%16 = load i64, i64* %2
%17 = add i64 %16, 1
store i64 %17, i64* %2
br label %5
18: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"\0A\0AValues on entering automaticArrayInit:\00"
@.str.1 = [20 x i8] c"array2[ %u ] = %d \00"
define void @automaticArrayInit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 0, i32 6)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 1, i32 7)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 2, i32 8)
ret void
}