#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ rtype;
  int size;
  int *data;
};
struct TYPE_4__ {
  TYPE_1__ output;
};
struct uhid_event {
  TYPE_2__ u;
};

/* Variables and functions */
scalar_t__ UHID_OUTPUT_REPORT;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void handle_output(struct uhid_event *ev) {
  if (ev->u.output.rtype != UHID_OUTPUT_REPORT) {
    return;
  }
  if (ev->u.output.size != 2) {
    return;
  }
  if (ev->u.output.data[0] != 0x2) {
    return;
  }
  fprintf(stderr, "LED output report received with flags %x\n",
          ev->u.output.data[1]);
}


x86 assembly (clang, -O0):
<handle_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2ebe(%rip),%rcx
cmp    (%rcx),%rax
je     1138 <handle_output+0x28>
jmp    1181 <handle_output+0x71>
mov    -0x8(%rbp),%rax
cmpl   $0x2,0x8(%rax)
je     114b <handle_output+0x3b>
jmp    1181 <handle_output+0x71>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
cmpl   $0x2,(%rax)
je     1161 <handle_output+0x51>
jmp    1181 <handle_output+0x71>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x4(%rax),%edx
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_output>:
mov    (%rdi),%rax
mov    0x2ece(%rip),%rcx
cmp    (%rcx),%rax
jne    1146 <handle_output+0x36>
cmpl   $0x2,0x8(%rdi)
jne    1146 <handle_output+0x36>
mov    0x10(%rdi),%rax
cmpl   $0x2,(%rax)
jne    1146 <handle_output+0x36>
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%edi
mov    0x4(%rax),%edx
lea    0xebf(%rip),%rsi
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
%struct.uhid_event = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64, i32, i32* }
@UHID_OUTPUT_REPORT = global i64 0
@stderr = global i32 0
@.str = [42 x i8] c"LED output report received with flags %x\0A\00"
define void @handle_output(%struct.uhid_event* %0) {
%2 = alloca %struct.uhid_event*
store %struct.uhid_event* %0, %struct.uhid_event** %2
%3 = load %struct.uhid_event*, %struct.uhid_event** %2
%4 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %3, i32 0, i32 0
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = load i64, i64* @UHID_OUTPUT_REPORT
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %1
br label %39
11: ; preds = %1
%12 = load %struct.uhid_event*, %struct.uhid_event** %2
%13 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %12, i32 0, i32 0
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %19
18: ; preds = %11
br label %39
19: ; preds = %11
%20 = load %struct.uhid_event*, %struct.uhid_event** %2
%21 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %20, i32 0, i32 0
%22 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %21, i32 0, i32 0
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %22, i32 0, i32 2
%24 = load i32*, i32** %23
%25 = getelementptr inbounds i32, i32* %24, i64 0
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 2
br i1 %27, label %28, label %29
28: ; preds = %19
br label %39
29: ; preds = %19
%30 = load i32, i32* @stderr
%31 = load %struct.uhid_event*, %struct.uhid_event** %2
%32 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %31, i32 0, i32 0
%33 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %32, i32 0, i32 0
%34 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %33, i32 0, i32 2
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 1
%37 = load i32, i32* %36
%38 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %29, %28, %18, %10
ret void
}

LLVM IR (-O2):
%struct.uhid_event = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64, i32, i32* }
@UHID_OUTPUT_REPORT = global i64 0
@stderr = global i32 0
@.str = [42 x i8] c"LED output report received with flags %x\0A\00"
define void @handle_output(%struct.uhid_event* nocapture %0) {
%2 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %0, i64 0, i32 0, i32 0, i32 0
%3 = load i64, i64* %2
%4 = load i64, i64* @UHID_OUTPUT_REPORT
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %20
6: ; preds = %1
%7 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %0, i64 0, i32 0, i32 0, i32 1
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = getelementptr inbounds %struct.uhid_event, %struct.uhid_event* %0, i64 0, i32 0, i32 0, i32 2
%12 = load i32*, i32** %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = getelementptr inbounds i32, i32* %12, i64 1
%18 = load i32, i32* %17
%19 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %10, %6, %1, %15
ret void
}