#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 */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
scalar_t__ CompareContigPos(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int WithinRangeContigPos(int32_t contig, int32_t position, int32_t startContig,
                         int32_t startPosition, int32_t endContig,
                         int32_t endPosition) {
  if (CompareContigPos(startContig, startPosition, contig, position) <= 0 &&
      CompareContigPos(contig, position, endContig, endPosition) <= 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<WithinRangeContigPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1030 <CompareContigPos@plt>
cmp    $0x0,%rax
jg     116e <WithinRangeContigPos+0x5e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <CompareContigPos@plt>
cmp    $0x0,%rax
jg     116e <WithinRangeContigPos+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    1175 <WithinRangeContigPos+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WithinRangeContigPos>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edx,%edi
mov    %ecx,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <CompareContigPos@plt>
test   %rax,%rax
jg     1147 <WithinRangeContigPos+0x37>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <CompareContigPos@plt>
test   %rax,%rax
jle    1154 <WithinRangeContigPos+0x44>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%eax
jmp    1149 <WithinRangeContigPos+0x39>

LLVM IR (-O0):
define i32 @WithinRangeContigPos(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%14 = load i32, i32* %10
%15 = load i32, i32* %11
%16 = load i32, i32* %8
%17 = load i32, i32* %9
%18 = call i64 @CompareContigPos(i32 %14, i32 %15, i32 %16, i32 %17)
%19 = icmp sle i64 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %6
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = load i32, i32* %12
%24 = load i32, i32* %13
%25 = call i64 @CompareContigPos(i32 %21, i32 %22, i32 %23, i32 %24)
%26 = icmp sle i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 1, i32* %7
br label %29
28: ; preds = %20, %6
store i32 0, i32* %7
br label %29
29: ; preds = %28, %27
%30 = load i32, i32* %7
ret i32 %30
}

LLVM IR (-O2):
define i32 @WithinRangeContigPos(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i64 @CompareContigPos(i32 %2, i32 %3, i32 %0, i32 %1)
%8 = icmp slt i64 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i64 @CompareContigPos(i32 %0, i32 %1, i32 %4, i32 %5)
%11 = icmp slt i64 %10, 1
br i1 %11, label %13, label %12
12: ; preds = %9, %6
br label %13
13: ; preds = %9, %12
%14 = phi i32 [ 0, %12 ], [ 1, %9 ]
ret i32 %14
}