#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 example5(void) {
  int a[42];
  int b[42];
  int i = 0;
  while (i < 42) {
    a[i] = 2;
    b[41 - i] = 0;
    assert(b[7] == 0);
    assert(a[5] == 2);
    i++;
  }
  assert(a[0] == 2);
  assert(a[41] == 2);
  assert(b[0] == 0);
  assert(b[41] == 0);
}


x86 assembly (clang, -O0):
<example5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x164(%rbp)
cmpl   $0x2a,-0x164(%rbp)
jge    1198 <example5+0x88>
movslq -0x164(%rbp),%rax
movl   $0x2,-0xb0(%rbp,%rax,4)
mov    $0x29,%eax
sub    -0x164(%rbp),%eax
cltq
movl   $0x0,-0x160(%rbp,%rax,4)
cmpl   $0x0,-0x144(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2,-0x9c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1125 <example5+0x15>
cmpl   $0x2,-0xb0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x160(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0xbc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example5>:
push   %r14
push   %rbx
sub    $0x158,%rsp
mov    $0x29,%r14d
lea    0xb0(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movl   $0x2,(%rbx)
movl   $0x0,(%rsp,%r14,4)
xor    %edi,%edi
cmpl   $0x0,0x1c(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0xc4(%rsp)
02
sete   %dil
call   1030 <assert@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r14
jb     1130 <example5+0x20>
xor    %edi,%edi
cmpl   $0x2,0xb0(%rsp)
02
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0x154(%rsp)
02
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,0xa4(%rsp)
sete   %dil
add    $0x158,%rsp
pop    %rbx
pop    %r14
jmp    1030 <assert@plt>

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

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