#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*/, char *);
int nondet_bool();
void f(int d) {
  int x, y, k, z = 1;
L1:
  while (z < k) {
    z = 2 * z;
  }
  if (!(z >= 1))
    goto ERROR;
L2:
  while (x > 0 && y > 0) {
    int c = nondet_bool();
    if (c) {
    P1:
      x = x - d;
      y = nondet_bool();
      ;
      z = z - 1;
    } else {
      y = y - d;
    }
  }
ERROR:
  assert(0, "ERROR");
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
jmp    1137 <f+0x17>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1151 <f+0x31>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <f+0x17>
cmpl   $0x1,-0x14(%rbp)
jge    1160 <f+0x40>
jmp    11e0 <f+0xc0>
jmp    1165 <f+0x45>
jmp    116a <f+0x4a>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jle    1183 <f+0x63>
cmpl   $0x0,-0xc(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1193 <f+0x73>
jmp    11db <f+0xbb>
mov    $0x0,%al
call   1040 <nondet_bool@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11cd <f+0xad>
jmp    11ac <f+0x8c>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <nondet_bool@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d6 <f+0xb6>
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    116a <f+0x4a>
jmp    11e0 <f+0xc0>
xor    %edi,%edi
lea    0xe17(%rip),%rsi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ERROR\00"
define void @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %6
br label %8
8: ; preds = %1
br label %9
9: ; preds = %13, %8
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %6
%15 = mul nsw i32 2, %14
store i32 %15, i32* %6
br label %9
16: ; preds = %9
%17 = load i32, i32* %6
%18 = icmp sge i32 %17, 1
br i1 %18, label %20, label %19
19: ; preds = %16
br label %48
20: ; preds = %16
br label %21
21: ; preds = %20
br label %22
22: ; preds = %46, %21
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 0
br label %28
28: ; preds = %25, %22
%29 = phi i1 [ false, %22 ], [ %27, %25 ]
br i1 %29, label %30, label %47
30: ; preds = %28
%31 = call i32 (...) @nondet_bool()
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %30
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = sub nsw i32 %36, %37
store i32 %38, i32* %3
%39 = call i32 (...) @nondet_bool()
store i32 %39, i32* %4
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %6
br label %46
42: ; preds = %30
%43 = load i32, i32* %4
%44 = load i32, i32* %2
%45 = sub nsw i32 %43, %44
store i32 %45, i32* %4
br label %46
46: ; preds = %42, %35
br label %22
47: ; preds = %28
br label %48
48: ; preds = %47, %19
%49 = call i32 @assert(i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"ERROR\00"
define void @f(i32 %0) {
%2 = tail call i32 @assert(i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}