#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;
typedef int /*<<< orphan*/ FILE;

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


x86 assembly (clang, -O0):
<do_GraphicsExpose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
sub    $0x80,%eax
je     1174 <do_GraphicsExpose+0x54>
jmp    1151 <do_GraphicsExpose+0x31>
mov    -0x30(%rbp),%eax
sub    $0x81,%eax
jne    1184 <do_GraphicsExpose+0x64>
jmp    1164 <do_GraphicsExpose+0x44>
lea    0xe95(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11a2 <do_GraphicsExpose+0x82>
lea    0xe8e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11a2 <do_GraphicsExpose+0x82>
lea    -0x2a(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x2a(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe76(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe44(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%ecx
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_GraphicsExpose>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%edx
cmp    $0x81,%edx
je     114a <do_GraphicsExpose+0x2a>
cmp    $0x80,%edx
jne    1153 <do_GraphicsExpose+0x33>
lea    0xec1(%rip),%r15
jmp    1167 <do_GraphicsExpose+0x47>
lea    0xeaf(%rip),%r15
jmp    1167 <do_GraphicsExpose+0x47>
lea    0x16(%rsp),%r15
lea    0xeb4(%rip),%rsi
mov    %r15,%rdi
call   1040 <sprintf@plt>
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%ecx
mov    0xc(%rbx),%r8d
mov    0x10(%rbx),%r9d
mov    0x14(%rbx),%eax
mov    %eax,(%rsp)
lea    0xe94(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x18(%rbx),%ecx
lea    0xead(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
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, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca %struct.TYPE_2__*
%6 = alloca i8*
%7 = alloca [10 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %4
%9 = bitcast i32* %8 to %struct.TYPE_2__*
store %struct.TYPE_2__* %9, %struct.TYPE_2__** %5
%10 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%11 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %10, i32 0, i32 0
%12 = load i32, i32* %11
switch i32 %12, label %15 [
i32 129, label %13
i32 128, label %14
]
13: ; preds = %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %6
br label %22
14: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %22
15: ; preds = %2
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
store i8* %16, i8** %6
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%18 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%19 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %15, %14, %13
%23 = load i32*, i32** %3
%24 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%28 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %27, i32 0, i32 2
%29 = load i32, i32* %28
%30 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%31 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %30, i32 0, i32 3
%32 = load i32, i32* %31
%33 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%34 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %33, i32 0, i32 4
%35 = load i32, i32* %34
%36 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%37 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %36, i32 0, i32 5
%38 = load i32, i32* %37
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %29, i32 %32, i32 %35, i32 %38)
%40 = load i32*, i32** %3
%41 = load i8*, i8** %6
%42 = load %struct.TYPE_2__*, %struct.TYPE_2__** %5
%43 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %42, i32 0, i32 6
%44 = load i32, i32* %43
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %41, i32 %44)
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, i32* nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %1
switch i32 %5, label %7 [
i32 129, label %9
i32 128, label %6
]
6: ; preds = %2
br label %9
7: ; preds = %2
%8 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %5)
br label %9
9: ; preds = %2, %7, %6
%10 = phi i8* [ %4, %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = getelementptr inbounds i32, i32* %1, i64 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 2
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %1, i64 3
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %1, i64 4
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %1, i64 5
%20 = load i32, i32* %19
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 %14, i32 %16, i32 %18, i32 %20)
%22 = getelementptr inbounds i32, i32* %1, i64 6
%23 = load i32, i32* %22
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %10, i32 %23)
ret void
}