#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 main() {
  unsigned int x1 = 0, x2 = 0;
  int s = 1;
  while (__VERIFIER_nondet_bool()) {
    if (s == 1)
      x1++;
    else if (s == 2)
      x2++;
    s++;
    if (s == 5)
      s = 1;
  }
  if (s >= 4) {
  ERROR:
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_bool@plt>
cmp    $0x0,%rax
je     1194 <main+0x84>
cmpl   $0x1,-0x10(%rbp)
jne    115d <main+0x4d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x65>
cmpl   $0x2,-0x10(%rbp)
jne    1170 <main+0x60>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <main+0x65>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jne    118f <main+0x7f>
movl   $0x1,-0x10(%rbp)
jmp    1134 <main+0x24>
cmpl   $0x4,-0x10(%rbp)
jl     11aa <main+0x9a>
jmp    11a3 <main+0x93>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
test   %rax,%rax
je     114d <main+0x3d>
mov    $0x1,%ebx
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x5,%ebp
cmove  %ebx,%ebp
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
test   %rax,%rax
jne    1130 <main+0x20>
xor    %ebx,%ebx
cmp    $0x4,%ebp
setge  %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %27, %0
%6 = call i64 (...) @__VERIFIER_nondet_bool()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add i32 %12, 1
store i32 %13, i32* %2
br label %21
14: ; preds = %8
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %3
%19 = add i32 %18, 1
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %14
br label %21
21: ; preds = %20, %11
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 5
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 1, i32* %4
br label %27
27: ; preds = %26, %21
br label %5
28: ; preds = %5
%29 = load i32, i32* %4
%30 = icmp sge i32 %29, 4
br i1 %30, label %31, label %33
31: ; preds = %28
br label %32
32: ; preds = %31
store i32 1, i32* %1
br label %33
33: ; preds = %32, %28
%34 = load i32, i32* %1
ret i32 %34
}

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 ], [ 1, %0 ]
%5 = add nsw i32 %4, 1
%6 = icmp eq i32 %5, 5
%7 = select i1 %6, i32 1, i32 %5
%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 sgt i32 %7, 3
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %10, %0
%14 = phi i32 [ 0, %0 ], [ %12, %10 ]
ret i32 %14
}