#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 main() {
  int x;
  if (!((x >= 0) && (x <= 50)))
    return 0;
  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)
cmpl   $0x0,-0x8(%rbp)
jl     1133 <main+0x23>
cmpl   $0x32,-0x8(%rbp)
jle    113b <main+0x2b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1140 <main+0x30>
cmpl   $0x32,-0x8(%rbp)
jle    1153 <main+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    116b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <main+0x64>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     118d <main+0x7d>
cmpl   $0x32,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1140 <main+0x30>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
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    1120 <main+0x10>

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 i1 %7, label %9, label %8
8: ; preds = %5, %0
ret i32 0
9: ; preds = %5
br label %10
10: ; preds = %9, %31
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 50
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %10
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %25
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, -1
store i32 %24, i32* %2
br label %25
25: ; preds = %22, %19
%26 = load i32, i32* %2
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = icmp sle i32 %29, 50
br label %31
31: ; preds = %28, %25
%32 = phi i1 [ false, %25 ], [ %30, %28 ]
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
br label %10
}

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