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


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
sar    $0x3,%edx
call   1030 <pixel_unpack_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    $0x5,%edx
call   1040 <pixel_unpack_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    $0x5,%edx
call   1040 <pixel_unpack_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,%r15
sar    $0x3,%edx
call   1030 <pixel_unpack_u8s16_y@plt>
movslq %ebp,%rbx
lea    (%r15,%rbx,1),%rdi
mov    %ebx,%eax
sar    $0x2,%eax
add    %ebx,%eax
movslq %eax,%r12
lea    (%r14,%r12,2),%rsi
mov    %ebx,%ebp
sar    $0x5,%ebp
mov    %ebp,%edx
call   1040 <pixel_unpack_u8s16_uv@plt>
add    %r12,%r15
lea    (%r14,%rbx,2),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <pixel_unpack_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 = ashr i32 %9, 3
%11 = call i32 @pixel_unpack_u8s16_y(i8* %7, i16* %8, i32 %10)
%12 = load i8*, i8** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i16*, i16** %5
%17 = load i32, i32* %6
%18 = load i32, i32* %6
%19 = ashr i32 %18, 2
%20 = add nsw i32 %17, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i16, i16* %16, i64 %21
%23 = load i32, i32* %6
%24 = ashr i32 %23, 5
%25 = call i32 @pixel_unpack_u8s16_uv(i8* %15, i16* %22, i32 %24)
%26 = load i8*, i8** %4
%27 = load i32, i32* %6
%28 = load i32, i32* %6
%29 = ashr i32 %28, 2
%30 = add nsw i32 %27, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %26, i64 %31
%33 = load i16*, i16** %5
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i16, i16* %33, i64 %35
%37 = load i32, i32* %6
%38 = ashr i32 %37, 5
%39 = call i32 @pixel_unpack_u8s16_uv(i8* %32, i16* %36, i32 %38)
ret void
}

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