#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 */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ increasingArray(int *);
int /*<<< orphan*/ populateArray(int *, int);
int /*<<< orphan*/ printResults(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sumArray(int *, int *, int *);
int main() {
  clock_t begin = clock();
  printf("Test 1 running\n");
  int array1[16];
  int array2[16];
  int result[16];
  populateArray(array1, 8);
  increasingArray(array2);
  sumArray(array1, array2, result);
  printResults(array1);
  printResults(array2);
  printResults(result);
  clock_t end = clock();
  printf("Finished execution. Duration: %f ms\n",
         (double)(end - begin) * 1000 / CLOCKS_PER_SEC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x8,%esi
call   1070 <populateArray@plt>
lea    -0x90(%rbp),%rdi
call   1040 <increasingArray@plt>
lea    -0x50(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
call   1050 <sumArray@plt>
lea    -0x50(%rbp),%rdi
call   1080 <printResults@plt>
lea    -0x90(%rbp),%rdi
call   1080 <printResults@plt>
lea    -0xd0(%rbp),%rdi
call   1080 <printResults@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  0xdfd(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2dda(%rip),%rax
divsd  (%rax),%xmm0
lea    0xdff(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r14
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%r15
mov    %r15,%rdi
mov    $0x8,%esi
call   1080 <populateArray@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <increasingArray@plt>
mov    %rsp,%r12
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1060 <sumArray@plt>
mov    %r15,%rdi
call   1090 <printResults@plt>
mov    %rbx,%rdi
call   1090 <printResults@plt>
mov    %r12,%rdi
call   1090 <printResults@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mulsd  0xe0a(%rip),%xmm0
mov    0x2deb(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe00(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Test 1 running\0A\00"
@.str.1 = [37 x i8] c"Finished execution. Duration: %f ms\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca [16 x i32]
%4 = alloca [16 x i32]
%5 = alloca [16 x i32]
%6 = alloca i64
store i32 0, i32* %1
%7 = call i64 (...) @clock()
store i64 %7, i64* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%10 = call i32 @populateArray(i32* %9, i32 8)
%11 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%12 = call i32 @increasingArray(i32* %11)
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%14 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%15 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
%16 = call i32 @sumArray(i32* %13, i32* %14, i32* %15)
%17 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%18 = call i32 @printResults(i32* %17)
%19 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%20 = call i32 @printResults(i32* %19)
%21 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
%22 = call i32 @printResults(i32* %21)
%23 = call i64 (...) @clock()
store i64 %23, i64* %6
%24 = load i64, i64* %6
%25 = load i64, i64* %2
%26 = sub nsw i64 %24, %25
%27 = sitofp i64 %26 to double
%28 = fmul double %27, 1.000000e+03
%29 = load double, double* @CLOCKS_PER_SEC
%30 = fdiv double %28, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), double %30)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [37 x i8] c"Finished execution. Duration: %f ms\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@str = [15 x i8] c"Test 1 running\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = alloca [16 x i32]
%3 = alloca [16 x i32]
%4 = tail call i64 (...) @clock()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = bitcast [16 x i32]* %1 to i8*
%7 = bitcast [16 x i32]* %2 to i8*
%8 = bitcast [16 x i32]* %3 to i8*
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%10 = call i32 @populateArray(i32* %9, i32 8)
%11 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%12 = call i32 @increasingArray(i32* %11)
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%14 = call i32 @sumArray(i32* %9, i32* %11, i32* %13)
%15 = call i32 @printResults(i32* %9)
%16 = call i32 @printResults(i32* %11)
%17 = call i32 @printResults(i32* %13)
%18 = call i64 (...) @clock()
%19 = sub nsw i64 %18, %4
%20 = sitofp i64 %19 to double
%21 = fmul double %20, 1.000000e+03
%22 = load double, double* @CLOCKS_PER_SEC
%23 = fdiv double %21, %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), double %23)
ret i32 0
}