#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*/ __VERIFIER_assert(int);
int __VERIFIER_nondet_int();
int loop(int /*<<< orphan*/);
void main() {
  int x;
  x = loop(0);
  switch (__VERIFIER_nondet_int()) {
  case 0:
    __VERIFIER_assert(x <= 1);
    break;
  case 1:
    __VERIFIER_assert(x >= 0);
    break;
  case 2:
    __VERIFIER_assert(x <= 10);
    break;
  default:
    __VERIFIER_assert(x == 10);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
mov    %edi,-0xc(%rbp)
call   1030 <loop@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    %ecx,-0x4(%rbp)
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
test   %eax,%eax
je     1183 <main+0x53>
jmp    1161 <main+0x31>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     1199 <main+0x69>
jmp    1172 <main+0x42>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11af <main+0x7f>
jmp    11c5 <main+0x95>
cmpl   $0x1,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
jmp    11d6 <main+0xa6>
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
jmp    11d6 <main+0xa6>
cmpl   $0xa,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
jmp    11d6 <main+0xa6>
cmpl   $0xa,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1030 <loop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x2,%eax
je     1156 <main+0x26>
cmp    $0x1,%eax
je     1165 <main+0x35>
xor    %edi,%edi
test   %eax,%eax
jne    1172 <main+0x42>
cmp    $0x2,%ebx
jmp    115b <main+0x2b>
xor    %edi,%edi
cmp    $0xb,%ebx
setl   %dil
pop    %rbx
jmp    1050 <__VERIFIER_assert@plt>
not    %ebx
shr    $0x1f,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1050 <__VERIFIER_assert@plt>
cmp    $0xa,%ebx
sete   %dil
pop    %rbx
jmp    1050 <__VERIFIER_assert@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i32 @loop(i32 0)
store i32 %2, i32* %1
%3 = call i32 (...) @__VERIFIER_nondet_int()
switch i32 %3, label %19 [
i32 0, label %4
i32 1, label %9
i32 2, label %14
]
4: ; preds = %0
%5 = load i32, i32* %1
%6 = icmp sle i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @__VERIFIER_assert(i32 %7)
br label %24
9: ; preds = %0
%10 = load i32, i32* %1
%11 = icmp sge i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @__VERIFIER_assert(i32 %12)
br label %24
14: ; preds = %0
%15 = load i32, i32* %1
%16 = icmp sle i32 %15, 10
%17 = zext i1 %16 to i32
%18 = call i32 @__VERIFIER_assert(i32 %17)
br label %24
19: ; preds = %0
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 10
%22 = zext i1 %21 to i32
%23 = call i32 @__VERIFIER_assert(i32 %22)
br label %24
24: ; preds = %19, %14, %9, %4
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @loop(i32 0)
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
switch i32 %2, label %12 [
i32 0, label %3
i32 1, label %6
i32 2, label %9
]
3: ; preds = %0
%4 = icmp slt i32 %1, 2
%5 = zext i1 %4 to i32
br label %15
6: ; preds = %0
%7 = xor i32 %1, -1
%8 = lshr i32 %7, 31
br label %15
9: ; preds = %0
%10 = icmp slt i32 %1, 11
%11 = zext i1 %10 to i32
br label %15
12: ; preds = %0
%13 = icmp eq i32 %1, 10
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %12, %9, %6, %3
%16 = phi i32 [ %14, %12 ], [ %11, %9 ], [ %8, %6 ], [ %5, %3 ]
%17 = tail call i32 @__VERIFIER_assert(i32 %16)
ret void
}