#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*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ GL_RENDERER;
int /*<<< orphan*/ GL_SHADING_LANGUAGE_VERSION;
int /*<<< orphan*/ GL_VENDOR;
int /*<<< orphan*/ GL_VERSION;
int /*<<< orphan*/ XMapWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *XOpenDisplay(int /*<<< orphan*/ *);
int /*<<< orphan*/ event_loop(int /*<<< orphan*/ *);
int /*<<< orphan*/ glClearColor(double, double, double, double);
scalar_t__ glGetString(int /*<<< orphan*/);
int /*<<< orphan*/ make_rgb_db_window(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ printf(char *, char const *);
int main(int argc, char *argv[]) {
  Display *dpy;
  Window win;
  dpy = XOpenDisplay(NULL);
  win = make_rgb_db_window(dpy, 300, 300);
  {
    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 *glShaderVersion =
        (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
    printf("OpenGL vender: %s\n", glVendor);
    printf("OpenGL render: %s\n", glRenderer);
    printf("OpenGL version: %s\n", glVersion);
    printf("GLSL version: %s\n", glShaderVersion);
  }
  glClearColor(0.5, 0.5, 0.5, 1.0);
  XMapWindow(dpy, win);
  event_loop(dpy);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <XOpenDisplay@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x12c,%edx
mov    %edx,%esi
call   1060 <make_rgb_db_window@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,-0x30(%rbp)
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,-0x38(%rbp)
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
movsd  0xdca(%rip),%xmm2
movsd  0xdca(%rip),%xmm3
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glClearColor@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1090 <XMapWindow@plt>
mov    -0x18(%rbp),%rdi
call   1080 <event_loop@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1040 <XOpenDisplay@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x12c,%esi
mov    $0x12c,%edx
call   1060 <make_rgb_db_window@plt>
mov    %eax,%r14d
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,%r12
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,%r13
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,%rbp
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,%rbx
lea    0xe2b(%rip),%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movsd  0xdde(%rip),%xmm0
movsd  0xdde(%rip),%xmm3
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1050 <glClearColor@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1090 <XMapWindow@plt>
mov    %r15,%rdi
call   1080 <event_loop@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_VENDOR = global i32 0
@GL_RENDERER = global i32 0
@GL_VERSION = global i32 0
@GL_SHADING_LANGUAGE_VERSION = global i32 0
@.str = [19 x i8] c"OpenGL vender: %s\0A\00"
@.str.1 = [19 x i8] c"OpenGL render: %s\0A\00"
@.str.2 = [20 x i8] c"OpenGL version: %s\0A\00"
@.str.3 = [18 x i8] c"GLSL version: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32* @XOpenDisplay(i32* null)
store i32* %12, i32** %6
%13 = load i32*, i32** %6
%14 = call i32 @make_rgb_db_window(i32* %13, i32 300, i32 300)
store i32 %14, i32* %7
%15 = load i32, i32* @GL_VENDOR
%16 = call i64 @glGetString(i32 %15)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %8
%18 = load i32, i32* @GL_RENDERER
%19 = call i64 @glGetString(i32 %18)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %9
%21 = load i32, i32* @GL_VERSION
%22 = call i64 @glGetString(i32 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %10
%24 = load i32, i32* @GL_SHADING_LANGUAGE_VERSION
%25 = call i64 @glGetString(i32 %24)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %11
%27 = load i8*, i8** %8
%28 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %9
%30 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %10
%32 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %11
%34 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = call i32 @glClearColor(double 5.000000e-01, double 5.000000e-01, double 5.000000e-01, double 1.000000e+00)
%36 = load i32*, i32** %6
%37 = load i32, i32* %7
%38 = call i32 @XMapWindow(i32* %36, i32 %37)
%39 = load i32*, i32** %6
%40 = call i32 @event_loop(i32* %39)
ret i32 0
}

LLVM IR (-O2):
@GL_VENDOR = global i32 0
@GL_RENDERER = global i32 0
@GL_VERSION = global i32 0
@GL_SHADING_LANGUAGE_VERSION = global i32 0
@.str = [19 x i8] c"OpenGL vender: %s\0A\00"
@.str.1 = [19 x i8] c"OpenGL render: %s\0A\00"
@.str.2 = [20 x i8] c"OpenGL version: %s\0A\00"
@.str.3 = [18 x i8] c"GLSL version: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @XOpenDisplay(i32* null)
%4 = tail call i32 @make_rgb_db_window(i32* %3, i32 300, i32 300)
%5 = load i32, i32* @GL_VENDOR
%6 = tail call i64 @glGetString(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = load i32, i32* @GL_RENDERER
%9 = tail call i64 @glGetString(i32 %8)
%10 = inttoptr i64 %9 to i8*
%11 = load i32, i32* @GL_VERSION
%12 = tail call i64 @glGetString(i32 %11)
%13 = inttoptr i64 %12 to i8*
%14 = load i32, i32* @GL_SHADING_LANGUAGE_VERSION
%15 = tail call i64 @glGetString(i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %7)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%21 = tail call i32 @glClearColor(double 5.000000e-01, double 5.000000e-01, double 5.000000e-01, double 1.000000e+00)
%22 = tail call i32 @XMapWindow(i32* %3, i32 %4)
%23 = tail call i32 @event_loop(i32* %3)
ret i32 0
}