#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 input_event {
  int type;
  int code;
  int value;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ event;

/* Variables and functions */
int /*<<< orphan*/ EVIOCGVERSION;
int /*<<< orphan*/ O_RDWR;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ ioctl(int, int /*<<< orphan*/, int *);
int /*<<< orphan*/ memset(struct input_event *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
char *strerror(int /*<<< orphan*/);
size_t strlen(char *);
scalar_t__ write(int, struct input_event *, int);
int main(int argc, char *argv[]) {
  int fd;
  ssize_t ret;
  int version;
  struct input_event event;
  char event_file[20] = "/dev/input/event";
  if (argc != 5) {
    fprintf(stderr,
            "Use: %s device type code value. Only found %d arguments.\n",
            argv[0], argc);
    return 1;
  }
  printf("argc: %d, argv[1]: %s, argv[2]: %d, argv[3]: %d, argv[4]: %d\n", argc,
         argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]));
  strcat(event_file, argv[1]);
  event_file[strlen(event_file)] = '\0';
  fd = open(event_file, O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "Could not open %s, %s\n", event_file, strerror(errno));
    return 1;
  }
  if (ioctl(fd, EVIOCGVERSION, &version)) {
    fprintf(stderr, "Could not get driver version for %s, %s\n", event_file,
            strerror(errno));
    return 1;
  }
  memset(&event, 0, sizeof(event));
  event.type = atoi(argv[2]);
  event.code = atoi(argv[3]);
  event.value = atoi(argv[4]);
  printf("type: %d, code: %d, value: %d\n", event.type, event.code,
         event.value);
  ret = write(fd, &event, sizeof(event));
  if (ret < (ssize_t)sizeof(event)) {
    fprintf(stderr, "Write event failed, %s\n", strerror(errno));
    return -1;
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe30(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe2d(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe2b(%rip),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     121f <main+0x6f>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1432 <main+0x282>
mov    -0x8(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10b0 <atoi@plt>
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%rdx
mov    -0x58(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    %eax,%r9d
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   10c0 <strcat@plt>
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
movb   $0x0,-0x50(%rbp,%rax,1)
lea    -0x50(%rbp),%rdi
mov    0x2d41(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1301 <main+0x151>
mov    0x2d16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1432 <main+0x282>
mov    -0x14(%rbp),%edi
mov    0x2cb5(%rip),%rax
mov    (%rax),%esi
lea    -0x24(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
je     136c <main+0x1bc>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xd4a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1432 <main+0x282>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0xc,-0x20(%rbp)
jge    1423 <main+0x273>
mov    0x2bee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x88(%rbp),%edi
mov    %rax,%rdx
lea    0xcdb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1432 <main+0x282>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
movaps 0xe38(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
cmp    $0x5,%edi
jne    1296 <main+0xe6>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rdi
call   10b0 <atoi@plt>
lea    0xe45(%rip),%rdi
mov    $0x5,%esi
mov    %r14,%rdx
mov    %r15d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   10c0 <strcat@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
movb   $0x0,0x10(%rsp,%rax,1)
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     12b4 <main+0x104>
mov    %eax,%r14d
mov    0x2d62(%rip),%rax
mov    (%rax),%esi
lea    0x24(%rsp),%rdx
mov    %r14d,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
je     12f9 <main+0x149>
mov    0x2d5b(%rip),%rax
mov    (%rax),%ebx
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xe0f(%rip),%rsi
jmp    12d2 <main+0x122>
mov    %edi,%ecx
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd69(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    12e3 <main+0x133>
mov    0x2d1d(%rip),%rax
mov    (%rax),%ebx
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xdba(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r15
xor    %ebp,%ebp
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x10(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r12d
mov    %eax,(%rsp)
mov    0x18(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r13d
mov    %eax,0x4(%rsp)
mov    0x20(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,0x8(%rsp)
lea    0xd8c(%rip),%rdi
mov    %r12d,%esi
mov    %r13d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1030 <write@plt>
cmp    $0xb,%rax
jg     1399 <main+0x1e9>
mov    0x2c6c(%rip),%rax
mov    (%rax),%ebx
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xd68(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    12e8 <main+0x138>
mov    %r14d,%edi
call   1080 <close@plt>
jmp    12e8 <main+0x138>

LLVM IR (-O0):
%struct.input_event = type { i32, i32, i32 }
@__const.main.event_file = [20 x i8] c"/dev/input/event\00\00\00\00"
@stderr = global i32 0
@.str = [58 x i8] c"Use: %s device type code value. Only found %d arguments.\0A\00"
@.str.1 = [62 x i8] c"argc: %d, argv[1]: %s, argv[2]: %d, argv[3]: %d, argv[4]: %d\0A\00"
@O_RDWR = global i32 0
@.str.2 = [23 x i8] c"Could not open %s, %s\0A\00"
@errno = global i32 0
@EVIOCGVERSION = global i32 0
@.str.3 = [41 x i8] c"Could not get driver version for %s, %s\0A\00"
@.str.4 = [31 x i8] c"type: %d, code: %d, value: %d\0A\00"
@.str.5 = [24 x i8] c"Write event failed, %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = alloca %struct.input_event
%10 = alloca [20 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [20 x i8]* %10 to i8*
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 5
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = load i32, i32* %4
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19)
store i32 1, i32* %3
br label %105
21: ; preds = %2
%22 = load i32, i32* %4
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 4
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i32 %22, i8* %25, i32 %29, i32 %33, i32 %37)
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @strcat(i8* %39, i8* %42)
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%45 = call i64 @strlen(i8* %44)
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 %45
store i8 0, i8* %46
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%48 = load i32, i32* @O_RDWR
%49 = call i32 @open(i8* %47, i32 %48)
store i32 %49, i32* %6
%50 = load i32, i32* %6
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %21
%53 = load i32, i32* @stderr
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%55 = load i32, i32* @errno
%56 = call i8* @strerror(i32 %55)
%57 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %54, i8* %56)
store i32 1, i32* %3
br label %105
58: ; preds = %21
%59 = load i32, i32* %6
%60 = load i32, i32* @EVIOCGVERSION
%61 = call i64 @ioctl(i32 %59, i32 %60, i32* %8)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %69
63: ; preds = %58
%64 = load i32, i32* @stderr
%65 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%66 = load i32, i32* @errno
%67 = call i8* @strerror(i32 %66)
%68 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %65, i8* %67)
store i32 1, i32* %3
br label %105
69: ; preds = %58
%70 = call i32 @memset(%struct.input_event* %9, i32 0, i32 12)
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 2
%73 = load i8*, i8** %72
%74 = call i32 @atoi(i8* %73)
%75 = getelementptr inbounds %struct.input_event, %struct.input_event* %9, i32 0, i32 0
store i32 %74, i32* %75
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 3
%78 = load i8*, i8** %77
%79 = call i32 @atoi(i8* %78)
%80 = getelementptr inbounds %struct.input_event, %struct.input_event* %9, i32 0, i32 1
store i32 %79, i32* %80
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 4
%83 = load i8*, i8** %82
%84 = call i32 @atoi(i8* %83)
%85 = getelementptr inbounds %struct.input_event, %struct.input_event* %9, i32 0, i32 2
store i32 %84, i32* %85
%86 = getelementptr inbounds %struct.input_event, %struct.input_event* %9, i32 0, i32 0
%87 = load i32, i32* %86
%88 = getelementptr inbounds %struct.input_event, %struct.input_event* %9, i32 0, i32 1
%89 = load i32, i32* %88
%90 = getelementptr inbounds %struct.input_event, %struct.input_event* %9, i32 0, i32 2
%91 = load i32, i32* %90
%92 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %87, i32 %89, i32 %91)
%93 = load i32, i32* %6
%94 = call i64 @write(i32 %93, %struct.input_event* %9, i32 12)
store i64 %94, i64* %7
%95 = load i64, i64* %7
%96 = icmp slt i64 %95, 12
br i1 %96, label %97, label %102
97: ; preds = %69
%98 = load i32, i32* @stderr
%99 = load i32, i32* @errno
%100 = call i8* @strerror(i32 %99)
%101 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %100)
store i32 -1, i32* %3
br label %105
102: ; preds = %69
%103 = load i32, i32* %6
%104 = call i32 @close(i32 %103)
store i32 0, i32* %3
br label %105
105: ; preds = %102, %97, %63, %52, %14
%106 = load i32, i32* %3
ret i32 %106
}

LLVM IR (-O2):
%struct.input_event = type { i32, i32, i32 }
@__const.main.event_file = [20 x i8] c"/dev/input/event\00\00\00\00"
@stderr = global i32 0
@.str = [58 x i8] c"Use: %s device type code value. Only found %d arguments.\0A\00"
@.str.1 = [62 x i8] c"argc: %d, argv[1]: %s, argv[2]: %d, argv[3]: %d, argv[4]: %d\0A\00"
@O_RDWR = global i32 0
@.str.2 = [23 x i8] c"Could not open %s, %s\0A\00"
@errno = global i32 0
@EVIOCGVERSION = global i32 0
@.str.3 = [41 x i8] c"Could not get driver version for %s, %s\0A\00"
@.str.4 = [31 x i8] c"type: %d, code: %d, value: %d\0A\00"
@.str.5 = [24 x i8] c"Write event failed, %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.input_event
%5 = alloca [20 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast %struct.input_event* %4 to i8*
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 5
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %0)
br label %69
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 4
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i32 5, i8* %16, i32 %19, i32 %22, i32 %25)
%27 = load i8*, i8** %15
%28 = call i32 @strcat(i8* %8, i8* %27)
%29 = call i64 @strlen(i8* %8)
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %29
store i8 0, i8* %30
%31 = load i32, i32* @O_RDWR
%32 = call i32 @open(i8* %8, i32 %31)
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %14
%35 = load i32, i32* @stderr
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %37)
br label %69
39: ; preds = %14
%40 = load i32, i32* @EVIOCGVERSION
%41 = call i64 @ioctl(i32 %32, i32 %40, i32* %3)
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* %46)
br label %69
48: ; preds = %39
%49 = call i32 @memset(%struct.input_event* %4, i32 0, i32 12)
%50 = load i8*, i8** %17
%51 = call i32 @atoi(i8* %50)
%52 = getelementptr inbounds %struct.input_event, %struct.input_event* %4, i64 0, i32 0
store i32 %51, i32* %52
%53 = load i8*, i8** %20
%54 = call i32 @atoi(i8* %53)
%55 = getelementptr inbounds %struct.input_event, %struct.input_event* %4, i64 0, i32 1
store i32 %54, i32* %55
%56 = load i8*, i8** %23
%57 = call i32 @atoi(i8* %56)
%58 = getelementptr inbounds %struct.input_event, %struct.input_event* %4, i64 0, i32 2
store i32 %57, i32* %58
%59 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %51, i32 %54, i32 %57)
%60 = call i64 @write(i32 %32, %struct.input_event* %4, i32 12)
%61 = icmp slt i64 %60, 12
br i1 %61, label %62, label %67
62: ; preds = %48
%63 = load i32, i32* @stderr
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %65)
br label %69
67: ; preds = %48
%68 = call i32 @close(i32 %32)
br label %69
69: ; preds = %67, %62, %43, %34, %10
%70 = phi i32 [ 1, %10 ], [ 1, %34 ], [ 1, %43 ], [ -1, %62 ], [ 0, %67 ]
ret i32 %70
}