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

/* Variables and functions */
int /*<<< orphan*/ GL_BACK;
int /*<<< orphan*/ GL_LINEAR;
int /*<<< orphan*/ GL_S;
int /*<<< orphan*/ GL_SPHERE_MAP;
int /*<<< orphan*/ GL_T;
int /*<<< orphan*/ GL_TEXTURE_2D;
int /*<<< orphan*/ GL_TEXTURE_GEN_MODE;
int /*<<< orphan*/ GL_TEXTURE_GEN_S;
int /*<<< orphan*/ GL_TEXTURE_GEN_T;
int /*<<< orphan*/ GL_TEXTURE_MAG_FILTER;
int /*<<< orphan*/ GL_TEXTURE_MIN_FILTER;
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glReadBuffer(int /*<<< orphan*/);
int /*<<< orphan*/ glTexGenf(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ glTexParameterf(int /*<<< orphan*/, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ render_spheremap(int *, int *, int *, int /*<<< orphan*/);
void texture_init_from_spheremap(void) {
  int w, h, components;
  render_spheremap(&w, &h, &components, 0);
  glReadBuffer(GL_BACK);
  ;
  ;
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
  glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
  glEnable(GL_TEXTURE_GEN_S);
  glEnable(GL_TEXTURE_GEN_T);
}


x86 assembly (clang, -O0):
<texture_init_from_spheremap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
xor    %ecx,%ecx
call   1070 <render_spheremap@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1040 <glReadBuffer@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
mov    0x2e2e(%rip),%rax
mov    (%rax),%edx
call   1060 <glTexParameterf@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    0x2e27(%rip),%rax
mov    (%rax),%esi
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
call   1060 <glTexParameterf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
mov    0x2df6(%rip),%rax
mov    (%rax),%edx
call   1030 <glTexGenf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
mov    0x2dd6(%rip),%rax
mov    (%rax),%edx
call   1030 <glTexGenf@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<texture_init_from_spheremap>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %ecx,%ecx
call   1070 <render_spheremap@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1040 <glReadBuffer@plt>
mov    0x2e2e(%rip),%r14
mov    (%r14),%edi
mov    0x2e04(%rip),%rax
mov    (%rax),%esi
mov    0x2e2b(%rip),%rbx
mov    (%rbx),%edx
call   1060 <glTexParameterf@plt>
mov    (%r14),%edi
mov    0x2e2a(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
call   1060 <glTexParameterf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    0x2e39(%rip),%r14
mov    (%r14),%esi
mov    0x2dff(%rip),%rbx
mov    (%rbx),%edx
call   1030 <glTexGenf@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%esi
mov    (%rbx),%edx
call   1030 <glTexGenf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@GL_BACK = global i32 0
@GL_TEXTURE_2D = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_S = global i32 0
@GL_TEXTURE_GEN_MODE = global i32 0
@GL_SPHERE_MAP = global i32 0
@GL_T = global i32 0
@GL_TEXTURE_GEN_S = global i32 0
@GL_TEXTURE_GEN_T = global i32 0
define void @texture_init_from_spheremap() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @render_spheremap(i32* %1, i32* %2, i32* %3, i32 0)
%5 = load i32, i32* @GL_BACK
%6 = call i32 @glReadBuffer(i32 %5)
%7 = load i32, i32* @GL_TEXTURE_2D
%8 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%9 = load i32, i32* @GL_LINEAR
%10 = call i32 @glTexParameterf(i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* @GL_TEXTURE_2D
%12 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%13 = load i32, i32* @GL_LINEAR
%14 = call i32 @glTexParameterf(i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* @GL_S
%16 = load i32, i32* @GL_TEXTURE_GEN_MODE
%17 = load i32, i32* @GL_SPHERE_MAP
%18 = call i32 @glTexGenf(i32 %15, i32 %16, i32 %17)
%19 = load i32, i32* @GL_T
%20 = load i32, i32* @GL_TEXTURE_GEN_MODE
%21 = load i32, i32* @GL_SPHERE_MAP
%22 = call i32 @glTexGenf(i32 %19, i32 %20, i32 %21)
%23 = load i32, i32* @GL_TEXTURE_GEN_S
%24 = call i32 @glEnable(i32 %23)
%25 = load i32, i32* @GL_TEXTURE_GEN_T
%26 = call i32 @glEnable(i32 %25)
ret void
}

LLVM IR (-O2):
@GL_BACK = global i32 0
@GL_TEXTURE_2D = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_S = global i32 0
@GL_TEXTURE_GEN_MODE = global i32 0
@GL_SPHERE_MAP = global i32 0
@GL_T = global i32 0
@GL_TEXTURE_GEN_S = global i32 0
@GL_TEXTURE_GEN_T = global i32 0
define void @texture_init_from_spheremap() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @render_spheremap(i32* %1, i32* %2, i32* %3, i32 0)
%8 = load i32, i32* @GL_BACK
%9 = call i32 @glReadBuffer(i32 %8)
%10 = load i32, i32* @GL_TEXTURE_2D
%11 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%12 = load i32, i32* @GL_LINEAR
%13 = call i32 @glTexParameterf(i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* @GL_TEXTURE_2D
%15 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%16 = load i32, i32* @GL_LINEAR
%17 = call i32 @glTexParameterf(i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* @GL_S
%19 = load i32, i32* @GL_TEXTURE_GEN_MODE
%20 = load i32, i32* @GL_SPHERE_MAP
%21 = call i32 @glTexGenf(i32 %18, i32 %19, i32 %20)
%22 = load i32, i32* @GL_T
%23 = load i32, i32* @GL_TEXTURE_GEN_MODE
%24 = load i32, i32* @GL_SPHERE_MAP
%25 = call i32 @glTexGenf(i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* @GL_TEXTURE_GEN_S
%27 = call i32 @glEnable(i32 %26)
%28 = load i32, i32* @GL_TEXTURE_GEN_T
%29 = call i32 @glEnable(i32 %28)
ret void
}