#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 */
typedef struct TYPE_10__ TYPE_5__;
typedef struct TYPE_9__ TYPE_4__;
typedef struct TYPE_8__ TYPE_3__;
typedef struct TYPE_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
struct TYPE_10__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct input_event {
  int type;
  int code;
  int value;
  TYPE_5__ time;
};
struct TYPE_9__ {
  int length;
  int delay;
};
struct TYPE_7__ {
  int strong_magnitude;
  scalar_t__ weak_magnitude;
};
struct TYPE_8__ {
  TYPE_2__ rumble;
};
struct TYPE_6__ {
  scalar_t__ interval;
  scalar_t__ button;
};
struct ff_effect {
  int id;
  TYPE_4__ replay;
  TYPE_3__ u;
  TYPE_1__ trigger;
  scalar_t__ direction;
  int /*<<< orphan*/ type;
};

/* Variables and functions */
int /*<<< orphan*/ EVIOCSFF;
int /*<<< orphan*/ FF_RUMBLE;
int /*<<< orphan*/ O_RDWR;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ff_effect *);
struct input_event *malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, struct input_event *, int);
int main(int argc, char **argv) {
  int i, id, j;
  int starttime;
  int fd;
  struct input_event *ev;
  if (argc < 3) {
    printf("Usage: %s vibrafile ontime offtime ..", argv[0]);
  }
  fd = open(argv[1], O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "cannot open %s\n", argv[1]);
    return 1;
  }
  argc -= 2;
  argv++;
  argv++;
  ev = malloc(sizeof(struct input_event) * argc);
  j = 0;
  starttime = 0;
  for (i = 0; i < argc; i++) {
    int t = atoi(argv[i]);
    if ((i & 1) == 0) {
      struct ff_effect ff;
      ff.type = FF_RUMBLE;
      ff.id = -1;
      ff.direction = 0;
      ff.trigger.button = 0;
      ff.trigger.interval = 0;
      ff.u.rumble.strong_magnitude = 0xffff;
      ff.u.rumble.weak_magnitude = 0;
      ff.replay.length = t;
      ff.replay.delay = starttime;
      if (0 <= ioctl(fd, EVIOCSFF, &ff)) {
        ev[j].time.tv_sec = 0;
        ev[j].time.tv_usec = 0;
        ev[j].type = 0x15;
        ev[j].code = ff.id;
        ev[j].value = 1;
        j++;
      }
    }
    starttime += t;
  }
  write(fd, ev, j * sizeof(struct input_event));
  usleep(starttime * 1000);
  close(fd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11c6 <main+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1212 <main+0x82>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe25(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13b0 <main+0x220>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x5,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1386 <main+0x1f6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    136f <main+0x1df>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
movl   $0xffffffff,-0x78(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movl   $0xffff,-0x68(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2cee(%rip),%rax
mov    (%rax),%esi
lea    -0x78(%rbp),%rdx
call   1050 <ioctl@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jg     136a <main+0x1da>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movq   $0x0,0x18(%rax)
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movq   $0x0,0x10(%rax)
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movl   $0x15,(%rax)
mov    -0x78(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rdx
shl    $0x5,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movl   $0x1,0x8(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    136f <main+0x1df>
mov    -0x34(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125b <main+0xcb>
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x5,%rax
mov    %eax,%edx
call   1030 <write@plt>
imul   $0x3e8,-0x20(%rbp),%edi
call   10b0 <usleep@plt>
mov    -0x24(%rbp),%edi
call   1060 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r12
mov    %edi,%r14d
cmp    $0x2,%edi
jg     11b9 <main+0x29>
mov    (%r12),%rsi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    0x8(%r12),%rdi
mov    0x2e23(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
js     12dd <main+0x14d>
lea    -0x2(%r14),%r15d
mov    %r15d,%edi
shl    $0x5,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    $0x0,%ebx
mov    $0x0,%r13d
cmp    $0x3,%r14d
jl     1305 <main+0x175>
mov    %r12,0x10(%rsp)
mov    %r15d,%r13d
xor    %r15d,%r15d
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    1230 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %r14d,%r12d
add    $0x1,%r15
cmp    %r15,%r13
je     12fe <main+0x16e>
mov    0x10(%rsp),%rax
mov    0x10(%rax,%r15,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
test   $0x1,%r15b
jne    1220 <main+0x90>
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x50(%rsp)
movl   $0xffffffff,0x18(%rsp)
ff
lea    0x38(%rsp),%rax
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
movq   $0x0,0x10(%rax)
movl   $0xffff,0x28(%rsp)
movq   $0x0,0x30(%rsp)
mov    %r14d,0x1c(%rsp)
mov    %r12d,0x20(%rsp)
mov    0x2d36(%rip),%rax
mov    (%rax),%esi
mov    0xc(%rsp),%edi
lea    0x18(%rsp),%rdx
call   1050 <ioctl@plt>
test   %rax,%rax
js     1220 <main+0x90>
movslq %ebx,%rbx
mov    %rbx,%rax
shl    $0x5,%rax
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rbp,%rax,1)
movl   $0x15,0x0(%rbp,%rax,1)
mov    0x18(%rsp),%ecx
mov    %ecx,0x4(%rbp,%rax,1)
movl   $0x1,0x8(%rbp,%rax,1)
add    $0x1,%ebx
jmp    1220 <main+0x90>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r12),%rdx
lea    0xd44(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    132c <main+0x19c>
imul   $0x3e8,%r12d,%r13d
shl    $0x5,%ebx
mov    0xc(%rsp),%r14d
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1030 <write@plt>
mov    %r13d,%edi
call   10b0 <usleep@plt>
mov    %r14d,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.input_event = type { i32, i32, i32, %struct.TYPE_10__ }
%struct.TYPE_10__ = type { i64, i64 }
%struct.ff_effect = type { i32, %struct.TYPE_9__, %struct.TYPE_8__, %struct.TYPE_6__, i64, i32 }
%struct.TYPE_9__ = type { i32, i32 }
%struct.TYPE_8__ = type { %struct.TYPE_7__ }
%struct.TYPE_7__ = type { i32, i64 }
%struct.TYPE_6__ = type { i64, i64 }
@.str = [38 x i8] c"Usage: %s vibrafile ontime offtime ..\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [16 x i8] c"cannot open %s\0A\00"
@FF_RUMBLE = global i32 0
@EVIOCSFF = global i32 0
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
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.input_event*
%12 = alloca i32
%13 = alloca %struct.ff_effect
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i32, i32* @O_RDWR
%26 = call i32 @open(i8* %24, i32 %25)
store i32 %26, i32* %10
%27 = load i32, i32* %10
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %21
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %33)
store i32 1, i32* %3
br label %139
35: ; preds = %21
%36 = load i32, i32* %4
%37 = sub nsw i32 %36, 2
store i32 %37, i32* %4
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %5
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i32 1
store i8** %41, i8*** %5
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = mul i64 32, %43
%45 = trunc i64 %44 to i32
%46 = call %struct.input_event* @malloc(i32 %45)
store %struct.input_event* %46, %struct.input_event** %11
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %6
br label %47
47: ; preds = %123, %35
%48 = load i32, i32* %6
%49 = load i32, i32* %4
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %126
51: ; preds = %47
%52 = load i8**, i8*** %5
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %12
%58 = load i32, i32* %6
%59 = and i32 %58, 1
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %119
61: ; preds = %51
%62 = load i32, i32* @FF_RUMBLE
%63 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 5
store i32 %62, i32* %63
%64 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 0
store i32 -1, i32* %64
%65 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 4
store i64 0, i64* %65
%66 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 3
%67 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %66, i32 0, i32 1
store i64 0, i64* %67
%68 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 3
%69 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %68, i32 0, i32 0
store i64 0, i64* %69
%70 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 2
%71 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %70, i32 0, i32 0
%72 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %71, i32 0, i32 0
store i32 65535, i32* %72
%73 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 2
%74 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %73, i32 0, i32 0
%75 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %74, i32 0, i32 1
store i64 0, i64* %75
%76 = load i32, i32* %12
%77 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 1
%78 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %77, i32 0, i32 0
store i32 %76, i32* %78
%79 = load i32, i32* %9
%80 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 1
%81 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %80, i32 0, i32 1
store i32 %79, i32* %81
%82 = load i32, i32* %10
%83 = load i32, i32* @EVIOCSFF
%84 = call i64 @ioctl(i32 %82, i32 %83, %struct.ff_effect* %13)
%85 = icmp sle i64 0, %84
br i1 %85, label %86, label %118
86: ; preds = %61
%87 = load %struct.input_event*, %struct.input_event** %11
%88 = load i32, i32* %8
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds %struct.input_event, %struct.input_event* %87, i64 %89
%91 = getelementptr inbounds %struct.input_event, %struct.input_event* %90, i32 0, i32 3
%92 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %91, i32 0, i32 1
store i64 0, i64* %92
%93 = load %struct.input_event*, %struct.input_event** %11
%94 = load i32, i32* %8
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds %struct.input_event, %struct.input_event* %93, i64 %95
%97 = getelementptr inbounds %struct.input_event, %struct.input_event* %96, i32 0, i32 3
%98 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %97, i32 0, i32 0
store i64 0, i64* %98
%99 = load %struct.input_event*, %struct.input_event** %11
%100 = load i32, i32* %8
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds %struct.input_event, %struct.input_event* %99, i64 %101
%103 = getelementptr inbounds %struct.input_event, %struct.input_event* %102, i32 0, i32 0
store i32 21, i32* %103
%104 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %13, i32 0, i32 0
%105 = load i32, i32* %104
%106 = load %struct.input_event*, %struct.input_event** %11
%107 = load i32, i32* %8
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds %struct.input_event, %struct.input_event* %106, i64 %108
%110 = getelementptr inbounds %struct.input_event, %struct.input_event* %109, i32 0, i32 1
store i32 %105, i32* %110
%111 = load %struct.input_event*, %struct.input_event** %11
%112 = load i32, i32* %8
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds %struct.input_event, %struct.input_event* %111, i64 %113
%115 = getelementptr inbounds %struct.input_event, %struct.input_event* %114, i32 0, i32 2
store i32 1, i32* %115
%116 = load i32, i32* %8
%117 = add nsw i32 %116, 1
store i32 %117, i32* %8
br label %118
118: ; preds = %86, %61
br label %119
119: ; preds = %118, %51
%120 = load i32, i32* %12
%121 = load i32, i32* %9
%122 = add nsw i32 %121, %120
store i32 %122, i32* %9
br label %123
123: ; preds = %119
%124 = load i32, i32* %6
%125 = add nsw i32 %124, 1
store i32 %125, i32* %6
br label %47
126: ; preds = %47
%127 = load i32, i32* %10
%128 = load %struct.input_event*, %struct.input_event** %11
%129 = load i32, i32* %8
%130 = sext i32 %129 to i64
%131 = mul i64 %130, 32
%132 = trunc i64 %131 to i32
%133 = call i32 @write(i32 %127, %struct.input_event* %128, i32 %132)
%134 = load i32, i32* %9
%135 = mul nsw i32 %134, 1000
%136 = call i32 @usleep(i32 %135)
%137 = load i32, i32* %10
%138 = call i32 @close(i32 %137)
br label %139
139: ; preds = %126, %29
%140 = load i32, i32* %3
ret i32 %140
}

LLVM IR (-O2):
%struct.ff_effect = type { i32, %struct.TYPE_9__, %struct.TYPE_8__, %struct.TYPE_6__, i64, i32 }
%struct.TYPE_9__ = type { i32, i32 }
%struct.TYPE_8__ = type { %struct.TYPE_7__ }
%struct.TYPE_7__ = type { i32, i64 }
%struct.TYPE_6__ = type { i64, i64 }
%struct.input_event = type { i32, i32, i32, %struct.TYPE_10__ }
%struct.TYPE_10__ = type { i64, i64 }
@.str = [38 x i8] c"Usage: %s vibrafile ontime offtime ..\00"
@O_RDWR = global i32 0
@stderr = global i32 0
@.str.1 = [16 x i8] c"cannot open %s\0A\00"
@FF_RUMBLE = global i32 0
@EVIOCSFF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.ff_effect
%4 = icmp slt i32 %0, 3
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = load i32, i32* @O_RDWR
%12 = tail call i32 @open(i8* %10, i32 %11)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %9
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %74
18: ; preds = %8
%19 = add nsw i32 %0, -2
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = shl i32 %19, 5
%22 = tail call %struct.input_event* @malloc(i32 %21)
%23 = icmp sgt i32 %0, 2
br i1 %23, label %24, label %67
24: ; preds = %18
%25 = bitcast %struct.ff_effect* %3 to i8*
%26 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 5
%27 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 0
%28 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 3, i32 0
%29 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 2, i32 0, i32 0
%30 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 2, i32 0, i32 1
%31 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 1, i32 0
%32 = getelementptr inbounds %struct.ff_effect, %struct.ff_effect* %3, i64 0, i32 1, i32 1
%33 = zext i32 %19 to i64
%34 = bitcast i64* %28 to i8*
br label %35
35: ; preds = %24, %60
%36 = phi i64 [ 0, %24 ], [ %63, %60 ]
%37 = phi i32 [ 0, %24 ], [ %62, %60 ]
%38 = phi i32 [ 0, %24 ], [ %61, %60 ]
%39 = getelementptr inbounds i8*, i8** %20, i64 %36
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
%42 = and i64 %36, 1
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %60
44: ; preds = %35
%45 = load i32, i32* @FF_RUMBLE
store i32 %45, i32* %26
store i32 -1, i32* %27
store i32 65535, i32* %29
store i64 0, i64* %30
store i32 %41, i32* %31
store i32 %37, i32* %32
%46 = load i32, i32* @EVIOCSFF
%47 = call i64 @ioctl(i32 %12, i32 %46, %struct.ff_effect* %3)
%48 = icmp sgt i64 %47, -1
br i1 %48, label %49, label %58
49: ; preds = %44
%50 = sext i32 %38 to i64
%51 = getelementptr inbounds %struct.input_event, %struct.input_event* %22, i64 %50, i32 3, i32 0
%52 = getelementptr inbounds %struct.input_event, %struct.input_event* %22, i64 %50, i32 0
%53 = bitcast i64* %51 to i8*
store i32 21, i32* %52
%54 = load i32, i32* %27
%55 = getelementptr inbounds %struct.input_event, %struct.input_event* %22, i64 %50, i32 1
store i32 %54, i32* %55
%56 = getelementptr inbounds %struct.input_event, %struct.input_event* %22, i64 %50, i32 2
store i32 1, i32* %56
%57 = add nsw i32 %38, 1
br label %58
58: ; preds = %49, %44
%59 = phi i32 [ %57, %49 ], [ %38, %44 ]
br label %60
60: ; preds = %58, %35
%61 = phi i32 [ %59, %58 ], [ %38, %35 ]
%62 = add nsw i32 %41, %37
%63 = add nuw nsw i64 %36, 1
%64 = icmp eq i64 %63, %33
br i1 %64, label %65, label %35
65: ; preds = %60
%66 = mul i32 %62, 1000
br label %67
67: ; preds = %65, %18
%68 = phi i32 [ 0, %18 ], [ %61, %65 ]
%69 = phi i32 [ 0, %18 ], [ %66, %65 ]
%70 = shl i32 %68, 5
%71 = call i32 @write(i32 %12, %struct.input_event* %22, i32 %70)
%72 = call i32 @usleep(i32 %69)
%73 = call i32 @close(i32 %12)
br label %74
74: ; preds = %67, %14
%75 = phi i32 [ 1, %14 ], [ 0, %67 ]
ret i32 %75
}