#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_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int time;
};
struct TYPE_5__ {
  scalar_t__ type;
  TYPE_1__ xkey;
};
typedef TYPE_2__ XEvent;
typedef int Time;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ False;
scalar_t__ KeyPress;
scalar_t__ SelectionNotify;
int /*<<< orphan*/ True;
Bool sel_pred(Display *dpy, XEvent *ev, char *arg) {
  if (ev->type == SelectionNotify)
    return (True);
  if (arg != NULL && ev->type == KeyPress &&
      (ev->xkey.time - *(Time *)arg) > 2000)
    return (True);
  return (False);
}


x86 assembly (clang, -O0):
<sel_pred>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2eda(%rip),%rcx
cmp    (%rcx),%rax
jne    1138 <sel_pred+0x38>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    118f <sel_pred+0x8f>
cmpq   $0x0,-0x20(%rbp)
je     1183 <sel_pred+0x83>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
jne    1183 <sel_pred+0x83>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
cmp    $0x7d0,%eax
jle    1183 <sel_pred+0x83>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    118f <sel_pred+0x8f>
mov    0x2e56(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sel_pred>:
mov    (%rsi),%rcx
mov    0x2eee(%rip),%rdi
mov    0x2ec7(%rip),%rax
cmp    (%rdi),%rcx
je     113b <sel_pred+0x3b>
test   %rdx,%rdx
je     1134 <sel_pred+0x34>
mov    0x2eae(%rip),%rdi
cmp    (%rdi),%rcx
jne    1134 <sel_pred+0x34>
mov    0x8(%rsi),%ecx
sub    (%rdx),%ecx
cmp    $0x7d0,%ecx
jg     113b <sel_pred+0x3b>
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32 }
@SelectionNotify = global i64 0
@True = global i32 0
@KeyPress = global i64 0
@False = global i32 0
define i32 @sel_pred(i32* %0, %struct.TYPE_5__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.TYPE_5__*
%7 = alloca i8*
store i32* %0, i32** %5
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %6
store i8* %2, i8** %7
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = load i64, i64* @SelectionNotify
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i32, i32* @True
store i32 %14, i32* %4
br label %38
15: ; preds = %3
%16 = load i8*, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %36
18: ; preds = %15
%19 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%20 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %19, i32 0, i32 0
%21 = load i64, i64* %20
%22 = load i64, i64* @KeyPress
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %36
24: ; preds = %18
%25 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %25, i32 0, i32 1
%27 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = load i8*, i8** %7
%30 = bitcast i8* %29 to i32*
%31 = load i32, i32* %30
%32 = sub nsw i32 %28, %31
%33 = icmp sgt i32 %32, 2000
br i1 %33, label %34, label %36
34: ; preds = %24
%35 = load i32, i32* @True
store i32 %35, i32* %4
br label %38
36: ; preds = %24, %18, %15
%37 = load i32, i32* @False
store i32 %37, i32* %4
br label %38
38: ; preds = %36, %34, %13
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32 }
@SelectionNotify = global i64 0
@True = global i32 0
@KeyPress = global i64 0
@False = global i32 0
define i32 @sel_pred(i32* nocapture readnone %0, %struct.TYPE_5__* nocapture %1, i8* %2) {
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @SelectionNotify
%7 = icmp eq i64 %5, %6
br i1 %7, label %21, label %8
8: ; preds = %3
%9 = icmp ne i8* %2, null
%10 = load i64, i64* @KeyPress
%11 = icmp eq i64 %5, %10
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 0
%15 = load i32, i32* %14
%16 = bitcast i8* %2 to i32*
%17 = load i32, i32* %16
%18 = sub nsw i32 %15, %17
%19 = icmp sgt i32 %18, 2000
br i1 %19, label %21, label %20
20: ; preds = %13, %8
br label %21
21: ; preds = %13, %3, %20
%22 = phi i32* [ @False, %20 ], [ @True, %3 ], [ @True, %13 ]
%23 = load i32, i32* %22
ret i32 %23
}