#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_21__ TYPE_8__;
typedef struct TYPE_20__ TYPE_6__;
typedef struct TYPE_19__ TYPE_5__;
typedef struct TYPE_18__ TYPE_4__;
typedef struct TYPE_17__ TYPE_3__;
typedef struct TYPE_16__ TYPE_2__;
typedef struct TYPE_15__ TYPE_1__;

/* Type definitions */
struct TYPE_15__ {
  int member_0;
  int member_1;
  int member_2;
  int member_3;
};
typedef TYPE_1__ xcb_segment_t;
struct TYPE_16__ {
  int black_pixel;
  int white_pixel;
  int /*<<< orphan*/ root_visual;
  void *root;
  int /*<<< orphan*/ root_depth;
};
typedef TYPE_2__ xcb_screen_t;
struct TYPE_17__ {
  int member_0;
  int member_1;
  int member_2;
  int member_3;
};
typedef TYPE_3__ xcb_rectangle_t;
struct TYPE_18__ {
  int member_0;
  int member_1;
};
typedef TYPE_4__ xcb_point_t;
struct TYPE_19__ {
  int response_type;
};
typedef TYPE_5__ xcb_generic_event_t;
typedef void *xcb_gcontext_t;
typedef void *xcb_drawable_t;
typedef int /*<<< orphan*/ xcb_connection_t;
struct TYPE_20__ {
  int member_0;
  int member_1;
  int member_2;
  int member_3;
  int member_5;
  int /*<<< orphan*/ member_4;
};
typedef TYPE_6__ xcb_arc_t;
typedef int uint32_t;
struct TYPE_21__ {
  TYPE_2__ *data;
};

/* Variables and functions */
int /*<<< orphan*/ XCB_COORD_MODE_ORIGIN;
int /*<<< orphan*/ XCB_COORD_MODE_PREVIOUS;
int XCB_CW_BACK_PIXEL;
int XCB_CW_EVENT_MASK;
int XCB_EVENT_MASK_EXPOSURE;
#define XCB_EXPOSE 128
int XCB_GC_FOREGROUND;
int XCB_GC_GRAPHICS_EXPOSURES;
int /*<<< orphan*/ XCB_WINDOW_CLASS_INPUT_OUTPUT;
int /*<<< orphan*/ free(TYPE_5__ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *xcb_connect(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_create_gc(int /*<<< orphan*/ *, void *, void *, int,
                                 int *);
int /*<<< orphan*/ xcb_create_window(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                     void *, void *, int /*<<< orphan*/,
                                     int /*<<< orphan*/, int, int, int,
                                     int /*<<< orphan*/, int /*<<< orphan*/,
                                     int, int *);
int /*<<< orphan*/ xcb_disconnect(int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_flush(int /*<<< orphan*/ *);
void *xcb_generate_id(int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_get_setup(int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_map_window(int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ xcb_poly_arc(int /*<<< orphan*/ *, void *, void *, int,
                                TYPE_6__ *);
int /*<<< orphan*/ xcb_poly_line(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 void *, void *, int, TYPE_4__ *);
int /*<<< orphan*/ xcb_poly_point(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  void *, void *, int, TYPE_4__ *);
int /*<<< orphan*/ xcb_poly_rectangle(int /*<<< orphan*/ *, void *, void *, int,
                                      TYPE_3__ *);
int /*<<< orphan*/ xcb_poly_segment(int /*<<< orphan*/ *, void *, void *, int,
                                    TYPE_1__ *);
TYPE_8__ xcb_setup_roots_iterator(int /*<<< orphan*/);
TYPE_5__ *xcb_wait_for_event(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  xcb_point_t points[] = {{10, 10}, {10, 20}, {20, 10}, {20, 20}};
  xcb_point_t polyline[] = {{50, 10}, {5, 20}, {20, -20}, {10, 10}};
  xcb_segment_t segments[] = {{100, 10, 140, 30}, {110, 25, 130, 60}};
  xcb_rectangle_t rectangles[] = {{10, 50, 40, 20}, {80, 50, 10, 40}};
  xcb_arc_t arcs[] = {{10, 100, 60, 40, 0, 90 << 6},
                      {90, 100, 55, 40, 0, 270 << 6}};
  xcb_connection_t *connection = xcb_connect(NULL, NULL);
  xcb_screen_t *screen =
      xcb_setup_roots_iterator(xcb_get_setup(connection)).data;
  xcb_drawable_t window = screen->root;
  xcb_gcontext_t foreground = xcb_generate_id(connection);
  uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
  uint32_t values[2] = {screen->black_pixel, 0};
  xcb_create_gc(connection, foreground, window, mask, values);
  window = xcb_generate_id(connection);
  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
  values[0] = screen->white_pixel;
  values[1] = XCB_EVENT_MASK_EXPOSURE;
  xcb_create_window(connection, screen->root_depth, window, screen->root, 0, 0,
                    150, 150, 10, XCB_WINDOW_CLASS_INPUT_OUTPUT,
                    screen->root_visual, mask, values);
  xcb_map_window(connection, window);
  xcb_flush(connection);
  printf("Window mapped.\n");
  xcb_generic_event_t *event;
  while ((event = xcb_wait_for_event(connection))) {
    printf("We're waiting.\n");
    switch (event->response_type & ~0x80) {
    case XCB_EXPOSE:
      printf("Expose event.\n");
      xcb_poly_point(connection, XCB_COORD_MODE_ORIGIN, window, foreground, 4,
                     points);
      xcb_poly_line(connection, XCB_COORD_MODE_PREVIOUS, window, foreground, 4,
                    polyline);
      xcb_poly_segment(connection, window, foreground, 2, segments);
      xcb_poly_rectangle(connection, window, foreground, 2, rectangles);
      xcb_poly_arc(connection, window, foreground, 2, arcs);
      xcb_flush(connection);
      break;
    default:
      break;
    }
    free(event);
  }
  printf("We did derp.\n");
  xcb_disconnect(connection);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x148,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0xdbf(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xdbc(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xdb9(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xdb6(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xdb3(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xdb0(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xdad(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xdaa(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xda7(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xda4(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xda1(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xd9e(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xd9b(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xd95(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xd8f(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xd89(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xd7c(%rip),%rsi
mov    $0x30,%edx
call   10b0 <memcpy@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1050 <xcb_connect@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rdi
call   1140 <xcb_get_setup@plt>
mov    %eax,%edi
call   10a0 <xcb_setup_roots_iterator@plt>
mov    %rax,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xf0(%rbp)
mov    -0xd8(%rbp),%rdi
call   1080 <xcb_generate_id@plt>
mov    %rax,-0xf8(%rbp)
mov    0x2c7b(%rip),%rax
mov    (%rax),%eax
mov    0x2c4a(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0xfc(%rbp)
mov    -0xe0(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x104(%rbp)
movl   $0x0,-0x100(%rbp)
mov    -0xd8(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    -0xf0(%rbp),%rdx
mov    -0xfc(%rbp),%ecx
lea    -0x104(%rbp),%r8
call   1060 <xcb_create_gc@plt>
mov    -0xd8(%rbp),%rdi
call   1080 <xcb_generate_id@plt>
mov    %rax,-0xf0(%rbp)
mov    0x2be0(%rip),%rax
mov    (%rax),%eax
mov    0x2bbf(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0xfc(%rbp)
mov    -0xe0(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x104(%rbp)
mov    0x2bc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x100(%rbp)
mov    -0xd8(%rbp),%rdi
mov    -0xe0(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0xf0(%rbp),%rdx
mov    -0xe0(%rbp),%rax
mov    0x10(%rax),%rcx
mov    0x2ba6(%rip),%rax
mov    (%rax),%ebx
mov    -0xe0(%rbp),%rax
mov    0x8(%rax),%r11d
mov    -0xfc(%rbp),%r10d
lea    -0x104(%rbp),%rax
xor    %r9d,%r9d
mov    %r9d,%r8d
movl   $0x96,(%rsp)
movl   $0x96,0x8(%rsp)
movl   $0xa,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1040 <xcb_create_window@plt>
mov    -0xd8(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
call   10f0 <xcb_map_window@plt>
mov    -0xd8(%rbp),%rdi
call   1070 <xcb_flush@plt>
lea    0xc00(%rip),%rdi
call   1090 <printf@plt>
mov    -0xd8(%rbp),%rdi
call   1100 <xcb_wait_for_event@plt>
mov    %rax,-0x110(%rbp)
cmp    $0x0,%rax
je     15f8 <main+0x3d8>
lea    0xbe7(%rip),%rdi
call   1090 <printf@plt>
mov    -0x110(%rbp),%rax
mov    (%rax),%eax
and    $0xffffff7f,%eax
sub    $0x80,%eax
jne    15e2 <main+0x3c2>
jmp    14fc <main+0x2dc>
lea    0xbcd(%rip),%rdi
call   1090 <printf@plt>
mov    -0xd8(%rbp),%rdi
mov    0x2ac2(%rip),%rax
mov    (%rax),%esi
mov    -0xf0(%rbp),%rdx
mov    -0xf8(%rbp),%rcx
lea    -0x40(%rbp),%r9
mov    $0x4,%r8d
call   10c0 <xcb_poly_point@plt>
mov    -0xd8(%rbp),%rdi
mov    0x2a6d(%rip),%rax
mov    (%rax),%esi
mov    -0xf0(%rbp),%rdx
mov    -0xf8(%rbp),%rcx
lea    -0x60(%rbp),%r9
mov    $0x4,%r8d
call   10d0 <xcb_poly_line@plt>
mov    -0xd8(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    -0xf8(%rbp),%rdx
lea    -0x80(%rbp),%r8
mov    $0x2,%ecx
call   1130 <xcb_poly_segment@plt>
mov    -0xd8(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    -0xf8(%rbp),%rdx
lea    -0xa0(%rbp),%r8
mov    $0x2,%ecx
call   1120 <xcb_poly_rectangle@plt>
mov    -0xd8(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    -0xf8(%rbp),%rdx
lea    -0xd0(%rbp),%r8
mov    $0x2,%ecx
call   10e0 <xcb_poly_arc@plt>
mov    -0xd8(%rbp),%rdi
call   1070 <xcb_flush@plt>
jmp    15e7 <main+0x3c7>
jmp    15e7 <main+0x3c7>
mov    -0x110(%rbp),%rdi
call   1030 <free@plt>
jmp    14b5 <main+0x295>
lea    0xae0(%rip),%rdi
call   1090 <printf@plt>
mov    -0xd8(%rbp),%rdi
call   1110 <xcb_disconnect@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
xor    %esi,%esi
call   1060 <xcb_connect@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   10e0 <xcb_get_setup@plt>
mov    %eax,%edi
call   10a0 <xcb_setup_roots_iterator@plt>
mov    %rax,%r15
mov    0x10(%rax),%rbx
mov    %r13,%rdi
call   1090 <xcb_generate_id@plt>
mov    0x2df2(%rip),%rdx
mov    0x2dcb(%rip),%rcx
mov    (%rcx),%ecx
or     (%rdx),%ecx
mov    (%r15),%edx
mov    %edx,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x8(%rsp),%r12
mov    %r13,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
mov    %r12,%r8
call   1070 <xcb_create_gc@plt>
mov    %r13,%rdi
call   1090 <xcb_generate_id@plt>
mov    %rax,%r14
mov    0x2d88(%rip),%rax
mov    0x2d71(%rip),%rcx
mov    (%rcx),%ebx
or     (%rax),%ebx
mov    0x4(%r15),%eax
mov    %eax,0x8(%rsp)
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x18(%r15),%esi
mov    0x10(%r15),%rcx
mov    0x2d71(%rip),%rax
mov    (%rax),%r10d
mov    0x8(%r15),%eax
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r14,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %r12
push   %rbx
push   %rax
push   %r10
push   $0xa
push   $0x96
push   $0x96
call   1050 <xcb_create_window@plt>
add    $0x40,%rsp
mov    %r13,%rdi
mov    %r14,%rsi
call   10b0 <xcb_map_window@plt>
mov    %r13,%rdi
call   1080 <xcb_flush@plt>
lea    0xd45(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   10c0 <xcb_wait_for_event@plt>
test   %rax,%rax
je     1300 <main+0x140>
mov    %rax,%rbx
lea    0xd45(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   10c0 <xcb_wait_for_event@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12e0 <main+0x120>
lea    0xd08(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   10d0 <xcb_disconnect@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_18__ = type { i32, i32 }
%struct.TYPE_15__ = type { i32, i32, i32, i32 }
%struct.TYPE_17__ = type { i32, i32, i32, i32 }
%struct.TYPE_20__ = type { i32, i32, i32, i32, i32, i32 }
%struct.TYPE_16__ = type { i32, i32, i32, i8*, i32 }
%struct.TYPE_21__ = type { %struct.TYPE_16__* }
%struct.TYPE_19__ = type { i32 }
@__const.main.points = [4 x %struct.TYPE_18__] [%struct.TYPE_18__ { i32 10, i32 10 }, %struct.TYPE_18__ { i32 10, i32 20 }, %struct.TYPE_18__ { i32 20, i32 10 }, %struct.TYPE_18__ { i32 20, i32 20 }]
@__const.main.polyline = [4 x %struct.TYPE_18__] [%struct.TYPE_18__ { i32 50, i32 10 }, %struct.TYPE_18__ { i32 5, i32 20 }, %struct.TYPE_18__ { i32 20, i32 -20 }, %struct.TYPE_18__ { i32 10, i32 10 }]
@__const.main.segments = [2 x %struct.TYPE_15__] [%struct.TYPE_15__ { i32 100, i32 10, i32 140, i32 30 }, %struct.TYPE_15__ { i32 110, i32 25, i32 130, i32 60 }]
@__const.main.rectangles = [2 x %struct.TYPE_17__] [%struct.TYPE_17__ { i32 10, i32 50, i32 40, i32 20 }, %struct.TYPE_17__ { i32 80, i32 50, i32 10, i32 40 }]
@__const.main.arcs = [2 x %struct.TYPE_20__] [%struct.TYPE_20__ { i32 10, i32 100, i32 60, i32 40, i32 0, i32 5760 }, %struct.TYPE_20__ { i32 90, i32 100, i32 55, i32 40, i32 0, i32 17280 }]
@XCB_GC_FOREGROUND = global i32 0
@XCB_GC_GRAPHICS_EXPOSURES = global i32 0
@XCB_CW_BACK_PIXEL = global i32 0
@XCB_CW_EVENT_MASK = global i32 0
@XCB_EVENT_MASK_EXPOSURE = global i32 0
@XCB_WINDOW_CLASS_INPUT_OUTPUT = global i32 0
@.str = [16 x i8] c"Window mapped.\0A\00"
@.str.1 = [16 x i8] c"We're waiting.\0A\00"
@.str.2 = [15 x i8] c"Expose event.\0A\00"
@XCB_COORD_MODE_ORIGIN = global i32 0
@XCB_COORD_MODE_PREVIOUS = global i32 0
@.str.3 = [14 x i8] c"We did derp.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x %struct.TYPE_18__]
%7 = alloca [4 x %struct.TYPE_18__]
%8 = alloca [2 x %struct.TYPE_15__]
%9 = alloca [2 x %struct.TYPE_17__]
%10 = alloca [2 x %struct.TYPE_20__]
%11 = alloca i32*
%12 = alloca %struct.TYPE_16__*
%13 = alloca %struct.TYPE_21__
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca [2 x i32]
%18 = alloca %struct.TYPE_19__*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = bitcast [4 x %struct.TYPE_18__]* %6 to i8*
%20 = bitcast [4 x %struct.TYPE_18__]* %7 to i8*
%21 = bitcast [2 x %struct.TYPE_15__]* %8 to i8*
%22 = bitcast [2 x %struct.TYPE_17__]* %9 to i8*
%23 = bitcast [2 x %struct.TYPE_20__]* %10 to i8*
%24 = call i32* @xcb_connect(i32* null, i32* null)
store i32* %24, i32** %11
%25 = load i32*, i32** %11
%26 = call i32 @xcb_get_setup(i32* %25)
%27 = call %struct.TYPE_16__* @xcb_setup_roots_iterator(i32 %26)
%28 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %13, i32 0, i32 0
store %struct.TYPE_16__* %27, %struct.TYPE_16__** %28
%29 = getelementptr inbounds %struct.TYPE_21__, %struct.TYPE_21__* %13, i32 0, i32 0
%30 = load %struct.TYPE_16__*, %struct.TYPE_16__** %29
store %struct.TYPE_16__* %30, %struct.TYPE_16__** %12
%31 = load %struct.TYPE_16__*, %struct.TYPE_16__** %12
%32 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %31, i32 0, i32 3
%33 = load i8*, i8** %32
store i8* %33, i8** %14
%34 = load i32*, i32** %11
%35 = call i8* @xcb_generate_id(i32* %34)
store i8* %35, i8** %15
%36 = load i32, i32* @XCB_GC_FOREGROUND
%37 = load i32, i32* @XCB_GC_GRAPHICS_EXPOSURES
%38 = or i32 %36, %37
store i32 %38, i32* %16
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 0
%40 = load %struct.TYPE_16__*, %struct.TYPE_16__** %12
%41 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %40, i32 0, i32 0
%42 = load i32, i32* %41
store i32 %42, i32* %39
%43 = getelementptr inbounds i32, i32* %39, i64 1
store i32 0, i32* %43
%44 = load i32*, i32** %11
%45 = load i8*, i8** %15
%46 = load i8*, i8** %14
%47 = load i32, i32* %16
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 0
%49 = call i32 @xcb_create_gc(i32* %44, i8* %45, i8* %46, i32 %47, i32* %48)
%50 = load i32*, i32** %11
%51 = call i8* @xcb_generate_id(i32* %50)
store i8* %51, i8** %14
%52 = load i32, i32* @XCB_CW_BACK_PIXEL
%53 = load i32, i32* @XCB_CW_EVENT_MASK
%54 = or i32 %52, %53
store i32 %54, i32* %16
%55 = load %struct.TYPE_16__*, %struct.TYPE_16__** %12
%56 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %55, i32 0, i32 1
%57 = load i32, i32* %56
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 0
store i32 %57, i32* %58
%59 = load i32, i32* @XCB_EVENT_MASK_EXPOSURE
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 1
store i32 %59, i32* %60
%61 = load i32*, i32** %11
%62 = load %struct.TYPE_16__*, %struct.TYPE_16__** %12
%63 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %62, i32 0, i32 4
%64 = load i32, i32* %63
%65 = load i8*, i8** %14
%66 = load %struct.TYPE_16__*, %struct.TYPE_16__** %12
%67 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %66, i32 0, i32 3
%68 = load i8*, i8** %67
%69 = load i32, i32* @XCB_WINDOW_CLASS_INPUT_OUTPUT
%70 = load %struct.TYPE_16__*, %struct.TYPE_16__** %12
%71 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %70, i32 0, i32 2
%72 = load i32, i32* %71
%73 = load i32, i32* %16
%74 = getelementptr inbounds [2 x i32], [2 x i32]* %17, i64 0, i64 0
%75 = call i32 @xcb_create_window(i32* %61, i32 %64, i8* %65, i8* %68, i32 0, i32 0, i32 150, i32 150, i32 10, i32 %69, i32 %72, i32 %73, i32* %74)
%76 = load i32*, i32** %11
%77 = load i8*, i8** %14
%78 = call i32 @xcb_map_window(i32* %76, i8* %77)
%79 = load i32*, i32** %11
%80 = call i32 @xcb_flush(i32* %79)
%81 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %82
82: ; preds = %124, %2
%83 = load i32*, i32** %11
%84 = call %struct.TYPE_19__* @xcb_wait_for_event(i32* %83)
store %struct.TYPE_19__* %84, %struct.TYPE_19__** %18
%85 = icmp ne %struct.TYPE_19__* %84, null
br i1 %85, label %86, label %127
86: ; preds = %82
%87 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%88 = load %struct.TYPE_19__*, %struct.TYPE_19__** %18
%89 = getelementptr inbounds %struct.TYPE_19__, %struct.TYPE_19__* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = and i32 %90, -129
switch i32 %91, label %123 [
i32 128, label %92
]
92: ; preds = %86
%93 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%94 = load i32*, i32** %11
%95 = load i32, i32* @XCB_COORD_MODE_ORIGIN
%96 = load i8*, i8** %14
%97 = load i8*, i8** %15
%98 = getelementptr inbounds [4 x %struct.TYPE_18__], [4 x %struct.TYPE_18__]* %6, i64 0, i64 0
%99 = call i32 @xcb_poly_point(i32* %94, i32 %95, i8* %96, i8* %97, i32 4, %struct.TYPE_18__* %98)
%100 = load i32*, i32** %11
%101 = load i32, i32* @XCB_COORD_MODE_PREVIOUS
%102 = load i8*, i8** %14
%103 = load i8*, i8** %15
%104 = getelementptr inbounds [4 x %struct.TYPE_18__], [4 x %struct.TYPE_18__]* %7, i64 0, i64 0
%105 = call i32 @xcb_poly_line(i32* %100, i32 %101, i8* %102, i8* %103, i32 4, %struct.TYPE_18__* %104)
%106 = load i32*, i32** %11
%107 = load i8*, i8** %14
%108 = load i8*, i8** %15
%109 = getelementptr inbounds [2 x %struct.TYPE_15__], [2 x %struct.TYPE_15__]* %8, i64 0, i64 0
%110 = call i32 @xcb_poly_segment(i32* %106, i8* %107, i8* %108, i32 2, %struct.TYPE_15__* %109)
%111 = load i32*, i32** %11
%112 = load i8*, i8** %14
%113 = load i8*, i8** %15
%114 = getelementptr inbounds [2 x %struct.TYPE_17__], [2 x %struct.TYPE_17__]* %9, i64 0, i64 0
%115 = call i32 @xcb_poly_rectangle(i32* %111, i8* %112, i8* %113, i32 2, %struct.TYPE_17__* %114)
%116 = load i32*, i32** %11
%117 = load i8*, i8** %14
%118 = load i8*, i8** %15
%119 = getelementptr inbounds [2 x %struct.TYPE_20__], [2 x %struct.TYPE_20__]* %10, i64 0, i64 0
%120 = call i32 @xcb_poly_arc(i32* %116, i8* %117, i8* %118, i32 2, %struct.TYPE_20__* %119)
%121 = load i32*, i32** %11
%122 = call i32 @xcb_flush(i32* %121)
br label %124
123: ; preds = %86
br label %124
124: ; preds = %123, %92
%125 = load %struct.TYPE_19__*, %struct.TYPE_19__** %18
%126 = call i32 @free(%struct.TYPE_19__* %125)
br label %82
127: ; preds = %82
%128 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%129 = load i32*, i32** %11
%130 = call i32 @xcb_disconnect(i32* %129)
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_16__ = type { i32, i32, i32, i8*, i32 }
%struct.TYPE_19__ = type { i32 }
@XCB_GC_FOREGROUND = global i32 0
@XCB_GC_GRAPHICS_EXPOSURES = global i32 0
@XCB_CW_BACK_PIXEL = global i32 0
@XCB_CW_EVENT_MASK = global i32 0
@XCB_EVENT_MASK_EXPOSURE = global i32 0
@XCB_WINDOW_CLASS_INPUT_OUTPUT = global i32 0
@XCB_COORD_MODE_ORIGIN = global i32 0
@XCB_COORD_MODE_PREVIOUS = global i32 0
@str = [15 x i8] c"Window mapped.\00"
@str.4 = [13 x i8] c"We did derp.\00"
@str.5 = [15 x i8] c"We're waiting.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32]
%4 = tail call i32* @xcb_connect(i32* null, i32* null)
%5 = tail call i32 @xcb_get_setup(i32* %4)
%6 = tail call %struct.TYPE_16__* @xcb_setup_roots_iterator(i32 %5)
%7 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %6, i64 0, i32 3
%8 = load i8*, i8** %7
%9 = tail call i8* @xcb_generate_id(i32* %4)
%10 = load i32, i32* @XCB_GC_FOREGROUND
%11 = load i32, i32* @XCB_GC_GRAPHICS_EXPOSURES
%12 = or i32 %11, %10
%13 = bitcast [2 x i32]* %3 to i8*
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%15 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %6, i64 0, i32 0
%16 = load i32, i32* %15
store i32 %16, i32* %14
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 0, i32* %17
%18 = call i32 @xcb_create_gc(i32* %4, i8* %9, i8* %8, i32 %12, i32* %14)
%19 = call i8* @xcb_generate_id(i32* %4)
%20 = load i32, i32* @XCB_CW_BACK_PIXEL
%21 = load i32, i32* @XCB_CW_EVENT_MASK
%22 = or i32 %21, %20
%23 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %6, i64 0, i32 1
%24 = load i32, i32* %23
store i32 %24, i32* %14
%25 = load i32, i32* @XCB_EVENT_MASK_EXPOSURE
store i32 %25, i32* %17
%26 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %6, i64 0, i32 4
%27 = load i32, i32* %26
%28 = load i8*, i8** %7
%29 = load i32, i32* @XCB_WINDOW_CLASS_INPUT_OUTPUT
%30 = getelementptr inbounds %struct.TYPE_16__, %struct.TYPE_16__* %6, i64 0, i32 2
%31 = load i32, i32* %30
%32 = call i32 @xcb_create_window(i32* %4, i32 %27, i8* %19, i8* %28, i32 0, i32 0, i32 150, i32 150, i32 10, i32 %29, i32 %31, i32 %22, i32* %14)
%33 = call i32 @xcb_map_window(i32* %4, i8* %19)
%34 = call i32 @xcb_flush(i32* %4)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%36 = call %struct.TYPE_19__* @xcb_wait_for_event(i32* %4)
%37 = icmp eq %struct.TYPE_19__* %36, null
br i1 %37, label %44, label %38
38: ; preds = %2, %38
%39 = phi %struct.TYPE_19__* [ %42, %38 ], [ %36, %2 ]
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%41 = call i32 @free(%struct.TYPE_19__* %39)
%42 = call %struct.TYPE_19__* @xcb_wait_for_event(i32* %4)
%43 = icmp eq %struct.TYPE_19__* %42, null
br i1 %43, label %44, label %38
44: ; preds = %38, %2
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0))
%46 = call i32 @xcb_disconnect(i32* %4)
ret i32 0
}