#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, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int soma = 0, maior = 0, menor = 0, numero, i = 0, qt;
  float media;
  int flag = 1;
  puts("quantos numeros você quer ler ?");
  scanf("%d", &qt);
  printf("informe uma sequencia de %d numeros:", qt);
  for (; i < qt; i++) {
    scanf("%d", &numero);
    maior = flag ? numero : maior;
    menor = flag ? numero : menor;
    maior = numero > maior ? numero : maior;
    menor = numero < menor ? numero : menor;
    soma += numero;
    flag = 0;
  }
  media = (float)soma / 20;
  printf("\n Maior: %d\n Menor: %d\n Soma: %d\n Media: 4%.2f", maior, menor,
         soma, media);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x1c(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1251 <main+0x121>
lea    0xe83(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x24(%rbp)
je     11c0 <main+0x90>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11c6 <main+0x96>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11e1 <main+0xb1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11e7 <main+0xb7>
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1204 <main+0xd4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    120a <main+0xda>
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1227 <main+0xf7>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    122d <main+0xfd>
mov    -0x10(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118f <main+0x5f>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xda2(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdcd(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
lea    0xec8(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,(%rsp)
mov    $0x0,%ebx
mov    $0x0,%r14d
jle    11de <main+0xae>
lea    0xea3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r14d
cmpl   $0x2,(%rsp)
jl     11d8 <main+0xa8>
mov    $0x1,%ebp
lea    0xe82(%rip),%r15
lea    0x4(%rsp),%r12
mov    %r14d,%ebx
mov    %r14d,%r13d
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
cmovg  %eax,%r13d
cmp    %ebx,%eax
cmovl  %eax,%ebx
add    %eax,%r14d
add    $0x1,%ebp
cmp    (%rsp),%ebp
jl     11b0 <main+0x80>
jmp    11de <main+0xae>
mov    %r14d,%r13d
mov    %r14d,%ebx
cvtsi2ss %r14d,%xmm0
divss  0xe15(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe57(%rip),%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    $0x1,%al
call   1040 <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 = [33 x i8] c"quantos numeros voc\C3\AA quer ler ?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"informe uma sequencia de %d numeros:\00"
@.str.3 = [47 x i8] c"\0A Maior: %d\0A Menor: %d\0A Soma: %d\0A Media: 4%.2f\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
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %6
store i32 1, i32* %9
%10 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 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* %7)
%12 = load i32, i32* %7
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %57, %0
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %60
18: ; preds = %14
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%20 = load i32, i32* %9
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32, i32* %5
br label %26
24: ; preds = %18
%25 = load i32, i32* %3
br label %26
26: ; preds = %24, %22
%27 = phi i32 [ %23, %22 ], [ %25, %24 ]
store i32 %27, i32* %3
%28 = load i32, i32* %9
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32, i32* %5
br label %34
32: ; preds = %26
%33 = load i32, i32* %4
br label %34
34: ; preds = %32, %30
%35 = phi i32 [ %31, %30 ], [ %33, %32 ]
store i32 %35, i32* %4
%36 = load i32, i32* %5
%37 = load i32, i32* %3
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load i32, i32* %5
br label %43
41: ; preds = %34
%42 = load i32, i32* %3
br label %43
43: ; preds = %41, %39
%44 = phi i32 [ %40, %39 ], [ %42, %41 ]
store i32 %44, i32* %3
%45 = load i32, i32* %5
%46 = load i32, i32* %4
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = load i32, i32* %5
br label %52
50: ; preds = %43
%51 = load i32, i32* %4
br label %52
52: ; preds = %50, %48
%53 = phi i32 [ %49, %48 ], [ %51, %50 ]
store i32 %53, i32* %4
%54 = load i32, i32* %5
%55 = load i32, i32* %2
%56 = add nsw i32 %55, %54
store i32 %56, i32* %2
store i32 0, i32* %9
br label %57
57: ; preds = %52
%58 = load i32, i32* %6
%59 = add nsw i32 %58, 1
store i32 %59, i32* %6
br label %14
60: ; preds = %14
%61 = load i32, i32* %2
%62 = sitofp i32 %61 to float
%63 = fdiv float %62, 2.000000e+01
store float %63, float* %8
%64 = load i32, i32* %3
%65 = load i32, i32* %4
%66 = load i32, i32* %2
%67 = load float, float* %8
%68 = fpext float %67 to double
%69 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %64, i32 %65, i32 %66, double %68)
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
@.str = [33 x i8] c"quantos numeros voc\C3\AA quer ler ?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"informe uma sequencia de %d numeros:\00"
@.str.3 = [47 x i8] c"\0A Maior: %d\0A Menor: %d\0A Soma: %d\0A Media: 4%.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %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 = load i32, i32* %2
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %31
16: ; preds = %11, %16
%17 = phi i32 [ %27, %16 ], [ %13, %11 ]
%18 = phi i32 [ %28, %16 ], [ 1, %11 ]
%19 = phi i32 [ %26, %16 ], [ %13, %11 ]
%20 = phi i32 [ %24, %16 ], [ %13, %11 ]
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, %20
%24 = select i1 %23, i32 %22, i32 %20
%25 = icmp slt i32 %22, %19
%26 = select i1 %25, i32 %22, i32 %19
%27 = add nsw i32 %22, %17
%28 = add nuw nsw i32 %18, 1
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %16, label %31
31: ; preds = %16, %11, %0
%32 = phi i32 [ 0, %0 ], [ %13, %11 ], [ %24, %16 ]
%33 = phi i32 [ 0, %0 ], [ %13, %11 ], [ %26, %16 ]
%34 = phi i32 [ 0, %0 ], [ %13, %11 ], [ %27, %16 ]
%35 = sitofp i32 %34 to float
%36 = fdiv float %35, 2.000000e+01
%37 = fpext float %36 to double
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %32, i32 %33, i32 %34, double %37)
ret i32 0
}