#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 >= 0) {
    for (c2 = 0; 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   $0x0,-0x4(%rbp)
jl     118e <test+0x7e>
movl   $0x0,-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
test   %edi,%edi
js     11b5 <test+0xa5>
mov    %edi,%r14d
neg    %r14d
mov    $0xfffffffe,%ebp
mov    $0x5,%ebx
jmp    1156 <test+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%r14,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
add    $0x1,%ebx
mov    %ecx,%ebp
cmp    $0xffffffff,%eax
je     11b5 <test+0xa5>
mov    %ebx,%eax
imul   $0x24924925,%rax,%rax
shr    $0x20,%rax
mov    %ebx,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x2,%ecx
lea    0x0(,%rcx,8),%eax
sub    %eax,%ecx
add    %ebp,%ecx
cmp    $0xfffffff9,%ecx
jne    1140 <test+0x30>
lea    0x2(%rbp),%r15d
mov    $0x1,%edi
call   1030 <hash@plt>
mov    %r15d,%edi
call   1030 <hash@plt>
movslq %ebp,%rax
imul   $0xffffffff92492493,%rax,%rdi
shr    $0x20,%rdi
add    %ebp,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x2,%edi
add    %eax,%edi
call   1030 <hash@plt>
jmp    1140 <test+0x30>
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
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %31
8: ; preds = %1
store i32 0, 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, 0
br i1 %2, label %17, label %3
3: ; preds = %1, %14
%4 = phi i32 [ %15, %14 ], [ 0, %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 = sdiv 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
}