#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);
int /*<<< orphan*/ assume(int);
int main() {
  int x;
  assume((x >= 0) && (x <= 50));
  while (1) {
    if (x > 50)
      x++;
    if (x == 0) {
      x++;
    } else
      x--;
    assert((x >= 0) && (x <= 50));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1148 <main+0x28>
cmpl   $0x32,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assume@plt>
cmpl   $0x32,-0x8(%rbp)
jle    1168 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1180 <main+0x60>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1189 <main+0x69>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     11a2 <main+0x82>
cmpl   $0x32,-0x8(%rbp)
setle  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1155 <main+0x35>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <assume@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
cmp    $0x33,%eax
setge  %bpl
add    %eax,%ebp
sub    $0x1,%ebp
cmovb  %ebx,%ebp
xor    %edi,%edi
cmp    $0x33,%ebp
setb   %dil
call   1030 <assert@plt>
mov    %ebp,%eax
jmp    1140 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 50
br label %8
8: ; preds = %5, %0
%9 = phi i1 [ false, %0 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @assume(i32 %10)
br label %12
12: ; preds = %8, %33
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 50
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %27
24: ; preds = %18
%25 = load i32, i32* %2
%26 = add nsw i32 %25, -1
store i32 %26, i32* %2
br label %27
27: ; preds = %24, %21
%28 = load i32, i32* %2
%29 = icmp sge i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %2
%32 = icmp sle i32 %31, 50
br label %33
33: ; preds = %30, %27
%34 = phi i1 [ false, %27 ], [ %32, %30 ]
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
br label %12
}

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