#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 main() {
  int r = __VERIFIER_nondet_int();
  int da, db, temp;
  if (r >= 0) {
    da = 2 * r;
    db = 2 * r;
    while (da >= r) {
      if (__VERIFIER_nondet_int()) {
        da--;
      } else {
        temp = da;
        da = db - 1;
        db = da;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     118e <main+0x7e>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1189 <main+0x79>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     116f <main+0x5f>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1184 <main+0x74>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1145 <main+0x35>
jmp    118e <main+0x7e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
js     114a <main+0x3a>
mov    %eax,%r14d
lea    (%r14,%r14,1),%ebp
cmp    %eax,%ebp
jl     114a <main+0x3a>
mov    %ebp,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
add    $0xffffffff,%ebp
lea    -0x1(%rbx),%ecx
test   %eax,%eax
cmove  %ecx,%ebx
cmove  %ecx,%ebp
cmp    %r14d,%ebp
jge    1130 <main+0x20>
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
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %31
9: ; preds = %0
%10 = load i32, i32* %2
%11 = mul nsw i32 2, %10
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = mul nsw i32 2, %12
store i32 %13, i32* %4
br label %14
14: ; preds = %29, %9
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = call i32 (...) @__VERIFIER_nondet_int()
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %29
24: ; preds = %18
%25 = load i32, i32* %3
store i32 %25, i32* %5
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %3
%28 = load i32, i32* %3
store i32 %28, i32* %4
br label %29
29: ; preds = %24, %21
br label %14
30: ; preds = %14
br label %31
31: ; preds = %30, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = icmp slt i32 %1, 0
%3 = shl nuw nsw i32 %1, 1
%4 = icmp slt i32 %3, %1
%5 = select i1 %2, i1 true, i1 %4
br i1 %5, label %16, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %14, %6 ], [ %3, %0 ]
%8 = phi i32 [ %13, %6 ], [ %3, %0 ]
%9 = tail call i32 (...) @__VERIFIER_nondet_int()
%10 = icmp eq i32 %9, 0
%11 = add nsw i32 %7, -1
%12 = add nsw i32 %8, -1
%13 = select i1 %10, i32 %12, i32 %8
%14 = select i1 %10, i32 %12, i32 %11
%15 = icmp slt i32 %14, %1
br i1 %15, label %16, label %6
16: ; preds = %6, %0
ret i32 0
}