#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 *, float);
int main() {
  int contador;
  float soma = 0, cont, media;
  for (contador = 1; contador <= 100; contador++) {
    soma = soma + contador;
    cont = cont + 1;
  }
  printf("A soma dos numeros de 0_100 é %.0f", soma);
  media = soma / cont;
  printf("\nA media é %.2f", media);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     116b <main+0x5b>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xead(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <main+0x1e>
movss  -0xc(%rbp),%xmm0
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xorps  %xmm0,%xmm0
mov    $0x1,%eax
movss  0xedf(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
lea    0x1(%rax),%ecx
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
addss  %xmm0,%xmm1
addss  %xmm4,%xmm3
addss  %xmm1,%xmm2
lea    0x2(%rax),%ecx
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
addss  %xmm2,%xmm1
lea    0x3(%rax),%ecx
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
addss  %xmm4,%xmm3
addss  %xmm4,%xmm3
addss  %xmm1,%xmm2
addss  %xmm4,%xmm3
lea    0x4(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
addss  %xmm2,%xmm0
addss  %xmm4,%xmm3
add    $0x5,%eax
cmp    $0x65,%eax
jne    1130 <main+0x20>
lea    0xe6e(%rip),%rdi
movss  %xmm3,0x4(%rsp)
movss  %xmm0,(%rsp)
call   1030 <printf@plt>
movss  (%rsp),%xmm0
divss  0x4(%rsp),%xmm0
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"A soma dos numeros de 0_100 \C3\A9 %.0f\00"
@.str.1 = [17 x i8] c"\0AA media \C3\A9 %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store i32 1, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load float, float* %3
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to float
%13 = fadd float %10, %12
store float %13, float* %3
%14 = load float, float* %4
%15 = fadd float %14, 1.000000e+00
store float %15, float* %4
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
%20 = load float, float* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), float %20)
%22 = load float, float* %3
%23 = load float, float* %4
%24 = fdiv float %22, %23
store float %24, float* %5
%25 = load float, float* %5
%26 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"A soma dos numeros de 0_100 \C3\A9 %.0f\00"
@.str.1 = [17 x i8] c"\0AA media \C3\A9 %.2f\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 1, %0 ], [ %24, %1 ]
%3 = phi float [ undef, %0 ], [ %23, %1 ]
%4 = phi float [ 0.000000e+00, %0 ], [ %22, %1 ]
%5 = sitofp i32 %2 to float
%6 = fadd float %4, %5
%7 = fadd float %3, 1.000000e+00
%8 = add nuw nsw i32 %2, 1
%9 = sitofp i32 %8 to float
%10 = fadd float %6, %9
%11 = fadd float %7, 1.000000e+00
%12 = add nuw nsw i32 %2, 2
%13 = sitofp i32 %12 to float
%14 = fadd float %10, %13
%15 = fadd float %11, 1.000000e+00
%16 = add nuw nsw i32 %2, 3
%17 = sitofp i32 %16 to float
%18 = fadd float %14, %17
%19 = fadd float %15, 1.000000e+00
%20 = add nuw nsw i32 %2, 4
%21 = sitofp i32 %20 to float
%22 = fadd float %18, %21
%23 = fadd float %19, 1.000000e+00
%24 = add nuw nsw i32 %2, 5
%25 = icmp eq i32 %24, 101
br i1 %25, label %26, label %1
26: ; preds = %1
%27 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), float %22)
%28 = fdiv float %22, %23
%29 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float %28)
ret i32 0
}