#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 */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ UINT32_MAX;
scalar_t__ time(int /*<<< orphan*/ *);
double test_c_l(int l, int nsteps, double (*prand)(double)) {
  double x, x_l;
  double accum_x_nl;
  double accum_x_n;
  double accum_x_n2;
  uint32_t z;
  int i;
  z = time(NULL);
  x = prand((double)z / (double)UINT32_MAX);
  x_l = x;
  for (i = 0; i < l; i++) {
    x_l = prand(x_l);
  }
  accum_x_nl = 0.0;
  accum_x_n = 0.0;
  accum_x_n2 = 0.0;
  for (i = 0; i < nsteps; i++) {
    accum_x_nl += x * x_l;
    accum_x_n += x;
    accum_x_n2 += x * x;
    x = prand(x);
    x_l = prand(x_l);
  }
  return (accum_x_nl - accum_x_n * accum_x_n / nsteps) /
         (accum_x_n2 - accum_x_n * accum_x_n / nsteps);
}


x86 assembly (clang, -O0):
<test_c_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
cvtsi2sdq -0x40(%rbp),%xmm0
mov    0x2eb8(%rip),%rcx
cvtsi2sdq (%rcx),%xmm1
divsd  %xmm1,%xmm0
call   *%rax
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118b <test_c_l+0x7b>
mov    -0x10(%rbp),%rax
movsd  -0x20(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x20(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1161 <test_c_l+0x51>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122b <test_c_l+0x11b>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x20(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x20(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11aa <test_c_l+0x9a>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mulsd  -0x30(%rbp),%xmm2
cvtsi2sdl -0x8(%rbp),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_c_l>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %edi,%edi
call   1030 <time@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec5(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
call   *%rbx
movsd  %xmm0,0x8(%rsp)
test   %ebp,%ebp
jle    1157 <test_c_l+0x47>
movsd  0x8(%rsp),%xmm0
xchg   %ax,%ax
call   *%rbx
add    $0xffffffff,%ebp
jne    1150 <test_c_l+0x40>
test   %r14d,%r14d
jle    11e7 <test_c_l+0xd7>
xorpd  %xmm2,%xmm2
mov    %r14d,%ebp
xorpd  %xmm4,%xmm4
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm5
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x10(%rsp)
movapd %xmm5,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm1,%xmm3
movsd  %xmm3,0x20(%rsp)
addsd  %xmm5,%xmm4
movsd  %xmm4,0x18(%rsp)
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x28(%rsp)
movapd %xmm5,%xmm0
call   *%rbx
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   *%rbx
movsd  0x8(%rsp),%xmm5
movsd  0x18(%rsp),%xmm4
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm2
add    $0xffffffff,%ebp
jne    1180 <test_c_l+0x70>
jmp    11f3 <test_c_l+0xe3>
xorpd  %xmm3,%xmm3
xorpd  %xmm4,%xmm4
xorpd  %xmm2,%xmm2
mulsd  %xmm4,%xmm4
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
divsd  %xmm0,%xmm4
subsd  %xmm4,%xmm3
subsd  %xmm4,%xmm2
divsd  %xmm2,%xmm3
movapd %xmm3,%xmm0
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@UINT32_MAX = global i64 0
define double @test_c_l(i32 %0, i32 %1, double (double)* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double (double)*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i64
%13 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store double (double)* %2, double (double)** %6
%14 = call i64 @time(i32* null)
store i64 %14, i64* %12
%15 = load double (double)*, double (double)** %6
%16 = load i64, i64* %12
%17 = sitofp i64 %16 to double
%18 = load i64, i64* @UINT32_MAX
%19 = sitofp i64 %18 to double
%20 = fdiv double %17, %19
%21 = call double %15(double %20)
store double %21, double* %7
%22 = load double, double* %7
store double %22, double* %8
store i32 0, i32* %13
br label %23
23: ; preds = %31, %3
%24 = load i32, i32* %13
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load double (double)*, double (double)** %6
%29 = load double, double* %8
%30 = call double %28(double %29)
store double %30, double* %8
br label %31
31: ; preds = %27
%32 = load i32, i32* %13
%33 = add nsw i32 %32, 1
store i32 %33, i32* %13
br label %23
34: ; preds = %23
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %11
store i32 0, i32* %13
br label %35
35: ; preds = %57, %34
%36 = load i32, i32* %13
%37 = load i32, i32* %5
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %60
39: ; preds = %35
%40 = load double, double* %7
%41 = load double, double* %8
%42 = load double, double* %9
%43 = call double @llvm.fmuladd.f64(double %40, double %41, double %42)
store double %43, double* %9
%44 = load double, double* %7
%45 = load double, double* %10
%46 = fadd double %45, %44
store double %46, double* %10
%47 = load double, double* %7
%48 = load double, double* %7
%49 = load double, double* %11
%50 = call double @llvm.fmuladd.f64(double %47, double %48, double %49)
store double %50, double* %11
%51 = load double (double)*, double (double)** %6
%52 = load double, double* %7
%53 = call double %51(double %52)
store double %53, double* %7
%54 = load double (double)*, double (double)** %6
%55 = load double, double* %8
%56 = call double %54(double %55)
store double %56, double* %8
br label %57
57: ; preds = %39
%58 = load i32, i32* %13
%59 = add nsw i32 %58, 1
store i32 %59, i32* %13
br label %35
60: ; preds = %35
%61 = load double, double* %9
%62 = load double, double* %10
%63 = load double, double* %10
%64 = fmul double %62, %63
%65 = load i32, i32* %5
%66 = sitofp i32 %65 to double
%67 = fdiv double %64, %66
%68 = fsub double %61, %67
%69 = load double, double* %11
%70 = load double, double* %10
%71 = load double, double* %10
%72 = fmul double %70, %71
%73 = load i32, i32* %5
%74 = sitofp i32 %73 to double
%75 = fdiv double %72, %74
%76 = fsub double %69, %75
%77 = fdiv double %68, %76
ret double %77
}

LLVM IR (-O2):
@UINT32_MAX = global i64 0
define double @test_c_l(i32 %0, i32 %1, double (double)* nocapture %2) {
%4 = tail call i64 @time(i32* null)
%5 = sitofp i64 %4 to double
%6 = load i64, i64* @UINT32_MAX
%7 = sitofp i64 %6 to double
%8 = fdiv double %5, %7
%9 = tail call double %2(double %8)
%10 = icmp sgt i32 %0, 0
br i1 %10, label %14, label %11
11: ; preds = %14, %3
%12 = phi double [ %9, %3 ], [ %17, %14 ]
%13 = icmp sgt i32 %1, 0
br i1 %13, label %20, label %34
14: ; preds = %3, %14
%15 = phi i32 [ %18, %14 ], [ 0, %3 ]
%16 = phi double [ %17, %14 ], [ %9, %3 ]
%17 = tail call double %2(double %16)
%18 = add nuw nsw i32 %15, 1
%19 = icmp eq i32 %18, %0
br i1 %19, label %11, label %14
20: ; preds = %11, %20
%21 = phi i32 [ %32, %20 ], [ 0, %11 ]
%22 = phi double [ %30, %20 ], [ %9, %11 ]
%23 = phi double [ %29, %20 ], [ 0.000000e+00, %11 ]
%24 = phi double [ %28, %20 ], [ 0.000000e+00, %11 ]
%25 = phi double [ %27, %20 ], [ 0.000000e+00, %11 ]
%26 = phi double [ %31, %20 ], [ %12, %11 ]
%27 = tail call double @llvm.fmuladd.f64(double %22, double %26, double %25)
%28 = fadd double %24, %22
%29 = tail call double @llvm.fmuladd.f64(double %22, double %22, double %23)
%30 = tail call double %2(double %22)
%31 = tail call double %2(double %26)
%32 = add nuw nsw i32 %21, 1
%33 = icmp eq i32 %32, %1
br i1 %33, label %34, label %20
34: ; preds = %20, %11
%35 = phi double [ 0.000000e+00, %11 ], [ %27, %20 ]
%36 = phi double [ 0.000000e+00, %11 ], [ %28, %20 ]
%37 = phi double [ 0.000000e+00, %11 ], [ %29, %20 ]
%38 = fmul double %36, %36
%39 = sitofp i32 %1 to double
%40 = fdiv double %38, %39
%41 = fsub double %35, %40
%42 = fsub double %37, %40
%43 = fdiv double %41, %42
ret double %43
}