#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 */

/* Variables and functions */
int /*<<< orphan*/ compress_DDS_color_block(int, unsigned char *,
                                            unsigned char *);
scalar_t__ malloc(int);
unsigned char *convert_image_to_DXT1(const unsigned char *const uncompressed,
                                     int width, int height, int channels,
                                     int *out_size) {
  unsigned char *compressed;
  int i, j, x, y;
  unsigned char ublock[16 * 3];
  unsigned char cblock[8];
  int index = 0, chan_step = 1;
  int block_count = 0;
  *out_size = 0;
  if ((width < 1) || (height < 1) || (NULL == uncompressed) || (channels < 1) ||
      (channels > 4)) {
    return NULL;
  }
  if (channels < 3) {
    chan_step = 0;
  }
  *out_size = ((width + 3) >> 2) * ((height + 3) >> 2) * 8;
  compressed = (unsigned char *)malloc(*out_size);
  for (j = 0; j < height; j += 4) {
    for (i = 0; i < width; i += 4) {
      int idx = 0;
      int mx = 4, my = 4;
      if (j + 4 >= height) {
        my = height - j;
      }
      if (i + 4 >= width) {
        mx = width - i;
      }
      for (y = 0; y < my; ++y) {
        for (x = 0; x < mx; ++x) {
          ublock[idx++] =
              uncompressed[(j + y) * width * channels + (i + x) * channels];
          ublock[idx++] = uncompressed[(j + y) * width * channels +
                                       (i + x) * channels + chan_step];
          ublock[idx++] =
              uncompressed[(j + y) * width * channels + (i + x) * channels +
                           chan_step + chan_step];
        }
        for (x = mx; x < 4; ++x) {
          ublock[idx++] = ublock[0];
          ublock[idx++] = ublock[1];
          ublock[idx++] = ublock[2];
        }
      }
      for (y = my; y < 4; ++y) {
        for (x = 0; x < 4; ++x) {
          ublock[idx++] = ublock[0];
          ublock[idx++] = ublock[1];
          ublock[idx++] = ublock[2];
        }
      }
      ++block_count;
      compress_DDS_color_block(3, ublock, cblock);
      for (x = 0; x < 8; ++x) {
        compressed[index++] = cblock[x];
      }
    }
  }
  return compressed;
}


x86 assembly (clang, -O0):
<convert_image_to_DXT1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x1,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
cmpl   $0x1,-0x14(%rbp)
jl     1192 <convert_image_to_DXT1+0x72>
cmpl   $0x1,-0x18(%rbp)
jl     1192 <convert_image_to_DXT1+0x72>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1192 <convert_image_to_DXT1+0x72>
cmpl   $0x1,-0x1c(%rbp)
jl     1192 <convert_image_to_DXT1+0x72>
cmpl   $0x4,-0x1c(%rbp)
jle    119f <convert_image_to_DXT1+0x7f>
movq   $0x0,-0x8(%rbp)
jmp    14eb <convert_image_to_DXT1+0x3cb>
cmpl   $0x3,-0x1c(%rbp)
jge    11b0 <convert_image_to_DXT1+0x90>
movl   $0x0,-0x80(%rbp)
mov    -0x14(%rbp),%ecx
add    $0x3,%ecx
sar    $0x2,%ecx
mov    -0x18(%rbp),%eax
add    $0x3,%eax
sar    $0x2,%eax
imul   %eax,%ecx
shl    $0x3,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    14e3 <convert_image_to_DXT1+0x3c3>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14d0 <convert_image_to_DXT1+0x3b0>
movl   $0x0,-0x88(%rbp)
movl   $0x4,-0x8c(%rbp)
movl   $0x4,-0x90(%rbp)
mov    -0x38(%rbp),%eax
add    $0x4,%eax
cmp    -0x18(%rbp),%eax
jl     123c <convert_image_to_DXT1+0x11c>
mov    -0x18(%rbp),%eax
sub    -0x38(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x34(%rbp),%eax
add    $0x4,%eax
cmp    -0x14(%rbp),%eax
jl     1257 <convert_image_to_DXT1+0x137>
mov    -0x14(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x8c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x90(%rbp),%eax
jge    13cd <convert_image_to_DXT1+0x2ad>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    134b <convert_image_to_DXT1+0x22b>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
mov    -0x34(%rbp),%edx
add    -0x3c(%rbp),%edx
imul   -0x1c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
mov    -0x34(%rbp),%edx
add    -0x3c(%rbp),%edx
imul   -0x1c(%rbp),%edx
add    %edx,%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    -0x40(%rbp),%ecx
imul   -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
mov    -0x34(%rbp),%edx
add    -0x3c(%rbp),%edx
imul   -0x1c(%rbp),%edx
add    %edx,%ecx
add    -0x80(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1274 <convert_image_to_DXT1+0x154>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x4,-0x3c(%rbp)
jge    13ba <convert_image_to_DXT1+0x29a>
mov    -0x70(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x6f(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x6e(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1354 <convert_image_to_DXT1+0x234>
jmp    13bf <convert_image_to_DXT1+0x29f>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    125e <convert_image_to_DXT1+0x13e>
mov    -0x90(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x4,-0x40(%rbp)
jge    1460 <convert_image_to_DXT1+0x340>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x4,-0x3c(%rbp)
jge    144d <convert_image_to_DXT1+0x32d>
mov    -0x70(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x6f(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x6e(%rbp),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    13e7 <convert_image_to_DXT1+0x2c7>
jmp    1452 <convert_image_to_DXT1+0x332>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13d6 <convert_image_to_DXT1+0x2b6>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
lea    -0x70(%rbp),%rsi
lea    -0x78(%rbp),%rdx
mov    $0x3,%edi
call   1030 <compress_DDS_color_block@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x8,-0x3c(%rbp)
jge    14bd <convert_image_to_DXT1+0x39d>
movslq -0x3c(%rbp),%rax
mov    -0x78(%rbp,%rax,1),%dl
mov    -0x30(%rbp),%rax
mov    -0x7c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x7c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1488 <convert_image_to_DXT1+0x368>
jmp    14c2 <convert_image_to_DXT1+0x3a2>
mov    -0x34(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x34(%rbp)
jmp    11f7 <convert_image_to_DXT1+0xd7>
jmp    14d5 <convert_image_to_DXT1+0x3b5>
mov    -0x38(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x38(%rbp)
jmp    11e4 <convert_image_to_DXT1+0xc4>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_image_to_DXT1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %ecx,%r12d
movl   $0x0,(%r8)
lea    -0x5(%r12),%eax
xor    %ecx,%ecx
mov    %rcx,0x60(%rsp)
cmp    $0xfffffffc,%eax
jb     195f <convert_image_to_DXT1+0x83f>
mov    %rdi,%r15
test   %rdi,%rdi
je     195f <convert_image_to_DXT1+0x83f>
mov    %esi,%ebx
test   %esi,%esi
jle    195f <convert_image_to_DXT1+0x83f>
test   %edx,%edx
jle    195f <convert_image_to_DXT1+0x83f>
xor    %ebp,%ebp
cmp    $0x3,%r12d
setae  %bpl
lea    0x3(%rdx),%eax
shr    $0x2,%eax
lea    (%rbx,%rbx,1),%edi
add    $0x6,%edi
and    $0xfffffff8,%edi
imul   %eax,%edi
mov    %edi,(%r8)
mov    %rdx,0xc8(%rsp)
call   1040 <malloc@plt>
mov    0xc8(%rsp),%r10
mov    %rax,0x60(%rsp)
lea    0x0(,%rbx,4),%r13d
lea    0x0(%rbp,%rbp,1),%r14d
mov    %r12d,%r11d
mov    %rbx,0x68(%rsp)
imul   %ebx,%r11d
lea    0x0(,%r11,4),%edx
mov    %edx,0x74(%rsp)
lea    0x0(,%r12,4),%edx
mov    %edx,0x9c(%rsp)
mov    %r12d,%edx
shl    $0x4,%edx
mov    %edx,0xb8(%rsp)
xor    %r9d,%r9d
mov    $0xffffffff,%esi
movdqa 0xe07(%rip),%xmm8
movdqa 0xe0f(%rip),%xmm7
mov    $0x4,%edi
xor    %ebx,%ebx
mov    %ebp,%ecx
mov    %r14d,%r8d
xor    %edx,%edx
movl   $0x0,0x48(%rsp)
xor    %eax,%eax
mov    %r11,0xd0(%rsp)
mov    %r13d,0x78(%rsp)
jmp    1294 <convert_image_to_DXT1+0x174>
nopl   0x0(%rax,%rax,1)
mov    0x80(%rsp),%edx
add    $0x1,%edx
mov    0x74(%rsp),%eax
mov    0x84(%rsp),%r8d
add    %eax,%r8d
mov    0x88(%rsp),%ecx
add    %eax,%ecx
mov    0x8c(%rsp),%ebx
add    %eax,%ebx
mov    0x78(%rsp),%r13d
mov    0xe0(%rsp),%r9
add    %r13d,%r9d
mov    0x90(%rsp),%edi
add    $0x4,%edi
mov    0x94(%rsp),%esi
add    $0xfffffffc,%esi
mov    0xc8(%rsp),%r10
mov    0x7c(%rsp),%eax
cmp    %r10d,%eax
jge    195f <convert_image_to_DXT1+0x83f>
cmp    %edi,%r10d
mov    %edi,0x90(%rsp)
cmovl  %r10d,%edi
mov    %esi,0x94(%rsp)
add    %esi,%edi
mov    %edi,0xa0(%rsp)
mov    %r13d,%esi
mov    %edx,0x80(%rsp)
imul   %edx,%esi
mov    %esi,%edx
or     %ebp,%edx
mov    %rdx,0xe8(%rsp)
mov    %r14d,%edx
mov    %rsi,0xf0(%rsp)
or     %esi,%edx
mov    %edx,0x98(%rsp)
mov    %r10d,%edx
sub    %eax,%edx
add    $0x4,%eax
mov    %eax,0x7c(%rsp)
cmp    %r10d,%eax
mov    $0x4,%eax
cmovl  %eax,%edx
mov    %edx,0xc(%rsp)
mov    %r9,0xe0(%rsp)
mov    %r9d,%r10d
mov    %ebx,0x8c(%rsp)
mov    %ebx,%r13d
mov    %ecx,0x88(%rsp)
mov    %r8d,0x84(%rsp)
mov    %r8d,0x44(%rsp)
xor    %edi,%edi
mov    $0x4,%r9d
xor    %esi,%esi
xor    %ebx,%ebx
mov    0x68(%rsp),%rdx
jmp    141c <convert_image_to_DXT1+0x2fc>
nopl   0x0(%rax)
mov    $0x3,%edi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1030 <compress_DDS_color_block@plt>
movslq 0x48(%rsp),%rax
mov    0x4(%rsp),%cl
mov    0x60(%rsp),%rdx
mov    %cl,(%rdx,%rax,1)
mov    0x5(%rsp),%cl
mov    %cl,0x1(%rdx,%rax,1)
mov    0x6(%rsp),%cl
mov    %cl,0x2(%rdx,%rax,1)
mov    0x7(%rsp),%cl
mov    %cl,0x3(%rdx,%rax,1)
mov    0x8(%rsp),%cl
mov    %cl,0x4(%rdx,%rax,1)
mov    0x9(%rsp),%cl
mov    %cl,0x5(%rdx,%rax,1)
mov    0xa(%rsp),%cl
mov    %cl,0x6(%rdx,%rax,1)
mov    0xb(%rsp),%cl
lea    0x8(%rax),%esi
mov    %esi,0x48(%rsp)
mov    %cl,0x7(%rdx,%rax,1)
mov    0xf8(%rsp),%rsi
add    $0x1,%esi
mov    0xa8(%rsp),%r9d
add    $0x4,%r9d
mov    0xac(%rsp),%edi
add    $0xfffffffc,%edi
mov    0x9c(%rsp),%eax
add    %eax,0x44(%rsp)
mov    0x4c(%rsp),%ecx
add    %eax,%ecx
mov    0xb0(%rsp),%r13d
add    %eax,%r13d
mov    0xb4(%rsp),%r10d
add    $0x4,%r10d
mov    0xa4(%rsp),%eax
mov    %eax,%ebx
mov    0x68(%rsp),%rdx
cmp    %edx,%eax
mov    0xd0(%rsp),%r11
movdqa 0xbf2(%rip),%xmm8
movdqa 0xbfa(%rip),%xmm7
jge    1230 <convert_image_to_DXT1+0x110>
mov    %ecx,0x4c(%rsp)
cmp    %r9d,%edx
mov    %r9d,0xa8(%rsp)
cmovl  %edx,%r9d
lea    0x4(%rbx),%ecx
cmp    %ecx,%edx
mov    %ecx,%eax
cmovl  %edx,%eax
mov    %eax,0x50(%rsp)
mov    %edx,%r8d
sub    %ebx,%r8d
mov    %ecx,0xa4(%rsp)
cmp    %edx,%ecx
mov    $0x4,%ecx
cmovl  %ecx,%r8d
cmpl   $0x0,0xc(%rsp)
mov    %r10d,0xb4(%rsp)
mov    %r13d,0xb0(%rsp)
mov    %edi,0xac(%rsp)
mov    %rsi,0xf8(%rsp)
jle    18c0 <convert_image_to_DXT1+0x7a0>
add    %edi,%r9d
movslq %r9d,%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,0x110(%rsp)
mov    %ebx,%eax
or     $0x3,%eax
mov    %eax,0xc0(%rsp)
lea    0x0(,%rsi,4),%eax
mov    0x50(%rsp),%esi
mov    %esi,%ecx
sub    %eax,%ecx
movslq %ecx,%rcx
lea    -0x1(%rcx),%rax
mov    %rax,0x130(%rsp)
mov    0xf0(%rsp),%rax
add    %ebx,%eax
mov    %rax,0x128(%rsp)
mov    0xe8(%rsp),%rax
add    %ebx,%eax
mov    %rax,0x120(%rsp)
add    0x98(%rsp),%ebx
mov    %rbx,0x118(%rsp)
mov    %esi,%r9d
mov    %r8d,%edx
movslq %r8d,%r8
mov    %rcx,%rax
mov    %rcx,0xd8(%rsp)
and    $0xfffffffffffffff0,%rcx
mov    %rcx,0x108(%rsp)
lea    (%rcx,%rcx,2),%rax
mov    %rax,0x100(%rsp)
lea    0x1(%r8),%eax
mov    %eax,0xbc(%rsp)
xor    %eax,%eax
mov    0x4c(%rsp),%ecx
mov    %ecx,0x58(%rsp)
mov    %r13d,%edi
mov    0x44(%rsp),%ecx
mov    %ecx,0x54(%rsp)
xor    %esi,%esi
mov    0x68(%rsp),%r13
mov    %edx,%ebx
mov    %edx,0xc4(%rsp)
jmp    156d <convert_image_to_DXT1+0x44d>
nopl   0x0(%rax)
add    $0x1,%esi
add    %r11d,0x54(%rsp)
add    %r11d,0x58(%rsp)
add    %r11d,%edi
add    %r13d,%r10d
cmp    0xc(%rsp),%esi
jge    18c2 <convert_image_to_DXT1+0x7a2>
test   %ebx,%ebx
jle    15eb <convert_image_to_DXT1+0x4cb>
mov    %edi,0x5c(%rsp)
movslq %eax,%r9
cmpl   $0x10,0xd8(%rsp)
10
jae    1620 <convert_image_to_DXT1+0x500>
xor    %ecx,%ecx
mov    %r9,%rax
lea    (%r10,%rcx,1),%edx
imul   %r12d,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %edx,%rdx
movzbl (%r15,%rdx,1),%ebx
mov    %bl,0x10(%rsp,%rax,1)
lea    (%rdx,%rbp,1),%edi
movslq %edi,%rdi
movzbl (%r15,%rdi,1),%ebx
mov    %bl,0x11(%rsp,%rax,1)
lea    (%r14,%rdx,1),%edi
movslq %edi,%rdi
movzbl (%r15,%rdi,1),%ebx
mov    %bl,0x12(%rsp,%rax,1)
add    $0x3,%rax
add    $0x1,%rcx
add    %r12d,%edx
cmp    %r8,%rcx
jl     15a0 <convert_image_to_DXT1+0x480>
mov    0x50(%rsp),%r9d
mov    0xc4(%rsp),%ebx
mov    0x5c(%rsp),%edi
cmp    $0x3,%ebx
jg     1550 <convert_image_to_DXT1+0x430>
cltq
test   $0x1,%r9b
jne    1830 <convert_image_to_DXT1+0x710>
mov    %ebx,%ecx
cmp    %r9d,0xc0(%rsp)
je     1550 <convert_image_to_DXT1+0x430>
jmp    1861 <convert_image_to_DXT1+0x741>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x1,%r12d
jne    1586 <convert_image_to_DXT1+0x466>
mov    %esi,%eax
imul   %r13d,%eax
mov    0x128(%rsp),%rcx
add    %eax,%ecx
mov    0x130(%rsp),%rbx
lea    (%rcx,%rbx,1),%edx
cmp    %ecx,%edx
jl     1586 <convert_image_to_DXT1+0x466>
mov    %rbx,%rcx
shr    $0x20,%rcx
jne    1586 <convert_image_to_DXT1+0x466>
mov    0x120(%rsp),%rdx
add    %eax,%edx
lea    (%rdx,%rbx,1),%edi
cmp    %edx,%edi
jl     1586 <convert_image_to_DXT1+0x466>
test   %rcx,%rcx
jne    1586 <convert_image_to_DXT1+0x466>
add    0x118(%rsp),%eax
lea    (%rax,%rbx,1),%edx
cmp    %eax,%edx
jl     1586 <convert_image_to_DXT1+0x466>
test   %rcx,%rcx
jne    1586 <convert_image_to_DXT1+0x466>
mov    %r13,%rdi
mov    0x100(%rsp),%rax
add    %r9,%rax
lea    0x10(%rsp,%r9,1),%rcx
mov    0x5c(%rsp),%edx
mov    %edx,%r13d
mov    0x58(%rsp),%edx
mov    0x54(%rsp),%ebx
mov    %ebx,%r11d
mov    0x110(%rsp),%r9
mov    0xb8(%rsp),%ebx
nopw   0x0(%rax,%rax,1)
movslq %r13d,%r13
movdqu (%r15,%r13,1),%xmm3
movslq %edx,%rdx
movdqu (%r15,%rdx,1),%xmm0
movslq %r11d,%r11
movdqu (%r15,%r11,1),%xmm2
pshuflw $0xf6,%xmm2,%xmm1
pshufhw $0x0,%xmm1,%xmm1
movdqa %xmm8,%xmm4
pandn  %xmm1,%xmm4
pshufd $0xe6,%xmm0,%xmm1
punpcklbw %xmm1,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0xe9,%xmm1,%xmm1
pshufhw $0x94,%xmm1,%xmm5
pand   %xmm8,%xmm5
por    %xmm4,%xmm5
pand   %xmm7,%xmm5
pshuflw $0xff,%xmm3,%xmm1
pshufhw $0x60,%xmm1,%xmm4
movdqa %xmm7,%xmm1
pandn  %xmm4,%xmm1
por    %xmm5,%xmm1
movdqa %xmm0,%xmm4
punpcklbw %xmm0,%xmm4
pshufd $0x94,%xmm4,%xmm4
pshuflw $0x94,%xmm4,%xmm4
movdqa %xmm8,%xmm5
pandn  %xmm4,%xmm5
pshufd $0x44,%xmm3,%xmm4
pshuflw $0x60,%xmm4,%xmm4
pshufhw $0xa5,%xmm4,%xmm4
pand   %xmm8,%xmm4
por    %xmm5,%xmm4
pand   %xmm7,%xmm4
pshufd $0x44,%xmm2,%xmm5
pshuflw $0x0,%xmm5,%xmm5
pshufhw $0xa5,%xmm5,%xmm5
movdqa %xmm7,%xmm6
pandn  %xmm5,%xmm6
por    %xmm4,%xmm6
pshufd $0xee,%xmm3,%xmm3
pshuflw $0xa5,%xmm3,%xmm3
pshufhw $0xff,%xmm3,%xmm3
movdqa %xmm8,%xmm4
pandn  %xmm3,%xmm4
pshufd $0xee,%xmm2,%xmm2
pshuflw $0xa5,%xmm2,%xmm2
pshufhw $0xf6,%xmm2,%xmm2
pand   %xmm8,%xmm2
por    %xmm4,%xmm2
pand   %xmm7,%xmm2
punpckhbw %xmm0,%xmm0
pshufd $0xe6,%xmm0,%xmm0
pshuflw $0xcc,%xmm0,%xmm0
pshufhw $0xe9,%xmm0,%xmm0
movdqa %xmm7,%xmm3
pandn  %xmm0,%xmm3
por    %xmm2,%xmm3
movdqu %xmm3,0x20(%rcx)
movdqu %xmm6,(%rcx)
movdqu %xmm1,0x10(%rcx)
add    %ebx,%r11d
add    %ebx,%edx
add    %ebx,%r13d
add    $0x30,%rcx
add    $0xfffffffffffffff0,%r9
jne    16d0 <convert_image_to_DXT1+0x5b0>
mov    0x108(%rsp),%rdx
mov    %rdx,%rcx
cmp    0xd8(%rsp),%rdx
mov    %rdi,%r13
mov    0xd0(%rsp),%r11
jne    158b <convert_image_to_DXT1+0x46b>
jmp    15db <convert_image_to_DXT1+0x4bb>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%cl
mov    %cl,0x10(%rsp,%rax,1)
mov    0x11(%rsp),%cl
mov    %cl,0x11(%rsp,%rax,1)
mov    0x12(%rsp),%cl
mov    %cl,0x12(%rsp,%rax,1)
add    $0x3,%rax
mov    0xbc(%rsp),%ecx
cmp    %r9d,0xc0(%rsp)
je     1550 <convert_image_to_DXT1+0x430>
add    $0xfffffffe,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x10(%rsp),%edx
mov    %dl,0x10(%rsp,%rax,1)
movzbl 0x11(%rsp),%edx
mov    %dl,0x11(%rsp,%rax,1)
movzbl 0x12(%rsp),%edx
mov    %dl,0x12(%rsp,%rax,1)
movzbl 0x10(%rsp),%edx
mov    %dl,0x13(%rsp,%rax,1)
movzbl 0x11(%rsp),%edx
mov    %dl,0x14(%rsp,%rax,1)
movzbl 0x12(%rsp),%edx
mov    %dl,0x15(%rsp,%rax,1)
add    $0x6,%rax
add    $0x2,%ecx
cmp    $0x2,%ecx
jl     1870 <convert_image_to_DXT1+0x750>
jmp    1550 <convert_image_to_DXT1+0x430>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
mov    0xa0(%rsp),%ecx
cmpl   $0x3,0xc(%rsp)
jg     1340 <convert_image_to_DXT1+0x220>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %eax,%rdx
movzbl 0x10(%rsp),%eax
mov    %al,0x10(%rsp,%rdx,1)
movzbl 0x11(%rsp),%eax
mov    %al,0x11(%rsp,%rdx,1)
movzbl 0x12(%rsp),%eax
mov    %al,0x12(%rsp,%rdx,1)
movzbl 0x10(%rsp),%eax
mov    %al,0x13(%rsp,%rdx,1)
movzbl 0x11(%rsp),%eax
mov    %al,0x14(%rsp,%rdx,1)
movzbl 0x12(%rsp),%eax
mov    %al,0x15(%rsp,%rdx,1)
movzbl 0x10(%rsp),%eax
mov    %al,0x16(%rsp,%rdx,1)
movzbl 0x11(%rsp),%eax
mov    %al,0x17(%rsp,%rdx,1)
movzbl 0x12(%rsp),%eax
mov    %al,0x18(%rsp,%rdx,1)
movzbl 0x10(%rsp),%eax
mov    %al,0x19(%rsp,%rdx,1)
movzbl 0x11(%rsp),%eax
mov    %al,0x1a(%rsp,%rdx,1)
movzbl 0x12(%rsp),%ebx
lea    0xc(%rdx),%eax
mov    %bl,0x1b(%rsp,%rdx,1)
add    $0x1,%ecx
cmp    $0x3,%ecx
jl     18e0 <convert_image_to_DXT1+0x7c0>
jmp    1340 <convert_image_to_DXT1+0x220>
mov    0x60(%rsp),%rax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @convert_image_to_DXT1(i8* %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4) {
%6 = alloca [48 x i8]
%7 = alloca [8 x i8]
%8 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
store i32 0, i32* %4
%10 = icmp slt i32 %1, 1
%11 = icmp slt i32 %2, 1
%12 = or i1 %10, %11
%13 = icmp eq i8* %0, null
%14 = or i1 %13, %12
%15 = add i32 %3, -5
%16 = icmp ult i32 %15, -4
%17 = or i1 %16, %14
br i1 %17, label %307, label %18
18: ; preds = %5
%19 = icmp ugt i32 %3, 2
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %2, 3
%22 = lshr i32 %21, 2
%23 = shl nuw i32 %1, 1
%24 = add i32 %23, 6
%25 = and i32 %24, -8
%26 = mul i32 %25, %22
store i32 %26, i32* %4
%27 = tail call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i8*
%29 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 1
%30 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 2
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 1
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 2
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 3
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 4
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 5
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 6
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 7
%38 = shl i32 %1, 2
%39 = select i1 %19, i32 2, i32 0
%40 = icmp ne i32 %3, 1
br label %41
41: ; preds = %18, %304
%42 = phi i32 [ 0, %18 ], [ %306, %304 ]
%43 = phi i32 [ 0, %18 ], [ %301, %304 ]
%44 = phi i32 [ 0, %18 ], [ %48, %304 ]
%45 = mul i32 %38, %42
%46 = or i32 %45, %20
%47 = or i32 %39, %45
%48 = add nuw nsw i32 %44, 4
%49 = icmp slt i32 %48, %2
%50 = sub nsw i32 %2, %44
%51 = select i1 %49, i32 4, i32 %50
%52 = icmp sgt i32 %51, 0
%53 = icmp slt i32 %51, 4
br label %54
54: ; preds = %41, %276
%55 = phi i32 [ 0, %41 ], [ %303, %276 ]
%56 = phi i32 [ %43, %41 ], [ %301, %276 ]
%57 = phi i32 [ 0, %41 ], [ %75, %276 ]
%58 = add nuw i32 %57, 4
%59 = call i32 @llvm.smin.i32(i32 %1, i32 %58)
%60 = or i32 %57, 3
%61 = add nuw i32 %57, 4
%62 = call i32 @llvm.smin.i32(i32 %1, i32 %61)
%63 = mul i32 %55, -4
%64 = add i32 %62, %63
%65 = sext i32 %64 to i64
%66 = add nuw i32 %57, 4
%67 = call i32 @llvm.smin.i32(i32 %1, i32 %66)
%68 = mul i32 %55, -4
%69 = add i32 %67, %68
%70 = sext i32 %69 to i64
%71 = add nsw i64 %70, -1
%72 = add i32 %45, %57
%73 = add i32 %46, %57
%74 = add i32 %47, %57
%75 = add nuw nsw i32 %57, 4
%76 = icmp slt i32 %75, %1
%77 = sub nsw i32 %1, %57
%78 = select i1 %76, i32 4, i32 %77
br i1 %52, label %79, label %97
79: ; preds = %54
%80 = icmp sgt i32 %78, 0
%81 = icmp slt i32 %78, 4
%82 = sext i32 %78 to i64
%83 = icmp ult i32 %64, 16
%84 = trunc i64 %71 to i32
%85 = icmp ugt i64 %71, 4294967295
%86 = trunc i64 %71 to i32
%87 = icmp ugt i64 %71, 4294967295
%88 = trunc i64 %71 to i32
%89 = icmp ugt i64 %71, 4294967295
%90 = and i64 %65, -16
%91 = mul nsw i64 %90, 3
%92 = icmp eq i64 %90, %65
%93 = and i32 %59, 1
%94 = icmp eq i32 %93, 0
%95 = add nsw i32 %78, 1
%96 = icmp eq i32 %60, %59
br label %99
97: ; preds = %230, %54
%98 = phi i32 [ 0, %54 ], [ %231, %230 ]
br i1 %53, label %234, label %276
99: ; preds = %79, %230
%100 = phi i32 [ 0, %79 ], [ %231, %230 ]
%101 = phi i32 [ 0, %79 ], [ %232, %230 ]
%102 = mul i32 %101, %1
%103 = add i32 %72, %102
%104 = add i32 %73, %102
%105 = add i32 %74, %102
br i1 %80, label %106, label %161
106: ; preds = %99
%107 = add nuw nsw i32 %101, %44
%108 = mul nsw i32 %107, %1
%109 = add i32 %108, %57
%110 = sext i32 %100 to i64
br i1 %83, label %155, label %111
111: ; preds = %106
%112 = add i32 %103, %84
%113 = icmp slt i32 %112, %103
%114 = or i1 %113, %85
%115 = add i32 %104, %86
%116 = icmp slt i32 %115, %104
%117 = or i1 %116, %87
%118 = add i32 %105, %88
%119 = icmp slt i32 %118, %105
%120 = or i1 %119, %89
%121 = or i1 %40, %114
%122 = or i1 %121, %117
%123 = or i1 %122, %120
br i1 %123, label %155, label %124
124: ; preds = %111
%125 = add nsw i64 %91, %110
br label %126
126: ; preds = %126, %124
%127 = phi i64 [ 0, %124 ], [ %152, %126 ]
%128 = mul i64 %127, 3
%129 = add i64 %128, %110
%130 = trunc i64 %127 to i32
%131 = add i32 %109, %130
%132 = mul i32 %131, %3
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i8, i8* %0, i64 %133
%135 = bitcast i8* %134 to <16 x i8>*
%136 = load <16 x i8>, <16 x i8>* %135
%137 = add nsw i32 %132, %20
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i8, i8* %0, i64 %138
%140 = bitcast i8* %139 to <16 x i8>*
%141 = load <16 x i8>, <16 x i8>* %140
%142 = add nsw i32 %137, %20
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %0, i64 %143
%145 = bitcast i8* %144 to <16 x i8>*
%146 = load <16 x i8>, <16 x i8>* %145
%147 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %129
%148 = bitcast i8* %147 to <48 x i8>*
%149 = shufflevector <16 x i8> %136, <16 x i8> %141, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
%150 = shufflevector <16 x i8> %146, <16 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
%151 = shufflevector <32 x i8> %149, <32 x i8> %150, <48 x i32> <i32 0, i32 16, i32 32, i32 1, i32 17, i32 33, i32 2, i32 18, i32 34, i32 3, i32 19, i32 35, i32 4, i32 20, i32 36, i32 5, i32 21, i32 37, i32 6, i32 22, i32 38, i32 7, i32 23, i32 39, i32 8, i32 24, i32 40, i32 9, i32 25, i32 41, i32 10, i32 26, i32 42, i32 11, i32 27, i32 43, i32 12, i32 28, i32 44, i32 13, i32 29, i32 45, i32 14, i32 30, i32 46, i32 15, i32 31, i32 47>
store <48 x i8> %151, <48 x i8>* %148
%152 = add nuw i64 %127, 16
%153 = icmp eq i64 %152, %90
br i1 %153, label %154, label %126
154: ; preds = %126
br i1 %92, label %158, label %155
155: ; preds = %111, %106, %154
%156 = phi i64 [ 0, %111 ], [ 0, %106 ], [ %90, %154 ]
%157 = phi i64 [ %110, %111 ], [ %110, %106 ], [ %125, %154 ]
br label %179
158: ; preds = %179, %154
%159 = phi i64 [ %125, %154 ], [ %200, %179 ]
%160 = trunc i64 %159 to i32
br label %161
161: ; preds = %158, %99
%162 = phi i32 [ %100, %99 ], [ %160, %158 ]
br i1 %81, label %163, label %230
163: ; preds = %161
%164 = sext i32 %162 to i64
br i1 %94, label %175, label %165
165: ; preds = %163
%166 = load i8, i8* %8
%167 = add nsw i64 %164, 1
%168 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %164
store i8 %166, i8* %168
%169 = load i8, i8* %29
%170 = add nsw i64 %164, 2
%171 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %167
store i8 %169, i8* %171
%172 = load i8, i8* %30
%173 = add nsw i64 %164, 3
%174 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %170
store i8 %172, i8* %174
br label %175
175: ; preds = %165, %163
%176 = phi i64 [ %164, %163 ], [ %173, %165 ]
%177 = phi i32 [ %78, %163 ], [ %95, %165 ]
%178 = phi i64 [ undef, %163 ], [ %173, %165 ]
br i1 %96, label %227, label %204
179: ; preds = %155, %179
%180 = phi i64 [ %202, %179 ], [ %156, %155 ]
%181 = phi i64 [ %200, %179 ], [ %157, %155 ]
%182 = trunc i64 %180 to i32
%183 = add i32 %109, %182
%184 = mul i32 %183, %3
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds i8, i8* %0, i64 %185
%187 = load i8, i8* %186
%188 = add nsw i64 %181, 1
%189 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %181
store i8 %187, i8* %189
%190 = add nsw i32 %184, %20
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i8, i8* %0, i64 %191
%193 = load i8, i8* %192
%194 = add nsw i64 %181, 2
%195 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %188
store i8 %193, i8* %195
%196 = add nsw i32 %190, %20
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds i8, i8* %0, i64 %197
%199 = load i8, i8* %198
%200 = add nsw i64 %181, 3
%201 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %194
store i8 %199, i8* %201
%202 = add nuw nsw i64 %180, 1
%203 = icmp slt i64 %202, %82
br i1 %203, label %179, label %158
204: ; preds = %175, %204
%205 = phi i64 [ %223, %204 ], [ %176, %175 ]
%206 = phi i32 [ %225, %204 ], [ %177, %175 ]
%207 = load i8, i8* %8
%208 = add nsw i64 %205, 1
%209 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %205
store i8 %207, i8* %209
%210 = load i8, i8* %29
%211 = add nsw i64 %205, 2
%212 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %208
store i8 %210, i8* %212
%213 = load i8, i8* %30
%214 = add nsw i64 %205, 3
%215 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %211
store i8 %213, i8* %215
%216 = load i8, i8* %8
%217 = add nsw i64 %205, 4
%218 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %214
store i8 %216, i8* %218
%219 = load i8, i8* %29
%220 = add nsw i64 %205, 5
%221 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %217
store i8 %219, i8* %221
%222 = load i8, i8* %30
%223 = add nsw i64 %205, 6
%224 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %220
store i8 %222, i8* %224
%225 = add nsw i32 %206, 2
%226 = icmp slt i32 %206, 2
br i1 %226, label %204, label %227
227: ; preds = %204, %175
%228 = phi i64 [ %178, %175 ], [ %223, %204 ]
%229 = trunc i64 %228 to i32
br label %230
230: ; preds = %227, %161
%231 = phi i32 [ %162, %161 ], [ %229, %227 ]
%232 = add nuw nsw i32 %101, 1
%233 = icmp slt i32 %232, %51
br i1 %233, label %99, label %97
234: ; preds = %97, %234
%235 = phi i32 [ %272, %234 ], [ %98, %97 ]
%236 = phi i32 [ %274, %234 ], [ %51, %97 ]
%237 = sext i32 %235 to i64
%238 = load i8, i8* %8
%239 = add nsw i64 %237, 1
%240 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %237
store i8 %238, i8* %240
%241 = load i8, i8* %29
%242 = add nsw i64 %237, 2
%243 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %239
store i8 %241, i8* %243
%244 = load i8, i8* %30
%245 = add nsw i64 %237, 3
%246 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %242
store i8 %244, i8* %246
%247 = load i8, i8* %8
%248 = add nsw i64 %237, 4
%249 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %245
store i8 %247, i8* %249
%250 = load i8, i8* %29
%251 = add nsw i64 %237, 5
%252 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %248
store i8 %250, i8* %252
%253 = load i8, i8* %30
%254 = add nsw i64 %237, 6
%255 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %251
store i8 %253, i8* %255
%256 = load i8, i8* %8
%257 = add nsw i64 %237, 7
%258 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %254
store i8 %256, i8* %258
%259 = load i8, i8* %29
%260 = add nsw i64 %237, 8
%261 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %257
store i8 %259, i8* %261
%262 = load i8, i8* %30
%263 = add nsw i64 %237, 9
%264 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %260
store i8 %262, i8* %264
%265 = load i8, i8* %8
%266 = add nsw i64 %237, 10
%267 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %263
store i8 %265, i8* %267
%268 = load i8, i8* %29
%269 = add nsw i64 %237, 11
%270 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %266
store i8 %268, i8* %270
%271 = load i8, i8* %30
%272 = add i32 %235, 12
%273 = getelementptr inbounds [48 x i8], [48 x i8]* %6, i64 0, i64 %269
store i8 %271, i8* %273
%274 = add nsw i32 %236, 1
%275 = icmp slt i32 %236, 3
br i1 %275, label %234, label %276
276: ; preds = %234, %97
%277 = call i32 @compress_DDS_color_block(i32 3, i8* %8, i8* %9)
%278 = sext i32 %56 to i64
%279 = load i8, i8* %9
%280 = add nsw i64 %278, 1
%281 = getelementptr inbounds i8, i8* %28, i64 %278
store i8 %279, i8* %281
%282 = load i8, i8* %31
%283 = add nsw i64 %278, 2
%284 = getelementptr inbounds i8, i8* %28, i64 %280
store i8 %282, i8* %284
%285 = load i8, i8* %32
%286 = add nsw i64 %278, 3
%287 = getelementptr inbounds i8, i8* %28, i64 %283
store i8 %285, i8* %287
%288 = load i8, i8* %33
%289 = add nsw i64 %278, 4
%290 = getelementptr inbounds i8, i8* %28, i64 %286
store i8 %288, i8* %290
%291 = load i8, i8* %34
%292 = add nsw i64 %278, 5
%293 = getelementptr inbounds i8, i8* %28, i64 %289
store i8 %291, i8* %293
%294 = load i8, i8* %35
%295 = add nsw i64 %278, 6
%296 = getelementptr inbounds i8, i8* %28, i64 %292
store i8 %294, i8* %296
%297 = load i8, i8* %36
%298 = add nsw i64 %278, 7
%299 = getelementptr inbounds i8, i8* %28, i64 %295
store i8 %297, i8* %299
%300 = load i8, i8* %37
%301 = add i32 %56, 8
%302 = getelementptr inbounds i8, i8* %28, i64 %298
store i8 %300, i8* %302
%303 = add i32 %55, 1
br i1 %76, label %54, label %304
304: ; preds = %276
%305 = icmp slt i32 %48, %2
%306 = add i32 %42, 1
br i1 %305, label %41, label %307
307: ; preds = %304, %5
%308 = phi i8* [ null, %5 ], [ %28, %304 ]
ret i8* %308
}