#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__ floor(double);
double next_float();
int next_int();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ seed(int);
int main() {
  int counts[5] = {0, 0, 0, 0, 0};
  int i;
  seed(1234567);
  printf("%u\n", next_int());
  printf("%u\n", next_int());
  printf("%u\n", next_int());
  printf("%u\n", next_int());
  printf("%u\n", next_int());
  printf("\n");
  seed(987654321);
  for (i = 0; i < 100000; i++) {
    int j = (int)floor(next_float() * 5.0);
    counts[j]++;
  }
  for (i = 0; i < 5; i++) {
    printf("%d: %d\n", i, counts[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    $0x12d687,%edi
call   1040 <seed@plt>
mov    $0x0,%al
call   1070 <next_int@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <next_int@plt>
mov    %eax,%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <next_int@plt>
mov    %eax,%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <next_int@plt>
mov    %eax,%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <next_int@plt>
mov    %eax,%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3ade68b1,%edi
call   1040 <seed@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x186a0,-0x24(%rbp)
jge    1260 <main+0x100>
mov    $0x0,%al
call   1060 <next_float@plt>
movsd  0xdc9(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1080 <floor@plt>
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    121b <main+0xbb>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1298 <main+0x138>
mov    -0x24(%rbp),%esi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1267 <main+0x107>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
xorpd  %xmm0,%xmm0
movapd %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
mov    $0x12d687,%edi
call   1050 <seed@plt>
xor    %eax,%eax
call   1070 <next_int@plt>
lea    0xe7a(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <next_int@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <next_int@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <next_int@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <next_int@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x3ade68b1,%edi
call   1050 <seed@plt>
mov    $0x186a0,%ebx
nop
xor    %eax,%eax
call   1060 <next_float@plt>
mulsd  0xdf1(%rip),%xmm0
call   1080 <floor@plt>
cltq
addl   $0x1,(%rsp,%rax,4)
add    $0xffffffff,%ebx
jne    1200 <main+0xa0>
mov    (%rsp),%edx
lea    0xde3(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [8 x i8] c"%d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x i32]* %2 to i8*
%6 = call i32 @seed(i32 1234567)
%7 = call i32 (...) @next_int()
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (...) @next_int()
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @next_int()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @next_int()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 (...) @next_int()
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @seed(i32 987654321)
store i32 0, i32* %3
br label %19
19: ; preds = %32, %0
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 100000
br i1 %21, label %22, label %35
22: ; preds = %19
%23 = call double (...) @next_float()
%24 = fmul double %23, 5.000000e+00
%25 = call i64 @floor(double %24)
%26 = trunc i64 %25 to i32
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = add nsw i32 %30, 1
store i32 %31, i32* %29
br label %32
32: ; preds = %22
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %19
35: ; preds = %19
store i32 0, i32* %3
br label %36
36: ; preds = %46, %35
%37 = load i32, i32* %3
%38 = icmp slt i32 %37, 5
br i1 %38, label %39, label %49
39: ; preds = %36
%40 = load i32, i32* %3
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %40, i32 %44)
br label %46
46: ; preds = %39
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %36
49: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
@.str.2 = [8 x i8] c"%d: %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32 @seed(i32 1234567)
%4 = tail call i32 (...) @next_int()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (...) @next_int()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @next_int()
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @next_int()
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @next_int()
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @seed(i32 987654321)
br label %16
16: ; preds = %0, %16
%17 = phi i32 [ 0, %0 ], [ %26, %16 ]
%18 = tail call double (...) @next_float()
%19 = fmul double %18, 5.000000e+00
%20 = tail call i64 @floor(double %19)
%21 = shl i64 %20, 32
%22 = ashr exact i64 %21, 32
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
%26 = add nuw nsw i32 %17, 1
%27 = icmp eq i32 %26, 100000
br i1 %27, label %28, label %16
28: ; preds = %16
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %30)
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%33 = load i32, i32* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %33)
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %36)
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %39)
%41 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%42 = load i32, i32* %41
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %42)
ret i32 0
}