#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 = 0;
  int y = 0;
  while (1) {
    if (x <= 50) {
      y++;
    } else
      y--;
    if (y < 0)
      break;
    x++;
  }
  assert(x + y <= 101);
  assert(x <= 102);
}


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)
cmpl   $0x32,-0x8(%rbp)
jg     1145 <main+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    115d <main+0x4d>
jmp    116b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x65,%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x66,-0x8(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edx,%edx
mov    $0xffffffff,%ebx
nopl   0x0(%rax,%rax,1)
mov    %edx,%eax
add    $0x1,%ebx
xor    %ecx,%ecx
cmp    $0x33,%ebx
setb   %cl
add    %ecx,%ecx
add    $0xffffffff,%ecx
mov    %ecx,%edx
add    %eax,%edx
jns    1120 <main+0x10>
add    %eax,%ecx
add    %ebx,%ecx
xor    %edi,%edi
cmp    $0x66,%ecx
setl   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x67,%ebx
setb   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %8, %1 ]
%3 = phi i32 [ 0, %0 ], [ %6, %1 ]
%4 = icmp ult i32 %2, 51
%5 = select i1 %4, i32 1, i32 -1
%6 = add nsw i32 %5, %3
%7 = icmp slt i32 %6, 0
%8 = add nuw nsw i32 %2, 1
br i1 %7, label %9, label %1
9: ; preds = %1
%10 = add nsw i32 %6, %2
%11 = icmp slt i32 %10, 102
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = icmp ult i32 %2, 103
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
ret i32 0
}