#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_11__ TYPE_5__;
typedef struct TYPE_10__ TYPE_3__;
typedef struct TYPE_9__ TYPE_2__;
typedef struct TYPE_8__ TYPE_1__;

/* Type definitions */
struct TYPE_8__ {
  int black_pixel;
  int white_pixel;
  int /*<<< orphan*/ root_visual;
  void *root;
};
typedef TYPE_1__ xcb_screen_t;
struct TYPE_9__ {
  int member_0;
  int member_1;
  int member_2;
  int member_3;
};
typedef TYPE_2__ xcb_rectangle_t;
struct TYPE_10__ {
  int response_type;
};
typedef TYPE_3__ xcb_generic_event_t;
typedef void *xcb_gcontext_t;
typedef void *xcb_drawable_t;
typedef int /*<<< orphan*/ xcb_connection_t;
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
struct TYPE_11__ {
  TYPE_1__ *data;
};

/* Variables and functions */
int /*<<< orphan*/ XCB_COPY_FROM_PARENT;
int XCB_CW_BACK_PIXEL;
int XCB_CW_EVENT_MASK;
int XCB_EVENT_MASK_EXPOSURE;
int XCB_EVENT_MASK_KEY_PRESS;
#define XCB_EXPOSE 129
int XCB_GC_BACKGROUND;
int XCB_GC_FOREGROUND;
int XCB_GC_GRAPHICS_EXPOSURES;
#define XCB_KEY_PRESS 128
int /*<<< orphan*/ XCB_WINDOW_CLASS_INPUT_OUTPUT;
int /*<<< orphan*/ free(TYPE_3__ *);
int /*<<< orphan*/ strlen(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_flush(int /*<<< orphan*/ *);
void *xcb_generate_id(int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_get_setup(int /*<<< orphan*/ *);
int /*<<< orphan*/ xcb_image_text_8(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                    void *, void *, int, int, char *);
int /*<<< orphan*/ xcb_map_window(int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ xcb_poly_rectangle(int /*<<< orphan*/ *, void *, void *, int,
                                      TYPE_2__ *);
TYPE_5__ xcb_setup_roots_iterator(int /*<<< orphan*/);
TYPE_3__ *xcb_wait_for_event(int /*<<< orphan*/ *);
int main() {
  xcb_connection_t *c;
  xcb_screen_t *screen;
  xcb_drawable_t win;
  xcb_gcontext_t foreground;
  xcb_gcontext_t background;
  xcb_generic_event_t *e;
  uint32_t mask = 0;
  uint32_t values[2];
  char string[] = "Hello, XCB!";
  uint8_t string_len = strlen(string);
  xcb_rectangle_t rectangles[] = {
      {40, 40, 20, 20},
  };
  c = xcb_connect(NULL, NULL);
  screen = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
  win = screen->root;
  foreground = xcb_generate_id(c);
  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
  values[0] = screen->black_pixel;
  values[1] = 0;
  xcb_create_gc(c, foreground, win, mask, values);
  background = xcb_generate_id(c);
  mask = XCB_GC_BACKGROUND | XCB_GC_GRAPHICS_EXPOSURES;
  values[0] = screen->white_pixel;
  values[1] = 0;
  xcb_create_gc(c, background, win, mask, values);
  win = xcb_generate_id(c);
  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
  values[0] = screen->white_pixel;
  values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS;
  xcb_create_window(c, XCB_COPY_FROM_PARENT, win, screen->root, 0, 0, 150, 150,
                    10, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual,
                    mask, values);
  xcb_map_window(c, win);
  xcb_flush(c);
  while ((e = xcb_wait_for_event(c))) {
    switch (e->response_type & ~0x80) {
    case XCB_EXPOSE:
      xcb_poly_rectangle(c, win, foreground, 1, rectangles);
      xcb_image_text_8(c, string_len, win, background, 20, 20, string);
      xcb_flush(c);
      break;
    case XCB_KEY_PRESS:
      goto endloop;
    }
    free(e);
  }
endloop:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xb8,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x44(%rbp)
mov    0xe0f(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe0d(%rip),%eax
mov    %eax,-0x50(%rbp)
lea    -0x58(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x5c(%rbp)
mov    0xdff(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xdfc(%rip),%rax
mov    %rax,-0x68(%rbp)
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1050 <xcb_connect@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10e0 <xcb_get_setup@plt>
mov    %eax,%edi
call   10a0 <xcb_setup_roots_iterator@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <xcb_generate_id@plt>
mov    %rax,-0x30(%rbp)
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
mov    0x2d53(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x44(%rbp),%ecx
lea    -0x4c(%rbp),%r8
call   1060 <xcb_create_gc@plt>
mov    -0x18(%rbp),%rdi
call   1090 <xcb_generate_id@plt>
mov    %rax,-0x38(%rbp)
mov    0x2cea(%rip),%rax
mov    (%rax),%eax
mov    0x2d09(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x44(%rbp),%ecx
lea    -0x4c(%rbp),%r8
call   1060 <xcb_create_gc@plt>
mov    -0x18(%rbp),%rdi
call   1090 <xcb_generate_id@plt>
mov    %rax,-0x28(%rbp)
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
mov    0x2c9e(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2cb8(%rip),%rax
mov    (%rax),%eax
mov    0x2c87(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2c97(%rip),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rcx
mov    0x2c92(%rip),%rax
mov    (%rax),%ebx
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r11d
mov    -0x44(%rbp),%r10d
lea    -0x4c(%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    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <xcb_map_window@plt>
mov    -0x18(%rbp),%rdi
call   1080 <xcb_flush@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <xcb_wait_for_event@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     1453 <main+0x283>
mov    -0x40(%rbp),%rax
mov    (%rax),%eax
and    $0xffffff7f,%eax
mov    %eax,-0x7c(%rbp)
sub    $0x80,%eax
je     1440 <main+0x270>
jmp    13e0 <main+0x210>
mov    -0x7c(%rbp),%eax
sub    $0x81,%eax
jne    1445 <main+0x275>
jmp    13f3 <main+0x223>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    -0x70(%rbp),%r8
mov    $0x1,%ecx
call   10d0 <xcb_poly_rectangle@plt>
mov    -0x18(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x38(%rbp),%rcx
lea    -0x58(%rbp),%rax
mov    $0x14,%r9d
mov    %r9d,%r8d
mov    %rax,(%rsp)
call   10f0 <xcb_image_text_8@plt>
mov    -0x18(%rbp),%rdi
call   1080 <xcb_flush@plt>
jmp    1445 <main+0x275>
jmp    1458 <main+0x288>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
jmp    13ab <main+0x1db>
jmp    1458 <main+0x288>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movabs $0x58202c6f6c6c6548,%rax
2c 20 58
mov    %rax,0x10(%rsp)
movl   $0x214243,0x18(%rsp)
lea    0x10(%rsp),%rdi
call   1070 <strlen@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <xcb_connect@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10d0 <xcb_get_setup@plt>
mov    %eax,%edi
call   10a0 <xcb_setup_roots_iterator@plt>
mov    %rax,%r14
mov    0x10(%rax),%r12
mov    %rbx,%rdi
call   1090 <xcb_generate_id@plt>
mov    0x2de1(%rip),%rdx
mov    0x2db2(%rip),%r13
mov    0x0(%r13),%ecx
or     (%rdx),%ecx
mov    (%r14),%edx
mov    %edx,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x8(%rsp),%r15
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r12,%rdx
mov    %r15,%r8
call   1060 <xcb_create_gc@plt>
mov    %rbx,%rdi
call   1090 <xcb_generate_id@plt>
mov    0x2d50(%rip),%rdx
mov    0x0(%r13),%ecx
or     (%rdx),%ecx
mov    0x4(%r14),%edx
mov    %edx,0x8(%rsp)
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r12,%rdx
mov    %r15,%r8
call   1060 <xcb_create_gc@plt>
mov    %rbx,%rdi
call   1090 <xcb_generate_id@plt>
mov    %rax,%r12
mov    0x2d37(%rip),%rdx
mov    0x2d18(%rip),%rcx
mov    (%rcx),%eax
or     (%rdx),%eax
mov    0x4(%r14),%ecx
mov    0x2d39(%rip),%rdx
mov    0x2d0a(%rip),%rsi
mov    (%rsi),%esi
or     (%rdx),%esi
mov    %ecx,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    0x2d17(%rip),%rcx
mov    (%rcx),%esi
mov    0x10(%r14),%rcx
mov    0x2d1a(%rip),%rdx
mov    (%rdx),%r10d
mov    0x8(%r14),%r11d
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %r15
push   %rax
push   %r11
push   %r10
push   $0xa
push   $0x96
push   $0x96
call   1040 <xcb_create_window@plt>
add    $0x40,%rsp
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <xcb_map_window@plt>
mov    %rbx,%rdi
call   1080 <xcb_flush@plt>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10c0 <xcb_wait_for_event@plt>
test   %rax,%rax
je     1327 <main+0x177>
mov    %rax,%rdi
call   1030 <free@plt>
jmp    1310 <main+0x160>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_9__ = type { i32, i32, i32, i32 }
%struct.TYPE_8__ = type { i32, i32, i32, i8* }
%struct.TYPE_10__ = type { i32 }
%struct.TYPE_11__ = type { %struct.TYPE_8__* }
@__const.main.string = [12 x i8] c"Hello, XCB!\00"
@__const.main.rectangles = [1 x %struct.TYPE_9__] [%struct.TYPE_9__ { i32 40, i32 40, i32 20, i32 20 }]
@XCB_GC_FOREGROUND = global i32 0
@XCB_GC_GRAPHICS_EXPOSURES = global i32 0
@XCB_GC_BACKGROUND = 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_EVENT_MASK_KEY_PRESS = global i32 0
@XCB_COPY_FROM_PARENT = global i32 0
@XCB_WINDOW_CLASS_INPUT_OUTPUT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca %struct.TYPE_8__*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.TYPE_10__*
%8 = alloca i32
%9 = alloca [2 x i32]
%10 = alloca [12 x i8]
%11 = alloca i32
%12 = alloca [1 x %struct.TYPE_9__]
%13 = alloca %struct.TYPE_11__
store i32 0, i32* %1
store i32 0, i32* %8
%14 = bitcast [12 x i8]* %10 to i8*
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %10, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %11
%17 = bitcast [1 x %struct.TYPE_9__]* %12 to i8*
%18 = call i32* @xcb_connect(i32* null, i32* null)
store i32* %18, i32** %2
%19 = load i32*, i32** %2
%20 = call i32 @xcb_get_setup(i32* %19)
%21 = call %struct.TYPE_8__* @xcb_setup_roots_iterator(i32 %20)
%22 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %13, i32 0, i32 0
store %struct.TYPE_8__* %21, %struct.TYPE_8__** %22
%23 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %13, i32 0, i32 0
%24 = load %struct.TYPE_8__*, %struct.TYPE_8__** %23
store %struct.TYPE_8__* %24, %struct.TYPE_8__** %3
%25 = load %struct.TYPE_8__*, %struct.TYPE_8__** %3
%26 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %25, i32 0, i32 3
%27 = load i8*, i8** %26
store i8* %27, i8** %4
%28 = load i32*, i32** %2
%29 = call i8* @xcb_generate_id(i32* %28)
store i8* %29, i8** %5
%30 = load i32, i32* @XCB_GC_FOREGROUND
%31 = load i32, i32* @XCB_GC_GRAPHICS_EXPOSURES
%32 = or i32 %30, %31
store i32 %32, i32* %8
%33 = load %struct.TYPE_8__*, %struct.TYPE_8__** %3
%34 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %33, i32 0, i32 0
%35 = load i32, i32* %34
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %35, i32* %36
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 0, i32* %37
%38 = load i32*, i32** %2
%39 = load i8*, i8** %5
%40 = load i8*, i8** %4
%41 = load i32, i32* %8
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%43 = call i32 @xcb_create_gc(i32* %38, i8* %39, i8* %40, i32 %41, i32* %42)
%44 = load i32*, i32** %2
%45 = call i8* @xcb_generate_id(i32* %44)
store i8* %45, i8** %6
%46 = load i32, i32* @XCB_GC_BACKGROUND
%47 = load i32, i32* @XCB_GC_GRAPHICS_EXPOSURES
%48 = or i32 %46, %47
store i32 %48, i32* %8
%49 = load %struct.TYPE_8__*, %struct.TYPE_8__** %3
%50 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %49, i32 0, i32 1
%51 = load i32, i32* %50
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %51, i32* %52
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 0, i32* %53
%54 = load i32*, i32** %2
%55 = load i8*, i8** %6
%56 = load i8*, i8** %4
%57 = load i32, i32* %8
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%59 = call i32 @xcb_create_gc(i32* %54, i8* %55, i8* %56, i32 %57, i32* %58)
%60 = load i32*, i32** %2
%61 = call i8* @xcb_generate_id(i32* %60)
store i8* %61, i8** %4
%62 = load i32, i32* @XCB_CW_BACK_PIXEL
%63 = load i32, i32* @XCB_CW_EVENT_MASK
%64 = or i32 %62, %63
store i32 %64, i32* %8
%65 = load %struct.TYPE_8__*, %struct.TYPE_8__** %3
%66 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %65, i32 0, i32 1
%67 = load i32, i32* %66
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %67, i32* %68
%69 = load i32, i32* @XCB_EVENT_MASK_EXPOSURE
%70 = load i32, i32* @XCB_EVENT_MASK_KEY_PRESS
%71 = or i32 %69, %70
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 %71, i32* %72
%73 = load i32*, i32** %2
%74 = load i32, i32* @XCB_COPY_FROM_PARENT
%75 = load i8*, i8** %4
%76 = load %struct.TYPE_8__*, %struct.TYPE_8__** %3
%77 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %76, i32 0, i32 3
%78 = load i8*, i8** %77
%79 = load i32, i32* @XCB_WINDOW_CLASS_INPUT_OUTPUT
%80 = load %struct.TYPE_8__*, %struct.TYPE_8__** %3
%81 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %80, i32 0, i32 2
%82 = load i32, i32* %81
%83 = load i32, i32* %8
%84 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%85 = call i32 @xcb_create_window(i32* %73, i32 %74, i8* %75, i8* %78, i32 0, i32 0, i32 150, i32 150, i32 10, i32 %79, i32 %82, i32 %83, i32* %84)
%86 = load i32*, i32** %2
%87 = load i8*, i8** %4
%88 = call i32 @xcb_map_window(i32* %86, i8* %87)
%89 = load i32*, i32** %2
%90 = call i32 @xcb_flush(i32* %89)
br label %91
91: ; preds = %115, %0
%92 = load i32*, i32** %2
%93 = call %struct.TYPE_10__* @xcb_wait_for_event(i32* %92)
store %struct.TYPE_10__* %93, %struct.TYPE_10__** %7
%94 = icmp ne %struct.TYPE_10__* %93, null
br i1 %94, label %95, label %118
95: ; preds = %91
%96 = load %struct.TYPE_10__*, %struct.TYPE_10__** %7
%97 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %96, i32 0, i32 0
%98 = load i32, i32* %97
%99 = and i32 %98, -129
switch i32 %99, label %115 [
i32 129, label %100
i32 128, label %114
]
100: ; preds = %95
%101 = load i32*, i32** %2
%102 = load i8*, i8** %4
%103 = load i8*, i8** %5
%104 = getelementptr inbounds [1 x %struct.TYPE_9__], [1 x %struct.TYPE_9__]* %12, i64 0, i64 0
%105 = call i32 @xcb_poly_rectangle(i32* %101, i8* %102, i8* %103, i32 1, %struct.TYPE_9__* %104)
%106 = load i32*, i32** %2
%107 = load i32, i32* %11
%108 = load i8*, i8** %4
%109 = load i8*, i8** %6
%110 = getelementptr inbounds [12 x i8], [12 x i8]* %10, i64 0, i64 0
%111 = call i32 @xcb_image_text_8(i32* %106, i32 %107, i8* %108, i8* %109, i32 20, i32 20, i8* %110)
%112 = load i32*, i32** %2
%113 = call i32 @xcb_flush(i32* %112)
br label %115
114: ; preds = %95
br label %119
115: ; preds = %95, %100
%116 = load %struct.TYPE_10__*, %struct.TYPE_10__** %7
%117 = call i32 @free(%struct.TYPE_10__* %116)
br label %91
118: ; preds = %91
br label %119
119: ; preds = %118, %114
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_8__ = type { i32, i32, i32, i8* }
%struct.TYPE_10__ = type { i32 }
@__const.main.string = [12 x i8] c"Hello, XCB!\00"
@XCB_GC_FOREGROUND = global i32 0
@XCB_GC_GRAPHICS_EXPOSURES = global i32 0
@XCB_GC_BACKGROUND = 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_EVENT_MASK_KEY_PRESS = global i32 0
@XCB_COPY_FROM_PARENT = global i32 0
@XCB_WINDOW_CLASS_INPUT_OUTPUT = global i32 0
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [12 x i8]
%3 = bitcast [2 x i32]* %1 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @strlen(i8* %4)
%6 = call i32* @xcb_connect(i32* null, i32* null)
%7 = call i32 @xcb_get_setup(i32* %6)
%8 = call %struct.TYPE_8__* @xcb_setup_roots_iterator(i32 %7)
%9 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %8, i64 0, i32 3
%10 = load i8*, i8** %9
%11 = call i8* @xcb_generate_id(i32* %6)
%12 = load i32, i32* @XCB_GC_FOREGROUND
%13 = load i32, i32* @XCB_GC_GRAPHICS_EXPOSURES
%14 = or i32 %13, %12
%15 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %8, i64 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
store i32 %16, i32* %17
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
store i32 0, i32* %18
%19 = call i32 @xcb_create_gc(i32* %6, i8* %11, i8* %10, i32 %14, i32* %17)
%20 = call i8* @xcb_generate_id(i32* %6)
%21 = load i32, i32* @XCB_GC_BACKGROUND
%22 = load i32, i32* @XCB_GC_GRAPHICS_EXPOSURES
%23 = or i32 %22, %21
%24 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %8, i64 0, i32 1
%25 = load i32, i32* %24
store i32 %25, i32* %17
store i32 0, i32* %18
%26 = call i32 @xcb_create_gc(i32* %6, i8* %20, i8* %10, i32 %23, i32* %17)
%27 = call i8* @xcb_generate_id(i32* %6)
%28 = load i32, i32* @XCB_CW_BACK_PIXEL
%29 = load i32, i32* @XCB_CW_EVENT_MASK
%30 = or i32 %29, %28
%31 = load i32, i32* %24
store i32 %31, i32* %17
%32 = load i32, i32* @XCB_EVENT_MASK_EXPOSURE
%33 = load i32, i32* @XCB_EVENT_MASK_KEY_PRESS
%34 = or i32 %33, %32
store i32 %34, i32* %18
%35 = load i32, i32* @XCB_COPY_FROM_PARENT
%36 = load i8*, i8** %9
%37 = load i32, i32* @XCB_WINDOW_CLASS_INPUT_OUTPUT
%38 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %8, i64 0, i32 2
%39 = load i32, i32* %38
%40 = call i32 @xcb_create_window(i32* %6, i32 %35, i8* %27, i8* %36, i32 0, i32 0, i32 150, i32 150, i32 10, i32 %37, i32 %39, i32 %30, i32* %17)
%41 = call i32 @xcb_map_window(i32* %6, i8* %27)
%42 = call i32 @xcb_flush(i32* %6)
%43 = call %struct.TYPE_10__* @xcb_wait_for_event(i32* %6)
%44 = icmp eq %struct.TYPE_10__* %43, null
br i1 %44, label %50, label %45
45: ; preds = %0, %45
%46 = phi %struct.TYPE_10__* [ %48, %45 ], [ %43, %0 ]
%47 = call i32 @free(%struct.TYPE_10__* %46)
%48 = call %struct.TYPE_10__* @xcb_wait_for_event(i32* %6)
%49 = icmp eq %struct.TYPE_10__* %48, null
br i1 %49, label %50, label %45
50: ; preds = %45, %0
ret i32 0
}