#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 value;
  int /*<<< orphan*/ code;
  int /*<<< orphan*/ type;
};

/* Variables and functions */
int /*<<< orphan*/ EV_REL;
int /*<<< orphan*/ EV_SYN;
int /*<<< orphan*/ REL_Y;
int /*<<< orphan*/ SYN_REPORT;
int /*<<< orphan*/ memset(struct input_event *, int /*<<< orphan*/, int);
scalar_t__ write(int, struct input_event *, int);
void send_mouse_Y_event(int uinput_fd, int pixels) {
  struct input_event ev;
  memset(&ev, 0, sizeof(struct input_event));
  ev.type = EV_REL;
  ev.code = REL_Y;
  ev.value = pixels;
  if (write(uinput_fd, &ev, sizeof(struct input_event)) < 0)
    return;
  memset(&ev, 0, sizeof(struct input_event));
  ev.type = EV_SYN;
  ev.code = SYN_REPORT;
  if (write(uinput_fd, &ev, sizeof(struct input_event)) < 0)
    return;
}


x86 assembly (clang, -O0):
<send_mouse_Y_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jge    117c <send_mouse_Y_event+0x5c>
jmp    11c4 <send_mouse_Y_event+0xa4>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jge    11c4 <send_mouse_Y_event+0xa4>
jmp    11c4 <send_mouse_Y_event+0xa4>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_mouse_Y_event>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %ebp,(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1030 <write@plt>
test   %rax,%rax
js     11aa <send_mouse_Y_event+0x8a>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.input_event = type { i32, i32, i32 }
@EV_REL = global i32 0
@REL_Y = global i32 0
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define void @send_mouse_Y_event(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.input_event
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @memset(%struct.input_event* %5, i32 0, i32 12)
%7 = load i32, i32* @EV_REL
%8 = getelementptr inbounds %struct.input_event, %struct.input_event* %5, i32 0, i32 2
store i32 %7, i32* %8
%9 = load i32, i32* @REL_Y
%10 = getelementptr inbounds %struct.input_event, %struct.input_event* %5, i32 0, i32 1
store i32 %9, i32* %10
%11 = load i32, i32* %4
%12 = getelementptr inbounds %struct.input_event, %struct.input_event* %5, i32 0, i32 0
store i32 %11, i32* %12
%13 = load i32, i32* %3
%14 = call i64 @write(i32 %13, %struct.input_event* %5, i32 12)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
br label %27
17: ; preds = %2
%18 = call i32 @memset(%struct.input_event* %5, i32 0, i32 12)
%19 = load i32, i32* @EV_SYN
%20 = getelementptr inbounds %struct.input_event, %struct.input_event* %5, i32 0, i32 2
store i32 %19, i32* %20
%21 = load i32, i32* @SYN_REPORT
%22 = getelementptr inbounds %struct.input_event, %struct.input_event* %5, i32 0, i32 1
store i32 %21, i32* %22
%23 = load i32, i32* %3
%24 = call i64 @write(i32 %23, %struct.input_event* %5, i32 12)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %17
br label %27
27: ; preds = %16, %26, %17
ret void
}

LLVM IR (-O2):
%struct.input_event = type { i32, i32, i32 }
@EV_REL = global i32 0
@REL_Y = global i32 0
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define void @send_mouse_Y_event(i32 %0, i32 %1) {
%3 = alloca %struct.input_event
%4 = bitcast %struct.input_event* %3 to i8*
%5 = call i32 @memset(%struct.input_event* %3, i32 0, i32 12)
%6 = load i32, i32* @EV_REL
%7 = getelementptr inbounds %struct.input_event, %struct.input_event* %3, i64 0, i32 2
store i32 %6, i32* %7
%8 = load i32, i32* @REL_Y
%9 = getelementptr inbounds %struct.input_event, %struct.input_event* %3, i64 0, i32 1
store i32 %8, i32* %9
%10 = getelementptr inbounds %struct.input_event, %struct.input_event* %3, i64 0, i32 0
store i32 %1, i32* %10
%11 = call i64 @write(i32 %0, %struct.input_event* %3, i32 12)
%12 = icmp slt i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %2
%14 = call i32 @memset(%struct.input_event* %3, i32 0, i32 12)
%15 = load i32, i32* @EV_SYN
store i32 %15, i32* %7
%16 = load i32, i32* @SYN_REPORT
store i32 %16, i32* %9
%17 = call i64 @write(i32 %0, %struct.input_event* %3, i32 12)
br label %18
18: ; preds = %13, %2
ret void
}