#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) {
    *x = *x + *y;
    *y = *z;
    *z = -(*z) - 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    $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),%rax
cmpl   $0x0,(%rax)
jle    11c7 <main+0xa7>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1186 <main+0x66>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
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,%rbx
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,(%rbx)
nopl   0x0(%rax)
mov    (%r14),%eax
test   %eax,%eax
jle    1186 <main+0x66>
add    (%r15),%eax
mov    %eax,(%r14)
mov    (%rbx),%eax
mov    %eax,(%r15)
notl   (%rbx)
jmp    1170 <main+0x50>
xor    %eax,%eax
pop    %rbx
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 = %18, %0
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load i32*, i32** %2
%20 = load i32, i32* %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %21
%23 = add nsw i32 %20, %22
%24 = load i32*, i32** %2
store i32 %23, i32* %24
%25 = load i32*, i32** %4
%26 = load i32, i32* %25
%27 = load i32*, i32** %3
store i32 %26, i32* %27
%28 = load i32*, i32** %4
%29 = load i32, i32* %28
%30 = sub nsw i32 0, %29
%31 = sub nsw i32 %30, 1
%32 = load i32*, i32** %4
store i32 %31, i32* %32
br label %14
33: ; preds = %14
%34 = load i32, i32* %1
ret i32 %34
}

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 %18
9: ; preds = %0, %9
%10 = phi i32 [ %16, %9 ], [ %7, %0 ]
%11 = load i32, i32* %2
%12 = add nsw i32 %11, %10
store i32 %12, i32* %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
%14 = load i32, i32* %3
%15 = xor i32 %14, -1
store i32 %15, i32* %3
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 0
br i1 %17, label %9, label %18
18: ; preds = %9, %0
ret i32 0
}