#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()) {
      if (*x < *y) {
        *y = *x - 1;
      } else {
        *y = *y - 1;
      }
      *x = __VERIFIER_nondet_int();
    } else {
      if (*x < *y) {
        *x = *x - 1;
      } else {
        *x = *y - 1;
      }
      *y = __VERIFIER_nondet_int();
    }
  }
}


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    121c <main+0xfc>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     11d3 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    11b0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11bf <main+0x9f>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1217 <main+0xf7>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    11f9 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1208 <main+0xe8>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%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,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
cmpl   $0x0,(%r14)
jle    1190 <main+0x70>
mov    %rax,%rbx
jmp    1163 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,(%r14)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%rbx)
mov    (%r14),%eax
test   %eax,%eax
jle    1190 <main+0x70>
cmpl   $0x0,(%rbx)
jle    1190 <main+0x70>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    (%r14),%edx
mov    (%rbx),%ecx
cmp    %ecx,%edx
cmovl  %edx,%ecx
add    $0xffffffff,%ecx
test   %eax,%eax
je     1150 <main+0x30>
mov    %ecx,(%rbx)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r14)
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 = %57, %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 %58
16: ; preds = %14
%17 = call i32 (...) @__VERIFIER_nondet_int()
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %38
19: ; preds = %16
%20 = load i32*, i32** %2
%21 = load i32, i32* %20
%22 = load i32*, i32** %3
%23 = load i32, i32* %22
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = load i32*, i32** %2
%27 = load i32, i32* %26
%28 = sub nsw i32 %27, 1
%29 = load i32*, i32** %3
store i32 %28, i32* %29
br label %35
30: ; preds = %19
%31 = load i32*, i32** %3
%32 = load i32, i32* %31
%33 = sub nsw i32 %32, 1
%34 = load i32*, i32** %3
store i32 %33, i32* %34
br label %35
35: ; preds = %30, %25
%36 = call i32 (...) @__VERIFIER_nondet_int()
%37 = load i32*, i32** %2
store i32 %36, i32* %37
br label %57
38: ; preds = %16
%39 = load i32*, i32** %2
%40 = load i32, i32* %39
%41 = load i32*, i32** %3
%42 = load i32, i32* %41
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %49
44: ; preds = %38
%45 = load i32*, i32** %2
%46 = load i32, i32* %45
%47 = sub nsw i32 %46, 1
%48 = load i32*, i32** %2
store i32 %47, i32* %48
br label %54
49: ; preds = %38
%50 = load i32*, i32** %3
%51 = load i32, i32* %50
%52 = sub nsw i32 %51, 1
%53 = load i32*, i32** %2
store i32 %52, i32* %53
br label %54
54: ; preds = %49, %44
%55 = call i32 (...) @__VERIFIER_nondet_int()
%56 = load i32*, i32** %3
store i32 %55, i32* %56
br label %57
57: ; preds = %54, %35
br label %6
58: ; preds = %14
%59 = load i32, i32* %1
ret i32 %59
}

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 %24
5: ; preds = %0, %21
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = tail call i32 (...) @__VERIFIER_nondet_int()
%10 = icmp eq i32 %9, 0
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
%14 = select i1 %13, i32 %11, i32 %12
%15 = add nsw i32 %14, -1
br i1 %10, label %18, label %16
16: ; preds = %8
store i32 %15, i32* %2
%17 = tail call i32 (...) @__VERIFIER_nondet_int()
store i32 %17, i32* %1
br label %21
18: ; preds = %8
store i32 %15, i32* %1
%19 = tail call i32 (...) @__VERIFIER_nondet_int()
store i32 %19, i32* %2
%20 = load i32, i32* %1
br label %21
21: ; preds = %18, %16
%22 = phi i32 [ %20, %18 ], [ %17, %16 ]
%23 = icmp sgt i32 %22, 0
br i1 %23, label %5, label %24
24: ; preds = %5, %21, %0
ret i32 0
}