#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 */
double rand_uni(double);
double integral_2(int nsteps) {
  int i;
  double sum;
  double x, y, z, u, v;
  sum = 0.0;
  for (i = 0; i < nsteps; i++) {
    x = rand_uni(0.7);
    y = rand_uni(0.8);
    z = rand_uni(0.9);
    u = rand_uni(1.0);
    v = rand_uni(1.1);
    sum += 6.0 - x * x - y * y - z * z - u * u - v * v;
  }
  return sum * 0.7 * 0.8 * 0.9 * 1.1 / (double)nsteps;
}


x86 assembly (clang, -O0):
<integral_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    127d <integral_2+0x16d>
movsd  0xeda(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xec0(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xea6(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb4(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7a(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe63(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112a <integral_2+0x1a>
movsd  0xd93(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xd7e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd6a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd56(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integral_2>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
xorpd  %xmm0,%xmm0
test   %edi,%edi
jle    1212 <integral_2+0x102>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  0xec3(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0xeb8(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0xead(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xea2(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe97(%rip),%xmm0
call   1030 <rand_uni@plt>
movsd  0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movsd  0xe88(%rip),%xmm1
subsd  %xmm2,%xmm1
movsd  0x18(%rsp),%xmm2
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
add    $0xffffffff,%ebp
jne    1130 <integral_2+0x20>
mulsd  0xe06(%rip),%xmm0
mulsd  0xe06(%rip),%xmm0
mulsd  0xe06(%rip),%xmm0
mulsd  0xe0e(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @integral_2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %2
store double 0.000000e+00, double* %4
store i32 0, i32* %3
br label %10
10: ; preds = %42, %1
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %45
14: ; preds = %10
%15 = call double @rand_uni(double 0x3FE6666666666666)
store double %15, double* %5
%16 = call double @rand_uni(double 8.000000e-01)
store double %16, double* %6
%17 = call double @rand_uni(double 9.000000e-01)
store double %17, double* %7
%18 = call double @rand_uni(double 1.000000e+00)
store double %18, double* %8
%19 = call double @rand_uni(double 1.100000e+00)
store double %19, double* %9
%20 = load double, double* %5
%21 = load double, double* %5
%22 = fneg double %20
%23 = call double @llvm.fmuladd.f64(double %22, double %21, double 6.000000e+00)
%24 = load double, double* %6
%25 = load double, double* %6
%26 = fneg double %24
%27 = call double @llvm.fmuladd.f64(double %26, double %25, double %23)
%28 = load double, double* %7
%29 = load double, double* %7
%30 = fneg double %28
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double %27)
%32 = load double, double* %8
%33 = load double, double* %8
%34 = fneg double %32
%35 = call double @llvm.fmuladd.f64(double %34, double %33, double %31)
%36 = load double, double* %9
%37 = load double, double* %9
%38 = fneg double %36
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %35)
%40 = load double, double* %4
%41 = fadd double %40, %39
store double %41, double* %4
br label %42
42: ; preds = %14
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %10
45: ; preds = %10
%46 = load double, double* %4
%47 = fmul double %46, 0x3FE6666666666666
%48 = fmul double %47, 8.000000e-01
%49 = fmul double %48, 9.000000e-01
%50 = fmul double %49, 1.100000e+00
%51 = load i32, i32* %2
%52 = sitofp i32 %51 to double
%53 = fdiv double %50, %52
ret double %53
}

LLVM IR (-O2):
define double @integral_2(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %29
3: ; preds = %1, %3
%4 = phi i32 [ %22, %3 ], [ 0, %1 ]
%5 = phi double [ %21, %3 ], [ 0.000000e+00, %1 ]
%6 = tail call double @rand_uni(double 0x3FE6666666666666)
%7 = tail call double @rand_uni(double 8.000000e-01)
%8 = tail call double @rand_uni(double 9.000000e-01)
%9 = tail call double @rand_uni(double 1.000000e+00)
%10 = tail call double @rand_uni(double 1.100000e+00)
%11 = fneg double %6
%12 = tail call double @llvm.fmuladd.f64(double %11, double %6, double 6.000000e+00)
%13 = fneg double %7
%14 = tail call double @llvm.fmuladd.f64(double %13, double %7, double %12)
%15 = fneg double %8
%16 = tail call double @llvm.fmuladd.f64(double %15, double %8, double %14)
%17 = fneg double %9
%18 = tail call double @llvm.fmuladd.f64(double %17, double %9, double %16)
%19 = fneg double %10
%20 = tail call double @llvm.fmuladd.f64(double %19, double %10, double %18)
%21 = fadd double %5, %20
%22 = add nuw nsw i32 %4, 1
%23 = icmp eq i32 %22, %0
br i1 %23, label %24, label %3
24: ; preds = %3
%25 = fmul double %21, 0x3FE6666666666666
%26 = fmul double %25, 8.000000e-01
%27 = fmul double %26, 9.000000e-01
%28 = fmul double %27, 1.100000e+00
br label %29
29: ; preds = %24, %1
%30 = phi double [ 0.000000e+00, %1 ], [ %28, %24 ]
%31 = sitofp i32 %0 to double
%32 = fdiv double %30, %31
ret double %32
}