#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 *debug = alloca(sizeof(int));
  *x = __VERIFIER_nondet_int();
  *debug = 0;
  while (*x < 255) {
    if (*x % 2 != 0) {
      (*x)--;
    } else {
      *x += 2;
    }
    if (*debug != 0) {
      *x = 0;
    }
  }
  return 0;
}


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    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xff,(%rax)
jge    11c2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     119b <main+0x7b>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
jmp    11a6 <main+0x86>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     11bd <main+0x9d>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    1164 <main+0x44>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%rbx)
movl   $0x0,(%r14)
mov    (%rbx),%eax
cmp    $0xfe,%eax
jg     1183 <main+0x63>
nopl   0x0(%rax)
mov    %eax,%ecx
and    $0x1,%ecx
neg    %ecx
sbb    %ecx,%ecx
or     $0x2,%ecx
add    %eax,%ecx
mov    %ecx,(%rbx)
cmpl   $0x0,(%r14)
cmovne %ebp,%ecx
mov    %ecx,(%rbx)
mov    %ecx,%eax
cmp    $0xff,%ecx
jl     1160 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
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
%6 = call i32 (...) @__VERIFIER_nondet_int()
%7 = load i32*, i32** %2
store i32 %6, i32* %7
%8 = load i32*, i32** %3
store i32 0, i32* %8
br label %9
9: ; preds = %32, %0
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = icmp slt i32 %11, 255
br i1 %12, label %13, label %33
13: ; preds = %9
%14 = load i32*, i32** %2
%15 = load i32, i32* %14
%16 = srem i32 %15, 2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i32*, i32** %2
%20 = load i32, i32* %19
%21 = add nsw i32 %20, -1
store i32 %21, i32* %19
br label %26
22: ; preds = %13
%23 = load i32*, i32** %2
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 2
store i32 %25, i32* %23
br label %26
26: ; preds = %22, %18
%27 = load i32*, i32** %3
%28 = load i32, i32* %27
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32*, i32** %2
store i32 0, i32* %31
br label %32
32: ; preds = %30, %26
br label %9
33: ; preds = %9
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 (...) @__VERIFIER_nondet_int()
store i32 %3, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 255
br i1 %5, label %6, label %16
6: ; preds = %0, %6
%7 = phi i32 [ %14, %6 ], [ %4, %0 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 2, i32 -1
%11 = add nsw i32 %10, %7
store i32 %11, i32* %1
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i32 %11, i32 0
store i32 %14, i32* %1
%15 = icmp slt i32 %14, 255
br i1 %15, label %6, label %16
16: ; preds = %6, %0
ret i32 0
}