#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 I420toRGB(unsigned char *, int, int, int, int, int, int, int,
              unsigned char *, int, int, int, int, int, int, int, int);
int I420toRGB565(unsigned char *dest_ptr, int dest_width, int dest_height,
                 int dest_pitch, int dest_x, int dest_y, int dest_dx,
                 int dest_dy, unsigned char *src_ptr, int src_width,
                 int src_height, int src_pitch, int src_x, int src_y,
                 int src_dx, int src_dy) {
  return I420toRGB(dest_ptr, dest_width, dest_height, dest_pitch, dest_x,
                   dest_y, dest_dx, dest_dy, src_ptr, src_width, src_height,
                   src_pitch, src_x, src_y, src_dx, src_dy, 2);
}


x86 assembly (clang, -O0):
<I420toRGB565>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    %edx,-0x38(%rbp)
mov    %ecx,-0x3c(%rbp)
mov    %r8d,-0x40(%rbp)
mov    %r9d,-0x44(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x40(%rbp),%r8d
mov    -0x44(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x18(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    0x20(%rbp),%r13
mov    0x28(%rbp),%r12d
mov    0x30(%rbp),%r15d
mov    0x38(%rbp),%r14d
mov    0x40(%rbp),%ebx
mov    0x48(%rbp),%r11d
mov    0x50(%rbp),%r10d
mov    0x58(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,(%rsp)
mov    -0x4c(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0x48(%rbp),%eax
mov    %r13,0x10(%rsp)
mov    %r12d,0x18(%rsp)
mov    %r15d,0x20(%rsp)
mov    %r14d,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11d,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
movl   $0x2,0x50(%rsp)
call   1030 <I420toRGB@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<I420toRGB565>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x40(%rsp),%r10d
mov    0x48(%rsp),%r11d
mov    0x58(%rsp),%r14d
mov    0x60(%rsp),%r15d
mov    0x68(%rsp),%r12d
mov    0x70(%rsp),%r13d
mov    0x78(%rsp),%eax
mov    0x80(%rsp),%ebx
mov    0x88(%rsp),%ebp
sub    $0x8,%rsp
push   $0x2
push   %rbp
push   %rbx
push   %rax
push   %r13
push   %r12
push   %r15
push   %r14
push   0x98(%rsp)
push   %r11
push   %r10
call   1030 <I420toRGB@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @I420toRGB565(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15) {
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i8*
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
store i8* %0, i8** %17
store i32 %1, i32* %18
store i32 %2, i32* %19
store i32 %3, i32* %20
store i32 %4, i32* %21
store i32 %5, i32* %22
store i32 %6, i32* %23
store i32 %7, i32* %24
store i8* %8, i8** %25
store i32 %9, i32* %26
store i32 %10, i32* %27
store i32 %11, i32* %28
store i32 %12, i32* %29
store i32 %13, i32* %30
store i32 %14, i32* %31
store i32 %15, i32* %32
%33 = load i8*, i8** %17
%34 = load i32, i32* %18
%35 = load i32, i32* %19
%36 = load i32, i32* %20
%37 = load i32, i32* %21
%38 = load i32, i32* %22
%39 = load i32, i32* %23
%40 = load i32, i32* %24
%41 = load i8*, i8** %25
%42 = load i32, i32* %26
%43 = load i32, i32* %27
%44 = load i32, i32* %28
%45 = load i32, i32* %29
%46 = load i32, i32* %30
%47 = load i32, i32* %31
%48 = load i32, i32* %32
%49 = call i32 @I420toRGB(i8* %33, i32 %34, i32 %35, i32 %36, i32 %37, i32 %38, i32 %39, i32 %40, i8* %41, i32 %42, i32 %43, i32 %44, i32 %45, i32 %46, i32 %47, i32 %48, i32 2)
ret i32 %49
}

LLVM IR (-O2):
define i32 @I420toRGB565(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15) {
%17 = tail call i32 @I420toRGB(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 2)
ret i32 %17
}