double randum() {
  static int r1 = 1271199957, r2 = 1013501921;
  static double h1l = 65533.0, h1u = 32767.0;
  int isc, i1;
  double randum, r0, r3, asc, dir;
  isc = 65536;
  asc = (double)isc;
  dir = asc * asc;
  i1 = r1 - (r1 / isc) * isc;
  r3 = h1l * (double)r1 + asc * h1u * (double)i1;
  i1 = r3 / dir;
  r3 = r3 - ((double)i1) * dir;
  dir = 0.5 * dir;
  i1 = r2 / isc;
  isc = r2 - i1 * isc;
  r0 = h1l * (double)r2 + asc * h1u * (double)isc;
  asc = 1.0 / dir;
  isc = r0 * asc;
  r2 = r0 - ((double)isc) * dir;
  r3 = r3 + ((double)isc + 2.0 * h1u * (double)i1);
  isc = r3 * asc;
  r1 = r3 - ((double)isc) * dir;
  randum = ((double)r1 + ((double)r2) * asc) * asc;
  return randum;
}


x86 assembly (clang, -O0):
<randum>:
push   %rbp
mov    %rsp,%rbp
movl   $0x10000,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2ef6(%rip),%eax
mov    %eax,-0x34(%rbp)
mov    0x2eed(%rip),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
imul   -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
movsd  0x2edb(%rip),%xmm0
cvtsi2sdl 0x2ecb(%rip),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  0x2ece(%rip),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe4c(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2e50(%rip),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    0x2e43(%rip),%eax
mov    -0x8(%rbp),%ecx
imul   -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
movsd  0x2e33(%rip),%xmm0
cvtsi2sdl 0x2e27(%rip),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  0x2e26(%rip),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xde0(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,0x2da9(%rip)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xd73(%rip),%xmm1
mulsd  0x2d9b(%rip),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,0x2d2c(%rip)
cvtsi2sdl 0x2d24(%rip),%xmm1
cvtsi2sdl 0x2d20(%rip),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randum>:
mov    0x2f1a(%rip),%eax
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
cvtsi2sd %eax,%xmm0
and    $0xffff0000,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xed7(%rip),%xmm3
mulsd  %xmm3,%xmm1
movsd  0xed3(%rip),%xmm4
mulsd  %xmm4,%xmm0
addsd  %xmm1,%xmm0
movsd  0xecb(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm2
xorpd  0xed7(%rip),%xmm2
mov    0x2ec5(%rip),%eax
lea    0xffff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
mov    %ecx,%edx
sar    $0x10,%edx
and    $0xffff0000,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
sub    %ecx,%eax
cvtsi2sd %eax,%xmm5
mulsd  %xmm3,%xmm5
mulsd  %xmm4,%xmm1
addsd  %xmm5,%xmm1
movsd  0xe82(%rip),%xmm3
movapd %xmm1,%xmm4
mulsd  %xmm3,%xmm4
cvttpd2dq %xmm4,%xmm4
cvtdq2pd %xmm4,%xmm4
movsd  0xe72(%rip),%xmm5
unpcklpd %xmm4,%xmm0
mulsd  %xmm5,%xmm4
subsd  %xmm4,%xmm1
cvttsd2si %xmm1,%eax
xorps  %xmm4,%xmm4
cvtsi2sd %edx,%xmm4
mov    %eax,0x2e59(%rip)
unpcklpd %xmm4,%xmm2
mulpd  0xe69(%rip),%xmm2
addpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm0,%xmm2
mulsd  %xmm3,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm5,%xmm2
subsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm2
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
mov    %eax,0x2e07(%rip)
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
@randum.r1 = internal global i32 1271199957
@randum.r2 = internal global i32 1013501921
@randum.h1l = internal global double 6.553300e+04
@randum.h1u = internal global double 3.276700e+04
define double @randum() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 65536, i32* %1
%8 = load i32, i32* %1
%9 = sitofp i32 %8 to double
store double %9, double* %6
%10 = load double, double* %6
%11 = load double, double* %6
%12 = fmul double %10, %11
store double %12, double* %7
%13 = load i32, i32* @randum.r1
%14 = load i32, i32* @randum.r1
%15 = load i32, i32* %1
%16 = sdiv i32 %14, %15
%17 = load i32, i32* %1
%18 = mul nsw i32 %16, %17
%19 = sub nsw i32 %13, %18
store i32 %19, i32* %2
%20 = load double, double* @randum.h1l
%21 = load i32, i32* @randum.r1
%22 = sitofp i32 %21 to double
%23 = load double, double* %6
%24 = load double, double* @randum.h1u
%25 = fmul double %23, %24
%26 = load i32, i32* %2
%27 = sitofp i32 %26 to double
%28 = fmul double %25, %27
%29 = call double @llvm.fmuladd.f64(double %20, double %22, double %28)
store double %29, double* %5
%30 = load double, double* %5
%31 = load double, double* %7
%32 = fdiv double %30, %31
%33 = fptosi double %32 to i32
store i32 %33, i32* %2
%34 = load double, double* %5
%35 = load i32, i32* %2
%36 = sitofp i32 %35 to double
%37 = load double, double* %7
%38 = fneg double %36
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %34)
store double %39, double* %5
%40 = load double, double* %7
%41 = fmul double 5.000000e-01, %40
store double %41, double* %7
%42 = load i32, i32* @randum.r2
%43 = load i32, i32* %1
%44 = sdiv i32 %42, %43
store i32 %44, i32* %2
%45 = load i32, i32* @randum.r2
%46 = load i32, i32* %2
%47 = load i32, i32* %1
%48 = mul nsw i32 %46, %47
%49 = sub nsw i32 %45, %48
store i32 %49, i32* %1
%50 = load double, double* @randum.h1l
%51 = load i32, i32* @randum.r2
%52 = sitofp i32 %51 to double
%53 = load double, double* %6
%54 = load double, double* @randum.h1u
%55 = fmul double %53, %54
%56 = load i32, i32* %1
%57 = sitofp i32 %56 to double
%58 = fmul double %55, %57
%59 = call double @llvm.fmuladd.f64(double %50, double %52, double %58)
store double %59, double* %4
%60 = load double, double* %7
%61 = fdiv double 1.000000e+00, %60
store double %61, double* %6
%62 = load double, double* %4
%63 = load double, double* %6
%64 = fmul double %62, %63
%65 = fptosi double %64 to i32
store i32 %65, i32* %1
%66 = load double, double* %4
%67 = load i32, i32* %1
%68 = sitofp i32 %67 to double
%69 = load double, double* %7
%70 = fneg double %68
%71 = call double @llvm.fmuladd.f64(double %70, double %69, double %66)
%72 = fptosi double %71 to i32
store i32 %72, i32* @randum.r2
%73 = load double, double* %5
%74 = load i32, i32* %1
%75 = sitofp i32 %74 to double
%76 = load double, double* @randum.h1u
%77 = fmul double 2.000000e+00, %76
%78 = load i32, i32* %2
%79 = sitofp i32 %78 to double
%80 = call double @llvm.fmuladd.f64(double %77, double %79, double %75)
%81 = fadd double %73, %80
store double %81, double* %5
%82 = load double, double* %5
%83 = load double, double* %6
%84 = fmul double %82, %83
%85 = fptosi double %84 to i32
store i32 %85, i32* %1
%86 = load double, double* %5
%87 = load i32, i32* %1
%88 = sitofp i32 %87 to double
%89 = load double, double* %7
%90 = fneg double %88
%91 = call double @llvm.fmuladd.f64(double %90, double %89, double %86)
%92 = fptosi double %91 to i32
store i32 %92, i32* @randum.r1
%93 = load i32, i32* @randum.r1
%94 = sitofp i32 %93 to double
%95 = load i32, i32* @randum.r2
%96 = sitofp i32 %95 to double
%97 = load double, double* %6
%98 = call double @llvm.fmuladd.f64(double %96, double %97, double %94)
%99 = load double, double* %6
%100 = fmul double %98, %99
store double %100, double* %3
%101 = load double, double* %3
ret double %101
}

LLVM IR (-O2):
@randum.r1 = internal unnamed_addr global i32 1271199957
@randum.r2 = internal unnamed_addr global i32 1013501921
define double @randum() {
%1 = load i32, i32* @randum.r1
%2 = srem i32 %1, 65536
%3 = sitofp i32 %1 to double
%4 = sitofp i32 %2 to double
%5 = fmul double %4, 0x41DFFFC000000000
%6 = tail call double @llvm.fmuladd.f64(double %3, double 6.553300e+04, double %5)
%7 = fmul double %6, 0x3DF0000000000000
%8 = fptosi double %7 to i32
%9 = sitofp i32 %8 to double
%10 = fneg double %9
%11 = load i32, i32* @randum.r2
%12 = sdiv i32 %11, 65536
%13 = mul i32 %12, -65536
%14 = add i32 %13, %11
%15 = sitofp i32 %11 to double
%16 = sitofp i32 %14 to double
%17 = fmul double %16, 0x41DFFFC000000000
%18 = tail call double @llvm.fmuladd.f64(double %15, double 6.553300e+04, double %17)
%19 = fmul double %18, 0x3E00000000000000
%20 = fptosi double %19 to i32
%21 = sitofp i32 %20 to double
%22 = fneg double %21
%23 = tail call double @llvm.fmuladd.f64(double %22, double 0x41E0000000000000, double %18)
%24 = fptosi double %23 to i32
store i32 %24, i32* @randum.r2
%25 = sitofp i32 %12 to double
%26 = insertelement <2 x double> poison, double %10, i64 0
%27 = insertelement <2 x double> %26, double %25, i64 1
%28 = insertelement <2 x double> poison, double %6, i64 0
%29 = insertelement <2 x double> %28, double %21, i64 1
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %27, <2 x double> <double 0x41F0000000000000, double 6.553400e+04>, <2 x double> %29)
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%32 = fadd <2 x double> %30, %31
%33 = extractelement <2 x double> %32, i64 0
%34 = fmul double %33, 0x3E00000000000000
%35 = fptosi double %34 to i32
%36 = sitofp i32 %35 to double
%37 = fneg double %36
%38 = tail call double @llvm.fmuladd.f64(double %37, double 0x41E0000000000000, double %33)
%39 = fptosi double %38 to i32
store i32 %39, i32* @randum.r1
%40 = sitofp i32 %39 to double
%41 = sitofp i32 %24 to double
%42 = tail call double @llvm.fmuladd.f64(double %41, double 0x3E00000000000000, double %40)
%43 = fmul double %42, 0x3E00000000000000
ret double %43
}