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

/* Type definitions */
struct TYPE_8__ {
  int /*<<< orphan*/ height;
  int /*<<< orphan*/ width;
};
typedef TYPE_1__ XWindowAttributes;
struct TYPE_9__ {
  int /*<<< orphan*/ visual;
  int /*<<< orphan*/ depth;
};
typedef TYPE_2__ XVisualInfo;
struct TYPE_10__ {
  int event_mask;
  int /*<<< orphan*/ colormap;
};
typedef TYPE_3__ XSetWindowAttributes;
typedef int /*<<< orphan*/ Window;
typedef int GLint;
typedef int /*<<< orphan*/ GLXContext;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Colormap;

/* Variables and functions */
int /*<<< orphan*/ AllocNone;
int CWColormap;
int CWEventMask;
int /*<<< orphan*/ DefaultRootWindow(int /*<<< orphan*/ *);
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int ExposureMask;
int GLX_DEPTH_SIZE;
int GLX_DOUBLEBUFFER;
int GLX_RGBA;
int /*<<< orphan*/ GL_TRUE;
int /*<<< orphan*/ InputOutput;
int KeyPressMask;
int None;
int /*<<< orphan*/ XCreateColormap(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ XCreateWindow(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int, int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 TYPE_3__ *);
int /*<<< orphan*/ XGetWindowAttributes(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, TYPE_1__ *);
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ XStoreName(int /*<<< orphan*/ *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ draw();
int /*<<< orphan*/ draw_command(char *);
int /*<<< orphan*/ draw_init(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
TYPE_2__ *glXChooseVisual(int /*<<< orphan*/ *, int /*<<< orphan*/, int *);
int /*<<< orphan*/ glXCreateContext(int /*<<< orphan*/ *, TYPE_2__ *,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ glXMakeCurrent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ glXSwapBuffers(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ net_init();
char *net_recv();
int main(int argc, char *argv[]) {
  Display *dpy;
  Window root;
  XVisualInfo *vi;
  Colormap cmap;
  XSetWindowAttributes swa;
  Window win;
  GLXContext context;
  XWindowAttributes wa;
  GLint visual_attribs[] = {GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER,
                            None};
  if (NULL == (dpy = XOpenDisplay(NULL)))
    err(EXIT_FAILURE, "XOpenDisplay");
  root = DefaultRootWindow(dpy);
  if (NULL == (vi = glXChooseVisual(dpy, 0, visual_attribs)))
    errx(EXIT_FAILURE, "glXChooseVisual");
  cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
  swa.colormap = cmap;
  swa.event_mask = ExposureMask | KeyPressMask;
  win = XCreateWindow(dpy, root, 0, 0, 1280, 768, 0, vi->depth, InputOutput,
                      vi->visual, CWColormap | CWEventMask, &swa);
  XMapWindow(dpy, win);
  XStoreName(dpy, win, "Fotosyntesefestival");
  context = glXCreateContext(dpy, vi, NULL, GL_TRUE);
  glXMakeCurrent(dpy, win, context);
  XGetWindowAttributes(dpy, win, &wa);
  draw_init(wa.width, wa.height);
  net_init();
  for (;;) {
    draw();
    glXSwapBuffers(dpy, win);
    char *s = NULL;
    do {
      s = net_recv();
      if (s)
        draw_command(s);
    } while (s);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
movl   $0x0,-0x14(%rbp)
mov    %edi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x2d99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
movl   $0x18,-0x68(%rbp)
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2d62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <XOpenDisplay@plt>
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    12a3 <main+0x83>
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
lea    0xd62(%rip),%rsi
call   10b0 <err@plt>
mov    -0x28(%rbp),%rdi
call   1070 <DefaultRootWindow@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x70(%rbp),%rdx
xor    %esi,%esi
call   1110 <glXChooseVisual@plt>
mov    %rax,%rcx
mov    %rcx,-0x38(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    12e5 <main+0xc5>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
lea    0xd2d(%rip),%rsi
call   1080 <errx@plt>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rax
mov    (%rax),%edx
mov    0x2ccf(%rip),%rax
mov    (%rax),%ecx
call   10f0 <XCreateColormap@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    0x2c80(%rip),%rax
mov    (%rax),%eax
mov    0x2cbf(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%r14d
mov    0x2c6c(%rip),%rax
mov    (%rax),%ebx
mov    -0x38(%rbp),%rax
mov    (%rax),%r11d
mov    0x2c7c(%rip),%rax
mov    (%rax),%r10d
mov    0x2c3a(%rip),%rax
or     (%rax),%r10d
xor    %ecx,%ecx
mov    $0x500,%r8d
mov    $0x300,%r9d
lea    -0x48(%rbp),%rax
mov    %ecx,%edx
movl   $0x0,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   10d0 <XCreateWindow@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1120 <XMapWindow@plt>
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
lea    0xc77(%rip),%rdx
call   1050 <XStoreName@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    0x2bee(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edx
call   10c0 <glXCreateContext@plt>
mov    %eax,-0x50(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
call   1090 <glXMakeCurrent@plt>
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
lea    -0x58(%rbp),%rdx
call   1100 <XGetWindowAttributes@plt>
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1130 <draw_init@plt>
mov    $0x0,%al
call   1040 <net_init@plt>
mov    $0x0,%al
call   1060 <draw@plt>
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1140 <glXSwapBuffers@plt>
movq   $0x0,-0x78(%rbp)
mov    $0x0,%al
call   10e0 <net_recv@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     1433 <main+0x213>
mov    -0x78(%rbp),%rdi
call   1030 <draw_command@plt>
jmp    1438 <main+0x218>
cmpq   $0x0,-0x78(%rbp)
jne    1414 <main+0x1f4>
jmp    13f9 <main+0x1d9>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    0x2dad(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
movl   $0x18,0x18(%rsp)
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
xor    %edi,%edi
call   10a0 <XOpenDisplay@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    128c <main+0x6c>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
lea    0xd79(%rip),%rsi
call   10b0 <err@plt>
mov    %rbx,%rdi
call   1070 <DefaultRootWindow@plt>
mov    %eax,%r15d
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1110 <glXChooseVisual@plt>
mov    %rax,%r14
test   %rax,%rax
jne    12c3 <main+0xa3>
mov    0x2ce3(%rip),%rax
mov    (%rax),%edi
lea    0xd4f(%rip),%rsi
call   1080 <errx@plt>
mov    (%r14),%edx
mov    0x2cfb(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    %r15d,%esi
call   10f0 <XCreateColormap@plt>
mov    %eax,0xc(%rsp)
mov    0x2cab(%rip),%rax
mov    0x2cec(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x8(%rsp)
mov    (%r14),%r11d
mov    0x4(%r14),%r10d
mov    0x2c9e(%rip),%rcx
mov    (%rcx),%ebp
mov    0x2cb5(%rip),%rcx
mov    0x2c76(%rip),%rdx
mov    (%rdx),%eax
or     (%rcx),%eax
lea    0x8(%rsp),%r12
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x500,%r8d
mov    $0x300,%r9d
push   %r12
push   %rax
push   %r11
push   %rbp
push   %r10
push   $0x0
call   10d0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1120 <XMapWindow@plt>
lea    0xcc6(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <XStoreName@plt>
mov    0x2c40(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   10c0 <glXCreateContext@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1090 <glXMakeCurrent@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1100 <XGetWindowAttributes@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edi
call   1130 <draw_init@plt>
xor    %eax,%eax
call   1040 <net_init@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <draw@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1140 <glXSwapBuffers@plt>
xor    %eax,%eax
call   10e0 <net_recv@plt>
test   %rax,%rax
je     13b0 <main+0x190>
nopl   (%rax)
mov    %rax,%rdi
call   1030 <draw_command@plt>
xor    %eax,%eax
call   10e0 <net_recv@plt>
test   %rax,%rax
jne    13d0 <main+0x1b0>
jmp    13b0 <main+0x190>

LLVM IR (-O0):
%struct.TYPE_9__ = type { i32, i32 }
%struct.TYPE_10__ = type { i32, i32 }
%struct.TYPE_8__ = type { i32, i32 }
@GLX_RGBA = global i32 0
@GLX_DEPTH_SIZE = global i32 0
@GLX_DOUBLEBUFFER = global i32 0
@None = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [13 x i8] c"XOpenDisplay\00"
@.str.1 = [16 x i8] c"glXChooseVisual\00"
@AllocNone = global i32 0
@ExposureMask = global i32 0
@KeyPressMask = global i32 0
@InputOutput = global i32 0
@CWColormap = global i32 0
@CWEventMask = global i32 0
@.str.2 = [20 x i8] c"Fotosyntesefestival\00"
@GL_TRUE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca %struct.TYPE_9__*
%9 = alloca i32
%10 = alloca %struct.TYPE_10__
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.TYPE_8__
%14 = alloca [5 x i32]
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %14, i64 0, i64 0
%17 = load i32, i32* @GLX_RGBA
store i32 %17, i32* %16
%18 = getelementptr inbounds i32, i32* %16, i64 1
%19 = load i32, i32* @GLX_DEPTH_SIZE
store i32 %19, i32* %18
%20 = getelementptr inbounds i32, i32* %18, i64 1
store i32 24, i32* %20
%21 = getelementptr inbounds i32, i32* %20, i64 1
%22 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %22, i32* %21
%23 = getelementptr inbounds i32, i32* %21, i64 1
%24 = load i32, i32* @None
store i32 %24, i32* %23
%25 = call i32* @XOpenDisplay(i32* null)
store i32* %25, i32** %6
%26 = icmp eq i32* null, %25
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @err(i32 %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %27, %2
%31 = load i32*, i32** %6
%32 = call i32 @DefaultRootWindow(i32* %31)
store i32 %32, i32* %7
%33 = load i32*, i32** %6
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %14, i64 0, i64 0
%35 = call %struct.TYPE_9__* @glXChooseVisual(i32* %33, i32 0, i32* %34)
store %struct.TYPE_9__* %35, %struct.TYPE_9__** %8
%36 = icmp eq %struct.TYPE_9__* null, %35
br i1 %36, label %37, label %40
37: ; preds = %30
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @errx(i32 %38, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %37, %30
%41 = load i32*, i32** %6
%42 = load i32, i32* %7
%43 = load %struct.TYPE_9__*, %struct.TYPE_9__** %8
%44 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %43, i32 0, i32 0
%45 = load i32, i32* %44
%46 = load i32, i32* @AllocNone
%47 = call i32 @XCreateColormap(i32* %41, i32 %42, i32 %45, i32 %46)
store i32 %47, i32* %9
%48 = load i32, i32* %9
%49 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i32 0, i32 1
store i32 %48, i32* %49
%50 = load i32, i32* @ExposureMask
%51 = load i32, i32* @KeyPressMask
%52 = or i32 %50, %51
%53 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %10, i32 0, i32 0
store i32 %52, i32* %53
%54 = load i32*, i32** %6
%55 = load i32, i32* %7
%56 = load %struct.TYPE_9__*, %struct.TYPE_9__** %8
%57 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %56, i32 0, i32 1
%58 = load i32, i32* %57
%59 = load i32, i32* @InputOutput
%60 = load %struct.TYPE_9__*, %struct.TYPE_9__** %8
%61 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %60, i32 0, i32 0
%62 = load i32, i32* %61
%63 = load i32, i32* @CWColormap
%64 = load i32, i32* @CWEventMask
%65 = or i32 %63, %64
%66 = call i32 @XCreateWindow(i32* %54, i32 %55, i32 0, i32 0, i32 1280, i32 768, i32 0, i32 %58, i32 %59, i32 %62, i32 %65, %struct.TYPE_10__* %10)
store i32 %66, i32* %11
%67 = load i32*, i32** %6
%68 = load i32, i32* %11
%69 = call i32 @XMapWindow(i32* %67, i32 %68)
%70 = load i32*, i32** %6
%71 = load i32, i32* %11
%72 = call i32 @XStoreName(i32* %70, i32 %71, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%73 = load i32*, i32** %6
%74 = load %struct.TYPE_9__*, %struct.TYPE_9__** %8
%75 = load i32, i32* @GL_TRUE
%76 = call i32 @glXCreateContext(i32* %73, %struct.TYPE_9__* %74, i32* null, i32 %75)
store i32 %76, i32* %12
%77 = load i32*, i32** %6
%78 = load i32, i32* %11
%79 = load i32, i32* %12
%80 = call i32 @glXMakeCurrent(i32* %77, i32 %78, i32 %79)
%81 = load i32*, i32** %6
%82 = load i32, i32* %11
%83 = call i32 @XGetWindowAttributes(i32* %81, i32 %82, %struct.TYPE_8__* %13)
%84 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %13, i32 0, i32 1
%85 = load i32, i32* %84
%86 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %13, i32 0, i32 0
%87 = load i32, i32* %86
%88 = call i32 @draw_init(i32 %85, i32 %87)
%89 = call i32 (...) @net_init()
br label %90
90: ; preds = %106, %40
%91 = call i32 (...) @draw()
%92 = load i32*, i32** %6
%93 = load i32, i32* %11
%94 = call i32 @glXSwapBuffers(i32* %92, i32 %93)
store i8* null, i8** %15
br label %95
95: ; preds = %103, %90
%96 = call i8* (...) @net_recv()
store i8* %96, i8** %15
%97 = load i8*, i8** %15
%98 = icmp ne i8* %97, null
br i1 %98, label %99, label %102
99: ; preds = %95
%100 = load i8*, i8** %15
%101 = call i32 @draw_command(i8* %100)
br label %102
102: ; preds = %99, %95
br label %103
103: ; preds = %102
%104 = load i8*, i8** %15
%105 = icmp ne i8* %104, null
br i1 %105, label %95, label %106
106: ; preds = %103
br label %90
}

LLVM IR (-O2):
%struct.TYPE_10__ = type { i32, i32 }
%struct.TYPE_8__ = type { i32, i32 }
%struct.TYPE_9__ = type { i32, i32 }
@GLX_RGBA = global i32 0
@GLX_DEPTH_SIZE = global i32 0
@GLX_DOUBLEBUFFER = global i32 0
@None = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [13 x i8] c"XOpenDisplay\00"
@.str.1 = [16 x i8] c"glXChooseVisual\00"
@AllocNone = global i32 0
@ExposureMask = global i32 0
@KeyPressMask = global i32 0
@InputOutput = global i32 0
@CWColormap = global i32 0
@CWEventMask = global i32 0
@.str.2 = [20 x i8] c"Fotosyntesefestival\00"
@GL_TRUE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.TYPE_10__
%4 = alloca %struct.TYPE_8__
%5 = alloca [5 x i32]
%6 = bitcast %struct.TYPE_10__* %3 to i8*
%7 = bitcast %struct.TYPE_8__* %4 to i8*
%8 = bitcast [5 x i32]* %5 to i8*
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%10 = load i32, i32* @GLX_RGBA
store i32 %10, i32* %9
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%12 = load i32, i32* @GLX_DEPTH_SIZE
store i32 %12, i32* %11
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 2
store i32 24, i32* %13
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%15 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %15, i32* %14
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
%17 = load i32, i32* @None
store i32 %17, i32* %16
%18 = tail call i32* @XOpenDisplay(i32* null)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @err(i32 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %20, %2
%24 = tail call i32 @DefaultRootWindow(i32* %18)
%25 = call %struct.TYPE_9__* @glXChooseVisual(i32* %18, i32 0, i32* %9)
%26 = icmp eq %struct.TYPE_9__* %25, null
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @errx(i32 %28, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %27, %23
%31 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %25, i64 0, i32 0
%32 = load i32, i32* %31
%33 = load i32, i32* @AllocNone
%34 = call i32 @XCreateColormap(i32* %18, i32 %24, i32 %32, i32 %33)
%35 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %3, i64 0, i32 1
store i32 %34, i32* %35
%36 = load i32, i32* @ExposureMask
%37 = load i32, i32* @KeyPressMask
%38 = or i32 %37, %36
%39 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %3, i64 0, i32 0
store i32 %38, i32* %39
%40 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %25, i64 0, i32 1
%41 = load i32, i32* %40
%42 = load i32, i32* @InputOutput
%43 = load i32, i32* %31
%44 = load i32, i32* @CWColormap
%45 = load i32, i32* @CWEventMask
%46 = or i32 %45, %44
%47 = call i32 @XCreateWindow(i32* %18, i32 %24, i32 0, i32 0, i32 1280, i32 768, i32 0, i32 %41, i32 %42, i32 %43, i32 %46, %struct.TYPE_10__* %3)
%48 = call i32 @XMapWindow(i32* %18, i32 %47)
%49 = call i32 @XStoreName(i32* %18, i32 %47, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* @GL_TRUE
%51 = call i32 @glXCreateContext(i32* %18, %struct.TYPE_9__* %25, i32* null, i32 %50)
%52 = call i32 @glXMakeCurrent(i32* %18, i32 %47, i32 %51)
%53 = call i32 @XGetWindowAttributes(i32* %18, i32 %47, %struct.TYPE_8__* %4)
%54 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i64 0, i32 1
%55 = load i32, i32* %54
%56 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %4, i64 0, i32 0
%57 = load i32, i32* %56
%58 = call i32 @draw_init(i32 %55, i32 %57)
%59 = call i32 (...) @net_init()
br label %60
60: ; preds = %65, %30
%61 = call i32 (...) @draw()
%62 = call i32 @glXSwapBuffers(i32* %18, i32 %47)
%63 = call i8* (...) @net_recv()
%64 = icmp eq i8* %63, null
br i1 %64, label %65, label %66
65: ; preds = %66, %60
br label %60
66: ; preds = %60, %66
%67 = phi i8* [ %69, %66 ], [ %63, %60 ]
%68 = call i32 @draw_command(i8* %67)
%69 = call i8* (...) @net_recv()
%70 = icmp eq i8* %69, null
br i1 %70, label %65, label %66
}