#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 rand();
void loop(int x) {
  if (x < 10) {
    loop(x + 1);
  } else {
    switch (rand()) {
    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):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1155 <loop+0x25>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <loop@plt>
jmp    11e8 <loop+0xb8>
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
test   %eax,%eax
je     1190 <loop+0x60>
jmp    116e <loop+0x3e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     11a6 <loop+0x76>
jmp    117f <loop+0x4f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11bc <loop+0x8c>
jmp    11d2 <loop+0xa2>
cmpl   $0x1,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
jmp    11e3 <loop+0xb3>
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
jmp    11e3 <loop+0xb3>
cmpl   $0xa,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
jmp    11e3 <loop+0xb3>
cmpl   $0xa,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
jmp    11e8 <loop+0xb8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
test   %eax,%eax
je     115c <loop+0x3c>
cmp    $0x2,%eax
je     1141 <loop+0x21>
cmp    $0x1,%eax
jne    1155 <loop+0x35>
mov    $0x1,%bpl
jmp    115c <loop+0x3c>
cmp    $0xb,%ebx
mov    $0xa,%eax
cmovge %ebx,%eax
cmp    $0xb,%eax
setb   %bpl
jmp    115c <loop+0x3c>
cmp    $0xb,%ebx
setl   %bpl
movzbl %bpl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <__VERIFIER_assert@plt>

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

LLVM IR (-O2):
define void @loop(i32 %0) {
%2 = tail call i32 (...) @rand()
switch i32 %2, label %7 [
i32 0, label %9
i32 1, label %3
i32 2, label %4
]
3: ; preds = %1
br label %9
4: ; preds = %1
%5 = call i32 @llvm.smax.i32(i32 %0, i32 10)
%6 = icmp ult i32 %5, 11
br label %9
7: ; preds = %1
%8 = icmp slt i32 %0, 11
br label %9
9: ; preds = %1, %3, %4, %7
%10 = phi i1 [ true, %3 ], [ %6, %4 ], [ %8, %7 ], [ false, %1 ]
%11 = zext i1 %10 to i32
%12 = tail call i32 @__VERIFIER_assert(i32 %11)
ret void
}