#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 example7(void) {
  int top;
  int a[42];
  int i = 0;
  int j;
  while (i < 30) {
    a[i] = 0;
    i++;
    if (i > 10) {
      if (top) {
        j = i - 5;
      } else {
        j = i - 7;
      }
      assert(a[j] == 0);
    }
  }
}


x86 assembly (clang, -O0):
<example7>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0xb4(%rbp)
cmpl   $0x1e,-0xb4(%rbp)
jge    11ae <example7+0x9e>
movslq -0xb4(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
cmpl   $0xa,-0xb4(%rbp)
jle    11a9 <example7+0x99>
cmpl   $0x0,-0x4(%rbp)
je     117e <example7+0x6e>
mov    -0xb4(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0xb8(%rbp)
jmp    118d <example7+0x7d>
mov    -0xb4(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0xb8(%rbp)
movslq -0xb8(%rbp),%rax
cmpl   $0x0,-0xb0(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1125 <example7+0x15>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example7>:
push   %rbx
sub    $0xb0,%rsp
xor    %eax,%eax
jmp    1129 <example7+0x19>
nopl   0x0(%rax)
mov    %rbx,%rax
cmp    $0x1e,%rbx
je     114e <example7+0x3e>
movl   $0x0,(%rsp,%rax,4)
lea    0x1(%rax),%rbx
cmp    $0xa,%rax
jb     1120 <example7+0x10>
add    $0xfffffffa,%eax
xor    %edi,%edi
cmpl   $0x0,(%rsp,%rax,4)
sete   %dil
call   1030 <assert@plt>
jmp    1120 <example7+0x10>
add    $0xb0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @example7() {
%1 = alloca i32
%2 = alloca [42 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %3
br label %5
5: ; preds = %33, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 30
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [42 x i32], [42 x i32]* %2, i64 0, i64 %10
store i32 0, i32* %11
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 10
br i1 %15, label %16, label %33
16: ; preds = %8
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 5
store i32 %21, i32* %4
br label %25
22: ; preds = %16
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 7
store i32 %24, i32* %4
br label %25
25: ; preds = %22, %19
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [42 x i32], [42 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
br label %33
33: ; preds = %25, %8
br label %5
34: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @example7() {
%1 = alloca [42 x i32]
%2 = bitcast [42 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %16
%4 = phi i64 [ 0, %0 ], [ %6, %16 ]
%5 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %4
store i32 0, i32* %5
%6 = add nuw nsw i64 %4, 1
%7 = icmp ugt i64 %4, 9
br i1 %7, label %8, label %16
8: ; preds = %3
%9 = add nuw i64 %4, 4294967290
%10 = and i64 %9, 4294967295
%11 = getelementptr inbounds [42 x i32], [42 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
br label %16
16: ; preds = %8, %3
%17 = icmp eq i64 %6, 30
br i1 %17, label %18, label %3
18: ; preds = %16
ret void
}