#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int type;
  int /*<<< orphan*/ xunmap;
  int /*<<< orphan*/ xbutton;
  int /*<<< orphan*/ xcrossing;
  int /*<<< orphan*/ xexpose;
};
typedef TYPE_1__ XEvent;

/* Variables and functions */
#define ButtonPress 133
#define ButtonRelease 132
#define EnterNotify 131
#define Expose 130
#define LeaveNotify 129
#define UnmapNotify 128
int /*<<< orphan*/ buttonpress(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ buttonrelease(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ enternotify(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ expose(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ leavenotify(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ unmapnotify(void *, int /*<<< orphan*/ *);
void event(void *self, XEvent *e) {
  switch (e->type) {
  case Expose:
    expose(self, &e->xexpose);
    break;
  case EnterNotify:
    enternotify(self, &e->xcrossing);
    break;
  case LeaveNotify:
    leavenotify(self, &e->xcrossing);
    break;
  case ButtonPress:
    buttonpress(self, &e->xbutton);
    break;
  case ButtonRelease:
    buttonrelease(self, &e->xbutton);
    break;
  case UnmapNotify:
    unmapnotify(self, &e->xunmap);
    break;
  }
}


x86 assembly (clang, -O0):
<event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     121b <event+0xbb>
mov    -0x18(%rbp),%rax
lea    0xe6d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1070 <expose@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rsi
call   1040 <enternotify@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rsi
call   1080 <leavenotify@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <buttonpress@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1060 <buttonrelease@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
call   1050 <unmapnotify@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event>:
mov    (%rsi),%eax
add    $0xffffff80,%eax
cmp    $0x5,%eax
ja     1183 <event+0x23>
lea    0xe8f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
add    $0x4,%rsi
jmp    1050 <unmapnotify@plt>
ret
add    $0xc,%rsi
jmp    1080 <leavenotify@plt>
add    $0x10,%rsi
jmp    1070 <expose@plt>
add    $0xc,%rsi
jmp    1040 <enternotify@plt>
add    $0x8,%rsi
jmp    1060 <buttonrelease@plt>
add    $0x8,%rsi
jmp    1030 <buttonpress@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32 }
define void @event(i8* %0, %struct.TYPE_3__* %1) {
%3 = alloca i8*
%4 = alloca %struct.TYPE_3__*
store i8* %0, i8** %3
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %4
%5 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i32, i32* %6
switch i32 %7, label %38 [
i32 130, label %8
i32 131, label %13
i32 129, label %18
i32 133, label %23
i32 132, label %28
i32 128, label %33
]
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 4
%12 = call i32 @expose(i8* %9, i32* %11)
br label %38
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 3
%17 = call i32 @enternotify(i8* %14, i32* %16)
br label %38
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 3
%22 = call i32 @leavenotify(i8* %19, i32* %21)
br label %38
23: ; preds = %2
%24 = load i8*, i8** %3
%25 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%26 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %25, i32 0, i32 2
%27 = call i32 @buttonpress(i8* %24, i32* %26)
br label %38
28: ; preds = %2
%29 = load i8*, i8** %3
%30 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %30, i32 0, i32 2
%32 = call i32 @buttonrelease(i8* %29, i32* %31)
br label %38
33: ; preds = %2
%34 = load i8*, i8** %3
%35 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%36 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %35, i32 0, i32 1
%37 = call i32 @unmapnotify(i8* %34, i32* %36)
br label %38
38: ; preds = %2, %33, %28, %23, %18, %13, %8
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32 }
define void @event(i8* %0, %struct.TYPE_3__* %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %23 [
i32 130, label %5
i32 131, label %8
i32 129, label %11
i32 133, label %14
i32 132, label %17
i32 128, label %20
]
5: ; preds = %2
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 4
%7 = tail call i32 @expose(i8* %0, i32* %6)
br label %23
8: ; preds = %2
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 3
%10 = tail call i32 @enternotify(i8* %0, i32* %9)
br label %23
11: ; preds = %2
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 3
%13 = tail call i32 @leavenotify(i8* %0, i32* %12)
br label %23
14: ; preds = %2
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 2
%16 = tail call i32 @buttonpress(i8* %0, i32* %15)
br label %23
17: ; preds = %2
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 2
%19 = tail call i32 @buttonrelease(i8* %0, i32* %18)
br label %23
20: ; preds = %2
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
%22 = tail call i32 @unmapnotify(i8* %0, i32* %21)
br label %23
23: ; preds = %2, %20, %17, %14, %11, %8, %5
ret void
}