#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 edisrnd(double *);
double nordisrnd(double u, double g, double *r) {
  double value;
  int i;
  for (i = 1, value = 0.0; i <= 12; i++)
    value = value + edisrnd(r);
  value = u + g * (value - 6.0);
  return (value);
}


x86 assembly (clang, -O0):
<nordisrnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0xc,-0x24(%rbp)
jg     1171 <nordisrnd+0x61>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <edisrnd@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1135 <nordisrnd+0x25>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xe78(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nordisrnd>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
call   1030 <edisrnd@plt>
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <edisrnd@plt>
addsd  0x8(%rsp),%xmm0
addsd  0xdeb(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @nordisrnd(double %0, double %1, double* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double*
%7 = alloca double
%8 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double* %2, double** %6
store i32 1, i32* %8
store double 0.000000e+00, double* %7
br label %9
9: ; preds = %17, %3
%10 = load i32, i32* %8
%11 = icmp sle i32 %10, 12
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load double, double* %7
%14 = load double*, double** %6
%15 = call double @edisrnd(double* %14)
%16 = fadd double %13, %15
store double %16, double* %7
br label %17
17: ; preds = %12
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
store i32 %19, i32* %8
br label %9
20: ; preds = %9
%21 = load double, double* %4
%22 = load double, double* %5
%23 = load double, double* %7
%24 = fsub double %23, 6.000000e+00
%25 = call double @llvm.fmuladd.f64(double %22, double %24, double %21)
store double %25, double* %7
%26 = load double, double* %7
ret double %26
}

LLVM IR (-O2):
define double @nordisrnd(double %0, double %1, double* %2) {
%4 = tail call double @edisrnd(double* %2)
%5 = fadd double %4, 0.000000e+00
%6 = tail call double @edisrnd(double* %2)
%7 = fadd double %5, %6
%8 = tail call double @edisrnd(double* %2)
%9 = fadd double %7, %8
%10 = tail call double @edisrnd(double* %2)
%11 = fadd double %9, %10
%12 = tail call double @edisrnd(double* %2)
%13 = fadd double %11, %12
%14 = tail call double @edisrnd(double* %2)
%15 = fadd double %13, %14
%16 = tail call double @edisrnd(double* %2)
%17 = fadd double %15, %16
%18 = tail call double @edisrnd(double* %2)
%19 = fadd double %17, %18
%20 = tail call double @edisrnd(double* %2)
%21 = fadd double %19, %20
%22 = tail call double @edisrnd(double* %2)
%23 = fadd double %21, %22
%24 = tail call double @edisrnd(double* %2)
%25 = fadd double %23, %24
%26 = tail call double @edisrnd(double* %2)
%27 = fadd double %25, %26
%28 = fadd double %27, -6.000000e+00
%29 = tail call double @llvm.fmuladd.f64(double %1, double %28, double %0)
ret double %29
}