#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 DecompressBlockDXT1Internal(const uint8_t *block, uint32_t *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;
        }
        output[j * outputStride + i] = 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;
        }
        output[j * outputStride + i] = finalColor;
      }
    }
  }
}


x86 assembly (clang, -O0):
<DecompressBlockDXT1Internal>:
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    13e3 <DecompressBlockDXT1Internal+0x2d3>
movl   $0x0,-0x50(%rbp)
cmpl   $0x4,-0x50(%rbp)
jge    13de <DecompressBlockDXT1Internal+0x2ce>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    13cb <DecompressBlockDXT1Internal+0x2bb>
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 <DecompressBlockDXT1Internal+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 <DecompressBlockDXT1Internal+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 <DecompressBlockDXT1Internal+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 <DecompressBlockDXT1Internal+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
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1277 <DecompressBlockDXT1Internal+0x167>
jmp    13d0 <DecompressBlockDXT1Internal+0x2c0>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1266 <DecompressBlockDXT1Internal+0x156>
jmp    1525 <DecompressBlockDXT1Internal+0x415>
movl   $0x0,-0x50(%rbp)
cmpl   $0x4,-0x50(%rbp)
jge    1520 <DecompressBlockDXT1Internal+0x410>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    150d <DecompressBlockDXT1Internal+0x3fd>
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     14e8 <DecompressBlockDXT1Internal+0x3d8>
mov    -0x78(%rbp),%rax
lea    0xba4(%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    14e8 <DecompressBlockDXT1Internal+0x3d8>
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    14e8 <DecompressBlockDXT1Internal+0x3d8>
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    14e8 <DecompressBlockDXT1Internal+0x3d8>
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
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13fb <DecompressBlockDXT1Internal+0x2eb>
jmp    1512 <DecompressBlockDXT1Internal+0x402>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    13ea <DecompressBlockDXT1Internal+0x2da>
jmp    1525 <DecompressBlockDXT1Internal+0x415>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DecompressBlockDXT1Internal>:
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 <DecompressBlockDXT1Internal+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
add    $0xc,%rbx
shl    $0x2,%rax
mov    %rax,0x48(%rsp)
xor    %r13d,%r13d
jmp    12f9 <DecompressBlockDXT1Internal+0x1e9>
nop
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     1972 <DecompressBlockDXT1Internal+0x862>
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 <DecompressBlockDXT1Internal+0x1cf>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    0xc(%rsp),%esi
mov    %r15d,%edx
jmp    12df <DecompressBlockDXT1Internal+0x1cf>
xchg   %ax,%ax
mov    0x50(%rsp),%rdi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
jmp    12df <DecompressBlockDXT1Internal+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
shl    $0x2,%rbp
xor    %r15d,%r15d
mov    (%r14,%r15,2),%eax
mov    %r12d,%edx
xor    %ecx,%ecx
sar    %cl,%edx
and    $0x3,%edx
lea    0x996(%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    0x977(%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    0x94d(%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    0x913(%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    0x8dd(%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    0x8ac(%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    0x882(%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    0x851(%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    0x817(%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    0x7e1(%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    0x7b7(%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    0x786(%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    0x74c(%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    0x716(%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    194b <DecompressBlockDXT1Internal+0x83b>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1958 <DecompressBlockDXT1Internal+0x848>
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
jmp    1958 <DecompressBlockDXT1Internal+0x848>
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    1673 <DecompressBlockDXT1Internal+0x563>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @DecompressBlockDXT1Internal(i32* %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%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 i32* %1, i32** %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 %186
94: ; preds = %4
store i32 0, i32* %20
br label %95
95: ; preds = %182, %94
%96 = load i32, i32* %20
%97 = icmp slt i32 %96, 4
br i1 %97, label %98, label %185
98: ; preds = %95
store i32 0, i32* %19
br label %99
99: ; preds = %178, %98
%100 = load i32, i32* %19
%101 = icmp slt i32 %100, 4
br i1 %101, label %102, label %181
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 i32*, i32** %6
%171 = load i32, i32* %20
%172 = load i32, i32* %7
%173 = mul nsw i32 %171, %172
%174 = load i32, i32* %19
%175 = add nsw i32 %173, %174
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i32, i32* %170, i64 %176
store i32 %169, i32* %177
br label %178
178: ; preds = %168
%179 = load i32, i32* %19
%180 = add nsw i32 %179, 1
store i32 %180, i32* %19
br label %99
181: ; preds = %99
br label %182
182: ; preds = %181
%183 = load i32, i32* %20
%184 = add nsw i32 %183, 1
store i32 %184, i32* %20
br label %95
185: ; preds = %95
br label %260
186: ; preds = %4
store i32 0, i32* %20
br label %187
187: ; preds = %256, %186
%188 = load i32, i32* %20
%189 = icmp slt i32 %188, 4
br i1 %189, label %190, label %259
190: ; preds = %187
store i32 0, i32* %19
br label %191
191: ; preds = %252, %190
%192 = load i32, i32* %19
%193 = icmp slt i32 %192, 4
br i1 %193, label %194, label %255
194: ; preds = %191
%195 = load i32*, i32** %8
%196 = load i32, i32* %20
%197 = mul nsw i32 %196, 4
%198 = load i32, i32* %19
%199 = add nsw i32 %197, %198
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds i32, i32* %195, i64 %200
%202 = load i32, i32* %201
store i32 %202, i32* %26
store i32 0, i32* %24
%203 = load i32, i32* %10
%204 = load i32, i32* %20
%205 = mul nsw i32 4, %204
%206 = load i32, i32* %19
%207 = add nsw i32 %205, %206
%208 = mul nsw i32 2, %207
%209 = ashr i32 %203, %208
%210 = and i32 %209, 3
store i32 %210, i32* %25
%211 = load i32, i32* %25
switch i32 %211, label %242 [
i32 0, label %212
i32 1, label %218
i32 2, label %224
i32 3, label %239
]
212: ; preds = %194
%213 = load i32, i32* %13
%214 = load i32, i32* %14
%215 = load i32, i32* %15
%216 = load i32, i32* %26
%217 = call i32 @PackRGBA(i32 %213, i32 %214, i32 %215, i32 %216)
store i32 %217, i32* %24
br label %242
218: ; preds = %194
%219 = load i32, i32* %16
%220 = load i32, i32* %17
%221 = load i32, i32* %18
%222 = load i32, i32* %26
%223 = call i32 @PackRGBA(i32 %219, i32 %220, i32 %221, i32 %222)
store i32 %223, i32* %24
br label %242
224: ; preds = %194
%225 = load i32, i32* %13
%226 = load i32, i32* %16
%227 = add nsw i32 %225, %226
%228 = sdiv i32 %227, 2
%229 = load i32, i32* %14
%230 = load i32, i32* %17
%231 = add nsw i32 %229, %230
%232 = sdiv i32 %231, 2
%233 = load i32, i32* %15
%234 = load i32, i32* %18
%235 = add nsw i32 %233, %234
%236 = sdiv i32 %235, 2
%237 = load i32, i32* %26
%238 = call i32 @PackRGBA(i32 %228, i32 %232, i32 %236, i32 %237)
store i32 %238, i32* %24
br label %242
239: ; preds = %194
%240 = load i32, i32* %26
%241 = call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %240)
store i32 %241, i32* %24
br label %242
242: ; preds = %194, %239, %224, %218, %212
%243 = load i32, i32* %24
%244 = load i32*, i32** %6
%245 = load i32, i32* %20
%246 = load i32, i32* %7
%247 = mul nsw i32 %245, %246
%248 = load i32, i32* %19
%249 = add nsw i32 %247, %248
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds i32, i32* %244, i64 %250
store i32 %243, i32* %251
br label %252
252: ; preds = %242
%253 = load i32, i32* %19
%254 = add nsw i32 %253, 1
store i32 %254, i32* %19
br label %191
255: ; preds = %191
br label %256
256: ; preds = %255
%257 = load i32, i32* %20
%258 = add nsw i32 %257, 1
store i32 %258, i32* %20
br label %187
259: ; preds = %187
br label %260
260: ; preds = %259, %185
ret void
}

LLVM IR (-O2):
define void @DecompressBlockDXT1Internal(i32* nocapture %0, i32* 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 %166
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, %160
%86 = phi i64 [ 0, %57 ], [ %164, %160 ]
%87 = shl nsw i64 %86, 2
%88 = mul nsw i64 %86, %84
%89 = getelementptr inbounds i32, i32* %3, i64 %87
%90 = load i32, i32* %89
%91 = trunc i64 %86 to i32
%92 = shl i32 %91, 3
%93 = ashr i32 %47, %92
%94 = and i32 %93, 3
switch i32 %94, label %103 [
i32 0, label %95
i32 1, label %97
i32 2, label %99
i32 3, label %101
]
95: ; preds = %85
%96 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %90)
br label %104
97: ; preds = %85
%98 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %90)
br label %104
99: ; preds = %85
%100 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %90)
br label %104
101: ; preds = %85
%102 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %90)
br label %104
103: ; preds = %141, %122, %104, %85
unreachable
104: ; preds = %101, %99, %97, %95
%105 = phi i32 [ %102, %101 ], [ %100, %99 ], [ %98, %97 ], [ %96, %95 ]
%106 = getelementptr inbounds i32, i32* %1, i64 %88
store i32 %105, i32* %106
%107 = or i64 %87, 1
%108 = getelementptr inbounds i32, i32* %3, i64 %107
%109 = load i32, i32* %108
%110 = trunc i64 %107 to i32
%111 = shl i32 %110, 1
%112 = ashr i32 %47, %111
%113 = and i32 %112, 3
switch i32 %113, label %103 [
i32 0, label %120
i32 1, label %118
i32 2, label %116
i32 3, label %114
]
114: ; preds = %104
%115 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %109)
br label %122
116: ; preds = %104
%117 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %109)
br label %122
118: ; preds = %104
%119 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %109)
br label %122
120: ; preds = %104
%121 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %109)
br label %122
122: ; preds = %120, %118, %116, %114
%123 = phi i32 [ %115, %114 ], [ %117, %116 ], [ %119, %118 ], [ %121, %120 ]
%124 = add nsw i64 %88, 1
%125 = getelementptr inbounds i32, i32* %1, i64 %124
store i32 %123, i32* %125
%126 = or i64 %87, 2
%127 = getelementptr inbounds i32, i32* %3, i64 %126
%128 = load i32, i32* %127
%129 = trunc i64 %126 to i32
%130 = shl i32 %129, 1
%131 = ashr i32 %47, %130
%132 = and i32 %131, 3
switch i32 %132, label %103 [
i32 0, label %139
i32 1, label %137
i32 2, label %135
i32 3, label %133
]
133: ; preds = %122
%134 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %128)
br label %141
135: ; preds = %122
%136 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %128)
br label %141
137: ; preds = %122
%138 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %128)
br label %141
139: ; preds = %122
%140 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %128)
br label %141
141: ; preds = %139, %137, %135, %133
%142 = phi i32 [ %134, %133 ], [ %136, %135 ], [ %138, %137 ], [ %140, %139 ]
%143 = add nsw i64 %88, 2
%144 = getelementptr inbounds i32, i32* %1, i64 %143
store i32 %142, i32* %144
%145 = or i64 %87, 3
%146 = getelementptr inbounds i32, i32* %3, i64 %145
%147 = load i32, i32* %146
%148 = trunc i64 %145 to i32
%149 = shl i32 %148, 1
%150 = ashr i32 %47, %149
%151 = and i32 %150, 3
switch i32 %151, label %103 [
i32 0, label %158
i32 1, label %156
i32 2, label %154
i32 3, label %152
]
152: ; preds = %141
%153 = tail call i32 @PackRGBA(i32 %60, i32 %65, i32 %70, i32 %147)
br label %160
154: ; preds = %141
%155 = tail call i32 @PackRGBA(i32 %73, i32 %78, i32 %83, i32 %147)
br label %160
156: ; preds = %141
%157 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %147)
br label %160
158: ; preds = %141
%159 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %147)
br label %160
160: ; preds = %158, %156, %154, %152
%161 = phi i32 [ %153, %152 ], [ %155, %154 ], [ %157, %156 ], [ %159, %158 ]
%162 = add nsw i64 %88, 3
%163 = getelementptr inbounds i32, i32* %1, i64 %162
store i32 %161, i32* %163
%164 = add nuw nsw i64 %86, 1
%165 = icmp eq i64 %164, 4
br i1 %165, label %247, label %85
166: ; preds = %49, %241
%167 = phi i64 [ 0, %49 ], [ %245, %241 ]
%168 = shl nsw i64 %167, 2
%169 = mul nsw i64 %167, %56
%170 = getelementptr inbounds i32, i32* %3, i64 %168
%171 = load i32, i32* %170
%172 = trunc i64 %167 to i32
%173 = shl i32 %172, 3
%174 = ashr i32 %47, %173
%175 = and i32 %174, 3
switch i32 %175, label %184 [
i32 0, label %176
i32 1, label %178
i32 2, label %180
i32 3, label %182
]
176: ; preds = %166
%177 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %171)
br label %185
178: ; preds = %166
%179 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %171)
br label %185
180: ; preds = %166
%181 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %171)
br label %185
182: ; preds = %166
%183 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %171)
br label %185
184: ; preds = %222, %203, %185, %166
unreachable
185: ; preds = %182, %180, %178, %176
%186 = phi i32 [ %183, %182 ], [ %181, %180 ], [ %179, %178 ], [ %177, %176 ]
%187 = getelementptr inbounds i32, i32* %1, i64 %169
store i32 %186, i32* %187
%188 = or i64 %168, 1
%189 = getelementptr inbounds i32, i32* %3, i64 %188
%190 = load i32, i32* %189
%191 = trunc i64 %188 to i32
%192 = shl i32 %191, 1
%193 = ashr i32 %47, %192
%194 = and i32 %193, 3
switch i32 %194, label %184 [
i32 0, label %201
i32 1, label %199
i32 2, label %197
i32 3, label %195
]
195: ; preds = %185
%196 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %190)
br label %203
197: ; preds = %185
%198 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %190)
br label %203
199: ; preds = %185
%200 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %190)
br label %203
201: ; preds = %185
%202 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %190)
br label %203
203: ; preds = %201, %199, %197, %195
%204 = phi i32 [ %196, %195 ], [ %198, %197 ], [ %200, %199 ], [ %202, %201 ]
%205 = add nsw i64 %169, 1
%206 = getelementptr inbounds i32, i32* %1, i64 %205
store i32 %204, i32* %206
%207 = or i64 %168, 2
%208 = getelementptr inbounds i32, i32* %3, i64 %207
%209 = load i32, i32* %208
%210 = trunc i64 %207 to i32
%211 = shl i32 %210, 1
%212 = ashr i32 %47, %211
%213 = and i32 %212, 3
switch i32 %213, label %184 [
i32 0, label %220
i32 1, label %218
i32 2, label %216
i32 3, label %214
]
214: ; preds = %203
%215 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %209)
br label %222
216: ; preds = %203
%217 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %209)
br label %222
218: ; preds = %203
%219 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %209)
br label %222
220: ; preds = %203
%221 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %209)
br label %222
222: ; preds = %220, %218, %216, %214
%223 = phi i32 [ %215, %214 ], [ %217, %216 ], [ %219, %218 ], [ %221, %220 ]
%224 = add nsw i64 %169, 2
%225 = getelementptr inbounds i32, i32* %1, i64 %224
store i32 %223, i32* %225
%226 = or i64 %168, 3
%227 = getelementptr inbounds i32, i32* %3, i64 %226
%228 = load i32, i32* %227
%229 = trunc i64 %226 to i32
%230 = shl i32 %229, 1
%231 = ashr i32 %47, %230
%232 = and i32 %231, 3
switch i32 %232, label %184 [
i32 0, label %239
i32 1, label %237
i32 2, label %235
i32 3, label %233
]
233: ; preds = %222
%234 = tail call i32 @PackRGBA(i32 0, i32 0, i32 0, i32 %228)
br label %241
235: ; preds = %222
%236 = tail call i32 @PackRGBA(i32 %51, i32 %53, i32 %55, i32 %228)
br label %241
237: ; preds = %222
%238 = tail call i32 @PackRGBA(i32 %32, i32 %39, i32 %45, i32 %228)
br label %241
239: ; preds = %222
%240 = tail call i32 @PackRGBA(i32 %13, i32 %20, i32 %26, i32 %228)
br label %241
241: ; preds = %239, %237, %235, %233
%242 = phi i32 [ %234, %233 ], [ %236, %235 ], [ %238, %237 ], [ %240, %239 ]
%243 = add nsw i64 %169, 3
%244 = getelementptr inbounds i32, i32* %1, i64 %243
store i32 %242, i32* %244
%245 = add nuw nsw i64 %167, 1
%246 = icmp eq i64 %245, 4
br i1 %246, label %247, label %166
247: ; preds = %241, %160
ret void
}