#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 */

/* Variables and functions */
size_t ID_BUS;
size_t ID_PRODUCT;
size_t ID_VENDOR;
int /*<<< orphan*/ logdebug(char *);
int evdev_is_mouseemu(unsigned short *id) {
  unsigned short product = id[ID_PRODUCT];
  if (id[ID_BUS] != 0x06)
    return 0;
  if (id[ID_VENDOR] != 0x001f)
    return 0;
  if (product == 0x001f) {
    logdebug(" -> Mouseemu virtual keyboard\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<evdev_is_mouseemu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,2),%ax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2e93(%rip),%rcx
mov    (%rcx),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x6,%eax
je     1159 <evdev_is_mouseemu+0x49>
movl   $0x0,-0x4(%rbp)
jmp    11ac <evdev_is_mouseemu+0x9c>
mov    -0x10(%rbp),%rax
mov    0x2e84(%rip),%rcx
mov    (%rcx),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x1f,%eax
je     1180 <evdev_is_mouseemu+0x70>
movl   $0x0,-0x4(%rbp)
jmp    11ac <evdev_is_mouseemu+0x9c>
movzwl -0x12(%rbp),%eax
cmp    $0x1f,%eax
jne    11a5 <evdev_is_mouseemu+0x95>
lea    0xe6c(%rip),%rdi
call   1030 <logdebug@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ac <evdev_is_mouseemu+0x9c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evdev_is_mouseemu>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmpw   $0x6,(%rdi,%rcx,2)
jne    1157 <evdev_is_mouseemu+0x47>
mov    0x2ebd(%rip),%rcx
mov    (%rcx),%rcx
cmpw   $0x1f,(%rdi,%rcx,2)
jne    1157 <evdev_is_mouseemu+0x47>
mov    0x2e9c(%rip),%rcx
mov    (%rcx),%rcx
cmpw   $0x1f,(%rdi,%rcx,2)
jne    1157 <evdev_is_mouseemu+0x47>
lea    0xeb3(%rip),%rdi
call   1030 <logdebug@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ID_PRODUCT = global i64 0
@ID_BUS = global i64 0
@ID_VENDOR = global i64 0
@.str = [31 x i8] c" -> Mouseemu virtual keyboard\0A\00"
define i32 @evdev_is_mouseemu(i16* %0) {
%2 = alloca i32
%3 = alloca i16*
%4 = alloca i16
store i16* %0, i16** %3
%5 = load i16*, i16** %3
%6 = load i64, i64* @ID_PRODUCT
%7 = getelementptr inbounds i16, i16* %5, i64 %6
%8 = load i16, i16* %7
store i16 %8, i16* %4
%9 = load i16*, i16** %3
%10 = load i64, i64* @ID_BUS
%11 = getelementptr inbounds i16, i16* %9, i64 %10
%12 = load i16, i16* %11
%13 = zext i16 %12 to i32
%14 = icmp ne i32 %13, 6
br i1 %14, label %15, label %16
15: ; preds = %1
store i32 0, i32* %2
br label %31
16: ; preds = %1
%17 = load i16*, i16** %3
%18 = load i64, i64* @ID_VENDOR
%19 = getelementptr inbounds i16, i16* %17, i64 %18
%20 = load i16, i16* %19
%21 = zext i16 %20 to i32
%22 = icmp ne i32 %21, 31
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 0, i32* %2
br label %31
24: ; preds = %16
%25 = load i16, i16* %4
%26 = zext i16 %25 to i32
%27 = icmp eq i32 %26, 31
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @logdebug(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %31
30: ; preds = %24
store i32 0, i32* %2
br label %31
31: ; preds = %30, %28, %23, %15
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@ID_PRODUCT = global i64 0
@ID_BUS = global i64 0
@ID_VENDOR = global i64 0
@.str = [31 x i8] c" -> Mouseemu virtual keyboard\0A\00"
define i32 @evdev_is_mouseemu(i16* nocapture %0) {
%2 = load i64, i64* @ID_BUS
%3 = getelementptr inbounds i16, i16* %0, i64 %2
%4 = load i16, i16* %3
%5 = icmp eq i16 %4, 6
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = load i64, i64* @ID_PRODUCT
%8 = getelementptr inbounds i16, i16* %0, i64 %7
%9 = load i16, i16* %8
%10 = load i64, i64* @ID_VENDOR
%11 = getelementptr inbounds i16, i16* %0, i64 %10
%12 = load i16, i16* %11
%13 = icmp eq i16 %12, 31
%14 = icmp eq i16 %9, 31
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %16, label %18
16: ; preds = %6
%17 = tail call i32 @logdebug(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %6, %1, %16
%19 = phi i32 [ 1, %16 ], [ 0, %1 ], [ 0, %6 ]
ret i32 %19
}