#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 INT_MAX;
int INT_MIN;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  const int r = 20;
  int i = 1, num, soma = 0, maior = INT_MIN, menor = INT_MAX;
  float media;
  for (i; i <= r; i++) {
    printf("Entre com um numero: ");
    scanf("%d", &num);
    if (num < menor) {
      menor = num;
    }
    if (num > maior) {
      maior = num;
    }
    soma = soma + num;
  }
  printf("\nSoma: %d", soma);
  media = (float)soma / r;
  printf("\nMedia: %.2f", media);
  printf("\nMaior: %d", maior);
  printf("\nMenor: %d", menor);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x14,-0xc(%rbp)
jg     11bf <main+0x9f>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1196 <main+0x76>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11a8 <main+0x88>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <main+0x3c>
mov    -0x14(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  0xe23(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%ebp
mov    0x2ead(%rip),%rax
mov    (%rax),%r14d
mov    $0x14,%r15d
lea    0xed6(%rip),%r12
lea    0x4(%rsp),%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r14d,%eax
cmovl  %eax,%r14d
cmp    %ebp,%eax
cmovg  %eax,%ebp
add    %eax,%ebx
add    $0xffffffff,%r15d
jne    1160 <main+0x40>
lea    0xe82(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cvtsi2ss %ebx,%xmm0
divss  0xe53(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str = [22 x i8] c"Entre com um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"\0ASoma: %d\00"
@.str.3 = [13 x i8] c"\0AMedia: %.2f\00"
@.str.4 = [11 x i8] c"\0AMaior: %d\00"
@.str.5 = [11 x i8] c"\0AMenor: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
store i32 0, i32* %1
store i32 20, i32* %2
store i32 1, i32* %3
store i32 0, i32* %5
%9 = load i32, i32* @INT_MIN
store i32 %9, i32* %6
%10 = load i32, i32* @INT_MAX
store i32 %10, i32* %7
%11 = load i32, i32* %3
br label %12
12: ; preds = %33, %0
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 20
br i1 %14, label %15, label %36
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %4
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = load i32, i32* %4
store i32 %22, i32* %7
br label %23
23: ; preds = %21, %15
%24 = load i32, i32* %4
%25 = load i32, i32* %6
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i32, i32* %4
store i32 %28, i32* %6
br label %29
29: ; preds = %27, %23
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = add nsw i32 %30, %31
store i32 %32, i32* %5
br label %33
33: ; preds = %29
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %12
36: ; preds = %12
%37 = load i32, i32* %5
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %5
%40 = sitofp i32 %39 to float
%41 = fdiv float %40, 2.000000e+01
store float %41, float* %8
%42 = load float, float* %8
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %43)
%45 = load i32, i32* %6
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str = [22 x i8] c"Entre com um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"\0ASoma: %d\00"
@.str.3 = [13 x i8] c"\0AMedia: %.2f\00"
@.str.4 = [11 x i8] c"\0AMaior: %d\00"
@.str.5 = [11 x i8] c"\0AMenor: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @INT_MIN
%4 = load i32, i32* @INT_MAX
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 1, %0 ], [ %18, %5 ]
%7 = phi i32 [ %4, %0 ], [ %14, %5 ]
%8 = phi i32 [ %3, %0 ], [ %16, %5 ]
%9 = phi i32 [ 0, %0 ], [ %17, %5 ]
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, %7
%14 = select i1 %13, i32 %12, i32 %7
%15 = icmp sgt i32 %12, %8
%16 = select i1 %15, i32 %12, i32 %8
%17 = add nsw i32 %12, %9
%18 = add nuw nsw i32 %6, 1
%19 = icmp eq i32 %18, 21
br i1 %19, label %20, label %5
20: ; preds = %5
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%22 = sitofp i32 %17 to float
%23 = fdiv float %22, 2.000000e+01
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %14)
ret i32 0
}