#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 example4c(void) {
  int a[42];
  int j;
  int i = 41;
  while (i > 8) {
    a[i] = 7;
    a[i - 2] = 31;
    if (i < 41) {
      assert(a[i + 1] == 7);
    }
    i--;
  }
}


x86 assembly (clang, -O0):
<example4c>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x29,-0xb8(%rbp)
cmpl   $0x8,-0xb8(%rbp)
jle    119b <example4c+0x8b>
movslq -0xb8(%rbp),%rax
movl   $0x7,-0xb0(%rbp,%rax,4)
mov    -0xb8(%rbp),%eax
sub    $0x2,%eax
cltq
movl   $0x1f,-0xb0(%rbp,%rax,4)
cmpl   $0x29,-0xb8(%rbp)
jge    1187 <example4c+0x77>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
cltq
cmpl   $0x7,-0xb0(%rbp,%rax,4)
07
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xb8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xb8(%rbp)
jmp    1125 <example4c+0x15>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example4c>:
push   %rbx
sub    $0xb0,%rsp
mov    $0x2a,%eax
jmp    1129 <example4c+0x19>
nop
mov    %rbx,%rax
cmp    $0x9,%rbx
jbe    1154 <example4c+0x44>
lea    -0x1(%rax),%rbx
movl   $0x7,-0x4(%rsp,%rax,4)
movl   $0x1f,-0xc(%rsp,%rax,4)
cmp    $0x28,%rbx
ja     1120 <example4c+0x10>
xor    %edi,%edi
cmpl   $0x7,(%rsp,%rax,4)
sete   %dil
call   1030 <assert@plt>
jmp    1120 <example4c+0x10>
add    $0xb0,%rsp
pop    %rbx
ret

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

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