#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 random();
float randn(void) {
  int sum = 0, i;
  for (i = 0; i < 16; i++)
    sum += random() & 0xfff;
  return (sum - 0x8000) * (1.0 / 4729.7);
}


x86 assembly (clang, -O0):
<randn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    1150 <randn+0x40>
mov    $0x0,%al
call   1030 <random@plt>
and    $0xfff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <randn+0x16>
mov    -0x4(%rbp),%eax
sub    $0x8000,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe9c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randn>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
and    $0xfff,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
and    $0xfff,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <random@plt>
and    $0xfff,%eax
add    %ebx,%eax
add    $0xffff8000,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xdd1(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @randn() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 16
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = call i32 (...) @random()
%8 = and i32 %7, 4095
%9 = load i32, i32* %1
%10 = add nsw i32 %9, %8
store i32 %10, i32* %1
br label %11
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
%15 = load i32, i32* %1
%16 = sub nsw i32 %15, 32768
%17 = sitofp i32 %16 to double
%18 = fmul double %17, 0x3F2BB66903EF59D0
%19 = fptrunc double %18 to float
ret float %19
}

LLVM IR (-O2):
define float @randn() {
%1 = tail call i32 (...) @random()
%2 = and i32 %1, 4095
%3 = tail call i32 (...) @random()
%4 = and i32 %3, 4095
%5 = add nuw nsw i32 %4, %2
%6 = tail call i32 (...) @random()
%7 = and i32 %6, 4095
%8 = add nuw nsw i32 %7, %5
%9 = tail call i32 (...) @random()
%10 = and i32 %9, 4095
%11 = add nuw nsw i32 %10, %8
%12 = tail call i32 (...) @random()
%13 = and i32 %12, 4095
%14 = add nuw nsw i32 %13, %11
%15 = tail call i32 (...) @random()
%16 = and i32 %15, 4095
%17 = add nuw nsw i32 %16, %14
%18 = tail call i32 (...) @random()
%19 = and i32 %18, 4095
%20 = add nuw nsw i32 %19, %17
%21 = tail call i32 (...) @random()
%22 = and i32 %21, 4095
%23 = add nuw nsw i32 %22, %20
%24 = tail call i32 (...) @random()
%25 = and i32 %24, 4095
%26 = add nuw nsw i32 %25, %23
%27 = tail call i32 (...) @random()
%28 = and i32 %27, 4095
%29 = add nuw nsw i32 %28, %26
%30 = tail call i32 (...) @random()
%31 = and i32 %30, 4095
%32 = add nuw nsw i32 %31, %29
%33 = tail call i32 (...) @random()
%34 = and i32 %33, 4095
%35 = add nuw nsw i32 %34, %32
%36 = tail call i32 (...) @random()
%37 = and i32 %36, 4095
%38 = add nuw nsw i32 %37, %35
%39 = tail call i32 (...) @random()
%40 = and i32 %39, 4095
%41 = add nuw nsw i32 %40, %38
%42 = tail call i32 (...) @random()
%43 = and i32 %42, 4095
%44 = add nuw nsw i32 %43, %41
%45 = tail call i32 (...) @random()
%46 = and i32 %45, 4095
%47 = add nuw nsw i32 %46, %44
%48 = add nsw i32 %47, -32768
%49 = sitofp i32 %48 to double
%50 = fmul double %49, 0x3F2BB66903EF59D0
%51 = fptrunc double %50 to float
ret float %51
}