#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_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows,
                          int columns) {
  if ((Src == NULL) || (Dest == NULL))
    return (-1);
  if ((columns < 8) || (rows < 3))
    return (-1);
  if ((SDL_imageFilterMMXdetect())) {
    return (0);
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<SDL_imageFilterSobelX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113c <SDL_imageFilterSobelX+0x2c>
cmpq   $0x0,-0x18(%rbp)
jne    1148 <SDL_imageFilterSobelX+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <SDL_imageFilterSobelX+0x7c>
cmpl   $0x8,-0x20(%rbp)
jl     115c <SDL_imageFilterSobelX+0x4c>
cmpl   $0x3,-0x1c(%rbp)
jge    1168 <SDL_imageFilterSobelX+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <SDL_imageFilterSobelX+0x7c>
mov    $0x0,%al
call   1030 <SDL_imageFilterMMXdetect@plt>
cmp    $0x0,%rax
je     1185 <SDL_imageFilterSobelX+0x75>
movl   $0x0,-0x4(%rbp)
jmp    118c <SDL_imageFilterSobelX+0x7c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDL_imageFilterSobelX>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     113b <SDL_imageFilterSobelX+0x2b>
test   %rsi,%rsi
je     113b <SDL_imageFilterSobelX+0x2b>
cmp    $0x3,%edx
jl     113b <SDL_imageFilterSobelX+0x2b>
cmp    $0x8,%ecx
jl     113b <SDL_imageFilterSobelX+0x2b>
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_imageFilterSobelX(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i8*, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %4
%13 = load i8*, i8** %7
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %12, %4
store i32 -1, i32* %5
br label %28
16: ; preds = %12
%17 = load i32, i32* %9
%18 = icmp slt i32 %17, 8
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %8
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %23
22: ; preds = %19, %16
store i32 -1, i32* %5
br label %28
23: ; preds = %19
%24 = call i64 (...) @SDL_imageFilterMMXdetect()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 0, i32* %5
br label %28
27: ; preds = %23
store i32 -1, i32* %5
br label %28
28: ; preds = %27, %26, %22, %15
%29 = load i32, i32* %5
ret i32 %29
}

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