#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 M, int N) {
  int i, j;
  for (i = 1; i <= 2; i++) {
    for (j = 1; j <= M; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
  }
  for (i = 3; i <= M - 1; i++) {
    for (j = 1; j <= i - 1; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
    {
      hash(1);
      hash(i);
      hash(i);
    };
    {
      hash(2);
      hash(i);
      hash(i);
    };
    for (j = i + 1; j <= M; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
  }
  for (j = 1; j <= M - 1; j++) {
    {
      hash(1);
      hash(M);
      hash(j);
    };
  }
  {
    hash(1);
    hash(M);
    hash(M);
  };
  {
    hash(2);
    hash(M);
    hash(M);
  };
  for (i = M + 1; i <= N; i++) {
    for (j = 1; j <= M; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
    {
      hash(2);
      hash(i);
      hash(i);
    };
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     117d <test+0x6d>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     116a <test+0x5a>
mov    $0x1,%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    1136 <test+0x26>
jmp    116f <test+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <test+0x15>
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1259 <test+0x149>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11d5 <test+0xc5>
mov    $0x1,%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    119c <test+0x8c>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1246 <test+0x136>
mov    $0x1,%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    1212 <test+0x102>
jmp    124b <test+0x13b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1184 <test+0x74>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1299 <test+0x189>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x4(%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    1260 <test+0x150>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%edi
call   1030 <hash@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1345 <test+0x235>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     131d <test+0x20d>
mov    $0x1,%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    12e9 <test+0x1d9>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0xc(%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    12d6 <test+0x1c6>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%r15d
test   %edi,%edi
jle    12c1 <test+0x1b1>
mov    %r15d,%r12d
neg    %r12d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1140 <test+0x30>
test   %r15d,%r15d
jle    12c1 <test+0x1b1>
mov    %r14d,0x4(%rsp)
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1190 <test+0x80>
cmp    $0x4,%r15d
jl     1288 <test+0x178>
mov    $0x3,%r14d
mov    $0xfffffffe,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%ebx
mov    $0x1,%ebp
nopl   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>
lea    0x1(%r13,%rbp,1),%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    11f0 <test+0xe0>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
lea    0x1(%rbx),%r14d
mov    %r14d,%ebp
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
lea    (%r12,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1250 <test+0x140>
add    $0xffffffff,%r13d
cmp    %r15d,%r14d
jne    11e0 <test+0xd0>
cmp    $0x2,%r15d
mov    0x4(%rsp),%r14d
jl     12c1 <test+0x1b1>
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    12a0 <test+0x190>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
cmp    %r14d,%r15d
jge    136d <test+0x25d>
mov    %r15d,%r12d
neg    %r12d
mov    %r15d,%ebx
jmp    132d <test+0x21d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
cmp    %r14d,%ebx
je     136d <test+0x25d>
add    $0x1,%ebx
test   %r15d,%r15d
jle    1310 <test+0x200>
mov    $0x1,%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>
lea    (%r12,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1340 <test+0x230>
jmp    1310 <test+0x200>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @test(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 2
br i1 %9, label %10, label %28
10: ; preds = %7
store i32 1, i32* %6
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %3
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = call i32 @hash(i32 1)
%17 = load i32, i32* %5
%18 = call i32 @hash(i32 %17)
%19 = load i32, i32* %6
%20 = call i32 @hash(i32 %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %11
24: ; preds = %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
store i32 3, i32* %5
br label %29
29: ; preds = %76, %28
%30 = load i32, i32* %5
%31 = load i32, i32* %3
%32 = sub nsw i32 %31, 1
%33 = icmp sle i32 %30, %32
br i1 %33, label %34, label %79
34: ; preds = %29
store i32 1, i32* %6
br label %35
35: ; preds = %46, %34
%36 = load i32, i32* %6
%37 = load i32, i32* %5
%38 = sub nsw i32 %37, 1
%39 = icmp sle i32 %36, %38
br i1 %39, label %40, label %49
40: ; preds = %35
%41 = call i32 @hash(i32 1)
%42 = load i32, i32* %5
%43 = call i32 @hash(i32 %42)
%44 = load i32, i32* %6
%45 = call i32 @hash(i32 %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %35
49: ; preds = %35
%50 = call i32 @hash(i32 1)
%51 = load i32, i32* %5
%52 = call i32 @hash(i32 %51)
%53 = load i32, i32* %5
%54 = call i32 @hash(i32 %53)
%55 = call i32 @hash(i32 2)
%56 = load i32, i32* %5
%57 = call i32 @hash(i32 %56)
%58 = load i32, i32* %5
%59 = call i32 @hash(i32 %58)
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
br label %62
62: ; preds = %72, %49
%63 = load i32, i32* %6
%64 = load i32, i32* %3
%65 = icmp sle i32 %63, %64
br i1 %65, label %66, label %75
66: ; preds = %62
%67 = call i32 @hash(i32 1)
%68 = load i32, i32* %5
%69 = call i32 @hash(i32 %68)
%70 = load i32, i32* %6
%71 = call i32 @hash(i32 %70)
br label %72
72: ; preds = %66
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %62
75: ; preds = %62
br label %76
76: ; preds = %75
%77 = load i32, i32* %5
%78 = add nsw i32 %77, 1
store i32 %78, i32* %5
br label %29
79: ; preds = %29
store i32 1, i32* %6
br label %80
80: ; preds = %91, %79
%81 = load i32, i32* %6
%82 = load i32, i32* %3
%83 = sub nsw i32 %82, 1
%84 = icmp sle i32 %81, %83
br i1 %84, label %85, label %94
85: ; preds = %80
%86 = call i32 @hash(i32 1)
%87 = load i32, i32* %3
%88 = call i32 @hash(i32 %87)
%89 = load i32, i32* %6
%90 = call i32 @hash(i32 %89)
br label %91
91: ; preds = %85
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
store i32 %93, i32* %6
br label %80
94: ; preds = %80
%95 = call i32 @hash(i32 1)
%96 = load i32, i32* %3
%97 = call i32 @hash(i32 %96)
%98 = load i32, i32* %3
%99 = call i32 @hash(i32 %98)
%100 = call i32 @hash(i32 2)
%101 = load i32, i32* %3
%102 = call i32 @hash(i32 %101)
%103 = load i32, i32* %3
%104 = call i32 @hash(i32 %103)
%105 = load i32, i32* %3
%106 = add nsw i32 %105, 1
store i32 %106, i32* %5
br label %107
107: ; preds = %131, %94
%108 = load i32, i32* %5
%109 = load i32, i32* %4
%110 = icmp sle i32 %108, %109
br i1 %110, label %111, label %134
111: ; preds = %107
store i32 1, i32* %6
br label %112
112: ; preds = %122, %111
%113 = load i32, i32* %6
%114 = load i32, i32* %3
%115 = icmp sle i32 %113, %114
br i1 %115, label %116, label %125
116: ; preds = %112
%117 = call i32 @hash(i32 1)
%118 = load i32, i32* %5
%119 = call i32 @hash(i32 %118)
%120 = load i32, i32* %6
%121 = call i32 @hash(i32 %120)
br label %122
122: ; preds = %116
%123 = load i32, i32* %6
%124 = add nsw i32 %123, 1
store i32 %124, i32* %6
br label %112
125: ; preds = %112
%126 = call i32 @hash(i32 2)
%127 = load i32, i32* %5
%128 = call i32 @hash(i32 %127)
%129 = load i32, i32* %5
%130 = call i32 @hash(i32 %129)
br label %131
131: ; preds = %125
%132 = load i32, i32* %5
%133 = add nsw i32 %132, 1
store i32 %133, i32* %5
br label %107
134: ; preds = %107
ret void
}

LLVM IR (-O2):
define void @test(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %56, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ 1, %2 ]
%6 = tail call i32 @hash(i32 1)
%7 = tail call i32 @hash(i32 1)
%8 = tail call i32 @hash(i32 %5)
%9 = add nuw i32 %5, 1
%10 = icmp eq i32 %5, %0
br i1 %10, label %11, label %4
11: ; preds = %4
br i1 %3, label %56, label %12
12: ; preds = %11, %12
%13 = phi i32 [ %17, %12 ], [ 1, %11 ]
%14 = tail call i32 @hash(i32 1)
%15 = tail call i32 @hash(i32 2)
%16 = tail call i32 @hash(i32 %13)
%17 = add nuw i32 %13, 1
%18 = icmp eq i32 %13, %0
br i1 %18, label %19, label %12
19: ; preds = %12
%20 = icmp sgt i32 %0, 3
br i1 %20, label %23, label %25
21: ; preds = %42
%22 = icmp eq i32 %41, %0
br i1 %22, label %25, label %23
23: ; preds = %19, %21
%24 = phi i32 [ %41, %21 ], [ 3, %19 ]
br label %27
25: ; preds = %21, %19
%26 = icmp sgt i32 %0, 1
br i1 %26, label %49, label %56
27: ; preds = %23, %27
%28 = phi i32 [ 1, %23 ], [ %32, %27 ]
%29 = tail call i32 @hash(i32 1)
%30 = tail call i32 @hash(i32 %24)
%31 = tail call i32 @hash(i32 %28)
%32 = add nuw nsw i32 %28, 1
%33 = icmp eq i32 %32, %24
br i1 %33, label %34, label %27
34: ; preds = %27
%35 = tail call i32 @hash(i32 1)
%36 = tail call i32 @hash(i32 %24)
%37 = tail call i32 @hash(i32 %24)
%38 = tail call i32 @hash(i32 2)
%39 = tail call i32 @hash(i32 %24)
%40 = tail call i32 @hash(i32 %24)
%41 = add nuw nsw i32 %24, 1
br label %42
42: ; preds = %34, %42
%43 = phi i32 [ %47, %42 ], [ %41, %34 ]
%44 = tail call i32 @hash(i32 1)
%45 = tail call i32 @hash(i32 %24)
%46 = tail call i32 @hash(i32 %43)
%47 = add nuw i32 %43, 1
%48 = icmp eq i32 %43, %0
br i1 %48, label %21, label %42
49: ; preds = %25, %49
%50 = phi i32 [ %54, %49 ], [ 1, %25 ]
%51 = tail call i32 @hash(i32 1)
%52 = tail call i32 @hash(i32 %0)
%53 = tail call i32 @hash(i32 %50)
%54 = add nuw nsw i32 %50, 1
%55 = icmp eq i32 %54, %0
br i1 %55, label %56, label %49
56: ; preds = %49, %11, %2, %25
%57 = tail call i32 @hash(i32 1)
%58 = tail call i32 @hash(i32 %0)
%59 = tail call i32 @hash(i32 %0)
%60 = tail call i32 @hash(i32 2)
%61 = tail call i32 @hash(i32 %0)
%62 = tail call i32 @hash(i32 %0)
%63 = icmp slt i32 %0, %1
br i1 %63, label %64, label %79
64: ; preds = %56, %74
%65 = phi i32 [ %66, %74 ], [ %0, %56 ]
%66 = add i32 %65, 1
br i1 %3, label %74, label %67
67: ; preds = %64, %67
%68 = phi i32 [ %72, %67 ], [ 1, %64 ]
%69 = tail call i32 @hash(i32 1)
%70 = tail call i32 @hash(i32 %66)
%71 = tail call i32 @hash(i32 %68)
%72 = add nuw i32 %68, 1
%73 = icmp eq i32 %68, %0
br i1 %73, label %74, label %67
74: ; preds = %67, %64
%75 = tail call i32 @hash(i32 2)
%76 = tail call i32 @hash(i32 %66)
%77 = tail call i32 @hash(i32 %66)
%78 = icmp eq i32 %66, %1
br i1 %78, label %79, label %64
79: ; preds = %74, %56
ret void
}