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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    $0x0,%eax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assume@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1176 <main+0x56>
cmpl   $0x0,-0xc(%rbp)
jle    1168 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1171 <main+0x51>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <main+0x56>
cmpl   $0x0,-0x8(%rbp)
jle    118e <main+0x6e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <main+0x77>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    $0x0,%eax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    1146 <main+0x26>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%edi
call   1040 <assume@plt>
nopl   (%rax)
xor    %ecx,%ecx
test   %ebx,%ebx
setg   %cl
test   %eax,%eax
lea    -0x1(%rcx,%rcx,1),%ebp
cmovne %eax,%ebp
xor    %eax,%eax
xor    %ecx,%ecx
test   %ebp,%ebp
setg   %al
setle  %cl
sub    %ecx,%ebp
add    %eax,%ebx
mov    %ebp,%edi
imul   %ebx,%edi
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
mov    %ebp,%eax
jmp    1130 <main+0x10>

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

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 ], [ %12, %2 ]
%4 = phi i32 [ undef, %0 ], [ %14, %2 ]
%5 = icmp eq i32 %3, 0
%6 = icmp slt i32 %4, 1
%7 = select i1 %6, i32 -1, i32 1
%8 = select i1 %5, i32 %7, i32 %3
%9 = icmp sgt i32 %8, 0
%10 = xor i1 %9, true
%11 = sext i1 %10 to i32
%12 = add nsw i32 %8, %11
%13 = zext i1 %9 to i32
%14 = add nsw i32 %4, %13
%15 = mul nsw i32 %12, %14
%16 = xor i32 %15, -1
%17 = lshr i32 %16, 31
%18 = tail call i32 @assert(i32 %17)
br label %2
}