#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 /*<<< orphan*/ dump_error(char *);
double ran1(int *idum) {
  static int ix1, ix2, ix3;
  static double r[98];
  double temp;
  static int iff = 0;
  int j;
  if (*idum < 0 || iff == 0) {
    iff = 1;
    ix1 = (54773l - (*idum)) % 259200l;
    ix1 = (7141l * ix1 + 54773l) % 259200l;
    ix2 = ix1 % 134456l;
    ix1 = (7141l * ix1 + 54773l) % 259200l;
    ix3 = ix1 % 243000l;
    for (j = 1; j <= 97; j++) {
      ix1 = (7141l * ix1 + 54773l) % 259200l;
      ix2 = (8121l * ix2 + 28411l) % 134456l;
      r[j] = (ix1 + ix2 * (1.0 / 134456l)) * (1.0 / 259200l);
    }
    *idum = 1;
  }
  ix1 = (7141l * ix1 + 54773l) % 259200l;
  ix2 = (8121l * ix2 + 28411l) % 134456l;
  ix3 = (4561l * ix3 + 51349l) % 243000l;
  j = (int)(1 + ((97 * ix3) / 243000l));
  if (j > 97 || j < 1)
    dump_error("RAN1: This cannot happen.");
  temp = r[j];
  r[j] = (ix1 + ix2 * (1.0 / 134456l)) * (1.0 / 259200l);
  return temp;
}


x86 assembly (clang, -O0):
<ran1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jl     1136 <ran1+0x26>
cmpl   $0x0,0x3230(%rip)
jne    1290 <ran1+0x180>
movl   $0x1,0x3220(%rip)
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
mov    $0xd5f5,%eax
sub    %rcx,%rax
mov    $0x3f480,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2edf(%rip)
movslq 0x2ed8(%rip),%rax
imul   $0x1be5,%rax,%rax
add    $0xd5f5,%rax
mov    $0x3f480,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2eb9(%rip)
movslq 0x2eb2(%rip),%rax
mov    $0x20d38,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2ea4(%rip)
movslq 0x2e99(%rip),%rax
imul   $0x1be5,%rax,%rax
add    $0xd5f5,%rax
mov    $0x3f480,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2e7a(%rip)
movslq 0x2e73(%rip),%rax
mov    $0x3b538,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2e69(%rip)
movl   $0x1,-0x14(%rbp)
cmpl   $0x61,-0x14(%rbp)
jg     1286 <ran1+0x176>
movslq 0x2e49(%rip),%rax
imul   $0x1be5,%rax,%rax
add    $0xd5f5,%rax
mov    $0x3f480,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2e2a(%rip)
movslq 0x2e27(%rip),%rax
imul   $0x1fb9,%rax,%rax
add    $0x6efb,%rax
mov    $0x20d38,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2e08(%rip)
cvtsi2sdl 0x2dfc(%rip),%xmm1
cvtsi2sdl 0x2df8(%rip),%xmm0
movsd  0xdb4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd9c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movslq -0x14(%rbp),%rcx
lea    0x2ddd(%rip),%rax
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e6 <ran1+0xd6>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
movslq 0x2da9(%rip),%rax
imul   $0x1be5,%rax,%rax
add    $0xd5f5,%rax
mov    $0x3f480,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2d8a(%rip)
movslq 0x2d87(%rip),%rax
imul   $0x1fb9,%rax,%rax
add    $0x6efb,%rax
mov    $0x20d38,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2d68(%rip)
movslq 0x2d65(%rip),%rax
imul   $0x11d1,%rax,%rax
add    $0xc895,%rax
mov    $0x3b538,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,0x2d46(%rip)
imul   $0x61,0x2d3f(%rip),%eax
cltq
mov    $0x3b538,%ecx
cqto
idiv   %rcx
add    $0x1,%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x61,-0x14(%rbp)
jg     1330 <ran1+0x220>
cmpl   $0x1,-0x14(%rbp)
jge    133c <ran1+0x22c>
lea    0xcd9(%rip),%rdi
call   1030 <dump_error@plt>
movslq -0x14(%rbp),%rcx
lea    0x2d09(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl 0x2ce7(%rip),%xmm1
cvtsi2sdl 0x2ce3(%rip),%xmm0
movsd  0xc9f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc87(%rip),%xmm1
mulsd  %xmm1,%xmm0
movslq -0x14(%rbp),%rcx
lea    0x2cc8(%rip),%rax
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ran1>:
push   %r14
push   %rbx
push   %rax
movslq (%rdi),%rax
movabs $0x81742e044c5b8725,%r9
2e 74 81
movabs $0x1f31d2b36647fc39,%r8
d2 31 1f
test   %rax,%rax
js     1152 <ran1+0x42>
testb  $0x1,0x3229(%rip)
je     1152 <ran1+0x42>
mov    0x2f00(%rip),%r11d
mov    0x2efe(%rip),%ecx
mov    0x2efb(%rip),%r10d
jmp    12ed <ran1+0x1dd>
mov    $0xd5f5,%ecx
sub    %rax,%rcx
mov    %rcx,%rax
imul   %r9
movb   $0x1,0x31f9(%rip)
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x11,%rdx
add    %eax,%edx
imul   $0x3f480,%edx,%eax
sub    %eax,%ecx
imul   $0x1be5,%ecx,%eax
mov    %eax,%ecx
add    $0xd5f5,%ecx
movslq %ecx,%rcx
imul   $0xffffffff81742e05,%rcx,%rdx
shr    $0x20,%rdx
add    %edx,%eax
add    $0xd5f5,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x11,%eax
add    %edx,%eax
imul   $0x3f480,%eax,%eax
sub    %eax,%ecx
movslq %ecx,%rcx
imul   $0x3e63a567,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
sar    $0xf,%eax
add    %edx,%eax
imul   $0x20d38,%eax,%eax
imul   $0x1be5,%ecx,%edx
sub    %eax,%ecx
mov    %edx,%eax
add    $0xd5f5,%eax
movslq %eax,%r11
imul   $0xffffffff81742e05,%r11,%rax
shr    $0x20,%rax
add    %edx,%eax
add    $0xd5f5,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x11,%eax
add    %edx,%eax
imul   $0x3f480,%eax,%eax
sub    %eax,%r11d
movslq %r11d,%r10
imul   $0x2285619b,%r10,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x2f,%rax
add    %edx,%eax
imul   $0x3b538,%eax,%eax
sub    %eax,%r10d
mov    $0x1,%esi
movsd  0xdc8(%rip),%xmm0
movsd  0xdc8(%rip),%xmm1
lea    0x2e09(%rip),%r14
nopw   0x0(%rax,%rax,1)
movslq %r11d,%rax
imul   $0x1be5,%rax,%rbx
lea    0xd5f5(%rbx),%r11
mov    %r11,%rax
imul   %r9
lea    (%rdx,%rbx,1),%rax
add    $0xd5f5,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x11,%rax
add    %rdx,%rax
imul   $0x3f480,%rax,%rbx
movslq %ecx,%rax
imul   $0x1fb9,%rax,%rcx
add    $0x6efb,%rcx
mov    %rcx,%rax
imul   %r8
sub    %rbx,%r11
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xe,%rdx
add    %rax,%rdx
imul   $0x20d38,%rdx,%rax
sub    %rax,%rcx
xorps  %xmm2,%xmm2
cvtsi2sd %r11d,%xmm2
xorps  %xmm3,%xmm3
cvtsi2sd %ecx,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
movsd  %xmm3,(%r14,%rsi,8)
add    $0x1,%rsi
cmp    $0x62,%rsi
jne    1250 <ran1+0x140>
movl   $0x1,(%rdi)
movslq %r11d,%rax
imul   $0x1be5,%rax,%rdi
lea    0xd5f5(%rdi),%rsi
mov    %rsi,%rax
imul   %r9
lea    (%rdx,%rdi,1),%rax
add    $0xd5f5,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x11,%rax
add    %edx,%eax
imul   $0x3f480,%eax,%eax
sub    %eax,%esi
mov    %esi,0x2d17(%rip)
movslq %ecx,%rax
imul   $0x1fb9,%rax,%rcx
add    $0x6efb,%rcx
mov    %rcx,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xe,%rdx
add    %eax,%edx
imul   $0x20d38,%edx,%eax
sub    %eax,%ecx
mov    %ecx,0x2ce9(%rip)
movslq %r10d,%rax
imul   $0x11d1,%rax,%rdi
add    $0xc895,%rdi
movabs $0x2285619abf07573d,%rdx
61 85 22
mov    %rdi,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xf,%rdx
add    %eax,%edx
imul   $0x3b538,%edx,%eax
sub    %eax,%edi
mov    %edi,0x2cb1(%rip)
imul   $0x61,%edi,%eax
cltq
imul   $0x2285619b,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x2f,%rbx
add    %eax,%ebx
cmp    $0x7fffffff,%ebx
jb     13d0 <ran1+0x2c0>
lea    0xc51(%rip),%rdi
call   1030 <dump_error@plt>
mov    0x2c76(%rip),%esi
mov    0x2c74(%rip),%ecx
movslq %ebx,%rax
lea    0x2c76(%rip),%rdx
movsd  0x8(%rdx,%rax,8),%xmm0
cvtsi2sd %esi,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %ecx,%xmm2
mulsd  0xc0d(%rip),%xmm2
addsd  %xmm1,%xmm2
mulsd  0xc09(%rip),%xmm2
movsd  %xmm2,0x8(%rdx,%rax,8)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@ran1.ix1 = internal global i32 0
@ran1.ix2 = internal global i32 0
@ran1.ix3 = internal global i32 0
@ran1.r = internal global [98 x double] zeroinitializer
@ran1.iff = internal global i32 0
@.str = [26 x i8] c"RAN1: This cannot happen.\00"
define double @ran1(i32* %0) {
%2 = alloca i32*
%3 = alloca double
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* @ran1.iff
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %68
11: ; preds = %8, %1
store i32 1, i32* @ran1.iff
%12 = load i32*, i32** %2
%13 = load i32, i32* %12
%14 = sext i32 %13 to i64
%15 = sub nsw i64 54773, %14
%16 = srem i64 %15, 259200
%17 = trunc i64 %16 to i32
store i32 %17, i32* @ran1.ix1
%18 = load i32, i32* @ran1.ix1
%19 = sext i32 %18 to i64
%20 = mul nsw i64 7141, %19
%21 = add nsw i64 %20, 54773
%22 = srem i64 %21, 259200
%23 = trunc i64 %22 to i32
store i32 %23, i32* @ran1.ix1
%24 = load i32, i32* @ran1.ix1
%25 = sext i32 %24 to i64
%26 = srem i64 %25, 134456
%27 = trunc i64 %26 to i32
store i32 %27, i32* @ran1.ix2
%28 = load i32, i32* @ran1.ix1
%29 = sext i32 %28 to i64
%30 = mul nsw i64 7141, %29
%31 = add nsw i64 %30, 54773
%32 = srem i64 %31, 259200
%33 = trunc i64 %32 to i32
store i32 %33, i32* @ran1.ix1
%34 = load i32, i32* @ran1.ix1
%35 = sext i32 %34 to i64
%36 = srem i64 %35, 243000
%37 = trunc i64 %36 to i32
store i32 %37, i32* @ran1.ix3
store i32 1, i32* %4
br label %38
38: ; preds = %63, %11
%39 = load i32, i32* %4
%40 = icmp sle i32 %39, 97
br i1 %40, label %41, label %66
41: ; preds = %38
%42 = load i32, i32* @ran1.ix1
%43 = sext i32 %42 to i64
%44 = mul nsw i64 7141, %43
%45 = add nsw i64 %44, 54773
%46 = srem i64 %45, 259200
%47 = trunc i64 %46 to i32
store i32 %47, i32* @ran1.ix1
%48 = load i32, i32* @ran1.ix2
%49 = sext i32 %48 to i64
%50 = mul nsw i64 8121, %49
%51 = add nsw i64 %50, 28411
%52 = srem i64 %51, 134456
%53 = trunc i64 %52 to i32
store i32 %53, i32* @ran1.ix2
%54 = load i32, i32* @ran1.ix1
%55 = sitofp i32 %54 to double
%56 = load i32, i32* @ran1.ix2
%57 = sitofp i32 %56 to double
%58 = call double @llvm.fmuladd.f64(double %57, double 0x3EDF31D2B36647FC, double %55)
%59 = fmul double %58, 0x3ED02E85C0898B71
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [98 x double], [98 x double]* @ran1.r, i64 0, i64 %61
store double %59, double* %62
br label %63
63: ; preds = %41
%64 = load i32, i32* %4
%65 = add nsw i32 %64, 1
store i32 %65, i32* %4
br label %38
66: ; preds = %38
%67 = load i32*, i32** %2
store i32 1, i32* %67
br label %68
68: ; preds = %66, %8
%69 = load i32, i32* @ran1.ix1
%70 = sext i32 %69 to i64
%71 = mul nsw i64 7141, %70
%72 = add nsw i64 %71, 54773
%73 = srem i64 %72, 259200
%74 = trunc i64 %73 to i32
store i32 %74, i32* @ran1.ix1
%75 = load i32, i32* @ran1.ix2
%76 = sext i32 %75 to i64
%77 = mul nsw i64 8121, %76
%78 = add nsw i64 %77, 28411
%79 = srem i64 %78, 134456
%80 = trunc i64 %79 to i32
store i32 %80, i32* @ran1.ix2
%81 = load i32, i32* @ran1.ix3
%82 = sext i32 %81 to i64
%83 = mul nsw i64 4561, %82
%84 = add nsw i64 %83, 51349
%85 = srem i64 %84, 243000
%86 = trunc i64 %85 to i32
store i32 %86, i32* @ran1.ix3
%87 = load i32, i32* @ran1.ix3
%88 = mul nsw i32 97, %87
%89 = sext i32 %88 to i64
%90 = sdiv i64 %89, 243000
%91 = add nsw i64 1, %90
%92 = trunc i64 %91 to i32
store i32 %92, i32* %4
%93 = load i32, i32* %4
%94 = icmp sgt i32 %93, 97
br i1 %94, label %98, label %95
95: ; preds = %68
%96 = load i32, i32* %4
%97 = icmp slt i32 %96, 1
br i1 %97, label %98, label %100
98: ; preds = %95, %68
%99 = call i32 @dump_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %100
100: ; preds = %98, %95
%101 = load i32, i32* %4
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [98 x double], [98 x double]* @ran1.r, i64 0, i64 %102
%104 = load double, double* %103
store double %104, double* %3
%105 = load i32, i32* @ran1.ix1
%106 = sitofp i32 %105 to double
%107 = load i32, i32* @ran1.ix2
%108 = sitofp i32 %107 to double
%109 = call double @llvm.fmuladd.f64(double %108, double 0x3EDF31D2B36647FC, double %106)
%110 = fmul double %109, 0x3ED02E85C0898B71
%111 = load i32, i32* %4
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [98 x double], [98 x double]* @ran1.r, i64 0, i64 %112
store double %110, double* %113
%114 = load double, double* %3
ret double %114
}

LLVM IR (-O2):
@ran1.ix1 = internal unnamed_addr global i32 0
@ran1.ix2 = internal unnamed_addr global i32 0
@ran1.ix3 = internal unnamed_addr global i32 0
@ran1.r = internal unnamed_addr global [98 x double] zeroinitializer
@ran1.iff = internal unnamed_addr global i1 false
@.str = [26 x i8] c"RAN1: This cannot happen.\00"
define double @ran1(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp slt i32 %2, 0
%4 = load i1, i1* @ran1.iff
%5 = xor i1 %4, true
%6 = select i1 %3, i1 true, i1 %5
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i32, i32* @ran1.ix1
%9 = load i32, i32* @ran1.ix2
%10 = load i32, i32* @ran1.ix3
br label %48
11: ; preds = %1
store i1 true, i1* @ran1.iff
%12 = sext i32 %2 to i64
%13 = sub nsw i64 54773, %12
%14 = srem i64 %13, 259200
%15 = trunc i64 %14 to i32
%16 = mul nsw i32 %15, 7141
%17 = add nsw i32 %16, 54773
%18 = srem i32 %17, 259200
%19 = srem i32 %18, 134456
%20 = mul nsw i32 %18, 7141
%21 = add nsw i32 %20, 54773
%22 = srem i32 %21, 259200
%23 = srem i32 %22, 243000
br label %24
24: ; preds = %11, %24
%25 = phi i64 [ 1, %11 ], [ %43, %24 ]
%26 = phi i32 [ %22, %11 ], [ %32, %24 ]
%27 = phi i32 [ %19, %11 ], [ %37, %24 ]
%28 = sext i32 %26 to i64
%29 = mul nsw i64 %28, 7141
%30 = add nsw i64 %29, 54773
%31 = srem i64 %30, 259200
%32 = trunc i64 %31 to i32
%33 = sext i32 %27 to i64
%34 = mul nsw i64 %33, 8121
%35 = add nsw i64 %34, 28411
%36 = srem i64 %35, 134456
%37 = trunc i64 %36 to i32
%38 = sitofp i32 %32 to double
%39 = sitofp i32 %37 to double
%40 = tail call double @llvm.fmuladd.f64(double %39, double 0x3EDF31D2B36647FC, double %38)
%41 = fmul double %40, 0x3ED02E85C0898B71
%42 = getelementptr inbounds [98 x double], [98 x double]* @ran1.r, i64 0, i64 %25
store double %41, double* %42
%43 = add nuw nsw i64 %25, 1
%44 = icmp eq i64 %43, 98
br i1 %44, label %45, label %24
45: ; preds = %24
%46 = trunc i64 %31 to i32
%47 = trunc i64 %36 to i32
store i32 1, i32* %0
br label %48
48: ; preds = %7, %45
%49 = phi i32 [ %10, %7 ], [ %23, %45 ]
%50 = phi i32 [ %9, %7 ], [ %47, %45 ]
%51 = phi i32 [ %8, %7 ], [ %46, %45 ]
%52 = sext i32 %51 to i64
%53 = mul nsw i64 %52, 7141
%54 = add nsw i64 %53, 54773
%55 = srem i64 %54, 259200
%56 = trunc i64 %55 to i32
store i32 %56, i32* @ran1.ix1
%57 = sext i32 %50 to i64
%58 = mul nsw i64 %57, 8121
%59 = add nsw i64 %58, 28411
%60 = srem i64 %59, 134456
%61 = trunc i64 %60 to i32
store i32 %61, i32* @ran1.ix2
%62 = sext i32 %49 to i64
%63 = mul nsw i64 %62, 4561
%64 = add nsw i64 %63, 51349
%65 = srem i64 %64, 243000
%66 = trunc i64 %65 to i32
store i32 %66, i32* @ran1.ix3
%67 = mul nsw i32 %66, 97
%68 = sdiv i32 %67, 243000
%69 = icmp ugt i32 %68, 2147483646
br i1 %69, label %70, label %74
70: ; preds = %48
%71 = tail call i32 @dump_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%72 = load i32, i32* @ran1.ix1
%73 = load i32, i32* @ran1.ix2
br label %74
74: ; preds = %48, %70
%75 = phi i32 [ %61, %48 ], [ %73, %70 ]
%76 = phi i32 [ %56, %48 ], [ %72, %70 ]
%77 = add nsw i32 %68, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [98 x double], [98 x double]* @ran1.r, i64 0, i64 %78
%80 = load double, double* %79
%81 = sitofp i32 %76 to double
%82 = sitofp i32 %75 to double
%83 = tail call double @llvm.fmuladd.f64(double %82, double 0x3EDF31D2B36647FC, double %81)
%84 = fmul double %83, 0x3ED02E85C0898B71
store double %84, double* %79
ret double %80
}