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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1080 <memset@plt>
movsd  0xe4d(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe33(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe1e(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe09(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1080 <memset@plt>
movsd  0xdfc(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdf7(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xde2(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xdcd(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xdb8(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10b0 <printArray@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1090 <sum@plt>
movsd  %xmm0,-0x80(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10a0 <avg@plt>
movsd  %xmm0,-0x78(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1070 <max@plt>
movsd  %xmm0,-0x70(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1060 <min@plt>
movsd  %xmm0,-0x68(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10c0 <isSorted@plt>
movsd  -0x80(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
mov    %eax,%esi
lea    0xd4e(%rip),%rdi
mov    $0x4,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x5,%esi
call   1030 <toIndex@plt>
lea    -0x60(%rbp),%rdi
mov    $0x5,%esi
call   10b0 <printArray@plt>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x5,%edx
call   1040 <sumArrays@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10b0 <printArray@plt>
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
movaps 0xe52(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe56(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
movabs $0x4016000000000000,%rax
mov    %rax,0x70(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm1,0x30(%rsp)
mov    %rax,0x40(%rsp)
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   10b0 <printArray@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1090 <sum@plt>
movsd  %xmm0,0x18(%rsp)
mov    %r14,%rdi
mov    $0x5,%esi
call   10a0 <avg@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    $0x5,%esi
call   1080 <max@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    $0x5,%esi
call   1070 <min@plt>
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    $0x5,%esi
call   10c0 <isSorted@plt>
lea    0xdd2(%rip),%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
mov    %eax,%esi
mov    $0x4,%al
call   1060 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <toIndex@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   10b0 <printArray@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1050 <sumArrays@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   10b0 <printArray@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0A%f\0A%f\0A%f\0A%f\0A%d\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = alloca [5 x double]
%3 = bitcast [5 x double]* %1 to i8*
%4 = bitcast i8* %3 to [5 x double]*
%5 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 0
store double 3.000000e+00, double* %5
%6 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 1
store double 2.000000e+00, double* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 2
store double 3.000000e+00, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 3
store double 4.000000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %4, i32 0, i32 4
store double 5.500000e+00, double* %9
%10 = bitcast [5 x double]* %2 to i8*
%11 = bitcast i8* %10 to [5 x double]*
%12 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 0
store double 3.000000e+00, double* %12
%13 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 1
store double 2.000000e+00, double* %13
%14 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 2
store double 3.000000e+00, double* %14
%15 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 3
store double 4.000000e+00, double* %15
%16 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 4
store double 5.500000e+00, double* %16
%17 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%18 = call i32 @printArray(double* %17, i32 5)
%19 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%20 = call double @sum(double* %19, i32 5)
%21 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%22 = call double @avg(double* %21, i32 5)
%23 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%24 = call double @max(double* %23, i32 5)
%25 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%26 = call double @min(double* %25, i32 5)
%27 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%28 = call i32 @isSorted(double* %27, i32 5)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %20, double %22, double %24, double %26, i32 %28)
%30 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%31 = call i32 @toIndex(double* %30, i32 5)
%32 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%33 = call i32 @printArray(double* %32, i32 5)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%36 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%37 = call i32 @sumArrays(double* %35, double* %36, i32 5)
%38 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%39 = call i32 @printArray(double* %38, i32 5)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0A%f\0A%f\0A%f\0A%f\0A%d\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = alloca [5 x double]
%3 = bitcast [5 x double]* %1 to i8*
%4 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%5 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 2.000000e+00>, <2 x double>* %5
%6 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 4
store double 5.500000e+00, double* %8
%9 = bitcast [5 x double]* %2 to i8*
%10 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%11 = bitcast [5 x double]* %2 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 2.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 2
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %13
%14 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 4
store double 5.500000e+00, double* %14
%15 = call i32 @printArray(double* %4, i32 5)
%16 = call double @sum(double* %4, i32 5)
%17 = call double @avg(double* %4, i32 5)
%18 = call double @max(double* %4, i32 5)
%19 = call double @min(double* %4, i32 5)
%20 = call i32 @isSorted(double* %4, i32 5)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %16, double %17, double %18, double %19, i32 %20)
%22 = call i32 @toIndex(double* %10, i32 5)
%23 = call i32 @printArray(double* %10, i32 5)
%24 = call i32 @putchar(i32 10)
%25 = call i32 @sumArrays(double* %4, double* %10, i32 5)
%26 = call i32 @printArray(double* %4, i32 5)
%27 = call i32 @putchar(i32 10)
ret i32 0
}