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


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1194 <test+0x84>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%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    115e <test+0x4e>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1270 <test+0x160>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11ec <test+0xdc>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%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    11b3 <test+0xa3>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     125d <test+0x14d>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%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    1229 <test+0x119>
jmp    1262 <test+0x152>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119b <test+0x8b>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     12b0 <test+0x1a0>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x4(%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    1277 <test+0x167>
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>
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    %edi,%r14d
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x2,%ebx
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
cmp    $0x2,%r14d
jl     12b1 <test+0x1a1>
mov    %r14d,%r15d
neg    %r15d
nop
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1170 <test+0x60>
cmp    $0x3,%r14d
jl     1278 <test+0x168>
mov    $0x2,%r13d
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13d,%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    (%r12,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x2,%eax
jne    11d0 <test+0xc0>
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),%r13d
mov    %r13d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
lea    (%r15,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1240 <test+0x130>
add    $0xffffffff,%r12d
cmp    %r14d,%r13d
jne    11c0 <test+0xb0>
cmp    $0x2,%r14d
jl     12b1 <test+0x1a1>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1290 <test+0x180>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
call   1030 <hash@plt>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <hash@plt>

LLVM IR (-O0):
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @hash(i32 1)
%6 = call i32 @hash(i32 1)
%7 = call i32 @hash(i32 1)
%8 = call i32 @hash(i32 2)
%9 = call i32 @hash(i32 1)
%10 = call i32 @hash(i32 1)
store i32 2, i32* %4
br label %11
11: ; preds = %20, %1
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = call i32 @hash(i32 1)
%17 = call i32 @hash(i32 1)
%18 = load i32, i32* %4
%19 = call i32 @hash(i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %11
23: ; preds = %11
store i32 2, i32* %3
br label %24
24: ; preds = %71, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 1
%28 = icmp sle i32 %25, %27
br i1 %28, label %29, label %74
29: ; preds = %24
store i32 1, i32* %4
br label %30
30: ; preds = %41, %29
%31 = load i32, i32* %4
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 1
%34 = icmp sle i32 %31, %33
br i1 %34, label %35, label %44
35: ; preds = %30
%36 = call i32 @hash(i32 1)
%37 = load i32, i32* %3
%38 = call i32 @hash(i32 %37)
%39 = load i32, i32* %4
%40 = call i32 @hash(i32 %39)
br label %41
41: ; preds = %35
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %30
44: ; preds = %30
%45 = call i32 @hash(i32 1)
%46 = load i32, i32* %3
%47 = call i32 @hash(i32 %46)
%48 = load i32, i32* %3
%49 = call i32 @hash(i32 %48)
%50 = call i32 @hash(i32 2)
%51 = load i32, i32* %3
%52 = call i32 @hash(i32 %51)
%53 = load i32, i32* %3
%54 = call i32 @hash(i32 %53)
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %57
57: ; preds = %67, %44
%58 = load i32, i32* %4
%59 = load i32, i32* %2
%60 = icmp sle i32 %58, %59
br i1 %60, label %61, label %70
61: ; preds = %57
%62 = call i32 @hash(i32 1)
%63 = load i32, i32* %3
%64 = call i32 @hash(i32 %63)
%65 = load i32, i32* %4
%66 = call i32 @hash(i32 %65)
br label %67
67: ; preds = %61
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
store i32 %69, i32* %4
br label %57
70: ; preds = %57
br label %71
71: ; preds = %70
%72 = load i32, i32* %3
%73 = add nsw i32 %72, 1
store i32 %73, i32* %3
br label %24
74: ; preds = %24
store i32 1, i32* %4
br label %75
75: ; preds = %86, %74
%76 = load i32, i32* %4
%77 = load i32, i32* %2
%78 = sub nsw i32 %77, 1
%79 = icmp sle i32 %76, %78
br i1 %79, label %80, label %89
80: ; preds = %75
%81 = call i32 @hash(i32 1)
%82 = load i32, i32* %2
%83 = call i32 @hash(i32 %82)
%84 = load i32, i32* %4
%85 = call i32 @hash(i32 %84)
br label %86
86: ; preds = %80
%87 = load i32, i32* %4
%88 = add nsw i32 %87, 1
store i32 %88, i32* %4
br label %75
89: ; preds = %75
%90 = call i32 @hash(i32 1)
%91 = load i32, i32* %2
%92 = call i32 @hash(i32 %91)
%93 = load i32, i32* %2
%94 = call i32 @hash(i32 %93)
%95 = call i32 @hash(i32 2)
%96 = load i32, i32* %2
%97 = call i32 @hash(i32 %96)
%98 = load i32, i32* %2
%99 = call i32 @hash(i32 %98)
ret void
}

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