#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 EXIT_SUCCESS;
scalar_t__ integraton_test();
int /*<<< orphan*/ printf(char *, float, int, float, ...);
int main(int argc, char **argv) {
  long sum = 0;
  for (int i = 0; i < 10; ++i) {
    sum += integraton_test();
  }
  float avg = (float)sum / 10;
  printf("\n Ran code %d times, sum is: %ld, average is: %ld/%d = %f", 10, sum,
         sum, 10, avg);
  float percnt = (avg / 400000) * 100;
  printf("\n False positive error percentage: %f/%d is:  %f", avg, 400000,
         percnt);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    116c <main+0x4c>
mov    $0x0,%al
call   1030 <integraton_test@plt>
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1145 <main+0x25>
cvtsi2ssq -0x18(%rbp),%xmm0
movss  0xe8e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%esi
cvtsi2ssq -0x18(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
lea    0xe6d(%rip),%rdi
movss  0xe61(%rip),%xmm0
mov    $0xa,%edx
mov    $0x3,%al
call   1040 <printf@plt>
movss  -0x20(%rbp),%xmm0
movss  0xe44(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xe34(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
lea    0xe60(%rip),%rdi
mov    $0x61a80,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0x2de7(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <integraton_test@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
xor    %eax,%eax
call   1030 <integraton_test@plt>
add    %rax,%rbx
cvtsi2ss %rbx,%xmm1
movss  0xe6a(%rip),%xmm0
movaps %xmm1,%xmm2
divss  %xmm0,%xmm2
movss  %xmm2,0xc(%rsp)
cvtss2sd %xmm2,%xmm2
lea    0xe5e(%rip),%rdi
mov    %ebx,%esi
mov    $0xa,%edx
mov    $0x3,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,%xmm1
divss  0xe37(%rip),%xmm1
mulss  0xe33(%rip),%xmm1
lea    0xe6a(%rip),%rdi
mov    $0x61a80,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"\0A Ran code %d times, sum is: %ld, average is: %ld/%d = %f\00"
@.str.1 = [49 x i8] c"\0A False positive error percentage: %f/%d is: %f\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca float
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i32 0, i32* %7
br label %10
10: ; preds = %17, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = call i64 (...) @integraton_test()
%15 = load i64, i64* %6
%16 = add nsw i64 %15, %14
store i64 %16, i64* %6
br label %17
17: ; preds = %13
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %10
20: ; preds = %10
%21 = load i64, i64* %6
%22 = sitofp i64 %21 to float
%23 = fdiv float %22, 1.000000e+01
store float %23, float* %8
%24 = load i64, i64* %6
%25 = trunc i64 %24 to i32
%26 = load i64, i64* %6
%27 = sitofp i64 %26 to float
%28 = load float, float* %8
%29 = fpext float %28 to double
%30 = call i32 (i8*, float, i32, float, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), float 1.000000e+01, i32 %25, float %27, i32 10, double %29)
%31 = load float, float* %8
%32 = fdiv float %31, 4.000000e+05
%33 = fmul float %32, 1.000000e+02
store float %33, float* %9
%34 = load float, float* %8
%35 = load float, float* %9
%36 = call i32 (i8*, float, i32, float, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), float %34, i32 400000, float %35)
%37 = load i32, i32* @EXIT_SUCCESS
ret i32 %37
}

LLVM IR (-O2):
@.str = [58 x i8] c"\0A Ran code %d times, sum is: %ld, average is: %ld/%d = %f\00"
@.str.1 = [49 x i8] c"\0A False positive error percentage: %f/%d is: %f\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @integraton_test()
%4 = tail call i64 (...) @integraton_test()
%5 = add nsw i64 %4, %3
%6 = tail call i64 (...) @integraton_test()
%7 = add nsw i64 %6, %5
%8 = tail call i64 (...) @integraton_test()
%9 = add nsw i64 %8, %7
%10 = tail call i64 (...) @integraton_test()
%11 = add nsw i64 %10, %9
%12 = tail call i64 (...) @integraton_test()
%13 = add nsw i64 %12, %11
%14 = tail call i64 (...) @integraton_test()
%15 = add nsw i64 %14, %13
%16 = tail call i64 (...) @integraton_test()
%17 = add nsw i64 %16, %15
%18 = tail call i64 (...) @integraton_test()
%19 = add nsw i64 %18, %17
%20 = tail call i64 (...) @integraton_test()
%21 = add nsw i64 %20, %19
%22 = sitofp i64 %21 to float
%23 = fdiv float %22, 1.000000e+01
%24 = trunc i64 %21 to i32
%25 = fpext float %23 to double
%26 = tail call i32 (i8*, float, i32, float, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), float 1.000000e+01, i32 %24, float %22, i32 10, double %25)
%27 = fdiv float %23, 4.000000e+05
%28 = fmul float %27, 1.000000e+02
%29 = tail call i32 (i8*, float, i32, float, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), float %23, i32 400000, float %28)
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}