#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*/ xmaprequest;
  int /*<<< orphan*/ xconfigurerequest;
  int /*<<< orphan*/ xbutton;
  int /*<<< orphan*/ xmotion;
  int /*<<< orphan*/ xexpose;
};
typedef TYPE_1__ XEvent;

/* Variables and functions */
#define ButtonPress 133
#define ButtonRelease 132
#define ConfigureRequest 131
#define Expose 130
#define MapRequest 129
#define MotionNotify 128
int /*<<< orphan*/ buttonpress(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ buttonrelease(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ confrequest(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ expose(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ maprequest(void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ motionnotify(void *, int /*<<< orphan*/ *);
void event(void *self, XEvent *e) {
  switch (e->type) {
  case Expose:
    expose(self, &e->xexpose);
    break;
  case MotionNotify:
    motionnotify(self, &e->xmotion);
    break;
  case ButtonPress:
    buttonpress(self, &e->xbutton);
    break;
  case ButtonRelease:
    buttonrelease(self, &e->xbutton);
    break;
  case ConfigureRequest:
    confrequest(self, &e->xconfigurerequest);
    break;
  case MapRequest:
    maprequest(self, &e->xmaprequest);
    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    $0x14,%rsi
call   1060 <expose@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1070 <motionnotify@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rsi
call   1030 <buttonpress@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rsi
call   1050 <buttonrelease@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <confrequest@plt>
jmp    121b <event+0xbb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
call   1080 <maprequest@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    $0x10,%rsi
jmp    1070 <motionnotify@plt>
ret
add    $0x4,%rsi
jmp    1080 <maprequest@plt>
add    $0x14,%rsi
jmp    1060 <expose@plt>
add    $0x8,%rsi
jmp    1040 <confrequest@plt>
add    $0xc,%rsi
jmp    1050 <buttonrelease@plt>
add    $0xc,%rsi
jmp    1030 <buttonpress@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, 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 128, label %13
i32 133, label %18
i32 132, label %23
i32 131, label %28
i32 129, 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 5
%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 4
%17 = call i32 @motionnotify(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 @buttonpress(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 3
%27 = call i32 @buttonrelease(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 @confrequest(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 @maprequest(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, 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 128, label %8
i32 133, label %11
i32 132, label %14
i32 131, label %17
i32 129, label %20
]
5: ; preds = %2
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 5
%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 4
%10 = tail call i32 @motionnotify(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 @buttonpress(i8* %0, i32* %12)
br label %23
14: ; preds = %2
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 3
%16 = tail call i32 @buttonrelease(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 @confrequest(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 @maprequest(i8* %0, i32* %21)
br label %23
23: ; preds = %2, %20, %17, %14, %11, %8, %5
ret void
}