#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 uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t get_roles(uint8_t class_flags, uint16_t ability_flags) {
  if (!(ability_flags & (((1 << 11) | (1 << 12) | (1 << 13)))))
    class_flags &= ~(1 << 1);
  if (!(ability_flags & (((1 << 10)))))
    class_flags &= ~(1 << 0);
  if (!(ability_flags & (((1 << 8)))))
    class_flags &= ~(1 << 2);
  if (!(ability_flags & (((1 << 9)))))
    class_flags &= ~(1 << 3);
  return class_flags;
}


x86 assembly (clang, -O0):
<get_roles>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3800,%eax
cmp    $0x0,%eax
jne    1124 <get_roles+0x24>
mov    -0x4(%rbp),%eax
and    $0xfffffffd,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
jne    113e <get_roles+0x3e>
mov    -0x4(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
jne    1158 <get_roles+0x58>
mov    -0x4(%rbp),%eax
and    $0xfffffffb,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
jne    1172 <get_roles+0x72>
mov    -0x4(%rbp),%eax
and    $0xfffffff7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_roles>:
mov    %edi,%eax
and    $0xfffffffd,%eax
test   $0x3800,%esi
cmovne %edi,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
test   $0x400,%esi
cmovne %eax,%ecx
mov    %ecx,%edx
and    $0xfffffffb,%edx
test   $0x100,%esi
cmovne %ecx,%edx
mov    %edx,%eax
and    $0xfffffff7,%eax
test   $0x200,%esi
cmovne %edx,%eax
ret

LLVM IR (-O0):
define i32 @get_roles(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 = and i32 %5, 14336
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = and i32 %9, -3
store i32 %10, i32* %3
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %4
%13 = and i32 %12, 1024
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = and i32 %16, -2
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %11
%19 = load i32, i32* %4
%20 = and i32 %19, 256
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = and i32 %23, -5
store i32 %24, i32* %3
br label %25
25: ; preds = %22, %18
%26 = load i32, i32* %4
%27 = and i32 %26, 512
%28 = icmp ne i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = load i32, i32* %3
%31 = and i32 %30, -9
store i32 %31, i32* %3
br label %32
32: ; preds = %29, %25
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @get_roles(i32 %0, i32 %1) {
%3 = and i32 %1, 14336
%4 = icmp eq i32 %3, 0
%5 = and i32 %0, -3
%6 = select i1 %4, i32 %5, i32 %0
%7 = and i32 %1, 1024
%8 = icmp eq i32 %7, 0
%9 = and i32 %6, -2
%10 = select i1 %8, i32 %9, i32 %6
%11 = and i32 %1, 256
%12 = icmp eq i32 %11, 0
%13 = and i32 %10, -5
%14 = select i1 %12, i32 %13, i32 %10
%15 = and i32 %1, 512
%16 = icmp eq i32 %15, 0
%17 = and i32 %14, -9
%18 = select i1 %16, i32 %17, i32 %14
ret i32 %18
}