#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 example4(void) {
  int a[42];
  int i = 0;
  while (i <= 9) {
    a[i] = 9;
    int j = i + 5;
    a[j] = 42;
    assert(a[i] == 9);
    if (i > 0) {
      int k = a[i - 1];
      assert(k == 9);
      int l = a[0];
      assert(l == 9);
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<example4>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0xb4(%rbp)
cmpl   $0x9,-0xb4(%rbp)
jg     11ee <example4+0xde>
movslq -0xb4(%rbp),%rax
movl   $0x9,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xb8(%rbp)
movslq -0xb8(%rbp),%rax
movl   $0x2a,-0xb0(%rbp,%rax,4)
movslq -0xb4(%rbp),%rax
cmpl   $0x9,-0xb0(%rbp,%rax,4)
09
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0xb4(%rbp)
jle    11da <example4+0xca>
mov    -0xb4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0xb0(%rbp,%rax,4),%eax
mov    %eax,-0xbc(%rbp)
cmpl   $0x9,-0xbc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb0(%rbp),%eax
mov    %eax,-0xc0(%rbp)
cmpl   $0x9,-0xc0(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1125 <example4+0x15>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example4>:
push   %rbx
sub    $0xb0,%rsp
movl   $0x9,(%rsp)
movl   $0x2a,0x14(%rsp)
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movl   $0x9,0x4(%rsp,%rbx,4)
movl   $0x2a,0x18(%rsp,%rbx,4)
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x9,(%rsp,%rbx,4)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x9,(%rsp)
sete   %dil
call   1030 <assert@plt>
add    $0x1,%rbx
cmp    $0x9,%rbx
jne    1140 <example4+0x30>
add    $0xb0,%rsp
pop    %rbx
ret

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

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