#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*/ __VERIFIER_assert(int);
int __VERIFIER_nondet_bool();
int /*<<< orphan*/ foo();
int main() {
  int d = 1;
  int x;
  int c1 = __VERIFIER_nondet_bool(), c2 = __VERIFIER_nondet_bool();
  if (c1)
    d = d - 1;
  if (c2)
    foo();
  c1 = __VERIFIER_nondet_bool(), c2 = __VERIFIER_nondet_bool();
  if (c1)
    foo();
  if (c2)
    d = d - 1;
  while (x > 0) {
    x = x - d;
  }
  __VERIFIER_assert(x <= 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_bool@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_bool@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     116d <main+0x3d>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     117e <main+0x4e>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_bool@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_bool@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11a3 <main+0x73>
mov    $0x0,%al
call   1040 <foo@plt>
cmpl   $0x0,-0x14(%rbp)
je     11b6 <main+0x86>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x8b>
cmpl   $0x0,-0xc(%rbp)
jle    11d3 <main+0xa3>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11bb <main+0x8b>
cmpl   $0x0,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
test   %eax,%eax
je     114a <main+0x1a>
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
test   %ebx,%ebx
je     1165 <main+0x35>
xor    %eax,%eax
call   1040 <foo@plt>
mov    $0x1,%edi
call   1050 <__VERIFIER_assert@plt>
xor    %eax,%eax
pop    %rbx
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
store i32 1, i32* %2
%6 = call i32 (...) @__VERIFIER_nondet_bool()
store i32 %6, i32* %4
%7 = call i32 (...) @__VERIFIER_nondet_bool()
store i32 %7, i32* %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %0
%14 = load i32, i32* %5
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @foo()
br label %18
18: ; preds = %16, %13
%19 = call i32 (...) @__VERIFIER_nondet_bool()
store i32 %19, i32* %4
%20 = call i32 (...) @__VERIFIER_nondet_bool()
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 (...) @foo()
br label %25
25: ; preds = %23, %18
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %2
br label %31
31: ; preds = %28, %25
br label %32
32: ; preds = %35, %31
%33 = load i32, i32* %3
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = sub nsw i32 %36, %37
store i32 %38, i32* %3
br label %32
39: ; preds = %32
%40 = load i32, i32* %3
%41 = icmp sle i32 %40, 0
%42 = zext i1 %41 to i32
%43 = call i32 @__VERIFIER_assert(i32 %42)
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_bool()
%2 = tail call i32 (...) @__VERIFIER_nondet_bool()
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (...) @foo()
br label %6
6: ; preds = %4, %0
%7 = tail call i32 (...) @__VERIFIER_nondet_bool()
%8 = tail call i32 (...) @__VERIFIER_nondet_bool()
%9 = icmp eq i32 %7, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (...) @foo()
br label %12
12: ; preds = %10, %6
%13 = tail call i32 @__VERIFIER_assert(i32 1)
ret i32 0
}