#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 */
scalar_t__ SDL_imageFilterMMXdetect();
int /*<<< orphan*/ SDL_imageFilterNormalizeLinearMMX(unsigned char *,
                                                     unsigned char *, int, int,
                                                     int, int, int);
int SDL_imageFilterNormalizeLinear(unsigned char *Src1, unsigned char *Dest,
                                   int length, int Cmin, int Cmax, int Nmin,
                                   int Nmax) {
  unsigned int i, istart;
  unsigned char *cursrc1;
  unsigned char *curdest;
  int dN, dC, factor;
  int result;
  if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
    SDL_imageFilterNormalizeLinearMMX(Src1, Dest, length, Cmin, Cmax, Nmin,
                                      Nmax);
    if ((length & 7) > 0) {
      istart = length & 0xfffffff8;
      cursrc1 = &Src1[istart];
      curdest = &Dest[istart];
    } else {
      return (0);
    }
  } else {
    istart = 0;
    cursrc1 = Src1;
    curdest = Dest;
  }
  dC = Cmax - Cmin;
  if (dC == 0)
    return (0);
  dN = Nmax - Nmin;
  factor = dN / dC;
  for (i = istart; i < length; i++) {
    result = factor * ((int)(*cursrc1) - Cmin) + Nmin;
    if (result > 255)
      result = 255;
    *curdest = (unsigned char)result;
    cursrc1++;
    curdest++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<SDL_imageFilterNormalizeLinear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    $0x0,%al
call   1030 <SDL_imageFilterMMXdetect@plt>
cmp    $0x0,%rax
je     11c7 <SDL_imageFilterNormalizeLinear+0xa7>
cmpl   $0x7,-0x1c(%rbp)
jle    11c7 <SDL_imageFilterNormalizeLinear+0xa7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <SDL_imageFilterNormalizeLinearMMX@plt>
mov    -0x1c(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jle    11b6 <SDL_imageFilterNormalizeLinear+0x96>
mov    -0x1c(%rbp),%eax
and    $0xfffffff8,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
jmp    11c2 <SDL_imageFilterNormalizeLinear+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    1284 <SDL_imageFilterNormalizeLinear+0x164>
jmp    11de <SDL_imageFilterNormalizeLinear+0xbe>
movl   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    11fd <SDL_imageFilterNormalizeLinear+0xdd>
movl   $0x0,-0x4(%rbp)
jmp    1284 <SDL_imageFilterNormalizeLinear+0x164>
mov    0x10(%rbp),%eax
sub    -0x28(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cltd
idivl  -0x48(%rbp)
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    127d <SDL_imageFilterNormalizeLinear+0x15d>
mov    -0x4c(%rbp),%eax
mov    -0x38(%rbp),%rcx
movzbl (%rcx),%ecx
sub    -0x20(%rbp),%ecx
imul   %ecx,%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x50(%rbp)
cmpl   $0xff,-0x50(%rbp)
jle    124c <SDL_imageFilterNormalizeLinear+0x12c>
movl   $0xff,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %al,%cl
mov    -0x40(%rbp),%rax
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1216 <SDL_imageFilterNormalizeLinear+0xf6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDL_imageFilterNormalizeLinear>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r13d
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %rsi,0x10(%rsp)
mov    %rdi,%r12
mov    0x50(%rsp),%r15d
xor    %eax,%eax
call   1030 <SDL_imageFilterMMXdetect@plt>
cmp    $0x8,%r14d
jl     1196 <SDL_imageFilterNormalizeLinear+0x76>
test   %rax,%rax
je     1196 <SDL_imageFilterNormalizeLinear+0x76>
mov    %r15d,(%rsp)
mov    %r12,%rdi
mov    0x10(%rsp),%rsi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %r13d,%r9d
call   1040 <SDL_imageFilterNormalizeLinearMMX@plt>
test   $0x7,%r14b
je     17ed <SDL_imageFilterNormalizeLinear+0x6cd>
mov    %r14d,%r10d
and    $0xfffffff8,%r10d
add    %r10,%r12
add    %r10,0x10(%rsp)
sub    %ebp,%ebx
jne    11a1 <SDL_imageFilterNormalizeLinear+0x81>
jmp    17ed <SDL_imageFilterNormalizeLinear+0x6cd>
xor    %r10d,%r10d
sub    %ebp,%ebx
je     17ed <SDL_imageFilterNormalizeLinear+0x6cd>
sub    %r13d,%r15d
mov    %r15d,%eax
cltd
idiv   %ebx
cmp    %r14d,%r10d
jae    17ed <SDL_imageFilterNormalizeLinear+0x6cd>
mov    %r10d,%r11d
not    %r11d
add    %r14d,%r11d
cmp    $0x7,%r11d
jae    11cf <SDL_imageFilterNormalizeLinear+0xaf>
mov    %r12,%rdi
mov    0x10(%rsp),%rbx
jmp    1762 <SDL_imageFilterNormalizeLinear+0x642>
lea    (%r12,%r11,1),%rdx
add    $0x1,%rdx
mov    0x10(%rsp),%rcx
cmp    %rdx,%rcx
jae    11f9 <SDL_imageFilterNormalizeLinear+0xd9>
lea    (%rcx,%r11,1),%rdx
add    $0x1,%rdx
cmp    %rdx,%r12
jae    11f9 <SDL_imageFilterNormalizeLinear+0xd9>
mov    %r12,%rdi
mov    %rcx,%rbx
jmp    1762 <SDL_imageFilterNormalizeLinear+0x642>
movabs $0x1fffffff0,%rdx
movd   %ebp,%xmm8
movd   %eax,%xmm9
movd   %r13d,%xmm10
cmp    $0xf,%r11d
jae    121f <SDL_imageFilterNormalizeLinear+0xff>
xor    %esi,%esi
jmp    166a <SDL_imageFilterNormalizeLinear+0x54a>
lea    0x1(%r11),%r8
mov    %r8,%rsi
and    %rdx,%rsi
pshufd $0x0,%xmm8,%xmm6
pshufd $0x0,%xmm9,%xmm13
pshufd $0x0,%xmm10,%xmm12
lea    -0x10(%rsi),%rdi
mov    %rdi,%r9
shr    $0x4,%r9
add    $0x1,%r9
pshufd $0xf5,%xmm13,%xmm14
test   %rdi,%rdi
je     14f4 <SDL_imageFilterNormalizeLinear+0x3d4>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %ebx,%ebx
pxor   %xmm11,%xmm11
movdqa 0xd91(%rip),%xmm0
nop
movdqu (%r12,%rbx,1),%xmm1
movdqa %xmm1,%xmm4
punpcklbw %xmm11,%xmm4
movdqa %xmm4,%xmm2
punpcklwd %xmm11,%xmm2
punpckhwd %xmm11,%xmm4
punpckhbw %xmm11,%xmm1
movdqa %xmm1,%xmm3
punpcklwd %xmm11,%xmm3
punpckhwd %xmm11,%xmm1
psubd  %xmm6,%xmm1
psubd  %xmm6,%xmm3
psubd  %xmm6,%xmm4
psubd  %xmm6,%xmm2
pshufd $0xf5,%xmm2,%xmm7
pmuludq %xmm13,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm14,%xmm7
pshufd $0xe8,%xmm7,%xmm7
punpckldq %xmm7,%xmm2
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm13,%xmm4
pshufd $0xe8,%xmm4,%xmm7
pmuludq %xmm14,%xmm5
pshufd $0xe8,%xmm5,%xmm4
punpckldq %xmm4,%xmm7
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm13,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm14,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
pshufd $0xf5,%xmm1,%xmm5
pmuludq %xmm13,%xmm1
pshufd $0xe8,%xmm1,%xmm4
pmuludq %xmm14,%xmm5
pshufd $0xe8,%xmm5,%xmm1
punpckldq %xmm1,%xmm4
paddd  %xmm12,%xmm4
paddd  %xmm12,%xmm3
paddd  %xmm12,%xmm7
paddd  %xmm12,%xmm2
movdqa %xmm0,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm7,%xmm2
pand   %xmm2,%xmm7
pandn  %xmm0,%xmm2
por    %xmm7,%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm3,%xmm5
pand   %xmm5,%xmm3
pandn  %xmm0,%xmm5
por    %xmm3,%xmm5
movdqa %xmm0,%xmm3
pcmpgtd %xmm4,%xmm3
pand   %xmm3,%xmm4
pandn  %xmm0,%xmm3
por    %xmm4,%xmm3
pand   %xmm0,%xmm3
pand   %xmm0,%xmm5
packuswb %xmm3,%xmm5
pand   %xmm0,%xmm2
pand   %xmm0,%xmm1
packuswb %xmm2,%xmm1
packuswb %xmm5,%xmm1
movdqu %xmm1,(%rcx,%rbx,1)
movdqu 0x10(%r12,%rbx,1),%xmm1
movdqa %xmm1,%xmm4
punpcklbw %xmm11,%xmm4
movdqa %xmm4,%xmm2
punpcklwd %xmm11,%xmm2
punpckhwd %xmm11,%xmm4
punpckhbw %xmm11,%xmm1
movdqa %xmm1,%xmm3
punpcklwd %xmm11,%xmm3
punpckhwd %xmm11,%xmm1
psubd  %xmm6,%xmm1
psubd  %xmm6,%xmm3
psubd  %xmm6,%xmm4
psubd  %xmm6,%xmm2
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm13,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm14,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm2
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm13,%xmm4
pshufd $0xe8,%xmm4,%xmm7
pmuludq %xmm14,%xmm5
pshufd $0xe8,%xmm5,%xmm4
punpckldq %xmm4,%xmm7
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm13,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm14,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm3
pshufd $0xf5,%xmm1,%xmm5
pmuludq %xmm13,%xmm1
pshufd $0xe8,%xmm1,%xmm4
pmuludq %xmm14,%xmm5
pshufd $0xe8,%xmm5,%xmm1
punpckldq %xmm1,%xmm4
paddd  %xmm12,%xmm4
paddd  %xmm12,%xmm3
paddd  %xmm12,%xmm7
paddd  %xmm12,%xmm2
movdqa %xmm0,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm7,%xmm2
pand   %xmm2,%xmm7
pandn  %xmm0,%xmm2
por    %xmm7,%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm3,%xmm5
pand   %xmm5,%xmm3
pandn  %xmm0,%xmm5
por    %xmm3,%xmm5
movdqa %xmm0,%xmm3
pcmpgtd %xmm4,%xmm3
pand   %xmm3,%xmm4
pandn  %xmm0,%xmm3
por    %xmm4,%xmm3
pand   %xmm0,%xmm3
pand   %xmm0,%xmm5
packuswb %xmm3,%xmm5
pand   %xmm0,%xmm2
pand   %xmm0,%xmm1
packuswb %xmm2,%xmm1
packuswb %xmm5,%xmm1
movdqu %xmm1,0x10(%rcx,%rbx,1)
add    $0x20,%rbx
add    $0xfffffffffffffffe,%rdi
jne    1270 <SDL_imageFilterNormalizeLinear+0x150>
jmp    14f6 <SDL_imageFilterNormalizeLinear+0x3d6>
xor    %ebx,%ebx
test   $0x1,%r9b
je     1640 <SDL_imageFilterNormalizeLinear+0x520>
movdqu (%r12,%rbx,1),%xmm0
pxor   %xmm1,%xmm1
movdqa %xmm0,%xmm2
punpcklbw %xmm1,%xmm2
movdqa %xmm2,%xmm4
punpcklwd %xmm1,%xmm4
punpckhwd %xmm1,%xmm2
punpckhbw %xmm1,%xmm0
movdqa %xmm0,%xmm3
punpcklwd %xmm1,%xmm3
punpckhwd %xmm1,%xmm0
psubd  %xmm6,%xmm0
psubd  %xmm6,%xmm3
psubd  %xmm6,%xmm2
psubd  %xmm6,%xmm4
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm13,%xmm4
pshufd $0xe8,%xmm4,%xmm1
pmuludq %xmm14,%xmm5
pshufd $0xe8,%xmm5,%xmm4
punpckldq %xmm4,%xmm1
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm13,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm14,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm2
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm13,%xmm3
pshufd $0xe8,%xmm3,%xmm6
pmuludq %xmm14,%xmm4
pshufd $0xe8,%xmm4,%xmm3
punpckldq %xmm3,%xmm6
pmuludq %xmm0,%xmm13
pshufd $0xe8,%xmm13,%xmm4
pshufd $0xf5,%xmm0,%xmm0
pmuludq %xmm14,%xmm0
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm4
paddd  %xmm12,%xmm4
paddd  %xmm12,%xmm6
paddd  %xmm12,%xmm2
paddd  %xmm12,%xmm1
movdqa 0xa31(%rip),%xmm3
movdqa %xmm3,%xmm0
pcmpgtd %xmm1,%xmm0
pand   %xmm0,%xmm1
pandn  %xmm3,%xmm0
por    %xmm1,%xmm0
movdqa %xmm3,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm3,%xmm1
por    %xmm2,%xmm1
movdqa %xmm3,%xmm2
pcmpgtd %xmm6,%xmm2
pand   %xmm2,%xmm6
pandn  %xmm3,%xmm2
por    %xmm6,%xmm2
movdqa %xmm3,%xmm5
pcmpgtd %xmm4,%xmm5
pand   %xmm5,%xmm4
pandn  %xmm3,%xmm5
por    %xmm4,%xmm5
pand   %xmm3,%xmm5
pand   %xmm3,%xmm2
packuswb %xmm5,%xmm2
pand   %xmm3,%xmm1
pand   %xmm3,%xmm0
packuswb %xmm1,%xmm0
packuswb %xmm2,%xmm0
movdqu %xmm0,(%rcx,%rbx,1)
cmp    %rsi,%r8
je     17ed <SDL_imageFilterNormalizeLinear+0x6cd>
test   $0x8,%r8b
jne    1665 <SDL_imageFilterNormalizeLinear+0x545>
mov    0x10(%rsp),%rbx
add    %rsi,%rbx
add    %rsi,%r12
add    %esi,%r10d
mov    %r12,%rdi
jmp    1762 <SDL_imageFilterNormalizeLinear+0x642>
mov    0x10(%rsp),%rcx
add    $0x1,%r11
add    $0x8,%rdx
and    %r11,%rdx
add    %edx,%r10d
lea    (%r12,%rdx,1),%rdi
lea    (%rcx,%rdx,1),%rbx
pshufd $0x0,%xmm8,%xmm0
pshufd $0x0,%xmm9,%xmm1
pshufd $0x0,%xmm10,%xmm2
pxor   %xmm8,%xmm8
pshufd $0xf5,%xmm1,%xmm4
movdqa 0x95c(%rip),%xmm5
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movq   (%r12,%rsi,1),%xmm6
punpcklbw %xmm8,%xmm6
movdqa %xmm6,%xmm7
punpcklwd %xmm8,%xmm7
punpckhwd %xmm8,%xmm6
psubd  %xmm0,%xmm6
psubd  %xmm0,%xmm7
pshufd $0xf5,%xmm7,%xmm3
pmuludq %xmm1,%xmm7
pshufd $0xe8,%xmm7,%xmm7
pmuludq %xmm4,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm7
pshufd $0xf5,%xmm6,%xmm3
pmuludq %xmm1,%xmm6
pshufd $0xe8,%xmm6,%xmm6
pmuludq %xmm4,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm6
paddd  %xmm2,%xmm6
paddd  %xmm2,%xmm7
movdqa %xmm5,%xmm3
pcmpgtd %xmm7,%xmm3
pand   %xmm3,%xmm7
pandn  %xmm5,%xmm3
por    %xmm7,%xmm3
movdqa %xmm5,%xmm7
pcmpgtd %xmm6,%xmm7
pand   %xmm7,%xmm6
pandn  %xmm5,%xmm7
por    %xmm6,%xmm7
pand   %xmm5,%xmm7
pand   %xmm5,%xmm3
packuswb %xmm7,%xmm3
packuswb %xmm3,%xmm3
movq   %xmm3,(%rcx,%rsi,1)
add    $0x8,%rsi
cmp    %rsi,%rdx
jne    16b0 <SDL_imageFilterNormalizeLinear+0x590>
cmp    %rdx,%r11
je     17ed <SDL_imageFilterNormalizeLinear+0x6cd>
mov    %r14d,%edx
sub    %r10d,%edx
mov    %r10d,%ecx
not    %ecx
test   $0x1,%dl
je     179a <SDL_imageFilterNormalizeLinear+0x67a>
movzbl (%rdi),%edx
sub    %ebp,%edx
imul   %eax,%edx
add    %r13d,%edx
cmp    $0xff,%edx
mov    $0xff,%esi
cmovl  %edx,%esi
mov    %sil,(%rbx)
add    $0x1,%rdi
add    $0x1,%rbx
add    $0x1,%r10d
add    %r14d,%ecx
je     17ed <SDL_imageFilterNormalizeLinear+0x6cd>
sub    %r10d,%r14d
xor    %ecx,%ecx
mov    $0xff,%edx
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%esi
sub    %ebp,%esi
imul   %eax,%esi
add    %r13d,%esi
cmp    $0xff,%esi
cmovge %edx,%esi
mov    %sil,(%rbx,%rcx,1)
movzbl 0x1(%rdi,%rcx,1),%esi
sub    %ebp,%esi
imul   %eax,%esi
add    %r13d,%esi
cmp    $0xff,%esi
cmovge %edx,%esi
mov    %sil,0x1(%rbx,%rcx,1)
add    $0x2,%rcx
cmp    %ecx,%r14d
jne    17b0 <SDL_imageFilterNormalizeLinear+0x690>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SDL_imageFilterNormalizeLinear(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i8* %0, i8** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
%24 = call i64 (...) @SDL_imageFilterMMXdetect()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %54
26: ; preds = %7
%27 = load i32, i32* %11
%28 = icmp sgt i32 %27, 7
br i1 %28, label %29, label %54
29: ; preds = %26
%30 = load i8*, i8** %9
%31 = load i8*, i8** %10
%32 = load i32, i32* %11
%33 = load i32, i32* %12
%34 = load i32, i32* %13
%35 = load i32, i32* %14
%36 = load i32, i32* %15
%37 = call i32 @SDL_imageFilterNormalizeLinearMMX(i8* %30, i8* %31, i32 %32, i32 %33, i32 %34, i32 %35, i32 %36)
%38 = load i32, i32* %11
%39 = and i32 %38, 7
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %52
41: ; preds = %29
%42 = load i32, i32* %11
%43 = and i32 %42, -8
store i32 %43, i32* %17
%44 = load i8*, i8** %9
%45 = load i32, i32* %17
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
store i8* %47, i8** %18
%48 = load i8*, i8** %10
%49 = load i32, i32* %17
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8* %51, i8** %19
br label %53
52: ; preds = %29
store i32 0, i32* %8
br label %101
53: ; preds = %41
br label %57
54: ; preds = %26, %7
store i32 0, i32* %17
%55 = load i8*, i8** %9
store i8* %55, i8** %18
%56 = load i8*, i8** %10
store i8* %56, i8** %19
br label %57
57: ; preds = %54, %53
%58 = load i32, i32* %13
%59 = load i32, i32* %12
%60 = sub nsw i32 %58, %59
store i32 %60, i32* %21
%61 = load i32, i32* %21
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %57
store i32 0, i32* %8
br label %101
64: ; preds = %57
%65 = load i32, i32* %15
%66 = load i32, i32* %14
%67 = sub nsw i32 %65, %66
store i32 %67, i32* %20
%68 = load i32, i32* %20
%69 = load i32, i32* %21
%70 = sdiv i32 %68, %69
store i32 %70, i32* %22
%71 = load i32, i32* %17
store i32 %71, i32* %16
br label %72
72: ; preds = %97, %64
%73 = load i32, i32* %16
%74 = load i32, i32* %11
%75 = icmp ult i32 %73, %74
br i1 %75, label %76, label %100
76: ; preds = %72
%77 = load i32, i32* %22
%78 = load i8*, i8** %18
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = load i32, i32* %12
%82 = sub nsw i32 %80, %81
%83 = mul nsw i32 %77, %82
%84 = load i32, i32* %14
%85 = add nsw i32 %83, %84
store i32 %85, i32* %23
%86 = load i32, i32* %23
%87 = icmp sgt i32 %86, 255
br i1 %87, label %88, label %89
88: ; preds = %76
store i32 255, i32* %23
br label %89
89: ; preds = %88, %76
%90 = load i32, i32* %23
%91 = trunc i32 %90 to i8
%92 = load i8*, i8** %19
store i8 %91, i8* %92
%93 = load i8*, i8** %18
%94 = getelementptr inbounds i8, i8* %93, i32 1
store i8* %94, i8** %18
%95 = load i8*, i8** %19
%96 = getelementptr inbounds i8, i8* %95, i32 1
store i8* %96, i8** %19
br label %97
97: ; preds = %89
%98 = load i32, i32* %16
%99 = add i32 %98, 1
store i32 %99, i32* %16
br label %72
100: ; preds = %72
store i32 0, i32* %8
br label %101
101: ; preds = %100, %63, %52
%102 = load i32, i32* %8
ret i32 %102
}

LLVM IR (-O2):
define i32 @SDL_imageFilterNormalizeLinear(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i64 (...) @SDL_imageFilterMMXdetect()
%9 = icmp ne i64 %8, 0
%10 = icmp sgt i32 %2, 7
%11 = and i1 %10, %9
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = tail call i32 @SDL_imageFilterNormalizeLinearMMX(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6)
%14 = and i32 %2, 7
%15 = icmp eq i32 %14, 0
br i1 %15, label %207, label %16
16: ; preds = %12
%17 = and i32 %2, -8
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = getelementptr inbounds i8, i8* %1, i64 %18
br label %21
21: ; preds = %7, %16
%22 = phi i8* [ %20, %16 ], [ %1, %7 ]
%23 = phi i8* [ %19, %16 ], [ %0, %7 ]
%24 = phi i32 [ %17, %16 ], [ 0, %7 ]
%25 = sub nsw i32 %4, %3
%26 = icmp eq i32 %25, 0
br i1 %26, label %207, label %27
27: ; preds = %21
%28 = sub nsw i32 %6, %5
%29 = sdiv i32 %28, %25
%30 = icmp ult i32 %24, %2
br i1 %30, label %31, label %207
31: ; preds = %27
%32 = xor i32 %24, -1
%33 = add i32 %32, %2
%34 = zext i32 %33 to i64
%35 = add nuw nsw i64 %34, 1
%36 = icmp ult i32 %33, 7
br i1 %36, label %155, label %37
37: ; preds = %31
%38 = xor i32 %24, -1
%39 = add i32 %38, %2
%40 = zext i32 %39 to i64
%41 = add nuw nsw i64 %40, 1
%42 = getelementptr i8, i8* %22, i64 %41
%43 = getelementptr i8, i8* %23, i64 %41
%44 = icmp ult i8* %22, %43
%45 = icmp ult i8* %23, %42
%46 = and i1 %44, %45
br i1 %46, label %155, label %47
47: ; preds = %37
%48 = icmp ult i32 %33, 15
br i1 %48, label %120, label %49
49: ; preds = %47
%50 = and i64 %35, 8589934576
%51 = insertelement <16 x i32> poison, i32 %3, i64 0
%52 = shufflevector <16 x i32> %51, <16 x i32> poison, <16 x i32> zeroinitializer
%53 = insertelement <16 x i32> poison, i32 %29, i64 0
%54 = shufflevector <16 x i32> %53, <16 x i32> poison, <16 x i32> zeroinitializer
%55 = insertelement <16 x i32> poison, i32 %5, i64 0
%56 = shufflevector <16 x i32> %55, <16 x i32> poison, <16 x i32> zeroinitializer
%57 = add nsw i64 %50, -16
%58 = lshr exact i64 %57, 4
%59 = add nuw nsw i64 %58, 1
%60 = and i64 %59, 1
%61 = icmp eq i64 %57, 0
br i1 %61, label %95, label %62
62: ; preds = %49
%63 = and i64 %59, 2305843009213693950
br label %64
64: ; preds = %64, %62
%65 = phi i64 [ 0, %62 ], [ %92, %64 ]
%66 = phi i64 [ 0, %62 ], [ %93, %64 ]
%67 = getelementptr i8, i8* %23, i64 %65
%68 = getelementptr i8, i8* %22, i64 %65
%69 = bitcast i8* %67 to <16 x i8>*
%70 = load <16 x i8>, <16 x i8>* %69
%71 = zext <16 x i8> %70 to <16 x i32>
%72 = sub nsw <16 x i32> %71, %52
%73 = mul nsw <16 x i32> %72, %54
%74 = add nsw <16 x i32> %73, %56
%75 = icmp slt <16 x i32> %74, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%76 = select <16 x i1> %75, <16 x i32> %74, <16 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%77 = trunc <16 x i32> %76 to <16 x i8>
%78 = bitcast i8* %68 to <16 x i8>*
store <16 x i8> %77, <16 x i8>* %78
%79 = or i64 %65, 16
%80 = getelementptr i8, i8* %23, i64 %79
%81 = getelementptr i8, i8* %22, i64 %79
%82 = bitcast i8* %80 to <16 x i8>*
%83 = load <16 x i8>, <16 x i8>* %82
%84 = zext <16 x i8> %83 to <16 x i32>
%85 = sub nsw <16 x i32> %84, %52
%86 = mul nsw <16 x i32> %85, %54
%87 = add nsw <16 x i32> %86, %56
%88 = icmp slt <16 x i32> %87, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%89 = select <16 x i1> %88, <16 x i32> %87, <16 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%90 = trunc <16 x i32> %89 to <16 x i8>
%91 = bitcast i8* %81 to <16 x i8>*
store <16 x i8> %90, <16 x i8>* %91
%92 = add nuw i64 %65, 32
%93 = add i64 %66, 2
%94 = icmp eq i64 %93, %63
br i1 %94, label %95, label %64
95: ; preds = %64, %49
%96 = phi i64 [ 0, %49 ], [ %92, %64 ]
%97 = icmp eq i64 %60, 0
br i1 %97, label %111, label %98
98: ; preds = %95
%99 = getelementptr i8, i8* %23, i64 %96
%100 = getelementptr i8, i8* %22, i64 %96
%101 = bitcast i8* %99 to <16 x i8>*
%102 = load <16 x i8>, <16 x i8>* %101
%103 = zext <16 x i8> %102 to <16 x i32>
%104 = sub nsw <16 x i32> %103, %52
%105 = mul nsw <16 x i32> %104, %54
%106 = add nsw <16 x i32> %105, %56
%107 = icmp slt <16 x i32> %106, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%108 = select <16 x i1> %107, <16 x i32> %106, <16 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%109 = trunc <16 x i32> %108 to <16 x i8>
%110 = bitcast i8* %100 to <16 x i8>*
store <16 x i8> %109, <16 x i8>* %110
br label %111
111: ; preds = %95, %98
%112 = icmp eq i64 %35, %50
br i1 %112, label %207, label %113
113: ; preds = %111
%114 = getelementptr i8, i8* %22, i64 %50
%115 = getelementptr i8, i8* %23, i64 %50
%116 = trunc i64 %50 to i32
%117 = add i32 %24, %116
%118 = and i64 %35, 8
%119 = icmp eq i64 %118, 0
br i1 %119, label %155, label %120
120: ; preds = %47, %113
%121 = phi i64 [ %50, %113 ], [ 0, %47 ]
%122 = xor i32 %24, -1
%123 = add i32 %122, %2
%124 = zext i32 %123 to i64
%125 = add nuw nsw i64 %124, 1
%126 = and i64 %125, 8589934584
%127 = trunc i64 %126 to i32
%128 = add i32 %24, %127
%129 = getelementptr i8, i8* %23, i64 %126
%130 = getelementptr i8, i8* %22, i64 %126
%131 = insertelement <8 x i32> poison, i32 %3, i64 0
%132 = shufflevector <8 x i32> %131, <8 x i32> poison, <8 x i32> zeroinitializer
%133 = insertelement <8 x i32> poison, i32 %29, i64 0
%134 = shufflevector <8 x i32> %133, <8 x i32> poison, <8 x i32> zeroinitializer
%135 = insertelement <8 x i32> poison, i32 %5, i64 0
%136 = shufflevector <8 x i32> %135, <8 x i32> poison, <8 x i32> zeroinitializer
br label %137
137: ; preds = %137, %120
%138 = phi i64 [ %121, %120 ], [ %151, %137 ]
%139 = getelementptr i8, i8* %23, i64 %138
%140 = getelementptr i8, i8* %22, i64 %138
%141 = bitcast i8* %139 to <8 x i8>*
%142 = load <8 x i8>, <8 x i8>* %141
%143 = zext <8 x i8> %142 to <8 x i32>
%144 = sub nsw <8 x i32> %143, %132
%145 = mul nsw <8 x i32> %144, %134
%146 = add nsw <8 x i32> %145, %136
%147 = icmp slt <8 x i32> %146, <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%148 = select <8 x i1> %147, <8 x i32> %146, <8 x i32> <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>
%149 = trunc <8 x i32> %148 to <8 x i8>
%150 = bitcast i8* %140 to <8 x i8>*
store <8 x i8> %149, <8 x i8>* %150
%151 = add nuw i64 %138, 8
%152 = icmp eq i64 %151, %126
br i1 %152, label %153, label %137
153: ; preds = %137
%154 = icmp eq i64 %125, %126
br i1 %154, label %207, label %155
155: ; preds = %37, %31, %113, %153
%156 = phi i32 [ %24, %31 ], [ %24, %37 ], [ %117, %113 ], [ %128, %153 ]
%157 = phi i8* [ %23, %31 ], [ %23, %37 ], [ %115, %113 ], [ %129, %153 ]
%158 = phi i8* [ %22, %31 ], [ %22, %37 ], [ %114, %113 ], [ %130, %153 ]
%159 = sub i32 %2, %156
%160 = xor i32 %156, -1
%161 = and i32 %159, 1
%162 = icmp eq i32 %161, 0
br i1 %162, label %175, label %163
163: ; preds = %155
%164 = load i8, i8* %157
%165 = zext i8 %164 to i32
%166 = sub nsw i32 %165, %3
%167 = mul nsw i32 %166, %29
%168 = add nsw i32 %167, %5
%169 = icmp slt i32 %168, 255
%170 = select i1 %169, i32 %168, i32 255
%171 = trunc i32 %170 to i8
store i8 %171, i8* %158
%172 = getelementptr inbounds i8, i8* %157, i64 1
%173 = getelementptr inbounds i8, i8* %158, i64 1
%174 = add nuw i32 %156, 1
br label %175
175: ; preds = %163, %155
%176 = phi i32 [ %156, %155 ], [ %174, %163 ]
%177 = phi i8* [ %157, %155 ], [ %172, %163 ]
%178 = phi i8* [ %158, %155 ], [ %173, %163 ]
%179 = sub i32 0, %2
%180 = icmp eq i32 %160, %179
br i1 %180, label %207, label %181
181: ; preds = %175, %181
%182 = phi i32 [ %205, %181 ], [ %176, %175 ]
%183 = phi i8* [ %203, %181 ], [ %177, %175 ]
%184 = phi i8* [ %204, %181 ], [ %178, %175 ]
%185 = load i8, i8* %183
%186 = zext i8 %185 to i32
%187 = sub nsw i32 %186, %3
%188 = mul nsw i32 %187, %29
%189 = add nsw i32 %188, %5
%190 = icmp slt i32 %189, 255
%191 = select i1 %190, i32 %189, i32 255
%192 = trunc i32 %191 to i8
store i8 %192, i8* %184
%193 = getelementptr inbounds i8, i8* %183, i64 1
%194 = getelementptr inbounds i8, i8* %184, i64 1
%195 = load i8, i8* %193
%196 = zext i8 %195 to i32
%197 = sub nsw i32 %196, %3
%198 = mul nsw i32 %197, %29
%199 = add nsw i32 %198, %5
%200 = icmp slt i32 %199, 255
%201 = select i1 %200, i32 %199, i32 255
%202 = trunc i32 %201 to i8
store i8 %202, i8* %194
%203 = getelementptr inbounds i8, i8* %183, i64 2
%204 = getelementptr inbounds i8, i8* %184, i64 2
%205 = add nuw i32 %182, 2
%206 = icmp eq i32 %205, %2
br i1 %206, label %207, label %181
207: ; preds = %175, %181, %111, %153, %27, %21, %12
ret i32 0
}