#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 uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ decompress(int const *, int **, int *, int);
int deindex_4bpp(int *, int, int *, int **);
int /*<<< orphan*/ detile(int *, int, int, int **);
int /*<<< orphan*/ free(int *);
void extract_image(uint8_t *buffer, uint32_t imgAddr, uint32_t palAddr,
                   int compImg, int compPal, uint32_t **out) {
  uint32_t destSize, srcSize, *pixels = NULL, *image = NULL;
  uint8_t *output = NULL, *offset = NULL;
  size_t i;
  offset = (uint8_t *)(buffer + (imgAddr - 0x8000000));
  srcSize = (1 << 24) - (imgAddr - 0x8000000);
  if (compImg) {
    decompress((const uint8_t *)offset, &output, &destSize, srcSize);
  } else {
    output = offset;
  }
  uint16_t *paletteGBA = NULL;
  uint8_t *paletteComp = (uint8_t *)((palAddr - 0x8000000) + buffer);
  srcSize = (1 << 24) - (palAddr - 0x8000000);
  if (compPal) {
    decompress((const uint8_t *)paletteComp, (uint8_t **)&paletteGBA, NULL,
               srcSize);
  } else {
    paletteGBA = (uint16_t *)paletteComp;
  }
  uint32_t paletteRGBA[16] = {};
  for (i = 0; i < 16; i++) {
    uint32_t r, g, b, a;
    r = ((paletteGBA[i] >> 0) & 0x1F) << (3);
    g = ((paletteGBA[i] >> 5) & 0x1F) << (3 + 8);
    b = ((paletteGBA[i] >> 10) & 0x1F) << (3 + 16);
    a = (i ? 0xFF : 0x0) << 24;
    paletteRGBA[i] = r | g | b | a;
  }
  int length = deindex_4bpp(output, destSize, paletteRGBA, &pixels);
  if (compImg)
    free(output);
  detile(pixels, length, 8, &image);
  *out = image;
  free(pixels);
}


x86 assembly (clang, -O0):
<extract_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
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,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x8000000,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%ecx
sub    $0x8000000,%ecx
mov    $0x1000000,%eax
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11e1 <extract_image+0x91>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%ecx
lea    -0x40(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1070 <decompress@plt>
jmp    11e9 <extract_image+0x99>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x58(%rbp)
mov    -0x10(%rbp),%ecx
sub    $0x8000000,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%ecx
sub    $0x8000000,%ecx
mov    $0x1000000,%eax
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1242 <extract_image+0xf2>
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%ecx
lea    -0x58(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <decompress@plt>
jmp    124a <extract_image+0xfa>
mov    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movq   $0x0,-0x50(%rbp)
cmpq   $0x10,-0x50(%rbp)
jae    130d <extract_image+0x1bd>
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sar    $0x0,%eax
and    $0x1f,%eax
shl    $0x3,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sar    $0x5,%eax
and    $0x1f,%eax
shl    $0xb,%eax
mov    %eax,-0xa8(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sar    $0xa,%eax
and    $0x1f,%eax
shl    $0x13,%eax
mov    %eax,-0xac(%rbp)
mov    -0x50(%rbp),%rdx
xor    %eax,%eax
mov    $0xff,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
shl    $0x18,%eax
mov    %eax,-0xb0(%rbp)
mov    -0xa4(%rbp),%ecx
or     -0xa8(%rbp),%ecx
or     -0xac(%rbp),%ecx
or     -0xb0(%rbp),%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1265 <extract_image+0x115>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0xa0(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1060 <deindex_4bpp@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     133d <extract_image+0x1ed>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
mov    -0xb4(%rbp),%esi
mov    $0x8,%edx
lea    -0x38(%rbp),%rcx
call   1050 <detile@plt>
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_image>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %r9,%r14
mov    %r8d,%r12d
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %rdi,%rbp
movq   $0x0,0x18(%rsp)
movq   $0x0,0x28(%rsp)
movq   $0x0,0x8(%rsp)
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
add    $0xffffffffe0000000,%rdi
test   %ecx,%ecx
je     119f <extract_image+0x5f>
mov    $0x9000000,%ecx
sub    %esi,%ecx
lea    0x8(%rsp),%rsi
lea    0x24(%rsp),%rdx
call   1060 <decompress@plt>
jmp    11a4 <extract_image+0x64>
mov    %rdi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
movslq %ebx,%rax
lea    -0x20000000(,%rax,4),%rdi
e0
add    %rbp,%rdi
test   %r12d,%r12d
je     11da <extract_image+0x9a>
mov    $0x9000000,%ecx
sub    %ebx,%ecx
lea    0x10(%rsp),%rsi
xor    %edx,%edx
call   1060 <decompress@plt>
mov    0x10(%rsp),%rdi
jmp    11df <extract_image+0x9f>
mov    %rdi,0x10(%rsp)
pxor   %xmm0,%xmm0
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
lea    0x40(%rdi),%rax
lea    0x30(%rsp),%rcx
cmp    %rax,%rcx
jae    1269 <extract_image+0x129>
lea    0x70(%rsp),%rax
cmp    %rax,%rdi
jae    1269 <extract_image+0x129>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rdi,%rax,4),%ecx
mov    %ecx,%edx
and    $0x1f,%edx
mov    %ecx,%esi
shl    $0x6,%esi
and    $0xf800,%esi
shl    $0x9,%ecx
and    $0xf80000,%ecx
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
shl    $0x18,%ebp
or     %esi,%ebp
lea    0x0(%rbp,%rdx,8),%edx
add    %edx,%ecx
add    $0xff000000,%ecx
mov    %ecx,0x30(%rsp,%rax,4)
add    $0x1,%rax
cmp    $0x10,%rax
jne    1220 <extract_image+0xe0>
jmp    1374 <extract_image+0x234>
movdqu (%rdi),%xmm3
movdqa %xmm3,%xmm2
pslld  $0x3,%xmm2
movdqa 0xd82(%rip),%xmm0
pand   %xmm0,%xmm2
movdqa %xmm3,%xmm4
pslld  $0x6,%xmm4
movdqa 0xd7d(%rip),%xmm1
pand   %xmm1,%xmm4
por    %xmm2,%xmm4
pslld  $0x9,%xmm3
movdqa 0xd78(%rip),%xmm2
pand   %xmm2,%xmm3
por    %xmm4,%xmm3
por    0xd78(%rip),%xmm3
movdqa %xmm3,0x30(%rsp)
movdqu 0x10(%rdi),%xmm4
movdqa %xmm4,%xmm3
pslld  $0x3,%xmm3
pand   %xmm0,%xmm3
movdqa %xmm4,%xmm5
pslld  $0x6,%xmm5
pand   %xmm1,%xmm5
por    %xmm3,%xmm5
pslld  $0x9,%xmm4
pand   %xmm2,%xmm4
movdqa 0xd4e(%rip),%xmm3
por    %xmm3,%xmm4
por    %xmm5,%xmm4
movdqa %xmm4,0x40(%rsp)
movdqu 0x20(%rdi),%xmm4
movdqa %xmm4,%xmm5
pslld  $0x3,%xmm5
pand   %xmm0,%xmm5
movdqa %xmm4,%xmm6
pslld  $0x6,%xmm6
pand   %xmm1,%xmm6
por    %xmm5,%xmm6
pslld  $0x9,%xmm4
pand   %xmm2,%xmm4
por    %xmm3,%xmm4
por    %xmm6,%xmm4
movdqa %xmm4,0x50(%rsp)
movdqu 0x30(%rdi),%xmm4
movdqa %xmm4,%xmm5
pslld  $0x3,%xmm5
pand   %xmm0,%xmm5
movdqa %xmm4,%xmm0
pslld  $0x6,%xmm0
pand   %xmm1,%xmm0
por    %xmm5,%xmm0
pslld  $0x9,%xmm4
pand   %xmm2,%xmm4
por    %xmm3,%xmm4
por    %xmm0,%xmm4
movdqa %xmm4,0x60(%rsp)
mov    0x8(%rsp),%rdi
mov    0x24(%rsp),%esi
lea    0x30(%rsp),%rdx
lea    0x18(%rsp),%rcx
call   1050 <deindex_4bpp@plt>
mov    %eax,%ebx
test   %r15d,%r15d
je     139d <extract_image+0x25d>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
lea    0x28(%rsp),%rcx
mov    %ebx,%esi
mov    $0x8,%edx
call   1040 <detile@plt>
mov    0x28(%rsp),%rax
mov    %rax,(%r14)
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @extract_image(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32** %5) {
%7 = alloca i32*
%8 = alloca i32
%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 i64
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca [16 x i32]
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32** %5, i32*** %12
store i32* null, i32** %15
store i32* null, i32** %16
store i32* null, i32** %17
store i32* null, i32** %18
%28 = load i32*, i32** %7
%29 = load i32, i32* %8
%30 = sub nsw i32 %29, 134217728
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %28, i64 %31
store i32* %32, i32** %18
%33 = load i32, i32* %8
%34 = sub nsw i32 %33, 134217728
%35 = sub nsw i32 16777216, %34
store i32 %35, i32* %14
%36 = load i32, i32* %10
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %6
%39 = load i32*, i32** %18
%40 = load i32, i32* %14
%41 = call i32 @decompress(i32* %39, i32** %17, i32* %13, i32 %40)
br label %44
42: ; preds = %6
%43 = load i32*, i32** %18
store i32* %43, i32** %17
br label %44
44: ; preds = %42, %38
store i32* null, i32** %20
%45 = load i32, i32* %9
%46 = sub nsw i32 %45, 134217728
%47 = load i32*, i32** %7
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds i32, i32* %47, i64 %48
store i32* %49, i32** %21
%50 = load i32, i32* %9
%51 = sub nsw i32 %50, 134217728
%52 = sub nsw i32 16777216, %51
store i32 %52, i32* %14
%53 = load i32, i32* %11
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %44
%56 = load i32*, i32** %21
%57 = load i32, i32* %14
%58 = call i32 @decompress(i32* %56, i32** %20, i32* null, i32 %57)
br label %61
59: ; preds = %44
%60 = load i32*, i32** %21
store i32* %60, i32** %20
br label %61
61: ; preds = %59, %55
%62 = bitcast [16 x i32]* %22 to i8*
store i64 0, i64* %19
br label %63
63: ; preds = %102, %61
%64 = load i64, i64* %19
%65 = icmp ult i64 %64, 16
br i1 %65, label %66, label %105
66: ; preds = %63
%67 = load i32*, i32** %20
%68 = load i64, i64* %19
%69 = getelementptr inbounds i32, i32* %67, i64 %68
%70 = load i32, i32* %69
%71 = ashr i32 %70, 0
%72 = and i32 %71, 31
%73 = shl i32 %72, 3
store i32 %73, i32* %23
%74 = load i32*, i32** %20
%75 = load i64, i64* %19
%76 = getelementptr inbounds i32, i32* %74, i64 %75
%77 = load i32, i32* %76
%78 = ashr i32 %77, 5
%79 = and i32 %78, 31
%80 = shl i32 %79, 11
store i32 %80, i32* %24
%81 = load i32*, i32** %20
%82 = load i64, i64* %19
%83 = getelementptr inbounds i32, i32* %81, i64 %82
%84 = load i32, i32* %83
%85 = ashr i32 %84, 10
%86 = and i32 %85, 31
%87 = shl i32 %86, 19
store i32 %87, i32* %25
%88 = load i64, i64* %19
%89 = icmp ne i64 %88, 0
%90 = zext i1 %89 to i64
%91 = select i1 %89, i32 255, i32 0
%92 = shl i32 %91, 24
store i32 %92, i32* %26
%93 = load i32, i32* %23
%94 = load i32, i32* %24
%95 = or i32 %93, %94
%96 = load i32, i32* %25
%97 = or i32 %95, %96
%98 = load i32, i32* %26
%99 = or i32 %97, %98
%100 = load i64, i64* %19
%101 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 %100
store i32 %99, i32* %101
br label %102
102: ; preds = %66
%103 = load i64, i64* %19
%104 = add i64 %103, 1
store i64 %104, i64* %19
br label %63
105: ; preds = %63
%106 = load i32*, i32** %17
%107 = load i32, i32* %13
%108 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%109 = call i32 @deindex_4bpp(i32* %106, i32 %107, i32* %108, i32** %15)
store i32 %109, i32* %27
%110 = load i32, i32* %10
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %115
112: ; preds = %105
%113 = load i32*, i32** %17
%114 = call i32 @free(i32* %113)
br label %115
115: ; preds = %112, %105
%116 = load i32*, i32** %15
%117 = load i32, i32* %27
%118 = call i32 @detile(i32* %116, i32 %117, i32 8, i32** %16)
%119 = load i32*, i32** %16
%120 = load i32**, i32*** %12
store i32* %119, i32** %120
%121 = load i32*, i32** %15
%122 = call i32 @free(i32* %121)
ret void
}

LLVM IR (-O2):
define void @extract_image(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32** nocapture writeonly %5) {
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca [16 x i32]
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32** %8 to i8*
store i32* null, i32** %8
%15 = bitcast i32** %9 to i8*
store i32* null, i32** %9
%16 = bitcast i32** %10 to i8*
store i32* null, i32** %10
%17 = add nsw i32 %1, -134217728
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = icmp eq i32 %3, 0
br i1 %20, label %24, label %21
21: ; preds = %6
%22 = sub i32 150994944, %1
%23 = call i32 @decompress(i32* %19, i32** %10, i32* %7, i32 %22)
br label %25
24: ; preds = %6
store i32* %19, i32** %10
br label %25
25: ; preds = %24, %21
%26 = bitcast i32** %11 to i8*
store i32* null, i32** %11
%27 = add nsw i32 %2, -134217728
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = icmp eq i32 %4, 0
br i1 %30, label %35, label %31
31: ; preds = %25
%32 = sub i32 150994944, %2
%33 = call i32 @decompress(i32* %29, i32** %11, i32* null, i32 %32)
%34 = load i32*, i32** %11
br label %36
35: ; preds = %25
store i32* %29, i32** %11
br label %36
36: ; preds = %35, %31
%37 = phi i32* [ %29, %35 ], [ %34, %31 ]
%38 = bitcast [16 x i32]* %12 to i8*
%39 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 1, i64 0
%40 = getelementptr i32, i32* %37, i64 16
%41 = bitcast i32* %40 to [16 x i32]*
%42 = icmp ult [16 x i32]* %12, %41
%43 = icmp ult i32* %37, %39
%44 = and i1 %42, %43
br i1 %44, label %100, label %45
45: ; preds = %36
%46 = bitcast i32* %37 to <4 x i32>*
%47 = load <4 x i32>, <4 x i32>* %46
%48 = shl <4 x i32> %47, <i32 3, i32 3, i32 3, i32 3>
%49 = and <4 x i32> %48, <i32 248, i32 248, i32 248, i32 248>
%50 = shl <4 x i32> %47, <i32 6, i32 6, i32 6, i32 6>
%51 = and <4 x i32> %50, <i32 63488, i32 63488, i32 63488, i32 63488>
%52 = shl <4 x i32> %47, <i32 9, i32 9, i32 9, i32 9>
%53 = and <4 x i32> %52, <i32 16252928, i32 16252928, i32 16252928, i32 16252928>
%54 = or <4 x i32> %51, <i32 0, i32 -16777216, i32 -16777216, i32 -16777216>
%55 = or <4 x i32> %54, %49
%56 = or <4 x i32> %55, %53
%57 = bitcast [16 x i32]* %12 to <4 x i32>*
store <4 x i32> %56, <4 x i32>* %57
%58 = getelementptr inbounds i32, i32* %37, i64 4
%59 = bitcast i32* %58 to <4 x i32>*
%60 = load <4 x i32>, <4 x i32>* %59
%61 = shl <4 x i32> %60, <i32 3, i32 3, i32 3, i32 3>
%62 = and <4 x i32> %61, <i32 248, i32 248, i32 248, i32 248>
%63 = shl <4 x i32> %60, <i32 6, i32 6, i32 6, i32 6>
%64 = and <4 x i32> %63, <i32 63488, i32 63488, i32 63488, i32 63488>
%65 = shl <4 x i32> %60, <i32 9, i32 9, i32 9, i32 9>
%66 = and <4 x i32> %65, <i32 16252928, i32 16252928, i32 16252928, i32 16252928>
%67 = or <4 x i32> %64, <i32 -16777216, i32 -16777216, i32 -16777216, i32 -16777216>
%68 = or <4 x i32> %67, %62
%69 = or <4 x i32> %68, %66
%70 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 4
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> %69, <4 x i32>* %71
%72 = getelementptr inbounds i32, i32* %37, i64 8
%73 = bitcast i32* %72 to <4 x i32>*
%74 = load <4 x i32>, <4 x i32>* %73
%75 = shl <4 x i32> %74, <i32 3, i32 3, i32 3, i32 3>
%76 = and <4 x i32> %75, <i32 248, i32 248, i32 248, i32 248>
%77 = shl <4 x i32> %74, <i32 6, i32 6, i32 6, i32 6>
%78 = and <4 x i32> %77, <i32 63488, i32 63488, i32 63488, i32 63488>
%79 = shl <4 x i32> %74, <i32 9, i32 9, i32 9, i32 9>
%80 = and <4 x i32> %79, <i32 16252928, i32 16252928, i32 16252928, i32 16252928>
%81 = or <4 x i32> %78, <i32 -16777216, i32 -16777216, i32 -16777216, i32 -16777216>
%82 = or <4 x i32> %81, %76
%83 = or <4 x i32> %82, %80
%84 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 8
%85 = bitcast i32* %84 to <4 x i32>*
store <4 x i32> %83, <4 x i32>* %85
%86 = getelementptr inbounds i32, i32* %37, i64 12
%87 = bitcast i32* %86 to <4 x i32>*
%88 = load <4 x i32>, <4 x i32>* %87
%89 = shl <4 x i32> %88, <i32 3, i32 3, i32 3, i32 3>
%90 = and <4 x i32> %89, <i32 248, i32 248, i32 248, i32 248>
%91 = shl <4 x i32> %88, <i32 6, i32 6, i32 6, i32 6>
%92 = and <4 x i32> %91, <i32 63488, i32 63488, i32 63488, i32 63488>
%93 = shl <4 x i32> %88, <i32 9, i32 9, i32 9, i32 9>
%94 = and <4 x i32> %93, <i32 16252928, i32 16252928, i32 16252928, i32 16252928>
%95 = or <4 x i32> %92, <i32 -16777216, i32 -16777216, i32 -16777216, i32 -16777216>
%96 = or <4 x i32> %95, %90
%97 = or <4 x i32> %96, %94
%98 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 12
%99 = bitcast i32* %98 to <4 x i32>*
store <4 x i32> %97, <4 x i32>* %99
br label %118
100: ; preds = %36, %100
%101 = phi i64 [ %116, %100 ], [ 0, %36 ]
%102 = getelementptr inbounds i32, i32* %37, i64 %101
%103 = load i32, i32* %102
%104 = shl i32 %103, 3
%105 = and i32 %104, 248
%106 = shl i32 %103, 6
%107 = and i32 %106, 63488
%108 = shl i32 %103, 9
%109 = and i32 %108, 16252928
%110 = icmp eq i64 %101, 0
%111 = select i1 %110, i32 0, i32 -16777216
%112 = or i32 %107, %111
%113 = or i32 %112, %105
%114 = or i32 %113, %109
%115 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 %101
store i32 %114, i32* %115
%116 = add nuw nsw i64 %101, 1
%117 = icmp eq i64 %116, 16
br i1 %117, label %118, label %100
118: ; preds = %100, %45
%119 = load i32*, i32** %10
%120 = load i32, i32* %7
%121 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 0
%122 = call i32 @deindex_4bpp(i32* %119, i32 %120, i32* %121, i32** %8)
br i1 %20, label %126, label %123
123: ; preds = %118
%124 = load i32*, i32** %10
%125 = call i32 @free(i32* %124)
br label %126
126: ; preds = %123, %118
%127 = load i32*, i32** %8
%128 = call i32 @detile(i32* %127, i32 %122, i32 8, i32** %9)
%129 = load i32*, i32** %9
store i32* %129, i32** %5
%130 = load i32*, i32** %8
%131 = call i32 @free(i32* %130)
ret void
}