#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 n) {
  int i, j;
  for (i = 1; i <= n; i++) {
    if (i % 4 == 0) {
      {
        hash(2);
        hash(i);
        hash((i / 4));
      };
    }
    if (i % 2 == 0) {
      {
        hash(1);
        hash(i);
        hash((i / 2));
      };
    }
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11b1 <test+0xa1>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1166 <test+0x56>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119e <test+0x8e>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
jmp    11a3 <test+0x93>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <test+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    118c <test+0x7c>
mov    %edi,%r14d
neg    %r14d
mov    $0x1,%ebx
jmp    1143 <test+0x33>
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     118c <test+0x7c>
test   $0x3,%bl
je     1150 <test+0x40>
test   $0x1,%bl
jne    1130 <test+0x20>
jmp    1170 <test+0x60>
nop
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
shr    $0x2,%edi
call   1030 <hash@plt>
test   $0x1,%bl
jne    1130 <test+0x20>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
shr    %edi
call   1030 <hash@plt>
jmp    1130 <test+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %5
5: ; preds = %32, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %35
9: ; preds = %5
%10 = load i32, i32* %3
%11 = srem i32 %10, 4
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = call i32 @hash(i32 2)
%15 = load i32, i32* %3
%16 = call i32 @hash(i32 %15)
%17 = load i32, i32* %3
%18 = sdiv i32 %17, 4
%19 = call i32 @hash(i32 %18)
br label %20
20: ; preds = %13, %9
%21 = load i32, i32* %3
%22 = srem i32 %21, 2
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = call i32 @hash(i32 1)
%26 = load i32, i32* %3
%27 = call i32 @hash(i32 %26)
%28 = load i32, i32* %3
%29 = sdiv i32 %28, 2
%30 = call i32 @hash(i32 %29)
br label %31
31: ; preds = %24, %20
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %5
35: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @test(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %23, label %3
3: ; preds = %1, %20
%4 = phi i32 [ %21, %20 ], [ 1, %1 ]
%5 = and i32 %4, 3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = tail call i32 @hash(i32 2)
%9 = tail call i32 @hash(i32 %4)
%10 = lshr i32 %4, 2
%11 = tail call i32 @hash(i32 %10)
br label %12
12: ; preds = %7, %3
%13 = and i32 %4, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = tail call i32 @hash(i32 1)
%17 = tail call i32 @hash(i32 %4)
%18 = lshr i32 %4, 1
%19 = tail call i32 @hash(i32 %18)
br label %20
20: ; preds = %12, %15
%21 = add nuw i32 %4, 1
%22 = icmp eq i32 %4, %0
br i1 %22, label %23, label %3
23: ; preds = %20, %1
ret void
}