#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*/ hash_function(unsigned long);
int /*<<< orphan*/ printf(char *, unsigned long, int /*<<< orphan*/);
unsigned long random();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void hash_function_test() {
  int i;
  srandom(time(NULL));
  for (i = 0; i < 10; i++) {
    unsigned long val = random();
    printf("%10lu -> %2u\n", val, hash_function(val));
    ;
  }
}


x86 assembly (clang, -O0):
<hash_function_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11b5 <hash_function_test+0x65>
mov    $0x0,%al
call   1060 <random@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <hash_function@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <hash_function_test+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_function_test>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
lea    0xe85(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <random@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <hash_function@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%10lu -> %2u\0A\00"
define void @hash_function_test() {
%1 = alloca i32
%2 = alloca i64
%3 = call i32 @time(i32* null)
%4 = call i32 @srandom(i32 %3)
store i32 0, i32* %1
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = call i64 (...) @random()
store i64 %9, i64* %2
%10 = load i64, i64* %2
%11 = load i64, i64* %2
%12 = call i32 @hash_function(i64 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %10, i32 %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%10lu -> %2u\0A\00"
define void @hash_function_test() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srandom(i32 %1)
%3 = tail call i64 (...) @random()
%4 = tail call i32 @hash_function(i64 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %3, i32 %4)
%6 = tail call i64 (...) @random()
%7 = tail call i32 @hash_function(i64 %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %6, i32 %7)
%9 = tail call i64 (...) @random()
%10 = tail call i32 @hash_function(i64 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %9, i32 %10)
%12 = tail call i64 (...) @random()
%13 = tail call i32 @hash_function(i64 %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %12, i32 %13)
%15 = tail call i64 (...) @random()
%16 = tail call i32 @hash_function(i64 %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %15, i32 %16)
%18 = tail call i64 (...) @random()
%19 = tail call i32 @hash_function(i64 %18)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %18, i32 %19)
%21 = tail call i64 (...) @random()
%22 = tail call i32 @hash_function(i64 %21)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %21, i32 %22)
%24 = tail call i64 (...) @random()
%25 = tail call i32 @hash_function(i64 %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %24, i32 %25)
%27 = tail call i64 (...) @random()
%28 = tail call i32 @hash_function(i64 %27)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %27, i32 %28)
%30 = tail call i64 (...) @random()
%31 = tail call i32 @hash_function(i64 %30)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %30, i32 %31)
ret void
}