#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 foo(void) {
  int y = __VERIFIER_nondet_int();
  if (__VERIFIER_nondet_int()) {
    if (__VERIFIER_nondet_int()) {
      if (__VERIFIER_nondet_int()) {
        y = 0;
      } else {
        y = 1;
      }
    } else {
      if (__VERIFIER_nondet_int()) {
        y = 2;
      } else {
        y = 3;
      }
    }
  } else {
    if (__VERIFIER_nondet_int()) {
      if (__VERIFIER_nondet_int()) {
        y = 4;
      } else {
        y = 5;
      }
    } else {
      if (__VERIFIER_nondet_int()) {
        y = 6;
      } else {
        y = 7;
      }
    }
  }
  return y;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     1197 <foo+0x87>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     116a <foo+0x5a>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     115e <foo+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1165 <foo+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1192 <foo+0x82>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     1186 <foo+0x76>
movl   $0x2,-0x4(%rbp)
jmp    118d <foo+0x7d>
movl   $0x3,-0x4(%rbp)
jmp    1192 <foo+0x82>
jmp    11fc <foo+0xec>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     11cf <foo+0xbf>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     11c3 <foo+0xb3>
movl   $0x4,-0x4(%rbp)
jmp    11ca <foo+0xba>
movl   $0x5,-0x4(%rbp)
jmp    11f7 <foo+0xe7>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
je     11eb <foo+0xdb>
movl   $0x6,-0x4(%rbp)
jmp    11f2 <foo+0xe2>
movl   $0x7,-0x4(%rbp)
jmp    11f7 <foo+0xe7>
jmp    11fc <foo+0xec>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ebp,%ebp
je     1146 <foo+0x36>
test   %ebx,%ebx
je     1154 <foo+0x44>
test   %ecx,%ecx
sete   %al
jmp    1166 <foo+0x56>
test   %ebx,%ebx
je     115e <foo+0x4e>
test   %ecx,%ecx
sete   %al
or     $0x4,%eax
jmp    1166 <foo+0x56>
test   %ecx,%ecx
sete   %al
or     $0x2,%eax
jmp    1166 <foo+0x56>
test   %ecx,%ecx
sete   %al
or     $0x6,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %2, i32* %1
%3 = call i32 (...) @__VERIFIER_nondet_int()
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %21
5: ; preds = %0
%6 = call i32 (...) @__VERIFIER_nondet_int()
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = call i32 (...) @__VERIFIER_nondet_int()
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 0, i32* %1
br label %13
12: ; preds = %8
store i32 1, i32* %1
br label %13
13: ; preds = %12, %11
br label %20
14: ; preds = %5
%15 = call i32 (...) @__VERIFIER_nondet_int()
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 2, i32* %1
br label %19
18: ; preds = %14
store i32 3, i32* %1
br label %19
19: ; preds = %18, %17
br label %20
20: ; preds = %19, %13
br label %37
21: ; preds = %0
%22 = call i32 (...) @__VERIFIER_nondet_int()
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = call i32 (...) @__VERIFIER_nondet_int()
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 4, i32* %1
br label %29
28: ; preds = %24
store i32 5, i32* %1
br label %29
29: ; preds = %28, %27
br label %36
30: ; preds = %21
%31 = call i32 (...) @__VERIFIER_nondet_int()
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 6, i32* %1
br label %35
34: ; preds = %30
store i32 7, i32* %1
br label %35
35: ; preds = %34, %33
br label %36
36: ; preds = %35, %29
br label %37
37: ; preds = %36, %20
%38 = load i32, i32* %1
ret i32 %38
}

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