#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 */
typedef int uintmax_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ unwanghash32(scalar_t__);
scalar_t__ wanghash32(int);
void inthash(void) {
  int i;
  for (i = 0; i < 1024; i++)
    printf("%ju %ju\n", (uintmax_t)unwanghash32(wanghash32(i)),
           (uintmax_t)wanghash32(i) & 0xfff);
  for (i = 1000; i <= 10000; i++)
    printf("%ju %ju\n", (uintmax_t)unwanghash32(wanghash32(i)),
           (uintmax_t)wanghash32(i) & 0xffff);
}


x86 assembly (clang, -O0):
<inthash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x400,-0x4(%rbp)
jge    118c <inthash+0x5c>
mov    -0x4(%rbp),%edi
call   1050 <wanghash32@plt>
mov    %rax,%rdi
call   1040 <unwanghash32@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <wanghash32@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
and    $0xfff,%edx
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <inthash+0xf>
movl   $0x3e8,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jg     11e0 <inthash+0xb0>
mov    -0x4(%rbp),%edi
call   1050 <wanghash32@plt>
mov    %rax,%rdi
call   1040 <unwanghash32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <wanghash32@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
and    $0xffff,%edx
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1193 <inthash+0x63>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inthash>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xec2(%rip),%r14
xchg   %ax,%ax
mov    %ebx,%edi
call   1050 <wanghash32@plt>
mov    %rax,%rdi
call   1040 <unwanghash32@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1050 <wanghash32@plt>
and    $0xfff,%eax
mov    %r14,%rdi
mov    %r15d,%esi
mov    %eax,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x400,%ebx
jne    1140 <inthash+0x10>
mov    $0x3e8,%ebx
lea    0xe7e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
call   1050 <wanghash32@plt>
mov    %rax,%rdi
call   1040 <unwanghash32@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1050 <wanghash32@plt>
movzwl %ax,%edx
mov    %r14,%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x2711,%ebx
jne    1190 <inthash+0x60>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%ju %ju\0A\00"
define void @inthash() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %15, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 1024
br i1 %4, label %5, label %18
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i64 @wanghash32(i32 %6)
%8 = call i64 @unwanghash32(i64 %7)
%9 = trunc i64 %8 to i32
%10 = load i32, i32* %1
%11 = call i64 @wanghash32(i32 %10)
%12 = trunc i64 %11 to i32
%13 = and i32 %12, 4095
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %13)
br label %15
15: ; preds = %5
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
br label %2
18: ; preds = %2
store i32 1000, i32* %1
br label %19
19: ; preds = %32, %18
%20 = load i32, i32* %1
%21 = icmp sle i32 %20, 10000
br i1 %21, label %22, label %35
22: ; preds = %19
%23 = load i32, i32* %1
%24 = call i64 @wanghash32(i32 %23)
%25 = call i64 @unwanghash32(i64 %24)
%26 = trunc i64 %25 to i32
%27 = load i32, i32* %1
%28 = call i64 @wanghash32(i32 %27)
%29 = trunc i64 %28 to i32
%30 = and i32 %29, 65535
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %30)
br label %32
32: ; preds = %22
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %19
35: ; preds = %19
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%ju %ju\0A\00"
define void @inthash() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %10, %1 ]
%3 = tail call i64 @wanghash32(i32 %2)
%4 = tail call i64 @unwanghash32(i64 %3)
%5 = trunc i64 %4 to i32
%6 = tail call i64 @wanghash32(i32 %2)
%7 = trunc i64 %6 to i32
%8 = and i32 %7, 4095
%9 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8)
%10 = add nuw nsw i32 %2, 1
%11 = icmp eq i32 %10, 1024
br i1 %11, label %12, label %1
12: ; preds = %1, %12
%13 = phi i32 [ %21, %12 ], [ 1000, %1 ]
%14 = tail call i64 @wanghash32(i32 %13)
%15 = tail call i64 @unwanghash32(i64 %14)
%16 = trunc i64 %15 to i32
%17 = tail call i64 @wanghash32(i32 %13)
%18 = trunc i64 %17 to i32
%19 = and i32 %18, 65535
%20 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %19)
%21 = add nuw nsw i32 %13, 1
%22 = icmp eq i32 %21, 10001
br i1 %22, label %23, label %12
23: ; preds = %12
ret void
}