#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ mc_chroma_2xh(int /*<<< orphan*/ *, int,
                                 int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ mc_chroma_altivec_4xh(int /*<<< orphan*/ *, int,
                                         int /*<<< orphan*/ *, int, int, int,
                                         int);
int /*<<< orphan*/ mc_chroma_altivec_8xh(int /*<<< orphan*/ *, int,
                                         int /*<<< orphan*/ *, int, int, int,
                                         int);
void mc_chroma_altivec(uint8_t *dst, int i_dst_stride, uint8_t *src,
                       int i_src_stride, int mvx, int mvy, int i_width,
                       int i_height) {
  if (i_width == 8)
    mc_chroma_altivec_8xh(dst, i_dst_stride, src, i_src_stride, mvx, mvy,
                          i_height);
  else if (i_width == 4)
    mc_chroma_altivec_4xh(dst, i_dst_stride, src, i_src_stride, mvx, mvy,
                          i_height);
  else
    mc_chroma_2xh(dst, i_dst_stride, src, i_src_stride, mvx, mvy, i_height);
}


x86 assembly (clang, -O0):
<mc_chroma_altivec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x8,0x10(%rbp)
jne    1184 <mc_chroma_altivec+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <mc_chroma_altivec_8xh@plt>
jmp    11da <mc_chroma_altivec+0xaa>
cmpl   $0x4,0x10(%rbp)
jne    11b4 <mc_chroma_altivec+0x84>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <mc_chroma_altivec_4xh@plt>
jmp    11d5 <mc_chroma_altivec+0xa5>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <mc_chroma_2xh@plt>
jmp    11da <mc_chroma_altivec+0xaa>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mc_chroma_altivec>:
push   %rax
mov    0x18(%rsp),%r10d
mov    0x10(%rsp),%eax
cmp    $0x4,%eax
je     114f <mc_chroma_altivec+0x1f>
cmp    $0x8,%eax
jne    115a <mc_chroma_altivec+0x2a>
mov    %r10d,(%rsp)
call   1050 <mc_chroma_altivec_8xh@plt>
pop    %rax
ret
mov    %r10d,(%rsp)
call   1030 <mc_chroma_altivec_4xh@plt>
pop    %rax
ret
mov    %r10d,(%rsp)
call   1040 <mc_chroma_2xh@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @mc_chroma_altivec(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32* %0, i32** %9
store i32 %1, i32* %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
store i32 %7, i32* %16
%17 = load i32, i32* %15
%18 = icmp eq i32 %17, 8
br i1 %18, label %19, label %28
19: ; preds = %8
%20 = load i32*, i32** %9
%21 = load i32, i32* %10
%22 = load i32*, i32** %11
%23 = load i32, i32* %12
%24 = load i32, i32* %13
%25 = load i32, i32* %14
%26 = load i32, i32* %16
%27 = call i32 @mc_chroma_altivec_8xh(i32* %20, i32 %21, i32* %22, i32 %23, i32 %24, i32 %25, i32 %26)
br label %50
28: ; preds = %8
%29 = load i32, i32* %15
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %40
31: ; preds = %28
%32 = load i32*, i32** %9
%33 = load i32, i32* %10
%34 = load i32*, i32** %11
%35 = load i32, i32* %12
%36 = load i32, i32* %13
%37 = load i32, i32* %14
%38 = load i32, i32* %16
%39 = call i32 @mc_chroma_altivec_4xh(i32* %32, i32 %33, i32* %34, i32 %35, i32 %36, i32 %37, i32 %38)
br label %49
40: ; preds = %28
%41 = load i32*, i32** %9
%42 = load i32, i32* %10
%43 = load i32*, i32** %11
%44 = load i32, i32* %12
%45 = load i32, i32* %13
%46 = load i32, i32* %14
%47 = load i32, i32* %16
%48 = call i32 @mc_chroma_2xh(i32* %41, i32 %42, i32* %43, i32 %44, i32 %45, i32 %46, i32 %47)
br label %49
49: ; preds = %40, %31
br label %50
50: ; preds = %49, %19
ret void
}

LLVM IR (-O2):
define void @mc_chroma_altivec(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
switch i32 %6, label %13 [
i32 8, label %9
i32 4, label %11
]
9: ; preds = %8
%10 = tail call i32 @mc_chroma_altivec_8xh(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32 %7)
br label %15
11: ; preds = %8
%12 = tail call i32 @mc_chroma_altivec_4xh(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32 %7)
br label %15
13: ; preds = %8
%14 = tail call i32 @mc_chroma_2xh(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32 %7)
br label %15
15: ; preds = %11, %13, %9
ret void
}