#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 number = 1;
  float media = 0;
  for (number; number <= 100; number++) {
    media = media + number;
  }
  media = media / 100;
  printf("\n %3.2f", media);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
xorps  %xmm0,%xmm0
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  %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
lea    0x4(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
addss  %xmm1,%xmm2
addss  %xmm2,%xmm0
add    $0x5,%eax
cmp    $0x65,%eax
jne    1120 <main+0x10>
push   %rax
divss  0xe8c(%rip),%xmm0
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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