#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 */
double cputime();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ get_rn_dbl(int *);
int /*<<< orphan*/ get_rn_flt(int *);
int /*<<< orphan*/ get_rn_int(int *);
int *init_rng(int, int /*<<< orphan*/, int, int /*<<< orphan*/,
              int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stderr;
main() {
  int i;
  int *gen;
  double temp1, temp2, temp3, temp4;
  double temp_mult = 1000000 / 1.0e6;
  int gentype;
  scanf("%d\n", &gentype);
  if ((gentype < 0) || (gentype > 5)) {
    printf("\nGenerator numeral out of range.\n\t...Exiting\n");
    exit(1);
  }
  gen = init_rng(gentype, 0, 1, 0, 0);
  temp1 = cputime();
  for (i = 0; i < 1000000; i++)
    get_rn_int(gen);
  temp2 = cputime();
  for (i = 0; i < 1000000; i++)
    get_rn_flt(gen);
  temp3 = cputime();
  for (i = 0; i < 1000000; i++)
    get_rn_dbl(gen);
  temp4 = cputime();
  if (temp2 - temp1 < 1.0e-15 || temp3 - temp2 < 1.0e-15 ||
      temp4 - temp3 < 1.0e-15) {
    printf("Timing Information not available/not accurate "
           "enough.\n\t...Exiting\n");
    exit(1);
  }
  fprintf(stderr, "Last random number generated\n", get_rn_dbl(gen));
  printf("\nUser + System time Information (Note: MRS = Million Random Numbers "
         "Per Second)\n");
  printf("\tInteger generator:\t Time = %7.3f seconds => %8.4f MRS\n",
         temp2 - temp1, temp_mult / (temp2 - temp1));
  printf("\tFloat generator:\t Time = %7.3f seconds => %8.4f MRS\n",
         temp3 - temp2, temp_mult / (temp3 - temp2));
  printf("\tDouble generator:\t Time = %7.3f seconds => %8.4f MRS\n",
         temp4 - temp3, temp_mult / (temp4 - temp3));
  putchar('\n');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe49(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe4d(%rip),%rdi
lea    -0x3c(%rbp),%rsi
call   1080 <scanf@plt>
cmpl   $0x0,-0x3c(%rbp)
jl     11e0 <main+0x40>
cmpl   $0x5,-0x3c(%rbp)
jle    11f8 <main+0x58>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x3c(%rbp),%edi
xor    %r8d,%r8d
mov    $0x1,%edx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1050 <init_rng@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <cputime@plt>
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf4240,-0x8(%rbp)
jge    1249 <main+0xa9>
mov    -0x10(%rbp),%rdi
call   1090 <get_rn_int@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1225 <main+0x85>
mov    $0x0,%al
call   1060 <cputime@plt>
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf4240,-0x8(%rbp)
jge    1280 <main+0xe0>
mov    -0x10(%rbp),%rdi
call   10c0 <get_rn_flt@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    125c <main+0xbc>
mov    $0x0,%al
call   1060 <cputime@plt>
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf4240,-0x8(%rbp)
jge    12b7 <main+0x117>
mov    -0x10(%rbp),%rdi
call   10b0 <get_rn_dbl@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1293 <main+0xf3>
mov    $0x0,%al
call   1060 <cputime@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  0xd33(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1317 <main+0x177>
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  0xd17(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1317 <main+0x177>
movsd  -0x30(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xcfb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    132f <main+0x18f>
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2caa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <get_rn_dbl@plt>
mov    -0x40(%rbp),%edi
mov    %eax,%edx
lea    0xd35(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
divsd  %xmm2,%xmm1
lea    0xd6d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
subsd  -0x20(%rbp),%xmm2
divsd  %xmm2,%xmm1
lea    0xd7a(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
subsd  -0x28(%rbp),%xmm2
divsd  %xmm2,%xmm1
lea    0xd85(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0xe53(%rip),%rdi
lea    0x24(%rsp),%rsi
call   1090 <scanf@plt>
mov    0x24(%rsp),%edi
cmp    $0x6,%edi
jae    1357 <main+0x1a7>
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <init_rng@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <cputime@plt>
movsd  %xmm0,0x18(%rsp)
mov    $0xf4240,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10a0 <get_rn_int@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0x50>
xor    %eax,%eax
call   1070 <cputime@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0xf4240,%ebp
nop
mov    %rbx,%rdi
call   10d0 <get_rn_flt@plt>
add    $0xffffffff,%ebp
jne    1220 <main+0x70>
xor    %eax,%eax
call   1070 <cputime@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xf4240,%ebp
nop
mov    %rbx,%rdi
call   10c0 <get_rn_dbl@plt>
add    $0xffffffff,%ebp
jne    1240 <main+0x90>
xor    %eax,%eax
call   1070 <cputime@plt>
movsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm3
subsd  0x18(%rsp),%xmm3
movsd  0xd94(%rip),%xmm1
movsd  %xmm3,0x18(%rsp)
ucomisd %xmm3,%xmm1
movsd  0x8(%rsp),%xmm4
ja     134e <main+0x19e>
movapd %xmm4,%xmm3
subsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rsp)
ucomisd %xmm3,%xmm1
ja     134e <main+0x19e>
subsd  %xmm4,%xmm0
ucomisd %xmm0,%xmm1
ja     134e <main+0x19e>
mov    0x2d31(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
movsd  %xmm0,0x8(%rsp)
call   10c0 <get_rn_dbl@plt>
lea    0xd4e(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1080 <fprintf@plt>
lea    0xe01(%rip),%rdi
call   1040 <puts@plt>
movsd  0xd25(%rip),%xmm1
movsd  0x18(%rsp),%xmm0
divsd  %xmm0,%xmm1
lea    0xd3e(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  0xd05(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm0,%xmm1
lea    0xd56(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xcdf(%rip),%xmm1
divsd  %xmm0,%xmm1
lea    0xd6c(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xdd2(%rip),%rdi
jmp    135e <main+0x1ae>
lea    0xe0b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [46 x i8] c"\0AGenerator numeral out of range.\0A\09...Exiting\0A\00"
@.str.2 = [67 x i8] c"Timing Information not available/not accurate enough.\0A\09...Exiting\0A\00"
@stderr = global i32 0
@.str.3 = [30 x i8] c"Last random number generated\0A\00"
@.str.4 = [81 x i8] c"\0AUser + System time Information (Note: MRS = Million Random Numbers Per Second)\0A\00"
@.str.5 = [56 x i8] c"\09Integer generator:\09 Time = %7.3f seconds => %8.4f MRS\0A\00"
@.str.6 = [54 x i8] c"\09Float generator:\09 Time = %7.3f seconds => %8.4f MRS\0A\00"
@.str.7 = [55 x i8] c"\09Double generator:\09 Time = %7.3f seconds => %8.4f MRS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
store i32 0, i32* %1
store double 1.000000e+00, double* %8
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %0
%14 = load i32, i32* %9
%15 = icmp sgt i32 %14, 5
br i1 %15, label %16, label %19
16: ; preds = %13, %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %13
%20 = load i32, i32* %9
%21 = call i32* @init_rng(i32 %20, i32 0, i32 1, i32 0, i32 0)
store i32* %21, i32** %3
%22 = call double (...) @cputime()
store double %22, double* %4
store i32 0, i32* %2
br label %23
23: ; preds = %29, %19
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 1000000
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i32*, i32** %3
%28 = call i32 @get_rn_int(i32* %27)
br label %29
29: ; preds = %26
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %23
32: ; preds = %23
%33 = call double (...) @cputime()
store double %33, double* %5
store i32 0, i32* %2
br label %34
34: ; preds = %40, %32
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 1000000
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = load i32*, i32** %3
%39 = call i32 @get_rn_flt(i32* %38)
br label %40
40: ; preds = %37
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %34
43: ; preds = %34
%44 = call double (...) @cputime()
store double %44, double* %6
store i32 0, i32* %2
br label %45
45: ; preds = %51, %43
%46 = load i32, i32* %2
%47 = icmp slt i32 %46, 1000000
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load i32*, i32** %3
%50 = call i32 @get_rn_dbl(i32* %49)
br label %51
51: ; preds = %48
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %45
54: ; preds = %45
%55 = call double (...) @cputime()
store double %55, double* %7
%56 = load double, double* %5
%57 = load double, double* %4
%58 = fsub double %56, %57
%59 = fcmp olt double %58, 1.000000e-15
br i1 %59, label %70, label %60
60: ; preds = %54
%61 = load double, double* %6
%62 = load double, double* %5
%63 = fsub double %61, %62
%64 = fcmp olt double %63, 1.000000e-15
br i1 %64, label %70, label %65
65: ; preds = %60
%66 = load double, double* %7
%67 = load double, double* %6
%68 = fsub double %66, %67
%69 = fcmp olt double %68, 1.000000e-15
br i1 %69, label %70, label %73
70: ; preds = %65, %60, %54
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %65
%74 = load i32, i32* @stderr
%75 = load i32*, i32** %3
%76 = call i32 @get_rn_dbl(i32* %75)
%77 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
%79 = load double, double* %5
%80 = load double, double* %4
%81 = fsub double %79, %80
%82 = load double, double* %8
%83 = load double, double* %5
%84 = load double, double* %4
%85 = fsub double %83, %84
%86 = fdiv double %82, %85
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.5, i64 0, i64 0), double %81, double %86)
%88 = load double, double* %6
%89 = load double, double* %5
%90 = fsub double %88, %89
%91 = load double, double* %8
%92 = load double, double* %6
%93 = load double, double* %5
%94 = fsub double %92, %93
%95 = fdiv double %91, %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), double %90, double %95)
%97 = load double, double* %7
%98 = load double, double* %6
%99 = fsub double %97, %98
%100 = load double, double* %8
%101 = load double, double* %7
%102 = load double, double* %6
%103 = fsub double %101, %102
%104 = fdiv double %100, %103
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0), double %99, double %104)
%106 = call i32 @putchar(i8 signext 10)
%107 = load i32, i32* %1
ret i32 %107
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@stderr = global i32 0
@.str.3 = [30 x i8] c"Last random number generated\0A\00"
@.str.5 = [56 x i8] c"\09Integer generator:\09 Time = %7.3f seconds => %8.4f MRS\0A\00"
@.str.6 = [54 x i8] c"\09Float generator:\09 Time = %7.3f seconds => %8.4f MRS\0A\00"
@.str.7 = [55 x i8] c"\09Double generator:\09 Time = %7.3f seconds => %8.4f MRS\0A\00"
@str = [80 x i8] c"\0AUser + System time Information (Note: MRS = Million Random Numbers Per Second)\00"
@str.8 = [66 x i8] c"Timing Information not available/not accurate enough.\0A\09...Exiting\00"
@str.9 = [45 x i8] c"\0AGenerator numeral out of range.\0A\09...Exiting\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp ugt i32 %4, 5
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = call i32* @init_rng(i32 %4, i32 0, i32 1, i32 0, i32 0)
%11 = call double (...) @cputime()
br label %12
12: ; preds = %9, %12
%13 = phi i32 [ 0, %9 ], [ %15, %12 ]
%14 = call i32 @get_rn_int(i32* %10)
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, 1000000
br i1 %16, label %17, label %12
17: ; preds = %12
%18 = call double (...) @cputime()
br label %19
19: ; preds = %17, %19
%20 = phi i32 [ 0, %17 ], [ %22, %19 ]
%21 = call i32 @get_rn_flt(i32* %10)
%22 = add nuw nsw i32 %20, 1
%23 = icmp eq i32 %22, 1000000
br i1 %23, label %24, label %19
24: ; preds = %19
%25 = call double (...) @cputime()
br label %26
26: ; preds = %24, %26
%27 = phi i32 [ 0, %24 ], [ %29, %26 ]
%28 = call i32 @get_rn_dbl(i32* %10)
%29 = add nuw nsw i32 %27, 1
%30 = icmp eq i32 %29, 1000000
br i1 %30, label %31, label %26
31: ; preds = %26
%32 = call double (...) @cputime()
%33 = fsub double %18, %11
%34 = fcmp olt double %33, 1.000000e-15
br i1 %34, label %41, label %35
35: ; preds = %31
%36 = fsub double %25, %18
%37 = fcmp olt double %36, 1.000000e-15
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = fsub double %32, %25
%40 = fcmp olt double %39, 1.000000e-15
br i1 %40, label %41, label %44
41: ; preds = %38, %35, %31
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.8, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %38
%45 = load i32, i32* @stderr
%46 = call i32 @get_rn_dbl(i32* %10)
%47 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str, i64 0, i64 0))
%49 = fdiv double 1.000000e+00, %33
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.5, i64 0, i64 0), double %33, double %49)
%51 = fdiv double 1.000000e+00, %36
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), double %36, double %51)
%53 = fdiv double 1.000000e+00, %39
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0), double %39, double %53)
%55 = call i32 @putchar(i8 signext 10)
ret i32 0
}