#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 */
scalar_t__ CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ gauss_dble(double *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ ranlxd(double *, int);
int /*<<< orphan*/ rlxd_init(int, int);
int main(void) {
  int k, level;
  float t1, t2, dt;
  double r[100];
  printf("\n");
  printf("Timing of ranlxd ");
  printf("(average time per random number in microsec)\n\n");
  for (level = 1; level <= 2; level++) {
    rlxd_init(level, 1);
    t1 = (float)clock();
    for (k = 1; k <= 100000; k++)
      ranlxd(r, 100);
    t2 = (float)clock();
    dt = (t2 - t1) / (float)(CLOCKS_PER_SEC);
    dt *= 1.0e6f / (float)(100 * 100000);
    printf("%4.3f (level %1d)  ", dt, level);
  }
  printf("\n\n");
  printf("Timing of gauss_dble ");
  printf("(average time per random number in microsec)\n\n");
  for (level = 1; level <= 2; level++) {
    rlxd_init(level, 1);
    t1 = (float)clock();
    for (k = 1; k <= 100000; k++)
      gauss_dble(r, 24);
    t2 = (float)clock();
    dt = (t2 - t1) / (float)(CLOCKS_PER_SEC);
    dt *= 1.0e6f / (float)(24 * 100000);
    printf("%4.3f (level %1d)  ", dt, level);
  }
  printf("\n\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     1268 <main+0x108>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1050 <rlxd_init@plt>
mov    $0x0,%al
call   1040 <clock@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jg     11fe <main+0x9e>
lea    -0x340(%rbp),%rdi
mov    $0x64,%esi
call   1070 <ranlxd@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d2 <main+0x72>
mov    $0x0,%al
call   1040 <clock@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
mov    0x2dc8(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xdce(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
lea    0xdf6(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a3 <main+0x43>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     135e <main+0x1fe>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1050 <rlxd_init@plt>
mov    $0x0,%al
call   1040 <clock@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jg     12f4 <main+0x194>
lea    -0x340(%rbp),%rdi
mov    $0x18,%esi
call   1030 <gauss_dble@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12c8 <main+0x168>
mov    $0x0,%al
call   1040 <clock@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
mov    0x2cd2(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xcd4(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0xc(%rbp),%esi
lea    0xd00(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1299 <main+0x139>
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x338,%rsp
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe98(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1070 <rlxd_init@plt>
xor    %eax,%eax
call   1060 <clock@plt>
mov    %rax,%r14
mov    $0x186a0,%ebp
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x64,%esi
call   1090 <ranlxd@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0x60>
cvtsi2ss %r14,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1060 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
subss  0xc(%rsp),%xmm0
mov    0x2dcf(%rip),%r15
cvtsi2ssq (%r15),%xmm1
divss  %xmm1,%xmm0
mulss  0xdd6(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde5(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1080 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1070 <rlxd_init@plt>
xor    %eax,%eax
call   1060 <clock@plt>
mov    %rax,%r14
mov    $0x186a0,%ebp
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x64,%esi
call   1090 <ranlxd@plt>
add    $0xffffffff,%ebp
jne    1270 <main+0xf0>
xorps  %xmm0,%xmm0
cvtsi2ss %r14,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1060 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
subss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r15),%xmm1
divss  %xmm1,%xmm0
mulss  0xd47(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd56(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xd99(%rip),%rdi
call   1050 <puts@plt>
lea    0xd4b(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xd53(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1070 <rlxd_init@plt>
xor    %eax,%eax
call   1060 <clock@plt>
mov    %rax,%r14
mov    $0x186a0,%ebp
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x18,%esi
call   1040 <gauss_dble@plt>
add    $0xffffffff,%ebp
jne    1320 <main+0x1a0>
xorps  %xmm0,%xmm0
cvtsi2ss %r14,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1060 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
subss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r15),%xmm1
divss  %xmm1,%xmm0
mulss  0xc9b(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xca6(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1080 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1070 <rlxd_init@plt>
xor    %eax,%eax
call   1060 <clock@plt>
mov    %rax,%r14
mov    $0x186a0,%ebp
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    $0x18,%esi
call   1040 <gauss_dble@plt>
add    $0xffffffff,%ebp
jne    13b0 <main+0x230>
xorps  %xmm0,%xmm0
cvtsi2ss %r14,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1060 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
subss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r15),%xmm1
divss  %xmm1,%xmm0
mulss  0xc0b(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc16(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xc59(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [18 x i8] c"Timing of ranlxd \00"
@.str.2 = [47 x i8] c"(average time per random number in microsec)\0A\0A\00"
@CLOCKS_PER_SEC = global i64 0
@.str.3 = [20 x i8] c"%4.3f (level %1d) \00"
@.str.4 = [3 x i8] c"\0A\0A\00"
@.str.5 = [22 x i8] c"Timing of gauss_dble \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca [100 x double]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %11
11: ; preds = %43, %0
%12 = load i32, i32* %3
%13 = icmp sle i32 %12, 2
br i1 %13, label %14, label %46
14: ; preds = %11
%15 = load i32, i32* %3
%16 = call i32 @rlxd_init(i32 %15, i32 1)
%17 = call i64 (...) @clock()
%18 = sitofp i64 %17 to float
store float %18, float* %4
store i32 1, i32* %2
br label %19
19: ; preds = %25, %14
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 100000
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 0
%24 = call i32 @ranlxd(double* %23, i32 100)
br label %25
25: ; preds = %22
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %19
28: ; preds = %19
%29 = call i64 (...) @clock()
%30 = sitofp i64 %29 to float
store float %30, float* %5
%31 = load float, float* %5
%32 = load float, float* %4
%33 = fsub float %31, %32
%34 = load i64, i64* @CLOCKS_PER_SEC
%35 = sitofp i64 %34 to float
%36 = fdiv float %33, %35
store float %36, float* %6
%37 = load float, float* %6
%38 = fmul float %37, 0x3FB99999A0000000
store float %38, float* %6
%39 = load float, float* %6
%40 = fpext float %39 to double
%41 = load i32, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %40, i32 %41)
br label %43
43: ; preds = %28
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %11
46: ; preds = %11
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %50
50: ; preds = %82, %46
%51 = load i32, i32* %3
%52 = icmp sle i32 %51, 2
br i1 %52, label %53, label %85
53: ; preds = %50
%54 = load i32, i32* %3
%55 = call i32 @rlxd_init(i32 %54, i32 1)
%56 = call i64 (...) @clock()
%57 = sitofp i64 %56 to float
store float %57, float* %4
store i32 1, i32* %2
br label %58
58: ; preds = %64, %53
%59 = load i32, i32* %2
%60 = icmp sle i32 %59, 100000
br i1 %60, label %61, label %67
61: ; preds = %58
%62 = getelementptr inbounds [100 x double], [100 x double]* %7, i64 0, i64 0
%63 = call i32 @gauss_dble(double* %62, i32 24)
br label %64
64: ; preds = %61
%65 = load i32, i32* %2
%66 = add nsw i32 %65, 1
store i32 %66, i32* %2
br label %58
67: ; preds = %58
%68 = call i64 (...) @clock()
%69 = sitofp i64 %68 to float
store float %69, float* %5
%70 = load float, float* %5
%71 = load float, float* %4
%72 = fsub float %70, %71
%73 = load i64, i64* @CLOCKS_PER_SEC
%74 = sitofp i64 %73 to float
%75 = fdiv float %72, %74
store float %75, float* %6
%76 = load float, float* %6
%77 = fmul float %76, 0x3FDAAAAAA0000000
store float %77, float* %6
%78 = load float, float* %6
%79 = fpext float %78 to double
%80 = load i32, i32* %3
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %79, i32 %80)
br label %82
82: ; preds = %67
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 1
store i32 %84, i32* %3
br label %50
85: ; preds = %50
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%87 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"Timing of ranlxd \00"
@CLOCKS_PER_SEC = global i64 0
@.str.3 = [20 x i8] c"%4.3f (level %1d) \00"
@.str.5 = [22 x i8] c"Timing of gauss_dble \00"
@str.7 = [46 x i8] c"(average time per random number in microsec)\0A\00"
@str.8 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [100 x double]
%2 = bitcast [100 x double]* %1 to i8*
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.7, i64 0, i64 0))
%6 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 0
%7 = call i32 @rlxd_init(i32 1, i32 1)
%8 = call i64 (...) @clock()
br label %9
9: ; preds = %0, %9
%10 = phi i32 [ 1, %0 ], [ %12, %9 ]
%11 = call i32 @ranlxd(double* %6, i32 100)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, 100001
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = sitofp i64 %8 to float
%16 = call i64 (...) @clock()
%17 = sitofp i64 %16 to float
%18 = fsub float %17, %15
%19 = load i64, i64* @CLOCKS_PER_SEC
%20 = sitofp i64 %19 to float
%21 = fdiv float %18, %20
%22 = fmul float %21, 0x3FB99999A0000000
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %23, i32 1)
%25 = call i32 @rlxd_init(i32 2, i32 1)
%26 = call i64 (...) @clock()
br label %27
27: ; preds = %27, %14
%28 = phi i32 [ 1, %14 ], [ %30, %27 ]
%29 = call i32 @ranlxd(double* %6, i32 100)
%30 = add nuw nsw i32 %28, 1
%31 = icmp eq i32 %30, 100001
br i1 %31, label %32, label %27
32: ; preds = %27
%33 = sitofp i64 %26 to float
%34 = call i64 (...) @clock()
%35 = sitofp i64 %34 to float
%36 = fsub float %35, %33
%37 = load i64, i64* @CLOCKS_PER_SEC
%38 = sitofp i64 %37 to float
%39 = fdiv float %36, %38
%40 = fmul float %39, 0x3FB99999A0000000
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %41, i32 2)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.7, i64 0, i64 0))
%46 = call i32 @rlxd_init(i32 1, i32 1)
%47 = call i64 (...) @clock()
br label %48
48: ; preds = %32, %48
%49 = phi i32 [ 1, %32 ], [ %51, %48 ]
%50 = call i32 @gauss_dble(double* %6, i32 24)
%51 = add nuw nsw i32 %49, 1
%52 = icmp eq i32 %51, 100001
br i1 %52, label %53, label %48
53: ; preds = %48
%54 = sitofp i64 %47 to float
%55 = call i64 (...) @clock()
%56 = sitofp i64 %55 to float
%57 = fsub float %56, %54
%58 = load i64, i64* @CLOCKS_PER_SEC
%59 = sitofp i64 %58 to float
%60 = fdiv float %57, %59
%61 = fmul float %60, 0x3FDAAAAAA0000000
%62 = fpext float %61 to double
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %62, i32 1)
%64 = call i32 @rlxd_init(i32 2, i32 1)
%65 = call i64 (...) @clock()
br label %66
66: ; preds = %66, %53
%67 = phi i32 [ 1, %53 ], [ %69, %66 ]
%68 = call i32 @gauss_dble(double* %6, i32 24)
%69 = add nuw nsw i32 %67, 1
%70 = icmp eq i32 %69, 100001
br i1 %70, label %71, label %66
71: ; preds = %66
%72 = sitofp i64 %65 to float
%73 = call i64 (...) @clock()
%74 = sitofp i64 %73 to float
%75 = fsub float %74, %72
%76 = load i64, i64* @CLOCKS_PER_SEC
%77 = sitofp i64 %76 to float
%78 = fdiv float %75, %77
%79 = fmul float %78, 0x3FDAAAAAA0000000
%80 = fpext float %79 to double
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %80, i32 2)
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%83 = call i32 @exit(i32 0)
unreachable
}