#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_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

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

/* Variables and functions */
int /*<<< orphan*/ AllocNone;
unsigned long CWBackPixel;
unsigned long CWBorderPixel;
unsigned long CWColormap;
unsigned long CWEventMask;
int /*<<< orphan*/ DisplayString(int /*<<< orphan*/ *);
int ExposureMask;
int /*<<< orphan*/ GLU_EXTENSIONS;
int /*<<< orphan*/ GLU_VERSION;
int GLX_BLUE_SIZE;
int GLX_DOUBLEBUFFER;
int /*<<< orphan*/ GLX_EXTENSIONS;
int GLX_GREEN_SIZE;
int GLX_RED_SIZE;
int GLX_RGBA;
int /*<<< orphan*/ GLX_VENDOR;
int /*<<< orphan*/ GLX_VERSION;
int /*<<< orphan*/ GL_EXTENSIONS;
int /*<<< orphan*/ GL_RENDERER;
int /*<<< orphan*/ GL_VENDOR;
int /*<<< orphan*/ GL_VERSION;
int /*<<< orphan*/ InputOutput;
int None;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int);
int StructureNotifyMask;
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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ glGetString(int /*<<< orphan*/);
TYPE_1__ *glXChooseVisual(int /*<<< orphan*/ *, int, int *);
int /*<<< orphan*/ glXCreateContext(int /*<<< orphan*/ *, TYPE_1__ *,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ glXDestroyContext(int /*<<< orphan*/ *, int /*<<< orphan*/);
char *glXGetClientString(int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ glXIsDirect(int /*<<< orphan*/ *, int /*<<< orphan*/);
scalar_t__ glXMakeCurrent(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
char *glXQueryExtensionsString(int /*<<< orphan*/ *, int);
char *glXQueryServerString(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ gluGetString(int /*<<< orphan*/);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ print_extension_list(char const *);
int /*<<< orphan*/ print_limits();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
scalar_t__ strlen(int /*<<< orphan*/);
char *strrchr(char *, char);
void print_screen_info(Display *dpy, int scrnum, Bool allowDirect,
                       GLboolean limits) {
  Window win;
  int attribSingle[] = {GLX_RGBA, GLX_RED_SIZE,  1, GLX_GREEN_SIZE,
                        1,        GLX_BLUE_SIZE, 1, None};
  int attribDouble[] = {GLX_RGBA, GLX_RED_SIZE,  1, GLX_GREEN_SIZE,
                        1,        GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER,
                        None};
  XSetWindowAttributes attr;
  unsigned long mask;
  Window root;
  GLXContext ctx;
  XVisualInfo *visinfo;
  int width = 100, height = 100;
  root = RootWindow(dpy, scrnum);
  visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
  if (!visinfo) {
    visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
    if (!visinfo) {
      fprintf(stderr, "Error: couldn't find RGB GLX visual\n");
      return;
    }
  }
  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);
  ctx = glXCreateContext(dpy, visinfo, NULL, allowDirect);
  if (!ctx) {
    fprintf(stderr, "Error: glXCreateContext failed\n");
    XDestroyWindow(dpy, win);
    return;
  }
  if (glXMakeCurrent(dpy, win, ctx)) {
    const char *serverVendor = glXQueryServerString(dpy, scrnum, GLX_VENDOR);
    const char *serverVersion = glXQueryServerString(dpy, scrnum, GLX_VERSION);
    const char *serverExtensions =
        glXQueryServerString(dpy, scrnum, GLX_EXTENSIONS);
    const char *clientVendor = glXGetClientString(dpy, GLX_VENDOR);
    const char *clientVersion = glXGetClientString(dpy, GLX_VERSION);
    const char *clientExtensions = glXGetClientString(dpy, GLX_EXTENSIONS);
    const char *glxExtensions = glXQueryExtensionsString(dpy, scrnum);
    const char *glVendor = (const char *)glGetString(GL_VENDOR);
    const char *glRenderer = (const char *)glGetString(GL_RENDERER);
    const char *glVersion = (const char *)glGetString(GL_VERSION);
    const char *glExtensions = (const char *)glGetString(GL_EXTENSIONS);
    char *displayName = NULL;
    char *colon = NULL, *period = NULL;
    const char *gluVersion = (const char *)gluGetString(GLU_VERSION);
    const char *gluExtensions = (const char *)gluGetString(GLU_EXTENSIONS);
    if (!(displayName = (char *)malloc(strlen(DisplayString(dpy)) + 1))) {
      fprintf(stderr, "Error: malloc() failed\n");
      exit(1);
    }
    strcpy(displayName, DisplayString(dpy));
    colon = strrchr(displayName, ':');
    if (colon) {
      period = strchr(colon, '.');
      if (period)
        *period = '\0';
    }
    printf("display: %s  screen: %d\n", displayName, scrnum);
    free(displayName);
    printf("direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No");
    printf("server glx vendor string: %s\n", serverVendor);
    printf("server glx version string: %s\n", serverVersion);
    printf("server glx extensions:\n");
    print_extension_list(serverExtensions);
    printf("client glx vendor string: %s\n", clientVendor);
    printf("client glx version string: %s\n", clientVersion);
    printf("client glx extensions:\n");
    print_extension_list(clientExtensions);
    printf("GLX extensions:\n");
    print_extension_list(glxExtensions);
    printf("OpenGL vendor string: %s\n", glVendor);
    printf("OpenGL renderer string: %s\n", glRenderer);
    printf("OpenGL version string: %s\n", glVersion);
    printf("OpenGL extensions:\n");
    print_extension_list(glExtensions);
    if (limits)
      print_limits();
    printf("glu version: %s\n", gluVersion);
    printf("glu extensions:\n");
    print_extension_list(gluExtensions);
  } else {
    fprintf(stderr, "Error: glXMakeCurrent failed\n");
  }
  glXDestroyContext(dpy, ctx);
  XDestroyWindow(dpy, win);
}


x86 assembly (clang, -O0):
<print_screen_info>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x160,%rsp
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2d0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2c69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x1,-0x48(%rbp)
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
movl   $0x1,-0x40(%rbp)
mov    0x2cc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
mov    0x2ca8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    0x2c18(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
movl   $0x1,-0x78(%rbp)
mov    0x2c95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
movl   $0x1,-0x70(%rbp)
mov    0x2c72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
movl   $0x1,-0x68(%rbp)
mov    0x2c17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2c4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
movl   $0x64,-0xb4(%rbp)
movl   $0x64,-0xb8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   2170 <RootWindow@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   2190 <glXChooseVisual@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    23f9 <print_screen_info+0x159>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x80(%rbp),%rdx
call   2190 <glXChooseVisual@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    23f4 <print_screen_info+0x154>
mov    0x2b87(%rip),%rax
mov    (%rax),%edi
lea    0xc16(%rip),%rsi
call   2120 <fprintf@plt>
jmp    2940 <print_screen_info+0x6a0>
jmp    23f9 <print_screen_info+0x159>
movq   $0x0,-0x88(%rbp)
movq   $0x0,-0x90(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xa4(%rbp),%esi
mov    -0xb0(%rbp),%rax
mov    (%rax),%edx
mov    0x2b77(%rip),%rax
mov    (%rax),%ecx
call   2180 <XCreateColormap@plt>
mov    %eax,-0x94(%rbp)
mov    0x2b3b(%rip),%rax
mov    (%rax),%eax
mov    0x2aea(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x98(%rbp)
mov    0x2b8b(%rip),%rax
mov    (%rax),%rax
mov    0x2b91(%rip),%rcx
or     (%rcx),%rax
mov    0x2b2f(%rip),%rcx
or     (%rcx),%rax
mov    0x2ab5(%rip),%rcx
or     (%rcx),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xa4(%rbp),%esi
mov    -0xb4(%rbp),%r8d
mov    -0xb8(%rbp),%r9d
mov    -0xb0(%rbp),%rax
mov    0x4(%rax),%r14d
mov    0x2aa1(%rip),%rax
mov    (%rax),%ebx
mov    -0xb0(%rbp),%rax
mov    (%rax),%r11d
mov    -0xa0(%rbp),%r10
xor    %ecx,%ecx
lea    -0x98(%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   2160 <XCreateWindow@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xb0(%rbp),%rsi
mov    -0x20(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%edx
call   2150 <glXCreateContext@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jne    253c <print_screen_info+0x29c>
mov    0x2a4b(%rip),%rax
mov    (%rax),%edi
lea    0xaff(%rip),%rsi
call   2120 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   2110 <XDestroyWindow@plt>
jmp    2940 <print_screen_info+0x6a0>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0xa8(%rbp),%edx
call   2100 <glXMakeCurrent@plt>
cmp    $0x0,%rax
je     2910 <print_screen_info+0x670>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2a5a(%rip),%rax
mov    (%rax),%edx
call   2080 <glXQueryServerString@plt>
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2a56(%rip),%rax
mov    (%rax),%edx
call   2080 <glXQueryServerString@plt>
mov    %rax,-0xc8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x29b2(%rip),%rax
mov    (%rax),%edx
call   2080 <glXQueryServerString@plt>
mov    %rax,-0xd0(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2a09(%rip),%rax
mov    (%rax),%esi
call   2050 <glXGetClientString@plt>
mov    %rax,-0xd8(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2a08(%rip),%rax
mov    (%rax),%esi
call   2050 <glXGetClientString@plt>
mov    %rax,-0xe0(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2967(%rip),%rax
mov    (%rax),%esi
call   2050 <glXGetClientString@plt>
mov    %rax,-0xe8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   2090 <glXQueryExtensionsString@plt>
mov    %rax,-0xf0(%rbp)
mov    0x2997(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,-0xf8(%rbp)
mov    0x295a(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,-0x100(%rbp)
mov    0x294d(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,-0x108(%rbp)
mov    0x2908(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,-0x110(%rbp)
movq   $0x0,-0x118(%rbp)
movq   $0x0,-0x120(%rbp)
movq   $0x0,-0x128(%rbp)
mov    0x28ba(%rip),%rax
mov    (%rax),%edi
call   20e0 <gluGetString@plt>
mov    %rax,-0x130(%rbp)
mov    0x28c5(%rip),%rax
mov    (%rax),%edi
call   20e0 <gluGetString@plt>
mov    %rax,-0x138(%rbp)
mov    -0x18(%rbp),%rdi
call   21c0 <DisplayString@plt>
mov    %eax,%edi
call   20b0 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   2130 <malloc@plt>
mov    %rax,-0x118(%rbp)
cmp    $0x0,%rax
jne    26f5 <print_screen_info+0x455>
mov    0x288b(%rip),%rax
mov    (%rax),%edi
lea    0x95f(%rip),%rsi
call   2120 <fprintf@plt>
mov    $0x1,%edi
call   21b0 <exit@plt>
mov    -0x118(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x18(%rbp),%rdi
call   21c0 <DisplayString@plt>
mov    -0x140(%rbp),%rdi
mov    %eax,%esi
call   2060 <strcpy@plt>
mov    -0x118(%rbp),%rdi
mov    $0x3a,%esi
call   20f0 <strrchr@plt>
mov    %rax,-0x120(%rbp)
cmpq   $0x0,-0x120(%rbp)
je     2775 <print_screen_info+0x4d5>
mov    -0x120(%rbp),%rdi
mov    $0x2e,%esi
call   20c0 <strchr@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     2770 <print_screen_info+0x4d0>
mov    -0x128(%rbp),%rax
movb   $0x0,(%rax)
jmp    2775 <print_screen_info+0x4d5>
mov    -0x118(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0x8d7(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x118(%rbp),%rdi
call   2040 <free@plt>
mov    -0x18(%rbp),%rdi
mov    -0xa8(%rbp),%esi
call   2070 <glXIsDirect@plt>
mov    %rax,%rcx
lea    0x8de(%rip),%rsi
lea    0x8d3(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0x8ae(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xc0(%rbp),%rsi
lea    0x8b6(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xc8(%rbp),%rsi
lea    0x8bf(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x8d0(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xd0(%rbp),%rdi
call   21a0 <print_extension_list@plt>
mov    -0xd8(%rbp),%rsi
lea    0x8c7(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xe0(%rbp),%rsi
lea    0x8d0(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x8e1(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xe8(%rbp),%rdi
call   21a0 <print_extension_list@plt>
lea    0x8df(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xf0(%rbp),%rdi
call   21a0 <print_extension_list@plt>
mov    -0xf8(%rbp),%rsi
lea    0x8cf(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x100(%rbp),%rsi
lea    0x8d4(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x108(%rbp),%rsi
lea    0x8db(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x8e8(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x110(%rbp),%rdi
call   21a0 <print_extension_list@plt>
cmpq   $0x0,-0x28(%rbp)
je     28dc <print_screen_info+0x63c>
mov    $0x0,%al
call   20a0 <print_limits@plt>
mov    -0x130(%rbp),%rsi
lea    0x8c9(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x8cc(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x138(%rbp),%rdi
call   21a0 <print_extension_list@plt>
jmp    2925 <print_screen_info+0x685>
mov    0x2651(%rip),%rax
mov    (%rax),%edi
lea    0x8b5(%rip),%rsi
call   2120 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0xa8(%rbp),%esi
call   2030 <glXDestroyContext@plt>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   2110 <XDestroyWindow@plt>
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_screen_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rcx,%r13
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
mov    0x2cfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x2c58(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x14(%rsp)
movl   $0x1,0x18(%rsp)
mov    0x2cd3(%rip),%rdx
mov    (%rdx),%edx
mov    %edx,0x1c(%rsp)
movl   $0x1,0x20(%rsp)
mov    0x2cae(%rip),%rsi
mov    (%rsi),%esi
mov    %esi,0x24(%rsp)
movl   $0x1,0x28(%rsp)
mov    0x2c91(%rip),%rdi
mov    (%rdi),%edi
mov    %edi,0x2c(%rsp)
mov    %eax,0x30(%rsp)
mov    %ecx,0x34(%rsp)
movl   $0x1,0x38(%rsp)
mov    %edx,0x3c(%rsp)
movl   $0x1,0x40(%rsp)
mov    %esi,0x44(%rsp)
movl   $0x1,0x48(%rsp)
mov    0x2c1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4c(%rsp)
mov    %edi,0x50(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
call   2180 <RootWindow@plt>
mov    %eax,%r12d
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   21a0 <glXChooseVisual@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    239d <print_screen_info+0xed>
lea    0x30(%rsp),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   21a0 <glXChooseVisual@plt>
mov    %rax,%rbp
test   %rax,%rax
je     27cc <print_screen_info+0x51c>
mov    %ebx,0xc(%rsp)
mov    %r13,0xb8(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0xc8(%rsp)
mov    0x0(%rbp),%edx
mov    0x2be2(%rip),%rax
mov    (%rax),%ecx
mov    %r15,%rdi
mov    %r12d,%esi
call   2190 <XCreateColormap@plt>
mov    0x2ba6(%rip),%rcx
mov    0x2b57(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2bfc(%rip),%rcx
mov    0x2c05(%rip),%rsi
mov    (%rsi),%rbx
or     (%rcx),%rbx
mov    %eax,0xc4(%rsp)
mov    0x2b99(%rip),%rax
or     (%rax),%rbx
mov    %edx,0xc0(%rsp)
mov    0x2b18(%rip),%rax
or     (%rax),%rbx
mov    0x0(%rbp),%eax
mov    0x4(%rbp),%r10d
mov    0x2b27(%rip),%rcx
mov    (%rcx),%r11d
lea    0xc0(%rsp),%r13
mov    %r15,%rdi
mov    %r12d,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0x64,%r8d
mov    $0x64,%r9d
push   %r13
push   %rbx
push   %rax
push   %r11
push   %r10
push   $0x0
call   2170 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
mov    %r14d,%ecx
call   2160 <glXCreateContext@plt>
test   %eax,%eax
je     2779 <print_screen_info+0x4c9>
mov    %eax,%r12d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   2110 <glXMakeCurrent@plt>
test   %rax,%rax
je     2790 <print_screen_info+0x4e0>
mov    %ebx,0x8(%rsp)
mov    0x2b2e(%rip),%r14
mov    (%r14),%edx
mov    %r15,%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
call   2090 <glXQueryServerString@plt>
mov    %rax,0x78(%rsp)
mov    0x2b29(%rip),%r13
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   2090 <glXQueryServerString@plt>
mov    %rax,0x68(%rsp)
mov    0x2a87(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   2090 <glXQueryServerString@plt>
mov    %rax,0x70(%rsp)
mov    (%r14),%esi
mov    %r15,%rdi
call   2050 <glXGetClientString@plt>
mov    %rax,0x60(%rsp)
mov    0x0(%r13),%esi
mov    %r15,%rdi
call   2050 <glXGetClientString@plt>
mov    %rax,0x58(%rsp)
mov    0x0(%rbp),%esi
mov    %r15,%rdi
call   2050 <glXGetClientString@plt>
mov    %rax,0x80(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
call   20a0 <glXQueryExtensionsString@plt>
mov    %rax,0xa0(%rsp)
mov    0x2a80(%rip),%rax
mov    (%rax),%edi
call   2150 <glGetString@plt>
mov    %rax,0x98(%rsp)
mov    0x2a42(%rip),%rax
mov    (%rax),%edi
call   2150 <glGetString@plt>
mov    %rax,0x90(%rsp)
mov    0x2a34(%rip),%rax
mov    (%rax),%edi
call   2150 <glGetString@plt>
mov    %rax,0x88(%rsp)
mov    0x29ee(%rip),%rax
mov    (%rax),%edi
call   2150 <glGetString@plt>
mov    %rax,0xa8(%rsp)
mov    0x29c0(%rip),%rax
mov    (%rax),%edi
call   20f0 <gluGetString@plt>
mov    %rax,0xb0(%rsp)
mov    0x29ca(%rip),%rax
mov    (%rax),%edi
call   20f0 <gluGetString@plt>
mov    %rax,%r13
mov    %r15,%rdi
call   21d0 <DisplayString@plt>
mov    %eax,%edi
call   20c0 <strlen@plt>
lea    0x1(%rax),%rdi
call   2140 <malloc@plt>
test   %rax,%rax
je     27e3 <print_screen_info+0x533>
mov    %rax,%r14
mov    %r15,%rdi
call   21d0 <DisplayString@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   2060 <strcpy@plt>
mov    %r14,%rdi
mov    $0x3a,%esi
call   2100 <strrchr@plt>
test   %rax,%rax
mov    0xb8(%rsp),%rbp
je     2605 <print_screen_info+0x355>
mov    %rax,%rdi
mov    $0x2e,%esi
call   20d0 <strchr@plt>
test   %rax,%rax
je     2605 <print_screen_info+0x355>
movb   $0x0,(%rax)
lea    0xa51(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   20e0 <printf@plt>
mov    %r14,%rdi
call   2040 <free@plt>
mov    %r15,%rdi
mov    %r12d,%esi
call   2080 <glXIsDirect@plt>
test   %rax,%rax
lea    0xa5b(%rip),%rax
lea    0xa50(%rip),%rsi
cmove  %rax,%rsi
lea    0xa2f(%rip),%rdi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa3e(%rip),%rdi
mov    0x78(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa49(%rip),%rdi
mov    0x68(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xb12(%rip),%rdi
call   2070 <puts@plt>
mov    0x70(%rsp),%rdi
call   21b0 <print_extension_list@plt>
lea    0xa3f(%rip),%rdi
mov    0x60(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa4a(%rip),%rdi
mov    0x58(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xaed(%rip),%rdi
call   2070 <puts@plt>
mov    0x80(%rsp),%rdi
call   21b0 <print_extension_list@plt>
lea    0xaeb(%rip),%rdi
call   2070 <puts@plt>
mov    0xa0(%rsp),%rdi
call   21b0 <print_extension_list@plt>
lea    0xa24(%rip),%rdi
mov    0x98(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa28(%rip),%rdi
mov    0x90(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa2e(%rip),%rdi
mov    0x88(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xaa0(%rip),%rdi
call   2070 <puts@plt>
mov    0xa8(%rsp),%rdi
call   21b0 <print_extension_list@plt>
test   %rbp,%rbp
je     2749 <print_screen_info+0x499>
xor    %eax,%eax
call   20b0 <print_limits@plt>
lea    0xa0e(%rip),%rdi
mov    0xb0(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa78(%rip),%rdi
call   2070 <puts@plt>
mov    %r13,%rdi
call   21b0 <print_extension_list@plt>
mov    0x8(%rsp),%ebx
jmp    27a5 <print_screen_info+0x4f5>
mov    0x27e8(%rip),%rax
mov    (%rax),%edi
lea    0x89c(%rip),%rsi
call   2130 <fprintf@plt>
jmp    27b0 <print_screen_info+0x500>
mov    0x27d1(%rip),%rax
mov    (%rax),%edi
lea    0x9cf(%rip),%rsi
call   2130 <fprintf@plt>
mov    %r15,%rdi
mov    %r12d,%esi
call   2030 <glXDestroyContext@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   2120 <XDestroyWindow@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2795(%rip),%rax
mov    (%rax),%edi
lea    0x824(%rip),%rsi
call   2130 <fprintf@plt>
jmp    27ba <print_screen_info+0x50a>
mov    0x277e(%rip),%rax
mov    (%rax),%edi
lea    0x852(%rip),%rsi
call   2130 <fprintf@plt>
mov    $0x1,%edi
call   21c0 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_7__ = type { i32, i32, i64, i64 }
%struct.TYPE_6__ = type { i32, i32 }
@GLX_RGBA = global i32 0
@GLX_RED_SIZE = global i32 0
@GLX_GREEN_SIZE = global i32 0
@GLX_BLUE_SIZE = global i32 0
@None = global i32 0
@GLX_DOUBLEBUFFER = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"Error: couldn't find RGB GLX visual\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
@.str.1 = [32 x i8] c"Error: glXCreateContext failed\0A\00"
@GLX_VENDOR = global i32 0
@GLX_VERSION = global i32 0
@GLX_EXTENSIONS = global i32 0
@GL_VENDOR = global i32 0
@GL_RENDERER = global i32 0
@GL_VERSION = global i32 0
@GL_EXTENSIONS = global i32 0
@GLU_VERSION = global i32 0
@GLU_EXTENSIONS = global i32 0
@.str.2 = [24 x i8] c"Error: malloc() failed\0A\00"
@.str.3 = [25 x i8] c"display: %s screen: %d\0A\00"
@.str.4 = [22 x i8] c"direct rendering: %s\0A\00"
@.str.5 = [4 x i8] c"Yes\00"
@.str.6 = [3 x i8] c"No\00"
@.str.7 = [30 x i8] c"server glx vendor string: %s\0A\00"
@.str.8 = [31 x i8] c"server glx version string: %s\0A\00"
@.str.9 = [24 x i8] c"server glx extensions:\0A\00"
@.str.10 = [30 x i8] c"client glx vendor string: %s\0A\00"
@.str.11 = [31 x i8] c"client glx version string: %s\0A\00"
@.str.12 = [24 x i8] c"client glx extensions:\0A\00"
@.str.13 = [17 x i8] c"GLX extensions:\0A\00"
@.str.14 = [26 x i8] c"OpenGL vendor string: %s\0A\00"
@.str.15 = [28 x i8] c"OpenGL renderer string: %s\0A\00"
@.str.16 = [27 x i8] c"OpenGL version string: %s\0A\00"
@.str.17 = [20 x i8] c"OpenGL extensions:\0A\00"
@.str.18 = [17 x i8] c"glu version: %s\0A\00"
@.str.19 = [17 x i8] c"glu extensions:\0A\00"
@.str.20 = [30 x i8] c"Error: glXMakeCurrent failed\0A\00"
define void @print_screen_info(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca [8 x i32]
%11 = alloca [9 x i32]
%12 = alloca %struct.TYPE_7__
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.TYPE_6__*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca i8*
%27 = alloca i8*
%28 = alloca i8*
%29 = alloca i8*
%30 = alloca i8*
%31 = alloca i8*
%32 = alloca i8*
%33 = alloca i8*
%34 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%35 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%36 = load i32, i32* @GLX_RGBA
store i32 %36, i32* %35
%37 = getelementptr inbounds i32, i32* %35, i64 1
%38 = load i32, i32* @GLX_RED_SIZE
store i32 %38, i32* %37
%39 = getelementptr inbounds i32, i32* %37, i64 1
store i32 1, i32* %39
%40 = getelementptr inbounds i32, i32* %39, i64 1
%41 = load i32, i32* @GLX_GREEN_SIZE
store i32 %41, i32* %40
%42 = getelementptr inbounds i32, i32* %40, i64 1
store i32 1, i32* %42
%43 = getelementptr inbounds i32, i32* %42, i64 1
%44 = load i32, i32* @GLX_BLUE_SIZE
store i32 %44, i32* %43
%45 = getelementptr inbounds i32, i32* %43, i64 1
store i32 1, i32* %45
%46 = getelementptr inbounds i32, i32* %45, i64 1
%47 = load i32, i32* @None
store i32 %47, i32* %46
%48 = getelementptr inbounds [9 x i32], [9 x i32]* %11, i64 0, i64 0
%49 = load i32, i32* @GLX_RGBA
store i32 %49, i32* %48
%50 = getelementptr inbounds i32, i32* %48, i64 1
%51 = load i32, i32* @GLX_RED_SIZE
store i32 %51, i32* %50
%52 = getelementptr inbounds i32, i32* %50, i64 1
store i32 1, i32* %52
%53 = getelementptr inbounds i32, i32* %52, i64 1
%54 = load i32, i32* @GLX_GREEN_SIZE
store i32 %54, i32* %53
%55 = getelementptr inbounds i32, i32* %53, i64 1
store i32 1, i32* %55
%56 = getelementptr inbounds i32, i32* %55, i64 1
%57 = load i32, i32* @GLX_BLUE_SIZE
store i32 %57, i32* %56
%58 = getelementptr inbounds i32, i32* %56, i64 1
store i32 1, i32* %58
%59 = getelementptr inbounds i32, i32* %58, i64 1
%60 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %60, i32* %59
%61 = getelementptr inbounds i32, i32* %59, i64 1
%62 = load i32, i32* @None
store i32 %62, i32* %61
store i32 100, i32* %17
store i32 100, i32* %18
%63 = load i32*, i32** %5
%64 = load i32, i32* %6
%65 = call i32 @RootWindow(i32* %63, i32 %64)
store i32 %65, i32* %14
%66 = load i32*, i32** %5
%67 = load i32, i32* %6
%68 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%69 = call %struct.TYPE_6__* @glXChooseVisual(i32* %66, i32 %67, i32* %68)
store %struct.TYPE_6__* %69, %struct.TYPE_6__** %16
%70 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%71 = icmp ne %struct.TYPE_6__* %70, null
br i1 %71, label %83, label %72
72: ; preds = %4
%73 = load i32*, i32** %5
%74 = load i32, i32* %6
%75 = getelementptr inbounds [9 x i32], [9 x i32]* %11, i64 0, i64 0
%76 = call %struct.TYPE_6__* @glXChooseVisual(i32* %73, i32 %74, i32* %75)
store %struct.TYPE_6__* %76, %struct.TYPE_6__** %16
%77 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%78 = icmp ne %struct.TYPE_6__* %77, null
br i1 %78, label %82, label %79
79: ; preds = %72
%80 = load i32, i32* @stderr
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %266
82: ; preds = %72
br label %83
83: ; preds = %82, %4
%84 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 3
store i64 0, i64* %84
%85 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 2
store i64 0, i64* %85
%86 = load i32*, i32** %5
%87 = load i32, i32* %14
%88 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%89 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = load i32, i32* @AllocNone
%92 = call i32 @XCreateColormap(i32* %86, i32 %87, i32 %90, i32 %91)
%93 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 1
store i32 %92, i32* %93
%94 = load i32, i32* @StructureNotifyMask
%95 = load i32, i32* @ExposureMask
%96 = or i32 %94, %95
%97 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 0
store i32 %96, i32* %97
%98 = load i64, i64* @CWBackPixel
%99 = load i64, i64* @CWBorderPixel
%100 = or i64 %98, %99
%101 = load i64, i64* @CWColormap
%102 = or i64 %100, %101
%103 = load i64, i64* @CWEventMask
%104 = or i64 %102, %103
store i64 %104, i64* %13
%105 = load i32*, i32** %5
%106 = load i32, i32* %14
%107 = load i32, i32* %17
%108 = load i32, i32* %18
%109 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%110 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %109, i32 0, i32 1
%111 = load i32, i32* %110
%112 = load i32, i32* @InputOutput
%113 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%114 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %113, i32 0, i32 0
%115 = load i32, i32* %114
%116 = load i64, i64* %13
%117 = call i32 @XCreateWindow(i32* %105, i32 %106, i32 0, i32 0, i32 %107, i32 %108, i32 0, i32 %111, i32 %112, i32 %115, i64 %116, %struct.TYPE_7__* %12)
store i32 %117, i32* %9
%118 = load i32*, i32** %5
%119 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%120 = load i32, i32* %7
%121 = call i32 @glXCreateContext(i32* %118, %struct.TYPE_6__* %119, i32* null, i32 %120)
store i32 %121, i32* %15
%122 = load i32, i32* %15
%123 = icmp ne i32 %122, 0
br i1 %123, label %130, label %124
124: ; preds = %83
%125 = load i32, i32* @stderr
%126 = call i32 @fprintf(i32 %125, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%127 = load i32*, i32** %5
%128 = load i32, i32* %9
%129 = call i32 @XDestroyWindow(i32* %127, i32 %128)
br label %266
130: ; preds = %83
%131 = load i32*, i32** %5
%132 = load i32, i32* %9
%133 = load i32, i32* %15
%134 = call i64 @glXMakeCurrent(i32* %131, i32 %132, i32 %133)
%135 = icmp ne i64 %134, 0
br i1 %135, label %136, label %256
136: ; preds = %130
%137 = load i32*, i32** %5
%138 = load i32, i32* %6
%139 = load i32, i32* @GLX_VENDOR
%140 = call i8* @glXQueryServerString(i32* %137, i32 %138, i32 %139)
store i8* %140, i8** %19
%141 = load i32*, i32** %5
%142 = load i32, i32* %6
%143 = load i32, i32* @GLX_VERSION
%144 = call i8* @glXQueryServerString(i32* %141, i32 %142, i32 %143)
store i8* %144, i8** %20
%145 = load i32*, i32** %5
%146 = load i32, i32* %6
%147 = load i32, i32* @GLX_EXTENSIONS
%148 = call i8* @glXQueryServerString(i32* %145, i32 %146, i32 %147)
store i8* %148, i8** %21
%149 = load i32*, i32** %5
%150 = load i32, i32* @GLX_VENDOR
%151 = call i8* @glXGetClientString(i32* %149, i32 %150)
store i8* %151, i8** %22
%152 = load i32*, i32** %5
%153 = load i32, i32* @GLX_VERSION
%154 = call i8* @glXGetClientString(i32* %152, i32 %153)
store i8* %154, i8** %23
%155 = load i32*, i32** %5
%156 = load i32, i32* @GLX_EXTENSIONS
%157 = call i8* @glXGetClientString(i32* %155, i32 %156)
store i8* %157, i8** %24
%158 = load i32*, i32** %5
%159 = load i32, i32* %6
%160 = call i8* @glXQueryExtensionsString(i32* %158, i32 %159)
store i8* %160, i8** %25
%161 = load i32, i32* @GL_VENDOR
%162 = call i64 @glGetString(i32 %161)
%163 = inttoptr i64 %162 to i8*
store i8* %163, i8** %26
%164 = load i32, i32* @GL_RENDERER
%165 = call i64 @glGetString(i32 %164)
%166 = inttoptr i64 %165 to i8*
store i8* %166, i8** %27
%167 = load i32, i32* @GL_VERSION
%168 = call i64 @glGetString(i32 %167)
%169 = inttoptr i64 %168 to i8*
store i8* %169, i8** %28
%170 = load i32, i32* @GL_EXTENSIONS
%171 = call i64 @glGetString(i32 %170)
%172 = inttoptr i64 %171 to i8*
store i8* %172, i8** %29
store i8* null, i8** %30
store i8* null, i8** %31
store i8* null, i8** %32
%173 = load i32, i32* @GLU_VERSION
%174 = call i64 @gluGetString(i32 %173)
%175 = inttoptr i64 %174 to i8*
store i8* %175, i8** %33
%176 = load i32, i32* @GLU_EXTENSIONS
%177 = call i64 @gluGetString(i32 %176)
%178 = inttoptr i64 %177 to i8*
store i8* %178, i8** %34
%179 = load i32*, i32** %5
%180 = call i32 @DisplayString(i32* %179)
%181 = call i64 @strlen(i32 %180)
%182 = add nsw i64 %181, 1
%183 = call i64 @malloc(i64 %182)
%184 = inttoptr i64 %183 to i8*
store i8* %184, i8** %30
%185 = icmp ne i8* %184, null
br i1 %185, label %190, label %186
186: ; preds = %136
%187 = load i32, i32* @stderr
%188 = call i32 @fprintf(i32 %187, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%189 = call i32 @exit(i32 1)
unreachable
190: ; preds = %136
%191 = load i8*, i8** %30
%192 = load i32*, i32** %5
%193 = call i32 @DisplayString(i32* %192)
%194 = call i32 @strcpy(i8* %191, i32 %193)
%195 = load i8*, i8** %30
%196 = call i8* @strrchr(i8* %195, i8 signext 58)
store i8* %196, i8** %31
%197 = load i8*, i8** %31
%198 = icmp ne i8* %197, null
br i1 %198, label %199, label %207
199: ; preds = %190
%200 = load i8*, i8** %31
%201 = call i8* @strchr(i8* %200, i8 signext 46)
store i8* %201, i8** %32
%202 = load i8*, i8** %32
%203 = icmp ne i8* %202, null
br i1 %203, label %204, label %206
204: ; preds = %199
%205 = load i8*, i8** %32
store i8 0, i8* %205
br label %206
206: ; preds = %204, %199
br label %207
207: ; preds = %206, %190
%208 = load i8*, i8** %30
%209 = load i32, i32* %6
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %208, i32 %209)
%211 = load i8*, i8** %30
%212 = call i32 @free(i8* %211)
%213 = load i32*, i32** %5
%214 = load i32, i32* %15
%215 = call i64 @glXIsDirect(i32* %213, i32 %214)
%216 = icmp ne i64 %215, 0
%217 = zext i1 %216 to i64
%218 = select i1 %216, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0)
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %218)
%220 = load i8*, i8** %19
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %220)
%222 = load i8*, i8** %20
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %222)
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%225 = load i8*, i8** %21
%226 = call i32 @print_extension_list(i8* %225)
%227 = load i8*, i8** %22
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %227)
%229 = load i8*, i8** %23
%230 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %229)
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
%232 = load i8*, i8** %24
%233 = call i32 @print_extension_list(i8* %232)
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%235 = load i8*, i8** %25
%236 = call i32 @print_extension_list(i8* %235)
%237 = load i8*, i8** %26
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %237)
%239 = load i8*, i8** %27
%240 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i8* %239)
%241 = load i8*, i8** %28
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* %241)
%243 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0))
%244 = load i8*, i8** %29
%245 = call i32 @print_extension_list(i8* %244)
%246 = load i64, i64* %8
%247 = icmp ne i64 %246, 0
br i1 %247, label %248, label %250
248: ; preds = %207
%249 = call i32 (...) @print_limits()
br label %250
250: ; preds = %248, %207
%251 = load i8*, i8** %33
%252 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i8* %251)
%253 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i64 0, i64 0))
%254 = load i8*, i8** %34
%255 = call i32 @print_extension_list(i8* %254)
br label %259
256: ; preds = %130
%257 = load i32, i32* @stderr
%258 = call i32 @fprintf(i32 %257, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0))
br label %259
259: ; preds = %256, %250
%260 = load i32*, i32** %5
%261 = load i32, i32* %15
%262 = call i32 @glXDestroyContext(i32* %260, i32 %261)
%263 = load i32*, i32** %5
%264 = load i32, i32* %9
%265 = call i32 @XDestroyWindow(i32* %263, i32 %264)
br label %266
266: ; preds = %259, %124, %79
ret void
}

LLVM IR (-O2):
%struct.TYPE_7__ = type { i32, i32, i64, i64 }
%struct.TYPE_6__ = type { i32, i32 }
@GLX_RGBA = global i32 0
@GLX_RED_SIZE = global i32 0
@GLX_GREEN_SIZE = global i32 0
@GLX_BLUE_SIZE = global i32 0
@None = global i32 0
@GLX_DOUBLEBUFFER = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"Error: couldn't find RGB GLX visual\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
@.str.1 = [32 x i8] c"Error: glXCreateContext failed\0A\00"
@GLX_VENDOR = global i32 0
@GLX_VERSION = global i32 0
@GLX_EXTENSIONS = global i32 0
@GL_VENDOR = global i32 0
@GL_RENDERER = global i32 0
@GL_VERSION = global i32 0
@GL_EXTENSIONS = global i32 0
@GLU_VERSION = global i32 0
@GLU_EXTENSIONS = global i32 0
@.str.2 = [24 x i8] c"Error: malloc() failed\0A\00"
@.str.3 = [25 x i8] c"display: %s screen: %d\0A\00"
@.str.4 = [22 x i8] c"direct rendering: %s\0A\00"
@.str.5 = [4 x i8] c"Yes\00"
@.str.6 = [3 x i8] c"No\00"
@.str.7 = [30 x i8] c"server glx vendor string: %s\0A\00"
@.str.8 = [31 x i8] c"server glx version string: %s\0A\00"
@.str.10 = [30 x i8] c"client glx vendor string: %s\0A\00"
@.str.11 = [31 x i8] c"client glx version string: %s\0A\00"
@.str.14 = [26 x i8] c"OpenGL vendor string: %s\0A\00"
@.str.15 = [28 x i8] c"OpenGL renderer string: %s\0A\00"
@.str.16 = [27 x i8] c"OpenGL version string: %s\0A\00"
@.str.18 = [17 x i8] c"glu version: %s\0A\00"
@.str.20 = [30 x i8] c"Error: glXMakeCurrent failed\0A\00"
@str = [23 x i8] c"server glx extensions:\00"
@str.21 = [23 x i8] c"client glx extensions:\00"
@str.22 = [16 x i8] c"GLX extensions:\00"
@str.23 = [19 x i8] c"OpenGL extensions:\00"
@str.24 = [16 x i8] c"glu extensions:\00"
define void @print_screen_info(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca [8 x i32]
%6 = alloca [9 x i32]
%7 = alloca %struct.TYPE_7__
%8 = bitcast [8 x i32]* %5 to i8*
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%10 = load i32, i32* @GLX_RGBA
store i32 %10, i32* %9
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 1
%12 = load i32, i32* @GLX_RED_SIZE
store i32 %12, i32* %11
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 2
store i32 1, i32* %13
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 3
%15 = load i32, i32* @GLX_GREEN_SIZE
store i32 %15, i32* %14
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 4
store i32 1, i32* %16
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 5
%18 = load i32, i32* @GLX_BLUE_SIZE
store i32 %18, i32* %17
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 6
store i32 1, i32* %19
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 7
%21 = load i32, i32* @None
store i32 %21, i32* %20
%22 = bitcast [9 x i32]* %6 to i8*
%23 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 0
store i32 %10, i32* %23
%24 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 1
store i32 %12, i32* %24
%25 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 2
store i32 1, i32* %25
%26 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 3
store i32 %15, i32* %26
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 4
store i32 1, i32* %27
%28 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 5
store i32 %18, i32* %28
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 6
store i32 1, i32* %29
%30 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 7
%31 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %31, i32* %30
%32 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 8
store i32 %21, i32* %32
%33 = bitcast %struct.TYPE_7__* %7 to i8*
%34 = tail call i32 @RootWindow(i32* %0, i32 %1)
%35 = call %struct.TYPE_6__* @glXChooseVisual(i32* %0, i32 %1, i32* %9)
%36 = icmp eq %struct.TYPE_6__* %35, null
br i1 %36, label %37, label %43
37: ; preds = %4
%38 = call %struct.TYPE_6__* @glXChooseVisual(i32* %0, i32 %1, i32* %23)
%39 = icmp eq %struct.TYPE_6__* %38, null
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %163
43: ; preds = %37, %4
%44 = phi %struct.TYPE_6__* [ %35, %4 ], [ %38, %37 ]
%45 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i64 0, i32 2
%46 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %44, i64 0, i32 0
%47 = bitcast i64* %45 to i8*
%48 = load i32, i32* %46
%49 = load i32, i32* @AllocNone
%50 = call i32 @XCreateColormap(i32* %0, i32 %34, i32 %48, i32 %49)
%51 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i64 0, i32 1
store i32 %50, i32* %51
%52 = load i32, i32* @StructureNotifyMask
%53 = load i32, i32* @ExposureMask
%54 = or i32 %53, %52
%55 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i64 0, i32 0
store i32 %54, i32* %55
%56 = load i64, i64* @CWBackPixel
%57 = load i64, i64* @CWBorderPixel
%58 = or i64 %57, %56
%59 = load i64, i64* @CWColormap
%60 = or i64 %58, %59
%61 = load i64, i64* @CWEventMask
%62 = or i64 %60, %61
%63 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %44, i64 0, i32 1
%64 = load i32, i32* %63
%65 = load i32, i32* @InputOutput
%66 = load i32, i32* %46
%67 = call i32 @XCreateWindow(i32* %0, i32 %34, i32 0, i32 0, i32 100, i32 100, i32 0, i32 %64, i32 %65, i32 %66, i64 %62, %struct.TYPE_7__* %7)
%68 = call i32 @glXCreateContext(i32* %0, %struct.TYPE_6__* %44, i32* null, i32 %2)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %43
%71 = load i32, i32* @stderr
%72 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%73 = call i32 @XDestroyWindow(i32* %0, i32 %67)
br label %163
74: ; preds = %43
%75 = call i64 @glXMakeCurrent(i32* %0, i32 %67, i32 %68)
%76 = icmp eq i64 %75, 0
br i1 %76, label %157, label %77
77: ; preds = %74
%78 = load i32, i32* @GLX_VENDOR
%79 = call i8* @glXQueryServerString(i32* %0, i32 %1, i32 %78)
%80 = load i32, i32* @GLX_VERSION
%81 = call i8* @glXQueryServerString(i32* %0, i32 %1, i32 %80)
%82 = load i32, i32* @GLX_EXTENSIONS
%83 = call i8* @glXQueryServerString(i32* %0, i32 %1, i32 %82)
%84 = load i32, i32* @GLX_VENDOR
%85 = call i8* @glXGetClientString(i32* %0, i32 %84)
%86 = load i32, i32* @GLX_VERSION
%87 = call i8* @glXGetClientString(i32* %0, i32 %86)
%88 = load i32, i32* @GLX_EXTENSIONS
%89 = call i8* @glXGetClientString(i32* %0, i32 %88)
%90 = call i8* @glXQueryExtensionsString(i32* %0, i32 %1)
%91 = load i32, i32* @GL_VENDOR
%92 = call i64 @glGetString(i32 %91)
%93 = inttoptr i64 %92 to i8*
%94 = load i32, i32* @GL_RENDERER
%95 = call i64 @glGetString(i32 %94)
%96 = inttoptr i64 %95 to i8*
%97 = load i32, i32* @GL_VERSION
%98 = call i64 @glGetString(i32 %97)
%99 = inttoptr i64 %98 to i8*
%100 = load i32, i32* @GL_EXTENSIONS
%101 = call i64 @glGetString(i32 %100)
%102 = inttoptr i64 %101 to i8*
%103 = load i32, i32* @GLU_VERSION
%104 = call i64 @gluGetString(i32 %103)
%105 = inttoptr i64 %104 to i8*
%106 = load i32, i32* @GLU_EXTENSIONS
%107 = call i64 @gluGetString(i32 %106)
%108 = inttoptr i64 %107 to i8*
%109 = call i32 @DisplayString(i32* %0)
%110 = call i64 @strlen(i32 %109)
%111 = add nsw i64 %110, 1
%112 = call i64 @malloc(i64 %111)
%113 = inttoptr i64 %112 to i8*
%114 = icmp eq i64 %112, 0
br i1 %114, label %115, label %119
115: ; preds = %77
%116 = load i32, i32* @stderr
%117 = call i32 @fprintf(i32 %116, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %77
%120 = call i32 @DisplayString(i32* %0)
%121 = call i32 @strcpy(i8* %113, i32 %120)
%122 = call i8* @strrchr(i8* %113, i8 signext 58)
%123 = icmp eq i8* %122, null
br i1 %123, label %128, label %124
124: ; preds = %119
%125 = call i8* @strchr(i8* %122, i8 signext 46)
%126 = icmp eq i8* %125, null
br i1 %126, label %128, label %127
127: ; preds = %124
store i8 0, i8* %125
br label %128
128: ; preds = %124, %127, %119
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %113, i32 %1)
%130 = call i32 @free(i8* %113)
%131 = call i64 @glXIsDirect(i32* %0, i32 %68)
%132 = icmp eq i64 %131, 0
%133 = select i1 %132, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %133)
%135 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %79)
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %81)
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%138 = call i32 @print_extension_list(i8* %83)
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %85)
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %87)
%141 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.21, i64 0, i64 0))
%142 = call i32 @print_extension_list(i8* %89)
%143 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.22, i64 0, i64 0))
%144 = call i32 @print_extension_list(i8* %90)
%145 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %93)
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i8* %96)
%147 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* %99)
%148 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.23, i64 0, i64 0))
%149 = call i32 @print_extension_list(i8* %102)
%150 = icmp eq i64 %3, 0
br i1 %150, label %153, label %151
151: ; preds = %128
%152 = call i32 (...) @print_limits()
br label %153
153: ; preds = %151, %128
%154 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0), i8* %105)
%155 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.24, i64 0, i64 0))
%156 = call i32 @print_extension_list(i8* %108)
br label %160
157: ; preds = %74
%158 = load i32, i32* @stderr
%159 = call i32 @fprintf(i32 %158, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0))
br label %160
160: ; preds = %157, %153
%161 = call i32 @glXDestroyContext(i32* %0, i32 %68)
%162 = call i32 @XDestroyWindow(i32* %0, i32 %67)
br label %163
163: ; preds = %160, %70, %40
ret void
}