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

/* Variables and functions */
int V4L2_TUNER_CAP_LANG1;
int V4L2_TUNER_CAP_LANG2;
int V4L2_TUNER_CAP_LOW;
int V4L2_TUNER_CAP_NORM;
int V4L2_TUNER_CAP_SAP;
int V4L2_TUNER_CAP_STEREO;
int valid_tuner_capability(__u32 capability) {
  int valid = 0;
  if ((capability & ~(V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_NORM |
                      V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 |
                      V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP)) == 0) {
    valid = 1;
  } else {
    valid = 0;
  }
  return valid;
}


x86 assembly (clang, -O0):
<valid_tuner_capability>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb8(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2ec7(%rip),%rdx
or     (%rdx),%ecx
mov    0x2e9e(%rip),%rdx
or     (%rdx),%ecx
mov    0x2e7d(%rip),%rdx
or     (%rdx),%ecx
mov    0x2ea4(%rip),%rdx
or     (%rdx),%ecx
mov    0x2e73(%rip),%rdx
or     (%rdx),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    1161 <valid_tuner_capability+0x61>
movl   $0x1,-0x8(%rbp)
jmp    1168 <valid_tuner_capability+0x68>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_tuner_capability>:
mov    0x2ec9(%rip),%rax
mov    0x2eda(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2eaf(%rip),%rax
or     (%rax),%ecx
mov    0x2e8e(%rip),%rax
or     (%rax),%ecx
mov    0x2eb5(%rip),%rax
or     (%rax),%ecx
mov    0x2e84(%rip),%rax
or     (%rax),%ecx
not    %ecx
xor    %eax,%eax
test   %edi,%ecx
sete   %al
ret

LLVM IR (-O0):
@V4L2_TUNER_CAP_LOW = global i32 0
@V4L2_TUNER_CAP_NORM = global i32 0
@V4L2_TUNER_CAP_STEREO = global i32 0
@V4L2_TUNER_CAP_LANG1 = global i32 0
@V4L2_TUNER_CAP_LANG2 = global i32 0
@V4L2_TUNER_CAP_SAP = global i32 0
define i32 @valid_tuner_capability(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @V4L2_TUNER_CAP_LOW
%6 = load i32, i32* @V4L2_TUNER_CAP_NORM
%7 = or i32 %5, %6
%8 = load i32, i32* @V4L2_TUNER_CAP_STEREO
%9 = or i32 %7, %8
%10 = load i32, i32* @V4L2_TUNER_CAP_LANG1
%11 = or i32 %9, %10
%12 = load i32, i32* @V4L2_TUNER_CAP_LANG2
%13 = or i32 %11, %12
%14 = load i32, i32* @V4L2_TUNER_CAP_SAP
%15 = or i32 %13, %14
%16 = xor i32 %15, -1
%17 = and i32 %4, %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %1
store i32 1, i32* %3
br label %21
20: ; preds = %1
store i32 0, i32* %3
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@V4L2_TUNER_CAP_LOW = global i32 0
@V4L2_TUNER_CAP_NORM = global i32 0
@V4L2_TUNER_CAP_STEREO = global i32 0
@V4L2_TUNER_CAP_LANG1 = global i32 0
@V4L2_TUNER_CAP_LANG2 = global i32 0
@V4L2_TUNER_CAP_SAP = global i32 0
define i32 @valid_tuner_capability(i32 %0) {
%2 = load i32, i32* @V4L2_TUNER_CAP_LOW
%3 = load i32, i32* @V4L2_TUNER_CAP_NORM
%4 = or i32 %3, %2
%5 = load i32, i32* @V4L2_TUNER_CAP_STEREO
%6 = or i32 %4, %5
%7 = load i32, i32* @V4L2_TUNER_CAP_LANG1
%8 = or i32 %6, %7
%9 = load i32, i32* @V4L2_TUNER_CAP_LANG2
%10 = or i32 %8, %9
%11 = load i32, i32* @V4L2_TUNER_CAP_SAP
%12 = or i32 %10, %11
%13 = xor i32 %12, -1
%14 = and i32 %13, %0
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
ret i32 %16
}