#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 n = 0;
  int menor;
  int maior = 0;
  float numero = 0.0;
  float media = 0.0;
  printf("Entre com o numero de vezes: ");
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    printf("Entre com o %do numero: ", i);
    scanf("%f", &numero);
    media = media + numero;
    if (numero < menor) {
      menor = numero;
    }
    if (numero > maior) {
      maior = numero;
    }
  }
  printf("A media eh: %.2f \n", (media / n));
  printf("O menor numero eh: %i \n", menor);
  printf("O maior numero eh: %i \n", maior);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11fb <main+0xdb>
mov    -0x1c(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm1
cvtsi2ssl -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11cd <main+0xad>
cvttss2si -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    11e8 <main+0xc8>
cvttss2si -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11ed <main+0xcd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1174 <main+0x54>
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe29(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%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    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xebb(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
xorps  %xmm1,%xmm1
test   %eax,%eax
jle    11f1 <main+0xd1>
lea    0x10(%rsp),%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1198 <main+0x78>
nopl   0x0(%rax)
movss  0x14(%rsp),%xmm1
addss  %xmm0,%xmm1
mov    0xc(%rsp),%eax
mov    %r13d,%ebx
mov    %r15d,%r14d
cmp    %eax,%ebp
jge    11f1 <main+0xd1>
movss  %xmm1,0x14(%rsp)
add    $0x1,%ebp
lea    0xe79(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %r14d,%xmm1
ucomiss %xmm0,%xmm1
cvttss2si %xmm0,%r13d
mov    %r13d,%r15d
ja     11e0 <main+0xc0>
mov    %r14d,%r15d
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
ucomiss %xmm1,%xmm0
ja     1180 <main+0x60>
mov    %ebx,%r13d
jmp    1180 <main+0x60>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe3f(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <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 = [30 x i8] c"Entre com o numero de vezes: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"Entre com o %do numero: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [19 x i8] c"A media eh: %.2f \0A\00"
@.str.5 = [24 x i8] c"O menor numero eh: %i \0A\00"
@.str.6 = [24 x i8] c"O maior numero eh: %i \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
%8 = call i32 (i8*, ...) @printf(i8* 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* %2)
store i32 1, i32* %7
br label %10
10: ; preds = %37, %0
%11 = load i32, i32* %7
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %40
14: ; preds = %10
%15 = load i32, i32* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%18 = load float, float* %6
%19 = load float, float* %5
%20 = fadd float %18, %19
store float %20, float* %6
%21 = load float, float* %5
%22 = load i32, i32* %3
%23 = sitofp i32 %22 to float
%24 = fcmp olt float %21, %23
br i1 %24, label %25, label %28
25: ; preds = %14
%26 = load float, float* %5
%27 = fptosi float %26 to i32
store i32 %27, i32* %3
br label %28
28: ; preds = %25, %14
%29 = load float, float* %5
%30 = load i32, i32* %4
%31 = sitofp i32 %30 to float
%32 = fcmp ogt float %29, %31
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load float, float* %5
%35 = fptosi float %34 to i32
store i32 %35, i32* %4
br label %36
36: ; preds = %33, %28
br label %37
37: ; preds = %36
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %10
40: ; preds = %10
%41 = load float, float* %6
%42 = load i32, i32* %2
%43 = sitofp i32 %42 to float
%44 = fdiv float %41, %43
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %45)
%47 = load i32, i32* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %4
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Entre com o numero de vezes: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"Entre com o %do numero: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [19 x i8] c"A media eh: %.2f \0A\00"
@.str.5 = [24 x i8] c"O menor numero eh: %i \0A\00"
@.str.6 = [24 x i8] c"O maior numero eh: %i \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %20
9: ; preds = %20, %0
%10 = phi i32 [ undef, %0 ], [ %32, %20 ]
%11 = phi i32 [ 0, %0 ], [ %35, %20 ]
%12 = phi float [ 0.000000e+00, %0 ], [ %28, %20 ]
%13 = phi i32 [ %7, %0 ], [ %37, %20 ]
%14 = sitofp i32 %13 to float
%15 = fdiv float %12, %14
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %11)
ret i32 0
20: ; preds = %0, %20
%21 = phi i32 [ %36, %20 ], [ 1, %0 ]
%22 = phi float [ %28, %20 ], [ 0.000000e+00, %0 ]
%23 = phi i32 [ %35, %20 ], [ 0, %0 ]
%24 = phi i32 [ %32, %20 ], [ undef, %0 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%27 = load float, float* %2
%28 = fadd float %22, %27
%29 = sitofp i32 %24 to float
%30 = fcmp olt float %27, %29
%31 = fptosi float %27 to i32
%32 = select i1 %30, i32 %31, i32 %24
%33 = sitofp i32 %23 to float
%34 = fcmp ogt float %27, %33
%35 = select i1 %34, i32 %31, i32 %23
%36 = add nuw nsw i32 %21, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %21, %37
br i1 %38, label %20, label %9
}