#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 /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ EVIOCGID;
int /*<<< orphan*/ EVIOCGNAME(int);
int /*<<< orphan*/ EVIOCGPHYS(int);
int /*<<< orphan*/ EVIOCGVERSION;
#define EV_ABS 133
#define EV_KEY 132
#define EV_LED 131
unsigned int EV_MAX;
#define EV_REL 130
#define EV_REP 129
#define EV_SND 128
size_t ID_BUS;
size_t ID_PRODUCT;
size_t ID_VENDOR;
size_t ID_VERSION;
int /*<<< orphan*/ event_abs_log(int);
int /*<<< orphan*/ event_key_log(int);
int /*<<< orphan*/ event_led_log(int);
int /*<<< orphan*/ event_rel_log(int);
int /*<<< orphan*/ event_rep_log(int);
int /*<<< orphan*/ event_snd_log(int);
scalar_t__ event_test_bit(unsigned int, unsigned char *);
int /*<<< orphan*/ event_unknown_log(int, unsigned int);
scalar_t__ ioctl(int, int /*<<< orphan*/, ...);
int /*<<< orphan*/ log_f(char *, ...);
void event_log(int f, unsigned char *evtype_bitmask) {
  int version;
  unsigned short device_info[4];
  const char *bus;
  char buf[256];
  unsigned i;
  version = 0;
  if (ioctl(f, EVIOCGVERSION, &version)) {
    log_f("event: error in ioctl(EVIOCGVERSION)\n");
  } else {
    log_f("event: driver:%d.%d.%d\n", version >> 16, (version >> 8) & 0xff,
          version & 0xff);
  }
  if (ioctl(f, EVIOCGID, &device_info)) {
    log_f("event: error in ioctl(EVIOCGID)\n");
  } else {
    switch (device_info[ID_BUS]) {
    default:
      bus = "unknown";
      break;
    }
    log_f("event: device vendor:0x%04hx product:0x%04hx version:0x%04hx "
          "bus:0x%04hx (%s)\n",
          (unsigned)device_info[ID_VENDOR], (unsigned)device_info[ID_PRODUCT],
          (unsigned)device_info[ID_VERSION], (unsigned)device_info[ID_BUS],
          bus);
  }
  if (ioctl(f, EVIOCGNAME(sizeof(buf)), buf) < 0) {
    log_f("event: error in ioctl(EVIOCGNAME)\n");
  } else {
    log_f("event: name:\"%s\"\n", buf);
  }
  if (ioctl(f, EVIOCGPHYS(sizeof(buf)), buf) < 0) {
    log_f("event: error in ioctl(EVIOCGPHYS)\n");
  } else {
    log_f("event: physical_location:\"%s\"\n", buf);
  }
  for (i = 0; i < EV_MAX; ++i) {
    if (event_test_bit(i, evtype_bitmask)) {
      switch (i) {
      case EV_KEY:
        event_key_log(f);
        break;
      case EV_REL:
        event_rel_log(f);
        break;
      case EV_ABS:
        event_abs_log(f);
        break;
      case EV_LED:
        event_led_log(f);
        break;
      case EV_SND:
        event_snd_log(f);
        break;
      case EV_REP:
        event_rep_log(f);
        break;
      default:
        event_unknown_log(f, i);
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<event_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1070 <ioctl@plt>
cmp    $0x0,%rax
je     120d <event_log+0x4d>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
jmp    1236 <event_log+0x76>
mov    -0x14(%rbp),%esi
sar    $0x10,%esi
mov    -0x14(%rbp),%edx
sar    $0x8,%edx
and    $0xff,%edx
mov    -0x14(%rbp),%ecx
and    $0xff,%ecx
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
mov    -0x4(%rbp),%edi
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1070 <ioctl@plt>
cmp    $0x0,%rax
je     126a <event_log+0xaa>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
jmp    12c4 <event_log+0x104>
lea    0xe06(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2d64(%rip),%rax
mov    (%rax),%rax
movzwl -0x1c(%rbp,%rax,2),%esi
mov    0x2d35(%rip),%rax
mov    (%rax),%rax
movzwl -0x1c(%rbp,%rax,2),%edx
mov    0x2d36(%rip),%rax
mov    (%rax),%rax
movzwl -0x1c(%rbp,%rax,2),%ecx
mov    0x2d0f(%rip),%rax
mov    (%rax),%rax
movzwl -0x1c(%rbp,%rax,2),%r8d
mov    -0x28(%rbp),%r9
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x138(%rbp)
mov    $0x100,%edi
call   10e0 <EVIOCGNAME@plt>
mov    -0x138(%rbp),%edi
mov    %eax,%esi
lea    -0x130(%rbp),%rdx
mov    $0x0,%al
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    130a <event_log+0x14a>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
jmp    131f <event_log+0x15f>
lea    -0x130(%rbp),%rsi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x13c(%rbp)
mov    $0x100,%edi
call   10d0 <EVIOCGPHYS@plt>
mov    -0x13c(%rbp),%edi
mov    %eax,%esi
lea    -0x130(%rbp),%rdx
mov    $0x0,%al
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    1365 <event_log+0x1a5>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
jmp    137a <event_log+0x1ba>
lea    -0x130(%rbp),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <log_f@plt>
movl   $0x0,-0x134(%rbp)
mov    -0x134(%rbp),%eax
mov    0x2c5f(%rip),%rcx
cmp    (%rcx),%eax
jae    145e <event_log+0x29e>
mov    -0x134(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <event_test_bit@plt>
cmp    $0x0,%rax
je     1445 <event_log+0x285>
mov    -0x134(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x148(%rbp)
sub    $0x5,%eax
ja     1432 <event_log+0x272>
mov    -0x148(%rbp),%rax
lea    0xc25(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edi
call   1080 <event_key_log@plt>
jmp    1440 <event_log+0x280>
mov    -0x4(%rbp),%edi
call   10b0 <event_rel_log@plt>
jmp    1440 <event_log+0x280>
mov    -0x4(%rbp),%edi
call   10a0 <event_abs_log@plt>
jmp    1440 <event_log+0x280>
mov    -0x4(%rbp),%edi
call   1090 <event_led_log@plt>
jmp    1440 <event_log+0x280>
mov    -0x4(%rbp),%edi
call   1060 <event_snd_log@plt>
jmp    1440 <event_log+0x280>
mov    -0x4(%rbp),%edi
call   10c0 <event_rep_log@plt>
jmp    1440 <event_log+0x280>
mov    -0x4(%rbp),%edi
mov    -0x134(%rbp),%esi
call   1050 <event_unknown_log@plt>
jmp    1445 <event_log+0x285>
jmp    144a <event_log+0x28a>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1384 <event_log+0x1c4>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_log>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
movl   $0x0,0x4(%rsp)
mov    0x2dc4(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1070 <ioctl@plt>
test   %rax,%rax
je     1207 <event_log+0x47>
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1040 <log_f@plt>
jmp    1224 <event_log+0x64>
mov    0x4(%rsp),%eax
movzbl %ah,%edx
movzbl %al,%ecx
sar    $0x10,%eax
lea    0xe23(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <log_f@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %r14d,%edi
xor    %eax,%eax
call   1070 <ioctl@plt>
test   %rax,%rax
je     1251 <event_log+0x91>
lea    0xe0e(%rip),%rdi
xor    %eax,%eax
call   1040 <log_f@plt>
jmp    12a3 <event_log+0xe3>
mov    0x2d88(%rip),%rax
mov    (%rax),%rax
movzwl 0x8(%rsp,%rax,2),%esi
mov    0x2d59(%rip),%rax
mov    (%rax),%rax
movzwl 0x8(%rsp,%rax,2),%edx
mov    0x2d5a(%rip),%rax
mov    (%rax),%rax
movzwl 0x8(%rsp,%rax,2),%ecx
mov    0x2d33(%rip),%rax
mov    (%rax),%rax
movzwl 0x8(%rsp,%rax,2),%r8d
lea    0xdea(%rip),%rdi
lea    0xddb(%rip),%r9
xor    %eax,%eax
call   1040 <log_f@plt>
mov    $0x100,%edi
call   10e0 <EVIOCGNAME@plt>
lea    0x10(%rsp),%rdx
mov    %r14d,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ioctl@plt>
test   %rax,%rax
js     12d8 <event_log+0x118>
lea    0xe27(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <log_f@plt>
jmp    12e6 <event_log+0x126>
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1040 <log_f@plt>
mov    $0x100,%edi
call   10d0 <EVIOCGPHYS@plt>
lea    0x10(%rsp),%rdx
mov    %r14d,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ioctl@plt>
test   %rax,%rax
js     131b <event_log+0x15b>
lea    0xe19(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <log_f@plt>
jmp    1329 <event_log+0x169>
lea    0xde1(%rip),%rdi
xor    %eax,%eax
call   1040 <log_f@plt>
mov    0x2cc0(%rip),%r12
cmpl   $0x0,(%r12)
je     13b5 <event_log+0x1f5>
xor    %ebp,%ebp
lea    0xcc0(%rip),%rbx
jmp    1359 <event_log+0x199>
mov    %r14d,%edi
mov    %ebp,%esi
call   1050 <event_unknown_log@plt>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    (%r12),%ebp
jae    13b5 <event_log+0x1f5>
mov    %ebp,%edi
mov    %r15,%rsi
call   1030 <event_test_bit@plt>
test   %rax,%rax
je     1350 <event_log+0x190>
lea    -0x80(%rbp),%eax
cmp    $0x5,%eax
ja     1342 <event_log+0x182>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    %r14d,%edi
call   1060 <event_snd_log@plt>
jmp    1350 <event_log+0x190>
mov    %r14d,%edi
call   10c0 <event_rep_log@plt>
jmp    1350 <event_log+0x190>
mov    %r14d,%edi
call   10b0 <event_rel_log@plt>
jmp    1350 <event_log+0x190>
mov    %r14d,%edi
call   1090 <event_led_log@plt>
jmp    1350 <event_log+0x190>
mov    %r14d,%edi
call   1080 <event_key_log@plt>
jmp    1350 <event_log+0x190>
mov    %r14d,%edi
call   10a0 <event_abs_log@plt>
jmp    1350 <event_log+0x190>
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EVIOCGVERSION = global i32 0
@.str = [38 x i8] c"event: error in ioctl(EVIOCGVERSION)\0A\00"
@.str.1 = [24 x i8] c"event: driver:%d.%d.%d\0A\00"
@EVIOCGID = global i32 0
@.str.2 = [33 x i8] c"event: error in ioctl(EVIOCGID)\0A\00"
@ID_BUS = global i64 0
@.str.3 = [8 x i8] c"unknown\00"
@.str.4 = [79 x i8] c"event: device vendor:0x%04hx product:0x%04hx version:0x%04hx bus:0x%04hx (%s)\0A\00"
@ID_VENDOR = global i64 0
@ID_PRODUCT = global i64 0
@ID_VERSION = global i64 0
@.str.5 = [35 x i8] c"event: error in ioctl(EVIOCGNAME)\0A\00"
@.str.6 = [18 x i8] c"event: name:\22%s\22\0A\00"
@.str.7 = [35 x i8] c"event: error in ioctl(EVIOCGPHYS)\0A\00"
@.str.8 = [31 x i8] c"event: physical_location:\22%s\22\0A\00"
@EV_MAX = global i32 0
define void @event_log(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [4 x i16]
%7 = alloca i8*
%8 = alloca [256 x i8]
%9 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* @EVIOCGVERSION
%12 = call i64 (i32, i32, ...) @ioctl(i32 %10, i32 %11, i32* %5)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %25
16: ; preds = %2
%17 = load i32, i32* %5
%18 = ashr i32 %17, 16
%19 = load i32, i32* %5
%20 = ashr i32 %19, 8
%21 = and i32 %20, 255
%22 = load i32, i32* %5
%23 = and i32 %22, 255
%24 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %21, i32 %23)
br label %25
25: ; preds = %16, %14
%26 = load i32, i32* %3
%27 = load i32, i32* @EVIOCGID
%28 = call i64 (i32, i32, ...) @ioctl(i32 %26, i32 %27, [4 x i16]* %6)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %57
32: ; preds = %25
%33 = load i64, i64* @ID_BUS
%34 = getelementptr inbounds [4 x i16], [4 x i16]* %6, i64 0, i64 %33
%35 = load i16, i16* %34
%36 = zext i16 %35 to i32
switch i32 %36, label %37 [
]
37: ; preds = %32
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %7
br label %38
38: ; preds = %37
%39 = load i64, i64* @ID_VENDOR
%40 = getelementptr inbounds [4 x i16], [4 x i16]* %6, i64 0, i64 %39
%41 = load i16, i16* %40
%42 = zext i16 %41 to i32
%43 = load i64, i64* @ID_PRODUCT
%44 = getelementptr inbounds [4 x i16], [4 x i16]* %6, i64 0, i64 %43
%45 = load i16, i16* %44
%46 = zext i16 %45 to i32
%47 = load i64, i64* @ID_VERSION
%48 = getelementptr inbounds [4 x i16], [4 x i16]* %6, i64 0, i64 %47
%49 = load i16, i16* %48
%50 = zext i16 %49 to i32
%51 = load i64, i64* @ID_BUS
%52 = getelementptr inbounds [4 x i16], [4 x i16]* %6, i64 0, i64 %51
%53 = load i16, i16* %52
%54 = zext i16 %53 to i32
%55 = load i8*, i8** %7
%56 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0), i32 %42, i32 %46, i32 %50, i32 %54, i8* %55)
br label %57
57: ; preds = %38, %30
%58 = load i32, i32* %3
%59 = call i32 @EVIOCGNAME(i32 256)
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%61 = call i64 (i32, i32, ...) @ioctl(i32 %58, i32 %59, i8* %60)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %57
%64 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %68
65: ; preds = %57
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%67 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %65, %63
%69 = load i32, i32* %3
%70 = call i32 @EVIOCGPHYS(i32 256)
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%72 = call i64 (i32, i32, ...) @ioctl(i32 %69, i32 %70, i8* %71)
%73 = icmp slt i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %79
76: ; preds = %68
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%78 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %77)
br label %79
79: ; preds = %76, %74
store i32 0, i32* %9
br label %80
80: ; preds = %115, %79
%81 = load i32, i32* %9
%82 = load i32, i32* @EV_MAX
%83 = icmp ult i32 %81, %82
br i1 %83, label %84, label %118
84: ; preds = %80
%85 = load i32, i32* %9
%86 = load i8*, i8** %4
%87 = call i64 @event_test_bit(i32 %85, i8* %86)
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %114
89: ; preds = %84
%90 = load i32, i32* %9
switch i32 %90, label %109 [
i32 132, label %91
i32 130, label %94
i32 133, label %97
i32 131, label %100
i32 128, label %103
i32 129, label %106
]
91: ; preds = %89
%92 = load i32, i32* %3
%93 = call i32 @event_key_log(i32 %92)
br label %113
94: ; preds = %89
%95 = load i32, i32* %3
%96 = call i32 @event_rel_log(i32 %95)
br label %113
97: ; preds = %89
%98 = load i32, i32* %3
%99 = call i32 @event_abs_log(i32 %98)
br label %113
100: ; preds = %89
%101 = load i32, i32* %3
%102 = call i32 @event_led_log(i32 %101)
br label %113
103: ; preds = %89
%104 = load i32, i32* %3
%105 = call i32 @event_snd_log(i32 %104)
br label %113
106: ; preds = %89
%107 = load i32, i32* %3
%108 = call i32 @event_rep_log(i32 %107)
br label %113
109: ; preds = %89
%110 = load i32, i32* %3
%111 = load i32, i32* %9
%112 = call i32 @event_unknown_log(i32 %110, i32 %111)
br label %113
113: ; preds = %109, %106, %103, %100, %97, %94, %91
br label %114
114: ; preds = %113, %84
br label %115
115: ; preds = %114
%116 = load i32, i32* %9
%117 = add i32 %116, 1
store i32 %117, i32* %9
br label %80
118: ; preds = %80
ret void
}

LLVM IR (-O2):
@EVIOCGVERSION = global i32 0
@.str = [38 x i8] c"event: error in ioctl(EVIOCGVERSION)\0A\00"
@.str.1 = [24 x i8] c"event: driver:%d.%d.%d\0A\00"
@EVIOCGID = global i32 0
@.str.2 = [33 x i8] c"event: error in ioctl(EVIOCGID)\0A\00"
@ID_BUS = global i64 0
@.str.3 = [8 x i8] c"unknown\00"
@.str.4 = [79 x i8] c"event: device vendor:0x%04hx product:0x%04hx version:0x%04hx bus:0x%04hx (%s)\0A\00"
@ID_VENDOR = global i64 0
@ID_PRODUCT = global i64 0
@ID_VERSION = global i64 0
@.str.5 = [35 x i8] c"event: error in ioctl(EVIOCGNAME)\0A\00"
@.str.6 = [18 x i8] c"event: name:\22%s\22\0A\00"
@.str.7 = [35 x i8] c"event: error in ioctl(EVIOCGPHYS)\0A\00"
@.str.8 = [31 x i8] c"event: physical_location:\22%s\22\0A\00"
@EV_MAX = global i32 0
define void @event_log(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca [4 x i16]
%5 = alloca [256 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast [4 x i16]* %4 to i8*
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
store i32 0, i32* %3
%9 = load i32, i32* @EVIOCGVERSION
%10 = call i64 (i32, i32, ...) @ioctl(i32 %0, i32 %9, i32* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %21
14: ; preds = %2
%15 = load i32, i32* %3
%16 = ashr i32 %15, 16
%17 = lshr i32 %15, 8
%18 = and i32 %17, 255
%19 = and i32 %15, 255
%20 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %18, i32 %19)
br label %21
21: ; preds = %14, %12
%22 = load i32, i32* @EVIOCGID
%23 = call i64 (i32, i32, ...) @ioctl(i32 %0, i32 %22, [4 x i16]* %4)
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %45
27: ; preds = %21
%28 = load i64, i64* @ID_VENDOR
%29 = getelementptr inbounds [4 x i16], [4 x i16]* %4, i64 0, i64 %28
%30 = load i16, i16* %29
%31 = zext i16 %30 to i32
%32 = load i64, i64* @ID_PRODUCT
%33 = getelementptr inbounds [4 x i16], [4 x i16]* %4, i64 0, i64 %32
%34 = load i16, i16* %33
%35 = zext i16 %34 to i32
%36 = load i64, i64* @ID_VERSION
%37 = getelementptr inbounds [4 x i16], [4 x i16]* %4, i64 0, i64 %36
%38 = load i16, i16* %37
%39 = zext i16 %38 to i32
%40 = load i64, i64* @ID_BUS
%41 = getelementptr inbounds [4 x i16], [4 x i16]* %4, i64 0, i64 %40
%42 = load i16, i16* %41
%43 = zext i16 %42 to i32
%44 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %35, i32 %39, i32 %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %27, %25
%46 = call i32 @EVIOCGNAME(i32 256)
%47 = call i64 (i32, i32, ...) @ioctl(i32 %0, i32 %46, i8* %8)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %53
51: ; preds = %45
%52 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %8)
br label %53
53: ; preds = %51, %49
%54 = call i32 @EVIOCGPHYS(i32 256)
%55 = call i64 (i32, i32, ...) @ioctl(i32 %0, i32 %54, i8* %8)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %61
59: ; preds = %53
%60 = call i32 (i8*, ...) @log_f(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %8)
br label %61
61: ; preds = %59, %57
%62 = load i32, i32* @EV_MAX
%63 = icmp eq i32 %62, 0
br i1 %63, label %87, label %64
64: ; preds = %61, %83
%65 = phi i32 [ %84, %83 ], [ 0, %61 ]
%66 = call i64 @event_test_bit(i32 %65, i8* %1)
%67 = icmp eq i64 %66, 0
br i1 %67, label %83, label %68
68: ; preds = %64
switch i32 %65, label %81 [
i32 132, label %69
i32 130, label %71
i32 133, label %73
i32 131, label %75
i32 128, label %77
i32 129, label %79
]
69: ; preds = %68
%70 = call i32 @event_key_log(i32 %0)
br label %83
71: ; preds = %68
%72 = call i32 @event_rel_log(i32 %0)
br label %83
73: ; preds = %68
%74 = call i32 @event_abs_log(i32 %0)
br label %83
75: ; preds = %68
%76 = call i32 @event_led_log(i32 %0)
br label %83
77: ; preds = %68
%78 = call i32 @event_snd_log(i32 %0)
br label %83
79: ; preds = %68
%80 = call i32 @event_rep_log(i32 %0)
br label %83
81: ; preds = %68
%82 = call i32 @event_unknown_log(i32 %0, i32 %65)
br label %83
83: ; preds = %64, %81, %79, %77, %75, %73, %71, %69
%84 = add nuw i32 %65, 1
%85 = load i32, i32* @EV_MAX
%86 = icmp ult i32 %84, %85
br i1 %86, label %64, label %87
87: ; preds = %83, %61
ret void
}