#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 */

/* Type definitions */
typedef int /*<<< orphan*/ XVisualInfo;
typedef int /*<<< orphan*/ GLboolean;
typedef int /*<<< orphan*/ *GLXContext;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int GLX_BLUE_SIZE;
int GLX_DOUBLEBUFFER;
int GLX_GREEN_SIZE;
int GLX_RED_SIZE;
int GLX_RGBA;
int None;
int /*<<< orphan*/ True;
int /*<<< orphan*/ XFree(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *glXChooseVisual(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                    int *);
int /*<<< orphan*/ *glXCreateContext(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ glXDestroyContext(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
scalar_t__ glXIsDirect(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void print_screen_info(Display *dpy, GLboolean limits) {
  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};
  GLXContext ctx = NULL;
  XVisualInfo *visinfo;
  visinfo = glXChooseVisual(dpy, 0, attribSingle);
  if (!visinfo)
    visinfo = glXChooseVisual(dpy, 0, attribDouble);
  if (visinfo)
    ctx = glXCreateContext(dpy, visinfo, NULL, True);
  if (!visinfo) {
    exit(2);
  }
  if (!ctx) {
    fprintf(stderr, "Error: glXCreateContext failed\n");
    XFree(visinfo);
    exit(2);
  }
  if (glXIsDirect(dpy, ctx)) {
    printf("64bits direct rendering is enabled\n");
    exit(0);
  } else {
    printf("64bits direct rendering is not enabled\n");
    exit(1);
  }
  glXDestroyContext(dpy, ctx);
  XFree(visinfo);
}


x86 assembly (clang, -O0):
<print_screen_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2e16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x1,-0x28(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x20(%rbp)
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
mov    0x2e05(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
movl   $0x1,-0x58(%rbp)
mov    0x2dea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
movl   $0x1,-0x50(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x1,-0x48(%rbp)
mov    0x2d9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
movq   $0x0,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
xor    %esi,%esi
call   1080 <glXChooseVisual@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1266 <print_screen_info+0xf6>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
xor    %esi,%esi
call   1080 <glXChooseVisual@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     128f <print_screen_info+0x11f>
mov    -0x8(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    0x2d48(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edx
call   1070 <glXCreateContext@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    12a4 <print_screen_info+0x134>
mov    $0x2,%edi
call   1090 <exit@plt>
cmpq   $0x0,-0x68(%rbp)
jne    12d7 <print_screen_info+0x167>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
lea    0xd41(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x70(%rbp),%rdi
call   1050 <XFree@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1030 <glXIsDirect@plt>
cmp    $0x0,%rax
je     1301 <print_screen_info+0x191>
lea    0xd2b(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xd3c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<print_screen_info>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%r14
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    0x2e1b(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4(%rsp)
movl   $0x1,0x8(%rsp)
mov    0x2e3e(%rip),%rdx
mov    (%rdx),%edx
mov    %edx,0xc(%rsp)
movl   $0x1,0x10(%rsp)
mov    0x2e21(%rip),%rsi
mov    (%rsi),%esi
mov    %esi,0x14(%rsp)
movl   $0x1,0x18(%rsp)
mov    0x2e04(%rip),%rdi
mov    (%rdi),%edi
mov    %edi,0x1c(%rsp)
mov    %eax,0x20(%rsp)
mov    %ecx,0x24(%rsp)
movl   $0x1,0x28(%rsp)
mov    %edx,0x2c(%rsp)
movl   $0x1,0x30(%rsp)
mov    %esi,0x34(%rsp)
movl   $0x1,0x38(%rsp)
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x3c(%rsp)
mov    %edi,0x40(%rsp)
mov    %rsp,%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1080 <glXChooseVisual@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1241 <print_screen_info+0xd1>
lea    0x20(%rsp),%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1080 <glXChooseVisual@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1241 <print_screen_info+0xd1>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    0x2d80(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1070 <glXCreateContext@plt>
test   %rax,%rax
jne    1283 <print_screen_info+0x113>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
lea    0xd94(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <XFree@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <glXIsDirect@plt>
test   %rax,%rax
jne    12a9 <print_screen_info+0x139>
lea    0xd86(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0xd97(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@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
@True = global i32 0
@stderr = global i32 0
@.str = [32 x i8] c"Error: glXCreateContext failed\0A\00"
@.str.1 = [36 x i8] c"64bits direct rendering is enabled\0A\00"
@.str.2 = [40 x i8] c"64bits direct rendering is not enabled\0A\00"
define void @print_screen_info(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [8 x i32]
%6 = alloca [9 x i32]
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%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 i32, i32* %9, i64 1
%12 = load i32, i32* @GLX_RED_SIZE
store i32 %12, i32* %11
%13 = getelementptr inbounds i32, i32* %11, i64 1
store i32 1, i32* %13
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* @GLX_GREEN_SIZE
store i32 %15, i32* %14
%16 = getelementptr inbounds i32, i32* %14, i64 1
store i32 1, i32* %16
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = load i32, i32* @GLX_BLUE_SIZE
store i32 %18, i32* %17
%19 = getelementptr inbounds i32, i32* %17, i64 1
store i32 1, i32* %19
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* @None
store i32 %21, i32* %20
%22 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 0
%23 = load i32, i32* @GLX_RGBA
store i32 %23, i32* %22
%24 = getelementptr inbounds i32, i32* %22, i64 1
%25 = load i32, i32* @GLX_RED_SIZE
store i32 %25, i32* %24
%26 = getelementptr inbounds i32, i32* %24, i64 1
store i32 1, i32* %26
%27 = getelementptr inbounds i32, i32* %26, i64 1
%28 = load i32, i32* @GLX_GREEN_SIZE
store i32 %28, i32* %27
%29 = getelementptr inbounds i32, i32* %27, i64 1
store i32 1, i32* %29
%30 = getelementptr inbounds i32, i32* %29, i64 1
%31 = load i32, i32* @GLX_BLUE_SIZE
store i32 %31, i32* %30
%32 = getelementptr inbounds i32, i32* %30, i64 1
store i32 1, i32* %32
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %34, i32* %33
%35 = getelementptr inbounds i32, i32* %33, i64 1
%36 = load i32, i32* @None
store i32 %36, i32* %35
store i32* null, i32** %7
%37 = load i32*, i32** %3
%38 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%39 = call i32* @glXChooseVisual(i32* %37, i32 0, i32* %38)
store i32* %39, i32** %8
%40 = load i32*, i32** %8
%41 = icmp ne i32* %40, null
br i1 %41, label %46, label %42
42: ; preds = %2
%43 = load i32*, i32** %3
%44 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 0
%45 = call i32* @glXChooseVisual(i32* %43, i32 0, i32* %44)
store i32* %45, i32** %8
br label %46
46: ; preds = %42, %2
%47 = load i32*, i32** %8
%48 = icmp ne i32* %47, null
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i32*, i32** %3
%51 = load i32*, i32** %8
%52 = load i32, i32* @True
%53 = call i32* @glXCreateContext(i32* %50, i32* %51, i32* null, i32 %52)
store i32* %53, i32** %7
br label %54
54: ; preds = %49, %46
%55 = load i32*, i32** %8
%56 = icmp ne i32* %55, null
br i1 %56, label %59, label %57
57: ; preds = %54
%58 = call i32 @exit(i32 2)
unreachable
59: ; preds = %54
%60 = load i32*, i32** %7
%61 = icmp ne i32* %60, null
br i1 %61, label %68, label %62
62: ; preds = %59
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%65 = load i32*, i32** %8
%66 = call i32 @XFree(i32* %65)
%67 = call i32 @exit(i32 2)
unreachable
68: ; preds = %59
%69 = load i32*, i32** %3
%70 = load i32*, i32** %7
%71 = call i64 @glXIsDirect(i32* %69, i32* %70)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %68
%74 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%75 = call i32 @exit(i32 0)
unreachable
76: ; preds = %68
%77 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@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
@True = global i32 0
@stderr = global i32 0
@.str = [32 x i8] c"Error: glXCreateContext failed\0A\00"
@str = [39 x i8] c"64bits direct rendering is not enabled\00"
@str.3 = [35 x i8] c"64bits direct rendering is enabled\00"
define void @print_screen_info(i32* %0, i32 %1) {
%3 = alloca [8 x i32]
%4 = alloca [9 x i32]
%5 = bitcast [8 x i32]* %3 to i8*
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* @GLX_RGBA
store i32 %7, i32* %6
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 1
%9 = load i32, i32* @GLX_RED_SIZE
store i32 %9, i32* %8
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 2
store i32 1, i32* %10
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 3
%12 = load i32, i32* @GLX_GREEN_SIZE
store i32 %12, i32* %11
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 4
store i32 1, i32* %13
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 5
%15 = load i32, i32* @GLX_BLUE_SIZE
store i32 %15, i32* %14
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 6
store i32 1, i32* %16
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 7
%18 = load i32, i32* @None
store i32 %18, i32* %17
%19 = bitcast [9 x i32]* %4 to i8*
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 0
store i32 %7, i32* %20
%21 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 1
store i32 %9, i32* %21
%22 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 2
store i32 1, i32* %22
%23 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 3
store i32 %12, i32* %23
%24 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 4
store i32 1, i32* %24
%25 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 5
store i32 %15, i32* %25
%26 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 6
store i32 1, i32* %26
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 7
%28 = load i32, i32* @GLX_DOUBLEBUFFER
store i32 %28, i32* %27
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 8
store i32 %18, i32* %29
%30 = call i32* @glXChooseVisual(i32* %0, i32 0, i32* %6)
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %37
32: ; preds = %2
%33 = call i32* @glXChooseVisual(i32* %0, i32 0, i32* %20)
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @exit(i32 2)
unreachable
37: ; preds = %2, %32
%38 = phi i32* [ %33, %32 ], [ %30, %2 ]
%39 = load i32, i32* @True
%40 = call i32* @glXCreateContext(i32* %0, i32* %38, i32* null, i32 %39)
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %47
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%45 = call i32 @XFree(i32* %38)
%46 = call i32 @exit(i32 2)
unreachable
47: ; preds = %37
%48 = call i64 @glXIsDirect(i32* %0, i32* %40)
%49 = icmp eq i64 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.3, i64 0, i64 0))
%52 = call i32 @exit(i32 0)
unreachable
53: ; preds = %47
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
}