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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%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)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x21(%rbp)
jle    11b7 <main+0x97>
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x21(%rbp)
jle    11b7 <main+0x97>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11c7 <main+0xa7>
jmp    123a <main+0x11a>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jle    1208 <main+0xe8>
mov    -0x20(%rbp),%rax
mov    (%rax),%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)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1235 <main+0x115>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1186 <main+0x66>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r14)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r15)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r12)
jmp    1189 <main+0x69>
add    $0xffffffff,%ecx
mov    %ecx,(%r12)
mov    %r15,%rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r14)
add    $0xffffffff,%eax
mov    %eax,(%rbx)
mov    (%r14),%eax
test   %eax,%eax
jle    11ab <main+0x8b>
mov    (%r15),%edx
test   %edx,%edx
jle    11ab <main+0x8b>
mov    (%r12),%ecx
test   %ecx,%ecx
jle    11ab <main+0x8b>
cmp    %eax,%edx
jbe    1170 <main+0x50>
mov    %ecx,(%r15)
mov    %r12,%rbx
jmp    117a <main+0x5a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @alloca(i32 4)
store i32* %5, i32** %2
%6 = call i32* @alloca(i32 4)
store i32* %6, i32** %3
%7 = call i32* @alloca(i32 4)
store i32* %7, i32** %4
%8 = call i32 (...) @__VERIFIER_nondet_int()
%9 = load i32*, i32** %2
store i32 %8, i32* %9
%10 = call i32 (...) @__VERIFIER_nondet_int()
%11 = load i32*, i32** %3
store i32 %10, i32* %11
%12 = call i32 (...) @__VERIFIER_nondet_int()
%13 = load i32*, i32** %4
store i32 %12, i32* %13
br label %14
14: ; preds = %55, %0
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32*, i32** %4
%24 = load i32, i32* %23
%25 = icmp sgt i32 %24, 0
br label %26
26: ; preds = %22, %18, %14
%27 = phi i1 [ false, %18 ], [ false, %14 ], [ %25, %22 ]
br i1 %27, label %28, label %56
28: ; preds = %26
%29 = load i32*, i32** %3
%30 = load i32, i32* %29
%31 = load i32*, i32** %2
%32 = load i32, i32* %31
%33 = icmp sgt i32 %30, %32
br i1 %33, label %34, label %44
34: ; preds = %28
%35 = load i32*, i32** %4
%36 = load i32, i32* %35
%37 = load i32*, i32** %3
store i32 %36, i32* %37
%38 = call i32 (...) @__VERIFIER_nondet_int()
%39 = load i32*, i32** %2
store i32 %38, i32* %39
%40 = load i32*, i32** %2
%41 = load i32, i32* %40
%42 = sub nsw i32 %41, 1
%43 = load i32*, i32** %4
store i32 %42, i32* %43
br label %55
44: ; preds = %28
%45 = load i32*, i32** %4
%46 = load i32, i32* %45
%47 = sub nsw i32 %46, 1
%48 = load i32*, i32** %4
store i32 %47, i32* %48
%49 = call i32 (...) @__VERIFIER_nondet_int()
%50 = load i32*, i32** %2
store i32 %49, i32* %50
%51 = load i32*, i32** %2
%52 = load i32, i32* %51
%53 = sub nsw i32 %52, 1
%54 = load i32*, i32** %3
store i32 %53, i32* %54
br label %55
55: ; preds = %44, %34
br label %14
56: ; preds = %26
ret i32 0
}

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