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

/* Variables and functions */
int /*<<< orphan*/ check_error();
int /*<<< orphan*/ glad_glBindTexture(int, int /*<<< orphan*/);
int /*<<< orphan*/ glad_glGenTextures(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ glad_glTexImage2D(int, int /*<<< orphan*/, int, int, int,
                                     int /*<<< orphan*/, int, int,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ glad_glTexParameterf(int, int, int);
GLuint load_texture(int width, int height, GLvoid *data) {
  GLuint id;
  glad_glGenTextures(1, &id);
  glad_glBindTexture(0x0DE1, id);
  glad_glTexParameterf(0x0DE1, 0x2801, 0x2600);
  glad_glTexParameterf(0x0DE1, 0x2800, 0x2600);
  glad_glTexImage2D(0x0DE1, 0, 0x1908, width, height, 0, 0x1908, 0x1401, data);
  glad_glBindTexture(0x0DE1, 0);
  check_error();
  return id;
}


x86 assembly (clang, -O0):
<load_texture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x1,%edi
lea    -0x14(%rbp),%rsi
call   1070 <glad_glGenTextures@plt>
mov    -0x14(%rbp),%esi
mov    $0xde1,%edi
call   1030 <glad_glBindTexture@plt>
mov    $0xde1,%edi
mov    $0x2801,%esi
mov    $0x2600,%edx
call   1060 <glad_glTexParameterf@plt>
mov    $0xde1,%edi
mov    $0x2800,%esi
mov    $0x2600,%edx
call   1060 <glad_glTexParameterf@plt>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    -0x10(%rbp),%rax
mov    $0xde1,%edi
xor    %r9d,%r9d
mov    $0x1908,%edx
mov    %r9d,%esi
movl   $0x1908,(%rsp)
movl   $0x1401,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <glad_glTexImage2D@plt>
mov    $0xde1,%edi
xor    %esi,%esi
call   1030 <glad_glBindTexture@plt>
mov    $0x0,%al
call   1040 <check_error@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_texture>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xc(%rsp),%rsi
mov    $0x1,%edi
call   1070 <glad_glGenTextures@plt>
mov    0xc(%rsp),%esi
mov    $0xde1,%edi
call   1030 <glad_glBindTexture@plt>
mov    $0xde1,%edi
mov    $0x2801,%esi
mov    $0x2600,%edx
call   1060 <glad_glTexParameterf@plt>
mov    $0xde1,%edi
mov    $0x2800,%esi
mov    $0x2600,%edx
call   1060 <glad_glTexParameterf@plt>
sub    $0x8,%rsp
mov    $0xde1,%edi
xor    %esi,%esi
mov    $0x1908,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
xor    %r9d,%r9d
push   %r14
push   $0x1401
push   $0x1908
call   1050 <glad_glTexImage2D@plt>
add    $0x20,%rsp
mov    $0xde1,%edi
xor    %esi,%esi
call   1030 <glad_glBindTexture@plt>
xor    %eax,%eax
call   1040 <check_error@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @load_texture(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = call i32 @glad_glGenTextures(i32 1, i32* %7)
%9 = load i32, i32* %7
%10 = call i32 @glad_glBindTexture(i32 3553, i32 %9)
%11 = call i32 @glad_glTexParameterf(i32 3553, i32 10241, i32 9728)
%12 = call i32 @glad_glTexParameterf(i32 3553, i32 10240, i32 9728)
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = load i32*, i32** %6
%16 = call i32 @glad_glTexImage2D(i32 3553, i32 0, i32 6408, i32 %13, i32 %14, i32 0, i32 6408, i32 5121, i32* %15)
%17 = call i32 @glad_glBindTexture(i32 3553, i32 0)
%18 = call i32 (...) @check_error()
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @load_texture(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @glad_glGenTextures(i32 1, i32* %4)
%7 = load i32, i32* %4
%8 = call i32 @glad_glBindTexture(i32 3553, i32 %7)
%9 = call i32 @glad_glTexParameterf(i32 3553, i32 10241, i32 9728)
%10 = call i32 @glad_glTexParameterf(i32 3553, i32 10240, i32 9728)
%11 = call i32 @glad_glTexImage2D(i32 3553, i32 0, i32 6408, i32 %0, i32 %1, i32 0, i32 6408, i32 5121, i32* %2)
%12 = call i32 @glad_glBindTexture(i32 3553, i32 0)
%13 = call i32 (...) @check_error()
%14 = load i32, i32* %4
ret i32 %14
}