#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 /*<<< orphan*/ foo();
int main() {
  int d = 1;
  int x = __VERIFIER_nondet_int();
  if (__VERIFIER_nondet_int()) {
    d = d - 1;
  }
  if (__VERIFIER_nondet_int()) {
    foo();
  }
  if (__VERIFIER_nondet_int()) {
    foo();
  }
  if (__VERIFIER_nondet_int()) {
    foo();
  }
  if (__VERIFIER_nondet_int()) {
    foo();
  }
  if (__VERIFIER_nondet_int()) {
    d = d - 1;
  }
  while (x > 0) {
    x = x - d;
  }
  return 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   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     1159 <main+0x39>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     1170 <main+0x50>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     1187 <main+0x67>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     119e <main+0x7e>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     11b5 <main+0x95>
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     11ce <main+0xae>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d3 <main+0xb3>
cmpl   $0x0,-0xc(%rbp)
jle    11eb <main+0xcb>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d3 <main+0xb3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1141 <main+0x21>
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1153 <main+0x33>
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1165 <main+0x45>
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1177 <main+0x57>
xor    %eax,%eax
call   1040 <foo@plt>
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
store i32 0, i32* %1
store i32 1, i32* %2
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %3
%5 = call i32 (...) @__VERIFIER_nondet_int()
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %0
%11 = call i32 (...) @__VERIFIER_nondet_int()
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @foo()
br label %15
15: ; preds = %13, %10
%16 = call i32 (...) @__VERIFIER_nondet_int()
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @foo()
br label %20
20: ; preds = %18, %15
%21 = call i32 (...) @__VERIFIER_nondet_int()
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @foo()
br label %25
25: ; preds = %23, %20
%26 = call i32 (...) @__VERIFIER_nondet_int()
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @foo()
br label %30
30: ; preds = %28, %25
%31 = call i32 (...) @__VERIFIER_nondet_int()
%32 = icmp ne 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
br label %37
37: ; preds = %40, %36
%38 = load i32, i32* %3
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load i32, i32* %3
%42 = load i32, i32* %2
%43 = sub nsw i32 %41, %42
store i32 %43, i32* %3
br label %37
44: ; preds = %37
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 (...) @foo()
br label %7
7: ; preds = %5, %0
%8 = tail call i32 (...) @__VERIFIER_nondet_int()
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (...) @foo()
br label %12
12: ; preds = %10, %7
%13 = tail call i32 (...) @__VERIFIER_nondet_int()
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 (...) @foo()
br label %17
17: ; preds = %15, %12
%18 = tail call i32 (...) @__VERIFIER_nondet_int()
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 (...) @foo()
br label %22
22: ; preds = %20, %17
%23 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}