#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 uint16_t;

/* Variables and functions */
void transfer_YUV161616_to_YUV444P(unsigned char *output_y,
                                   unsigned char *output_u,
                                   unsigned char *output_v, uint16_t *input,
                                   int output_column) {
  output_y[output_column] = input[0] >> 8;
  output_u[output_column] = input[1] >> 8;
  output_v[output_column] = input[2] >> 8;
}


x86 assembly (clang, -O0):
<transfer_YUV161616_to_YUV444P>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
sar    $0x8,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
sar    $0x8,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%eax
sar    $0x8,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_YUV161616_to_YUV444P>:
mov    0x1(%rcx),%r9b
movslq %r8d,%r8
mov    %r9b,(%rdi,%r8,1)
mov    0x5(%rcx),%al
mov    %al,(%rsi,%r8,1)
mov    0x9(%rcx),%al
mov    %al,(%rdx,%r8,1)
ret

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

LLVM IR (-O2):
define void @transfer_YUV161616_to_YUV444P(i8* nocapture writeonly %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2, i32* nocapture %3, i32 %4) {
%6 = load i32, i32* %3
%7 = lshr i32 %6, 8
%8 = trunc i32 %7 to i8
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 %8, i8* %10
%11 = getelementptr inbounds i32, i32* %3, i64 1
%12 = load i32, i32* %11
%13 = lshr i32 %12, 8
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %1, i64 %9
store i8 %14, i8* %15
%16 = getelementptr inbounds i32, i32* %3, i64 2
%17 = load i32, i32* %16
%18 = lshr i32 %17, 8
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds i8, i8* %2, i64 %9
store i8 %19, i8* %20
ret void
}