#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, number, min = 0, max = 0, counter;
  float total_all, average_all;
  printf("How many number do you want to enter: ");
  scanf("%d", &counter);
  if (counter == 0) {
    printf("Np Try again\n");
  } else {
    for (i = 0; i < counter; i++) {
      printf("Enter %d. number: ", i + 1);
      scanf("%d", &number);
      if (i == 0) {
        max = number;
        min = number;
      }
      if (number < min)
        min = number;
      if (number > max)
        max = number;
      total_all += number;
    }
  }
  printf("%d %d\n", max, min);
  float average = (max + min) / 2;
  int total = max + min;
  average_all = total_all / i;
  printf("max + min = %d\n", total);
  printf("Average of max and min is:%.1f\n", average);
  printf("Total of all: %.1f\n", total_all);
  printf("Average of all : %f\n", average_all);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1178 <main+0x58>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120b <main+0xeb>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1206 <main+0xe6>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe81(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11c5 <main+0xa5>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d7 <main+0xb7>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11e9 <main+0xc9>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117f <main+0x5f>
jmp    120b <main+0xeb>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x28(%rbp),%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdef(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     11f8 <main+0xc8>
jle    1204 <main+0xd4>
lea    0xeb0(%rip),%r15
lea    0x14(%rsp),%r12
xor    %r13d,%r13d
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13d,%r14d
lea    0x1(%r14),%r13d
lea    0xe8c(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
test   %r14d,%r14d
mov    0x14(%rsp),%eax
cmove  %eax,%ebx
cmove  %eax,%ebp
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmp    %ebx,%eax
cmovg  %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
cmp    0xc(%rsp),%r13d
jl     1190 <main+0x60>
xorps  %xmm0,%xmm0
cvtsi2ss %r13d,%xmm0
movss  %xmm0,0x4(%rsp)
jmp    120f <main+0xdf>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
xor    %ebp,%ebp
lea    0xe27(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebx,%ebp
mov    %ebp,%eax
shr    $0x1f,%eax
add    %ebp,%eax
sar    %eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
divss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xdf2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdec(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"How many number do you want to enter: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Np Try again\0A\00"
@.str.3 = [19 x i8] c"Enter %d. number: \00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
@.str.5 = [16 x i8] c"max + min = %d\0A\00"
@.str.6 = [32 x i8] c"Average of max and min is:%.1f\0A\00"
@.str.7 = [20 x i8] c"Total of all: %.1f\0A\00"
@.str.8 = [21 x i8] c"Average of all : %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %53
17: ; preds = %0
store i32 0, i32* %2
br label %18
18: ; preds = %49, %17
%19 = load i32, i32* %2
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %52
22: ; preds = %18
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = load i32, i32* %3
store i32 %30, i32* %5
%31 = load i32, i32* %3
store i32 %31, i32* %4
br label %32
32: ; preds = %29, %22
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = load i32, i32* %3
store i32 %37, i32* %4
br label %38
38: ; preds = %36, %32
%39 = load i32, i32* %3
%40 = load i32, i32* %5
%41 = icmp sgt i32 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = load i32, i32* %3
store i32 %43, i32* %5
br label %44
44: ; preds = %42, %38
%45 = load i32, i32* %3
%46 = sitofp i32 %45 to float
%47 = load float, float* %7
%48 = fadd float %47, %46
store float %48, float* %7
br label %49
49: ; preds = %44
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %18
52: ; preds = %18
br label %53
53: ; preds = %52, %15
%54 = load i32, i32* %5
%55 = load i32, i32* %4
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %54, i32 %55)
%57 = load i32, i32* %5
%58 = load i32, i32* %4
%59 = add nsw i32 %57, %58
%60 = sdiv i32 %59, 2
%61 = sitofp i32 %60 to float
store float %61, float* %9
%62 = load i32, i32* %5
%63 = load i32, i32* %4
%64 = add nsw i32 %62, %63
store i32 %64, i32* %10
%65 = load float, float* %7
%66 = load i32, i32* %2
%67 = sitofp i32 %66 to float
%68 = fdiv float %65, %67
store float %68, float* %8
%69 = load i32, i32* %10
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %69)
%71 = load float, float* %9
%72 = fpext float %71 to double
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %72)
%74 = load float, float* %7
%75 = fpext float %74 to double
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), double %75)
%77 = load float, float* %8
%78 = fpext float %77 to double
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), double %78)
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"How many number do you want to enter: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Enter %d. number: \00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
@.str.5 = [16 x i8] c"max + min = %d\0A\00"
@.str.6 = [32 x i8] c"Average of max and min is:%.1f\0A\00"
@.str.7 = [20 x i8] c"Total of all: %.1f\0A\00"
@.str.8 = [21 x i8] c"Average of all : %f\0A\00"
@str = [13 x i8] c"Np Try again\00"
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 ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = icmp sgt i32 %7, 0
br i1 %10, label %13, label %35
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %35
13: ; preds = %9, %13
%14 = phi i32 [ %18, %13 ], [ 0, %9 ]
%15 = phi i32 [ %26, %13 ], [ 0, %9 ]
%16 = phi i32 [ %28, %13 ], [ 0, %9 ]
%17 = phi float [ %30, %13 ], [ undef, %9 ]
%18 = add nuw nsw i32 %14, 1
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%21 = icmp eq i32 %14, 0
%22 = load i32, i32* %1
%23 = select i1 %21, i32 %22, i32 %16
%24 = select i1 %21, i32 %22, i32 %15
%25 = icmp slt i32 %22, %24
%26 = select i1 %25, i32 %22, i32 %24
%27 = icmp sgt i32 %22, %23
%28 = select i1 %27, i32 %22, i32 %23
%29 = sitofp i32 %22 to float
%30 = fadd float %17, %29
%31 = load i32, i32* %2
%32 = icmp slt i32 %18, %31
br i1 %32, label %13, label %33
33: ; preds = %13
%34 = sitofp i32 %18 to float
br label %35
35: ; preds = %33, %9, %11
%36 = phi float [ undef, %11 ], [ undef, %9 ], [ %30, %33 ]
%37 = phi i32 [ 0, %11 ], [ 0, %9 ], [ %28, %33 ]
%38 = phi i32 [ 0, %11 ], [ 0, %9 ], [ %26, %33 ]
%39 = phi float [ 0.000000e+00, %11 ], [ 0.000000e+00, %9 ], [ %34, %33 ]
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %37, i32 %38)
%41 = add nsw i32 %38, %37
%42 = sdiv i32 %41, 2
%43 = sitofp i32 %42 to float
%44 = fdiv float %36, %39
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %41)
%46 = fpext float %43 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %46)
%48 = fpext float %36 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), double %48)
%50 = fpext float %44 to double
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), double %50)
ret i32 0
}