#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 (i = 0; i <= ((10) < (M) ? (10) : (M)); i++) {
    for (j = 0; j <= ((10) < (M) ? (10) : (M)); j++) {
      {
        hash(1);
        hash(i);
        hash(j);
      };
    }
  }
}


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
mov    %eax,-0x10(%rbp)
mov    $0xa,%eax
cmp    -0x4(%rbp),%eax
jge    1143 <test+0x33>
mov    $0xa,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <test+0x39>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jg     11ce <test+0xbe>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0xa,%eax
cmp    -0x4(%rbp),%eax
jge    117f <test+0x6f>
mov    $0xa,%eax
mov    %eax,-0x1c(%rbp)
jmp    1185 <test+0x75>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jg     11bb <test+0xab>
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    115e <test+0x4e>
jmp    11c0 <test+0xb0>
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   %rbx
push   %rax
cmp    $0xa,%edi
mov    $0xa,%r14d
cmovl  %edi,%r14d
test   %r14d,%r14d
js     116a <test+0x5a>
lea    0x1(%r14),%r15d
xor    %ebx,%ebx
nop
xor    %ebp,%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>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1140 <test+0x30>
lea    0x1(%rbx),%eax
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1130 <test+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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* %3
br label %5
5: ; preds = %36, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 10, %7
br i1 %8, label %9, label %10
9: ; preds = %5
br label %12
10: ; preds = %5
%11 = load i32, i32* %2
br label %12
12: ; preds = %10, %9
%13 = phi i32 [ 10, %9 ], [ %11, %10 ]
%14 = icmp sle i32 %6, %13
br i1 %14, label %15, label %39
15: ; preds = %12
store i32 0, i32* %4
br label %16
16: ; preds = %32, %15
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = icmp slt i32 10, %18
br i1 %19, label %20, label %21
20: ; preds = %16
br label %23
21: ; preds = %16
%22 = load i32, i32* %2
br label %23
23: ; preds = %21, %20
%24 = phi i32 [ 10, %20 ], [ %22, %21 ]
%25 = icmp sle i32 %17, %24
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = call i32 @hash(i32 1)
%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 %16
35: ; preds = %23
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %5
39: ; preds = %12
ret void
}

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