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

/* Variables and functions */
int /*<<< orphan*/ EV_SYN;
int /*<<< orphan*/ SYN_REPORT;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(struct input_event *, int /*<<< orphan*/, int);
int write(int, struct input_event *, int);
void uinput_syn(int fd) {
  struct input_event ev;
  int rc;
  memset(&ev, 0, sizeof(ev));
  ev.type = EV_SYN;
  ev.code = SYN_REPORT;
  ev.value = 0;
  rc = write(fd, &ev, sizeof(ev));
  assert(rc == sizeof(ev));
}


x86 assembly (clang, -O0):
<uinput_syn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x10,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uinput_syn>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x10,%edx
call   1030 <write@plt>
xor    %edi,%edi
cmp    $0x10,%eax
sete   %dil
call   1050 <assert@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.input_event = type { i64, i32, i32 }
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define void @uinput_syn(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.input_event
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @memset(%struct.input_event* %3, i32 0, i32 16)
%6 = load i32, i32* @EV_SYN
%7 = getelementptr inbounds %struct.input_event, %struct.input_event* %3, i32 0, i32 2
store i32 %6, i32* %7
%8 = load i32, i32* @SYN_REPORT
%9 = getelementptr inbounds %struct.input_event, %struct.input_event* %3, i32 0, i32 1
store i32 %8, i32* %9
%10 = getelementptr inbounds %struct.input_event, %struct.input_event* %3, i32 0, i32 0
store i64 0, i64* %10
%11 = load i32, i32* %2
%12 = call i32 @write(i32 %11, %struct.input_event* %3, i32 16)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = icmp eq i64 %14, 16
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
ret void
}

LLVM IR (-O2):
%struct.input_event = type { i64, i32, i32 }
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define void @uinput_syn(i32 %0) {
%2 = alloca %struct.input_event
%3 = bitcast %struct.input_event* %2 to i8*
%4 = call i32 @memset(%struct.input_event* %2, i32 0, i32 16)
%5 = load i32, i32* @EV_SYN
%6 = getelementptr inbounds %struct.input_event, %struct.input_event* %2, i64 0, i32 2
store i32 %5, i32* %6
%7 = load i32, i32* @SYN_REPORT
%8 = getelementptr inbounds %struct.input_event, %struct.input_event* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.input_event, %struct.input_event* %2, i64 0, i32 0
store i64 0, i64* %9
%10 = call i32 @write(i32 %0, %struct.input_event* %2, i32 16)
%11 = icmp eq i32 %10, 16
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret void
}