float randf() {
  static float buff[55];
  static int ip = 0, jp = 0, kp;
  int i, seed, get_i_variable();
  static double xva;
  if (ip == 0 && jp == 0) {
    seed = get_i_variable("seed");
    for (ip = 0; ip < 55; ip++) {
      seed = (seed * 2349 + 14867) % 32767;
      buff[ip] = (float)seed / 32767.;
      if (buff[ip] > 1.)
        buff[ip] = buff[ip] - 1.;
      if (buff[ip] < 0.)
        buff[ip] = buff[ip] + 1.;
    }
    ip = 23;
    jp = 54;
    kp = 0;
  }
  i = kp;
  xva = buff[jp] + buff[ip];
  if (xva > 1.)
    xva = xva - 1.;
  buff[kp] = xva;
  kp = (kp + 1) % 55;
  ip = (ip + 1) % 55;
  jp = (jp + 1) % 55;
  return buff[i];
}


x86 assembly (clang, -O0):
<randf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2ffd(%rip)
jne    1295 <randf+0x185>
cmpl   $0x0,0x2ff4(%rip)
jne    1295 <randf+0x185>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <get_i_variable@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,0x2fcf(%rip)
cmpl   $0x37,0x2fc8(%rip)
jge    1277 <randf+0x167>
imul   $0x92d,-0x8(%rbp),%eax
add    $0x3a13,%eax
mov    $0x7fff,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe86(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq 0x2f8b(%rip),%rcx
lea    0x2ea8(%rip),%rax
movss  %xmm0,(%rax,%rcx,4)
movslq 0x2f78(%rip),%rcx
lea    0x2e95(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe44(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1200 <randf+0xf0>
movslq 0x2f4f(%rip),%rcx
lea    0x2e6c(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq 0x2f28(%rip),%rcx
lea    0x2e45(%rip),%rax
movss  %xmm0,(%rax,%rcx,4)
movslq 0x2f15(%rip),%rcx
lea    0x2e32(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    125e <randf+0x14e>
movslq 0x2ef1(%rip),%rcx
lea    0x2e0e(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdbd(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq 0x2eca(%rip),%rcx
lea    0x2de7(%rip),%rax
movss  %xmm0,(%rax,%rcx,4)
jmp    1263 <randf+0x153>
mov    0x2eb3(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eaa(%rip)
jmp    114d <randf+0x3d>
movl   $0x17,0x2e9b(%rip)
movl   $0x36,0x2e95(%rip)
movl   $0x0,0x2e8f(%rip)
mov    0x2e89(%rip),%eax
mov    %eax,-0x4(%rbp)
movslq 0x2e7b(%rip),%rcx
lea    0x2d94(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
movslq 0x2e64(%rip),%rcx
lea    0x2d81(%rip),%rax
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x2e58(%rip)
movsd  0x2e50(%rip),%xmm0
movsd  0xd20(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1306 <randf+0x1f6>
movsd  0x2e36(%rip),%xmm0
movsd  0xd06(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2e22(%rip)
movsd  0x2e1a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movslq 0x2e0b(%rip),%rcx
lea    0x2d20(%rip),%rax
movss  %xmm0,(%rax,%rcx,4)
mov    0x2df9(%rip),%eax
add    $0x1,%eax
mov    $0x37,%ecx
cltd
idiv   %ecx
mov    %edx,0x2de8(%rip)
mov    0x2dda(%rip),%eax
add    $0x1,%eax
mov    $0x37,%ecx
cltd
idiv   %ecx
mov    %edx,0x2dc9(%rip)
mov    0x2dc7(%rip),%eax
add    $0x1,%eax
mov    $0x37,%ecx
cltd
idiv   %ecx
mov    %edx,0x2db6(%rip)
movslq -0x4(%rbp),%rcx
lea    0x2ccb(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randf>:
push   %rbx
mov    0x3005(%rip),%ecx
mov    0x3003(%rip),%eax
mov    %ecx,%edx
or     %eax,%edx
jne    1209 <randf+0xf9>
lea    0xede(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_i_variable@plt>
movss  0xec1(%rip),%xmm0
lea    0x2efa(%rip),%rcx
movss  0xeb6(%rip),%xmm1
movss  0xeb2(%rip),%xmm2
xorps  %xmm3,%xmm3
jmp    1176 <randf+0x66>
nopl   0x0(%rax,%rax,1)
movss  %xmm5,(%rbx,%rcx,1)
add    $0x4,%rbx
cmp    $0xdc,%rbx
je     1211 <randf+0x101>
imul   $0x92d,%eax,%eax
mov    %eax,%edx
add    $0x3a13,%edx
movslq %edx,%rdx
imul   $0xffffffff80010003,%rdx,%rdx
shr    $0x20,%rdx
add    %eax,%edx
add    $0x3a13,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0xe,%edx
add    %esi,%edx
mov    %edx,%esi
shl    $0xf,%esi
sub    %esi,%edx
add    %edx,%eax
add    $0x3a13,%eax
xorps  %xmm4,%xmm4
cvtsi2ss %eax,%xmm4
divss  %xmm0,%xmm4
movaps %xmm4,%xmm5
addss  %xmm1,%xmm5
movaps %xmm2,%xmm6
cmpltss %xmm4,%xmm6
andps  %xmm6,%xmm5
andnps %xmm4,%xmm6
orps   %xmm5,%xmm6
ucomiss %xmm6,%xmm3
movaps %xmm6,%xmm7
addss  %xmm2,%xmm7
movaps %xmm6,%xmm5
cmpltss %xmm3,%xmm5
andps  %xmm5,%xmm7
andnps %xmm6,%xmm5
orps   %xmm7,%xmm5
movaps %xmm5,%xmm6
ja     11f8 <randf+0xe8>
movaps %xmm4,%xmm6
ucomiss %xmm2,%xmm4
ja     1160 <randf+0x50>
movaps %xmm6,%xmm5
jmp    1160 <randf+0x50>
mov    0x2f15(%rip),%edx
jmp    121d <randf+0x10d>
xor    %edx,%edx
mov    $0x36,%eax
mov    $0x17,%ecx
mov    %eax,%esi
lea    0x2e1a(%rip),%rdi
movss  (%rdi,%rsi,4),%xmm1
movslq %ecx,%rcx
addss  (%rdi,%rcx,4),%xmm1
movss  0xdc9(%rip),%xmm2
addss  %xmm1,%xmm2
movss  0xdc1(%rip),%xmm0
cmpltss %xmm1,%xmm0
andps  %xmm0,%xmm2
andnps %xmm1,%xmm0
orps   %xmm2,%xmm0
movslq %edx,%rdx
movss  %xmm0,(%rdi,%rdx,4)
mov    %edx,%esi
add    $0x1,%esi
movslq %esi,%rsi
imul   $0x94f2095,%rsi,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x21,%rsi
add    %edi,%esi
imul   $0x37,%esi,%esi
neg    %esi
add    %esi,%edx
add    $0x1,%edx
mov    %edx,0x2e9b(%rip)
mov    %ecx,%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x94f2095,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x21,%rdx
add    %esi,%edx
imul   $0x37,%edx,%edx
neg    %edx
add    %edx,%ecx
add    $0x1,%ecx
mov    %ecx,0x2e67(%rip)
mov    %eax,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x94f2095,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
imul   $0x37,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x2e3f(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@randf.buff = internal global [55 x float] zeroinitializer
@randf.ip = internal global i32 0
@randf.jp = internal global i32 0
@randf.kp = internal global i32 0
@randf.xva = internal global double 0.000000e+00
@.str = [5 x i8] c"seed\00"
define float @randf() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @randf.ip
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %66
5: ; preds = %0
%6 = load i32, i32* @randf.jp
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %66
8: ; preds = %5
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @get_i_variable to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %9, i32* %2
store i32 0, i32* @randf.ip
br label %10
10: ; preds = %62, %8
%11 = load i32, i32* @randf.ip
%12 = icmp slt i32 %11, 55
br i1 %12, label %13, label %65
13: ; preds = %10
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, 2349
%16 = add nsw i32 %15, 14867
%17 = srem i32 %16, 32767
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to float
%20 = fpext float %19 to double
%21 = fdiv double %20, 3.276700e+04
%22 = fptrunc double %21 to float
%23 = load i32, i32* @randf.ip
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %24
store float %22, float* %25
%26 = load i32, i32* @randf.ip
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %27
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = fcmp ogt double %30, 1.000000e+00
br i1 %31, label %32, label %43
32: ; preds = %13
%33 = load i32, i32* @randf.ip
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %34
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = fsub double %37, 1.000000e+00
%39 = fptrunc double %38 to float
%40 = load i32, i32* @randf.ip
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %41
store float %39, float* %42
br label %43
43: ; preds = %32, %13
%44 = load i32, i32* @randf.ip
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %45
%47 = load float, float* %46
%48 = fpext float %47 to double
%49 = fcmp olt double %48, 0.000000e+00
br i1 %49, label %50, label %61
50: ; preds = %43
%51 = load i32, i32* @randf.ip
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %52
%54 = load float, float* %53
%55 = fpext float %54 to double
%56 = fadd double %55, 1.000000e+00
%57 = fptrunc double %56 to float
%58 = load i32, i32* @randf.ip
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %59
store float %57, float* %60
br label %61
61: ; preds = %50, %43
br label %62
62: ; preds = %61
%63 = load i32, i32* @randf.ip
%64 = add nsw i32 %63, 1
store i32 %64, i32* @randf.ip
br label %10
65: ; preds = %10
store i32 23, i32* @randf.ip
store i32 54, i32* @randf.jp
store i32 0, i32* @randf.kp
br label %66
66: ; preds = %65, %5, %0
%67 = load i32, i32* @randf.kp
store i32 %67, i32* %1
%68 = load i32, i32* @randf.jp
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %69
%71 = load float, float* %70
%72 = load i32, i32* @randf.ip
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %73
%75 = load float, float* %74
%76 = fadd float %71, %75
%77 = fpext float %76 to double
store double %77, double* @randf.xva
%78 = load double, double* @randf.xva
%79 = fcmp ogt double %78, 1.000000e+00
br i1 %79, label %80, label %83
80: ; preds = %66
%81 = load double, double* @randf.xva
%82 = fsub double %81, 1.000000e+00
store double %82, double* @randf.xva
br label %83
83: ; preds = %80, %66
%84 = load double, double* @randf.xva
%85 = fptrunc double %84 to float
%86 = load i32, i32* @randf.kp
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %87
store float %85, float* %88
%89 = load i32, i32* @randf.kp
%90 = add nsw i32 %89, 1
%91 = srem i32 %90, 55
store i32 %91, i32* @randf.kp
%92 = load i32, i32* @randf.ip
%93 = add nsw i32 %92, 1
%94 = srem i32 %93, 55
store i32 %94, i32* @randf.ip
%95 = load i32, i32* @randf.jp
%96 = add nsw i32 %95, 1
%97 = srem i32 %96, 55
store i32 %97, i32* @randf.jp
%98 = load i32, i32* %1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %99
%101 = load float, float* %100
ret float %101
}

LLVM IR (-O2):
@randf.buff = internal unnamed_addr global [55 x float] zeroinitializer
@randf.ip = internal unnamed_addr global i32 0
@randf.jp = internal unnamed_addr global i32 0
@randf.kp = internal unnamed_addr global i32 0
@.str = [5 x i8] c"seed\00"
define float @randf() {
%1 = load i32, i32* @randf.ip
%2 = icmp eq i32 %1, 0
%3 = load i32, i32* @randf.jp
%4 = icmp eq i32 %3, 0
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = load i32, i32* @randf.kp
br label %29
8: ; preds = %0
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @get_i_variable to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %27, %10 ]
%12 = phi i32 [ %9, %8 ], [ %15, %10 ]
%13 = mul nsw i32 %12, 2349
%14 = add nsw i32 %13, 14867
%15 = srem i32 %14, 32767
%16 = sitofp i32 %15 to float
%17 = fdiv float %16, 3.276700e+04
%18 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %11
%19 = fcmp ogt float %17, 1.000000e+00
%20 = fadd float %17, -1.000000e+00
%21 = select i1 %19, float %20, float %17
%22 = fcmp olt float %21, 0.000000e+00
%23 = or i1 %19, %22
%24 = fadd float %21, 1.000000e+00
%25 = select i1 %22, float %24, float %21
%26 = select i1 %23, float %25, float %17
store float %26, float* %18
%27 = add nuw nsw i64 %11, 1
%28 = icmp eq i64 %27, 55
br i1 %28, label %29, label %10
29: ; preds = %10, %6
%30 = phi i32 [ %1, %6 ], [ 23, %10 ]
%31 = phi i32 [ %3, %6 ], [ 54, %10 ]
%32 = phi i32 [ %7, %6 ], [ 0, %10 ]
%33 = zext i32 %31 to i64
%34 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %33
%35 = load float, float* %34
%36 = sext i32 %30 to i64
%37 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %36
%38 = load float, float* %37
%39 = fadd float %35, %38
%40 = fcmp ogt float %39, 1.000000e+00
%41 = fadd float %39, -1.000000e+00
%42 = select i1 %40, float %41, float %39
%43 = sext i32 %32 to i64
%44 = getelementptr inbounds [55 x float], [55 x float]* @randf.buff, i64 0, i64 %43
store float %42, float* %44
%45 = add nsw i32 %32, 1
%46 = srem i32 %45, 55
store i32 %46, i32* @randf.kp
%47 = add nsw i32 %30, 1
%48 = srem i32 %47, 55
store i32 %48, i32* @randf.ip
%49 = add nsw i32 %31, 1
%50 = srem i32 %49, 55
store i32 %50, i32* @randf.jp
ret float %42
}