#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_error();
int __VERIFIER_nondet_int();
int foo(int s, int t) {
  int d = s - t;
  if (d < 2 || d > 8) {
    return 0;
  }
  int x = __VERIFIER_nondet_int();
  int a = x ? 512 : 64;
  int b = a * d;
  if (b >= 2048) {
    __VERIFIER_error();
  }
  if (b < 128) {
    __VERIFIER_error();
  }
  while (a > 0) {
    a--;
  }
  return b;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jl     114b <foo+0x2b>
cmpl   $0x8,-0x10(%rbp)
jle    1157 <foo+0x37>
movl   $0x0,-0x4(%rbp)
jmp    11cc <foo+0xac>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x40,%eax
mov    $0x200,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x800,-0x1c(%rbp)
jl     1195 <foo+0x75>
mov    $0x0,%al
call   1040 <__VERIFIER_error@plt>
cmpl   $0x80,-0x1c(%rbp)
jge    11a9 <foo+0x89>
mov    $0x0,%al
call   1040 <__VERIFIER_error@plt>
jmp    11ae <foo+0x8e>
cmpl   $0x0,-0x18(%rbp)
jle    11c6 <foo+0xa6>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11ae <foo+0x8e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
sub    %esi,%r14d
lea    -0x9(%r14),%eax
xor    %ebx,%ebx
cmp    $0xfffffff9,%eax
jb     115e <foo+0x3e>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
mov    $0x40,%eax
mov    $0x200,%ebx
cmove  %eax,%ebx
imul   %r14d,%ebx
cmp    $0x800,%ebx
jb     115e <foo+0x3e>
xor    %eax,%eax
call   1040 <__VERIFIER_error@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = sub nsw i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 2
br i1 %14, label %18, label %15
15: ; preds = %2
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 8
br i1 %17, label %18, label %19
18: ; preds = %15, %2
store i32 0, i32* %3
br label %46
19: ; preds = %15
%20 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 512, i32 64
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = load i32, i32* %6
%27 = mul nsw i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = icmp sge i32 %28, 2048
br i1 %29, label %30, label %32
30: ; preds = %19
%31 = call i32 (...) @__VERIFIER_error()
br label %32
32: ; preds = %30, %19
%33 = load i32, i32* %9
%34 = icmp slt i32 %33, 128
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (...) @__VERIFIER_error()
br label %37
37: ; preds = %35, %32
br label %38
38: ; preds = %41, %37
%39 = load i32, i32* %8
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %8
%43 = add nsw i32 %42, -1
store i32 %43, i32* %8
br label %38
44: ; preds = %38
%45 = load i32, i32* %9
store i32 %45, i32* %3
br label %46
46: ; preds = %44, %18
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
%4 = add i32 %3, -9
%5 = icmp ult i32 %4, -7
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = tail call i32 (...) @__VERIFIER_nondet_int()
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 64, i32 512
%10 = mul nuw nsw i32 %9, %3
%11 = icmp ugt i32 %10, 2047
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 (...) @__VERIFIER_error()
br label %14
14: ; preds = %12, %6, %2
%15 = phi i32 [ 0, %2 ], [ %10, %6 ], [ %10, %12 ]
ret i32 %15
}