#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(int);
void test(int h0) {
  int i, j;
  for (i = ((0) > (32 * h0 - 1991) ? (0) : (32 * h0 - 1991));
       i <= ((999) < (32 * h0 + 31) ? (999) : (32 * h0 + 31)); i++) {
    if ((63 * i + 32 * h0 + 31) % 64 <= 62) {
      for (j = 0; j <= 999; j++) {
        {
          hash(1);
          hash(i);
          hash(j);
        };
      }
    }
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
shl    $0x5,%ecx
sub    $0x7c7,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    113b <test+0x2b>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <test+0x39>
mov    -0x4(%rbp),%eax
shl    $0x5,%eax
sub    $0x7c7,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%ecx
shl    $0x5,%ecx
add    $0x1f,%ecx
mov    $0x3e7,%eax
cmp    %ecx,%eax
jge    1178 <test+0x68>
mov    $0x3e7,%eax
mov    %eax,-0x18(%rbp)
jmp    1184 <test+0x74>
mov    -0x4(%rbp),%eax
shl    $0x5,%eax
add    $0x1f,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
cmp    %ecx,%eax
jg     1206 <test+0xf6>
imul   $0x3f,-0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x5,%ecx
add    %ecx,%eax
add    $0x1f,%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
cmp    $0x3e,%edx
jg     11f3 <test+0xe3>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e7,-0xc(%rbp)
jg     11ee <test+0xde>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b9 <test+0xa9>
jmp    11f3 <test+0xe3>
jmp    11f8 <test+0xe8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <test+0x3f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
shl    $0x5,%r14d
cmp    $0x7c8,%r14d
mov    $0x7c7,%ebx
cmovge %r14d,%ebx
add    $0xfffff839,%ebx
or     $0x1f,%r14d
cmp    $0x3e7,%r14d
mov    $0x3e7,%r15d
cmovl  %r14d,%r15d
cmp    %r15d,%ebx
jle    116a <test+0x5a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   0x0(%rax)
lea    0x1(%rbx),%eax
cmp    %r15d,%ebx
mov    %eax,%ebx
jge    114e <test+0x3e>
mov    %ebx,%eax
shl    $0x6,%eax
sub    %ebx,%eax
mov    %r14d,%ecx
add    %eax,%ecx
lea    0x3f(%r14,%rax,1),%eax
cmovns %ecx,%eax
and    $0xffffffc0,%eax
sub    %eax,%ecx
cmp    $0x3e,%ecx
jg     1160 <test+0x50>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
add    $0x1,%ebp
cmp    $0x3e8,%ebp
jne    1190 <test+0x80>
jmp    1160 <test+0x50>

LLVM IR (-O0):
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 32, %5
%7 = sub nsw i32 %6, 1991
%8 = icmp sgt i32 0, %7
br i1 %8, label %9, label %10
9: ; preds = %1
br label %14
10: ; preds = %1
%11 = load i32, i32* %2
%12 = mul nsw i32 32, %11
%13 = sub nsw i32 %12, 1991
br label %14
14: ; preds = %10, %9
%15 = phi i32 [ 0, %9 ], [ %13, %10 ]
store i32 %15, i32* %3
br label %16
16: ; preds = %54, %14
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = mul nsw i32 32, %18
%20 = add nsw i32 %19, 31
%21 = icmp slt i32 999, %20
br i1 %21, label %22, label %23
22: ; preds = %16
br label %27
23: ; preds = %16
%24 = load i32, i32* %2
%25 = mul nsw i32 32, %24
%26 = add nsw i32 %25, 31
br label %27
27: ; preds = %23, %22
%28 = phi i32 [ 999, %22 ], [ %26, %23 ]
%29 = icmp sle i32 %17, %28
br i1 %29, label %30, label %57
30: ; preds = %27
%31 = load i32, i32* %3
%32 = mul nsw i32 63, %31
%33 = load i32, i32* %2
%34 = mul nsw i32 32, %33
%35 = add nsw i32 %32, %34
%36 = add nsw i32 %35, 31
%37 = srem i32 %36, 64
%38 = icmp sle i32 %37, 62
br i1 %38, label %39, label %53
39: ; preds = %30
store i32 0, i32* %4
br label %40
40: ; preds = %49, %39
%41 = load i32, i32* %4
%42 = icmp sle i32 %41, 999
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = call i32 @hash(i32 1)
%45 = load i32, i32* %3
%46 = call i32 @hash(i32 %45)
%47 = load i32, i32* %4
%48 = call i32 @hash(i32 %47)
br label %49
49: ; preds = %43
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
br label %40
52: ; preds = %40
br label %53
53: ; preds = %52, %30
br label %54
54: ; preds = %53
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %16
57: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @test(i32 %0) {
%2 = shl nsw i32 %0, 5
%3 = icmp sgt i32 %2, 1991
%4 = select i1 %3, i32 %2, i32 1991
%5 = add nsw i32 %4, -1991
%6 = or i32 %2, 31
%7 = icmp slt i32 %6, 999
%8 = select i1 %7, i32 %6, i32 999
%9 = icmp sgt i32 %5, %8
br i1 %9, label %26, label %10
10: ; preds = %1, %23
%11 = phi i32 [ %24, %23 ], [ %5, %1 ]
%12 = mul nsw i32 %11, 63
%13 = add i32 %6, %12
%14 = srem i32 %13, 64
%15 = icmp slt i32 %14, 63
br i1 %15, label %16, label %23
16: ; preds = %10, %16
%17 = phi i32 [ %21, %16 ], [ 0, %10 ]
%18 = tail call i32 @hash(i32 1)
%19 = tail call i32 @hash(i32 %11)
%20 = tail call i32 @hash(i32 %17)
%21 = add nuw nsw i32 %17, 1
%22 = icmp eq i32 %21, 1000
br i1 %22, label %23, label %16
23: ; preds = %16, %10
%24 = add nsw i32 %11, 1
%25 = icmp slt i32 %11, %8
br i1 %25, label %10, label %26
26: ; preds = %23, %1
ret void
}