#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_VYU888(unsigned char *(*output), uint16_t *input) {
  (*output)[0] = input[2] >> 8;
  (*output)[1] = input[0] >> 8;
  (*output)[2] = input[1] >> 8;
  (*output) += 3;
}


x86 assembly (clang, -O0):
<transfer_YUV161616_to_VYU888>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x3,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_YUV161616_to_VYU888>:
mov    0x9(%rsi),%al
mov    (%rdi),%rcx
mov    %al,(%rcx)
mov    0x1(%rsi),%al
mov    (%rdi),%rcx
mov    %al,0x1(%rcx)
mov    0x5(%rsi),%al
mov    (%rdi),%rcx
mov    %al,0x2(%rcx)
addq   $0x3,(%rdi)
ret

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

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