#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 /*<<< orphan*/ assert(int /*<<< orphan*/);
int nondet();
int main1() {
  int i, x;
  int b;
  int bound;
  bound = nondet();
  x = 0;
  b = 0;
  i = bound;
  for (; 0 < i; i--) {
    if (b == 0) {
      b = 1;
      x++;
    } else {
      b = 0;
    }
    if (i <= 0) {
      assert(0);
    }
    if (2 * x != b + bound - (i - 1)) {
      assert(0);
    }
    if (2 * x > bound + 1) {
      assert(0);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <nondet@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
jge    11d9 <main1+0xb9>
cmpl   $0x0,-0xc(%rbp)
jne    1170 <main1+0x50>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main1+0x57>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1188 <main1+0x68>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
sub    %edx,%ecx
cmp    %ecx,%eax
je     11ab <main1+0x8b>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    11c6 <main1+0xa6>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    11cb <main1+0xab>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <main1+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <nondet@plt>
test   %eax,%eax
jle    1184 <main1+0x64>
mov    %eax,%r14d
add    $0x1,%r14d
mov    $0x1,%ebp
mov    %r14d,%ebx
xor    %r12d,%r12d
jmp    115b <main1+0x3b>
nopl   (%rax)
add    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0x1,%ebx
jbe    1184 <main1+0x64>
xor    $0x1,%r15d
add    %r15d,%r12d
lea    (%r12,%r12,1),%r13d
lea    (%r15,%rbp,1),%eax
cmp    %r13d,%eax
je     1176 <main1+0x56>
xor    %edi,%edi
call   1040 <assert@plt>
cmp    %r14d,%r13d
jle    1150 <main1+0x30>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    1150 <main1+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @nondet()
store i32 %5, i32* %4
store i32 0, i32* %2
store i32 0, i32* %3
%6 = load i32, i32* %4
store i32 %6, i32* %1
br label %7
7: ; preds = %43, %0
%8 = load i32, i32* %1
%9 = icmp slt i32 0, %8
br i1 %9, label %10, label %46
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
store i32 1, i32* %3
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %17
16: ; preds = %10
store i32 0, i32* %3
br label %17
17: ; preds = %16, %13
%18 = load i32, i32* %1
%19 = icmp sle i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @assert(i32 0)
br label %22
22: ; preds = %20, %17
%23 = load i32, i32* %2
%24 = mul nsw i32 2, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %1
%29 = sub nsw i32 %28, 1
%30 = sub nsw i32 %27, %29
%31 = icmp ne i32 %24, %30
br i1 %31, label %32, label %34
32: ; preds = %22
%33 = call i32 @assert(i32 0)
br label %34
34: ; preds = %32, %22
%35 = load i32, i32* %2
%36 = mul nsw i32 2, %35
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
%39 = icmp sgt i32 %36, %38
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = call i32 @assert(i32 0)
br label %42
42: ; preds = %40, %34
br label %43
43: ; preds = %42
%44 = load i32, i32* %1
%45 = add nsw i32 %44, -1
store i32 %45, i32* %1
br label %7
46: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main1() {
%1 = tail call i32 (...) @nondet()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %25
3: ; preds = %0
%4 = add nuw nsw i32 %1, 1
br label %5
5: ; preds = %3, %23
%6 = phi i32 [ %1, %3 ], [ %13, %23 ]
%7 = phi i32 [ 0, %3 ], [ %9, %23 ]
%8 = phi i32 [ 0, %3 ], [ %10, %23 ]
%9 = xor i32 %7, 1
%10 = add nuw nsw i32 %9, %8
%11 = shl nsw i32 %10, 1
%12 = add nsw i32 %9, %1
%13 = add nsw i32 %6, -1
%14 = sub nsw i32 1, %6
%15 = add i32 %12, %14
%16 = icmp eq i32 %11, %15
br i1 %16, label %19, label %17
17: ; preds = %5
%18 = tail call i32 @assert(i32 0)
br label %19
19: ; preds = %17, %5
%20 = icmp sgt i32 %11, %4
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = tail call i32 @assert(i32 0)
br label %23
23: ; preds = %19, %21
%24 = icmp ugt i32 %6, 1
br i1 %24, label %5, label %25
25: ; preds = %23, %0
ret i32 0
}