#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 *alloca(int);
int main() {
  int *x = alloca(sizeof(int));
  int *y = alloca(sizeof(int));
  while (*x > 0 && *y > 0) {
    if (__VERIFIER_nondet_int()) {
      *x = *x - 1;
    } else {
      *x = __VERIFIER_nondet_int();
      *y = *y - 1;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x19(%rbp)
jle    116a <main+0x4a>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    117a <main+0x5a>
jmp    11c1 <main+0xa1>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     119e <main+0x7e>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11bc <main+0x9c>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    114b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
cmpl   $0x0,(%rbx)
jle    117f <main+0x5f>
mov    %rax,%r14
jmp    1163 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%rbx)
addl   $0xffffffff,(%r14)
mov    (%rbx),%eax
test   %eax,%eax
jle    117f <main+0x5f>
cmpl   $0x0,(%r14)
jle    117f <main+0x5f>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1150 <main+0x30>
mov    (%rbx),%eax
add    $0xffffffff,%eax
mov    %eax,(%rbx)
test   %eax,%eax
jg     1163 <main+0x43>
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* @alloca(i32 4)
store i32* %4, i32** %2
%5 = call i32* @alloca(i32 4)
store i32* %5, i32** %3
br label %6
6: ; preds = %31, %0
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = icmp sgt i32 %12, 0
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
br i1 %15, label %16, label %32
16: ; preds = %14
%17 = call i32 (...) @__VERIFIER_nondet_int()
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32*, i32** %2
%21 = load i32, i32* %20
%22 = sub nsw i32 %21, 1
%23 = load i32*, i32** %2
store i32 %22, i32* %23
br label %31
24: ; preds = %16
%25 = call i32 (...) @__VERIFIER_nondet_int()
%26 = load i32*, i32** %2
store i32 %25, i32* %26
%27 = load i32*, i32** %3
%28 = load i32, i32* %27
%29 = sub nsw i32 %28, 1
%30 = load i32*, i32** %3
store i32 %29, i32* %30
br label %31
31: ; preds = %24, %19
br label %6
32: ; preds = %14
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %22
5: ; preds = %0, %19
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = tail call i32 (...) @__VERIFIER_nondet_int()
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %1
%13 = add nsw i32 %12, -1
store i32 %13, i32* %1
br label %19
14: ; preds = %8
%15 = tail call i32 (...) @__VERIFIER_nondet_int()
store i32 %15, i32* %1
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
%18 = load i32, i32* %1
br label %19
19: ; preds = %14, %11
%20 = phi i32 [ %18, %14 ], [ %13, %11 ]
%21 = icmp sgt i32 %20, 0
br i1 %21, label %5, label %22
22: ; preds = %5, %19, %0
ret i32 0
}