#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_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int x;
  int y;
  int width;
  int height;
};
struct TYPE_5__ {
  int type;
  TYPE_1__ xconfigure;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
#define ConfigureNotify 129
int /*<<< orphan*/ CopyFromParent;
#define Expose 128
int ExposureMask;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int StructureNotifyMask;
int /*<<< orphan*/ WhitePixel(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                 int, int, int, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ XFlush(int /*<<< orphan*/ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XNextEvent(int /*<<< orphan*/ *, TYPE_2__ *);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
scalar_t__ XPending(int /*<<< orphan*/ *);
int /*<<< orphan*/ XSelectInput(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ XSetWindowBackground(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XSetWindowBorderWidth(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main() {
  Display *display;
  Window win;
  XEvent report;
  XEvent msg;
  int x = 10, y = 10, h = 200, w = 200;
  display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "couldn't connect to X server :0\n");
    return 0;
  }
  win = XCreateWindow(display, RootWindow(display, 0), x, y, w, h, 10,
                      CopyFromParent, CopyFromParent, CopyFromParent, 0, NULL);
  XSetWindowBackground(display, win, WhitePixel(display, 0));
  XSelectInput(display, win, ExposureMask | StructureNotifyMask);
  XMapWindow(display, win);
  XFlush(display);
  while (XPending(display)) {
    XNextEvent(display, &report);
    switch (report.type) {
    case Expose:
      printf("exposed\n");
      break;
    case ConfigureNotify:
      x = report.xconfigure.x;
      y = report.xconfigure.y;
      w = report.xconfigure.width;
      h = report.xconfigure.height;
      printf("confignotify %i,%i-%ix%i\n", x, y, w, h);
      break;
    }
  }
  sleep(2);
  printf("setting border to 0\n");
  XSetWindowBorderWidth(display, win, 0);
  XFlush(display);
  while (XPending(display)) {
    XNextEvent(display, &report);
    switch (report.type) {
    case Expose:
      printf("exposed\n");
      break;
    case ConfigureNotify:
      x = report.xconfigure.x;
      y = report.xconfigure.y;
      w = report.xconfigure.width;
      h = report.xconfigure.height;
      printf("confignotify %i,%i-%ix%i\n", x, y, w, h);
      break;
    }
  }
  sleep(2);
  printf("setting border to 50\n");
  XSetWindowBorderWidth(display, win, 50);
  XFlush(display);
  while (XPending(display)) {
    XNextEvent(display, &report);
    switch (report.type) {
    case Expose:
      printf("exposed\n");
      break;
    case ConfigureNotify:
      x = report.xconfigure.x;
      y = report.xconfigure.y;
      w = report.xconfigure.width;
      h = report.xconfigure.height;
      printf("confignotify %i,%i-%ix%i\n", x, y, w, h);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xa8,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0xa,-0x4c(%rbp)
movl   $0xa,-0x50(%rbp)
movl   $0xc8,-0x54(%rbp)
movl   $0xc8,-0x58(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1248 <main+0x68>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
lea    0xdc9(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    153c <main+0x35c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   10b0 <RootWindow@plt>
mov    -0x70(%rbp),%rdi
mov    %eax,%esi
mov    -0x4c(%rbp),%edx
mov    -0x50(%rbp),%ecx
mov    -0x58(%rbp),%r8d
mov    -0x54(%rbp),%r9d
mov    0x2d52(%rip),%rax
mov    (%rax),%r11d
mov    0x2d48(%rip),%rax
mov    (%rax),%r10d
mov    0x2d3e(%rip),%rax
mov    (%rax),%eax
xor    %ebx,%ebx
xor    %ebx,%ebx
movl   $0xa,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movq   $0x0,0x28(%rsp)
call   10a0 <XCreateWindow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1050 <WhitePixel@plt>
mov    -0x68(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    %eax,%edx
call   10f0 <XSetWindowBackground@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2cdd(%rip),%rax
mov    (%rax),%edx
mov    0x2ce4(%rip),%rax
or     (%rax),%edx
call   10c0 <XSelectInput@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   10e0 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <XFlush@plt>
mov    -0x18(%rbp),%rdi
call   1030 <XPending@plt>
cmp    $0x0,%rax
je     13ac <main+0x1cc>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1090 <XNextEvent@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x74(%rbp)
sub    $0x80,%eax
je     1361 <main+0x181>
jmp    134e <main+0x16e>
mov    -0x74(%rbp),%eax
sub    $0x81,%eax
je     1374 <main+0x194>
jmp    13a7 <main+0x1c7>
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13a7 <main+0x1c7>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x58(%rbp),%ecx
mov    -0x54(%rbp),%r8d
lea    0xc8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1318 <main+0x138>
mov    $0x2,%edi
call   1100 <sleep@plt>
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
xor    %edx,%edx
call   1080 <XSetWindowBorderWidth@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <XFlush@plt>
mov    -0x18(%rbp),%rdi
call   1030 <XPending@plt>
cmp    $0x0,%rax
je     146f <main+0x28f>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1090 <XNextEvent@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x78(%rbp)
sub    $0x80,%eax
je     1424 <main+0x244>
jmp    1411 <main+0x231>
mov    -0x78(%rbp),%eax
sub    $0x81,%eax
je     1437 <main+0x257>
jmp    146a <main+0x28a>
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    146a <main+0x28a>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x58(%rbp),%ecx
mov    -0x54(%rbp),%r8d
lea    0xbc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13db <main+0x1fb>
mov    $0x2,%edi
call   1100 <sleep@plt>
lea    0xbd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0x32,%edx
call   1080 <XSetWindowBorderWidth@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <XFlush@plt>
mov    -0x18(%rbp),%rdi
call   1030 <XPending@plt>
cmp    $0x0,%rax
je     1535 <main+0x355>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1090 <XNextEvent@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x7c(%rbp)
sub    $0x80,%eax
je     14ea <main+0x30a>
jmp    14d7 <main+0x2f7>
mov    -0x7c(%rbp),%eax
sub    $0x81,%eax
je     14fd <main+0x31d>
jmp    1530 <main+0x350>
lea    0xb30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1530 <main+0x350>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x58(%rbp),%ecx
mov    -0x54(%rbp),%r8d
lea    0xb01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14a1 <main+0x2c1>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xa8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
xor    %edi,%edi
call   1070 <XOpenDisplay@plt>
test   %rax,%rax
je     144f <main+0x25f>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   10c0 <RootWindow@plt>
mov    0x2da8(%rip),%rcx
mov    (%rcx),%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0xa,%edx
mov    $0xa,%ecx
mov    $0xc8,%r8d
mov    $0xc8,%r9d
push   $0x0
push   $0x0
push   %rbp
push   %rbp
push   %rbp
push   $0xa
call   10b0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <WhitePixel@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %eax,%edx
call   1100 <XSetWindowBackground@plt>
mov    0x2d60(%rip),%rax
mov    0x2d69(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   10d0 <XSelectInput@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   10f0 <XMapWindow@plt>
mov    %rbx,%rdi
call   10e0 <XFlush@plt>
mov    %rbx,%rdi
call   1040 <XPending@plt>
test   %rax,%rax
je     130f <main+0x11f>
lea    0x8(%rsp),%rbp
lea    0xd6f(%rip),%r15
lea    0xdab(%rip),%r12
jmp    12e8 <main+0xf8>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <XPending@plt>
test   %rax,%rax
je     130f <main+0x11f>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <XNextEvent@plt>
mov    0x8(%rsp),%eax
cmp    $0x81,%eax
je     12c0 <main+0xd0>
cmp    $0x80,%eax
jne    12db <main+0xeb>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    12db <main+0xeb>
mov    $0x2,%edi
call   1110 <sleep@plt>
lea    0xd1b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1090 <XSetWindowBorderWidth@plt>
mov    %rbx,%rdi
call   10e0 <XFlush@plt>
mov    %rbx,%rdi
call   1040 <XPending@plt>
test   %rax,%rax
je     13af <main+0x1bf>
lea    0x8(%rsp),%rbp
lea    0xcce(%rip),%r15
lea    0xd0a(%rip),%r12
jmp    1388 <main+0x198>
nopl   0x0(%rax)
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <XPending@plt>
test   %rax,%rax
je     13af <main+0x1bf>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <XNextEvent@plt>
mov    0x8(%rsp),%eax
cmp    $0x81,%eax
je     1360 <main+0x170>
cmp    $0x80,%eax
jne    137b <main+0x18b>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    137b <main+0x18b>
mov    $0x2,%edi
call   1110 <sleep@plt>
lea    0xc8f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x32,%edx
call   1090 <XSetWindowBorderWidth@plt>
mov    %rbx,%rdi
call   10e0 <XFlush@plt>
mov    %rbx,%rdi
call   1040 <XPending@plt>
test   %rax,%rax
je     1464 <main+0x274>
lea    0x8(%rsp),%rbp
lea    0xc2b(%rip),%r14
lea    0xc67(%rip),%r15
jmp    1428 <main+0x238>
nop
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <XPending@plt>
test   %rax,%rax
je     1464 <main+0x274>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <XNextEvent@plt>
mov    0x8(%rsp),%eax
cmp    $0x81,%eax
je     1400 <main+0x210>
cmp    $0x80,%eax
jne    141b <main+0x22b>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    141b <main+0x22b>
mov    0x2b82(%rip),%rax
mov    (%rax),%edi
lea    0xba1(%rip),%rsi
call   1080 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@ExposureMask = global i32 0
@StructureNotifyMask = global i32 0
@.str.1 = [9 x i8] c"exposed\0A\00"
@.str.2 = [26 x i8] c"confignotify %i,%i-%ix%i\0A\00"
@.str.3 = [21 x i8] c"setting border to 0\0A\00"
@.str.4 = [22 x i8] c"setting border to 50\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca %struct.TYPE_5__
%5 = alloca %struct.TYPE_5__
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %6
store i32 10, i32* %7
store i32 200, i32* %8
store i32 200, i32* %9
%10 = call i32* @XOpenDisplay(i32* null)
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %151
16: ; preds = %0
%17 = load i32*, i32** %2
%18 = load i32*, i32** %2
%19 = call i32 @RootWindow(i32* %18, i32 0)
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %9
%23 = load i32, i32* %8
%24 = load i32, i32* @CopyFromParent
%25 = load i32, i32* @CopyFromParent
%26 = load i32, i32* @CopyFromParent
%27 = call i32 @XCreateWindow(i32* %17, i32 %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 10, i32 %24, i32 %25, i32 %26, i32 0, i32* null)
store i32 %27, i32* %3
%28 = load i32*, i32** %2
%29 = load i32, i32* %3
%30 = load i32*, i32** %2
%31 = call i32 @WhitePixel(i32* %30, i32 0)
%32 = call i32 @XSetWindowBackground(i32* %28, i32 %29, i32 %31)
%33 = load i32*, i32** %2
%34 = load i32, i32* %3
%35 = load i32, i32* @ExposureMask
%36 = load i32, i32* @StructureNotifyMask
%37 = or i32 %35, %36
%38 = call i32 @XSelectInput(i32* %33, i32 %34, i32 %37)
%39 = load i32*, i32** %2
%40 = load i32, i32* %3
%41 = call i32 @XMapWindow(i32* %39, i32 %40)
%42 = load i32*, i32** %2
%43 = call i32 @XFlush(i32* %42)
br label %44
44: ; preds = %73, %16
%45 = load i32*, i32** %2
%46 = call i64 @XPending(i32* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %74
48: ; preds = %44
%49 = load i32*, i32** %2
%50 = call i32 @XNextEvent(i32* %49, %struct.TYPE_5__* %4)
%51 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 0
%52 = load i32, i32* %51
switch i32 %52, label %73 [
i32 128, label %53
i32 129, label %55
]
53: ; preds = %48
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %73
55: ; preds = %48
%56 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%57 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %56, i32 0, i32 0
%58 = load i32, i32* %57
store i32 %58, i32* %6
%59 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%60 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %59, i32 0, i32 1
%61 = load i32, i32* %60
store i32 %61, i32* %7
%62 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%63 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %62, i32 0, i32 2
%64 = load i32, i32* %63
store i32 %64, i32* %9
%65 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%66 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %65, i32 0, i32 3
%67 = load i32, i32* %66
store i32 %67, i32* %8
%68 = load i32, i32* %6
%69 = load i32, i32* %7
%70 = load i32, i32* %9
%71 = load i32, i32* %8
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %68, i32 %69, i32 %70, i32 %71)
br label %73
73: ; preds = %48, %55, %53
br label %44
74: ; preds = %44
%75 = call i32 @sleep(i32 2)
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%77 = load i32*, i32** %2
%78 = load i32, i32* %3
%79 = call i32 @XSetWindowBorderWidth(i32* %77, i32 %78, i32 0)
%80 = load i32*, i32** %2
%81 = call i32 @XFlush(i32* %80)
br label %82
82: ; preds = %111, %74
%83 = load i32*, i32** %2
%84 = call i64 @XPending(i32* %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %112
86: ; preds = %82
%87 = load i32*, i32** %2
%88 = call i32 @XNextEvent(i32* %87, %struct.TYPE_5__* %4)
%89 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 0
%90 = load i32, i32* %89
switch i32 %90, label %111 [
i32 128, label %91
i32 129, label %93
]
91: ; preds = %86
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %111
93: ; preds = %86
%94 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%95 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %94, i32 0, i32 0
%96 = load i32, i32* %95
store i32 %96, i32* %6
%97 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%98 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %97, i32 0, i32 1
%99 = load i32, i32* %98
store i32 %99, i32* %7
%100 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%101 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %100, i32 0, i32 2
%102 = load i32, i32* %101
store i32 %102, i32* %9
%103 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%104 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %103, i32 0, i32 3
%105 = load i32, i32* %104
store i32 %105, i32* %8
%106 = load i32, i32* %6
%107 = load i32, i32* %7
%108 = load i32, i32* %9
%109 = load i32, i32* %8
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %106, i32 %107, i32 %108, i32 %109)
br label %111
111: ; preds = %86, %93, %91
br label %82
112: ; preds = %82
%113 = call i32 @sleep(i32 2)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%115 = load i32*, i32** %2
%116 = load i32, i32* %3
%117 = call i32 @XSetWindowBorderWidth(i32* %115, i32 %116, i32 50)
%118 = load i32*, i32** %2
%119 = call i32 @XFlush(i32* %118)
br label %120
120: ; preds = %149, %112
%121 = load i32*, i32** %2
%122 = call i64 @XPending(i32* %121)
%123 = icmp ne i64 %122, 0
br i1 %123, label %124, label %150
124: ; preds = %120
%125 = load i32*, i32** %2
%126 = call i32 @XNextEvent(i32* %125, %struct.TYPE_5__* %4)
%127 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 0
%128 = load i32, i32* %127
switch i32 %128, label %149 [
i32 128, label %129
i32 129, label %131
]
129: ; preds = %124
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %149
131: ; preds = %124
%132 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%133 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %132, i32 0, i32 0
%134 = load i32, i32* %133
store i32 %134, i32* %6
%135 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%136 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %135, i32 0, i32 1
%137 = load i32, i32* %136
store i32 %137, i32* %7
%138 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%139 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %138, i32 0, i32 2
%140 = load i32, i32* %139
store i32 %140, i32* %9
%141 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %4, i32 0, i32 1
%142 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %141, i32 0, i32 3
%143 = load i32, i32* %142
store i32 %143, i32* %8
%144 = load i32, i32* %6
%145 = load i32, i32* %7
%146 = load i32, i32* %9
%147 = load i32, i32* %8
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %144, i32 %145, i32 %146, i32 %147)
br label %149
149: ; preds = %124, %131, %129
br label %120
150: ; preds = %120
store i32 0, i32* %1
br label %151
151: ; preds = %150, %13
%152 = load i32, i32* %1
ret i32 %152
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [33 x i8] c"couldn't connect to X server :0\0A\00"
@CopyFromParent = global i32 0
@ExposureMask = global i32 0
@StructureNotifyMask = global i32 0
@.str.2 = [26 x i8] c"confignotify %i,%i-%ix%i\0A\00"
@str = [20 x i8] c"setting border to 0\00"
@str.5 = [21 x i8] c"setting border to 50\00"
@str.8 = [8 x i8] c"exposed\00"
define i32 @main() {
%1 = alloca %struct.TYPE_5__
%2 = bitcast %struct.TYPE_5__* %1 to i8*
%3 = tail call i32* @XOpenDisplay(i32* null)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %96
8: ; preds = %0
%9 = tail call i32 @RootWindow(i32* %3, i32 0)
%10 = load i32, i32* @CopyFromParent
%11 = tail call i32 @XCreateWindow(i32* %3, i32 %9, i32 10, i32 10, i32 200, i32 200, i32 10, i32 %10, i32 %10, i32 %10, i32 0, i32* null)
%12 = tail call i32 @WhitePixel(i32* %3, i32 0)
%13 = tail call i32 @XSetWindowBackground(i32* %3, i32 %11, i32 %12)
%14 = load i32, i32* @ExposureMask
%15 = load i32, i32* @StructureNotifyMask
%16 = or i32 %15, %14
%17 = tail call i32 @XSelectInput(i32* %3, i32 %11, i32 %16)
%18 = tail call i32 @XMapWindow(i32* %3, i32 %11)
%19 = tail call i32 @XFlush(i32* %3)
%20 = call i64 @XPending(i32* %3)
%21 = icmp eq i64 %20, 0
br i1 %21, label %42, label %22
22: ; preds = %8
%23 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 0
%25 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 1
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 2
%27 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 3
br label %28
28: ; preds = %22, %39
%29 = call i32 @XNextEvent(i32* %3, %struct.TYPE_5__* %1)
%30 = load i32, i32* %23
switch i32 %30, label %39 [
i32 128, label %31
i32 129, label %33
]
31: ; preds = %28
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
br label %39
33: ; preds = %28
%34 = load i32, i32* %24
%35 = load i32, i32* %25
%36 = load i32, i32* %26
%37 = load i32, i32* %27
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37)
br label %39
39: ; preds = %28, %33, %31
%40 = call i64 @XPending(i32* %3)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %28
42: ; preds = %39, %8
%43 = call i32 @sleep(i32 2)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%45 = call i32 @XSetWindowBorderWidth(i32* %3, i32 %11, i32 0)
%46 = call i32 @XFlush(i32* %3)
%47 = call i64 @XPending(i32* %3)
%48 = icmp eq i64 %47, 0
br i1 %48, label %69, label %49
49: ; preds = %42
%50 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%51 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 0
%52 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 1
%53 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 2
%54 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 3
br label %55
55: ; preds = %49, %66
%56 = call i32 @XNextEvent(i32* %3, %struct.TYPE_5__* %1)
%57 = load i32, i32* %50
switch i32 %57, label %66 [
i32 128, label %58
i32 129, label %60
]
58: ; preds = %55
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
br label %66
60: ; preds = %55
%61 = load i32, i32* %51
%62 = load i32, i32* %52
%63 = load i32, i32* %53
%64 = load i32, i32* %54
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %61, i32 %62, i32 %63, i32 %64)
br label %66
66: ; preds = %55, %60, %58
%67 = call i64 @XPending(i32* %3)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %55
69: ; preds = %66, %42
%70 = call i32 @sleep(i32 2)
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0))
%72 = call i32 @XSetWindowBorderWidth(i32* %3, i32 %11, i32 50)
%73 = call i32 @XFlush(i32* %3)
%74 = call i64 @XPending(i32* %3)
%75 = icmp eq i64 %74, 0
br i1 %75, label %96, label %76
76: ; preds = %69
%77 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%78 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 0
%79 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 1
%80 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 2
%81 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 3
br label %82
82: ; preds = %76, %93
%83 = call i32 @XNextEvent(i32* %3, %struct.TYPE_5__* %1)
%84 = load i32, i32* %77
switch i32 %84, label %93 [
i32 128, label %85
i32 129, label %87
]
85: ; preds = %82
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
br label %93
87: ; preds = %82
%88 = load i32, i32* %78
%89 = load i32, i32* %79
%90 = load i32, i32* %80
%91 = load i32, i32* %81
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %88, i32 %89, i32 %90, i32 %91)
br label %93
93: ; preds = %82, %87, %85
%94 = call i64 @XPending(i32* %3)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %82
96: ; preds = %93, %69, %5
ret i32 0
}