#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 */
struct can_filter {
  int can_id;
  int can_mask;
};

/* Variables and functions */
int CAN_INV_FILTER;
int /*<<< orphan*/ printf(char *, int, int);
void printfilter(const void *data) {
  struct can_filter *filter = (struct can_filter *)data;
  if (filter->can_id & CAN_INV_FILTER)
    printf("-f %03X~%X ", (filter->can_id & ~CAN_INV_FILTER), filter->can_mask);
  else
    printf("-f %03X:%X ", filter->can_id, filter->can_mask);
}


x86 assembly (clang, -O0):
<printfilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2ea7(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1168 <printfilter+0x58>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <printfilter+0x71>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printfilter>:
mov    (%rdi),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
test   %esi,%eax
je     1132 <printfilter+0x22>
not    %eax
and    %eax,%esi
mov    0x4(%rdi),%edx
lea    0xed3(%rip),%rdi
jmp    1030 <printf@plt>
mov    0x4(%rdi),%edx
lea    0xed0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.can_filter = type { i32, i32 }
@CAN_INV_FILTER = global i32 0
@.str = [12 x i8] c"-f %03X~%X \00"
@.str.1 = [12 x i8] c"-f %03X:%X \00"
define void @printfilter(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.can_filter*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.can_filter*
store %struct.can_filter* %5, %struct.can_filter** %3
%6 = load %struct.can_filter*, %struct.can_filter** %3
%7 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load i32, i32* @CAN_INV_FILTER
%10 = and i32 %8, %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %1
%13 = load %struct.can_filter*, %struct.can_filter** %3
%14 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load i32, i32* @CAN_INV_FILTER
%17 = xor i32 %16, -1
%18 = and i32 %15, %17
%19 = load %struct.can_filter*, %struct.can_filter** %3
%20 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %21)
br label %31
23: ; preds = %1
%24 = load %struct.can_filter*, %struct.can_filter** %3
%25 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = load %struct.can_filter*, %struct.can_filter** %3
%28 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %27, i32 0, i32 1
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %29)
br label %31
31: ; preds = %23, %12
ret void
}

LLVM IR (-O2):
@CAN_INV_FILTER = global i32 0
@.str = [12 x i8] c"-f %03X~%X \00"
@.str.1 = [12 x i8] c"-f %03X:%X \00"
define void @printfilter(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = load i32, i32* @CAN_INV_FILTER
%5 = and i32 %4, %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = xor i32 %4, -1
%9 = and i32 %3, %8
%10 = getelementptr inbounds i8, i8* %0, i64 4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12)
br label %19
14: ; preds = %1
%15 = getelementptr inbounds i8, i8* %0, i64 4
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %17)
br label %19
19: ; preds = %14, %7
ret void
}