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


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     11b5 <test+0xa5>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1167 <test+0x57>
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    1133 <test+0x23>
movl   $0xb,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a2 <test+0x92>
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>
jmp    11a7 <test+0x97>
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   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
mov    %edi,%r15d
neg    %r15d
mov    $0x1,%ebp
mov    $0x2,%r12d
xor    %r13d,%r13d
jmp    1151 <test+0x41>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
add    $0x1,%r12d
add    $0xffffffff,%r13d
cmp    $0xc,%r12d
je     11d0 <test+0xc0>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %ebp,%edi
call   1030 <hash@plt>
mov    %ebx,%edi
call   1030 <hash@plt>
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x2,%eax
jne    1160 <test+0x50>
cmp    $0xb,%r14d
jl     1140 <test+0x30>
mov    $0xb,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x2,%edi
call   1030 <hash@plt>
mov    %ebp,%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    11a0 <test+0x90>
jmp    1140 <test+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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
store i32 %0, i32* %2
store i32 1, i32* %3
br label %7
7: ; preds = %39, %1
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 10
br i1 %9, label %10, label %42
10: ; preds = %7
store i32 1, i32* %4
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* %4
%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* %3
%18 = call i32 @hash(i32 %17)
%19 = load i32, i32* %4
%20 = call i32 @hash(i32 %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %11
24: ; preds = %11
store i32 11, i32* %4
br label %25
25: ; preds = %35, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %2
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = call i32 @hash(i32 2)
%31 = load i32, i32* %3
%32 = call i32 @hash(i32 %31)
%33 = load i32, i32* %4
%34 = call i32 @hash(i32 %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %25
38: ; preds = %25
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %7
42: ; preds = %7
ret void
}

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