#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*/ assert(int);
void example8(void) {
  int a[42];
  int i = 0;
  int j = i;
  int N;
  if (N < 5) {
    N = 5;
  }
  if (N > 40) {
    N = 40;
  }
  while (i < N) {
    a[i] = 0;
    i++;
    j = i;
    a[j - 1] = 0;
    a[j] = 0;
    j++;
    i = j;
    assert(a[i - 1] == 0);
    assert(a[i - 2] == 0);
  }
  j = 0;
  while (j < N) {
    assert(a[j] == 0);
    j++;
  }
}


x86 assembly (clang, -O0):
<example8>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0xb8(%rbp)
cmpl   $0x5,-0xbc(%rbp)
jge    1148 <example8+0x38>
movl   $0x5,-0xbc(%rbp)
cmpl   $0x28,-0xbc(%rbp)
jle    115f <example8+0x4f>
movl   $0x28,-0xbc(%rbp)
jmp    1164 <example8+0x54>
mov    -0xb4(%rbp),%eax
cmp    -0xbc(%rbp),%eax
jge    122b <example8+0x11b>
movslq -0xb4(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
sub    $0x1,%eax
cltq
movl   $0x0,-0xb0(%rbp,%rax,4)
movslq -0xb8(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0x0,-0xb0(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb4(%rbp),%eax
sub    $0x2,%eax
cltq
cmpl   $0x0,-0xb0(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1164 <example8+0x54>
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xbc(%rbp),%eax
jge    1277 <example8+0x167>
movslq -0xb8(%rbp),%rax
cmpl   $0x0,-0xb0(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1235 <example8+0x125>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example8>:
ret

LLVM IR (-O0):
define void @example8() {
%1 = alloca [42 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 5, i32* %4
br label %9
9: ; preds = %8, %0
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 40
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 40, i32* %4
br label %13
13: ; preds = %12, %9
br label %14
14: ; preds = %18, %13
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %51
18: ; preds = %14
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %20
store i32 0, i32* %21
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
%24 = load i32, i32* %2
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %27
store i32 0, i32* %28
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %30
store i32 0, i32* %31
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
%34 = load i32, i32* %3
store i32 %34, i32* %2
%35 = load i32, i32* %2
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load i32, i32* %2
%44 = sub nsw i32 %43, 2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
br label %14
51: ; preds = %14
store i32 0, i32* %3
br label %52
52: ; preds = %56, %51
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %66
56: ; preds = %52
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, 0
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %52
66: ; preds = %52
ret void
}

LLVM IR (-O2):
define void @example8() {
ret void
}