#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 scalar_t__ GLint;
typedef scalar_t__ GLenum;

/* Variables and functions */
int /*<<< orphan*/ GL_MAX_TEXTURE_SIZE;
scalar_t__ GL_PROXY_TEXTURE_1D;
scalar_t__ GL_PROXY_TEXTURE_2D;
scalar_t__ GL_TEXTURE_1D;
scalar_t__ GL_TEXTURE_2D;
int /*<<< orphan*/ GL_TEXTURE_WIDTH;
int /*<<< orphan*/ GL_VERSION;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ glGetIntegerv(int /*<<< orphan*/, scalar_t__ *);
scalar_t__ glGetString(int /*<<< orphan*/);
int /*<<< orphan*/ glGetTexLevelParameteriv(scalar_t__, int, int /*<<< orphan*/,
                                            scalar_t__ *);
int /*<<< orphan*/ glTexImage1D(scalar_t__, int, scalar_t__, scalar_t__,
                                int /*<<< orphan*/, scalar_t__, scalar_t__,
                                int /*<<< orphan*/ *);
int /*<<< orphan*/ glTexImage2D(scalar_t__, int, scalar_t__, scalar_t__,
                                scalar_t__, int /*<<< orphan*/, scalar_t__,
                                scalar_t__, int /*<<< orphan*/ *);
scalar_t__ nearestPower(scalar_t__);
double strtod(char const *, int /*<<< orphan*/ *);
void closestFit(GLenum target, GLint width, GLint height, GLint internalFormat,
                GLenum format, GLenum type, GLint *newWidth, GLint *newHeight) {
  if ((strtod((const char *)glGetString(GL_VERSION), NULL) >= 1.1)) {
    GLint widthPowerOf2 = nearestPower(width);
    GLint heightPowerOf2 = nearestPower(height);
    GLint proxyWidth;
    do {
      GLint widthAtLevelOne =
          (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2;
      GLint heightAtLevelOne =
          (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2;
      GLenum proxyTarget;
      assert(widthAtLevelOne > 0);
      assert(heightAtLevelOne > 0);
      if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) {
        proxyTarget = GL_PROXY_TEXTURE_2D;
        glTexImage2D(proxyTarget, 1, internalFormat, widthAtLevelOne,
                     heightAtLevelOne, 0, format, type, NULL);
      } else {
        assert(target == GL_TEXTURE_1D || target == GL_PROXY_TEXTURE_1D);
        proxyTarget = GL_PROXY_TEXTURE_1D;
        glTexImage1D(proxyTarget, 1, internalFormat, widthAtLevelOne, 0, format,
                     type, NULL);
      }
      glGetTexLevelParameteriv(proxyTarget, 1, GL_TEXTURE_WIDTH, &proxyWidth);
      if (proxyWidth == 0) {
        if (widthPowerOf2 == 1 && heightPowerOf2 == 1) {
          goto noProxyTextures;
        }
        widthPowerOf2 = widthAtLevelOne;
        heightPowerOf2 = heightAtLevelOne;
      }
    } while (proxyWidth == 0);
    *newWidth = widthPowerOf2;
    *newHeight = heightPowerOf2;
  } else {
    GLint maxsize;
  noProxyTextures:
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
    *newWidth = nearestPower(width);
    if (*newWidth > maxsize)
      *newWidth = maxsize;
    *newHeight = nearestPower(height);
    if (*newHeight > maxsize)
      *newHeight = maxsize;
  }
}


x86 assembly (clang, -O0):
<closestFit>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  0xe33(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     13d7 <closestFit+0x257>
mov    -0x10(%rbp),%rdi
call   1040 <nearestPower@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <nearestPower@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x1,-0x38(%rbp)
jle    120d <closestFit+0x8d>
mov    -0x38(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1215 <closestFit+0x95>
mov    -0x38(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x1,-0x40(%rbp)
jle    1239 <closestFit+0xb9>
mov    -0x40(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    1241 <closestFit+0xc1>
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x50(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
cmpq   $0x0,-0x58(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rax
mov    0x2d60(%rip),%rcx
cmp    (%rcx),%rax
je     1295 <closestFit+0x115>
mov    -0x8(%rbp),%rax
mov    0x2d3c(%rip),%rcx
cmp    (%rcx),%rax
jne    12e2 <closestFit+0x162>
mov    0x2d2c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x28(%rbp),%r10
mov    -0x30(%rbp),%rax
mov    $0x1,%esi
xor    %r9d,%r9d
xor    %r11d,%r11d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1050 <glTexImage2D@plt>
jmp    135b <closestFit+0x1db>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
mov    0x2cc1(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x79(%rbp)
je     130f <closestFit+0x18f>
mov    -0x8(%rbp),%rax
mov    0x2cba(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    0x2c9d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    $0x1,%esi
xor    %r8d,%r8d
xor    %r10d,%r10d
mov    %rax,(%rsp)
movq   $0x0,0x8(%rsp)
call   1080 <glTexImage1D@plt>
mov    -0x60(%rbp),%rdi
mov    0x2c82(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%esi
lea    -0x48(%rbp),%rcx
call   1090 <glGetTexLevelParameteriv@plt>
cmpq   $0x0,-0x48(%rbp)
jne    13ac <closestFit+0x22c>
cmpq   $0x1,-0x38(%rbp)
jne    139c <closestFit+0x21c>
cmpq   $0x1,-0x40(%rbp)
jne    139c <closestFit+0x21c>
jmp    13dc <closestFit+0x25c>
mov    -0x50(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    13b1 <closestFit+0x231>
cmpq   $0x0,-0x48(%rbp)
je     11f1 <closestFit+0x71>
mov    -0x38(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x40(%rbp),%rcx
mov    0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1451 <closestFit+0x2d1>
jmp    13dc <closestFit+0x25c>
mov    0x2bd5(%rip),%rax
mov    (%rax),%edi
lea    -0x68(%rbp),%rsi
call   10a0 <glGetIntegerv@plt>
mov    -0x10(%rbp),%rdi
call   1040 <nearestPower@plt>
mov    %rax,%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x68(%rbp),%rax
jle    141d <closestFit+0x29d>
mov    -0x68(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
call   1040 <nearestPower@plt>
mov    %rax,%rcx
mov    0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x68(%rbp),%rax
jle    144c <closestFit+0x2cc>
mov    -0x68(%rbp),%rcx
mov    0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1451 <closestFit+0x2d1>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closestFit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,(%rsp)
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x78(%rsp),%r14
mov    0x70(%rsp),%r12
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
call   1070 <glGetString@plt>
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
ucomisd 0xe31(%rip),%xmm0
jb     132e <closestFit+0x1ae>
mov    %rbx,0x20(%rsp)
mov    %rbx,%rdi
call   1040 <nearestPower@plt>
mov    %rax,%r12
mov    %r15,0x28(%rsp)
mov    %r15,%rdi
call   1040 <nearestPower@plt>
mov    %rax,%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rbx
cmp    $0x2,%r12
setge  %cl
mov    %r12,%r14
sar    %cl,%r14
cmp    $0x2,%r15
setge  %cl
sar    %cl,%r15
xor    %edi,%edi
test   %r14,%r14
setg   %dil
call   1060 <assert@plt>
xor    %edi,%edi
test   %r15,%r15
setg   %dil
call   1060 <assert@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%r13
mov    0x2d91(%rip),%rax
cmp    %rbp,(%rax)
je     12b0 <closestFit+0x130>
cmp    %rbp,%r13
je     12b0 <closestFit+0x130>
mov    0x2d58(%rip),%rax
cmp    %rbp,(%rax)
sete   %al
mov    0x2d5b(%rip),%r13
cmp    %rbp,0x0(%r13)
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1060 <assert@plt>
mov    0x0(%r13),%r13
mov    %r13,%rdi
mov    $0x1,%esi
mov    (%rsp),%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
mov    0x8(%rsp),%r9
push   $0x0
push   0x18(%rsp)
call   1080 <glTexImage1D@plt>
add    $0x10,%rsp
jmp    12dd <closestFit+0x15d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    $0x8,%rsp
mov    %r13,%rdi
mov    $0x1,%esi
mov    0x8(%rsp),%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %r9d,%r9d
push   $0x0
push   0x20(%rsp)
push   0x20(%rsp)
call   1050 <glTexImage2D@plt>
add    $0x20,%rsp
mov    0x2d04(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    $0x1,%esi
lea    0x30(%rsp),%rcx
call   1090 <glGetTexLevelParameteriv@plt>
cmpq   $0x0,0x30(%rsp)
jne    1372 <closestFit+0x1f2>
cmp    $0x1,%r12
mov    %r14,%r12
jne    1200 <closestFit+0x80>
mov    %r14,%r12
cmp    $0x1,%rbx
jne    1200 <closestFit+0x80>
mov    0x78(%rsp),%r14
mov    0x28(%rsp),%r15
mov    0x70(%rsp),%r12
mov    0x20(%rsp),%rbx
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
lea    0x18(%rsp),%rsi
call   10a0 <glGetIntegerv@plt>
mov    %rbx,%rdi
call   1040 <nearestPower@plt>
mov    0x18(%rsp),%rcx
cmp    %rcx,%rax
cmovg  %rcx,%rax
mov    %rax,(%r12)
mov    %r15,%rdi
call   1040 <nearestPower@plt>
mov    0x18(%rsp),%rcx
cmp    %rcx,%rax
cmovg  %rcx,%rax
mov    %rax,(%r14)
jmp    1382 <closestFit+0x202>
mov    0x70(%rsp),%rax
mov    %r12,(%rax)
mov    0x78(%rsp),%rax
mov    %rbx,(%rax)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_VERSION = global i32 0
@GL_TEXTURE_2D = global i64 0
@GL_PROXY_TEXTURE_2D = global i64 0
@GL_TEXTURE_1D = global i64 0
@GL_PROXY_TEXTURE_1D = global i64 0
@GL_TEXTURE_WIDTH = global i32 0
@GL_MAX_TEXTURE_SIZE = global i32 0
define void @closestFit(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64* %6, i64* %7) {
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64*
%16 = alloca i64*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
store i64 %0, i64* %9
store i64 %1, i64* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i64 %5, i64* %14
store i64* %6, i64** %15
store i64* %7, i64** %16
%24 = load i32, i32* @GL_VERSION
%25 = call i64 @glGetString(i32 %24)
%26 = inttoptr i64 %25 to i8*
%27 = call double @strtod(i8* %26, i32* null)
%28 = fcmp oge double %27, 1.100000e+00
br i1 %28, label %29, label %121
29: ; preds = %8
%30 = load i64, i64* %10
%31 = call i64 @nearestPower(i64 %30)
store i64 %31, i64* %17
%32 = load i64, i64* %11
%33 = call i64 @nearestPower(i64 %32)
store i64 %33, i64* %18
br label %34
34: ; preds = %113, %29
%35 = load i64, i64* %17
%36 = icmp sgt i64 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i64, i64* %17
%39 = ashr i64 %38, 1
br label %42
40: ; preds = %34
%41 = load i64, i64* %17
br label %42
42: ; preds = %40, %37
%43 = phi i64 [ %39, %37 ], [ %41, %40 ]
store i64 %43, i64* %20
%44 = load i64, i64* %18
%45 = icmp sgt i64 %44, 1
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = load i64, i64* %18
%48 = ashr i64 %47, 1
br label %51
49: ; preds = %42
%50 = load i64, i64* %18
br label %51
51: ; preds = %49, %46
%52 = phi i64 [ %48, %46 ], [ %50, %49 ]
store i64 %52, i64* %21
%53 = load i64, i64* %20
%54 = icmp sgt i64 %53, 0
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i64, i64* %21
%58 = icmp sgt i64 %57, 0
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = load i64, i64* %9
%62 = load i64, i64* @GL_TEXTURE_2D
%63 = icmp eq i64 %61, %62
br i1 %63, label %68, label %64
64: ; preds = %51
%65 = load i64, i64* %9
%66 = load i64, i64* @GL_PROXY_TEXTURE_2D
%67 = icmp eq i64 %65, %66
br i1 %67, label %68, label %77
68: ; preds = %64, %51
%69 = load i64, i64* @GL_PROXY_TEXTURE_2D
store i64 %69, i64* %22
%70 = load i64, i64* %22
%71 = load i64, i64* %12
%72 = load i64, i64* %20
%73 = load i64, i64* %21
%74 = load i64, i64* %13
%75 = load i64, i64* %14
%76 = call i32 @glTexImage2D(i64 %70, i32 1, i64 %71, i64 %72, i64 %73, i32 0, i64 %74, i64 %75, i32* null)
br label %96
77: ; preds = %64
%78 = load i64, i64* %9
%79 = load i64, i64* @GL_TEXTURE_1D
%80 = icmp eq i64 %78, %79
br i1 %80, label %85, label %81
81: ; preds = %77
%82 = load i64, i64* %9
%83 = load i64, i64* @GL_PROXY_TEXTURE_1D
%84 = icmp eq i64 %82, %83
br label %85
85: ; preds = %81, %77
%86 = phi i1 [ true, %77 ], [ %84, %81 ]
%87 = zext i1 %86 to i32
%88 = call i32 @assert(i32 %87)
%89 = load i64, i64* @GL_PROXY_TEXTURE_1D
store i64 %89, i64* %22
%90 = load i64, i64* %22
%91 = load i64, i64* %12
%92 = load i64, i64* %20
%93 = load i64, i64* %13
%94 = load i64, i64* %14
%95 = call i32 @glTexImage1D(i64 %90, i32 1, i64 %91, i64 %92, i32 0, i64 %93, i64 %94, i32* null)
br label %96
96: ; preds = %85, %68
%97 = load i64, i64* %22
%98 = load i32, i32* @GL_TEXTURE_WIDTH
%99 = call i32 @glGetTexLevelParameteriv(i64 %97, i32 1, i32 %98, i64* %19)
%100 = load i64, i64* %19
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %112
102: ; preds = %96
%103 = load i64, i64* %17
%104 = icmp eq i64 %103, 1
br i1 %104, label %105, label %109
105: ; preds = %102
%106 = load i64, i64* %18
%107 = icmp eq i64 %106, 1
br i1 %107, label %108, label %109
108: ; preds = %105
br label %122
109: ; preds = %105, %102
%110 = load i64, i64* %20
store i64 %110, i64* %17
%111 = load i64, i64* %21
store i64 %111, i64* %18
br label %112
112: ; preds = %109, %96
br label %113
113: ; preds = %112
%114 = load i64, i64* %19
%115 = icmp eq i64 %114, 0
br i1 %115, label %34, label %116
116: ; preds = %113
%117 = load i64, i64* %17
%118 = load i64*, i64** %15
store i64 %117, i64* %118
%119 = load i64, i64* %18
%120 = load i64*, i64** %16
store i64 %119, i64* %120
br label %147
121: ; preds = %8
br label %122
122: ; preds = %121, %108
%123 = load i32, i32* @GL_MAX_TEXTURE_SIZE
%124 = call i32 @glGetIntegerv(i32 %123, i64* %23)
%125 = load i64, i64* %10
%126 = call i64 @nearestPower(i64 %125)
%127 = load i64*, i64** %15
store i64 %126, i64* %127
%128 = load i64*, i64** %15
%129 = load i64, i64* %128
%130 = load i64, i64* %23
%131 = icmp sgt i64 %129, %130
br i1 %131, label %132, label %135
132: ; preds = %122
%133 = load i64, i64* %23
%134 = load i64*, i64** %15
store i64 %133, i64* %134
br label %135
135: ; preds = %132, %122
%136 = load i64, i64* %11
%137 = call i64 @nearestPower(i64 %136)
%138 = load i64*, i64** %16
store i64 %137, i64* %138
%139 = load i64*, i64** %16
%140 = load i64, i64* %139
%141 = load i64, i64* %23
%142 = icmp sgt i64 %140, %141
br i1 %142, label %143, label %146
143: ; preds = %135
%144 = load i64, i64* %23
%145 = load i64*, i64** %16
store i64 %144, i64* %145
br label %146
146: ; preds = %143, %135
br label %147
147: ; preds = %146, %116
ret void
}

LLVM IR (-O2):
@GL_VERSION = global i32 0
@GL_TEXTURE_2D = global i64 0
@GL_PROXY_TEXTURE_2D = global i64 0
@GL_TEXTURE_1D = global i64 0
@GL_PROXY_TEXTURE_1D = global i64 0
@GL_TEXTURE_WIDTH = global i32 0
@GL_MAX_TEXTURE_SIZE = global i32 0
define void @closestFit(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64* nocapture writeonly %6, i64* nocapture writeonly %7) {
%9 = alloca i64
%10 = alloca i64
%11 = load i32, i32* @GL_VERSION
%12 = tail call i64 @glGetString(i32 %11)
%13 = inttoptr i64 %12 to i8*
%14 = tail call double @strtod(i8* nocapture %13, i32* null)
%15 = fcmp ult double %14, 1.100000e+00
br i1 %15, label %64, label %16
16: ; preds = %8
%17 = tail call i64 @nearestPower(i64 %1)
%18 = tail call i64 @nearestPower(i64 %2)
%19 = bitcast i64* %9 to i8*
br label %20
20: ; preds = %58, %16
%21 = phi i64 [ %18, %16 ], [ %28, %58 ]
%22 = phi i64 [ %17, %16 ], [ %25, %58 ]
%23 = icmp sgt i64 %22, 1
%24 = zext i1 %23 to i64
%25 = ashr i64 %22, %24
%26 = icmp sgt i64 %21, 1
%27 = zext i1 %26 to i64
%28 = ashr i64 %21, %27
%29 = icmp sgt i64 %25, 0
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = icmp sgt i64 %28, 0
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = load i64, i64* @GL_TEXTURE_2D
%36 = icmp eq i64 %35, %0
%37 = load i64, i64* @GL_PROXY_TEXTURE_2D
%38 = icmp eq i64 %37, %0
%39 = select i1 %36, i1 true, i1 %38
br i1 %39, label %40, label %42
40: ; preds = %20
%41 = call i32 @glTexImage2D(i64 %37, i32 1, i64 %3, i64 %25, i64 %28, i32 0, i64 %4, i64 %5, i32* null)
br label %52
42: ; preds = %20
%43 = load i64, i64* @GL_TEXTURE_1D
%44 = icmp eq i64 %43, %0
%45 = load i64, i64* @GL_PROXY_TEXTURE_1D
%46 = icmp eq i64 %45, %0
%47 = select i1 %44, i1 true, i1 %46
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load i64, i64* @GL_PROXY_TEXTURE_1D
%51 = call i32 @glTexImage1D(i64 %50, i32 1, i64 %3, i64 %25, i32 0, i64 %4, i64 %5, i32* null)
br label %52
52: ; preds = %42, %40
%53 = phi i64 [ %37, %40 ], [ %50, %42 ]
%54 = load i32, i32* @GL_TEXTURE_WIDTH
%55 = call i32 @glGetTexLevelParameteriv(i64 %53, i32 1, i32 %54, i64* %9)
%56 = load i64, i64* %9
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %52
%59 = icmp eq i64 %22, 1
%60 = icmp eq i64 %21, 1
%61 = select i1 %59, i1 %60, i1 false
br i1 %61, label %63, label %20
62: ; preds = %52
store i64 %22, i64* %6
store i64 %21, i64* %7
br label %75
63: ; preds = %58
br label %64
64: ; preds = %63, %8
%65 = load i32, i32* @GL_MAX_TEXTURE_SIZE
%66 = call i32 @glGetIntegerv(i32 %65, i64* %10)
%67 = call i64 @nearestPower(i64 %1)
%68 = load i64, i64* %10
%69 = icmp sgt i64 %67, %68
%70 = select i1 %69, i64 %68, i64 %67
store i64 %70, i64* %6
%71 = call i64 @nearestPower(i64 %2)
%72 = load i64, i64* %10
%73 = icmp sgt i64 %71, %72
%74 = select i1 %73, i64 %72, i64 %71
store i64 %74, i64* %7
br label %75
75: ; preds = %62, %64
ret void
}