#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 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__ 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;
    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();
  } 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    $0x150,%rsp
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2d1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2c89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x1,-0x48(%rbp)
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
movl   $0x1,-0x40(%rbp)
mov    0x2cd3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
mov    0x2cb8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2ccc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    0x2c38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
movl   $0x1,-0x78(%rbp)
mov    0x2ca5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
movl   $0x1,-0x70(%rbp)
mov    0x2c82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
movl   $0x1,-0x68(%rbp)
mov    0x2c27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2c5b(%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   2160 <RootWindow@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   2180 <glXChooseVisual@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    23e9 <print_screen_info+0x159>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x80(%rbp),%rdx
call   2180 <glXChooseVisual@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
jne    23e4 <print_screen_info+0x154>
mov    0x2b97(%rip),%rax
mov    (%rax),%edi
lea    0xc26(%rip),%rsi
call   2110 <fprintf@plt>
jmp    28d7 <print_screen_info+0x647>
jmp    23e9 <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    0x2b87(%rip),%rax
mov    (%rax),%ecx
call   2170 <XCreateColormap@plt>
mov    %eax,-0x94(%rbp)
mov    0x2b4b(%rip),%rax
mov    (%rax),%eax
mov    0x2b0a(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x98(%rbp)
mov    0x2b9b(%rip),%rax
mov    (%rax),%rax
mov    0x2ba1(%rip),%rcx
or     (%rcx),%rax
mov    0x2b3f(%rip),%rcx
or     (%rcx),%rax
mov    0x2ad5(%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    0x2ab9(%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   2150 <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   2140 <glXCreateContext@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jne    252c <print_screen_info+0x29c>
mov    0x2a5b(%rip),%rax
mov    (%rax),%edi
lea    0xb0f(%rip),%rsi
call   2110 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   2100 <XDestroyWindow@plt>
jmp    28d7 <print_screen_info+0x647>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0xa8(%rbp),%edx
call   20f0 <glXMakeCurrent@plt>
cmp    $0x0,%rax
je     28a7 <print_screen_info+0x617>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2a6a(%rip),%rax
mov    (%rax),%edx
call   2080 <glXQueryServerString@plt>
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2a66(%rip),%rax
mov    (%rax),%edx
call   2080 <glXQueryServerString@plt>
mov    %rax,-0xc8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x29ca(%rip),%rax
mov    (%rax),%edx
call   2080 <glXQueryServerString@plt>
mov    %rax,-0xd0(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2a19(%rip),%rax
mov    (%rax),%esi
call   2050 <glXGetClientString@plt>
mov    %rax,-0xd8(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2a18(%rip),%rax
mov    (%rax),%esi
call   2050 <glXGetClientString@plt>
mov    %rax,-0xe0(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x297f(%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    0x29a7(%rip),%rax
mov    (%rax),%edi
call   2130 <glGetString@plt>
mov    %rax,-0xf8(%rbp)
mov    0x296a(%rip),%rax
mov    (%rax),%edi
call   2130 <glGetString@plt>
mov    %rax,-0x100(%rbp)
mov    0x295d(%rip),%rax
mov    (%rax),%edi
call   2130 <glGetString@plt>
mov    %rax,-0x108(%rbp)
mov    0x2920(%rip),%rax
mov    (%rax),%edi
call   2130 <glGetString@plt>
mov    %rax,-0x110(%rbp)
movq   $0x0,-0x118(%rbp)
movq   $0x0,-0x120(%rbp)
movq   $0x0,-0x128(%rbp)
mov    -0x18(%rbp),%rdi
call   21b0 <DisplayString@plt>
mov    %eax,%edi
call   20b0 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   2120 <malloc@plt>
mov    %rax,-0x118(%rbp)
cmp    $0x0,%rax
jne    26bb <print_screen_info+0x42b>
mov    0x28c5(%rip),%rax
mov    (%rax),%edi
lea    0x999(%rip),%rsi
call   2110 <fprintf@plt>
mov    $0x1,%edi
call   21a0 <exit@plt>
mov    -0x118(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x18(%rbp),%rdi
call   21b0 <DisplayString@plt>
mov    -0x130(%rbp),%rdi
mov    %eax,%esi
call   2060 <strcpy@plt>
mov    -0x118(%rbp),%rdi
mov    $0x3a,%esi
call   20e0 <strrchr@plt>
mov    %rax,-0x120(%rbp)
cmpq   $0x0,-0x120(%rbp)
je     273b <print_screen_info+0x4ab>
mov    -0x120(%rbp),%rdi
mov    $0x2e,%esi
call   20c0 <strchr@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     2736 <print_screen_info+0x4a6>
mov    -0x128(%rbp),%rax
movb   $0x0,(%rax)
jmp    273b <print_screen_info+0x4ab>
mov    -0x118(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0x911(%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    0x918(%rip),%rsi
lea    0x90d(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0x8e8(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xc0(%rbp),%rsi
lea    0x8f0(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xc8(%rbp),%rsi
lea    0x8f9(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x90a(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xd0(%rbp),%rdi
call   2190 <print_extension_list@plt>
mov    -0xd8(%rbp),%rsi
lea    0x901(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xe0(%rbp),%rsi
lea    0x90a(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x91b(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xe8(%rbp),%rdi
call   2190 <print_extension_list@plt>
lea    0x919(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0xf0(%rbp),%rdi
call   2190 <print_extension_list@plt>
mov    -0xf8(%rbp),%rsi
lea    0x909(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x100(%rbp),%rsi
lea    0x90e(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x108(%rbp),%rsi
lea    0x915(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
lea    0x922(%rip),%rdi
mov    $0x0,%al
call   20d0 <printf@plt>
mov    -0x110(%rbp),%rdi
call   2190 <print_extension_list@plt>
cmpq   $0x0,-0x28(%rbp)
je     28a2 <print_screen_info+0x612>
mov    $0x0,%al
call   20a0 <print_limits@plt>
jmp    28bc <print_screen_info+0x62c>
mov    0x26ba(%rip),%rax
mov    (%rax),%edi
lea    0x8fc(%rip),%rsi
call   2110 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0xa8(%rbp),%esi
call   2030 <glXDestroyContext@plt>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   2100 <XDestroyWindow@plt>
add    $0x150,%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    $0xc8,%rsp
mov    %rcx,%r13
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
mov    0x2d0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x2c78(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x14(%rsp)
movl   $0x1,0x18(%rsp)
mov    0x2ce3(%rip),%rdx
mov    (%rdx),%edx
mov    %edx,0x1c(%rsp)
movl   $0x1,0x20(%rsp)
mov    0x2cbe(%rip),%rsi
mov    (%rsi),%esi
mov    %esi,0x24(%rsp)
movl   $0x1,0x28(%rsp)
mov    0x2ca1(%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    0x2c2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4c(%rsp)
mov    %edi,0x50(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
call   2170 <RootWindow@plt>
mov    %eax,%r12d
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   2190 <glXChooseVisual@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    238d <print_screen_info+0xed>
lea    0x30(%rsp),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   2190 <glXChooseVisual@plt>
mov    %rax,%rbp
test   %rax,%rax
je     2761 <print_screen_info+0x4c1>
mov    %ebx,0xc(%rsp)
mov    %r13,0xa8(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0xb8(%rsp)
mov    0x0(%rbp),%edx
mov    0x2bf2(%rip),%rax
mov    (%rax),%ecx
mov    %r15,%rdi
mov    %r12d,%esi
call   2180 <XCreateColormap@plt>
mov    0x2bb6(%rip),%rcx
mov    0x2b77(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2c0c(%rip),%rcx
mov    0x2c15(%rip),%rsi
mov    (%rsi),%rbx
or     (%rcx),%rbx
mov    %eax,0xb4(%rsp)
mov    0x2ba9(%rip),%rax
or     (%rax),%rbx
mov    %edx,0xb0(%rsp)
mov    0x2b38(%rip),%rax
or     (%rax),%rbx
mov    0x0(%rbp),%eax
mov    0x4(%rbp),%r10d
mov    0x2b3f(%rip),%rcx
mov    (%rcx),%r11d
lea    0xb0(%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   2160 <XCreateWindow@plt>
add    $0x30,%rsp
mov    %eax,%ebx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
mov    %r14d,%ecx
call   2150 <glXCreateContext@plt>
test   %eax,%eax
je     270e <print_screen_info+0x46e>
mov    %eax,%r12d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   2100 <glXMakeCurrent@plt>
test   %rax,%rax
je     2725 <print_screen_info+0x485>
mov    %ebx,0x8(%rsp)
mov    0x2b3e(%rip),%r14
mov    (%r14),%edx
mov    %r15,%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
call   2090 <glXQueryServerString@plt>
mov    %rax,0x78(%rsp)
mov    0x2b39(%rip),%r13
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   2090 <glXQueryServerString@plt>
mov    %rax,0x68(%rsp)
mov    0x2a9f(%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    0x2a90(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,0x98(%rsp)
mov    0x2a52(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,0x90(%rsp)
mov    0x2a44(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,0x88(%rsp)
mov    0x2a06(%rip),%rax
mov    (%rax),%edi
call   2140 <glGetString@plt>
mov    %rax,%r13
mov    %r15,%rdi
call   21c0 <DisplayString@plt>
mov    %eax,%edi
call   20c0 <strlen@plt>
lea    0x1(%rax),%rdi
call   2130 <malloc@plt>
test   %rax,%rax
je     2778 <print_screen_info+0x4d8>
mov    %rax,%r14
mov    %r15,%rdi
call   21c0 <DisplayString@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   2060 <strcpy@plt>
mov    %r14,%rdi
mov    $0x3a,%esi
call   20f0 <strrchr@plt>
test   %rax,%rax
mov    0xa8(%rsp),%rbp
je     25c9 <print_screen_info+0x329>
mov    %rax,%rdi
mov    $0x2e,%esi
call   20d0 <strchr@plt>
test   %rax,%rax
je     25c9 <print_screen_info+0x329>
movb   $0x0,(%rax)
lea    0xa8d(%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    0xa97(%rip),%rax
lea    0xa8c(%rip),%rsi
cmove  %rax,%rsi
lea    0xa6b(%rip),%rdi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa7a(%rip),%rdi
mov    0x78(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa85(%rip),%rdi
mov    0x68(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xb3d(%rip),%rdi
call   2070 <puts@plt>
mov    0x70(%rsp),%rdi
call   21a0 <print_extension_list@plt>
lea    0xa7b(%rip),%rdi
mov    0x60(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa86(%rip),%rdi
mov    0x58(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xb18(%rip),%rdi
call   2070 <puts@plt>
mov    0x80(%rsp),%rdi
call   21a0 <print_extension_list@plt>
lea    0xb16(%rip),%rdi
call   2070 <puts@plt>
mov    0xa0(%rsp),%rdi
call   21a0 <print_extension_list@plt>
lea    0xa60(%rip),%rdi
mov    0x98(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa64(%rip),%rdi
mov    0x90(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xa6a(%rip),%rdi
mov    0x88(%rsp),%rsi
xor    %eax,%eax
call   20e0 <printf@plt>
lea    0xacb(%rip),%rdi
call   2070 <puts@plt>
mov    %r13,%rdi
call   21a0 <print_extension_list@plt>
test   %rbp,%rbp
mov    0x8(%rsp),%ebx
je     273a <print_screen_info+0x49a>
xor    %eax,%eax
call   20b0 <print_limits@plt>
jmp    273a <print_screen_info+0x49a>
mov    0x2853(%rip),%rax
mov    (%rax),%edi
lea    0x907(%rip),%rsi
call   2120 <fprintf@plt>
jmp    2745 <print_screen_info+0x4a5>
mov    0x283c(%rip),%rax
mov    (%rax),%edi
lea    0xa29(%rip),%rsi
call   2120 <fprintf@plt>
mov    %r15,%rdi
mov    %r12d,%esi
call   2030 <glXDestroyContext@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   2110 <XDestroyWindow@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2800(%rip),%rax
mov    (%rax),%edi
lea    0x88f(%rip),%rsi
call   2120 <fprintf@plt>
jmp    274f <print_screen_info+0x4af>
mov    0x27e9(%rip),%rax
mov    (%rax),%edi
lea    0x8bd(%rip),%rsi
call   2120 <fprintf@plt>
mov    $0x1,%edi
call   21b0 <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
@.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 = [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*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%33 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%34 = load i32, i32* @GLX_RGBA
store i32 %34, i32* %33
%35 = getelementptr inbounds i32, i32* %33, i64 1
%36 = load i32, i32* @GLX_RED_SIZE
store i32 %36, i32* %35
%37 = getelementptr inbounds i32, i32* %35, i64 1
store i32 1, i32* %37
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* @GLX_GREEN_SIZE
store i32 %39, i32* %38
%40 = getelementptr inbounds i32, i32* %38, i64 1
store i32 1, i32* %40
%41 = getelementptr inbounds i32, i32* %40, i64 1
%42 = load i32, i32* @GLX_BLUE_SIZE
store i32 %42, i32* %41
%43 = getelementptr inbounds i32, i32* %41, i64 1
store i32 1, i32* %43
%44 = getelementptr inbounds i32, i32* %43, i64 1
%45 = load i32, i32* @None
store i32 %45, i32* %44
%46 = getelementptr inbounds [9 x i32], [9 x i32]* %11, i64 0, i64 0
%47 = load i32, i32* @GLX_RGBA
store i32 %47, i32* %46
%48 = getelementptr inbounds i32, i32* %46, i64 1
%49 = load i32, i32* @GLX_RED_SIZE
store i32 %49, i32* %48
%50 = getelementptr inbounds i32, i32* %48, i64 1
store i32 1, i32* %50
%51 = getelementptr inbounds i32, i32* %50, i64 1
%52 = load i32, i32* @GLX_GREEN_SIZE
store i32 %52, i32* %51
%53 = getelementptr inbounds i32, i32* %51, i64 1
store i32 1, i32* %53
%54 = getelementptr inbounds i32, i32* %53, i64 1
%55 = load i32, i32* @GLX_BLUE_SIZE
store i32 %55, i32* %54
%56 = getelementptr inbounds i32, i32* %54, i64 1
store i32 1, i32* %56
%57 = getelementptr inbounds i32, i32* %56, i64 1
%58 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %58, i32* %57
%59 = getelementptr inbounds i32, i32* %57, i64 1
%60 = load i32, i32* @None
store i32 %60, i32* %59
store i32 100, i32* %17
store i32 100, i32* %18
%61 = load i32*, i32** %5
%62 = load i32, i32* %6
%63 = call i32 @RootWindow(i32* %61, i32 %62)
store i32 %63, i32* %14
%64 = load i32*, i32** %5
%65 = load i32, i32* %6
%66 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%67 = call %struct.TYPE_6__* @glXChooseVisual(i32* %64, i32 %65, i32* %66)
store %struct.TYPE_6__* %67, %struct.TYPE_6__** %16
%68 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%69 = icmp ne %struct.TYPE_6__* %68, null
br i1 %69, label %81, label %70
70: ; preds = %4
%71 = load i32*, i32** %5
%72 = load i32, i32* %6
%73 = getelementptr inbounds [9 x i32], [9 x i32]* %11, i64 0, i64 0
%74 = call %struct.TYPE_6__* @glXChooseVisual(i32* %71, i32 %72, i32* %73)
store %struct.TYPE_6__* %74, %struct.TYPE_6__** %16
%75 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%76 = icmp ne %struct.TYPE_6__* %75, null
br i1 %76, label %80, label %77
77: ; preds = %70
%78 = load i32, i32* @stderr
%79 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %253
80: ; preds = %70
br label %81
81: ; preds = %80, %4
%82 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 3
store i64 0, i64* %82
%83 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 2
store i64 0, i64* %83
%84 = load i32*, i32** %5
%85 = load i32, i32* %14
%86 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%87 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %86, i32 0, i32 0
%88 = load i32, i32* %87
%89 = load i32, i32* @AllocNone
%90 = call i32 @XCreateColormap(i32* %84, i32 %85, i32 %88, i32 %89)
%91 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 1
store i32 %90, i32* %91
%92 = load i32, i32* @StructureNotifyMask
%93 = load i32, i32* @ExposureMask
%94 = or i32 %92, %93
%95 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i32 0, i32 0
store i32 %94, i32* %95
%96 = load i64, i64* @CWBackPixel
%97 = load i64, i64* @CWBorderPixel
%98 = or i64 %96, %97
%99 = load i64, i64* @CWColormap
%100 = or i64 %98, %99
%101 = load i64, i64* @CWEventMask
%102 = or i64 %100, %101
store i64 %102, i64* %13
%103 = load i32*, i32** %5
%104 = load i32, i32* %14
%105 = load i32, i32* %17
%106 = load i32, i32* %18
%107 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%108 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %107, i32 0, i32 1
%109 = load i32, i32* %108
%110 = load i32, i32* @InputOutput
%111 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%112 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %111, i32 0, i32 0
%113 = load i32, i32* %112
%114 = load i64, i64* %13
%115 = call i32 @XCreateWindow(i32* %103, i32 %104, i32 0, i32 0, i32 %105, i32 %106, i32 0, i32 %109, i32 %110, i32 %113, i64 %114, %struct.TYPE_7__* %12)
store i32 %115, i32* %9
%116 = load i32*, i32** %5
%117 = load %struct.TYPE_6__*, %struct.TYPE_6__** %16
%118 = load i32, i32* %7
%119 = call i32 @glXCreateContext(i32* %116, %struct.TYPE_6__* %117, i32* null, i32 %118)
store i32 %119, i32* %15
%120 = load i32, i32* %15
%121 = icmp ne i32 %120, 0
br i1 %121, label %128, label %122
122: ; preds = %81
%123 = load i32, i32* @stderr
%124 = call i32 @fprintf(i32 %123, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%125 = load i32*, i32** %5
%126 = load i32, i32* %9
%127 = call i32 @XDestroyWindow(i32* %125, i32 %126)
br label %253
128: ; preds = %81
%129 = load i32*, i32** %5
%130 = load i32, i32* %9
%131 = load i32, i32* %15
%132 = call i64 @glXMakeCurrent(i32* %129, i32 %130, i32 %131)
%133 = icmp ne i64 %132, 0
br i1 %133, label %134, label %243
134: ; preds = %128
%135 = load i32*, i32** %5
%136 = load i32, i32* %6
%137 = load i32, i32* @GLX_VENDOR
%138 = call i8* @glXQueryServerString(i32* %135, i32 %136, i32 %137)
store i8* %138, i8** %19
%139 = load i32*, i32** %5
%140 = load i32, i32* %6
%141 = load i32, i32* @GLX_VERSION
%142 = call i8* @glXQueryServerString(i32* %139, i32 %140, i32 %141)
store i8* %142, i8** %20
%143 = load i32*, i32** %5
%144 = load i32, i32* %6
%145 = load i32, i32* @GLX_EXTENSIONS
%146 = call i8* @glXQueryServerString(i32* %143, i32 %144, i32 %145)
store i8* %146, i8** %21
%147 = load i32*, i32** %5
%148 = load i32, i32* @GLX_VENDOR
%149 = call i8* @glXGetClientString(i32* %147, i32 %148)
store i8* %149, i8** %22
%150 = load i32*, i32** %5
%151 = load i32, i32* @GLX_VERSION
%152 = call i8* @glXGetClientString(i32* %150, i32 %151)
store i8* %152, i8** %23
%153 = load i32*, i32** %5
%154 = load i32, i32* @GLX_EXTENSIONS
%155 = call i8* @glXGetClientString(i32* %153, i32 %154)
store i8* %155, i8** %24
%156 = load i32*, i32** %5
%157 = load i32, i32* %6
%158 = call i8* @glXQueryExtensionsString(i32* %156, i32 %157)
store i8* %158, i8** %25
%159 = load i32, i32* @GL_VENDOR
%160 = call i64 @glGetString(i32 %159)
%161 = inttoptr i64 %160 to i8*
store i8* %161, i8** %26
%162 = load i32, i32* @GL_RENDERER
%163 = call i64 @glGetString(i32 %162)
%164 = inttoptr i64 %163 to i8*
store i8* %164, i8** %27
%165 = load i32, i32* @GL_VERSION
%166 = call i64 @glGetString(i32 %165)
%167 = inttoptr i64 %166 to i8*
store i8* %167, i8** %28
%168 = load i32, i32* @GL_EXTENSIONS
%169 = call i64 @glGetString(i32 %168)
%170 = inttoptr i64 %169 to i8*
store i8* %170, i8** %29
store i8* null, i8** %30
store i8* null, i8** %31
store i8* null, i8** %32
%171 = load i32*, i32** %5
%172 = call i32 @DisplayString(i32* %171)
%173 = call i64 @strlen(i32 %172)
%174 = add nsw i64 %173, 1
%175 = call i64 @malloc(i64 %174)
%176 = inttoptr i64 %175 to i8*
store i8* %176, i8** %30
%177 = icmp ne i8* %176, null
br i1 %177, label %182, label %178
178: ; preds = %134
%179 = load i32, i32* @stderr
%180 = call i32 @fprintf(i32 %179, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%181 = call i32 @exit(i32 1)
unreachable
182: ; preds = %134
%183 = load i8*, i8** %30
%184 = load i32*, i32** %5
%185 = call i32 @DisplayString(i32* %184)
%186 = call i32 @strcpy(i8* %183, i32 %185)
%187 = load i8*, i8** %30
%188 = call i8* @strrchr(i8* %187, i8 signext 58)
store i8* %188, i8** %31
%189 = load i8*, i8** %31
%190 = icmp ne i8* %189, null
br i1 %190, label %191, label %199
191: ; preds = %182
%192 = load i8*, i8** %31
%193 = call i8* @strchr(i8* %192, i8 signext 46)
store i8* %193, i8** %32
%194 = load i8*, i8** %32
%195 = icmp ne i8* %194, null
br i1 %195, label %196, label %198
196: ; preds = %191
%197 = load i8*, i8** %32
store i8 0, i8* %197
br label %198
198: ; preds = %196, %191
br label %199
199: ; preds = %198, %182
%200 = load i8*, i8** %30
%201 = load i32, i32* %6
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %200, i32 %201)
%203 = load i8*, i8** %30
%204 = call i32 @free(i8* %203)
%205 = load i32*, i32** %5
%206 = load i32, i32* %15
%207 = call i64 @glXIsDirect(i32* %205, i32 %206)
%208 = icmp ne i64 %207, 0
%209 = zext i1 %208 to i64
%210 = select i1 %208, 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)
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %210)
%212 = load i8*, i8** %19
%213 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %212)
%214 = load i8*, i8** %20
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %214)
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%217 = load i8*, i8** %21
%218 = call i32 @print_extension_list(i8* %217)
%219 = load i8*, i8** %22
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %219)
%221 = load i8*, i8** %23
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %221)
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0))
%224 = load i8*, i8** %24
%225 = call i32 @print_extension_list(i8* %224)
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%227 = load i8*, i8** %25
%228 = call i32 @print_extension_list(i8* %227)
%229 = load i8*, i8** %26
%230 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %229)
%231 = load i8*, i8** %27
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i8* %231)
%233 = load i8*, i8** %28
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* %233)
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0))
%236 = load i8*, i8** %29
%237 = call i32 @print_extension_list(i8* %236)
%238 = load i64, i64* %8
%239 = icmp ne i64 %238, 0
br i1 %239, label %240, label %242
240: ; preds = %199
%241 = call i32 (...) @print_limits()
br label %242
242: ; preds = %240, %199
br label %246
243: ; preds = %128
%244 = load i32, i32* @stderr
%245 = call i32 @fprintf(i32 %244, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0))
br label %246
246: ; preds = %243, %242
%247 = load i32*, i32** %5
%248 = load i32, i32* %15
%249 = call i32 @glXDestroyContext(i32* %247, i32 %248)
%250 = load i32*, i32** %5
%251 = load i32, i32* %9
%252 = call i32 @XDestroyWindow(i32* %250, i32 %251)
br label %253
253: ; preds = %246, %122, %77
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
@.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 = [30 x i8] c"Error: glXMakeCurrent failed\0A\00"
@str = [23 x i8] c"server glx extensions:\00"
@str.19 = [23 x i8] c"client glx extensions:\00"
@str.20 = [16 x i8] c"GLX extensions:\00"
@str.21 = [19 x i8] c"OpenGL 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 %153
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 %153
74: ; preds = %43
%75 = call i64 @glXMakeCurrent(i32* %0, i32 %67, i32 %68)
%76 = icmp eq i64 %75, 0
br i1 %76, label %147, 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 = call i32 @DisplayString(i32* %0)
%104 = call i64 @strlen(i32 %103)
%105 = add nsw i64 %104, 1
%106 = call i64 @malloc(i64 %105)
%107 = inttoptr i64 %106 to i8*
%108 = icmp eq i64 %106, 0
br i1 %108, label %109, label %113
109: ; preds = %77
%110 = load i32, i32* @stderr
%111 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %77
%114 = call i32 @DisplayString(i32* %0)
%115 = call i32 @strcpy(i8* %107, i32 %114)
%116 = call i8* @strrchr(i8* %107, i8 signext 58)
%117 = icmp eq i8* %116, null
br i1 %117, label %122, label %118
118: ; preds = %113
%119 = call i8* @strchr(i8* %116, i8 signext 46)
%120 = icmp eq i8* %119, null
br i1 %120, label %122, label %121
121: ; preds = %118
store i8 0, i8* %119
br label %122
122: ; preds = %118, %121, %113
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %107, i32 %1)
%124 = call i32 @free(i8* %107)
%125 = call i64 @glXIsDirect(i32* %0, i32 %68)
%126 = icmp eq i64 %125, 0
%127 = select i1 %126, 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)
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %127)
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %79)
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %81)
%131 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%132 = call i32 @print_extension_list(i8* %83)
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %85)
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %87)
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.19, i64 0, i64 0))
%136 = call i32 @print_extension_list(i8* %89)
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.20, i64 0, i64 0))
%138 = call i32 @print_extension_list(i8* %90)
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %93)
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i8* %96)
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* %99)
%142 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.21, i64 0, i64 0))
%143 = call i32 @print_extension_list(i8* %102)
%144 = icmp eq i64 %3, 0
br i1 %144, label %150, label %145
145: ; preds = %122
%146 = call i32 (...) @print_limits()
br label %150
147: ; preds = %74
%148 = load i32, i32* @stderr
%149 = call i32 @fprintf(i32 %148, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0))
br label %150
150: ; preds = %122, %145, %147
%151 = call i32 @glXDestroyContext(i32* %0, i32 %68)
%152 = call i32 @XDestroyWindow(i32* %0, i32 %67)
br label %153
153: ; preds = %150, %70, %40
ret void
}