#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 gaussRNG(double, double);
int /*<<< orphan*/ printf(char *, int, double);
int /*<<< orphan*/ srand48(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  srand48(time(0));
  int i;
  double s, mu, r;
  s = 1;
  mu = 0;
  for (i = 0; i < 10000; i++) {
    r = gaussRNG(mu, s);
    printf("%d\t%lf\n", i, r);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1060 <srand48@plt>
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    11bc <main+0x7c>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <gaussRNG@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <main+0x39>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1060 <srand48@plt>
lea    0xead(%rip),%r14
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
movsd  0xe95(%rip),%xmm1
call   1030 <gaussRNG@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x2710,%ebx
jne    1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d\09%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @time(i32 0)
%7 = call i32 @srand48(i32 %6)
store double 1.000000e+00, double* %3
store double 0.000000e+00, double* %4
store i32 0, i32* %2
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 10000
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load double, double* %4
%13 = load double, double* %3
%14 = call double @gaussRNG(double %12, double %13)
store double %14, double* %5
%15 = load i32, i32* %2
%16 = load double, double* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %15, double %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %8
21: ; preds = %8
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d\09%lf\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand48(i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %7, %3 ]
%5 = tail call double @gaussRNG(double 0.000000e+00, double 1.000000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4, double %5)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 10000
br i1 %8, label %9, label %3
9: ; preds = %3
ret i32 0
}