#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 uint16_t;

/* Variables and functions */
uint16_t get_quirks(uint16_t vendor, uint16_t product, uint16_t bcdDevice) {
  uint16_t quirks = 0;
  if (vendor == 0x1d50 || vendor == 0x1457 || vendor == 0x16c0)
    quirks |= (1 << 0);
  if (vendor == 0x1eaf && product == 0x0003 && bcdDevice == 0x0200)
    quirks |= (1 << 1);
  return (quirks);
}


x86 assembly (clang, -O0):
<get_quirks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x1d50,-0x4(%rbp)
je     113b <get_quirks+0x3b>
cmpl   $0x1457,-0x4(%rbp)
je     113b <get_quirks+0x3b>
cmpl   $0x16c0,-0x4(%rbp)
jne    1144 <get_quirks+0x44>
mov    -0x10(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1eaf,-0x4(%rbp)
jne    1171 <get_quirks+0x71>
cmpl   $0x3,-0x8(%rbp)
jne    1171 <get_quirks+0x71>
cmpl   $0x200,-0xc(%rbp)
jne    1171 <get_quirks+0x71>
mov    -0x10(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_quirks>:
cmp    $0x1457,%edi
je     111a <get_quirks+0x1a>
cmp    $0x1d50,%edi
je     111a <get_quirks+0x1a>
xor    %ecx,%ecx
cmp    $0x16c0,%edi
jne    111f <get_quirks+0x1f>
mov    $0x1,%ecx
xor    $0x1eaf,%edi
xor    $0x3,%esi
or     %edi,%esi
xor    $0x200,%edx
lea    0x2(%rcx),%eax
or     %esi,%edx
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_quirks(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 7504
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 5207
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 5824
br i1 %15, label %16, label %19
16: ; preds = %13, %10, %3
%17 = load i32, i32* %7
%18 = or i32 %17, 1
store i32 %18, i32* %7
br label %19
19: ; preds = %16, %13
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 7855
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 512
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %7
%30 = or i32 %29, 2
store i32 %30, i32* %7
br label %31
31: ; preds = %28, %25, %22, %19
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
define i32 @get_quirks(i32 %0, i32 %1, i32 %2) {
switch i32 %0, label %5 [
i32 7504, label %4
i32 5824, label %4
i32 5207, label %4
]
4: ; preds = %3, %3, %3
br label %5
5: ; preds = %3, %4
%6 = phi i32 [ 1, %4 ], [ 0, %3 ]
%7 = icmp eq i32 %0, 7855
%8 = icmp eq i32 %1, 3
%9 = and i1 %7, %8
%10 = icmp eq i32 %2, 512
%11 = and i1 %9, %10
%12 = or i32 %6, 2
%13 = select i1 %11, i32 %12, i32 %6
ret i32 %13
}