#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 x;
  int y;
  int width;
  int height;
  int count;
  int minor_code;
};
typedef TYPE_1__ XGraphicsExposeEvent;
typedef int /*<<< orphan*/ XEvent;

/* Variables and functions */
#define X_CopyArea 129
#define X_CopyPlane 128
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
void do_GraphicsExpose(XEvent *eventp) {
  XGraphicsExposeEvent *e = (XGraphicsExposeEvent *)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("    (%d,%d), width %d, height %d, count %d,\n", e->x, e->y, e->width,
         e->height, e->count);
  printf("    major %s, minor %d\n", m, e->minor_code);
}


x86 assembly (clang, -O0):
<do_GraphicsExpose>:
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_GraphicsExpose+0x50>
jmp    114d <do_GraphicsExpose+0x2d>
mov    -0x28(%rbp),%eax
sub    $0x81,%eax
jne    1180 <do_GraphicsExpose+0x60>
jmp    1160 <do_GraphicsExpose+0x40>
lea    0xe99(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    119e <do_GraphicsExpose+0x7e>
lea    0xe92(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    119e <do_GraphicsExpose+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    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%r9d
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_GraphicsExpose>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    (%rdi),%edx
cmp    $0x81,%edx
je     1145 <do_GraphicsExpose+0x25>
cmp    $0x80,%edx
jne    114e <do_GraphicsExpose+0x2e>
lea    0xec6(%rip),%r14
jmp    1162 <do_GraphicsExpose+0x42>
lea    0xeb4(%rip),%r14
jmp    1162 <do_GraphicsExpose+0x42>
lea    0xe(%rsp),%r14
lea    0xeb9(%rip),%rsi
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    0x4(%rbx),%esi
mov    0x8(%rbx),%edx
mov    0xc(%rbx),%ecx
mov    0x10(%rbx),%r8d
mov    0x14(%rbx),%r9d
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rbx),%edx
lea    0xeb8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32, i32, i32, i32, i32, 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 = [45 x i8] c" (%d,%d), width %d, height %d, count %d,\0A\00"
@.str.4 = [24 x i8] c" major %s, minor %d\0A\00"
define void @do_GraphicsExpose(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 %struct.TYPE_2__*, %struct.TYPE_2__** %3
%22 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 2
%26 = load i32, i32* %25
%27 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%28 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %27, i32 0, i32 3
%29 = load i32, i32* %28
%30 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%31 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %30, i32 0, i32 4
%32 = load i32, i32* %31
%33 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%34 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %33, i32 0, i32 5
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %26, i32 %29, i32 %32, i32 %35)
%37 = load i8*, i8** %4
%38 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%39 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %38, i32 0, i32 6
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %37, i32 %40)
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 = [45 x i8] c" (%d,%d), width %d, height %d, count %d,\0A\00"
@.str.4 = [24 x i8] c" major %s, minor %d\0A\00"
define void @do_GraphicsExpose(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 = getelementptr inbounds i32, i32* %0, i64 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %0, i64 4
%17 = load i32, i32* %16
%18 = getelementptr inbounds i32, i32* %0, i64 5
%19 = load i32, i32* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %13, i32 %15, i32 %17, i32 %19)
%21 = getelementptr inbounds i32, i32* %0, i64 6
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %9, i32 %22)
ret void
}