#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 example6(void) {
  int a[42];
  int i = 0;
  int j = 0;
  int top;
  while (i < 42) {
    a[i] = 4;
    i++;
  }
  assert(a[17] == 4);
  assert(a[9] == 4);
  assert(a[3] == 4);
  assert(a[i - 1] == 4);
  while (j < 10) {
    a[j] = -1;
    j++;
  }
  assert(a[3] == -1);
  assert(a[0] == -1);
  assert(a[j - 1] == -1);
  assert(a[j] == 4);
  assert(a[17] == 4);
  assert(a[j + 5] == 4);
}


x86 assembly (clang, -O0):
<example6>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
cmpl   $0x2a,-0xb4(%rbp)
jge    1162 <example6+0x52>
movslq -0xb4(%rbp),%rax
movl   $0x4,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    112f <example6+0x1f>
cmpl   $0x4,-0x6c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0x8c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0xa4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb4(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0x4,-0xb0(%rbp,%rax,4)
04
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0xa,-0xb8(%rbp)
jge    11ee <example6+0xde>
movslq -0xb8(%rbp),%rax
movl   $0xffffffff,-0xb0(%rbp,%rax,4)
ff ff ff ff
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    11bb <example6+0xab>
cmpl   $0xffffffff,-0xa4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0xffffffff,-0xb0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb8(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0xffffffff,-0xb0(%rbp,%rax,4)
ff
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movslq -0xb8(%rbp),%rax
cmpl   $0x4,-0xb0(%rbp,%rax,4)
04
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0x6c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb8(%rbp),%eax
add    $0x5,%eax
cltq
cmpl   $0x4,-0xb0(%rbp,%rax,4)
04
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example6>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @example6() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @assert(i32 1)
ret void
}