#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*/ toIndex(double *, int);
int main() {
  double i[] = {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(i, 5);
  printArray(i, 5);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
movsd  0xe60(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe5b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe46(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe31(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe1c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10a0 <printArray@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1080 <sum@plt>
movsd  %xmm0,-0x50(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1090 <avg@plt>
movsd  %xmm0,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1060 <max@plt>
movsd  %xmm0,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1050 <min@plt>
movsd  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10b0 <isSorted@plt>
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
mov    %eax,%esi
lea    0xdb2(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1030 <toIndex@plt>
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   10a0 <printArray@plt>
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xe64(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe68(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movabs $0x4016000000000000,%rax
mov    %rax,0x40(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   10a0 <printArray@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1080 <sum@plt>
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1090 <avg@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <max@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <min@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   10b0 <isSorted@plt>
lea    0xdf3(%rip),%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
mov    %eax,%esi
mov    $0x4,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <toIndex@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   10a0 <printArray@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
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 = 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 3.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 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%20 = call i32 @isSorted(double* %19, i32 5)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %12, double %14, double %16, double %18, i32 %20)
%22 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%23 = call i32 @toIndex(double* %22, i32 5)
%24 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%25 = call i32 @printArray(double* %24, i32 5)
%26 = 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 = 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 3.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 @isSorted(double* %3, i32 5)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %9, double %10, double %11, double %12, i32 %13)
%15 = call i32 @toIndex(double* %3, i32 5)
%16 = call i32 @printArray(double* %3, i32 5)
%17 = call i32 @putchar(i32 10)
ret i32 0
}