#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 */
scalar_t__ __VERIFIER_nondet_bool();
int /*<<< orphan*/ assert(int);
int main() {
  int i = 0;
  while (__VERIFIER_nondet_bool()) {
    if (i == 4) {
      i = 0;
    }
    i++;
  }
  assert(i >= 0 && i < 5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_bool@plt>
cmp    $0x0,%rax
je     1166 <main+0x46>
cmpl   $0x4,-0x8(%rbp)
jne    1158 <main+0x38>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     117f <main+0x5f>
cmpl   $0x5,-0x8(%rbp)
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_bool@plt>
test   %rax,%rax
je     1162 <main+0x42>
mov    $0x1,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
cmp    $0x4,%ebx
lea    0x1(%rbx),%eax
mov    %eax,%ebx
cmove  %ebp,%ebx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_bool@plt>
test   %rax,%rax
jne    1140 <main+0x20>
xor    %edi,%edi
cmp    $0x5,%ebx
setb   %dil
jmp    1167 <main+0x47>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = call i64 (...) @__VERIFIER_nondet_bool()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 4
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 0, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = load i32, i32* %2
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 5
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ false, %13 ], [ %18, %16 ]
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @__VERIFIER_nondet_bool()
%2 = icmp eq i64 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %7, %3 ], [ 0, %0 ]
%5 = icmp eq i32 %4, 4
%6 = add nsw i32 %4, 1
%7 = select i1 %5, i32 1, i32 %6
%8 = tail call i64 (...) @__VERIFIER_nondet_bool()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = icmp ult i32 %7, 5
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %10, %0
%14 = phi i32 [ 1, %0 ], [ %12, %10 ]
%15 = tail call i32 @assert(i32 %14)
ret i32 0
}