#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 /*<<< orphan*/);
main() {
  int i;
  int a[3];
  a[1] = 0;
  i = 0;
  while ((a[i] != 0) && (i < 3)) {
    a[i] = 2 * i;
    i = i + 1;
  }
  if (i >= 2) {
    assert(0);
  } else {
    ;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp,%rcx,4)
mov    %al,-0x15(%rbp)
je     114b <main+0x3b>
cmpl   $0x3,-0x8(%rbp)
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115b <main+0x4b>
jmp    1177 <main+0x67>
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x14(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
cmpl   $0x2,-0x8(%rbp)
jl     118d <main+0x7d>
xor    %edi,%edi
call   1030 <assert@plt>
jmp    1192 <main+0x82>
jmp    1192 <main+0x82>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x0,0xc(%rsp)
mov    $0x1,%al
test   %al,%al
jne    1144 <main+0x34>
movl   $0x2,0x10(%rsp)
mov    0x14(%rsp),%eax
test   %eax,%eax
mov    $0x4,%ecx
cmove  %eax,%ecx
mov    %ecx,0x14(%rsp)
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
store i32 0, i32* %1
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store i32 0, i32* %4
store i32 0, i32* %2
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %5
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 3
br label %14
14: ; preds = %11, %5
%15 = phi i1 [ false, %5 ], [ %13, %11 ]
br i1 %15, label %16, label %24
16: ; preds = %14
%17 = load i32, i32* %2
%18 = mul nsw i32 2, %17
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %20
store i32 %18, i32* %21
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %5
24: ; preds = %14
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 2
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @assert(i32 0)
br label %30
29: ; preds = %24
br label %30
30: ; preds = %29, %27
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 0, i32* %3
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 0, i32* %4
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %0
store i32 2, i32* %5
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 %10, i32 4
store i32 %12, i32* %9
%13 = tail call i32 @assert(i32 0)
br label %14
14: ; preds = %0, %8
ret i32 0
}