#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 processArray(int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int arr[1024], size = 0;
  int i = 0, retval = 1;
  scanf("%d", &size);
  for (i = 0; i < size; i++) {
    scanf("%d", &arr[i]);
  }
  retval = processArray(arr, size);
  return (retval);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1014(%rbp)
movl   $0x0,-0x1018(%rbp)
movl   $0x1,-0x101c(%rbp)
lea    0xea9(%rip),%rdi
lea    -0x1014(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1018(%rbp)
mov    -0x1018(%rbp),%eax
cmp    -0x1014(%rbp),%eax
jge    11b4 <main+0x94>
movslq -0x1018(%rbp),%rax
lea    -0x1010(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe65(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1018(%rbp)
jmp    116d <main+0x4d>
lea    -0x1010(%rbp),%rdi
mov    -0x1014(%rbp),%esi
call   1030 <processArray@plt>
mov    %eax,-0x101c(%rbp)
mov    -0x101c(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1010,%rsp
movl   $0x0,0xc(%rsp)
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    117d <main+0x5d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r15
cmp    %rsi,%rbx
jl     1160 <main+0x40>
lea    0x10(%rsp),%rdi
call   1030 <processArray@plt>
add    $0x1010,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [1024 x i32]
%2 = alloca i32
%3 = bitcast [1024 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %0, %8
%9 = phi i64 [ %12, %8 ], [ 0, %0 ]
%10 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = add nuw nsw i64 %9, 1
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = icmp slt i64 %12, %14
br i1 %15, label %8, label %16
16: ; preds = %8, %0
%17 = phi i32 [ %6, %0 ], [ %13, %8 ]
%18 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%19 = call i32 @processArray(i32* %18, i32 %17)
ret i32 %19
}