#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 */
unsigned short BUS_USB;
size_t ID_BUS;
size_t ID_PRODUCT;
size_t ID_VENDOR;
int /*<<< orphan*/ kbd_set_fnmode();
int /*<<< orphan*/ logdebug(char *);
int evdev_is_2011mba(unsigned short *id) {
  unsigned short product = id[ID_PRODUCT];
  if (id[ID_BUS] != BUS_USB)
    return 0;
  if (id[ID_VENDOR] != 0x05ac)
    return 0;
  if ((product == 0x024a) || (product == 0x024b) || (product == 0x024c) ||
      (product == 0x024d)) {
    logdebug(" -> 2011MBA USB assembly\n");
    kbd_set_fnmode();
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<evdev_is_2011mba>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2e99(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,2),%ax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2e7b(%rip),%rcx
mov    (%rcx),%rcx
movzwl (%rax,%rcx,2),%eax
mov    0x2e95(%rip),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
je     1172 <evdev_is_2011mba+0x52>
movl   $0x0,-0x4(%rbp)
jmp    11fd <evdev_is_2011mba+0xdd>
mov    -0x10(%rbp),%rax
mov    0x2e63(%rip),%rcx
mov    (%rcx),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x5ac,%eax
je     119b <evdev_is_2011mba+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    11fd <evdev_is_2011mba+0xdd>
movzwl -0x12(%rbp),%eax
cmp    $0x24a,%eax
je     11d7 <evdev_is_2011mba+0xb7>
movzwl -0x12(%rbp),%eax
cmp    $0x24b,%eax
je     11d7 <evdev_is_2011mba+0xb7>
movzwl -0x12(%rbp),%eax
cmp    $0x24c,%eax
je     11d7 <evdev_is_2011mba+0xb7>
movzwl -0x12(%rbp),%eax
cmp    $0x24d,%eax
jne    11f6 <evdev_is_2011mba+0xd6>
lea    0xe22(%rip),%rdi
call   1040 <logdebug@plt>
mov    $0x0,%al
call   1030 <kbd_set_fnmode@plt>
movl   $0x1,-0x4(%rbp)
jmp    11fd <evdev_is_2011mba+0xdd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evdev_is_2011mba>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%rax
movzwl (%rdi,%rax,2),%ecx
mov    0x2eba(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%cx
jne    1185 <evdev_is_2011mba+0x65>
mov    0x2e9c(%rip),%rcx
mov    (%rcx),%rcx
movzwl (%rdi,%rcx,2),%ecx
cmp    $0x5ac,%ecx
jne    1185 <evdev_is_2011mba+0x65>
mov    0x2e76(%rip),%rcx
mov    (%rcx),%rcx
movzwl (%rdi,%rcx,2),%ecx
add    $0xfffffdb6,%ecx
cmp    $0x3,%cx
ja     1185 <evdev_is_2011mba+0x65>
lea    0xe8c(%rip),%rdi
call   1040 <logdebug@plt>
xor    %eax,%eax
call   1030 <kbd_set_fnmode@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ID_PRODUCT = global i64 0
@ID_BUS = global i64 0
@BUS_USB = global i16 0
@ID_VENDOR = global i64 0
@.str = [26 x i8] c" -> 2011MBA USB assembly\0A\00"
define i32 @evdev_is_2011mba(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 = load i16, i16* @BUS_USB
%15 = zext i16 %14 to i32
%16 = icmp ne i32 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %1
store i32 0, i32* %2
br label %46
18: ; preds = %1
%19 = load i16*, i16** %3
%20 = load i64, i64* @ID_VENDOR
%21 = getelementptr inbounds i16, i16* %19, i64 %20
%22 = load i16, i16* %21
%23 = zext i16 %22 to i32
%24 = icmp ne i32 %23, 1452
br i1 %24, label %25, label %26
25: ; preds = %18
store i32 0, i32* %2
br label %46
26: ; preds = %18
%27 = load i16, i16* %4
%28 = zext i16 %27 to i32
%29 = icmp eq i32 %28, 586
br i1 %29, label %42, label %30
30: ; preds = %26
%31 = load i16, i16* %4
%32 = zext i16 %31 to i32
%33 = icmp eq i32 %32, 587
br i1 %33, label %42, label %34
34: ; preds = %30
%35 = load i16, i16* %4
%36 = zext i16 %35 to i32
%37 = icmp eq i32 %36, 588
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i16, i16* %4
%40 = zext i16 %39 to i32
%41 = icmp eq i32 %40, 589
br i1 %41, label %42, label %45
42: ; preds = %38, %34, %30, %26
%43 = call i32 @logdebug(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%44 = call i32 (...) @kbd_set_fnmode()
store i32 1, i32* %2
br label %46
45: ; preds = %38
store i32 0, i32* %2
br label %46
46: ; preds = %45, %42, %25, %17
%47 = load i32, i32* %2
ret i32 %47
}

LLVM IR (-O2):
@ID_PRODUCT = global i64 0
@ID_BUS = global i64 0
@BUS_USB = global i16 0
@ID_VENDOR = global i64 0
@.str = [26 x i8] c" -> 2011MBA USB assembly\0A\00"
define i32 @evdev_is_2011mba(i16* nocapture %0) {
%2 = load i64, i64* @ID_BUS
%3 = getelementptr inbounds i16, i16* %0, i64 %2
%4 = load i16, i16* %3
%5 = load i16, i16* @BUS_USB
%6 = icmp eq i16 %4, %5
br i1 %6, label %7, label %21
7: ; preds = %1
%8 = load i64, i64* @ID_PRODUCT
%9 = getelementptr inbounds i16, i16* %0, i64 %8
%10 = load i16, i16* %9
%11 = load i64, i64* @ID_VENDOR
%12 = getelementptr inbounds i16, i16* %0, i64 %11
%13 = load i16, i16* %12
%14 = icmp eq i16 %13, 1452
%15 = add i16 %10, -586
%16 = icmp ult i16 %15, 4
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %18, label %21
18: ; preds = %7
%19 = tail call i32 @logdebug(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 (...) @kbd_set_fnmode()
br label %21
21: ; preds = %7, %1, %18
%22 = phi i32 [ 1, %18 ], [ 0, %1 ], [ 0, %7 ]
ret i32 %22
}