int main() {
  int d = 1;
  int x;
  _Bool c1 = nondet_bool(), c2 = nondet_bool();
  if (c1)
    d = d - 1;
  if (c2)
    foo();
  c1 = nondet_bool(), c2 = nondet_bool();
  if (c1)
    foo();
  if (c2)
    d = d - 1;
  while (x > 0) {
    x = x - d;
  }
  assert(x <= 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1050 <nondet_bool@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
mov    %al,-0xd(%rbp)
mov    $0x0,%al
call   1050 <nondet_bool@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
mov    %al,-0xe(%rbp)
testb  $0x1,-0xd(%rbp)
je     117d <main+0x4d>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
testb  $0x1,-0xe(%rbp)
je     118e <main+0x5e>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1050 <nondet_bool@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
mov    %al,-0xd(%rbp)
mov    $0x0,%al
call   1050 <nondet_bool@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
mov    %al,-0xe(%rbp)
testb  $0x1,-0xd(%rbp)
je     11c3 <main+0x93>
mov    $0x0,%al
call   1040 <foo@plt>
testb  $0x1,-0xe(%rbp)
je     11d6 <main+0xa6>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0xab>
cmpl   $0x0,-0xc(%rbp)
jle    11f3 <main+0xc3>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11db <main+0xab>
cmpl   $0x0,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @nondet_bool()
%2 = tail call i32 (...) @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 (...) @nondet_bool()
%8 = icmp eq i32 %7, 0
%9 = tail call i32 (...) @nondet_bool()
br i1 %8, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (...) @foo()
br label %12
12: ; preds = %10, %6
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret i32 0
}