#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__ {
  scalar_t__ type;
};
struct TYPE_5__ {
  TYPE_1__ xkey;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
scalar_t__ KeyPress;
scalar_t__ KeyRelease;
const char *type(XEvent *ev) {
  const char *type;
  if (ev->xkey.type == KeyPress)
    type = "KeyPress";
  else if (ev->xkey.type == KeyRelease)
    type = "KeyRelease";
  else
    type = "Unknown";
  return type;
}


x86 assembly (clang, -O0):
<type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2ed2(%rip),%rcx
cmp    (%rcx),%rax
jne    112f <type+0x2f>
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1166 <type+0x66>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%rax
jne    1156 <type+0x56>
lea    0xebc(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1161 <type+0x61>
lea    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1166 <type+0x66>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<type>:
mov    (%rdi),%rax
mov    0x2ede(%rip),%rcx
mov    0x2ec7(%rip),%rdx
cmp    (%rdx),%rax
lea    0xeee(%rip),%rdx
lea    0xef2(%rip),%rsi
cmove  %rdx,%rsi
cmp    (%rcx),%rax
lea    0xed0(%rip),%rax
cmovne %rsi,%rax
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@KeyPress = global i64 0
@.str = [9 x i8] c"KeyPress\00"
@KeyRelease = global i64 0
@.str.1 = [11 x i8] c"KeyRelease\00"
@.str.2 = [8 x i8] c"Unknown\00"
define i8* @type(%struct.TYPE_5__* %0) {
%2 = alloca %struct.TYPE_5__*
%3 = alloca i8*
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %2
%4 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%5 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = load i64, i64* @KeyPress
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
br label %21
11: ; preds = %1
%12 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %12, i32 0, i32 0
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = load i64, i64* @KeyRelease
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %11
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %20
19: ; preds = %11
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %20
20: ; preds = %19, %18
br label %21
21: ; preds = %20, %10
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@KeyPress = global i64 0
@.str = [9 x i8] c"KeyPress\00"
@KeyRelease = global i64 0
@.str.1 = [11 x i8] c"KeyRelease\00"
@.str.2 = [8 x i8] c"Unknown\00"
define i8* @type(%struct.TYPE_5__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0, i32 0
%3 = load i64, i64* %2
%4 = load i64, i64* @KeyPress
%5 = icmp eq i64 %3, %4
%6 = load i64, i64* @KeyRelease
%7 = icmp eq i64 %3, %6
%8 = select i1 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%9 = select i1 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8
ret i8* %9
}