#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 */
int EXIT_SUCCESS;
int /*<<< orphan*/ checkIntInput(int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int number, num, sum = 0;
  double average, min = num, max;
  printf("Enter numbers: ");
  checkIntInput(&number);
  int ctr = 1;
  while (ctr <= number) {
    checkIntInput(&num);
    min = (min < num) ? min : num;
    max = (max > num) ? max : num;
    sum += num;
    average = (double)sum / number;
    ctr++;
  }
  printf("min = %.2lf\n", min);
  printf("max = %.2lf\n", max);
  printf("sum = %.2lf\n", (double)sum);
  printf("average = %.2lf\n", average);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <checkIntInput@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120b <main+0xeb>
lea    -0xc(%rbp),%rdi
call   1030 <checkIntInput@plt>
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1196 <main+0x76>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11a0 <main+0x80>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11cd <main+0xad>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11d7 <main+0xb7>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115e <main+0x3e>
movsd  -0x20(%rbp),%xmm0
lea    0xdf9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xdf3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cvtsi2sdl -0x10(%rbp),%xmm0
lea    0xded(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xde7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rdi
call   1030 <checkIntInput@plt>
cmpl   $0x0,0xc(%rsp)
jle    11cc <main+0xac>
xorpd  %xmm1,%xmm1
lea    0x24(%rsp),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
mov    %r14,%rdi
call   1030 <checkIntInput@plt>
movsd  0x10(%rsp),%xmm1
mov    0x24(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
minsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm2
maxsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  0x18(%rsp),%xmm0
add    %eax,%ebx
mov    0xc(%rsp),%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1160 <main+0x40>
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm2,0x10(%rsp)
divsd  %xmm0,%xmm2
movsd  %xmm2,0x28(%rsp)
jmp    11d9 <main+0xb9>
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm1,%xmm1
lea    0xe30(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe2b(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe24(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter numbers: \00"
@.str.1 = [13 x i8] c"min = %.2lf\0A\00"
@.str.2 = [13 x i8] c"max = %.2lf\0A\00"
@.str.3 = [13 x i8] c"sum = %.2lf\0A\00"
@.str.4 = [17 x i8] c"average = %.2lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
store double %10, double* %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @checkIntInput(i32* %2)
store i32 1, i32* %8
br label %13
13: ; preds = %39, %0
%14 = load i32, i32* %8
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %51
17: ; preds = %13
%18 = call i32 @checkIntInput(i32* %3)
%19 = load double, double* %6
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = fcmp olt double %19, %21
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = load double, double* %6
br label %28
25: ; preds = %17
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
br label %28
28: ; preds = %25, %23
%29 = phi double [ %24, %23 ], [ %27, %25 ]
store double %29, double* %6
%30 = load double, double* %7
%31 = load i32, i32* %3
%32 = sitofp i32 %31 to double
%33 = fcmp ogt double %30, %32
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = load double, double* %7
br label %39
36: ; preds = %28
%37 = load i32, i32* %3
%38 = sitofp i32 %37 to double
br label %39
39: ; preds = %36, %34
%40 = phi double [ %35, %34 ], [ %38, %36 ]
store double %40, double* %7
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = add nsw i32 %42, %41
store i32 %43, i32* %4
%44 = load i32, i32* %4
%45 = sitofp i32 %44 to double
%46 = load i32, i32* %2
%47 = sitofp i32 %46 to double
%48 = fdiv double %45, %47
store double %48, double* %5
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %13
51: ; preds = %13
%52 = load double, double* %6
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %52)
%54 = load double, double* %7
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %54)
%56 = load i32, i32* %4
%57 = sitofp i32 %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %57)
%59 = load double, double* %5
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %59)
%61 = load i32, i32* @EXIT_SUCCESS
ret i32 %61
}

LLVM IR (-O2):
@.str = [16 x i8] c"Enter numbers: \00"
@.str.1 = [13 x i8] c"min = %.2lf\0A\00"
@.str.2 = [13 x i8] c"max = %.2lf\0A\00"
@.str.3 = [13 x i8] c"sum = %.2lf\0A\00"
@.str.4 = [17 x i8] c"average = %.2lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @checkIntInput(i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %29, label %9
9: ; preds = %0, %9
%10 = phi i32 [ %22, %9 ], [ 1, %0 ]
%11 = phi double [ %20, %9 ], [ undef, %0 ]
%12 = phi double [ %18, %9 ], [ 0.000000e+00, %0 ]
%13 = phi i32 [ %21, %9 ], [ 0, %0 ]
%14 = call i32 @checkIntInput(i32* %2)
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to double
%17 = fcmp olt double %12, %16
%18 = select i1 %17, double %12, double %16
%19 = fcmp ogt double %11, %16
%20 = select i1 %19, double %11, double %16
%21 = add nsw i32 %15, %13
%22 = add nuw nsw i32 %10, 1
%23 = load i32, i32* %1
%24 = icmp slt i32 %10, %23
br i1 %24, label %9, label %25
25: ; preds = %9
%26 = sitofp i32 %21 to double
%27 = sitofp i32 %23 to double
%28 = fdiv double %26, %27
br label %29
29: ; preds = %25, %0
%30 = phi double [ %26, %25 ], [ 0.000000e+00, %0 ]
%31 = phi double [ %28, %25 ], [ undef, %0 ]
%32 = phi double [ %18, %25 ], [ 0.000000e+00, %0 ]
%33 = phi double [ %20, %25 ], [ undef, %0 ]
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %32)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %33)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %30)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %31)
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
}