#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*/ pixel_unpack_portable_u8s16_uv(unsigned char *, short *,
                                                  int);
int /*<<< orphan*/ pixel_unpack_portable_u8s16_y(unsigned char *, short *, int);
void llconv_yuv_planar_u8s16(unsigned char *source, short int *dest,
                             int nbpixels) {
  pixel_unpack_portable_u8s16_y(source, dest, nbpixels);
  pixel_unpack_portable_u8s16_uv(
      &source[nbpixels], &dest[nbpixels + (nbpixels >> 2)], nbpixels >> 2);
  pixel_unpack_portable_u8s16_uv(&source[nbpixels + (nbpixels >> 2)],
                                 &dest[nbpixels], nbpixels >> 2);
}


x86 assembly (clang, -O0):
<llconv_yuv_planar_u8s16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <pixel_unpack_portable_u8s16_y@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
add    %ecx,%eax
cltq
shl    $0x1,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
sar    $0x2,%edx
call   1040 <pixel_unpack_portable_u8s16_uv@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
add    %ecx,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
sar    $0x2,%edx
call   1040 <pixel_unpack_portable_u8s16_uv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llconv_yuv_planar_u8s16>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <pixel_unpack_portable_u8s16_y@plt>
movslq %ebp,%r15
lea    (%rbx,%r15,1),%rdi
mov    %r15d,%ebp
sar    $0x2,%ebp
lea    (%r15,%rbp,1),%eax
movslq %eax,%r12
lea    (%r14,%r12,2),%rsi
mov    %ebp,%edx
call   1040 <pixel_unpack_portable_u8s16_uv@plt>
add    %r12,%rbx
lea    (%r14,%r15,2),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <pixel_unpack_portable_u8s16_uv@plt>

LLVM IR (-O0):
define void @llconv_yuv_planar_u8s16(i8* %0, i16* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i16*
%6 = alloca i32
store i8* %0, i8** %4
store i16* %1, i16** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i16*, i16** %5
%9 = load i32, i32* %6
%10 = call i32 @pixel_unpack_portable_u8s16_y(i8* %7, i16* %8, i32 %9)
%11 = load i8*, i8** %4
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i16*, i16** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %6
%18 = ashr i32 %17, 2
%19 = add nsw i32 %16, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i16, i16* %15, i64 %20
%22 = load i32, i32* %6
%23 = ashr i32 %22, 2
%24 = call i32 @pixel_unpack_portable_u8s16_uv(i8* %14, i16* %21, i32 %23)
%25 = load i8*, i8** %4
%26 = load i32, i32* %6
%27 = load i32, i32* %6
%28 = ashr i32 %27, 2
%29 = add nsw i32 %26, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %25, i64 %30
%32 = load i16*, i16** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i16, i16* %32, i64 %34
%36 = load i32, i32* %6
%37 = ashr i32 %36, 2
%38 = call i32 @pixel_unpack_portable_u8s16_uv(i8* %31, i16* %35, i32 %37)
ret void
}

LLVM IR (-O2):
define void @llconv_yuv_planar_u8s16(i8* %0, i16* %1, i32 %2) {
%4 = tail call i32 @pixel_unpack_portable_u8s16_y(i8* %0, i16* %1, i32 %2)
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = ashr i32 %2, 2
%8 = add nsw i32 %7, %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i16, i16* %1, i64 %9
%11 = tail call i32 @pixel_unpack_portable_u8s16_uv(i8* %6, i16* %10, i32 %7)
%12 = getelementptr inbounds i8, i8* %0, i64 %9
%13 = getelementptr inbounds i16, i16* %1, i64 %5
%14 = tail call i32 @pixel_unpack_portable_u8s16_uv(i8* %12, i16* %13, i32 %7)
ret void
}