#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*/ printf(char *, ...);
float ran4(long *);
int main(void) {
  int i;
  static long idum[5] = {0, -1, 99, -99, 99};
  static char *ansvax[5] = {"", "0.275898", "0.208204", "0.034307", "0.838676"};
  static char *ansiee[5] = {"", "0.219120", "0.849246", "0.375290", "0.457334"};
  float random[5];
  for (i = 1; i <= 4; i++)
    random[i] = ran4(&idum[i]);
  printf("ran4 gets values: ");
  for (i = 1; i <= 4; i++)
    printf("%15.6f", random[i]);
  printf("\n    IEEE answers: ");
  for (i = 1; i <= 4; i++)
    printf("%15s", ansiee[i]);
  printf("\n     VAX answers: ");
  for (i = 1; i <= 4; i++)
    printf("%15s", ansvax[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     116f <main+0x4f>
movslq -0x8(%rbp),%rax
lea    0x2ef5(%rip),%rdi
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <ran4@plt>
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x20(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     11b8 <main+0x98>
movslq -0x8(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1184 <main+0x64>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     1202 <main+0xe2>
movslq -0x8(%rbp),%rcx
lea    0x2ebe(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cd <main+0xad>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     124c <main+0x12c>
movslq -0x8(%rbp),%rcx
lea    0x2e44(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1217 <main+0xf7>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x2f0c(%rip),%rdi
call   1040 <ran4@plt>
movss  %xmm0,(%rsp)
lea    0x2f03(%rip),%rdi
call   1040 <ran4@plt>
movss  %xmm0,0x4(%rsp)
lea    0x2ef9(%rip),%rdi
call   1040 <ran4@plt>
movss  %xmm0,0x8(%rsp)
lea    0x2eef(%rip),%rdi
call   1040 <ran4@plt>
movss  %xmm0,0xc(%rsp)
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rbx
lea    0xe28(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe20(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe18(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe10(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe3b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdb2(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdaa(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda2(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd9a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@main.idum = internal global [5 x i64] [i64 0, i64 -1, i64 99, i64 -99, i64 99]
@main.ansvax = internal global [5 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"0.275898\00"
@.str.2 = [9 x i8] c"0.208204\00"
@.str.3 = [9 x i8] c"0.034307\00"
@.str.4 = [9 x i8] c"0.838676\00"
@main.ansiee = internal global [5 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0)]
@.str.5 = [9 x i8] c"0.219120\00"
@.str.6 = [9 x i8] c"0.849246\00"
@.str.7 = [9 x i8] c"0.375290\00"
@.str.8 = [9 x i8] c"0.457334\00"
@.str.9 = [19 x i8] c"ran4 gets values: \00"
@.str.10 = [7 x i8] c"%15.6f\00"
@.str.11 = [20 x i8] c"\0A IEEE answers: \00"
@.str.12 = [5 x i8] c"%15s\00"
@.str.13 = [20 x i8] c"\0A VAX answers: \00"
@.str.14 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x float]
store i32 0, i32* %1
store i32 1, i32* %2
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 4
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [5 x i64], [5 x i64]* @main.idum, i64 0, i64 %9
%11 = call float @ran4(i64* %10)
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 %13
store float %11, float* %14
br label %15
15: ; preds = %7
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %4
18: ; preds = %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %2
br label %20
20: ; preds = %30, %18
%21 = load i32, i32* %2
%22 = icmp sle i32 %21, 4
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 %25
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %28)
br label %30
30: ; preds = %23
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %20
33: ; preds = %20
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %2
br label %35
35: ; preds = %44, %33
%36 = load i32, i32* %2
%37 = icmp sle i32 %36, 4
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [5 x i8*], [5 x i8*]* @main.ansiee, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %35
47: ; preds = %35
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %2
br label %49
49: ; preds = %58, %47
%50 = load i32, i32* %2
%51 = icmp sle i32 %50, 4
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [5 x i8*], [5 x i8*]* @main.ansvax, i64 0, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* %56)
br label %58
58: ; preds = %52
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
store i32 %60, i32* %2
br label %49
61: ; preds = %49
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@main.idum = internal global [5 x i64] [i64 0, i64 -1, i64 99, i64 -99, i64 99]
@.str.1 = [9 x i8] c"0.275898\00"
@.str.2 = [9 x i8] c"0.208204\00"
@.str.3 = [9 x i8] c"0.034307\00"
@.str.4 = [9 x i8] c"0.838676\00"
@.str.5 = [9 x i8] c"0.219120\00"
@.str.6 = [9 x i8] c"0.849246\00"
@.str.7 = [9 x i8] c"0.375290\00"
@.str.8 = [9 x i8] c"0.457334\00"
@.str.9 = [19 x i8] c"ran4 gets values: \00"
@.str.10 = [7 x i8] c"%15.6f\00"
@.str.11 = [20 x i8] c"\0A IEEE answers: \00"
@.str.12 = [5 x i8] c"%15s\00"
@.str.13 = [20 x i8] c"\0A VAX answers: \00"
define i32 @main() {
%1 = tail call float @ran4(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.idum, i64 0, i64 1))
%2 = tail call float @ran4(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.idum, i64 0, i64 2))
%3 = tail call float @ran4(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.idum, i64 0, i64 3))
%4 = tail call float @ran4(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.idum, i64 0, i64 4))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%6 = fpext float %1 to double
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %6)
%8 = fpext float %2 to double
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %8)
%10 = fpext float %3 to double
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %10)
%12 = fpext float %4 to double
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%24 = tail call i32 @putchar(i32 10)
ret i32 0
}