#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 main() {
  int userInput, sum, count, biggest, smallest;
  float avg;
  char close;
  biggest = 0;
  smallest = 0;
  sum = 0;
  count = 0;
  close = 'n';
  do {
    printf("Please enter the next input: ");
    scanf("%i", &userInput);
    sum += userInput;
    count++;
    if (userInput > biggest)
      biggest = userInput;
    else if (userInput < smallest)
      smallest = userInput;
    printf("Do you want to exit the programm?:");
    scanf("%s", &close);
  } while (close != 'y');
  avg = (float)sum / count;
  printf("Biggest: %i, smallest: %i, Avg: %f\n", biggest, smallest, avg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x6e,-0x1d(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1198 <main+0x78>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11af <main+0x8f>
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11aa <main+0x8a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11af <main+0x8f>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
lea    -0x1d(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1d(%rbp),%eax
cmp    $0x79,%eax
jne    114f <main+0x2f>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe42(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movb   $0x6e,0xb(%rsp)
pxor   %xmm0,%xmm0
movdqa %xmm0,0x10(%rsp)
lea    0xeed(%rip),%r13
lea    0xf09(%rip),%r14
lea    0xb(%rsp),%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%r12d
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
movd   %eax,%xmm0
movaps 0xe6d(%rip),%xmm1
movss  %xmm0,%xmm1
movdqa 0x10(%rsp),%xmm0
paddd  %xmm1,%xmm0
movdqa %xmm0,0x10(%rsp)
cmp    %ebp,%eax
cmovl  %eax,%ebp
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%ebp
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x79,0xb(%rsp)
jne    1160 <main+0x40>
cvtdq2ps 0x10(%rsp),%xmm0
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe69(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Please enter the next input: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [35 x i8] c"Do you want to exit the programm?:\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [36 x i8] c"Biggest: %i, smallest: %i, Avg: %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 i8
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %3
store i32 0, i32* %4
store i8 110, i8* %8
br label %9
9: ; preds = %32, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, %12
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = load i32, i32* %2
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %9
%21 = load i32, i32* %2
store i32 %21, i32* %5
br label %29
22: ; preds = %9
%23 = load i32, i32* %2
%24 = load i32, i32* %6
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %2
store i32 %27, i32* %6
br label %28
28: ; preds = %26, %22
br label %29
29: ; preds = %28, %20
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %8)
br label %32
32: ; preds = %29
%33 = load i8, i8* %8
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 121
br i1 %35, label %9, label %36
36: ; preds = %32
%37 = load i32, i32* %3
%38 = sitofp i32 %37 to float
%39 = load i32, i32* %4
%40 = sitofp i32 %39 to float
%41 = fdiv float %38, %40
store float %41, float* %7
%42 = load i32, i32* %5
%43 = load i32, i32* %6
%44 = load float, float* %7
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %42, i32 %43, double %45)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Please enter the next input: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [35 x i8] c"Do you want to exit the programm?:\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [36 x i8] c"Biggest: %i, smallest: %i, Avg: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
store i8 110, i8* %2
br label %4
4: ; preds = %4, %0
%5 = phi i32 [ 0, %0 ], [ %16, %4 ]
%6 = phi i32 [ 0, %0 ], [ %17, %4 ]
%7 = phi <2 x i32> [ zeroinitializer, %0 ], [ %12, %4 ]
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = insertelement <2 x i32> <i32 poison, i32 1>, i32 %10, i64 0
%12 = add nsw <2 x i32> %11, %7
%13 = icmp sgt i32 %10, %5
%14 = icmp slt i32 %10, %6
%15 = select i1 %14, i32 %10, i32 %6
%16 = select i1 %13, i32 %10, i32 %5
%17 = select i1 %13, i32 %6, i32 %15
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%20 = load i8, i8* %2
%21 = icmp eq i8 %20, 121
br i1 %21, label %22, label %4
22: ; preds = %4
%23 = sitofp <2 x i32> %12 to <2 x float>
%24 = extractelement <2 x float> %23, i64 0
%25 = extractelement <2 x float> %23, i64 1
%26 = fdiv float %24, %25
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %17, double %27)
ret i32 0
}