#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 a[42];
  int i = 0;
  int top;
  if (top) {
    while (i < 41) {
      a[i] = 0;
      assert(a[i] == 0);
      i++;
    }
  }
  assert(a[0] == 0);
  assert(a[7] == 0);
  assert(a[41] == 0);
  assert(a[top] == 0);
}


x86 assembly (clang, -O0):
<example7>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0xb4(%rbp)
cmpl   $0x0,-0xb8(%rbp)
je     118b <example7+0x7b>
jmp    1137 <example7+0x27>
cmpl   $0x29,-0xb4(%rbp)
jge    1186 <example7+0x76>
movslq -0xb4(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
movslq -0xb4(%rbp),%rax
cmpl   $0x0,-0xb0(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1137 <example7+0x27>
jmp    118b <example7+0x7b>
cmpl   $0x0,-0xb0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x94(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movslq -0xb8(%rbp),%rax
cmpl   $0x0,-0xb0(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example7>:
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @example7() {
%1 = tail call i32 @assert(i32 0)
%2 = tail call i32 @assert(i32 0)
%3 = tail call i32 @assert(i32 0)
%4 = tail call i32 @assert(i32 0)
ret void
}