#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*/ mmx_blend_argb32p_rgb16_inplace(unsigned short *,
                                                   unsigned int *, int);
int /*<<< orphan*/ mmx_blend_argb32p_rgb16_inplace_opacity(unsigned short *,
                                                           unsigned int *,
                                                           unsigned char, int);
int /*<<< orphan*/ printf(char *);
void mmx_blend_argb32p_rgb16(unsigned short *dest, unsigned int *src,
                             unsigned char opacity, int width,
                             unsigned short *output) {
  if (dest == output) {
    if (opacity != 0xFF)
      mmx_blend_argb32p_rgb16_inplace_opacity(dest, src, opacity, width);
    else
      mmx_blend_argb32p_rgb16_inplace(dest, src, width);
  } else {
    printf("mmx: Non-inplace argb32p + rgb16 blend not implemented\n");
  }
}


x86 assembly (clang, -O0):
<mmx_blend_argb32p_rgb16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1199 <mmx_blend_argb32p_rgb16+0x69>
movzbl -0x11(%rbp),%eax
cmp    $0xff,%eax
je     1184 <mmx_blend_argb32p_rgb16+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x11(%rbp),%al
mov    -0x18(%rbp),%ecx
movzbl %al,%edx
call   1030 <mmx_blend_argb32p_rgb16_inplace_opacity@plt>
jmp    1194 <mmx_blend_argb32p_rgb16+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1050 <mmx_blend_argb32p_rgb16_inplace@plt>
jmp    11a5 <mmx_blend_argb32p_rgb16+0x75>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmx_blend_argb32p_rgb16>:
cmp    %r8,%rdi
je     1141 <mmx_blend_argb32p_rgb16+0x11>
lea    0xec4(%rip),%rdi
jmp    1030 <puts@plt>
cmp    $0xff,%dl
je     114e <mmx_blend_argb32p_rgb16+0x1e>
movzbl %dl,%edx
jmp    1040 <mmx_blend_argb32p_rgb16_inplace_opacity@plt>
mov    %ecx,%edx
jmp    1050 <mmx_blend_argb32p_rgb16_inplace@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"mmx: Non-inplace argb32p + rgb16 blend not implemented\0A\00"
define void @mmx_blend_argb32p_rgb16(i16* %0, i32* %1, i8 zeroext %2, i32 %3, i16* %4) {
%6 = alloca i16*
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i32
%10 = alloca i16*
store i16* %0, i16** %6
store i32* %1, i32** %7
store i8 %2, i8* %8
store i32 %3, i32* %9
store i16* %4, i16** %10
%11 = load i16*, i16** %6
%12 = load i16*, i16** %10
%13 = icmp eq i16* %11, %12
br i1 %13, label %14, label %30
14: ; preds = %5
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = icmp ne i32 %16, 255
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i16*, i16** %6
%20 = load i32*, i32** %7
%21 = load i8, i8* %8
%22 = load i32, i32* %9
%23 = call i32 @mmx_blend_argb32p_rgb16_inplace_opacity(i16* %19, i32* %20, i8 zeroext %21, i32 %22)
br label %29
24: ; preds = %14
%25 = load i16*, i16** %6
%26 = load i32*, i32** %7
%27 = load i32, i32* %9
%28 = call i32 @mmx_blend_argb32p_rgb16_inplace(i16* %25, i32* %26, i32 %27)
br label %29
29: ; preds = %24, %18
br label %32
30: ; preds = %5
%31 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30, %29
ret void
}

LLVM IR (-O2):
@str = [55 x i8] c"mmx: Non-inplace argb32p + rgb16 blend not implemented\00"
define void @mmx_blend_argb32p_rgb16(i16* %0, i32* %1, i8 zeroext %2, i32 %3, i16* readnone %4) {
%6 = icmp eq i16* %0, %4
br i1 %6, label %7, label %13
7: ; preds = %5
%8 = icmp eq i8 %2, -1
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @mmx_blend_argb32p_rgb16_inplace_opacity(i16* %0, i32* %1, i8 zeroext %2, i32 %3)
br label %15
11: ; preds = %7
%12 = tail call i32 @mmx_blend_argb32p_rgb16_inplace(i16* %0, i32* %1, i32 %3)
br label %15
13: ; preds = %5
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %9, %11, %13
ret void
}