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

/* Variables and functions */
int /*<<< orphan*/ GL_UNSIGNED_BYTE;
scalar_t__ V3DTextureIsPowerOf2(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
scalar_t__ gluErrorString(int);
int gluScaleImage(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                  int /*<<< orphan*/, void const *, int /*<<< orphan*/,
                  int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
void V3DTextureRescaleImage(const u_int8_t *in_pixels, int bytes_per_pixel,
                            GLenum gl_image_format, int in_width, int in_height,
                            u_int8_t **out_pixels, int *out_width,
                            int *out_height) {
  int i, m, status, longer_in_dim;
  int lout_dim;
  u_int8_t *lout_pixels = NULL;
  if (out_pixels != NULL)
    *out_pixels = NULL;
  if (out_width != NULL)
    *out_width = 0;
  if (out_height != NULL)
    *out_height = 0;
  if ((in_pixels == NULL) || (bytes_per_pixel <= 0))
    return;
  if (V3DTextureIsPowerOf2(in_width)) {
    if ((in_height % in_width) == 0) {
      if (out_pixels != NULL)
        *out_pixels = (u_int8_t *)in_pixels;
      if (out_width != NULL)
        *out_width = in_width;
      if (out_height != NULL)
        *out_height = in_height;
      return;
    }
  }
  longer_in_dim = (((in_width) > (in_height)) ? (in_width) : (in_height));
  for (i = 0, m = 16; i < m; i++) {
    lout_dim = (int)(1 << i);
    if (lout_dim > longer_in_dim)
      break;
  }
  if (i >= m) {
    return;
  }
  lout_pixels = (u_int8_t *)malloc(lout_dim * lout_dim * bytes_per_pixel *
                                   sizeof(u_int8_t));
  if (lout_pixels == NULL)
    return;
  status = gluScaleImage(gl_image_format, (GLsizei)in_width, (GLsizei)in_height,
                         GL_UNSIGNED_BYTE, (const void *)in_pixels,
                         (GLsizei)lout_dim, (GLsizei)lout_dim, GL_UNSIGNED_BYTE,
                         (GLvoid *)lout_pixels);
  if (status != 0) {
    fprintf(stderr, "gluScaleImage(): Error: %s\n",
            (const char *)gluErrorString(status));
  }
  if (out_pixels != NULL)
    *out_pixels = lout_pixels;
  if (out_width != NULL)
    *out_width = lout_dim;
  if (out_height != NULL)
    *out_height = lout_dim;
}


x86 assembly (clang, -O0):
<V3DTextureRescaleImage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1193 <V3DTextureRescaleImage+0x43>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,0x10(%rbp)
je     11a8 <V3DTextureRescaleImage+0x58>
mov    0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,0x18(%rbp)
je     11bd <V3DTextureRescaleImage+0x6d>
mov    0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x8(%rbp)
je     11d2 <V3DTextureRescaleImage+0x82>
cmpl   $0x0,-0xc(%rbp)
jg     11d7 <V3DTextureRescaleImage+0x87>
jmp    139c <V3DTextureRescaleImage+0x24c>
mov    -0x14(%rbp),%edi
call   1070 <V3DTextureIsPowerOf2@plt>
cmp    $0x0,%rax
je     1241 <V3DTextureRescaleImage+0xf1>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    123c <V3DTextureRescaleImage+0xec>
cmpq   $0x0,-0x20(%rbp)
je     120f <V3DTextureRescaleImage+0xbf>
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,0x10(%rbp)
je     1223 <V3DTextureRescaleImage+0xd3>
mov    -0x14(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,0x18(%rbp)
je     1237 <V3DTextureRescaleImage+0xe7>
mov    -0x18(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    139c <V3DTextureRescaleImage+0x24c>
jmp    1241 <V3DTextureRescaleImage+0xf1>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1258 <V3DTextureRescaleImage+0x108>
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    125e <V3DTextureRescaleImage+0x10e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x10,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    12af <V3DTextureRescaleImage+0x15f>
mov    -0x24(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    129c <V3DTextureRescaleImage+0x14c>
jmp    12af <V3DTextureRescaleImage+0x15f>
jmp    12a1 <V3DTextureRescaleImage+0x151>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1272 <V3DTextureRescaleImage+0x122>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     12c0 <V3DTextureRescaleImage+0x170>
jmp    139c <V3DTextureRescaleImage+0x24c>
mov    -0x34(%rbp),%eax
imul   -0x34(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12ec <V3DTextureRescaleImage+0x19c>
jmp    139c <V3DTextureRescaleImage+0x24c>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    0x2cdc(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8
mov    -0x34(%rbp),%r9d
mov    -0x34(%rbp),%r11d
mov    0x2cc7(%rip),%rax
mov    (%rax),%r10d
mov    -0x40(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <gluScaleImage@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     135e <V3DTextureRescaleImage+0x20e>
mov    0x2ca1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x2c(%rbp),%edi
call   1060 <gluErrorString@plt>
mov    -0x48(%rbp),%edi
mov    %rax,%rdx
lea    0xca7(%rip),%rsi
call   1040 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1374 <V3DTextureRescaleImage+0x224>
mov    -0x40(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,0x10(%rbp)
je     1388 <V3DTextureRescaleImage+0x238>
mov    -0x34(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,0x18(%rbp)
je     139c <V3DTextureRescaleImage+0x24c>
mov    -0x34(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<V3DTextureRescaleImage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r13
mov    %r8d,%r14d
mov    %ecx,%ebp
mov    %esi,%ebx
mov    %rdi,%r15
mov    0x40(%rsp),%rcx
test   %r9,%r9
je     117a <V3DTextureRescaleImage+0x2a>
movq   $0x0,0x0(%r13)
mov    0x48(%rsp),%rax
test   %rcx,%rcx
je     118a <V3DTextureRescaleImage+0x3a>
movl   $0x0,(%rcx)
test   %rax,%rax
je     1195 <V3DTextureRescaleImage+0x45>
movl   $0x0,(%rax)
test   %r15,%r15
je     13c5 <V3DTextureRescaleImage+0x275>
test   %ebx,%ebx
jle    13c5 <V3DTextureRescaleImage+0x275>
mov    %edx,0x4(%rsp)
mov    %ebp,%edi
call   1070 <V3DTextureIsPowerOf2@plt>
test   %rax,%rax
je     11c0 <V3DTextureRescaleImage+0x70>
mov    %r14d,%eax
cltd
idiv   %ebp
test   %edx,%edx
je     1204 <V3DTextureRescaleImage+0xb4>
cmp    %r14d,%ebp
mov    %r14d,%eax
cmovg  %ebp,%eax
test   %eax,%eax
jle    11e2 <V3DTextureRescaleImage+0x92>
cmp    $0x1,%eax
jne    11ef <V3DTextureRescaleImage+0x9f>
mov    $0x2,%r12d
mov    $0x1,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
mov    $0x1,%r12d
xor    %ecx,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x4,%eax
jae    1227 <V3DTextureRescaleImage+0xd7>
mov    $0x4,%r12d
mov    $0x2,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
test   %r13,%r13
mov    0x40(%rsp),%rcx
je     1212 <V3DTextureRescaleImage+0xc2>
mov    %r15,0x0(%r13)
test   %rcx,%rcx
mov    0x48(%rsp),%rax
je     13bd <V3DTextureRescaleImage+0x26d>
mov    %ebp,(%rcx)
jmp    13bd <V3DTextureRescaleImage+0x26d>
cmp    $0x8,%eax
jae    123c <V3DTextureRescaleImage+0xec>
mov    $0x8,%r12d
mov    $0x3,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x10,%eax
jae    1251 <V3DTextureRescaleImage+0x101>
mov    $0x10,%r12d
mov    $0x4,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x20,%eax
jae    1266 <V3DTextureRescaleImage+0x116>
mov    $0x20,%r12d
mov    $0x5,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x40,%eax
jae    127b <V3DTextureRescaleImage+0x12b>
mov    $0x40,%r12d
mov    $0x6,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x80,%eax
jae    1292 <V3DTextureRescaleImage+0x142>
mov    $0x80,%r12d
mov    $0x7,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x100,%eax
jae    12a9 <V3DTextureRescaleImage+0x159>
mov    $0x100,%r12d
mov    $0x8,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x200,%eax
jae    12bd <V3DTextureRescaleImage+0x16d>
mov    $0x200,%r12d
mov    $0x9,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x400,%eax
jae    12d1 <V3DTextureRescaleImage+0x181>
mov    $0x400,%r12d
mov    $0xa,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x800,%eax
jae    12e5 <V3DTextureRescaleImage+0x195>
mov    $0x800,%r12d
mov    $0xb,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x1000,%eax
jae    12f9 <V3DTextureRescaleImage+0x1a9>
mov    $0x1000,%r12d
mov    $0xc,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x2000,%eax
jae    130d <V3DTextureRescaleImage+0x1bd>
mov    $0x2000,%r12d
mov    $0xd,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x4000,%eax
jae    1321 <V3DTextureRescaleImage+0x1d1>
mov    $0x4000,%r12d
mov    $0xe,%ecx
jmp    1337 <V3DTextureRescaleImage+0x1e7>
cmp    $0x7fff,%eax
ja     13c5 <V3DTextureRescaleImage+0x275>
mov    $0x8000,%r12d
mov    $0xf,%ecx
mov    %r12d,%eax
shl    %cl,%eax
imul   %eax,%ebx
shl    $0x2,%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
test   %rax,%rax
mov    0x4(%rsp),%edi
je     13c5 <V3DTextureRescaleImage+0x275>
mov    %rax,%rbx
mov    0x2c7c(%rip),%rax
mov    (%rax),%ecx
sub    $0x8,%rsp
mov    %ebp,%esi
mov    %r14d,%edx
mov    %r15,%r8
mov    %r12d,%r9d
push   %rbx
push   %rcx
push   %r12
call   1030 <gluScaleImage@plt>
add    $0x20,%rsp
test   %eax,%eax
je     139f <V3DTextureRescaleImage+0x24f>
mov    0x2c5b(%rip),%rcx
mov    (%rcx),%ebp
mov    %eax,%edi
call   1060 <gluErrorString@plt>
lea    0xc6b(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
test   %r13,%r13
je     13a8 <V3DTextureRescaleImage+0x258>
mov    %rbx,0x0(%r13)
mov    0x40(%rsp),%rcx
test   %rcx,%rcx
mov    0x48(%rsp),%rax
je     13ba <V3DTextureRescaleImage+0x26a>
mov    %r12d,(%rcx)
mov    %r12d,%r14d
test   %rax,%rax
je     13c5 <V3DTextureRescaleImage+0x275>
mov    %r14d,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_UNSIGNED_BYTE = global i32 0
@stderr = global i32 0
@.str = [28 x i8] c"gluScaleImage(): Error: %s\0A\00"
define void @V3DTextureRescaleImage(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32** %5, i32* %6, i32* %7) {
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32**
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32*
store i32* %0, i32** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32** %5, i32*** %14
store i32* %6, i32** %15
store i32* %7, i32** %16
store i32* null, i32** %22
%23 = load i32**, i32*** %14
%24 = icmp ne i32** %23, null
br i1 %24, label %25, label %27
25: ; preds = %8
%26 = load i32**, i32*** %14
store i32* null, i32** %26
br label %27
27: ; preds = %25, %8
%28 = load i32*, i32** %15
%29 = icmp ne i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = load i32*, i32** %15
store i32 0, i32* %31
br label %32
32: ; preds = %30, %27
%33 = load i32*, i32** %16
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i32*, i32** %16
store i32 0, i32* %36
br label %37
37: ; preds = %35, %32
%38 = load i32*, i32** %9
%39 = icmp eq i32* %38, null
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* %10
%42 = icmp sle i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %40, %37
br label %155
44: ; preds = %40
%45 = load i32, i32* %12
%46 = call i64 @V3DTextureIsPowerOf2(i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %73
48: ; preds = %44
%49 = load i32, i32* %13
%50 = load i32, i32* %12
%51 = srem i32 %49, %50
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %72
53: ; preds = %48
%54 = load i32**, i32*** %14
%55 = icmp ne i32** %54, null
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i32*, i32** %9
%58 = load i32**, i32*** %14
store i32* %57, i32** %58
br label %59
59: ; preds = %56, %53
%60 = load i32*, i32** %15
%61 = icmp ne i32* %60, null
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load i32, i32* %12
%64 = load i32*, i32** %15
store i32 %63, i32* %64
br label %65
65: ; preds = %62, %59
%66 = load i32*, i32** %16
%67 = icmp ne i32* %66, null
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load i32, i32* %13
%70 = load i32*, i32** %16
store i32 %69, i32* %70
br label %71
71: ; preds = %68, %65
br label %155
72: ; preds = %48
br label %73
73: ; preds = %72, %44
%74 = load i32, i32* %12
%75 = load i32, i32* %13
%76 = icmp sgt i32 %74, %75
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = load i32, i32* %12
br label %81
79: ; preds = %73
%80 = load i32, i32* %13
br label %81
81: ; preds = %79, %77
%82 = phi i32 [ %78, %77 ], [ %80, %79 ]
store i32 %82, i32* %20
store i32 0, i32* %17
store i32 16, i32* %18
br label %83
83: ; preds = %95, %81
%84 = load i32, i32* %17
%85 = load i32, i32* %18
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %98
87: ; preds = %83
%88 = load i32, i32* %17
%89 = shl i32 1, %88
store i32 %89, i32* %21
%90 = load i32, i32* %21
%91 = load i32, i32* %20
%92 = icmp sgt i32 %90, %91
br i1 %92, label %93, label %94
93: ; preds = %87
br label %98
94: ; preds = %87
br label %95
95: ; preds = %94
%96 = load i32, i32* %17
%97 = add nsw i32 %96, 1
store i32 %97, i32* %17
br label %83
98: ; preds = %93, %83
%99 = load i32, i32* %17
%100 = load i32, i32* %18
%101 = icmp sge i32 %99, %100
br i1 %101, label %102, label %103
102: ; preds = %98
br label %155
103: ; preds = %98
%104 = load i32, i32* %21
%105 = load i32, i32* %21
%106 = mul nsw i32 %104, %105
%107 = load i32, i32* %10
%108 = mul nsw i32 %106, %107
%109 = sext i32 %108 to i64
%110 = mul i64 %109, 4
%111 = trunc i64 %110 to i32
%112 = call i64 @malloc(i32 %111)
%113 = inttoptr i64 %112 to i32*
store i32* %113, i32** %22
%114 = load i32*, i32** %22
%115 = icmp eq i32* %114, null
br i1 %115, label %116, label %117
116: ; preds = %103
br label %155
117: ; preds = %103
%118 = load i32, i32* %11
%119 = load i32, i32* %12
%120 = load i32, i32* %13
%121 = load i32, i32* @GL_UNSIGNED_BYTE
%122 = load i32*, i32** %9
%123 = bitcast i32* %122 to i8*
%124 = load i32, i32* %21
%125 = load i32, i32* %21
%126 = load i32, i32* @GL_UNSIGNED_BYTE
%127 = load i32*, i32** %22
%128 = call i32 @gluScaleImage(i32 %118, i32 %119, i32 %120, i32 %121, i8* %123, i32 %124, i32 %125, i32 %126, i32* %127)
store i32 %128, i32* %19
%129 = load i32, i32* %19
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %137
131: ; preds = %117
%132 = load i32, i32* @stderr
%133 = load i32, i32* %19
%134 = call i64 @gluErrorString(i32 %133)
%135 = inttoptr i64 %134 to i8*
%136 = call i32 @fprintf(i32 %132, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %135)
br label %137
137: ; preds = %131, %117
%138 = load i32**, i32*** %14
%139 = icmp ne i32** %138, null
br i1 %139, label %140, label %143
140: ; preds = %137
%141 = load i32*, i32** %22
%142 = load i32**, i32*** %14
store i32* %141, i32** %142
br label %143
143: ; preds = %140, %137
%144 = load i32*, i32** %15
%145 = icmp ne i32* %144, null
br i1 %145, label %146, label %149
146: ; preds = %143
%147 = load i32, i32* %21
%148 = load i32*, i32** %15
store i32 %147, i32* %148
br label %149
149: ; preds = %146, %143
%150 = load i32*, i32** %16
%151 = icmp ne i32* %150, null
br i1 %151, label %152, label %155
152: ; preds = %149
%153 = load i32, i32* %21
%154 = load i32*, i32** %16
store i32 %153, i32* %154
br label %155
155: ; preds = %43, %71, %102, %116, %152, %149
ret void
}

LLVM IR (-O2):
@GL_UNSIGNED_BYTE = global i32 0
@stderr = global i32 0
@.str = [28 x i8] c"gluScaleImage(): Error: %s\0A\00"
define void @V3DTextureRescaleImage(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32** writeonly %5, i32* writeonly %6, i32* writeonly %7) {
%9 = icmp eq i32** %5, null
br i1 %9, label %11, label %10
10: ; preds = %8
store i32* null, i32** %5
br label %11
11: ; preds = %10, %8
%12 = icmp eq i32* %6, null
br i1 %12, label %14, label %13
13: ; preds = %11
store i32 0, i32* %6
br label %14
14: ; preds = %13, %11
%15 = icmp eq i32* %7, null
br i1 %15, label %17, label %16
16: ; preds = %14
store i32 0, i32* %7
br label %17
17: ; preds = %16, %14
%18 = icmp eq i32* %0, null
%19 = icmp slt i32 %1, 1
%20 = or i1 %18, %19
br i1 %20, label %92, label %21
21: ; preds = %17
%22 = tail call i64 @V3DTextureIsPowerOf2(i32 %3)
%23 = icmp eq i64 %22, 0
br i1 %23, label %32, label %24
24: ; preds = %21
%25 = srem i32 %4, %3
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %24
br i1 %9, label %29, label %28
28: ; preds = %27
store i32* %0, i32** %5
br label %29
29: ; preds = %28, %27
br i1 %12, label %31, label %30
30: ; preds = %29
store i32 %3, i32* %6
br label %31
31: ; preds = %30, %29
br i1 %15, label %92, label %90
32: ; preds = %24, %21
%33 = icmp sgt i32 %3, %4
%34 = select i1 %33, i32 %3, i32 %4
%35 = icmp slt i32 %34, 1
br i1 %35, label %66, label %36
36: ; preds = %32
%37 = icmp eq i32 %34, 1
br i1 %37, label %66, label %38
38: ; preds = %36
%39 = icmp ult i32 %34, 4
br i1 %39, label %66, label %40
40: ; preds = %38
%41 = icmp ult i32 %34, 8
br i1 %41, label %66, label %42
42: ; preds = %40
%43 = icmp ult i32 %34, 16
br i1 %43, label %66, label %44
44: ; preds = %42
%45 = icmp ult i32 %34, 32
br i1 %45, label %66, label %46
46: ; preds = %44
%47 = icmp ult i32 %34, 64
br i1 %47, label %66, label %48
48: ; preds = %46
%49 = icmp ult i32 %34, 128
br i1 %49, label %66, label %50
50: ; preds = %48
%51 = icmp ult i32 %34, 256
br i1 %51, label %66, label %52
52: ; preds = %50
%53 = icmp ult i32 %34, 512
br i1 %53, label %66, label %54
54: ; preds = %52
%55 = icmp ult i32 %34, 1024
br i1 %55, label %66, label %56
56: ; preds = %54
%57 = icmp ult i32 %34, 2048
br i1 %57, label %66, label %58
58: ; preds = %56
%59 = icmp ult i32 %34, 4096
br i1 %59, label %66, label %60
60: ; preds = %58
%61 = icmp ult i32 %34, 8192
br i1 %61, label %66, label %62
62: ; preds = %60
%63 = icmp ult i32 %34, 16384
br i1 %63, label %66, label %64
64: ; preds = %62
%65 = icmp ult i32 %34, 32768
br i1 %65, label %66, label %92
66: ; preds = %64, %62, %60, %58, %56, %54, %52, %50, %48, %46, %44, %42, %40, %38, %36, %32
%67 = phi i32 [ 0, %32 ], [ 1, %36 ], [ 2, %38 ], [ 3, %40 ], [ 4, %42 ], [ 5, %44 ], [ 6, %46 ], [ 7, %48 ], [ 8, %50 ], [ 9, %52 ], [ 10, %54 ], [ 11, %56 ], [ 12, %58 ], [ 13, %60 ], [ 14, %62 ], [ 15, %64 ]
%68 = phi i32 [ 1, %32 ], [ 2, %36 ], [ 4, %38 ], [ 8, %40 ], [ 16, %42 ], [ 32, %44 ], [ 64, %46 ], [ 128, %48 ], [ 256, %50 ], [ 512, %52 ], [ 1024, %54 ], [ 2048, %56 ], [ 4096, %58 ], [ 8192, %60 ], [ 16384, %62 ], [ 32768, %64 ]
%69 = shl nuw nsw i32 %68, %67
%70 = shl i32 %1, 2
%71 = mul i32 %70, %69
%72 = tail call i64 @malloc(i32 %71)
%73 = inttoptr i64 %72 to i32*
%74 = icmp eq i64 %72, 0
br i1 %74, label %92, label %75
75: ; preds = %66
%76 = load i32, i32* @GL_UNSIGNED_BYTE
%77 = bitcast i32* %0 to i8*
%78 = tail call i32 @gluScaleImage(i32 %2, i32 %3, i32 %4, i32 %76, i8* %77, i32 %68, i32 %68, i32 %76, i32* %73)
%79 = icmp eq i32 %78, 0
br i1 %79, label %85, label %80
80: ; preds = %75
%81 = load i32, i32* @stderr
%82 = tail call i64 @gluErrorString(i32 %78)
%83 = inttoptr i64 %82 to i8*
%84 = tail call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %83)
br label %85
85: ; preds = %80, %75
br i1 %9, label %87, label %86
86: ; preds = %85
store i32* %73, i32** %5
br label %87
87: ; preds = %86, %85
br i1 %12, label %89, label %88
88: ; preds = %87
store i32 %68, i32* %6
br label %89
89: ; preds = %88, %87
br i1 %15, label %92, label %90
90: ; preds = %89, %31
%91 = phi i32 [ %4, %31 ], [ %68, %89 ]
store i32 %91, i32* %7
br label %92
92: ; preds = %90, %64, %89, %66, %31, %17
ret void
}