#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 minmaxavg(double *, int, double *, double *);
int /*<<< orphan*/ printf(char *, double, double, double);
int main() {
  int N = 10;
  double arr[] = {5, 10, 43.5, 0.12, -4, 1, 11.43, 0, 545, 98};
  double min, max;
  double avg = minmaxavg(arr, N, &min, &max);
  printf("Avg= %f, Min= %f, Max= %f\n", avg, min, max);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0xa,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%esi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
call   1030 <minmaxavg@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
mov    $0xa,%esi
call   1030 <minmaxavg@plt>
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [10 x double] [double 5.000000e+00, double 1.000000e+01, double 4.350000e+01, double 1.200000e-01, double -4.000000e+00, double 1.000000e+00, double 1.143000e+01, double 0.000000e+00, double 5.450000e+02, double 9.800000e+01]
@.str = [27 x i8] c"Avg= %f, Min= %f, Max= %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x double]
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 10, i32* %1
%6 = bitcast [10 x double]* %2 to i8*
%7 = getelementptr inbounds [10 x double], [10 x double]* %2, i64 0, i64 0
%8 = load i32, i32* %1
%9 = call double @minmaxavg(double* %7, i32 %8, double* %3, double* %4)
store double %9, double* %5
%10 = load double, double* %5
%11 = load double, double* %3
%12 = load double, double* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %10, double %11, double %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [10 x double] [double 5.000000e+00, double 1.000000e+01, double 4.350000e+01, double 1.200000e-01, double -4.000000e+00, double 1.000000e+00, double 1.143000e+01, double 0.000000e+00, double 5.450000e+02, double 9.800000e+01]
@.str = [27 x i8] c"Avg= %f, Min= %f, Max= %f\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = alloca double
%3 = alloca double
%4 = bitcast [10 x double]* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%8 = call double @minmaxavg(double* %7, i32 10, double* %2, double* %3)
%9 = load double, double* %2
%10 = load double, double* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %8, double %9, double %10)
ret i32 0
}