#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 */
typedef struct TYPE_15__ TYPE_1__;

/* Type definitions */
struct TYPE_15__ {
  int member_0;
  int member_1;
};
typedef TYPE_1__ __m128i;

/* Variables and functions */
TYPE_1__ _mm_avg_epu16(TYPE_1__, TYPE_1__);
TYPE_1__ _mm_or_si128(TYPE_1__, TYPE_1__);
TYPE_1__ _mm_slli_si128(TYPE_1__, int);
TYPE_1__ _mm_srli_si128(TYPE_1__, int);
extern void reconstruct_missing_uv_sse2(__m128i *current_uv, __m128i *next_uv,
                                        __m128i *out) {
  __m128i avgB = {0x0LL, 0x0LL};
  __m128i tmp = {0x0LL, 0x0LL};
  (avgB) = _mm_srli_si128(*current_uv, 4);
  (tmp) = _mm_slli_si128(*next_uv, 12);
  (avgB) = _mm_or_si128((tmp), (avgB));
  *out = _mm_avg_epu16(*current_uv, (avgB));
}


x86 assembly (clang, -O0):
<reconstruct_missing_uv_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
call   1040 <_mm_srli_si128@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0xc,%esi
call   1070 <_mm_slli_si128@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <_mm_or_si128@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <_mm_avg_epu16@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
mov    %rcx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reconstruct_missing_uv_sse2>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    $0x4,%esi
call   1030 <_mm_srli_si128@plt>
mov    %rax,%r12
mov    (%r15),%rdi
mov    $0xc,%esi
call   1060 <_mm_slli_si128@plt>
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <_mm_or_si128@plt>
mov    (%rbx),%rdi
mov    %rax,%rsi
call   1050 <_mm_avg_epu16@plt>
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_15__ = type { i32, i32 }
define void @reconstruct_missing_uv_sse2(%struct.TYPE_15__* %0, %struct.TYPE_15__* %1, %struct.TYPE_15__* %2) {
%4 = alloca %struct.TYPE_15__*
%5 = alloca %struct.TYPE_15__*
%6 = alloca %struct.TYPE_15__*
%7 = alloca %struct.TYPE_15__
%8 = alloca %struct.TYPE_15__
%9 = alloca %struct.TYPE_15__
%10 = alloca %struct.TYPE_15__
%11 = alloca %struct.TYPE_15__
%12 = alloca %struct.TYPE_15__
store %struct.TYPE_15__* %0, %struct.TYPE_15__** %4
store %struct.TYPE_15__* %1, %struct.TYPE_15__** %5
store %struct.TYPE_15__* %2, %struct.TYPE_15__** %6
%13 = bitcast %struct.TYPE_15__* %7 to i8*
%14 = bitcast %struct.TYPE_15__* %8 to i8*
%15 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%16 = bitcast %struct.TYPE_15__* %15 to i64*
%17 = load i64, i64* %16
%18 = call i64 @_mm_srli_si128(i64 %17, i32 4)
%19 = bitcast %struct.TYPE_15__* %9 to i64*
store i64 %18, i64* %19
%20 = bitcast %struct.TYPE_15__* %7 to i8*
%21 = bitcast %struct.TYPE_15__* %9 to i8*
%22 = load %struct.TYPE_15__*, %struct.TYPE_15__** %5
%23 = bitcast %struct.TYPE_15__* %22 to i64*
%24 = load i64, i64* %23
%25 = call i64 @_mm_slli_si128(i64 %24, i32 12)
%26 = bitcast %struct.TYPE_15__* %10 to i64*
store i64 %25, i64* %26
%27 = bitcast %struct.TYPE_15__* %8 to i8*
%28 = bitcast %struct.TYPE_15__* %10 to i8*
%29 = bitcast %struct.TYPE_15__* %8 to i64*
%30 = load i64, i64* %29
%31 = bitcast %struct.TYPE_15__* %7 to i64*
%32 = load i64, i64* %31
%33 = call i64 @_mm_or_si128(i64 %30, i64 %32)
%34 = bitcast %struct.TYPE_15__* %11 to i64*
store i64 %33, i64* %34
%35 = bitcast %struct.TYPE_15__* %7 to i8*
%36 = bitcast %struct.TYPE_15__* %11 to i8*
%37 = load %struct.TYPE_15__*, %struct.TYPE_15__** %6
%38 = load %struct.TYPE_15__*, %struct.TYPE_15__** %4
%39 = bitcast %struct.TYPE_15__* %38 to i64*
%40 = load i64, i64* %39
%41 = bitcast %struct.TYPE_15__* %7 to i64*
%42 = load i64, i64* %41
%43 = call i64 @_mm_avg_epu16(i64 %40, i64 %42)
%44 = bitcast %struct.TYPE_15__* %12 to i64*
store i64 %43, i64* %44
%45 = bitcast %struct.TYPE_15__* %37 to i8*
%46 = bitcast %struct.TYPE_15__* %12 to i8*
ret void
}

LLVM IR (-O2):
%struct.TYPE_15__ = type { i32, i32 }
define void @reconstruct_missing_uv_sse2(%struct.TYPE_15__* nocapture %0, %struct.TYPE_15__* nocapture %1, %struct.TYPE_15__* nocapture writeonly %2) {
%4 = bitcast %struct.TYPE_15__* %0 to i64*
%5 = load i64, i64* %4
%6 = tail call i64 @_mm_srli_si128(i64 %5, i32 4)
%7 = bitcast %struct.TYPE_15__* %1 to i64*
%8 = load i64, i64* %7
%9 = tail call i64 @_mm_slli_si128(i64 %8, i32 12)
%10 = tail call i64 @_mm_or_si128(i64 %9, i64 %6)
%11 = load i64, i64* %4
%12 = tail call i64 @_mm_avg_epu16(i64 %11, i64 %10)
%13 = bitcast %struct.TYPE_15__* %2 to i64*
store i64 %12, i64* %13
ret void
}