#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 PackRGBA(int, int, int, int);
void DecompressBlockBC1Internal(const uint8_t *block, unsigned char *output,
                                uint32_t outputStride,
                                const uint8_t *alphaValues) {
  uint32_t temp, code;
  uint16_t color0, color1;
  uint8_t r0, g0, b0, r1, g1, b1;
  int i, j;
  color0 = *(const uint16_t *)(block);
  color1 = *(const uint16_t *)(block + 2);
  temp = (color0 >> 11) * 255 + 16;
  r0 = (uint8_t)((temp / 32 + temp) / 32);
  temp = ((color0 & 0x07E0) >> 5) * 255 + 32;
  g0 = (uint8_t)((temp / 64 + temp) / 64);
  temp = (color0 & 0x001F) * 255 + 16;
  b0 = (uint8_t)((temp / 32 + temp) / 32);
  temp = (color1 >> 11) * 255 + 16;
  r1 = (uint8_t)((temp / 32 + temp) / 32);
  temp = ((color1 & 0x07E0) >> 5) * 255 + 32;
  g1 = (uint8_t)((temp / 64 + temp) / 64);
  temp = (color1 & 0x001F) * 255 + 16;
  b1 = (uint8_t)((temp / 32 + temp) / 32);
  code = *(const uint32_t *)(block + 4);
  if (color0 > color1) {
    for (j = 0; j < 4; ++j) {
      for (i = 0; i < 4; ++i) {
        uint32_t finalColor, positionCode;
        uint8_t alpha;
        alpha = alphaValues[j * 4 + i];
        finalColor = 0;
        positionCode = (code >> 2 * (4 * j + i)) & 0x03;
        switch (positionCode) {
        case 0:
          finalColor = PackRGBA(r0, g0, b0, alpha);
          break;
        case 1:
          finalColor = PackRGBA(r1, g1, b1, alpha);
          break;
        case 2:
          finalColor = PackRGBA((2 * r0 + r1) / 3, (2 * g0 + g1) / 3,
                                (2 * b0 + b1) / 3, alpha);
          break;
        case 3:
          finalColor = PackRGBA((r0 + 2 * r1) / 3, (g0 + 2 * g1) / 3,
                                (b0 + 2 * b1) / 3, alpha);
          break;
        }
        *(uint32_t *)(output + j * outputStride + i * sizeof(uint32_t)) =
            finalColor;
      }
    }
  } else {
    for (j = 0; j < 4; ++j) {
      for (i = 0; i < 4; ++i) {
        uint32_t finalColor, positionCode;
        uint8_t alpha;
        alpha = alphaValues[j * 4 + i];
        finalColor = 0;
        positionCode = (code >> 2 * (4 * j + i)) & 0x03;
        switch (positionCode) {
        case 0:
          finalColor = PackRGBA(r0, g0, b0, alpha);
          break;
        case 1:
          finalColor = PackRGBA(r1, g1, b1, alpha);
          break;
        case 2:
          finalColor =
              PackRGBA((r0 + r1) / 2, (g0 + g1) / 2, (b0 + b1) / 2, alpha);
          break;
        case 3:
          finalColor = PackRGBA(0, 0, 0, alpha);
          break;
        }
        *(uint32_t *)(output + j * outputStride + i * sizeof(uint32_t)) =
            finalColor;
      }
    }
  }
}


x86 assembly (clang, -O0):
<DecompressBlockBC1Internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
sar    $0xb,%eax
imul   $0xff,%eax,%eax
add    $0x10,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
and    $0x7e0,%eax
sar    $0x5,%eax
imul   $0xff,%eax,%eax
add    $0x20,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
and    $0x1f,%eax
imul   $0xff,%eax,%eax
add    $0x10,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%eax
sar    $0xb,%eax
imul   $0xff,%eax,%eax
add    $0x10,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%eax
and    $0x7e0,%eax
sar    $0x5,%eax
imul   $0xff,%eax,%eax
add    $0x20,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
mov    -0x30(%rbp),%eax
and    $0x1f,%eax
imul   $0xff,%eax,%eax
add    $0x10,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    13eb <DecompressBlockBC1Internal+0x2db>
movl   $0x0,-0x50(%rbp)
cmpl   $0x4,-0x50(%rbp)
jge    13e6 <DecompressBlockBC1Internal+0x2d6>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    13d3 <DecompressBlockBC1Internal+0x2c3>
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
mov    -0x4c(%rbp),%esi
mov    %ecx,%edx
mov    %esi,%ecx
lea    (%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x5c(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x50(%rbp),%ecx
mov    -0x4c(%rbp),%esi
mov    %ecx,%edx
mov    %esi,%ecx
lea    (%rcx,%rdx,4),%ecx
add    %cl,%cl
sar    %cl,%eax
and    $0x3,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %rax,-0x70(%rbp)
sub    $0x3,%rax
ja     13a6 <DecompressBlockBC1Internal+0x296>
mov    -0x70(%rbp),%rax
lea    0xd38(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x5c(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x54(%rbp)
jmp    13a6 <DecompressBlockBC1Internal+0x296>
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x5c(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x54(%rbp)
jmp    13a6 <DecompressBlockBC1Internal+0x296>
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
add    -0x40(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x38(%rbp),%eax
shl    $0x1,%eax
add    -0x44(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
add    -0x48(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x5c(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x54(%rbp)
jmp    13a6 <DecompressBlockBC1Internal+0x296>
mov    -0x34(%rbp),%eax
mov    -0x40(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x38(%rbp),%eax
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x3c(%rbp),%eax
mov    -0x48(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x5c(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x4c(%rbp),%rcx
shl    $0x2,%rcx
mov    %edx,(%rax,%rcx,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1277 <DecompressBlockBC1Internal+0x167>
jmp    13d8 <DecompressBlockBC1Internal+0x2c8>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1266 <DecompressBlockBC1Internal+0x156>
jmp    1535 <DecompressBlockBC1Internal+0x425>
movl   $0x0,-0x50(%rbp)
cmpl   $0x4,-0x50(%rbp)
jge    1530 <DecompressBlockBC1Internal+0x420>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    151d <DecompressBlockBC1Internal+0x40d>
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
mov    -0x4c(%rbp),%esi
mov    %ecx,%edx
mov    %esi,%ecx
lea    (%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x50(%rbp),%ecx
mov    -0x4c(%rbp),%esi
mov    %ecx,%edx
mov    %esi,%ecx
lea    (%rcx,%rdx,4),%ecx
add    %cl,%cl
sar    %cl,%eax
and    $0x3,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %rax,-0x78(%rbp)
sub    $0x3,%rax
ja     14f0 <DecompressBlockBC1Internal+0x3e0>
mov    -0x78(%rbp),%rax
lea    0xb9c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x68(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x60(%rbp)
jmp    14f0 <DecompressBlockBC1Internal+0x3e0>
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x68(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x60(%rbp)
jmp    14f0 <DecompressBlockBC1Internal+0x3e0>
mov    -0x34(%rbp),%eax
add    -0x40(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x38(%rbp),%eax
add    -0x44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x3c(%rbp),%eax
add    -0x48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x68(%rbp),%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x60(%rbp)
jmp    14f0 <DecompressBlockBC1Internal+0x3e0>
mov    -0x68(%rbp),%ecx
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <PackRGBA@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x4c(%rbp),%rcx
shl    $0x2,%rcx
mov    %edx,(%rax,%rcx,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1403 <DecompressBlockBC1Internal+0x2f3>
jmp    1522 <DecompressBlockBC1Internal+0x412>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    13f2 <DecompressBlockBC1Internal+0x2e2>
jmp    1535 <DecompressBlockBC1Internal+0x425>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DecompressBlockBC1Internal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rcx,%r14
mov    %rsi,%rbx
mov    (%rdi),%r8d
mov    0x8(%rdi),%r9d
mov    %r8d,%esi
sar    $0xb,%esi
mov    %esi,%ebp
shl    $0x8,%ebp
sub    %esi,%ebp
lea    0x10(%rbp),%esi
lea    0x2f(%rbp),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x5,%eax
lea    (%rax,%rbp,1),%esi
add    $0x10,%esi
lea    (%rax,%rbp,1),%r15d
add    $0x2f,%r15d
test   %esi,%esi
cmovns %esi,%r15d
sar    $0x5,%r15d
mov    %r8d,%eax
shr    $0x5,%eax
and    $0x3f,%eax
mov    %eax,%esi
shl    $0x8,%esi
sub    %eax,%esi
lea    0x20(%rsi),%eax
shr    $0x6,%eax
lea    (%rax,%rsi,1),%r10d
add    $0x20,%r10d
shr    $0x6,%r10d
mov    %r8d,%eax
and    $0x1f,%eax
mov    %eax,%esi
shl    $0x8,%esi
sub    %eax,%esi
lea    0x10(%rsi),%eax
shr    $0x5,%eax
lea    (%rax,%rsi,1),%r11d
add    $0x10,%r11d
shr    $0x5,%r11d
mov    %r9d,%eax
sar    $0xb,%eax
mov    %eax,%esi
shl    $0x8,%esi
sub    %eax,%esi
lea    0x10(%rsi),%eax
lea    0x2f(%rsi),%ebp
test   %eax,%eax
cmovns %eax,%ebp
sar    $0x5,%ebp
lea    (%rsi,%rbp,1),%eax
add    $0x10,%eax
add    %esi,%ebp
add    $0x2f,%ebp
test   %eax,%eax
cmovns %eax,%ebp
sar    $0x5,%ebp
mov    %r9d,%eax
shr    $0x5,%eax
and    $0x3f,%eax
mov    %eax,%esi
shl    $0x8,%esi
sub    %eax,%esi
lea    0x20(%rsi),%eax
shr    $0x6,%eax
lea    (%rax,%rsi,1),%ecx
add    $0x20,%ecx
shr    $0x6,%ecx
mov    %r9d,%eax
and    $0x1f,%eax
mov    %eax,%esi
shl    $0x8,%esi
sub    %eax,%esi
lea    0x10(%rsi),%eax
shr    $0x5,%eax
add    %eax,%esi
add    $0x10,%esi
shr    $0x5,%esi
mov    0x10(%rdi),%r12d
cmp    %r9d,%r8d
mov    %r15,0x40(%rsp)
mov    %r10,0x38(%rsp)
mov    %r11,0x30(%rsp)
mov    %rbp,0x28(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
jle    1622 <DecompressBlockBC1Internal+0x512>
lea    (%r15,%rbp,2),%eax
cltq
imul   $0x55555556,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
shr    $0x20,%rdi
add    %eax,%edi
mov    %rdi,0x50(%rsp)
lea    (%r10,%rcx,2),%eax
movzwl %ax,%eax
imul   $0xaaab,%eax,%eax
shr    $0x11,%eax
mov    %eax,0x14(%rsp)
lea    (%r11,%rsi,2),%eax
movzwl %ax,%eax
imul   $0xaaab,%eax,%eax
shr    $0x11,%eax
mov    %eax,0x10(%rsp)
lea    0x0(%rbp,%r15,2),%eax
cltq
imul   $0x55555556,%rax,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
shr    $0x20,%rbp
add    %eax,%ebp
lea    (%rcx,%r10,2),%eax
movzwl %ax,%eax
imul   $0xaaab,%eax,%eax
shr    $0x11,%eax
mov    %eax,0xc(%rsp)
lea    (%rsi,%r11,2),%eax
movzwl %ax,%eax
imul   $0xaaab,%eax,%r15d
shr    $0x11,%r15d
movslq %edx,%rax
mov    %rax,0x48(%rsp)
add    $0xc,%rbx
xor    %r13d,%r13d
jmp    12f9 <DecompressBlockBC1Internal+0x1e9>
nopl   0x0(%rax,%rax,1)
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,(%rbx)
add    $0x8,%r13
add    0x48(%rsp),%rbx
cmp    $0x20,%r13
je     196e <DecompressBlockBC1Internal+0x85e>
mov    %r12d,%eax
mov    %r13d,%ecx
sar    %cl,%eax
mov    (%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xd31(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
lea    0x2(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x4(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xd09(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    %ebp,%edi
mov    0xc(%rsp),%esi
mov    %r15d,%edx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
lea    0x2(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x4(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xcd7(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
lea    0x2(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x4(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xc91(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
nopl   0x0(%rax,%rax,1)
mov    0x50(%rsp),%rdi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
lea    0x2(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x4(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xc53(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
lea    0x4(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x8(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xc2b(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
xchg   %ax,%ax
mov    %ebp,%edi
mov    0xc(%rsp),%esi
mov    %r15d,%edx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
lea    0x4(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x8(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xbf7(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
lea    0x4(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x8(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xbb1(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
nopl   0x0(%rax,%rax,1)
mov    0x50(%rsp),%rdi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
lea    0x4(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0x8(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xb73(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
lea    0x6(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0xc(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xb4b(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
xchg   %ax,%ax
mov    %ebp,%edi
mov    0xc(%rsp),%esi
mov    %r15d,%edx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
lea    0x6(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0xc(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xb17(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
lea    0x6(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0xc(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xad1(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
nopl   0x0(%rax,%rax,1)
mov    0x50(%rsp),%rdi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
lea    0x6(%r13),%ecx
mov    %r12d,%eax
sar    %cl,%eax
mov    0xc(%r14,%r13,2),%ecx
and    $0x3,%eax
lea    0xa93(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
jmp    12df <DecompressBlockBC1Internal+0x1cf>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    0xc(%rsp),%esi
mov    %r15d,%edx
jmp    12df <DecompressBlockBC1Internal+0x1cf>
xchg   %ax,%ax
mov    0x50(%rsp),%rdi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
jmp    12df <DecompressBlockBC1Internal+0x1cf>
lea    (%r15,%rbp,1),%eax
mov    %eax,%r13d
shr    $0x1f,%r13d
add    %eax,%r13d
sar    %r13d
lea    (%rcx,%r10,1),%eax
shr    %eax
mov    %eax,0xc(%rsp)
lea    (%rsi,%r11,1),%eax
shr    %eax
mov    %eax,0x48(%rsp)
movslq %edx,%rbp
add    $0xc,%rbx
xor    %r15d,%r15d
mov    (%r14,%r15,2),%eax
mov    %r12d,%edx
xor    %ecx,%ecx
sar    %cl,%edx
and    $0x3,%edx
lea    0x99a(%rip),%rsi
movslq (%rsi,%rdx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    %r12d,%edx
mov    %r15d,%ecx
sar    %cl,%edx
mov    (%r14,%r15,2),%eax
and    $0x3,%edx
lea    0x97b(%rip),%rsi
movslq (%rsi,%rdx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
mov    0x4(%r14,%r15,2),%eax
lea    0x2(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x951(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
mov    0x4(%r14,%r15,2),%eax
lea    0x2(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x917(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    %r13d,%edi
mov    0xc(%rsp),%esi
mov    0x48(%rsp),%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
mov    0x4(%r14,%r15,2),%eax
lea    0x2(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x8e1(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0xc(%rbx)
mov    0x4(%r14,%r15,2),%eax
lea    0x2(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x8b0(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
mov    0x8(%r14,%r15,2),%eax
lea    0x4(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x886(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
mov    0x8(%r14,%r15,2),%eax
lea    0x4(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x855(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
mov    0x8(%r14,%r15,2),%eax
lea    0x4(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x81b(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    %r13d,%edi
mov    0xc(%rsp),%esi
mov    0x48(%rsp),%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x8(%rbx)
mov    0x8(%r14,%r15,2),%eax
lea    0x4(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x7e5(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
mov    0xc(%r14,%r15,2),%eax
lea    0x6(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x7bb(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
mov    0xc(%r14,%r15,2),%eax
lea    0x6(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x78a(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
mov    0xc(%r14,%r15,2),%eax
lea    0x6(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x750(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    %r13d,%edi
mov    0xc(%rsp),%esi
mov    0x48(%rsp),%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,-0x4(%rbx)
mov    0xc(%r14,%r15,2),%eax
lea    0x6(%r15),%ecx
mov    %r12d,%edx
sar    %cl,%edx
and    $0x3,%edx
lea    0x71a(%rip),%rcx
movslq (%rcx,%rdx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%rsi
mov    0x30(%rsp),%rdx
jmp    1947 <DecompressBlockBC1Internal+0x837>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1954 <DecompressBlockBC1Internal+0x844>
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
jmp    1954 <DecompressBlockBC1Internal+0x844>
mov    %r13d,%edi
mov    0xc(%rsp),%esi
mov    0x48(%rsp),%edx
mov    %eax,%ecx
call   1030 <PackRGBA@plt>
mov    %eax,(%rbx)
add    $0x8,%r15
add    %rbp,%rbx
cmp    $0x20,%r15
jne    166f <DecompressBlockBC1Internal+0x55f>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @DecompressBlockBC1Internal(i32* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i8*
%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 i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%27 = load i32*, i32** %5
%28 = load i32, i32* %27
store i32 %28, i32* %11
%29 = load i32*, i32** %5
%30 = getelementptr inbounds i32, i32* %29, i64 2
%31 = load i32, i32* %30
store i32 %31, i32* %12
%32 = load i32, i32* %11
%33 = ashr i32 %32, 11
%34 = mul nsw i32 %33, 255
%35 = add nsw i32 %34, 16
store i32 %35, i32* %9
%36 = load i32, i32* %9
%37 = sdiv i32 %36, 32
%38 = load i32, i32* %9
%39 = add nsw i32 %37, %38
%40 = sdiv i32 %39, 32
store i32 %40, i32* %13
%41 = load i32, i32* %11
%42 = and i32 %41, 2016
%43 = ashr i32 %42, 5
%44 = mul nsw i32 %43, 255
%45 = add nsw i32 %44, 32
store i32 %45, i32* %9
%46 = load i32, i32* %9
%47 = sdiv i32 %46, 64
%48 = load i32, i32* %9
%49 = add nsw i32 %47, %48
%50 = sdiv i32 %49, 64
store i32 %50, i32* %14
%51 = load i32, i32* %11
%52 = and i32 %51, 31
%53 = mul nsw i32 %52, 255
%54 = add nsw i32 %53, 16
store i32 %54, i32* %9
%55 = load i32, i32* %9
%56 = sdiv i32 %55, 32
%57 = load i32, i32* %9
%58 = add nsw i32 %56, %57
%59 = sdiv i32 %58, 32
store i32 %59, i32* %15
%60 = load i32, i32* %12
%61 = ashr i32 %60, 11
%62 = mul nsw i32 %61, 255
%63 = add nsw i32 %62, 16
store i32 %63, i32* %9
%64 = load i32, i32* %9
%65 = sdiv i32 %64, 32
%66 = load i32, i32* %9
%67 = add nsw i32 %65, %66
%68 = sdiv i32 %67, 32
store i32 %68, i32* %16
%69 = load i32, i32* %12
%70 = and i32 %69, 2016
%71 = ashr i32 %70, 5
%72 = mul nsw i32 %71, 255
%73 = add nsw i32 %72, 32
store i32 %73, i32* %9
%74 = load i32, i32* %9
%75 = sdiv i32 %74, 64
%76 = load i32, i32* %9
%77 = add nsw i32 %75, %76
%78 = sdiv i32 %77, 64
store i32 %78, i32* %17
%79 = load i32, i32* %12
%80 = and i32 %79, 31
%81 = mul nsw i32 %80, 255
%82 = add nsw i32 %81, 16
store i32 %82, i32* %9
%83 = load i32, i32* %9
%84 = sdiv i32 %83, 32
%85 = load i32, i32* %9
%86 = add nsw i32 %84, %85
%87 = sdiv i32 %86, 32
store i32 %87, i32* %18
%88 = load i32*, i32** %5
%89 = getelementptr inbounds i32, i32* %88, i64 4
%90 = load i32, i32* %89
store i32 %90, i32* %10
%91 = load i32, i32* %11
%92 = load i32, i32* %12
%93 = icmp sgt i32 %91, %92
br i1 %93, label %94, label %189
94: ; preds = %4
store i32 0, i32* %20
br label %95
95: ; preds = %185, %94
%96 = load i32, i32* %20
%97 = icmp slt i32 %96, 4
br i1 %97, label %98, label %188
98: ; preds = %95
store i32 0, i32* %19
br label %99
99: ; preds = %181, %98
%100 = load i32, i32* %19
%101 = icmp slt i32 %100, 4
br i1 %101, label %102, label %184
102: ; preds = %99
%103 = load i32*, i32** %8
%104 = load i32, i32* %20
%105 = mul nsw i32 %104, 4
%106 = load i32, i32* %19
%107 = add nsw i32 %105, %106
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %103, i64 %108
%110 = load i32, i32* %109
store i32 %110, i32* %23
store i32 0, i32* %21
%111 = load i32, i32* %10
%112 = load i32, i32* %20
%113 = mul nsw i32 4, %112
%114 = load i32, i32* %19
%115 = add nsw i32 %113, %114
%116 = mul nsw i32 2, %115
%117 = ashr i32 %111, %116
%118 = and i32 %117, 3
store i32 %118, i32* %22
%119 = load i32, i32* %22
switch i32 %119, label %168 [
i32 0, label %120
i32 1, label %126
i32 2, label %132
i32 3, label %150
]
120: ; preds = %102
%121 = load i32, i32* %13
%122 = load i32, i32* %14
%123 = load i32, i32* %15
%124 = load i32, i32* %23
%125 = call i32 @PackRGBA(i32 %121, i32 %122, i32 %123, i32 %124)
store i32 %125, i32* %21
br label %168
126: ; preds = %102
%127 = load i32, i32* %16
%128 = load i32, i32* %17
%129 = load i32, i32* %18
%130 = load i32, i32* %23
%131 = call i32 @PackRGBA(i32 %127, i32 %128, i32 %129, i32 %130)
store i32 %131, i32* %21
br label %168
132: ; preds = %102
%133 = load i32, i32* %13
%134 = mul nsw i32 2, %133
%135 = load i32, i32* %16
%136 = add nsw i32 %134, %135
%137 = sdiv i32 %136, 3
%138 = load i32, i32* %14
%139 = mul nsw i32 2, %138
%140 = load i32, i32* %17
%141 = add nsw i32 %139, %140
%142 = sdiv i32 %141, 3
%143 = load i32, i32* %15
%144 = mul nsw i32 2, %143
%145 = load i32, i32* %18
%146 = add nsw i32 %144, %145
%147 = sdiv i32 %146, 3
%148 = load i32, i32* %23
%149 = call i32 @PackRGBA(i32 %137, i32 %142, i32 %147, i32 %148)
store i32 %149, i32* %21
br label %168
150: ; preds = %102
%151 = load i32, i32* %13
%152 = load i32, i32* %16
%153 = mul nsw i32 2, %152
%154 = add nsw i32 %151, %153
%155 = sdiv i32 %154, 3
%156 = load i32, i32* %14
%157 = load i32, i32* %17
%158 = mul nsw i32 2, %157
%159 = add nsw i32 %156, %158
%160 = sdiv i32 %159, 3
%161 = load i32, i32* %15
%162 = load i32, i32* %18
%163 = mul nsw i32 2, %162
%164 = add nsw i32 %161, %163
%165 = sdiv i32 %164, 3
%166 = load i32, i32* %23
%167 = call i32 @PackRGBA(i32 %155, i32 %160, i32 %165, i32 %166)
store i32 %167, i32* %21
br label %168
168: ; preds = %102, %150, %132, %126, %120
%169 = load i32, i32* %21
%170 = load i8*, i8** %6
%171 = load i32, i32* %20
%172 = load i32, i32* %7
%173 = mul nsw i32 %171, %172
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8, i8* %170, i64 %174
%176 = load i32, i32* %19
%177 = sext i32 %176 to i64
%178 = mul i64 %177, 4
%179 = getelementptr inbounds i8, i8* %175, i64 %178
%180 = bitcast i8* %179 to i32*
store i32 %169, i32* %180
br label %181
181: ; preds = %168
%182 = load i32, i32* %19
%183 = add nsw i32 %182, 1
store i32 %183, i32* %19
br label %99
184: ; preds = %99
br label %185
185: ; preds = %184
%186 = load i32, i32* %20
%187 = add nsw i32 %186, 1
store i32 %187, i32* %20
br label %95
188: ; preds = %95
br label %266
189: ; preds = %4
store i32 0, i32* %20
br label %190
190: ; preds = %262, %189
%191 = load i32, i32* %20
%192 = icmp slt i32 %191, 4
br i1 %192, label %193, label %265
193: ; preds = %190
store i32 0, i32* %19
br label %194
194: ; preds = %258, %193
%195 = load i32, i32* %19
%196 = icmp slt i32 %195, 4
br i1 %196, label %197, label %261
197: ; preds = %194
%198 = load i32*, i32** %8
%199 = load i32, i32* %20
%200 = mul nsw i32 %199, 4
%201 = load i32, i32* %19
%202 = add nsw i32 %200, %201
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i32, i32* %198, i64 %203
%205 = load i32, i32* %204
store i32 %205, i32* %26
store i32 0, i32* %24
%206 = load i32, i32* %10
%207 = load i32, i32* %20
%208 = mul nsw i32 4, %207
%209 = load i32, i32* %19
%210 = add nsw i32 %208, %209
%211 = mul nsw i32 2, %210
%212 = ashr i32 %206, %211
%213 = and i32 %212, 3
store i32 %213, i32* %25
%214 = load i32, i32* %25
switch i32 %214, label %245 [
i32 0, label %215
i32 1, label %221
i32 2, label %227
i32 3, label %242
]
215: ; preds = %197
%216 = load i32, i32* %13
%217 = load i32, i32* %14
%218 = load i32, i32* %15
%219 = load i32, i32* %26
%220 = call i32 @PackRGBA(i32 %216, i32 %217, i32 %218, i32 %219)
store i32 %220, i32* %24
br label %245
221: ; preds = %197
%222 = load i32, i32* %16
%223 = load i32, i32* %17
%224 = load i32, i32* %18
%225 = load i32, i32* %26
%226 = call i32 @PackRGBA(i32 %222, i32 %223, i32 %224, i32 %225)
store i32 %226, i32* %24
br label %245
227: ; preds = %197
%228 = load i32, i32* %13
%229 = load i32, i32* %16
%230 = add nsw i32 %228, %229
%231 = sdiv i32 %230, 2
%232 = load i32, i32* %14
%233 = load i32, i32* %17
%234 = add nsw i32 %232, %233
%235 = sdiv i32 %234, 2
%236 = load i32, i32* %15
%237 = load i32, i32* %18
%238 = add nsw i32 %236, %237
%239 = sdiv i32 %238, 2
%240 = load i32, i32* %26
%241 = call i32 @PackRGBA(i32 %231, i32 %235, i32 %239, i32 %240)
store i32 %241, i32* %24
br label %245
242: ; preds = %197
%243 = load i32, i32* %26
%244 = call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %243)
store i32 %244, i32* %24
br label %245
245: ; preds = %197, %242, %227, %221, %215
%246 = load i32, i32* %24
%247 = load i8*, i8** %6
%248 = load i32, i32* %20
%249 = load i32, i32* %7
%250 = mul nsw i32 %248, %249
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i8, i8* %247, i64 %251
%253 = load i32, i32* %19
%254 = sext i32 %253 to i64
%255 = mul i64 %254, 4
%256 = getelementptr inbounds i8, i8* %252, i64 %255
%257 = bitcast i8* %256 to i32*
store i32 %246, i32* %257
br label %258
258: ; preds = %245
%259 = load i32, i32* %19
%260 = add nsw i32 %259, 1
store i32 %260, i32* %19
br label %194
261: ; preds = %194
br label %262
262: ; preds = %261
%263 = load i32, i32* %20
%264 = add nsw i32 %263, 1
store i32 %264, i32* %20
br label %190
265: ; preds = %190
br label %266
266: ; preds = %265, %188
ret void
}

LLVM IR (-O2):
define void @DecompressBlockBC1Internal(i32* nocapture %0, i8* nocapture writeonly %1, i32 %2, i32* nocapture %3) {
%5 = load i32, i32* %0
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = ashr i32 %5, 11
%9 = mul nsw i32 %8, 255
%10 = add nsw i32 %9, 16
%11 = sdiv i32 %10, 32
%12 = add nsw i32 %11, %10
%13 = sdiv i32 %12, 32
%14 = lshr i32 %5, 5
%15 = and i32 %14, 63
%16 = mul nuw nsw i32 %15, 255
%17 = add nuw nsw i32 %16, 32
%18 = lshr i32 %17, 6
%19 = add nuw nsw i32 %18, %17
%20 = lshr i32 %19, 6
%21 = and i32 %5, 31
%22 = mul nuw nsw i32 %21, 255
%23 = add nuw nsw i32 %22, 16
%24 = lshr i32 %23, 5
%25 = add nuw nsw i32 %24, %23
%26 = lshr i32 %25, 5
%27 = ashr i32 %7, 11
%28 = mul nsw i32 %27, 255
%29 = add nsw i32 %28, 16
%30 = sdiv i32 %29, 32
%31 = add nsw i32 %30, %29
%32 = sdiv i32 %31, 32
%33 = lshr i32 %7, 5
%34 = and i32 %33, 63
%35 = mul nuw nsw i32 %34, 255
%36 = add nuw nsw i32 %35, 32
%37 = lshr i32 %36, 6
%38 = add nuw nsw i32 %37, %36
%39 = lshr i32 %38, 6
%40 = and i32 %7, 31
%41 = mul nuw nsw i32 %40, 255
%42 = add nuw nsw i32 %41, 16
%43 = lshr i32 %42, 5
%44 = add nuw nsw i32 %43, %42
%45 = lshr i32 %44, 5
%46 = getelementptr inbounds i32, i32* %0, i64 4
%47 = load i32, i32* %46
%48 = icmp sgt i32 %5, %7
br i1 %48, label %57, label %49
49: ; preds = %4
%50 = add nsw i32 %32, %13
%51 = sdiv i32 %50, 2
%52 = add nuw nsw i32 %39, %20
%53 = lshr i32 %52, 1
%54 = add nuw nsw i32 %45, %26
%55 = lshr i32 %54, 1
%56 = sext i32 %2 to i64
br label %167
57: ; preds = %4
%58 = shl nsw i32 %32, 1
%59 = add nsw i32 %58, %13
%60 = sdiv i32 %59, 3
%61 = shl nuw nsw i32 %39, 1
%62 = add nuw nsw i32 %61, %20
%63 = trunc i32 %62 to i16
%64 = udiv i16 %63, 3
%65 = zext i16 %64 to i32
%66 = shl nuw nsw i32 %45, 1
%67 = add nuw nsw i32 %66, %26
%68 = trunc i32 %67 to i16
%69 = udiv i16 %68, 3
%70 = zext i16 %69 to i32
%71 = shl nsw i32 %13, 1
%72 = add nsw i32 %71, %32
%73 = sdiv i32 %72, 3
%74 = shl nuw nsw i32 %20, 1
%75 = add nuw nsw i32 %74, %39
%76 = trunc i32 %75 to i16
%77 = udiv i16 %76, 3
%78 = zext i16 %77 to i32
%79 = shl nuw nsw i32 %26, 1
%80 = add nuw nsw i32 %79, %45
%81 = trunc i32 %80 to i16
%82 = udiv i16 %81, 3
%83 = zext i16 %82 to i32
%84 = sext i32 %2 to i64
br label %85
85: ; preds = %57, %161
%86 = phi i64 [ 0, %57 ], [ %165, %161 ]
%87 = shl nsw i64 %86, 2
%88 = mul nsw i64 %86, %84
%89 = getelementptr inbounds i8, i8* %1, i64 %88
%90 = getelementptr inbounds i32, i32* %3, i64 %87
%91 = load i32, i32* %90
%92 = trunc i64 %86 to i32
%93 = shl i32 %92, 3
%94 = ashr i32 %47, %93
%95 = and i32 %94, 3
switch i32 %95, label %104 [
i32 0, label %96
i32 1, label %98
i32 2, label %100
i32 3, label %102
]
96: ; preds = %85
%97 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %91)
br label %105
98: ; preds = %85
%99 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %91)
br label %105
100: ; preds = %85
%101 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %91)
br label %105
102: ; preds = %85
%103 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %91)
br label %105
104: ; preds = %142, %123, %105, %85
unreachable
105: ; preds = %102, %100, %98, %96
%106 = phi i32 [ %103, %102 ], [ %101, %100 ], [ %99, %98 ], [ %97, %96 ]
%107 = bitcast i8* %89 to i32*
store i32 %106, i32* %107
%108 = or i64 %87, 1
%109 = getelementptr inbounds i32, i32* %3, i64 %108
%110 = load i32, i32* %109
%111 = trunc i64 %108 to i32
%112 = shl i32 %111, 1
%113 = ashr i32 %47, %112
%114 = and i32 %113, 3
switch i32 %114, label %104 [
i32 0, label %121
i32 1, label %119
i32 2, label %117
i32 3, label %115
]
115: ; preds = %105
%116 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %110)
br label %123
117: ; preds = %105
%118 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %110)
br label %123
119: ; preds = %105
%120 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %110)
br label %123
121: ; preds = %105
%122 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %110)
br label %123
123: ; preds = %121, %119, %117, %115
%124 = phi i32 [ %116, %115 ], [ %118, %117 ], [ %120, %119 ], [ %122, %121 ]
%125 = getelementptr inbounds i8, i8* %89, i64 4
%126 = bitcast i8* %125 to i32*
store i32 %124, i32* %126
%127 = or i64 %87, 2
%128 = getelementptr inbounds i32, i32* %3, i64 %127
%129 = load i32, i32* %128
%130 = trunc i64 %127 to i32
%131 = shl i32 %130, 1
%132 = ashr i32 %47, %131
%133 = and i32 %132, 3
switch i32 %133, label %104 [
i32 0, label %140
i32 1, label %138
i32 2, label %136
i32 3, label %134
]
134: ; preds = %123
%135 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %129)
br label %142
136: ; preds = %123
%137 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %129)
br label %142
138: ; preds = %123
%139 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %129)
br label %142
140: ; preds = %123
%141 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %129)
br label %142
142: ; preds = %140, %138, %136, %134
%143 = phi i32 [ %135, %134 ], [ %137, %136 ], [ %139, %138 ], [ %141, %140 ]
%144 = getelementptr inbounds i8, i8* %89, i64 8
%145 = bitcast i8* %144 to i32*
store i32 %143, i32* %145
%146 = or i64 %87, 3
%147 = getelementptr inbounds i32, i32* %3, i64 %146
%148 = load i32, i32* %147
%149 = trunc i64 %146 to i32
%150 = shl i32 %149, 1
%151 = ashr i32 %47, %150
%152 = and i32 %151, 3
switch i32 %152, label %104 [
i32 0, label %159
i32 1, label %157
i32 2, label %155
i32 3, label %153
]
153: ; preds = %142
%154 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %148)
br label %161
155: ; preds = %142
%156 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %148)
br label %161
157: ; preds = %142
%158 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %148)
br label %161
159: ; preds = %142
%160 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %148)
br label %161
161: ; preds = %159, %157, %155, %153
%162 = phi i32 [ %154, %153 ], [ %156, %155 ], [ %158, %157 ], [ %160, %159 ]
%163 = getelementptr inbounds i8, i8* %89, i64 12
%164 = bitcast i8* %163 to i32*
store i32 %162, i32* %164
%165 = add nuw nsw i64 %86, 1
%166 = icmp eq i64 %165, 4
br i1 %166, label %249, label %85
167: ; preds = %49, %243
%168 = phi i64 [ 0, %49 ], [ %247, %243 ]
%169 = shl nsw i64 %168, 2
%170 = mul nsw i64 %168, %56
%171 = getelementptr inbounds i8, i8* %1, i64 %170
%172 = getelementptr inbounds i32, i32* %3, i64 %169
%173 = load i32, i32* %172
%174 = trunc i64 %168 to i32
%175 = shl i32 %174, 3
%176 = ashr i32 %47, %175
%177 = and i32 %176, 3
switch i32 %177, label %186 [
i32 0, label %178
i32 1, label %180
i32 2, label %182
i32 3, label %184
]
178: ; preds = %167
%179 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %173)
br label %187
180: ; preds = %167
%181 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %173)
br label %187
182: ; preds = %167
%183 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %173)
br label %187
184: ; preds = %167
%185 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %173)
br label %187
186: ; preds = %224, %205, %187, %167
unreachable
187: ; preds = %184, %182, %180, %178
%188 = phi i32 [ %185, %184 ], [ %183, %182 ], [ %181, %180 ], [ %179, %178 ]
%189 = bitcast i8* %171 to i32*
store i32 %188, i32* %189
%190 = or i64 %169, 1
%191 = getelementptr inbounds i32, i32* %3, i64 %190
%192 = load i32, i32* %191
%193 = trunc i64 %190 to i32
%194 = shl i32 %193, 1
%195 = ashr i32 %47, %194
%196 = and i32 %195, 3
switch i32 %196, label %186 [
i32 0, label %203
i32 1, label %201
i32 2, label %199
i32 3, label %197
]
197: ; preds = %187
%198 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %192)
br label %205
199: ; preds = %187
%200 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %192)
br label %205
201: ; preds = %187
%202 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %192)
br label %205
203: ; preds = %187
%204 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %192)
br label %205
205: ; preds = %203, %201, %199, %197
%206 = phi i32 [ %198, %197 ], [ %200, %199 ], [ %202, %201 ], [ %204, %203 ]
%207 = getelementptr inbounds i8, i8* %171, i64 4
%208 = bitcast i8* %207 to i32*
store i32 %206, i32* %208
%209 = or i64 %169, 2
%210 = getelementptr inbounds i32, i32* %3, i64 %209
%211 = load i32, i32* %210
%212 = trunc i64 %209 to i32
%213 = shl i32 %212, 1
%214 = ashr i32 %47, %213
%215 = and i32 %214, 3
switch i32 %215, label %186 [
i32 0, label %222
i32 1, label %220
i32 2, label %218
i32 3, label %216
]
216: ; preds = %205
%217 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %211)
br label %224
218: ; preds = %205
%219 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %211)
br label %224
220: ; preds = %205
%221 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %211)
br label %224
222: ; preds = %205
%223 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %211)
br label %224
224: ; preds = %222, %220, %218, %216
%225 = phi i32 [ %217, %216 ], [ %219, %218 ], [ %221, %220 ], [ %223, %222 ]
%226 = getelementptr inbounds i8, i8* %171, i64 8
%227 = bitcast i8* %226 to i32*
store i32 %225, i32* %227
%228 = or i64 %169, 3
%229 = getelementptr inbounds i32, i32* %3, i64 %228
%230 = load i32, i32* %229
%231 = trunc i64 %228 to i32
%232 = shl i32 %231, 1
%233 = ashr i32 %47, %232
%234 = and i32 %233, 3
switch i32 %234, label %186 [
i32 0, label %241
i32 1, label %239
i32 2, label %237
i32 3, label %235
]
235: ; preds = %224
%236 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %230)
br label %243
237: ; preds = %224
%238 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %230)
br label %243
239: ; preds = %224
%240 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %230)
br label %243
241: ; preds = %224
%242 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %230)
br label %243
243: ; preds = %241, %239, %237, %235
%244 = phi i32 [ %236, %235 ], [ %238, %237 ], [ %240, %239 ], [ %242, %241 ]
%245 = getelementptr inbounds i8, i8* %171, i64 12
%246 = bitcast i8* %245 to i32*
store i32 %244, i32* %246
%247 = add nuw nsw i64 %168, 1
%248 = icmp eq i64 %247, 4
br i1 %248, label %249, label %167
249: ; preds = %243, %161
ret void
}