#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);
float test(int);
int main() {
  float result = 0;
  float it;
  long i;
  for (i = 0; i < 5; i++) {
    it = test(1750000000);
    result = it + result;
  }
  result = result / 5;
  printf("%f\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x5,-0x18(%rbp)
jge    1179 <main+0x59>
mov    $0x684ee180,%edi
call   1040 <test@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113f <main+0x1f>
movss  -0x8(%rbp),%xmm0
movss  0xe7a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x684ee180,%edi
call   1040 <test@plt>
xorps  %xmm1,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
mov    $0x684ee180,%edi
call   1040 <test@plt>
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    $0x684ee180,%edi
call   1040 <test@plt>
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    $0x684ee180,%edi
call   1040 <test@plt>
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    $0x684ee180,%edi
call   1040 <test@plt>
addss  0x4(%rsp),%xmm0
divss  0xe6e(%rip),%xmm0
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call float @test(i32 1750000000)
%2 = fadd float %1, 0.000000e+00
%3 = tail call float @test(i32 1750000000)
%4 = fadd float %2, %3
%5 = tail call float @test(i32 1750000000)
%6 = fadd float %4, %5
%7 = tail call float @test(i32 1750000000)
%8 = fadd float %6, %7
%9 = tail call float @test(i32 1750000000)
%10 = fadd float %8, %9
%11 = fdiv float %10, 5.000000e+00
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %11)
ret i32 0
}