#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, quantidade, soma, MAnumero, MEnumero, coringa;
  float media;
  soma = 0;
  coringa = 0;
  quantidade = 0;
  while (valor != 0) {
    printf("Por favor, digite um numero: ");
    scanf("%d", &valor);
    if (valor != 0) {
      quantidade++;
      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 / quantidade;
  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    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11d8 <main+0xb8>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11d3 <main+0xb3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x20(%rbp)
jne    11bb <main+0x9b>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11a4 <main+0x84>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b6 <main+0x96>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11ce <main+0xae>
movl   $0x1,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11d3 <main+0xb3>
jmp    1144 <main+0x24>
cvtsi2ssl -0x14(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%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    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%r14d
test   %r14d,%r14d
je     11c9 <main+0xa9>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
je     11ce <main+0xae>
mov    $0x1,%r15d
lea    0xe9e(%rip),%r12
mov    %rsp,%r13
mov    %r14d,%ebp
mov    %r14d,%ebx
nopl   (%rax)
add    $0x1,%r15d
add    %eax,%ebp
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmp    %r14d,%eax
cmovl  %eax,%r14d
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
jne    1190 <main+0x70>
cvtsi2ss %r15d,%xmm0
jmp    11dc <main+0xbc>
xorps  %xmm0,%xmm0
jmp    11dc <main+0xbc>
movss  0xe2a(%rip),%xmm0
mov    %r14d,%ebx
mov    %r14d,%ebp
cvtsi2ss %ebp,%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
lea    0xe34(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe26(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe27(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2a(%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):
@.str = [30 x i8] c"Por favor, digite um numero: \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 i32
%9 = alloca float
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %8
store i32 0, i32* %4
br label %10
10: ; preds = %43, %0
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %44
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %43
18: ; preds = %13
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
%21 = load i32, i32* %3
%22 = load i32, i32* %5
%23 = add nsw i32 %22, %21
store i32 %23, i32* %5
%24 = load i32, i32* %8
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %39
26: ; preds = %18
%27 = load i32, i32* %3
%28 = load i32, i32* %6
%29 = icmp sgt 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
%33 = load i32, i32* %3
%34 = load i32, i32* %7
%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* %7
br label %38
38: ; preds = %36, %32
br label %42
39: ; preds = %18
store i32 1, i32* %8
%40 = load i32, i32* %3
store i32 %40, i32* %6
%41 = load i32, i32* %3
store i32 %41, i32* %7
br label %42
42: ; preds = %39, %38
br label %43
43: ; preds = %42, %13
br label %10
44: ; preds = %10
%45 = load i32, i32* %5
%46 = sitofp i32 %45 to float
%47 = load i32, i32* %4
%48 = sitofp i32 %47 to float
%49 = fdiv float %46, %48
store float %49, float* %9
%50 = load i32, i32* %5
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%52 = load float, float* %9
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %53)
%55 = load i32, i32* %6
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %7
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str = [30 x i8] c"Por favor, digite um numero: \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 ([30 x i8], [30 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
%6 = icmp eq i32 %5, 0
br i1 %6, label %30, label %7
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %30, label %12
12: ; preds = %7, %12
%13 = phi i32 [ %26, %12 ], [ %10, %7 ]
%14 = phi i32 [ %19, %12 ], [ %5, %7 ]
%15 = phi i32 [ %21, %12 ], [ %5, %7 ]
%16 = phi i32 [ %23, %12 ], [ %5, %7 ]
%17 = phi i32 [ %18, %12 ], [ 1, %7 ]
%18 = add nuw nsw i32 %17, 1
%19 = add nsw i32 %13, %14
%20 = icmp sgt i32 %13, %15
%21 = select i1 %20, i32 %13, i32 %15
%22 = icmp slt i32 %13, %16
%23 = select i1 %22, i32 %13, i32 %16
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%26 = load i32, i32* %1
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %12
28: ; preds = %12
%29 = sitofp i32 %18 to float
br label %30
30: ; preds = %7, %28, %0
%31 = phi float [ 0.000000e+00, %0 ], [ 1.000000e+00, %7 ], [ %29, %28 ]
%32 = phi i32 [ undef, %0 ], [ %5, %7 ], [ %23, %28 ]
%33 = phi i32 [ undef, %0 ], [ %5, %7 ], [ %21, %28 ]
%34 = phi i32 [ 0, %0 ], [ %5, %7 ], [ %19, %28 ]
%35 = sitofp i32 %34 to float
%36 = fdiv float %35, %31
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%38 = fpext float %36 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %33)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %32)
ret i32 0
}