#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 */
float avgf(int, float *);
int /*<<< orphan*/ loadvect(int, float *);
float maxf(int, float *);
float minf(int, float *);
int /*<<< orphan*/ printf(char *, float, float, float);
int main() {
  float vect[10], minv, maxv, avgv;
  loadvect(10, vect);
  minv = minf(10, vect);
  maxv = maxf(10, vect);
  avgv = avgf(10, vect);
  printf("min: %f\nmax: %f\navg: %f\n", minv, maxv, avgv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1050 <loadvect@plt>
lea    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1060 <minf@plt>
movss  %xmm0,-0x34(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1040 <maxf@plt>
movss  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0xa,%edi
call   1070 <avgf@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x34(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
movss  -0x3c(%rbp),%xmm2
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0x10(%rsp),%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <loadvect@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <minf@plt>
movss  %xmm0,0xc(%rsp)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <maxf@plt>
movss  %xmm0,0x8(%rsp)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1070 <avgf@plt>
movaps %xmm0,%xmm2
lea    0xe5c(%rip),%rdi
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"min: %f\0Amax: %f\0Aavg: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%7 = call i32 @loadvect(i32 10, float* %6)
%8 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%9 = call float @minf(i32 10, float* %8)
store float %9, float* %3
%10 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%11 = call float @maxf(i32 10, float* %10)
store float %11, float* %4
%12 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%13 = call float @avgf(i32 10, float* %12)
store float %13, float* %5
%14 = load float, float* %3
%15 = load float, float* %4
%16 = load float, float* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), float %14, float %15, float %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"min: %f\0Amax: %f\0Aavg: %f\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%4 = call i32 @loadvect(i32 10, float* %3)
%5 = call float @minf(i32 10, float* %3)
%6 = call float @maxf(i32 10, float* %3)
%7 = call float @avgf(i32 10, float* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), float %5, float %6, float %7)
ret i32 0
}