#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 cont, valor, soma, MAnumero, MEnumero, coringa;
  float media;
  soma = 0;
  coringa = 0;
  for (cont = 1; cont <= 20; cont++) {
    printf("Por favor, digite um numero inteiro: ");
    scanf("%d", &valor);
    soma = soma + valor;
    if (coringa == 1) {
      if (valor > MAnumero)
        MAnumero = valor;
      if (valor < MEnumero)
        MEnumero = valor;
    } else {
      coringa = 1;
      MAnumero = valor;
      MEnumero = valor;
    }
  }
  media = (float)soma / 20;
  printf("\nSoma: %d \n", soma);
  printf("Media: %4.2f \n", media);
  printf("Maior numero: %d \n", MAnumero);
  printf("Menor numero: %d \n", MEnumero);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jg     11ce <main+0xae>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    11a8 <main+0x88>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1191 <main+0x71>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a3 <main+0x83>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11bb <main+0x9b>
movl   $0x1,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
cvtsi2ssl -0x10(%rbp),%xmm0
movss  0xe25(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe34(%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
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeea(%rip),%r15
mov    %rsp,%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    $0x13,%r14d
mov    (%rsp),%r13d
mov    %r13d,%ebp
mov    %r13d,%ebx
xchg   %ax,%ax
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
add    %eax,%ebx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %r13d,%eax
cmovl  %eax,%r13d
add    $0xffffffff,%r14d
jne    1160 <main+0x40>
cvtsi2ss %ebx,%xmm0
divss  0xe64(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xe84(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    %r13d,%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):
@.str = [38 x i8] c"Por favor, digite um numero inteiro: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"\0ASoma: %d \0A\00"
@.str.3 = [15 x i8] c"Media: %4.2f \0A\00"
@.str.4 = [19 x i8] c"Maior numero: %d \0A\00"
@.str.5 = [19 x i8] c"Menor numero: %d \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 i32
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %7
store i32 1, i32* %2
br label %9
9: ; preds = %37, %0
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 20
br i1 %11, label %12, label %40
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
store i32 %17, i32* %4
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %33
20: ; preds = %12
%21 = load i32, i32* %3
%22 = load i32, i32* %5
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = load i32, i32* %3
store i32 %25, i32* %5
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* %3
%28 = load i32, i32* %6
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32, i32* %3
store i32 %31, i32* %6
br label %32
32: ; preds = %30, %26
br label %36
33: ; preds = %12
store i32 1, i32* %7
%34 = load i32, i32* %3
store i32 %34, i32* %5
%35 = load i32, i32* %3
store i32 %35, i32* %6
br label %36
36: ; preds = %33, %32
br label %37
37: ; preds = %36
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %9
40: ; preds = %9
%41 = load i32, i32* %4
%42 = sitofp i32 %41 to float
%43 = fdiv float %42, 2.000000e+01
store float %43, float* %8
%44 = load i32, i32* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load float, float* %8
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %47)
%49 = load i32, i32* %5
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %6
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str = [38 x i8] c"Por favor, digite um numero inteiro: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"\0ASoma: %d \0A\00"
@.str.3 = [15 x i8] c"Media: %4.2f \0A\00"
@.str.4 = [19 x i8] c"Maior numero: %d \0A\00"
@.str.5 = [19 x i8] c"Menor numero: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 2, %0 ], [ %19, %6 ]
%8 = phi i32 [ %5, %0 ], [ %18, %6 ]
%9 = phi i32 [ %5, %0 ], [ %16, %6 ]
%10 = phi i32 [ %5, %0 ], [ %14, %6 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 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* %1)
%13 = load i32, i32* %1
%14 = add nsw i32 %13, %10
%15 = icmp sgt i32 %13, %9
%16 = select i1 %15, i32 %13, i32 %9
%17 = icmp slt i32 %13, %8
%18 = select i1 %17, i32 %13, i32 %8
%19 = add nuw nsw i32 %7, 1
%20 = icmp eq i32 %19, 21
br i1 %20, label %21, label %6
21: ; preds = %6
%22 = sitofp i32 %14 to float
%23 = fdiv float %22, 2.000000e+01
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%25 = fpext float %23 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %18)
ret i32 0
}