#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 *);
int main() {
  int n1, n2, n3, n4;
  float media;
  printf("Escreva 4 números inteiros");
  printf("Escreva o primeiro número ");
  scanf("%d", &n1);
  printf("Escreva o segundo número ");
  scanf("%d", &n2);
  printf("Escreva o terceiro número ");
  scanf("%d", &n3);
  printf("Escreva o quarto número ");
  scanf("%d", &n4);
  media = ((float)n1 + n2 + n3 + n4) / 4;
  printf("A média aritimética dos números listado é: %.2f ", media);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
addss  %xmm1,%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
addss  %xmm1,%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  0xe23(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cvtsi2ssl 0xc(%rsp),%xmm0
cvtsi2ssl 0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0x4(%rsp),%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssl (%rsp),%xmm1
addss  %xmm0,%xmm1
mulss  0xe2b(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xead(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Escreva 4 n\C3\BAmeros inteiros\00"
@.str.1 = [28 x i8] c"Escreva o primeiro n\C3\BAmero \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [27 x i8] c"Escreva o segundo n\C3\BAmero \00"
@.str.4 = [28 x i8] c"Escreva o terceiro n\C3\BAmero \00"
@.str.5 = [26 x i8] c"Escreva o quarto n\C3\BAmero \00"
@.str.6 = [53 x i8] c"A m\C3\A9dia aritim\C3\A9tica dos n\C3\BAmeros listado \C3\A9: %.2f \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%16 = load i32, i32* %2
%17 = sitofp i32 %16 to float
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
%20 = fadd float %17, %19
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to float
%23 = fadd float %20, %22
%24 = load i32, i32* %5
%25 = sitofp i32 %24 to float
%26 = fadd float %23, %25
%27 = fdiv float %26, 4.000000e+00
store float %27, float* %6
%28 = load float, float* %6
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), double %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Escreva 4 n\C3\BAmeros inteiros\00"
@.str.1 = [28 x i8] c"Escreva o primeiro n\C3\BAmero \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [27 x i8] c"Escreva o segundo n\C3\BAmero \00"
@.str.4 = [28 x i8] c"Escreva o terceiro n\C3\BAmero \00"
@.str.5 = [26 x i8] c"Escreva o quarto n\C3\BAmero \00"
@.str.6 = [53 x i8] c"A m\C3\A9dia aritim\C3\A9tica dos n\C3\BAmeros listado \C3\A9: %.2f \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %1
%19 = sitofp i32 %18 to float
%20 = load i32, i32* %2
%21 = sitofp i32 %20 to float
%22 = fadd float %19, %21
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to float
%25 = fadd float %22, %24
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to float
%28 = fadd float %25, %27
%29 = fmul float %28, 2.500000e-01
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), double %30)
ret i32 0
}