#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 example2(void) {
  int a[20];
  int i = 0;
  int j = 0;
  int top;
  int z;
  int between1and8;
  if (between1and8 < 1) {
    between1and8 = 1;
  }
  if (between1and8 > 8) {
    between1and8 = 8;
  }
  while (i < 20) {
    a[i] = 0;
    i++;
  }
  while (j < between1and8) {
    a[j] = 2;
    j++;
  }
  a[j] = 1;
  if (top) {
    z = j;
  } else {
    z = j + 1;
  }
  assert(a[z] == 1);
  assert(a[z] == 0);
  assert(a[z] == 2);
}


x86 assembly (clang, -O0):
<example2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x1,-0x64(%rbp)
jge    1137 <example2+0x27>
movl   $0x1,-0x64(%rbp)
cmpl   $0x8,-0x64(%rbp)
jle    1148 <example2+0x38>
movl   $0x8,-0x64(%rbp)
jmp    114d <example2+0x3d>
cmpl   $0x14,-0x54(%rbp)
jge    1171 <example2+0x61>
movslq -0x54(%rbp),%rax
movl   $0x0,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    114d <example2+0x3d>
jmp    1176 <example2+0x66>
mov    -0x58(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    119c <example2+0x8c>
movslq -0x58(%rbp),%rax
movl   $0x2,-0x50(%rbp,%rax,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1176 <example2+0x66>
movslq -0x58(%rbp),%rax
movl   $0x1,-0x50(%rbp,%rax,4)
cmpl   $0x0,-0x5c(%rbp)
je     11bd <example2+0xad>
mov    -0x58(%rbp),%eax
mov    %eax,-0x60(%rbp)
jmp    11c6 <example2+0xb6>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
movslq -0x60(%rbp),%rax
cmpl   $0x1,-0x50(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movslq -0x60(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movslq -0x60(%rbp),%rax
cmpl   $0x2,-0x50(%rbp,%rax,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x70,%rsp
pop    %rbp
ret

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

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

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