#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 unsigned short own_version;
typedef unsigned short lib_ver;

/* Variables and functions */
bool statefs_is_version_compatible(unsigned own_version, unsigned lib_ver) {
  unsigned short maj, min;
  unsigned short prov_maj, prov_min;
  do {
    prov_maj = (lib_ver) >> (sizeof(unsigned) * 4);
    prov_min = (lib_ver) & ((unsigned)-1 >> (sizeof(unsigned) * 4));
  } while (0);
  do {
    maj = (own_version) >> (sizeof(unsigned) * 4);
    min = (own_version) & ((unsigned)-1 >> (sizeof(unsigned) * 4));
  } while (0);
  return (prov_maj == maj) && (prov_min <= min);
}


x86 assembly (clang, -O0):
<statefs_is_version_compatible>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
mov    %ax,-0xe(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffff,%eax
mov    %ax,-0x10(%rbp)
jmp    1125 <statefs_is_version_compatible+0x25>
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
mov    %ax,-0xa(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    %ax,-0xc(%rbp)
movzwl -0xe(%rbp),%ecx
movzwl -0xa(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jne    1160 <statefs_is_version_compatible+0x60>
movzwl -0x10(%rbp),%eax
movzwl -0xc(%rbp),%ecx
cmp    %ecx,%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<statefs_is_version_compatible>:
movzwl %si,%eax
xor    %edi,%esi
cmp    $0x10000,%esi
setb   %cl
movzwl %di,%edx
cmp    %edx,%eax
setbe  %al
and    %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @statefs_is_version_compatible(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i16
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = lshr i32 %10, 16
%12 = trunc i32 %11 to i16
store i16 %12, i16* %7
%13 = load i32, i32* %4
%14 = and i32 %13, 65535
%15 = trunc i32 %14 to i16
store i16 %15, i16* %8
br label %16
16: ; preds = %9
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = lshr i32 %18, 16
%20 = trunc i32 %19 to i16
store i16 %20, i16* %5
%21 = load i32, i32* %3
%22 = and i32 %21, 65535
%23 = trunc i32 %22 to i16
store i16 %23, i16* %6
br label %24
24: ; preds = %17
%25 = load i16, i16* %7
%26 = zext i16 %25 to i32
%27 = load i16, i16* %5
%28 = zext i16 %27 to i32
%29 = icmp eq i32 %26, %28
br i1 %29, label %30, label %36
30: ; preds = %24
%31 = load i16, i16* %8
%32 = zext i16 %31 to i32
%33 = load i16, i16* %6
%34 = zext i16 %33 to i32
%35 = icmp sle i32 %32, %34
br label %36
36: ; preds = %30, %24
%37 = phi i1 [ false, %24 ], [ %35, %30 ]
%38 = zext i1 %37 to i32
ret i32 %38
}

LLVM IR (-O2):
define i32 @statefs_is_version_compatible(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = icmp ult i32 %3, 65536
%5 = and i32 %1, 65535
%6 = and i32 %0, 65535
%7 = icmp ule i32 %5, %6
%8 = and i1 %4, %7
%9 = zext i1 %8 to i32
ret i32 %9
}