#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;
  int i, j;
  if (M >= 2) {
    for (c2 = 2; c2 <= M; c2++) {
      if ((c2 + 5) % 7 == 0) {
        {
          hash(1);
          hash(c2);
          hash(((c2 - 2) / 7));
        };
      }
    }
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     118e <test+0x7e>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1189 <test+0x79>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1176 <test+0x66>
mov    $0x1,%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%edi
call   1030 <hash@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <hash@plt>
jmp    117b <test+0x6b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <test+0x1c>
jmp    118e <test+0x7e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    1127 <test+0x17>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %edi,%r14d
add    $0xffffffff,%r14d
xor    %ebx,%ebx
mov    $0x7,%ebp
jmp    114b <test+0x3b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x1,%ebp
cmp    %ebx,%r14d
je     111c <test+0xc>
mov    %ebp,%eax
imul   $0x24924925,%rax,%rax
shr    $0x20,%rax
mov    %ebp,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x2,%ecx
lea    0x0(,%rcx,8),%eax
sub    %ecx,%eax
add    $0xfffffff9,%eax
cmp    %ebx,%eax
jne    1140 <test+0x30>
lea    0x2(%rbx),%r15d
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
mov    %ebx,%eax
imul   $0x24924925,%rax,%rax
shr    $0x20,%rax
mov    %ebx,%edi
sub    %eax,%edi
shr    %edi
add    %eax,%edi
shr    $0x2,%edi
call   1030 <hash@plt>
jmp    1140 <test+0x30>

LLVM IR (-O0):
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 2
br i1 %7, label %8, label %31
8: ; preds = %1
store i32 2, i32* %3
br label %9
9: ; preds = %27, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 5
%16 = srem i32 %15, 7
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %13
%19 = call i32 @hash(i32 1)
%20 = load i32, i32* %3
%21 = call i32 @hash(i32 %20)
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, 2
%24 = sdiv i32 %23, 7
%25 = call i32 @hash(i32 %24)
br label %26
26: ; preds = %18, %13
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %9
30: ; preds = %9
br label %31
31: ; preds = %30, %1
ret void
}

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