#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_2__;
typedef struct TYPE_10__ TYPE_1__;

/* Type definitions */
struct TYPE_10__ {
  int /*<<< orphan*/ visual;
  int /*<<< orphan*/ depth;
};
typedef TYPE_1__ XVisualInfo;
struct TYPE_11__ {
  int event_mask;
  int /*<<< orphan*/ colormap;
  scalar_t__ border_pixel;
  scalar_t__ background_pixel;
};
typedef TYPE_2__ XSetWindowAttributes;
typedef int /*<<< orphan*/ Window;
typedef TYPE_1__ GLXFBConfig;
typedef int /*<<< orphan*/ *GLXContext;
typedef int /*<<< orphan*/ Display;
typedef scalar_t__ Bool;

/* Variables and functions */
int /*<<< orphan*/ AllocNone;
unsigned long CWBackPixel;
unsigned long CWBorderPixel;
unsigned long CWColormap;
unsigned long CWEventMask;
int /*<<< orphan*/ CheckError(int);
int ExposureMask;
scalar_t__ False;
int /*<<< orphan*/ GL_VERSION;
int /*<<< orphan*/ InputOutput;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int StructureNotifyMask;
scalar_t__ True;
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*/,
                                 unsigned long, TYPE_2__ *);
int /*<<< orphan*/ XDestroyWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XFree(TYPE_1__ *);
int /*<<< orphan*/ XSync(int /*<<< orphan*/ *, int);
TYPE_1__ *choose_fb_config(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *create_context_with_config(int /*<<< orphan*/ *, TYPE_1__,
                                               scalar_t__, scalar_t__);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ glGetString(int /*<<< orphan*/);
int /*<<< orphan*/ glXDestroyContext(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
TYPE_1__ *glXGetVisualFromFBConfig(int /*<<< orphan*/ *, TYPE_1__);
scalar_t__ glXMakeCurrent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char const *, char const *);
int /*<<< orphan*/ stderr;
Bool print_version(Display *dpy, int scrnum, Bool allowDirect,
                   Bool coreProfile) {
  Window win;
  XSetWindowAttributes attr;
  unsigned long mask;
  Window root;
  GLXContext ctx = NULL;
  XVisualInfo *visinfo = NULL;
  int width = 100, height = 100;
  GLXFBConfig *fbconfigs;
  const char *oglstring = coreProfile ? "OpenGL core profile" : "OpenGL";
  root = RootWindow(dpy, scrnum);
  fbconfigs = choose_fb_config(dpy, scrnum);
  if (fbconfigs) {
    ctx =
        create_context_with_config(dpy, fbconfigs[0], coreProfile, allowDirect);
    visinfo = glXGetVisualFromFBConfig(dpy, fbconfigs[0]);
    XFree(fbconfigs);
  }
  if (!visinfo) {
    fprintf(stderr, "Error: couldn't find RGB GLX visual or fbconfig\n");
    return False;
  }
  if (!ctx) {
    if (!coreProfile)
      fprintf(stderr, "Error: glXCreateContext failed\n");
    XFree(visinfo);
    return False;
  }
  attr.background_pixel = 0;
  attr.border_pixel = 0;
  attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
  attr.event_mask = StructureNotifyMask | ExposureMask;
  mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
  win = XCreateWindow(dpy, root, 0, 0, width, height, 0, visinfo->depth,
                      InputOutput, visinfo->visual, mask, &attr);
  if (glXMakeCurrent(dpy, win, ctx)) {
    const char *glVersion = (const char *)glGetString(GL_VERSION);
    CheckError(336);
    printf("%s version string: %s\n", oglstring, glVersion);
  } else
    fprintf(stderr, "Error: glXMakeCurrent failed\n");
  glXDestroyContext(dpy, ctx);
  XFree(visinfo);
  XDestroyWindow(dpy, win);
  XSync(dpy, 1);
  return True;
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xc0,%rsp
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
movl   $0x64,-0x7c(%rbp)
movl   $0x64,-0x80(%rbp)
mov    -0x38(%rbp),%rdx
lea    0xdde(%rip),%rax
lea    0xdc3(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x90(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10e0 <RootWindow@plt>
mov    %eax,-0x64(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10b0 <choose_fb_config@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
je     12be <print_version+0xce>
mov    -0x20(%rbp),%rdi
mov    -0x88(%rbp),%rax
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    (%rax),%rsi
call   1100 <create_context_with_config@plt>
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x88(%rbp),%rax
mov    (%rax),%rsi
call   1110 <glXGetVisualFromFBConfig@plt>
mov    %rax,-0x78(%rbp)
mov    -0x88(%rbp),%rdi
call   1060 <XFree@plt>
cmpq   $0x0,-0x78(%rbp)
jne    12f1 <print_version+0x101>
mov    0x2cd0(%rip),%rax
mov    (%rax),%edi
lea    0xd42(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    14ac <print_version+0x2bc>
cmpq   $0x0,-0x70(%rbp)
jne    1338 <print_version+0x148>
cmpq   $0x0,-0x38(%rbp)
jne    131c <print_version+0x12c>
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
lea    0xd35(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x78(%rbp),%rdi
call   1060 <XFree@plt>
mov    0x2cac(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    14ac <print_version+0x2bc>
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    -0x78(%rbp),%rax
mov    (%rax),%edx
mov    0x2c6c(%rip),%rax
mov    (%rax),%ecx
call   10f0 <XCreateColormap@plt>
mov    %eax,-0x54(%rbp)
mov    0x2c3b(%rip),%rax
mov    (%rax),%eax
mov    0x2c1a(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x58(%rbp)
mov    0x2c5e(%rip),%rax
mov    (%rax),%rax
mov    0x2c64(%rip),%rcx
or     (%rcx),%rax
mov    0x2c2a(%rip),%rcx
or     (%rcx),%rax
mov    0x2be8(%rip),%rcx
or     (%rcx),%rax
mov    %rax,-0x60(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    -0x7c(%rbp),%r8d
mov    -0x80(%rbp),%r9d
mov    -0x78(%rbp),%rax
mov    0x4(%rax),%r14d
mov    0x2bd3(%rip),%rax
mov    (%rax),%ebx
mov    -0x78(%rbp),%rax
mov    (%rax),%r11d
mov    -0x60(%rbp),%r10
xor    %ecx,%ecx
lea    -0x58(%rbp),%rax
mov    %ecx,%edx
movl   $0x0,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   10c0 <XCreateWindow@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x70(%rbp),%rdx
call   1070 <glXMakeCurrent@plt>
cmp    $0x0,%rax
je     1459 <print_version+0x269>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
call   10a0 <glGetString@plt>
mov    %rax,-0x98(%rbp)
mov    $0x150,%edi
call   1040 <CheckError@plt>
mov    -0x90(%rbp),%rsi
mov    -0x98(%rbp),%rdx
lea    0xc1d(%rip),%rdi
call   1050 <printf@plt>
jmp    146e <print_version+0x27e>
mov    0x2b40(%rip),%rax
mov    (%rax),%edi
lea    0xc1a(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x70(%rbp),%rsi
call   1030 <glXDestroyContext@plt>
mov    -0x78(%rbp),%rdi
call   1060 <XFree@plt>
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1080 <XDestroyWindow@plt>
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   10d0 <XSync@plt>
mov    0x2b2b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xc0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%rbp
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r12
test   %rcx,%rcx
lea    0xe01(%rip),%rax
lea    0xde6(%rip),%r15
cmove  %rax,%r15
call   10e0 <RootWindow@plt>
mov    %eax,0x4(%rsp)
mov    %r12,%rdi
mov    %ebx,%esi
call   10b0 <choose_fb_config@plt>
test   %rax,%rax
je     136d <print_version+0x17d>
mov    %rax,%r13
mov    (%rax),%rsi
mov    %r12,%rdi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1100 <create_context_with_config@plt>
mov    %rax,%rbx
mov    0x0(%r13),%rsi
mov    %r12,%rdi
call   1110 <glXGetVisualFromFBConfig@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1060 <XFree@plt>
test   %r14,%r14
je     136d <print_version+0x17d>
test   %rbx,%rbx
je     138b <print_version+0x19b>
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
mov    (%r14),%edx
mov    0x2d3c(%rip),%rax
mov    (%rax),%ecx
mov    %r12,%rdi
mov    0x4(%rsp),%r13d
mov    %r13d,%esi
call   10f0 <XCreateColormap@plt>
mov    0x2d03(%rip),%rcx
mov    0x2ce4(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2d29(%rip),%rcx
mov    0x2d32(%rip),%rsi
mov    (%rsi),%rbp
or     (%rcx),%rbp
mov    %eax,0x14(%rsp)
mov    0x2cf1(%rip),%rax
or     (%rax),%rbp
mov    %edx,0x10(%rsp)
mov    0x2cab(%rip),%rax
or     (%rax),%rbp
mov    (%r14),%r10d
mov    0x4(%r14),%eax
mov    %rax,0x8(%rsp)
mov    0x2ca5(%rip),%rcx
mov    %rbx,%r11
mov    (%rcx),%ebx
mov    %r12,%rdi
mov    %r13d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x64,%r8d
mov    $0x64,%r9d
lea    0x10(%rsp),%rax
push   %rax
push   %rbp
push   %r10
push   %rbx
mov    %r11,%rbx
push   0x28(%rsp)
push   $0x0
call   10c0 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    %r12,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1070 <glXMakeCurrent@plt>
test   %rax,%rax
je     13b6 <print_version+0x1c6>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
call   10a0 <glGetString@plt>
mov    %rax,%r13
mov    $0x150,%edi
call   1040 <CheckError@plt>
lea    0xd0c(%rip),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1050 <printf@plt>
jmp    13cb <print_version+0x1db>
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
lea    0xc9e(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2c4f(%rip),%rax
jmp    13fc <print_version+0x20c>
test   %rbp,%rbp
jne    13a5 <print_version+0x1b5>
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
lea    0xcac(%rip),%rsi
call   1090 <fprintf@plt>
mov    %r14,%rdi
call   1060 <XFree@plt>
mov    0x2c24(%rip),%rax
jmp    13fc <print_version+0x20c>
mov    0x2be3(%rip),%rax
mov    (%rax),%edi
lea    0xcbd(%rip),%rsi
call   1090 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <glXDestroyContext@plt>
mov    %r14,%rdi
call   1060 <XFree@plt>
mov    %r12,%rdi
mov    %ebp,%esi
call   1080 <XDestroyWindow@plt>
mov    %r12,%rdi
mov    $0x1,%esi
call   10d0 <XSync@plt>
mov    0x2bd4(%rip),%rax
mov    (%rax),%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_11__ = type { i32, i32, i64, i64 }
%struct.TYPE_10__ = type { i32, i32 }
@.str = [20 x i8] c"OpenGL core profile\00"
@.str.1 = [7 x i8] c"OpenGL\00"
@stderr = global i32 0
@.str.2 = [49 x i8] c"Error: couldn't find RGB GLX visual or fbconfig\0A\00"
@False = global i64 0
@.str.3 = [32 x i8] c"Error: glXCreateContext failed\0A\00"
@AllocNone = global i32 0
@StructureNotifyMask = global i32 0
@ExposureMask = global i32 0
@CWBackPixel = global i64 0
@CWBorderPixel = global i64 0
@CWColormap = global i64 0
@CWEventMask = global i64 0
@InputOutput = global i32 0
@GL_VERSION = global i32 0
@.str.4 = [23 x i8] c"%s version string: %s\0A\00"
@.str.5 = [30 x i8] c"Error: glXMakeCurrent failed\0A\00"
@True = global i64 0
define i64 @print_version(i32* %0, i32 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.TYPE_11__
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32*
%15 = alloca %struct.TYPE_10__*
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.TYPE_10__*
%19 = alloca i8*
%20 = alloca i8*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i32* null, i32** %14
store %struct.TYPE_10__* null, %struct.TYPE_10__** %15
store i32 100, i32* %16
store i32 100, i32* %17
%21 = load i64, i64* %9
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
store i8* %24, i8** %19
%25 = load i32*, i32** %6
%26 = load i32, i32* %7
%27 = call i32 @RootWindow(i32* %25, i32 %26)
store i32 %27, i32* %13
%28 = load i32*, i32** %6
%29 = load i32, i32* %7
%30 = call %struct.TYPE_10__* @choose_fb_config(i32* %28, i32 %29)
store %struct.TYPE_10__* %30, %struct.TYPE_10__** %18
%31 = load %struct.TYPE_10__*, %struct.TYPE_10__** %18
%32 = icmp ne %struct.TYPE_10__* %31, null
br i1 %32, label %33, label %50
33: ; preds = %4
%34 = load i32*, i32** %6
%35 = load %struct.TYPE_10__*, %struct.TYPE_10__** %18
%36 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %35, i64 0
%37 = load i64, i64* %9
%38 = load i64, i64* %8
%39 = bitcast %struct.TYPE_10__* %36 to i64*
%40 = load i64, i64* %39
%41 = call i32* @create_context_with_config(i32* %34, i64 %40, i64 %37, i64 %38)
store i32* %41, i32** %14
%42 = load i32*, i32** %6
%43 = load %struct.TYPE_10__*, %struct.TYPE_10__** %18
%44 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %43, i64 0
%45 = bitcast %struct.TYPE_10__* %44 to i64*
%46 = load i64, i64* %45
%47 = call %struct.TYPE_10__* @glXGetVisualFromFBConfig(i32* %42, i64 %46)
store %struct.TYPE_10__* %47, %struct.TYPE_10__** %15
%48 = load %struct.TYPE_10__*, %struct.TYPE_10__** %18
%49 = call i32 @XFree(%struct.TYPE_10__* %48)
br label %50
50: ; preds = %33, %4
%51 = load %struct.TYPE_10__*, %struct.TYPE_10__** %15
%52 = icmp ne %struct.TYPE_10__* %51, null
br i1 %52, label %57, label %53
53: ; preds = %50
%54 = load i32, i32* @stderr
%55 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%56 = load i64, i64* @False
store i64 %56, i64* %5
br label %133
57: ; preds = %50
%58 = load i32*, i32** %14
%59 = icmp ne i32* %58, null
br i1 %59, label %70, label %60
60: ; preds = %57
%61 = load i64, i64* %9
%62 = icmp ne i64 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %66
66: ; preds = %63, %60
%67 = load %struct.TYPE_10__*, %struct.TYPE_10__** %15
%68 = call i32 @XFree(%struct.TYPE_10__* %67)
%69 = load i64, i64* @False
store i64 %69, i64* %5
br label %133
70: ; preds = %57
%71 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %11, i32 0, i32 3
store i64 0, i64* %71
%72 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %11, i32 0, i32 2
store i64 0, i64* %72
%73 = load i32*, i32** %6
%74 = load i32, i32* %13
%75 = load %struct.TYPE_10__*, %struct.TYPE_10__** %15
%76 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %75, i32 0, i32 0
%77 = load i32, i32* %76
%78 = load i32, i32* @AllocNone
%79 = call i32 @XCreateColormap(i32* %73, i32 %74, i32 %77, i32 %78)
%80 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %11, i32 0, i32 1
store i32 %79, i32* %80
%81 = load i32, i32* @StructureNotifyMask
%82 = load i32, i32* @ExposureMask
%83 = or i32 %81, %82
%84 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %11, i32 0, i32 0
store i32 %83, i32* %84
%85 = load i64, i64* @CWBackPixel
%86 = load i64, i64* @CWBorderPixel
%87 = or i64 %85, %86
%88 = load i64, i64* @CWColormap
%89 = or i64 %87, %88
%90 = load i64, i64* @CWEventMask
%91 = or i64 %89, %90
store i64 %91, i64* %12
%92 = load i32*, i32** %6
%93 = load i32, i32* %13
%94 = load i32, i32* %16
%95 = load i32, i32* %17
%96 = load %struct.TYPE_10__*, %struct.TYPE_10__** %15
%97 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %96, i32 0, i32 1
%98 = load i32, i32* %97
%99 = load i32, i32* @InputOutput
%100 = load %struct.TYPE_10__*, %struct.TYPE_10__** %15
%101 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %100, i32 0, i32 0
%102 = load i32, i32* %101
%103 = load i64, i64* %12
%104 = call i32 @XCreateWindow(i32* %92, i32 %93, i32 0, i32 0, i32 %94, i32 %95, i32 0, i32 %98, i32 %99, i32 %102, i64 %103, %struct.TYPE_11__* %11)
store i32 %104, i32* %10
%105 = load i32*, i32** %6
%106 = load i32, i32* %10
%107 = load i32*, i32** %14
%108 = call i64 @glXMakeCurrent(i32* %105, i32 %106, i32* %107)
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %118
110: ; preds = %70
%111 = load i32, i32* @GL_VERSION
%112 = call i64 @glGetString(i32 %111)
%113 = inttoptr i64 %112 to i8*
store i8* %113, i8** %20
%114 = call i32 @CheckError(i32 336)
%115 = load i8*, i8** %19
%116 = load i8*, i8** %20
%117 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %115, i8* %116)
br label %121
118: ; preds = %70
%119 = load i32, i32* @stderr
%120 = call i32 @fprintf(i32 %119, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %121
121: ; preds = %118, %110
%122 = load i32*, i32** %6
%123 = load i32*, i32** %14
%124 = call i32 @glXDestroyContext(i32* %122, i32* %123)
%125 = load %struct.TYPE_10__*, %struct.TYPE_10__** %15
%126 = call i32 @XFree(%struct.TYPE_10__* %125)
%127 = load i32*, i32** %6
%128 = load i32, i32* %10
%129 = call i32 @XDestroyWindow(i32* %127, i32 %128)
%130 = load i32*, i32** %6
%131 = call i32 @XSync(i32* %130, i32 1)
%132 = load i64, i64* @True
store i64 %132, i64* %5
br label %133
133: ; preds = %121, %66, %53
%134 = load i64, i64* %5
ret i64 %134
}

LLVM IR (-O2):
%struct.TYPE_11__ = type { i32, i32, i64, i64 }
%struct.TYPE_10__ = type { i32, i32 }
@.str = [20 x i8] c"OpenGL core profile\00"
@.str.1 = [7 x i8] c"OpenGL\00"
@stderr = global i32 0
@.str.2 = [49 x i8] c"Error: couldn't find RGB GLX visual or fbconfig\0A\00"
@False = global i64 0
@.str.3 = [32 x i8] c"Error: glXCreateContext failed\0A\00"
@AllocNone = global i32 0
@StructureNotifyMask = global i32 0
@ExposureMask = global i32 0
@CWBackPixel = global i64 0
@CWBorderPixel = global i64 0
@CWColormap = global i64 0
@CWEventMask = global i64 0
@InputOutput = global i32 0
@GL_VERSION = global i32 0
@.str.4 = [23 x i8] c"%s version string: %s\0A\00"
@.str.5 = [30 x i8] c"Error: glXMakeCurrent failed\0A\00"
@True = global i64 0
define i64 @print_version(i32* %0, i32 %1, i64 %2, i64 %3) {
%5 = alloca %struct.TYPE_11__
%6 = bitcast %struct.TYPE_11__* %5 to i8*
%7 = icmp eq i64 %3, 0
%8 = select i1 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
%9 = tail call i32 @RootWindow(i32* %0, i32 %1)
%10 = tail call %struct.TYPE_10__* @choose_fb_config(i32* %0, i32 %1)
%11 = icmp eq %struct.TYPE_10__* %10, null
br i1 %11, label %20, label %12
12: ; preds = %4
%13 = bitcast %struct.TYPE_10__* %10 to i64*
%14 = load i64, i64* %13
%15 = tail call i32* @create_context_with_config(i32* %0, i64 %14, i64 %3, i64 %2)
%16 = load i64, i64* %13
%17 = tail call %struct.TYPE_10__* @glXGetVisualFromFBConfig(i32* %0, i64 %16)
%18 = tail call i32 @XFree(%struct.TYPE_10__* %10)
%19 = icmp eq %struct.TYPE_10__* %17, null
br i1 %19, label %20, label %23
20: ; preds = %4, %12
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
br label %71
23: ; preds = %12
%24 = icmp eq i32* %15, null
br i1 %24, label %25, label %31
25: ; preds = %23
br i1 %7, label %26, label %29
26: ; preds = %25
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %26, %25
%30 = tail call i32 @XFree(%struct.TYPE_10__* %17)
br label %71
31: ; preds = %23
%32 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %5, i64 0, i32 2
%33 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %17, i64 0, i32 0
%34 = bitcast i64* %32 to i8*
%35 = load i32, i32* %33
%36 = load i32, i32* @AllocNone
%37 = tail call i32 @XCreateColormap(i32* %0, i32 %9, i32 %35, i32 %36)
%38 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %5, i64 0, i32 1
store i32 %37, i32* %38
%39 = load i32, i32* @StructureNotifyMask
%40 = load i32, i32* @ExposureMask
%41 = or i32 %40, %39
%42 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %5, i64 0, i32 0
store i32 %41, i32* %42
%43 = load i64, i64* @CWBackPixel
%44 = load i64, i64* @CWBorderPixel
%45 = or i64 %44, %43
%46 = load i64, i64* @CWColormap
%47 = or i64 %45, %46
%48 = load i64, i64* @CWEventMask
%49 = or i64 %47, %48
%50 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %17, i64 0, i32 1
%51 = load i32, i32* %50
%52 = load i32, i32* @InputOutput
%53 = load i32, i32* %33
%54 = call i32 @XCreateWindow(i32* %0, i32 %9, i32 0, i32 0, i32 100, i32 100, i32 0, i32 %51, i32 %52, i32 %53, i64 %49, %struct.TYPE_11__* %5)
%55 = call i64 @glXMakeCurrent(i32* %0, i32 %54, i32* %15)
%56 = icmp eq i64 %55, 0
br i1 %56, label %63, label %57
57: ; preds = %31
%58 = load i32, i32* @GL_VERSION
%59 = call i64 @glGetString(i32 %58)
%60 = inttoptr i64 %59 to i8*
%61 = call i32 @CheckError(i32 336)
%62 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %8, i8* %60)
br label %66
63: ; preds = %31
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %66
66: ; preds = %63, %57
%67 = call i32 @glXDestroyContext(i32* %0, i32* %15)
%68 = call i32 @XFree(%struct.TYPE_10__* %17)
%69 = call i32 @XDestroyWindow(i32* %0, i32 %54)
%70 = call i32 @XSync(i32* %0, i32 1)
br label %71
71: ; preds = %66, %29, %20
%72 = phi i64* [ @True, %66 ], [ @False, %29 ], [ @False, %20 ]
%73 = load i64, i64* %72
ret i64 %73
}