#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;
  for (j = 0; j <= 7; j++) {
    {
      hash(1);
      hash(1);
      hash(j);
    };
  }
  for (i = 2; i <= 5; i++) {
    for (j = 0; j <= i - 2; j++) {
      {
        hash(2);
        hash(i);
        hash(j);
      };
    }
    for (j = i - 1; j <= 4; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
      {
        hash(2);
        hash(i);
        hash(j);
      };
    }
    for (j = 5; j <= 7; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
  }
  for (j = 0; j <= 4; j++) {
    {
      hash(2);
      hash(6);
      hash(j);
    };
  }
  for (j = 5; j <= 7; j++) {
    {
      hash(1);
      hash(6);
      hash(j);
    };
  }
  for (i = 7; i <= 8; i++) {
    for (j = i - 1; j <= 7; j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     1156 <test+0x46>
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    1122 <test+0x12>
movl   $0x2,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     1248 <test+0x138>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     11a7 <test+0x97>
mov    $0x2,%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    116e <test+0x5e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jg     11fc <test+0xec>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0xc(%rbp),%edi
call   1030 <hash@plt>
mov    $0x2,%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    11b0 <test+0xa0>
movl   $0x5,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     1235 <test+0x125>
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    1203 <test+0xf3>
jmp    123a <test+0x12a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <test+0x4d>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jg     1283 <test+0x173>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x6,%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    124f <test+0x13f>
movl   $0x5,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     12be <test+0x1ae>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x6,%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    128a <test+0x17a>
movl   $0x7,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jg     131d <test+0x20d>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     130a <test+0x1fa>
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    12d8 <test+0x1c8>
jmp    130f <test+0x1ff>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12c5 <test+0x1b5>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%r14d
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
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>
mov    $0x3,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x4,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x5,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
call   1030 <hash@plt>
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2,%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    1220 <test+0x110>
lea    -0x1(%rbx),%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    %ebp,%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>
add    $0x1,%ebp
cmp    $0x5,%ebp
jne    1250 <test+0x140>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    $0x5,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
call   1030 <hash@plt>
add    $0x1,%ebx
add    $0x1,%r14d
cmp    $0x5,%r14d
jne    1210 <test+0x100>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
xor    %edi,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x3,%edi
call   1030 <hash@plt>
mov    $0x2,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x4,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x5,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
call   1030 <hash@plt>
mov    $0x6,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
call   1030 <hash@plt>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    $0x8,%edi
call   1030 <hash@plt>
mov    $0x7,%edi
pop    %rbx
pop    %r14
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
store i32 0, i32* %4
br label %5
5: ; preds = %13, %1
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 7
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = call i32 @hash(i32 1)
%10 = call i32 @hash(i32 1)
%11 = load i32, i32* %4
%12 = call i32 @hash(i32 %11)
br label %13
13: ; preds = %8
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %5
16: ; preds = %5
store i32 2, i32* %3
br label %17
17: ; preds = %69, %16
%18 = load i32, i32* %3
%19 = icmp sle i32 %18, 5
br i1 %19, label %20, label %72
20: ; preds = %17
store i32 0, i32* %4
br label %21
21: ; preds = %32, %20
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 2
%25 = icmp sle i32 %22, %24
br i1 %25, label %26, label %35
26: ; preds = %21
%27 = call i32 @hash(i32 2)
%28 = load i32, i32* %3
%29 = call i32 @hash(i32 %28)
%30 = load i32, i32* %4
%31 = call i32 @hash(i32 %30)
br label %32
32: ; preds = %26
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %21
35: ; preds = %21
%36 = load i32, i32* %3
%37 = sub nsw i32 %36, 1
store i32 %37, i32* %4
br label %38
38: ; preds = %52, %35
%39 = load i32, i32* %4
%40 = icmp sle i32 %39, 4
br i1 %40, label %41, label %55
41: ; preds = %38
%42 = call i32 @hash(i32 1)
%43 = load i32, i32* %3
%44 = call i32 @hash(i32 %43)
%45 = load i32, i32* %4
%46 = call i32 @hash(i32 %45)
%47 = call i32 @hash(i32 2)
%48 = load i32, i32* %3
%49 = call i32 @hash(i32 %48)
%50 = load i32, i32* %4
%51 = call i32 @hash(i32 %50)
br label %52
52: ; preds = %41
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
store i32 %54, i32* %4
br label %38
55: ; preds = %38
store i32 5, i32* %4
br label %56
56: ; preds = %65, %55
%57 = load i32, i32* %4
%58 = icmp sle i32 %57, 7
br i1 %58, label %59, label %68
59: ; preds = %56
%60 = call i32 @hash(i32 1)
%61 = load i32, i32* %3
%62 = call i32 @hash(i32 %61)
%63 = load i32, i32* %4
%64 = call i32 @hash(i32 %63)
br label %65
65: ; preds = %59
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 1
store i32 %67, i32* %4
br label %56
68: ; preds = %56
br label %69
69: ; preds = %68
%70 = load i32, i32* %3
%71 = add nsw i32 %70, 1
store i32 %71, i32* %3
br label %17
72: ; preds = %17
store i32 0, i32* %4
br label %73
73: ; preds = %81, %72
%74 = load i32, i32* %4
%75 = icmp sle i32 %74, 4
br i1 %75, label %76, label %84
76: ; preds = %73
%77 = call i32 @hash(i32 2)
%78 = call i32 @hash(i32 6)
%79 = load i32, i32* %4
%80 = call i32 @hash(i32 %79)
br label %81
81: ; preds = %76
%82 = load i32, i32* %4
%83 = add nsw i32 %82, 1
store i32 %83, i32* %4
br label %73
84: ; preds = %73
store i32 5, i32* %4
br label %85
85: ; preds = %93, %84
%86 = load i32, i32* %4
%87 = icmp sle i32 %86, 7
br i1 %87, label %88, label %96
88: ; preds = %85
%89 = call i32 @hash(i32 1)
%90 = call i32 @hash(i32 6)
%91 = load i32, i32* %4
%92 = call i32 @hash(i32 %91)
br label %93
93: ; preds = %88
%94 = load i32, i32* %4
%95 = add nsw i32 %94, 1
store i32 %95, i32* %4
br label %85
96: ; preds = %85
store i32 7, i32* %3
br label %97
97: ; preds = %116, %96
%98 = load i32, i32* %3
%99 = icmp sle i32 %98, 8
br i1 %99, label %100, label %119
100: ; preds = %97
%101 = load i32, i32* %3
%102 = sub nsw i32 %101, 1
store i32 %102, i32* %4
br label %103
103: ; preds = %112, %100
%104 = load i32, i32* %4
%105 = icmp sle i32 %104, 7
br i1 %105, label %106, label %115
106: ; preds = %103
%107 = call i32 @hash(i32 1)
%108 = load i32, i32* %3
%109 = call i32 @hash(i32 %108)
%110 = load i32, i32* %4
%111 = call i32 @hash(i32 %110)
br label %112
112: ; preds = %106
%113 = load i32, i32* %4
%114 = add nsw i32 %113, 1
store i32 %114, i32* %4
br label %103
115: ; preds = %103
br label %116
116: ; preds = %115
%117 = load i32, i32* %3
%118 = add nsw i32 %117, 1
store i32 %118, i32* %3
br label %97
119: ; preds = %97
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 0)
%5 = tail call i32 @hash(i32 1)
%6 = tail call i32 @hash(i32 1)
%7 = tail call i32 @hash(i32 1)
%8 = tail call i32 @hash(i32 1)
%9 = tail call i32 @hash(i32 1)
%10 = tail call i32 @hash(i32 2)
%11 = tail call i32 @hash(i32 1)
%12 = tail call i32 @hash(i32 1)
%13 = tail call i32 @hash(i32 3)
%14 = tail call i32 @hash(i32 1)
%15 = tail call i32 @hash(i32 1)
%16 = tail call i32 @hash(i32 4)
%17 = tail call i32 @hash(i32 1)
%18 = tail call i32 @hash(i32 1)
%19 = tail call i32 @hash(i32 5)
%20 = tail call i32 @hash(i32 1)
%21 = tail call i32 @hash(i32 1)
%22 = tail call i32 @hash(i32 6)
%23 = tail call i32 @hash(i32 1)
%24 = tail call i32 @hash(i32 1)
%25 = tail call i32 @hash(i32 7)
br label %26
26: ; preds = %38, %1
%27 = phi i32 [ 1, %1 ], [ %49, %38 ]
%28 = phi i32 [ 2, %1 ], [ %48, %38 ]
br label %29
29: ; preds = %26, %29
%30 = phi i32 [ %34, %29 ], [ 0, %26 ]
%31 = tail call i32 @hash(i32 2)
%32 = tail call i32 @hash(i32 %28)
%33 = tail call i32 @hash(i32 %30)
%34 = add nuw nsw i32 %30, 1
%35 = icmp eq i32 %34, %27
br i1 %35, label %36, label %29
36: ; preds = %29
%37 = add nsw i32 %28, -1
br label %51
38: ; preds = %51
%39 = tail call i32 @hash(i32 1)
%40 = tail call i32 @hash(i32 %28)
%41 = tail call i32 @hash(i32 5)
%42 = tail call i32 @hash(i32 1)
%43 = tail call i32 @hash(i32 %28)
%44 = tail call i32 @hash(i32 6)
%45 = tail call i32 @hash(i32 1)
%46 = tail call i32 @hash(i32 %28)
%47 = tail call i32 @hash(i32 7)
%48 = add nuw nsw i32 %28, 1
%49 = add nuw nsw i32 %27, 1
%50 = icmp eq i32 %49, 5
br i1 %50, label %61, label %26
51: ; preds = %36, %51
%52 = phi i32 [ %59, %51 ], [ %37, %36 ]
%53 = tail call i32 @hash(i32 1)
%54 = tail call i32 @hash(i32 %28)
%55 = tail call i32 @hash(i32 %52)
%56 = tail call i32 @hash(i32 2)
%57 = tail call i32 @hash(i32 %28)
%58 = tail call i32 @hash(i32 %52)
%59 = add nuw nsw i32 %52, 1
%60 = icmp eq i32 %59, 5
br i1 %60, label %38, label %51
61: ; preds = %38
%62 = tail call i32 @hash(i32 2)
%63 = tail call i32 @hash(i32 6)
%64 = tail call i32 @hash(i32 0)
%65 = tail call i32 @hash(i32 2)
%66 = tail call i32 @hash(i32 6)
%67 = tail call i32 @hash(i32 1)
%68 = tail call i32 @hash(i32 2)
%69 = tail call i32 @hash(i32 6)
%70 = tail call i32 @hash(i32 2)
%71 = tail call i32 @hash(i32 2)
%72 = tail call i32 @hash(i32 6)
%73 = tail call i32 @hash(i32 3)
%74 = tail call i32 @hash(i32 2)
%75 = tail call i32 @hash(i32 6)
%76 = tail call i32 @hash(i32 4)
%77 = tail call i32 @hash(i32 1)
%78 = tail call i32 @hash(i32 6)
%79 = tail call i32 @hash(i32 5)
%80 = tail call i32 @hash(i32 1)
%81 = tail call i32 @hash(i32 6)
%82 = tail call i32 @hash(i32 6)
%83 = tail call i32 @hash(i32 1)
%84 = tail call i32 @hash(i32 6)
%85 = tail call i32 @hash(i32 7)
%86 = tail call i32 @hash(i32 1)
%87 = tail call i32 @hash(i32 7)
%88 = tail call i32 @hash(i32 6)
%89 = tail call i32 @hash(i32 1)
%90 = tail call i32 @hash(i32 7)
%91 = tail call i32 @hash(i32 7)
%92 = tail call i32 @hash(i32 1)
%93 = tail call i32 @hash(i32 8)
%94 = tail call i32 @hash(i32 7)
ret void
}