#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*/ __u32;

/* Variables and functions */
scalar_t__ ceph_frag_bits(int /*<<< orphan*/);
int ceph_frag_mask(int /*<<< orphan*/);
int ceph_frag_value(int /*<<< orphan*/);
int ceph_frag_contains_frag(__u32 f, __u32 sub) {
  return ceph_frag_bits(sub) >= ceph_frag_bits(f) &&
         (ceph_frag_value(sub) & ceph_frag_mask(f)) == ceph_frag_value(f);
}


x86 assembly (clang, -O0):
<ceph_frag_contains_frag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ceph_frag_bits@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ceph_frag_bits@plt>
mov    -0x18(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x9(%rbp)
jl     1199 <ceph_frag_contains_frag+0x69>
mov    -0x8(%rbp),%edi
call   1040 <ceph_frag_value@plt>
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <ceph_frag_mask@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <ceph_frag_value@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceph_frag_contains_frag>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %esi,%edi
call   1030 <ceph_frag_bits@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1030 <ceph_frag_bits@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
jl     117b <ceph_frag_contains_frag+0x4b>
mov    %ebp,%edi
call   1040 <ceph_frag_value@plt>
mov    %eax,%ebx
mov    %r14d,%edi
call   1050 <ceph_frag_mask@plt>
mov    %eax,%ebp
and    %ebx,%ebp
mov    %r14d,%edi
call   1040 <ceph_frag_value@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%ebp
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ceph_frag_contains_frag(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i64 @ceph_frag_bits(i32 %5)
%7 = load i32, i32* %3
%8 = call i64 @ceph_frag_bits(i32 %7)
%9 = icmp sge i64 %6, %8
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i32, i32* %4
%12 = call i32 @ceph_frag_value(i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @ceph_frag_mask(i32 %13)
%15 = and i32 %12, %14
%16 = load i32, i32* %3
%17 = call i32 @ceph_frag_value(i32 %16)
%18 = icmp eq i32 %15, %17
br label %19
19: ; preds = %10, %2
%20 = phi i1 [ false, %2 ], [ %18, %10 ]
%21 = zext i1 %20 to i32
ret i32 %21
}

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