int jrand_(int *n, int *ix, int *iy, int *iz) {
  int ret_val;
  static double u, x;
  *ix = *ix * 171 % 30269;
  *iy = *iy * 172 % 30307;
  *iz = *iz * 170 % 30323;
  x = (double)(*ix) / 30269. + (double)(*iy) / 30307. + (double)(*iz) / 30323.;
  u = x - (int)x;
  ret_val = (int)((double)(*n) * u + 1.);
  return ret_val;
}


x86 assembly (clang, -O0):
<jrand_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
imul   $0xab,(%rax),%eax
mov    $0x763d,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
mov    -0x18(%rbp),%rax
imul   $0xac,(%rax),%eax
mov    $0x7663,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%rax
mov    %edx,(%rax)
mov    -0x20(%rbp),%rax
imul   $0xaa,(%rax),%eax
mov    $0x7673,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
movsd  0xeac(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe90(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe70(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e88(%rip)
movsd  0x2e80(%rip),%xmm0
cvttsd2si 0x2e78(%rip),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2e60(%rip)
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
movsd  0x2e50(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jrand_>:
imul   $0xab,(%rsi),%eax
movslq %eax,%r8
imul   $0x4548a88b,%r8,%rax
mov    %rax,%r9
shr    $0x3f,%r9
shr    $0x20,%rax
sar    $0xd,%eax
add    %r9d,%eax
imul   $0x763d,%eax,%eax
sub    %eax,%r8d
mov    %r8d,(%rsi)
imul   $0xac,(%rdx),%eax
movslq %eax,%r8
imul   $0x45326b65,%r8,%rax
mov    %rax,%r9
shr    $0x3f,%r9
shr    $0x20,%rax
sar    $0xd,%eax
add    %r9d,%eax
imul   $0x7663,%eax,%eax
sub    %eax,%r8d
mov    %r8d,(%rdx)
imul   $0xaa,(%rcx),%eax
movslq %eax,%r8
imul   $0xffffffff8a522519,%r8,%rax
shr    $0x20,%rax
add    %r8d,%eax
mov    %eax,%r9d
shr    $0x1f,%r9d
sar    $0xe,%eax
add    %r9d,%eax
imul   $0x7673,%eax,%eax
sub    %eax,%r8d
mov    %r8d,(%rcx)
cvtsi2sdl (%rdx),%xmm0
divsd  0xe6a(%rip),%xmm0
movd   %r8d,%xmm1
movd   (%rsi),%xmm2
punpckldq %xmm2,%xmm1
cvtdq2pd %xmm1,%xmm1
divpd  0xe61(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm0
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl (%rdi),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe2a(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
@jrand_.u = internal global double 0.000000e+00
@jrand_.x = internal global double 0.000000e+00
define i32 @jrand_(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = mul nsw i32 %11, 171
%13 = srem i32 %12, 30269
%14 = load i32*, i32** %6
store i32 %13, i32* %14
%15 = load i32*, i32** %7
%16 = load i32, i32* %15
%17 = mul nsw i32 %16, 172
%18 = srem i32 %17, 30307
%19 = load i32*, i32** %7
store i32 %18, i32* %19
%20 = load i32*, i32** %8
%21 = load i32, i32* %20
%22 = mul nsw i32 %21, 170
%23 = srem i32 %22, 30323
%24 = load i32*, i32** %8
store i32 %23, i32* %24
%25 = load i32*, i32** %6
%26 = load i32, i32* %25
%27 = sitofp i32 %26 to double
%28 = fdiv double %27, 3.026900e+04
%29 = load i32*, i32** %7
%30 = load i32, i32* %29
%31 = sitofp i32 %30 to double
%32 = fdiv double %31, 3.030700e+04
%33 = fadd double %28, %32
%34 = load i32*, i32** %8
%35 = load i32, i32* %34
%36 = sitofp i32 %35 to double
%37 = fdiv double %36, 3.032300e+04
%38 = fadd double %33, %37
store double %38, double* @jrand_.x
%39 = load double, double* @jrand_.x
%40 = load double, double* @jrand_.x
%41 = fptosi double %40 to i32
%42 = sitofp i32 %41 to double
%43 = fsub double %39, %42
store double %43, double* @jrand_.u
%44 = load i32*, i32** %5
%45 = load i32, i32* %44
%46 = sitofp i32 %45 to double
%47 = load double, double* @jrand_.u
%48 = call double @llvm.fmuladd.f64(double %46, double %47, double 1.000000e+00)
%49 = fptosi double %48 to i32
store i32 %49, i32* %9
%50 = load i32, i32* %9
ret i32 %50
}

LLVM IR (-O2):
define i32 @jrand_(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, 171
%7 = srem i32 %6, 30269
store i32 %7, i32* %1
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 172
%10 = srem i32 %9, 30307
store i32 %10, i32* %2
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 170
%13 = srem i32 %12, 30323
store i32 %13, i32* %3
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to double
%17 = fdiv double %16, 3.030700e+04
%18 = insertelement <2 x i32> poison, i32 %13, i64 0
%19 = insertelement <2 x i32> %18, i32 %14, i64 1
%20 = sitofp <2 x i32> %19 to <2 x double>
%21 = fdiv <2 x double> %20, <double 3.032300e+04, double 3.026900e+04>
%22 = extractelement <2 x double> %21, i64 1
%23 = fadd double %22, %17
%24 = extractelement <2 x double> %21, i64 0
%25 = fadd double %24, %23
%26 = fptosi double %25 to i32
%27 = sitofp i32 %26 to double
%28 = fsub double %25, %27
%29 = load i32, i32* %0
%30 = sitofp i32 %29 to double
%31 = tail call double @llvm.fmuladd.f64(double %30, double %28, double 1.000000e+00)
%32 = fptosi double %31 to i32
ret i32 %32
}