#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*/ s2e_kill_state(int, char *);
int /*<<< orphan*/ s2e_make_symbolic(int *, int, char const *);
int s2e_range(int start, int end, const char *name) {
  int x = -1;
  if (start >= end) {
    s2e_kill_state(1, "s2e_range: invalid range");
  }
  if (start + 1 == end) {
    return start;
  } else {
    s2e_make_symbolic(&x, sizeof x, name);
    if (start == 0) {
      if ((unsigned)x >= (unsigned)end) {
        s2e_kill_state(0, "s2e_range creating a constraint...");
      }
    } else {
      if (x < start || x >= end) {
        s2e_kill_state(0, "s2e_range creating a constraint...");
      }
    }
    return x;
  }
}


x86 assembly (clang, -O0):
<s2e_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1156 <s2e_range+0x36>
mov    $0x1,%edi
lea    0xeaf(%rip),%rsi
call   1030 <s2e_kill_state@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    1170 <s2e_range+0x50>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11dc <s2e_range+0xbc>
mov    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
call   1040 <s2e_make_symbolic@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11ab <s2e_range+0x8b>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jb     11a6 <s2e_range+0x86>
xor    %edi,%edi
lea    0xe78(%rip),%rsi
call   1030 <s2e_kill_state@plt>
jmp    11d6 <s2e_range+0xb6>
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     11c3 <s2e_range+0xa3>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11d1 <s2e_range+0xb1>
xor    %edi,%edi
lea    0xe4d(%rip),%rsi
call   1030 <s2e_kill_state@plt>
jmp    11d6 <s2e_range+0xb6>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2e_range>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
movl   $0xffffffff,0xc(%rsp)
ff
cmp    %esi,%edi
jl     114c <s2e_range+0x2c>
lea    0xebe(%rip),%rsi
mov    $0x1,%edi
call   1030 <s2e_kill_state@plt>
lea    0x1(%rbx),%eax
cmp    %ebp,%eax
je     118d <s2e_range+0x6d>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    %r14,%rdx
call   1040 <s2e_make_symbolic@plt>
mov    0xc(%rsp),%eax
test   %ebx,%ebx
je     1177 <s2e_range+0x57>
cmp    %ebx,%eax
jl     117b <s2e_range+0x5b>
cmp    %ebp,%eax
jl     1189 <s2e_range+0x69>
jmp    117b <s2e_range+0x5b>
cmp    %ebp,%eax
jb     1189 <s2e_range+0x69>
lea    0xe97(%rip),%rsi
xor    %edi,%edi
call   1030 <s2e_kill_state@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"s2e_range: invalid range\00"
@.str.1 = [35 x i8] c"s2e_range creating a constraint...\00"
define i32 @s2e_range(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 -1, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp sge i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @s2e_kill_state(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %3
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
%17 = load i32, i32* %6
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = load i32, i32* %5
store i32 %20, i32* %4
br label %46
21: ; preds = %14
%22 = load i8*, i8** %7
%23 = call i32 @s2e_make_symbolic(i32* %8, i32 4, i8* %22)
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %33
26: ; preds = %21
%27 = load i32, i32* %8
%28 = load i32, i32* %6
%29 = icmp uge i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @s2e_kill_state(i32 0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
br label %44
33: ; preds = %21
%34 = load i32, i32* %8
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %41, label %37
37: ; preds = %33
%38 = load i32, i32* %8
%39 = load i32, i32* %6
%40 = icmp sge i32 %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37, %33
%42 = call i32 @s2e_kill_state(i32 0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %37
br label %44
44: ; preds = %43, %32
%45 = load i32, i32* %8
store i32 %45, i32* %4
br label %46
46: ; preds = %44, %19
%47 = load i32, i32* %4
ret i32 %47
}

LLVM IR (-O2):
@.str = [25 x i8] c"s2e_range: invalid range\00"
@.str.1 = [35 x i8] c"s2e_range creating a constraint...\00"
define i32 @s2e_range(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
%6 = icmp slt i32 %0, %1
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @s2e_kill_state(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %3
%10 = add nsw i32 %0, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %26, label %12
12: ; preds = %9
%13 = call i32 @s2e_make_symbolic(i32* %4, i32 4, i8* %2)
%14 = icmp eq i32 %0, 0
%15 = load i32, i32* %4
br i1 %14, label %16, label %18
16: ; preds = %12
%17 = icmp ult i32 %15, %1
br i1 %17, label %24, label %22
18: ; preds = %12
%19 = icmp sge i32 %15, %0
%20 = icmp slt i32 %15, %1
%21 = and i1 %19, %20
br i1 %21, label %24, label %22
22: ; preds = %18, %16
%23 = call i32 @s2e_kill_state(i32 0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %18, %16
%25 = load i32, i32* %4
br label %26
26: ; preds = %9, %24
%27 = phi i32 [ %25, %24 ], [ %0, %9 ]
ret i32 %27
}