#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, int, float);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int soma = 0, maior = 0, menor = 0, numero, i = 0;
  float media;
  int flag = 1;
  puts("informe uma sequencia de 20 numeros:");
  for (; i < 4; 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    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x4,-0x18(%rbp)
jge    122e <main+0xfe>
lea    0xeaa(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
je     119d <main+0x6d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11a3 <main+0x73>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11be <main+0x8e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11c4 <main+0x94>
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11e1 <main+0xb1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11e7 <main+0xb7>
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1204 <main+0xd4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    120a <main+0xda>
mov    -0x10(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116e <main+0x3e>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  0xdc5(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
movss  -0x1c(%rbp),%xmm0
lea    0xdd3(%rip),%rdi
call   1040 <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    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%r15
lea    0x4(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r13d
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
cmp    %r13d,%ebx
mov    %r13d,%r14d
cmovg  %ebx,%r14d
mov    %r13d,%ebp
cmovl  %ebx,%ebp
add    %r13d,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r14d,%eax
cmovg  %eax,%r14d
cmp    %ebp,%eax
cmovl  %eax,%ebp
add    %eax,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r14d,%eax
cmovg  %eax,%r14d
cmp    %ebp,%eax
cmovl  %eax,%ebp
add    %eax,%ebx
cvtsi2ss %ebx,%xmm0
divss  0xe35(%rip),%xmm0
lea    0xe5a(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
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 = [37 x i8] c"informe uma sequencia de 20 numeros:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [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 float
%8 = 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* %8
%9 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %52, %0
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %55
13: ; preds = %10
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%15 = load i32, i32* %8
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load i32, i32* %5
br label %21
19: ; preds = %13
%20 = load i32, i32* %3
br label %21
21: ; preds = %19, %17
%22 = phi i32 [ %18, %17 ], [ %20, %19 ]
store i32 %22, i32* %3
%23 = load i32, i32* %8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %5
br label %29
27: ; preds = %21
%28 = load i32, i32* %4
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
store i32 %30, i32* %4
%31 = load i32, i32* %5
%32 = load i32, i32* %3
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = load i32, i32* %5
br label %38
36: ; preds = %29
%37 = load i32, i32* %3
br label %38
38: ; preds = %36, %34
%39 = phi i32 [ %35, %34 ], [ %37, %36 ]
store i32 %39, i32* %3
%40 = load i32, i32* %5
%41 = load i32, i32* %4
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = load i32, i32* %5
br label %47
45: ; preds = %38
%46 = load i32, i32* %4
br label %47
47: ; preds = %45, %43
%48 = phi i32 [ %44, %43 ], [ %46, %45 ]
store i32 %48, i32* %4
%49 = load i32, i32* %5
%50 = load i32, i32* %2
%51 = add nsw i32 %50, %49
store i32 %51, i32* %2
store i32 0, i32* %8
br label %52
52: ; preds = %47
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %10
55: ; preds = %10
%56 = load i32, i32* %2
%57 = sitofp i32 %56 to float
%58 = fdiv float %57, 2.000000e+01
store float %58, float* %7
%59 = load i32, i32* %3
%60 = load i32, i32* %4
%61 = load i32, i32* %2
%62 = load float, float* %7
%63 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %59, i32 %60, i32 %61, float %62)
%64 = load i32, i32* %1
ret i32 %64
}

LLVM IR (-O2):
@.str = [37 x i8] c"informe uma sequencia de 20 numeros:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [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 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 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 = call i32 @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 sgt i32 %7, %5
%9 = select i1 %8, i32 %7, i32 %5
%10 = icmp slt i32 %7, %5
%11 = select i1 %10, i32 %7, i32 %5
%12 = add nsw i32 %7, %5
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, %9
%16 = select i1 %15, i32 %14, i32 %9
%17 = icmp slt i32 %14, %11
%18 = select i1 %17, i32 %14, i32 %11
%19 = add nsw i32 %14, %12
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, %16
%23 = select i1 %22, i32 %21, i32 %16
%24 = icmp slt i32 %21, %18
%25 = select i1 %24, i32 %21, i32 %18
%26 = add nsw i32 %21, %19
%27 = sitofp i32 %26 to float
%28 = fdiv float %27, 2.000000e+01
%29 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %25, i32 %26, float %28)
ret i32 0
}