#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 */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ EV_KEY;
int /*<<< orphan*/ EV_MSC;
int /*<<< orphan*/ EV_SYN;
int /*<<< orphan*/ MSC_SCAN;
int /*<<< orphan*/ SYN_REPORT;
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write_event(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/, int /*<<< orphan*/);
void release_key(int32_t fd, uint16_t key) {
  write_event(fd, EV_MSC, MSC_SCAN, key);
  usleep(1);
  write_event(fd, EV_KEY, key, 0);
  usleep(1);
  write_event(fd, EV_SYN, SYN_REPORT, 0);
  usleep(100);
}


x86 assembly (clang, -O0):
<release_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%ecx
call   1030 <write_event@plt>
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
call   1030 <write_event@plt>
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    0x2e71(%rip),%rax
mov    (%rax),%esi
mov    0x2e48(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1030 <write_event@plt>
mov    $0x64,%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<release_key>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
mov    0x2e89(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%ecx
call   1030 <write_event@plt>
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <write_event@plt>
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    0x2e58(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %ecx,%ecx
call   1030 <write_event@plt>
mov    $0x64,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <usleep@plt>

LLVM IR (-O0):
@EV_MSC = global i32 0
@MSC_SCAN = global i32 0
@EV_KEY = global i32 0
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define void @release_key(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @EV_MSC
%7 = load i32, i32* @MSC_SCAN
%8 = load i32, i32* %4
%9 = call i32 @write_event(i32 %5, i32 %6, i32 %7, i32 %8)
%10 = call i32 @usleep(i32 1)
%11 = load i32, i32* %3
%12 = load i32, i32* @EV_KEY
%13 = load i32, i32* %4
%14 = call i32 @write_event(i32 %11, i32 %12, i32 %13, i32 0)
%15 = call i32 @usleep(i32 1)
%16 = load i32, i32* %3
%17 = load i32, i32* @EV_SYN
%18 = load i32, i32* @SYN_REPORT
%19 = call i32 @write_event(i32 %16, i32 %17, i32 %18, i32 0)
%20 = call i32 @usleep(i32 100)
ret void
}

LLVM IR (-O2):
@EV_MSC = global i32 0
@MSC_SCAN = global i32 0
@EV_KEY = global i32 0
@EV_SYN = global i32 0
@SYN_REPORT = global i32 0
define void @release_key(i32 %0, i32 %1) {
%3 = load i32, i32* @EV_MSC
%4 = load i32, i32* @MSC_SCAN
%5 = tail call i32 @write_event(i32 %0, i32 %3, i32 %4, i32 %1)
%6 = tail call i32 @usleep(i32 1)
%7 = load i32, i32* @EV_KEY
%8 = tail call i32 @write_event(i32 %0, i32 %7, i32 %1, i32 0)
%9 = tail call i32 @usleep(i32 1)
%10 = load i32, i32* @EV_SYN
%11 = load i32, i32* @SYN_REPORT
%12 = tail call i32 @write_event(i32 %0, i32 %10, i32 %11, i32 0)
%13 = tail call i32 @usleep(i32 100)
ret void
}