#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 c2, c4, c6;
  int i, j, k;
  for (c2 = 0; c2 <= N - 1; c2++) {
    for (c4 = 0; c4 <= N - 1; c4++) {
      {
        hash(1);
        hash(c2);
        hash(c4);
      };
      for (c6 = 0; c6 <= N - 1; c6++) {
        {
          hash(2);
          hash(c2);
          hash(c4);
          hash(c6);
        };
      }
    }
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11d3 <test+0xc3>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11c0 <test+0xb0>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11ad <test+0x9d>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    -0x10(%rbp),%edi
call   1030 <hash@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <test+0x5c>
jmp    11b2 <test+0xa2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <test+0x2a>
jmp    11c5 <test+0xb5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <test+0x12>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1199 <test+0x89>
mov    %edi,%r14d
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1160 <test+0x50>
add    $0x1,%ebx
cmp    %r14d,%ebx
jne    1140 <test+0x30>
add    $0x1,%r15d
cmp    %r14d,%r15d
jne    1130 <test+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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