#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 scalar_t__ uint32_t;
struct fb_bitfield {
  scalar_t__ offset;
  scalar_t__ length;
  scalar_t__ msb_right;
};

/* Variables and functions */
int fbp_is(const struct fb_bitfield *f, uint32_t off, uint32_t len, int msbr) {
  if (f->offset != off)
    return 0;
  if (f->length != len)
    return 0;
  if (msbr < 0)
    return 1;
  if ((f->msb_right ? 1 : 0) != (msbr ? 1 : 0))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<fbp_is>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
je     1130 <fbp_is+0x30>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <fbp_is+0xa5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
cmp    -0x20(%rbp),%rax
je     114e <fbp_is+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <fbp_is+0xa5>
cmpl   $0x0,-0x24(%rbp)
jge    1164 <fbp_is+0x64>
movl   $0x1,-0x4(%rbp)
jmp    11a5 <fbp_is+0xa5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    -0x24(%rbp),%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
cmp    %ecx,%eax
je     119e <fbp_is+0x9e>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <fbp_is+0xa5>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fbp_is>:
xor    %eax,%eax
cmp    %rsi,(%rdi)
jne    1123 <fbp_is+0x23>
cmp    %rdx,0x8(%rdi)
jne    1123 <fbp_is+0x23>
test   %ecx,%ecx
js     1124 <fbp_is+0x24>
cmpq   $0x0,0x10(%rdi)
sete   %al
test   %ecx,%ecx
setne  %cl
xor    %al,%cl
movzbl %cl,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.fb_bitfield = type { i64, i64, i64 }
define i32 @fbp_is(%struct.fb_bitfield* %0, i64 %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.fb_bitfield*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store %struct.fb_bitfield* %0, %struct.fb_bitfield** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i32 %3, i32* %9
%10 = load %struct.fb_bitfield*, %struct.fb_bitfield** %6
%11 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = load i64, i64* %7
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %4
store i32 0, i32* %5
br label %41
16: ; preds = %4
%17 = load %struct.fb_bitfield*, %struct.fb_bitfield** %6
%18 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %17, i32 0, i32 1
%19 = load i64, i64* %18
%20 = load i64, i64* %8
%21 = icmp ne i64 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 0, i32* %5
br label %41
23: ; preds = %16
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 1, i32* %5
br label %41
27: ; preds = %23
%28 = load %struct.fb_bitfield*, %struct.fb_bitfield** %6
%29 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %28, i32 0, i32 2
%30 = load i64, i64* %29
%31 = icmp ne i64 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 1, i32 0
%34 = load i32, i32* %9
%35 = icmp ne i32 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i32 1, i32 0
%38 = icmp ne i32 %33, %37
br i1 %38, label %39, label %40
39: ; preds = %27
store i32 0, i32* %5
br label %41
40: ; preds = %27
store i32 1, i32* %5
br label %41
41: ; preds = %40, %39, %26, %22, %15
%42 = load i32, i32* %5
ret i32 %42
}

LLVM IR (-O2):
%struct.fb_bitfield = type { i64, i64, i64 }
define i32 @fbp_is(%struct.fb_bitfield* nocapture %0, i64 %1, i64 %2, i32 %3) {
%5 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %0, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, %1
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %0, i64 0, i32 1
%10 = load i64, i64* %9
%11 = icmp eq i64 %10, %2
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = icmp slt i32 %3, 0
br i1 %13, label %21, label %14
14: ; preds = %12
%15 = getelementptr inbounds %struct.fb_bitfield, %struct.fb_bitfield* %0, i64 0, i32 2
%16 = load i64, i64* %15
%17 = icmp eq i64 %16, 0
%18 = icmp ne i32 %3, 0
%19 = xor i1 %18, %17
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %14, %12, %8, %4
%22 = phi i32 [ 0, %4 ], [ 0, %8 ], [ 1, %12 ], [ %20, %14 ]
ret i32 %22
}