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

/* Variables and functions */
int const GLX_TEXTURE_2D_EXT;
int const GLX_TEXTURE_FORMAT_EXT;
int const GLX_TEXTURE_FORMAT_RGB_EXT;
int const GLX_TEXTURE_TARGET_EXT;
int const None;
int /*<<< orphan*/ RootWindow(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ XCreatePixmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                 int, int);
int /*<<< orphan*/ XSync(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ glXCreatePixmap(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, int const *);
GLXPixmap CreatePixmap(Display *dpy, GLXFBConfig config, int w, int h,
                       Pixmap *p) {
  GLXPixmap gp;
  const int pixmapAttribs[] = {GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
                               GLX_TEXTURE_FORMAT_EXT,
                               GLX_TEXTURE_FORMAT_RGB_EXT, None};
  Window root = RootWindow(dpy, 0);
  *p = XCreatePixmap(dpy, root, w, h, 24);
  XSync(dpy, 0);
  gp = glXCreatePixmap(dpy, config, *p, pixmapAttribs);
  XSync(dpy, 0);
  return gp;
}


x86 assembly (clang, -O0):
<CreatePixmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <RootWindow@plt>
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    $0x18,%r8d
call   1060 <XCreatePixmap@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <XSync@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    -0x40(%rbp),%rcx
call   1050 <glXCreatePixmap@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <XSync@plt>
mov    -0x24(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreatePixmap>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%rbp
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%r14d
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
xor    %esi,%esi
call   1040 <RootWindow@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    $0x18,%r8d
call   1060 <XCreatePixmap@plt>
mov    %eax,0x0(%rbp)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <XSync@plt>
mov    0x0(%rbp),%edx
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <glXCreatePixmap@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <XSync@plt>
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GLX_TEXTURE_TARGET_EXT = constant i32 0
@GLX_TEXTURE_2D_EXT = constant i32 0
@GLX_TEXTURE_FORMAT_EXT = constant i32 0
@GLX_TEXTURE_FORMAT_RGB_EXT = constant i32 0
@None = constant i32 0
define i32 @CreatePixmap(i32* %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca [5 x i32]
%13 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 0
%15 = load i32, i32* @GLX_TEXTURE_TARGET_EXT
store i32 %15, i32* %14
%16 = getelementptr inbounds i32, i32* %14, i64 1
%17 = load i32, i32* @GLX_TEXTURE_2D_EXT
store i32 %17, i32* %16
%18 = getelementptr inbounds i32, i32* %16, i64 1
%19 = load i32, i32* @GLX_TEXTURE_FORMAT_EXT
store i32 %19, i32* %18
%20 = getelementptr inbounds i32, i32* %18, i64 1
%21 = load i32, i32* @GLX_TEXTURE_FORMAT_RGB_EXT
store i32 %21, i32* %20
%22 = getelementptr inbounds i32, i32* %20, i64 1
%23 = load i32, i32* @None
store i32 %23, i32* %22
%24 = load i32*, i32** %6
%25 = call i32 @RootWindow(i32* %24, i32 0)
store i32 %25, i32* %13
%26 = load i32*, i32** %6
%27 = load i32, i32* %13
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = call i32 @XCreatePixmap(i32* %26, i32 %27, i32 %28, i32 %29, i32 24)
%31 = load i32*, i32** %10
store i32 %30, i32* %31
%32 = load i32*, i32** %6
%33 = call i32 @XSync(i32* %32, i32 0)
%34 = load i32*, i32** %6
%35 = load i32, i32* %7
%36 = load i32*, i32** %10
%37 = load i32, i32* %36
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %12, i64 0, i64 0
%39 = call i32 @glXCreatePixmap(i32* %34, i32 %35, i32 %37, i32* %38)
store i32 %39, i32* %11
%40 = load i32*, i32** %6
%41 = call i32 @XSync(i32* %40, i32 0)
%42 = load i32, i32* %11
ret i32 %42
}

LLVM IR (-O2):
@GLX_TEXTURE_TARGET_EXT = constant i32 0
@GLX_TEXTURE_2D_EXT = constant i32 0
@GLX_TEXTURE_FORMAT_EXT = constant i32 0
@GLX_TEXTURE_FORMAT_RGB_EXT = constant i32 0
@None = constant i32 0
define i32 @CreatePixmap(i32* %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4) {
%6 = alloca [5 x i32]
%7 = bitcast [5 x i32]* %6 to i8*
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%9 = bitcast [5 x i32]* %6 to i8*
%10 = tail call i32 @RootWindow(i32* %0, i32 0)
%11 = tail call i32 @XCreatePixmap(i32* %0, i32 %10, i32 %2, i32 %3, i32 24)
store i32 %11, i32* %4
%12 = tail call i32 @XSync(i32* %0, i32 0)
%13 = load i32, i32* %4
%14 = call i32 @glXCreatePixmap(i32* %0, i32 %1, i32 %13, i32* %8)
%15 = call i32 @XSync(i32* %0, i32 0)
ret i32 %14
}