#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 */
int /*<<< orphan*/ O_RDWR;
scalar_t__ dump_packets(int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ send_command(int, int);
int /*<<< orphan*/ send_status_request(int);
scalar_t__ serio_reset(int);
int main(int argc, char **argv) {
  int i, j;
  (void)i;
  (void)j;
  if (argc != 2) {
    printf("Error: Invalid parameters.\n");
    printf("Usage: %s <path-to-serio_raw-device>\n", argv[0]);
    printf("For hints on how to enable serio_raw, see "
           "http://people.canonical.com/~sforshee/touchpad/mouse-to-serio.sh.\n"
           "Usage example: %s /dev/serio_raw0\n",
           argv[0]);
    return -1;
  }
  int file = open(argv[1], O_RDWR);
  if (file == -1) {
    printf("Could not open %s. Check that the program is run "
           "with the required privileges and that the file exists.\n",
           argv[1]);
    perror("open");
    return -1;
  }
  if (serio_reset(file) < 0) {
    printf("reset failed.");
    return -1;
  }
  send_command(file, 0xf5);
  send_command(file, 0xe6);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_status_request(file);
  send_command(file, 0xe6);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 1);
  send_status_request(file);
  send_command(file, 0xe6);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 2);
  send_status_request(file);
  send_command(file, 0xe6);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 5);
  send_status_request(file);
  send_command(file, 0xe6);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 0);
  send_command(file, 0xe8);
  send_command(file, 6);
  send_status_request(file);
  send_command(file, 0xf8);
  send_command(file, 0);
  send_command(file, 0xf8);
  send_command(file, 0);
  send_command(file, 0xf8);
  send_command(file, 0);
  send_command(file, 0xf8);
  send_command(file, 1);
  send_command(file, 0xe6);
  send_command(file, 0xf4);
  if (dump_packets(file, 6) < 0) {
    printf("dump_packets failed");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11d4 <main+0x64>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1550 <main+0x3e0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1225 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf26(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1550 <main+0x3e0>
mov    -0x1c(%rbp),%edi
call   1040 <serio_reset@plt>
cmp    $0x0,%rax
jge    1251 <main+0xe1>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1550 <main+0x3e0>
mov    -0x1c(%rbp),%edi
mov    $0xf5,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
call   1030 <send_status_request@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
call   1030 <send_status_request@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0x2,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
call   1030 <send_status_request@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0x5,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
call   1030 <send_status_request@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0x6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
call   1030 <send_status_request@plt>
mov    -0x1c(%rbp),%edi
mov    $0xf8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xf8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xf8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xf8,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xe6,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0xf4,%esi
call   1060 <send_command@plt>
mov    -0x1c(%rbp),%edi
mov    $0x6,%esi
call   1090 <dump_packets@plt>
cmp    $0x0,%rax
jge    1549 <main+0x3d9>
lea    0xc17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1550 <main+0x3e0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x2,%edi
jne    1462 <main+0x2e2>
mov    0x8(%rbp),%rdi
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     14b0 <main+0x330>
mov    %eax,%ebx
mov    %eax,%edi
call   1050 <serio_reset@plt>
test   %rax,%rax
js     1494 <main+0x314>
mov    %ebx,%edi
mov    $0xf5,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
xor    %ebp,%ebp
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
call   1030 <send_status_request@plt>
mov    %ebx,%edi
mov    $0xe6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
call   1030 <send_status_request@plt>
mov    %ebx,%edi
mov    $0xe6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
call   1030 <send_status_request@plt>
mov    %ebx,%edi
mov    $0xe6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
call   1030 <send_status_request@plt>
mov    %ebx,%edi
mov    $0xe6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0x6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
call   1030 <send_status_request@plt>
mov    %ebx,%edi
mov    $0xf8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xf8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xf8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xf8,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xe6,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0xf4,%esi
call   1070 <send_command@plt>
mov    %ebx,%edi
mov    $0x6,%esi
call   10a0 <dump_packets@plt>
test   %rax,%rax
jns    14a7 <main+0x327>
lea    0xcd1(%rip),%rdi
jmp    149b <main+0x31b>
lea    0xcdc(%rip),%rdi
call   1040 <puts@plt>
mov    0x0(%rbp),%rsi
lea    0xb87(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x0(%rbp),%rsi
lea    0xb9b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    14a2 <main+0x322>
lea    0xc88(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x8(%rbp),%rsi
lea    0xbfa(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc55(%rip),%rdi
call   1090 <perror@plt>
jmp    14a2 <main+0x322>

LLVM IR (-O0):
@.str = [28 x i8] c"Error: Invalid parameters.\0A\00"
@.str.1 = [38 x i8] c"Usage: %s <path-to-serio_raw-device>\0A\00"
@.str.2 = [143 x i8] c"For hints on how to enable serio_raw, see http://people.canonical.com/~sforshee/touchpad/mouse-to-serio.sh.\0AUsage example: %s /dev/serio_raw0\0A\00"
@O_RDWR = global i32 0
@.str.3 = [105 x i8] c"Could not open %s. Check that the program is run with the required privileges and that the file exists.\0A\00"
@.str.4 = [5 x i8] c"open\00"
@.str.5 = [14 x i8] c"reset failed.\00"
@.str.6 = [20 x i8] c"dump_packets failed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.2, i64 0, i64 0), i8* %21)
store i32 -1, i32* %3
br label %172
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = load i32, i32* @O_RDWR
%28 = call i32 @open(i8* %26, i32 %27)
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %37
31: ; preds = %23
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %172
37: ; preds = %23
%38 = load i32, i32* %8
%39 = call i64 @serio_reset(i32 %38)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %172
43: ; preds = %37
%44 = load i32, i32* %8
%45 = call i32 @send_command(i32 %44, i32 245)
%46 = load i32, i32* %8
%47 = call i32 @send_command(i32 %46, i32 230)
%48 = load i32, i32* %8
%49 = call i32 @send_command(i32 %48, i32 232)
%50 = load i32, i32* %8
%51 = call i32 @send_command(i32 %50, i32 0)
%52 = load i32, i32* %8
%53 = call i32 @send_command(i32 %52, i32 232)
%54 = load i32, i32* %8
%55 = call i32 @send_command(i32 %54, i32 0)
%56 = load i32, i32* %8
%57 = call i32 @send_command(i32 %56, i32 232)
%58 = load i32, i32* %8
%59 = call i32 @send_command(i32 %58, i32 0)
%60 = load i32, i32* %8
%61 = call i32 @send_command(i32 %60, i32 232)
%62 = load i32, i32* %8
%63 = call i32 @send_command(i32 %62, i32 0)
%64 = load i32, i32* %8
%65 = call i32 @send_status_request(i32 %64)
%66 = load i32, i32* %8
%67 = call i32 @send_command(i32 %66, i32 230)
%68 = load i32, i32* %8
%69 = call i32 @send_command(i32 %68, i32 232)
%70 = load i32, i32* %8
%71 = call i32 @send_command(i32 %70, i32 0)
%72 = load i32, i32* %8
%73 = call i32 @send_command(i32 %72, i32 232)
%74 = load i32, i32* %8
%75 = call i32 @send_command(i32 %74, i32 0)
%76 = load i32, i32* %8
%77 = call i32 @send_command(i32 %76, i32 232)
%78 = load i32, i32* %8
%79 = call i32 @send_command(i32 %78, i32 0)
%80 = load i32, i32* %8
%81 = call i32 @send_command(i32 %80, i32 232)
%82 = load i32, i32* %8
%83 = call i32 @send_command(i32 %82, i32 1)
%84 = load i32, i32* %8
%85 = call i32 @send_status_request(i32 %84)
%86 = load i32, i32* %8
%87 = call i32 @send_command(i32 %86, i32 230)
%88 = load i32, i32* %8
%89 = call i32 @send_command(i32 %88, i32 232)
%90 = load i32, i32* %8
%91 = call i32 @send_command(i32 %90, i32 0)
%92 = load i32, i32* %8
%93 = call i32 @send_command(i32 %92, i32 232)
%94 = load i32, i32* %8
%95 = call i32 @send_command(i32 %94, i32 0)
%96 = load i32, i32* %8
%97 = call i32 @send_command(i32 %96, i32 232)
%98 = load i32, i32* %8
%99 = call i32 @send_command(i32 %98, i32 0)
%100 = load i32, i32* %8
%101 = call i32 @send_command(i32 %100, i32 232)
%102 = load i32, i32* %8
%103 = call i32 @send_command(i32 %102, i32 2)
%104 = load i32, i32* %8
%105 = call i32 @send_status_request(i32 %104)
%106 = load i32, i32* %8
%107 = call i32 @send_command(i32 %106, i32 230)
%108 = load i32, i32* %8
%109 = call i32 @send_command(i32 %108, i32 232)
%110 = load i32, i32* %8
%111 = call i32 @send_command(i32 %110, i32 0)
%112 = load i32, i32* %8
%113 = call i32 @send_command(i32 %112, i32 232)
%114 = load i32, i32* %8
%115 = call i32 @send_command(i32 %114, i32 0)
%116 = load i32, i32* %8
%117 = call i32 @send_command(i32 %116, i32 232)
%118 = load i32, i32* %8
%119 = call i32 @send_command(i32 %118, i32 0)
%120 = load i32, i32* %8
%121 = call i32 @send_command(i32 %120, i32 232)
%122 = load i32, i32* %8
%123 = call i32 @send_command(i32 %122, i32 5)
%124 = load i32, i32* %8
%125 = call i32 @send_status_request(i32 %124)
%126 = load i32, i32* %8
%127 = call i32 @send_command(i32 %126, i32 230)
%128 = load i32, i32* %8
%129 = call i32 @send_command(i32 %128, i32 232)
%130 = load i32, i32* %8
%131 = call i32 @send_command(i32 %130, i32 0)
%132 = load i32, i32* %8
%133 = call i32 @send_command(i32 %132, i32 232)
%134 = load i32, i32* %8
%135 = call i32 @send_command(i32 %134, i32 0)
%136 = load i32, i32* %8
%137 = call i32 @send_command(i32 %136, i32 232)
%138 = load i32, i32* %8
%139 = call i32 @send_command(i32 %138, i32 0)
%140 = load i32, i32* %8
%141 = call i32 @send_command(i32 %140, i32 232)
%142 = load i32, i32* %8
%143 = call i32 @send_command(i32 %142, i32 6)
%144 = load i32, i32* %8
%145 = call i32 @send_status_request(i32 %144)
%146 = load i32, i32* %8
%147 = call i32 @send_command(i32 %146, i32 248)
%148 = load i32, i32* %8
%149 = call i32 @send_command(i32 %148, i32 0)
%150 = load i32, i32* %8
%151 = call i32 @send_command(i32 %150, i32 248)
%152 = load i32, i32* %8
%153 = call i32 @send_command(i32 %152, i32 0)
%154 = load i32, i32* %8
%155 = call i32 @send_command(i32 %154, i32 248)
%156 = load i32, i32* %8
%157 = call i32 @send_command(i32 %156, i32 0)
%158 = load i32, i32* %8
%159 = call i32 @send_command(i32 %158, i32 248)
%160 = load i32, i32* %8
%161 = call i32 @send_command(i32 %160, i32 1)
%162 = load i32, i32* %8
%163 = call i32 @send_command(i32 %162, i32 230)
%164 = load i32, i32* %8
%165 = call i32 @send_command(i32 %164, i32 244)
%166 = load i32, i32* %8
%167 = call i64 @dump_packets(i32 %166, i32 6)
%168 = icmp slt i64 %167, 0
br i1 %168, label %169, label %171
169: ; preds = %43
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %172
171: ; preds = %43
store i32 0, i32* %3
br label %172
172: ; preds = %171, %169, %41, %31, %13
%173 = load i32, i32* %3
ret i32 %173
}

LLVM IR (-O2):
@.str.1 = [38 x i8] c"Usage: %s <path-to-serio_raw-device>\0A\00"
@.str.2 = [143 x i8] c"For hints on how to enable serio_raw, see http://people.canonical.com/~sforshee/touchpad/mouse-to-serio.sh.\0AUsage example: %s /dev/serio_raw0\0A\00"
@O_RDWR = global i32 0
@.str.3 = [105 x i8] c"Could not open %s. Check that the program is run with the required privileges and that the file exists.\0A\00"
@.str.4 = [5 x i8] c"open\00"
@.str.5 = [14 x i8] c"reset failed.\00"
@.str.6 = [20 x i8] c"dump_packets failed\00"
@str = [27 x i8] c"Error: Invalid parameters.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([143 x i8], [143 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %91
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @O_RDWR
%14 = tail call i32 @open(i8* %12, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = load i8*, i8** %11
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %91
20: ; preds = %10
%21 = tail call i64 @serio_reset(i32 %14)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %91
25: ; preds = %20
%26 = tail call i32 @send_command(i32 %14, i32 245)
%27 = tail call i32 @send_command(i32 %14, i32 230)
%28 = tail call i32 @send_command(i32 %14, i32 232)
%29 = tail call i32 @send_command(i32 %14, i32 0)
%30 = tail call i32 @send_command(i32 %14, i32 232)
%31 = tail call i32 @send_command(i32 %14, i32 0)
%32 = tail call i32 @send_command(i32 %14, i32 232)
%33 = tail call i32 @send_command(i32 %14, i32 0)
%34 = tail call i32 @send_command(i32 %14, i32 232)
%35 = tail call i32 @send_command(i32 %14, i32 0)
%36 = tail call i32 @send_status_request(i32 %14)
%37 = tail call i32 @send_command(i32 %14, i32 230)
%38 = tail call i32 @send_command(i32 %14, i32 232)
%39 = tail call i32 @send_command(i32 %14, i32 0)
%40 = tail call i32 @send_command(i32 %14, i32 232)
%41 = tail call i32 @send_command(i32 %14, i32 0)
%42 = tail call i32 @send_command(i32 %14, i32 232)
%43 = tail call i32 @send_command(i32 %14, i32 0)
%44 = tail call i32 @send_command(i32 %14, i32 232)
%45 = tail call i32 @send_command(i32 %14, i32 1)
%46 = tail call i32 @send_status_request(i32 %14)
%47 = tail call i32 @send_command(i32 %14, i32 230)
%48 = tail call i32 @send_command(i32 %14, i32 232)
%49 = tail call i32 @send_command(i32 %14, i32 0)
%50 = tail call i32 @send_command(i32 %14, i32 232)
%51 = tail call i32 @send_command(i32 %14, i32 0)
%52 = tail call i32 @send_command(i32 %14, i32 232)
%53 = tail call i32 @send_command(i32 %14, i32 0)
%54 = tail call i32 @send_command(i32 %14, i32 232)
%55 = tail call i32 @send_command(i32 %14, i32 2)
%56 = tail call i32 @send_status_request(i32 %14)
%57 = tail call i32 @send_command(i32 %14, i32 230)
%58 = tail call i32 @send_command(i32 %14, i32 232)
%59 = tail call i32 @send_command(i32 %14, i32 0)
%60 = tail call i32 @send_command(i32 %14, i32 232)
%61 = tail call i32 @send_command(i32 %14, i32 0)
%62 = tail call i32 @send_command(i32 %14, i32 232)
%63 = tail call i32 @send_command(i32 %14, i32 0)
%64 = tail call i32 @send_command(i32 %14, i32 232)
%65 = tail call i32 @send_command(i32 %14, i32 5)
%66 = tail call i32 @send_status_request(i32 %14)
%67 = tail call i32 @send_command(i32 %14, i32 230)
%68 = tail call i32 @send_command(i32 %14, i32 232)
%69 = tail call i32 @send_command(i32 %14, i32 0)
%70 = tail call i32 @send_command(i32 %14, i32 232)
%71 = tail call i32 @send_command(i32 %14, i32 0)
%72 = tail call i32 @send_command(i32 %14, i32 232)
%73 = tail call i32 @send_command(i32 %14, i32 0)
%74 = tail call i32 @send_command(i32 %14, i32 232)
%75 = tail call i32 @send_command(i32 %14, i32 6)
%76 = tail call i32 @send_status_request(i32 %14)
%77 = tail call i32 @send_command(i32 %14, i32 248)
%78 = tail call i32 @send_command(i32 %14, i32 0)
%79 = tail call i32 @send_command(i32 %14, i32 248)
%80 = tail call i32 @send_command(i32 %14, i32 0)
%81 = tail call i32 @send_command(i32 %14, i32 248)
%82 = tail call i32 @send_command(i32 %14, i32 0)
%83 = tail call i32 @send_command(i32 %14, i32 248)
%84 = tail call i32 @send_command(i32 %14, i32 1)
%85 = tail call i32 @send_command(i32 %14, i32 230)
%86 = tail call i32 @send_command(i32 %14, i32 244)
%87 = tail call i64 @dump_packets(i32 %14, i32 6)
%88 = icmp slt i64 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %25
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %91
91: ; preds = %16, %23, %89, %25, %4
%92 = phi i32 [ -1, %4 ], [ -1, %16 ], [ -1, %23 ], [ -1, %89 ], [ 0, %25 ]
ret i32 %92
}