#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 SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src,
                                               unsigned char *Dest, int rows,
                                               int columns,
                                               signed short *Kernel,
                                               unsigned char NRightShift) {
  if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
    return (-1);
  if ((columns < 7) || (rows < 7) || (NRightShift > 7))
    return (-1);
  if ((SDL_imageFilterMMXdetect())) {
    return (0);
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<SDL_imageFilterConvolveKernel7x7ShiftRight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r9b,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %al,-0x29(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1151 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x41>
cmpq   $0x0,-0x18(%rbp)
je     1151 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x41>
cmpq   $0x0,-0x28(%rbp)
jne    115d <SDL_imageFilterConvolveKernel7x7ShiftRight+0x4d>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <SDL_imageFilterConvolveKernel7x7ShiftRight+0x9e>
cmpl   $0x7,-0x20(%rbp)
jl     117e <SDL_imageFilterConvolveKernel7x7ShiftRight+0x6e>
cmpl   $0x7,-0x1c(%rbp)
jl     117e <SDL_imageFilterConvolveKernel7x7ShiftRight+0x6e>
movzbl -0x29(%rbp),%eax
cmp    $0x7,%eax
jle    118a <SDL_imageFilterConvolveKernel7x7ShiftRight+0x7a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <SDL_imageFilterConvolveKernel7x7ShiftRight+0x9e>
mov    $0x0,%al
call   1030 <SDL_imageFilterMMXdetect@plt>
cmp    $0x0,%rax
je     11a7 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x97>
movl   $0x0,-0x4(%rbp)
jmp    11ae <SDL_imageFilterConvolveKernel7x7ShiftRight+0x9e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDL_imageFilterConvolveKernel7x7ShiftRight>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1146 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x36>
test   %rsi,%rsi
je     1146 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x36>
test   %r8,%r8
je     1146 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x36>
cmp    $0x7,%edx
jl     1146 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x36>
cmp    $0x7,%ecx
jl     1146 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x36>
cmp    $0x7,%r9b
ja     1146 <SDL_imageFilterConvolveKernel7x7ShiftRight+0x36>
push   %rax
xor    %eax,%eax
call   1030 <SDL_imageFilterMMXdetect@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @SDL_imageFilterConvolveKernel7x7ShiftRight(i8* %0, i8* %1, i32 %2, i32 %3, i16* %4, i8 zeroext %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i8
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i8 %5, i8* %13
%14 = load i8*, i8** %8
%15 = icmp eq i8* %14, null
br i1 %15, label %22, label %16
16: ; preds = %6
%17 = load i8*, i8** %9
%18 = icmp eq i8* %17, null
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i16*, i16** %12
%21 = icmp eq i16* %20, null
br i1 %21, label %22, label %23
22: ; preds = %19, %16, %6
store i32 -1, i32* %7
br label %39
23: ; preds = %19
%24 = load i32, i32* %11
%25 = icmp slt i32 %24, 7
br i1 %25, label %33, label %26
26: ; preds = %23
%27 = load i32, i32* %10
%28 = icmp slt i32 %27, 7
br i1 %28, label %33, label %29
29: ; preds = %26
%30 = load i8, i8* %13
%31 = zext i8 %30 to i32
%32 = icmp sgt i32 %31, 7
br i1 %32, label %33, label %34
33: ; preds = %29, %26, %23
store i32 -1, i32* %7
br label %39
34: ; preds = %29
%35 = call i64 (...) @SDL_imageFilterMMXdetect()
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 0, i32* %7
br label %39
38: ; preds = %34
store i32 -1, i32* %7
br label %39
39: ; preds = %38, %37, %33, %22
%40 = load i32, i32* %7
ret i32 %40
}

LLVM IR (-O2):
define i32 @SDL_imageFilterConvolveKernel7x7ShiftRight(i8* readnone %0, i8* readnone %1, i32 %2, i32 %3, i16* readnone %4, i8 zeroext %5) {
%7 = icmp eq i8* %0, null
%8 = icmp eq i8* %1, null
%9 = or i1 %7, %8
%10 = icmp eq i16* %4, null
%11 = or i1 %9, %10
br i1 %11, label %22, label %12
12: ; preds = %6
%13 = icmp slt i32 %3, 7
%14 = icmp slt i32 %2, 7
%15 = or i1 %14, %13
%16 = icmp ugt i8 %5, 7
%17 = or i1 %15, %16
br i1 %17, label %22, label %18
18: ; preds = %12
%19 = tail call i64 (...) @SDL_imageFilterMMXdetect()
%20 = icmp eq i64 %19, 0
%21 = sext i1 %20 to i32
br label %22
22: ; preds = %18, %12, %6
%23 = phi i32 [ -1, %6 ], [ -1, %12 ], [ %21, %18 ]
ret i32 %23
}