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

/* Variables and functions */
int /*<<< orphan*/ EV_REP;
int /*<<< orphan*/ REP_DELAY;
int /*<<< orphan*/ REP_PERIOD;
int /*<<< orphan*/ memset(struct input_event *, int /*<<< orphan*/, int);
int /*<<< orphan*/ write(int, struct input_event *, int);
void uinput_set_delay_period(int fd, __s32 delay, __s32 period) {
  struct input_event ev;
  memset(&ev, 0, sizeof(ev));
  ev.type = EV_REP;
  ev.code = REP_DELAY;
  ev.value = delay;
  write(fd, &ev, sizeof(ev));
  ev.code = REP_PERIOD;
  ev.value = period;
  write(fd, &ev, sizeof(ev));
}


x86 assembly (clang, -O0):
<uinput_set_delay_period>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uinput_set_delay_period>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    %rbx,0x8(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    %r14,0x8(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <write@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.input_event = type { i8*, i32, i32 }
@EV_REP = global i32 0
@REP_DELAY = global i32 0
@REP_PERIOD = global i32 0
define void @uinput_set_delay_period(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.input_event
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = call i32 @memset(%struct.input_event* %7, i32 0, i32 16)
%9 = load i32, i32* @EV_REP
%10 = getelementptr inbounds %struct.input_event, %struct.input_event* %7, i32 0, i32 2
store i32 %9, i32* %10
%11 = load i32, i32* @REP_DELAY
%12 = getelementptr inbounds %struct.input_event, %struct.input_event* %7, i32 0, i32 1
store i32 %11, i32* %12
%13 = load i8*, i8** %5
%14 = getelementptr inbounds %struct.input_event, %struct.input_event* %7, i32 0, i32 0
store i8* %13, i8** %14
%15 = load i32, i32* %4
%16 = call i32 @write(i32 %15, %struct.input_event* %7, i32 16)
%17 = load i32, i32* @REP_PERIOD
%18 = getelementptr inbounds %struct.input_event, %struct.input_event* %7, i32 0, i32 1
store i32 %17, i32* %18
%19 = load i8*, i8** %6
%20 = getelementptr inbounds %struct.input_event, %struct.input_event* %7, i32 0, i32 0
store i8* %19, i8** %20
%21 = load i32, i32* %4
%22 = call i32 @write(i32 %21, %struct.input_event* %7, i32 16)
ret void
}

LLVM IR (-O2):
%struct.input_event = type { i8*, i32, i32 }
@EV_REP = global i32 0
@REP_DELAY = global i32 0
@REP_PERIOD = global i32 0
define void @uinput_set_delay_period(i32 %0, i8* %1, i8* %2) {
%4 = alloca %struct.input_event
%5 = bitcast %struct.input_event* %4 to i8*
%6 = call i32 @memset(%struct.input_event* %4, i32 0, i32 16)
%7 = load i32, i32* @EV_REP
%8 = getelementptr inbounds %struct.input_event, %struct.input_event* %4, i64 0, i32 2
store i32 %7, i32* %8
%9 = load i32, i32* @REP_DELAY
%10 = getelementptr inbounds %struct.input_event, %struct.input_event* %4, i64 0, i32 1
store i32 %9, i32* %10
%11 = getelementptr inbounds %struct.input_event, %struct.input_event* %4, i64 0, i32 0
store i8* %1, i8** %11
%12 = call i32 @write(i32 %0, %struct.input_event* %4, i32 16)
%13 = load i32, i32* @REP_PERIOD
store i32 %13, i32* %10
store i8* %2, i8** %11
%14 = call i32 @write(i32 %0, %struct.input_event* %4, i32 16)
ret void
}