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

/* Type definitions */
struct TYPE_2__ {
  int major_code;
  int minor_code;
};
typedef TYPE_1__ XNoExposeEvent;
typedef int /*<<< orphan*/ XEvent;

/* Variables and functions */
#define X_CopyArea 129
#define X_CopyPlane 128
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void do_NoExpose(XEvent *eventp) {
  XNoExposeEvent *e = (XNoExposeEvent *)eventp;
  char *m;
  char mdummy[10];
  switch (e->major_code) {
  case X_CopyArea:
    m = "CopyArea";
    break;
  case X_CopyPlane:
    m = "CopyPlane";
    break;
  default:
    m = mdummy;
    sprintf(mdummy, "%d", e->major_code);
    break;
  }
  printf("    major %s, minor %d\n", m, e->minor_code);
  return;
}


x86 assembly (clang, -O0):
<do_NoExpose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
sub    $0x80,%eax
je     1170 <do_NoExpose+0x50>
jmp    114d <do_NoExpose+0x2d>
mov    -0x28(%rbp),%eax
sub    $0x81,%eax
jne    1180 <do_NoExpose+0x60>
jmp    1160 <do_NoExpose+0x40>
lea    0xe99(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    119e <do_NoExpose+0x7e>
lea    0xe92(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    119e <do_NoExpose+0x7e>
lea    -0x22(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x22(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe7a(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_NoExpose>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    (%rdi),%edx
cmp    $0x81,%edx
je     1145 <do_NoExpose+0x25>
cmp    $0x80,%edx
jne    114e <do_NoExpose+0x2e>
lea    0xec6(%rip),%r14
jmp    1162 <do_NoExpose+0x42>
lea    0xeb4(%rip),%r14
jmp    1162 <do_NoExpose+0x42>
lea    0xe(%rsp),%r14
lea    0xeb9(%rip),%rsi
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    0x4(%rbx),%edx
lea    0xeaa(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32, i32 }
@.str = [9 x i8] c"CopyArea\00"
@.str.1 = [10 x i8] c"CopyPlane\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [24 x i8] c" major %s, minor %d\0A\00"
define void @do_NoExpose(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.TYPE_2__*
%4 = alloca i8*
%5 = alloca [10 x i8]
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = bitcast i32* %6 to %struct.TYPE_2__*
store %struct.TYPE_2__* %7, %struct.TYPE_2__** %3
%8 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
%10 = load i32, i32* %9
switch i32 %10, label %13 [
i32 129, label %11
i32 128, label %12
]
11: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %4
br label %20
12: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %4
br label %20
13: ; preds = %1
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
store i8* %14, i8** %4
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%16 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%17 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %13, %12, %11
%21 = load i8*, i8** %4
%22 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%23 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %21, i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"CopyArea\00"
@.str.1 = [10 x i8] c"CopyPlane\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [24 x i8] c" major %s, minor %d\0A\00"
define void @do_NoExpose(i32* nocapture %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* %0
switch i32 %4, label %6 [
i32 129, label %8
i32 128, label %5
]
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %4)
br label %8
8: ; preds = %1, %6, %5
%9 = phi i8* [ %3, %6 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %9, i32 %11)
ret void
}