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

/* Variables and functions */
int /*<<< orphan*/ glXQueryVersion(int /*<<< orphan*/ *, int *, int *);
int check_glxversion(Display *display) {
  int major, minor;
  if (!glXQueryVersion(display, &major, &minor)) {
    return -1;
  }
  return (major > 1 || (major == 1 && minor >= 3)) ? 0 : -1;
}


x86 assembly (clang, -O0):
<check_glxversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <glXQueryVersion@plt>
cmp    $0x0,%eax
jne    1142 <check_glxversion+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <check_glxversion+0x73>
mov    $0x1,%al
cmpl   $0x1,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jg     1170 <check_glxversion+0x60>
xor    %eax,%eax
cmpl   $0x1,-0x14(%rbp)
mov    %al,-0x1a(%rbp)
jne    116a <check_glxversion+0x5a>
cmpl   $0x3,-0x18(%rbp)
setge  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%dl
mov    $0xffffffff,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_glxversion>:
push   %rax
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <glXQueryVersion@plt>
test   %eax,%eax
je     113e <check_glxversion+0x2e>
xor    %eax,%eax
cmpl   $0x1,0x4(%rsp)
jg     113c <check_glxversion+0x2c>
setne  %al
cmpl   $0x3,(%rsp)
setl   %cl
or     %al,%cl
movzbl %cl,%eax
neg    %eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @check_glxversion(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @glXQueryVersion(i32* %6, i32* %4, i32* %5)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 -1, i32* %2
br label %25
10: ; preds = %1
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %21, label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %5
%18 = icmp sge i32 %17, 3
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ false, %13 ], [ %18, %16 ]
br label %21
21: ; preds = %19, %10
%22 = phi i1 [ true, %10 ], [ %20, %19 ]
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 0, i32 -1
store i32 %24, i32* %2
br label %25
25: ; preds = %21, %9
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @check_glxversion(i32* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @glXQueryVersion(i32* %0, i32* %2, i32* %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 1
br i1 %10, label %17, label %11
11: ; preds = %8
%12 = icmp ne i32 %9, 1
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 3
%15 = select i1 %12, i1 true, i1 %14
%16 = sext i1 %15 to i32
br label %17
17: ; preds = %8, %11, %1
%18 = phi i32 [ -1, %1 ], [ 0, %8 ], [ %16, %11 ]
ret i32 %18
}