#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*/ _alphaBlitMMXGlobalAlpha(unsigned char *, unsigned char *,
                                            unsigned int, unsigned int,
                                            unsigned int, unsigned int,
                                            unsigned int);
int /*<<< orphan*/ _alphaBlitMMXNOGlobalAlpha(unsigned char *, unsigned char *,
                                              unsigned int, unsigned int,
                                              unsigned int, unsigned int);
void _alphaBlitMMX(unsigned char *src, unsigned char *dst, unsigned int w,
                   unsigned int h, unsigned int s_line, unsigned int d_line,
                   unsigned char alpha) {
  unsigned int asx = (s_line << 2) - (w << 2);
  unsigned int adx = (d_line << 2) - (w << 2);
  if (alpha == 255) {
    _alphaBlitMMXNOGlobalAlpha(src, dst, w, h, asx, adx);
  } else {
    unsigned int alp = (alpha + 1);
    _alphaBlitMMXGlobalAlpha(src, dst, w, h, asx, adx, alp);
  }
}


x86 assembly (clang, -O0):
<_alphaBlitMMX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
movzbl 0x10(%rbp),%eax
cmp    $0xff,%eax
jne    1192 <_alphaBlitMMX+0x72>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
call   1030 <_alphaBlitMMXNOGlobalAlpha@plt>
jmp    11bd <_alphaBlitMMX+0x9d>
movzbl 0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <_alphaBlitMMXGlobalAlpha@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_alphaBlitMMX>:
push   %rax
mov    0x10(%rsp),%al
sub    %edx,%r8d
shl    $0x2,%r8d
sub    %edx,%r9d
shl    $0x2,%r9d
cmp    $0xff,%al
je     1147 <_alphaBlitMMX+0x27>
movzbl %al,%eax
add    $0x1,%eax
mov    %eax,(%rsp)
call   1040 <_alphaBlitMMXGlobalAlpha@plt>
pop    %rax
ret
pop    %rax
jmp    1030 <_alphaBlitMMXNOGlobalAlpha@plt>

LLVM IR (-O0):
define void @_alphaBlitMMX(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i8 zeroext %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i8 %6, i8* %14
%18 = load i32, i32* %12
%19 = shl i32 %18, 2
%20 = load i32, i32* %10
%21 = shl i32 %20, 2
%22 = sub i32 %19, %21
store i32 %22, i32* %15
%23 = load i32, i32* %13
%24 = shl i32 %23, 2
%25 = load i32, i32* %10
%26 = shl i32 %25, 2
%27 = sub i32 %24, %26
store i32 %27, i32* %16
%28 = load i8, i8* %14
%29 = zext i8 %28 to i32
%30 = icmp eq i32 %29, 255
br i1 %30, label %31, label %39
31: ; preds = %7
%32 = load i8*, i8** %8
%33 = load i8*, i8** %9
%34 = load i32, i32* %10
%35 = load i32, i32* %11
%36 = load i32, i32* %15
%37 = load i32, i32* %16
%38 = call i32 @_alphaBlitMMXNOGlobalAlpha(i8* %32, i8* %33, i32 %34, i32 %35, i32 %36, i32 %37)
br label %51
39: ; preds = %7
%40 = load i8, i8* %14
%41 = zext i8 %40 to i32
%42 = add nsw i32 %41, 1
store i32 %42, i32* %17
%43 = load i8*, i8** %8
%44 = load i8*, i8** %9
%45 = load i32, i32* %10
%46 = load i32, i32* %11
%47 = load i32, i32* %15
%48 = load i32, i32* %16
%49 = load i32, i32* %17
%50 = call i32 @_alphaBlitMMXGlobalAlpha(i8* %43, i8* %44, i32 %45, i32 %46, i32 %47, i32 %48, i32 %49)
br label %51
51: ; preds = %39, %31
ret void
}

LLVM IR (-O2):
define void @_alphaBlitMMX(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i8 zeroext %6) {
%8 = sub i32 %4, %2
%9 = shl i32 %8, 2
%10 = sub i32 %5, %2
%11 = shl i32 %10, 2
%12 = icmp eq i8 %6, -1
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 @_alphaBlitMMXNOGlobalAlpha(i8* %0, i8* %1, i32 %2, i32 %3, i32 %9, i32 %11)
br label %19
15: ; preds = %7
%16 = zext i8 %6 to i32
%17 = add nuw nsw i32 %16, 1
%18 = tail call i32 @_alphaBlitMMXGlobalAlpha(i8* %0, i8* %1, i32 %2, i32 %3, i32 %9, i32 %11, i32 %17)
br label %19
19: ; preds = %15, %13
ret void
}