#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;
  x = __VERIFIER_nondet_int();
  y = __VERIFIER_nondet_int();
  while (x >= 2) {
    x = x - 1;
    y = y + x;
    while (y >= x && __VERIFIER_nondet_int() != 0) {
      y = y - 1;
    }
    x = x - 1;
    y = y - x;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%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)
cmpl   $0x2,-0x8(%rbp)
jl     11a5 <main+0x95>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jl     1170 <main+0x60>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1180 <main+0x70>
jmp    118e <main+0x7e>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <main+0x3f>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x2,%r14d
jl     1168 <main+0x58>
mov    %eax,%ebx
jmp    1145 <main+0x35>
nop
add    %r14d,%ebx
add    $0xffffffff,%ebx
lea    -0x2(%r14),%eax
sub    %eax,%ebx
cmp    $0x3,%r14d
mov    %eax,%r14d
jle    1168 <main+0x58>
test   %ebx,%ebx
js     1130 <main+0x20>
add    %r14d,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1163 <main+0x53>
add    $0xffffffff,%ebx
cmp    %r14d,%ebx
jge    1150 <main+0x40>
add    $0xffffffff,%ebx
jmp    1136 <main+0x26>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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