#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 i;
  int range;
  int up;
  i = __VERIFIER_nondet_int();
  range = 20;
  up = 0;
  while (0 <= i && i <= range) {
    if (i == 0) {
      up = 1;
    }
    if (i == range) {
      up = 0;
    }
    if (up == 1) {
      i = i + 1;
    }
    if (up == 0) {
      i = i - 1;
    }
    if (i == range - 2) {
      range = range - 1;
    }
  }
  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)
movl   $0x14,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     1153 <main+0x43>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1163 <main+0x53>
jmp    11cc <main+0xbc>
cmpl   $0x0,-0x8(%rbp)
jne    1174 <main+0x64>
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1187 <main+0x77>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    119a <main+0x8a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11ad <main+0x9d>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jne    11c7 <main+0xb7>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <main+0x27>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
pop    %rcx
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 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
store i32 20, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %44, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 0, %7
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sle i32 %10, %11
br label %13
13: ; preds = %9, %6
%14 = phi i1 [ false, %6 ], [ %12, %9 ]
br i1 %14, label %15, label %45
15: ; preds = %13
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 1, i32* %4
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 0, i32* %4
br label %24
24: ; preds = %23, %19
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %30
30: ; preds = %27, %24
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %2
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %2
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = sub nsw i32 %38, 2
%40 = icmp eq i32 %37, %39
br i1 %40, label %41, label %44
41: ; preds = %36
%42 = load i32, i32* %3
%43 = sub nsw i32 %42, 1
store i32 %43, i32* %3
br label %44
44: ; preds = %41, %36
br label %6
45: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}