#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 j, div41, div42, mod6, mod6_a;
  for (j = 1; j <= 10; j++) {
    if ((j + 1) % 3 == 0) {
      {
        hash(1);
        hash(j);
        hash(((j + 1) / 3));
        hash(((j + 1) / 3));
        hash(2);
        hash(((j - 2) / 3));
      };
      {
        hash(2);
        hash(j);
        hash(((j + 1) / 3));
        hash(((j + 1) / 3));
        hash(2);
        hash(((j - 2) / 3));
      };
      {
        hash(3);
        hash(j);
        hash(((j + 1) / 3));
        hash(((j + 1) / 3));
        hash(2);
        hash(((j - 2) / 3));
      };
    }
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jg     1264 <test+0x154>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1251 <test+0x141>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    $0x3,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
jmp    1256 <test+0x146>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <test+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%ebx
mov    $0x2,%r15b
jmp    1141 <test+0x31>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r15b
mov    %r12d,%ebx
cmp    $0xb,%r12d
je     1228 <test+0x118>
lea    0x1(%rbx),%r12d
movzbl %r15b,%eax
imul   $0xab,%eax,%eax
shr    $0x9,%eax
lea    (%rax,%rax,2),%eax
mov    $0x2,%cl
sub    %al,%cl
movzbl %cl,%eax
add    %ebx,%eax
cmp    $0x1,%al
jne    1130 <test+0x20>
movzbl %r12b,%eax
imul   $0xab,%eax,%ebp
shr    $0x9,%ebp
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
movzbl %bpl,%ebp
mov    %ebp,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
lea    0xfe(%rbx),%eax
movsbl %al,%eax
imul   $0x56,%eax,%eax
movzwl %ax,%eax
mov    %eax,%ecx
shr    $0xf,%ecx
shr    $0x8,%eax
add    %cl,%al
movsbl %al,%r14d
mov    %r14d,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
call   1030 <hash@plt>
mov    $0x3,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
call   1030 <hash@plt>
jmp    1130 <test+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @test() {
br label %1
1: ; preds = %0, %32
%2 = phi i32 [ 1, %0 ], [ %3, %32 ]
%3 = add nuw nsw i32 %2, 1
%4 = trunc i32 %3 to i8
%5 = urem i8 %4, 3
%6 = udiv i8 %4, 3
%7 = icmp eq i8 %5, 0
br i1 %7, label %8, label %32
8: ; preds = %1
%9 = tail call i32 @hash(i32 1)
%10 = tail call i32 @hash(i32 %2)
%11 = zext i8 %6 to i32
%12 = tail call i32 @hash(i32 %11)
%13 = tail call i32 @hash(i32 %11)
%14 = tail call i32 @hash(i32 2)
%15 = trunc i32 %2 to i8
%16 = add i8 %15, -2
%17 = sdiv i8 %16, 3
%18 = sext i8 %17 to i32
%19 = tail call i32 @hash(i32 %18)
%20 = tail call i32 @hash(i32 2)
%21 = tail call i32 @hash(i32 %2)
%22 = tail call i32 @hash(i32 %11)
%23 = tail call i32 @hash(i32 %11)
%24 = tail call i32 @hash(i32 2)
%25 = tail call i32 @hash(i32 %18)
%26 = tail call i32 @hash(i32 3)
%27 = tail call i32 @hash(i32 %2)
%28 = tail call i32 @hash(i32 %11)
%29 = tail call i32 @hash(i32 %11)
%30 = tail call i32 @hash(i32 2)
%31 = tail call i32 @hash(i32 %18)
br label %32
32: ; preds = %1, %8
%33 = icmp eq i32 %3, 11
br i1 %33, label %34, label %1
34: ; preds = %32
ret void
}