#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 __VERIFIER_nondet_int();
int main() {
  int x, y, oldx, oldy;
  x = __VERIFIER_nondet_int();
  y = __VERIFIER_nondet_int();
  while (x > 0 && y > 0) {
    oldx = x;
    oldy = y;
    if (__VERIFIER_nondet_int() != 0) {
      x = oldx - 1;
      y = oldx;
    } else {
      x = oldy - 2;
      y = oldx + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jle    114c <main+0x3c>
cmpl   $0x0,-0xc(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115c <main+0x4c>
jmp    11a3 <main+0x93>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     118c <main+0x7c>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    119e <main+0x8e>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %ebx,%ebx
jle    1151 <main+0x41>
mov    %eax,%ebp
test   %eax,%eax
jle    1151 <main+0x41>
nopl   (%rax)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
lea    -0x1(%rbx),%ecx
add    $0xfffffffe,%ebp
xor    %edx,%edx
test   %eax,%eax
sete   %dl
cmovne %ecx,%ebp
add    %ebx,%edx
mov    %ebp,%ebx
test   %ebp,%ebp
mov    %edx,%ebp
jg     1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %2
%7 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %7, i32* %3
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 0
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ false, %8 ], [ %13, %11 ]
br i1 %15, label %16, label %31
16: ; preds = %14
%17 = load i32, i32* %2
store i32 %17, i32* %4
%18 = load i32, i32* %3
store i32 %18, i32* %5
%19 = call i32 (...) @__VERIFIER_nondet_int()
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %2
%24 = load i32, i32* %4
store i32 %24, i32* %3
br label %30
25: ; preds = %16
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 2
store i32 %27, i32* %2
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %30
30: ; preds = %25, %21
br label %8
31: ; preds = %14
ret i32 0
}

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