#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 */
double avg(double *, int);
double max(double *, int);
double min(double *, int);
int /*<<< orphan*/ printArray(double *, int);
int /*<<< orphan*/ printf(char *, double, double, double, double);
double sum(double *, int);
int main() {
  double i[] = {1.0, 2.0, 3.0, 4.0, 5.5};
  printArray(i, 5);
  printf("\n%f\n%f\n%f\n%f\n", sum(i, 5), avg(i, 5), max(i, 5), min(i, 5));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe51(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe3c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1090 <printArray@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1070 <sum@plt>
movsd  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1080 <avg@plt>
movsd  %xmm0,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1050 <max@plt>
movsd  %xmm0,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1040 <min@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movabs $0x4016000000000000,%rax
mov    %rax,0x40(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1080 <printArray@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <sum@plt>
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <avg@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <max@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <min@plt>
movaps %xmm0,%xmm3
lea    0xe32(%rip),%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0A%f\0A%f\0A%f\0A%f\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = bitcast i8* %2 to [5 x double]*
%4 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 0
store double 1.000000e+00, double* %4
%5 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 1
store double 2.000000e+00, double* %5
%6 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 2
store double 3.000000e+00, double* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 3
store double 4.000000e+00, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 4
store double 5.500000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%10 = call i32 @printArray(double* %9, i32 5)
%11 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%12 = call double @sum(double* %11, i32 5)
%13 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%14 = call double @avg(double* %13, i32 5)
%15 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%16 = call double @max(double* %15, i32 5)
%17 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%18 = call double @min(double* %17, i32 5)
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %12, double %14, double %16, double %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0A%f\0A%f\0A%f\0A%f\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%4 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %4
%5 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 4
store double 5.500000e+00, double* %7
%8 = call i32 @printArray(double* %3, i32 5)
%9 = call double @sum(double* %3, i32 5)
%10 = call double @avg(double* %3, i32 5)
%11 = call double @max(double* %3, i32 5)
%12 = call double @min(double* %3, i32 5)
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %9, double %10, double %11, double %12)
ret i32 0
}