#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 p3;
  int j, l, m;
  for (p3 = 0; p3 <= n; p3++) {
    {
      hash(1);
      hash(p3);
      hash(0);
      hash(0);
    };
  }
  for (p3 = 0; p3 <= n; p3++) {
    {
      hash(2);
      hash(0);
      hash(p3);
      hash(0);
    };
  }
}


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
cmp    -0x4(%rbp),%eax
jg     115c <test+0x4c>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <test+0x12>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     119d <test+0x8d>
mov    $0x2,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1163 <test+0x53>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
js     1177 <test+0x67>
mov    %edi,%ebx
lea    0x1(%rbx),%r14d
xor    %ebp,%ebp
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1120 <test+0x10>
test   %ebx,%ebx
js     1177 <test+0x67>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x2,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1150 <test+0x40>
pop    %rbx
pop    %r14
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
store i32 %0, i32* %2
store i32 0, i32* %3
br label %7
7: ; preds = %17, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = call i32 @hash(i32 1)
%13 = load i32, i32* %3
%14 = call i32 @hash(i32 %13)
%15 = call i32 @hash(i32 0)
%16 = call i32 @hash(i32 0)
br label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %7
20: ; preds = %7
store i32 0, i32* %3
br label %21
21: ; preds = %31, %20
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = call i32 @hash(i32 2)
%27 = call i32 @hash(i32 0)
%28 = load i32, i32* %3
%29 = call i32 @hash(i32 %28)
%30 = call i32 @hash(i32 0)
br label %31
31: ; preds = %25
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %21
34: ; preds = %21
ret void
}

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