#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*/ genrand_int32();
double genrand_real2();
int /*<<< orphan*/ init_by_array(unsigned long *, unsigned long);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i;
  unsigned long init[4] = {0x123, 0x234, 0x345, 0x456}, length = 4;
  init_by_array(init, length);
  printf("1000 outputs of genrand_int32()\n");
  for (i = 0; i < 1000; i++) {
    printf("%10lu ", genrand_int32());
    if (i % 5 == 4)
      printf("\n");
  }
  printf("\n1000 outputs of genrand_real2()\n");
  for (i = 0; i < 1000; i++) {
    printf("%10.8f ", genrand_real2());
    if (i % 5 == 4)
      printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x4,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <init_by_array@plt>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11fe <main+0xbe>
mov    $0x0,%al
call   1030 <genrand_int32@plt>
mov    %eax,%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
jne    11eb <main+0xab>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f0 <main+0xb0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a5 <main+0x65>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    126a <main+0x12a>
mov    $0x0,%al
call   1050 <genrand_real2@plt>
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
jne    1257 <main+0x117>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125c <main+0x11c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1213 <main+0xd3>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe83(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1080 <init_by_array@plt>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7f(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11be <main+0x5e>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0xfffffc18,%ebx
je     11fb <main+0x9b>
movzwl %bp,%eax
imul   $0xcccd,%eax,%eax
shr    $0x12,%eax
lea    (%rax,%rax,4),%eax
mov    $0xfffffffc,%r15d
sub    %eax,%r15d
xor    %eax,%eax
call   1050 <genrand_int32@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %bx,%r15w
jne    11b0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x50>
lea    0xe4d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe19(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    122e <main+0xce>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0xfffffc18,%ebx
je     1269 <main+0x109>
movzwl %bp,%eax
imul   $0xcccd,%eax,%eax
shr    $0x12,%eax
lea    (%rax,%rax,4),%eax
mov    $0xfffffffc,%r15d
sub    %eax,%r15d
xor    %eax,%eax
call   1070 <genrand_real2@plt>
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
cmp    %bx,%r15w
jne    1220 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1220 <main+0xc0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.init = [4 x i64] [i64 291, i64 564, i64 837, i64 1110]
@.str = [33 x i8] c"1000 outputs of genrand_int32()\0A\00"
@.str.1 = [7 x i8] c"%10lu \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [34 x i8] c"\0A1000 outputs of genrand_real2()\0A\00"
@.str.4 = [8 x i8] c"%10.8f \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i64]
%4 = alloca i64
store i32 0, i32* %1
%5 = bitcast [4 x i64]* %3 to i8*
store i64 4, i64* %4
%6 = getelementptr inbounds [4 x i64], [4 x i64]* %3, i64 0, i64 0
%7 = load i64, i64* %4
%8 = call i32 @init_by_array(i64* %6, i64 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %10
10: ; preds = %22, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = call i32 (...) @genrand_int32()
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %2
%17 = srem i32 %16, 5
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %13
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %10
25: ; preds = %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %27
27: ; preds = %39, %25
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 1000
br i1 %29, label %30, label %42
30: ; preds = %27
%31 = call double (...) @genrand_real2()
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %31)
%33 = load i32, i32* %2
%34 = srem i32 %33, 5
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36, %30
br label %39
39: ; preds = %38
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
store i32 %41, i32* %2
br label %27
42: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@__const.main.init = [4 x i64] [i64 291, i64 564, i64 837, i64 1110]
@.str.1 = [7 x i8] c"%10lu \00"
@.str.4 = [8 x i8] c"%10.8f \00"
@str = [32 x i8] c"1000 outputs of genrand_int32()\00"
@str.5 = [33 x i8] c"\0A1000 outputs of genrand_real2()\00"
define i32 @main() {
%1 = alloca [4 x i64]
%2 = bitcast [4 x i64]* %1 to i8*
%3 = getelementptr inbounds [4 x i64], [4 x i64]* %1, i64 0, i64 0
%4 = call i32 @init_by_array(i64* %3, i64 4)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %0, %15
%7 = phi i32 [ 0, %0 ], [ %16, %15 ]
%8 = call i32 (...) @genrand_int32()
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = trunc i32 %7 to i16
%11 = urem i16 %10, 5
%12 = icmp eq i16 %11, 4
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = call i32 @putchar(i32 10)
br label %15
15: ; preds = %6, %13
%16 = add nuw nsw i32 %7, 1
%17 = icmp eq i32 %16, 1000
br i1 %17, label %18, label %6
18: ; preds = %15
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0))
br label %20
20: ; preds = %18, %29
%21 = phi i32 [ 0, %18 ], [ %30, %29 ]
%22 = call double (...) @genrand_real2()
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %22)
%24 = trunc i32 %21 to i16
%25 = urem i16 %24, 5
%26 = icmp eq i16 %25, 4
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 @putchar(i32 10)
br label %29
29: ; preds = %20, %27
%30 = add nuw nsw i32 %21, 1
%31 = icmp eq i32 %30, 1000
br i1 %31, label %32, label %20
32: ; preds = %29
ret i32 0
}