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

/* Variables and functions */
int /*<<< orphan*/ GLX_FRONT_LEFT_EXT;
int /*<<< orphan*/ GL_LINEAR;
int /*<<< orphan*/ GL_TEXTURE_2D;
int /*<<< orphan*/ GL_TEXTURE_MAG_FILTER;
int /*<<< orphan*/ GL_TEXTURE_MIN_FILTER;
int /*<<< orphan*/ glBindTexture(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glGenTextures(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ glTexParameteri(int /*<<< orphan*/, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ glXBindTexImageEXT_func(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/,
                                           int /*<<< orphan*/,
                                           int /*<<< orphan*/ *);
void BindPixmapTexture(Display *dpy, GLXPixmap gp) {
  GLuint texture;
  glGenTextures(1, &texture);
  glBindTexture(GL_TEXTURE_2D, texture);
  glXBindTexImageEXT_func(dpy, gp, GLX_FRONT_LEFT_EXT, NULL);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glEnable(GL_TEXTURE_2D);
}


x86 assembly (clang, -O0):
<BindPixmapTexture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%edi
lea    -0x10(%rbp),%rsi
call   1060 <glGenTextures@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%esi
call   1070 <glBindTexture@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e54(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <glXBindTexImageEXT_func@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    0x2e41(%rip),%rax
mov    (%rax),%esi
mov    0x2e28(%rip),%rax
mov    (%rax),%edx
call   1030 <glTexParameteri@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    0x2df9(%rip),%rax
mov    (%rax),%esi
mov    0x2e08(%rip),%rax
mov    (%rax),%edx
call   1030 <glTexParameteri@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
call   1040 <glEnable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BindPixmapTexture>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xc(%rsp),%rsi
mov    $0x1,%edi
call   1060 <glGenTextures@plt>
mov    0x2e55(%rip),%r14
mov    (%r14),%edi
mov    0xc(%rsp),%esi
call   1070 <glBindTexture@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %ecx,%ecx
call   1050 <glXBindTexImageEXT_func@plt>
mov    (%r14),%edi
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
mov    0x2e31(%rip),%rbx
mov    (%rbx),%edx
call   1030 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
call   1030 <glTexParameteri@plt>
mov    (%r14),%edi
call   1040 <glEnable@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@GL_TEXTURE_2D = global i32 0
@GLX_FRONT_LEFT_EXT = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
define void @BindPixmapTexture(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = call i32 @glGenTextures(i32 1, i32* %5)
%7 = load i32, i32* @GL_TEXTURE_2D
%8 = load i32, i32* %5
%9 = call i32 @glBindTexture(i32 %7, i32 %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* %4
%12 = load i32, i32* @GLX_FRONT_LEFT_EXT
%13 = call i32 @glXBindTexImageEXT_func(i32* %10, i32 %11, i32 %12, i32* null)
%14 = load i32, i32* @GL_TEXTURE_2D
%15 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%16 = load i32, i32* @GL_LINEAR
%17 = call i32 @glTexParameteri(i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* @GL_TEXTURE_2D
%19 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%20 = load i32, i32* @GL_LINEAR
%21 = call i32 @glTexParameteri(i32 %18, i32 %19, i32 %20)
%22 = load i32, i32* @GL_TEXTURE_2D
%23 = call i32 @glEnable(i32 %22)
ret void
}

LLVM IR (-O2):
@GL_TEXTURE_2D = global i32 0
@GLX_FRONT_LEFT_EXT = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
define void @BindPixmapTexture(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @glGenTextures(i32 1, i32* %3)
%6 = load i32, i32* @GL_TEXTURE_2D
%7 = load i32, i32* %3
%8 = call i32 @glBindTexture(i32 %6, i32 %7)
%9 = load i32, i32* @GLX_FRONT_LEFT_EXT
%10 = call i32 @glXBindTexImageEXT_func(i32* %0, i32 %1, i32 %9, i32* null)
%11 = load i32, i32* @GL_TEXTURE_2D
%12 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%13 = load i32, i32* @GL_LINEAR
%14 = call i32 @glTexParameteri(i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* @GL_TEXTURE_2D
%16 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%17 = load i32, i32* @GL_LINEAR
%18 = call i32 @glTexParameteri(i32 %15, i32 %16, i32 %17)
%19 = load i32, i32* @GL_TEXTURE_2D
%20 = call i32 @glEnable(i32 %19)
ret void
}