#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 /*<<< orphan*/ __m256i;

/* Variables and functions */
int /*<<< orphan*/ _mm256_add_epi32(int /*<<< orphan*/,
                                    int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm256_madd_epi16(int /*<<< orphan*/ const,
                                     int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm256_set1_epi32(int);
int /*<<< orphan*/ _mm256_srai_epi32(int /*<<< orphan*/, int);
void filter_16_2t_pixels(const __m256i *sig, const __m256i *f, __m256i *y0,
                         __m256i *y1) {
  const __m256i rounding = _mm256_set1_epi32(1 << ((7) - 1));
  __m256i x0 = _mm256_madd_epi16(sig[0], *f);
  __m256i x1 = _mm256_madd_epi16(sig[1], *f);
  x0 = _mm256_add_epi32(x0, rounding);
  x1 = _mm256_add_epi32(x1, rounding);
  *y0 = _mm256_srai_epi32(x0, (7));
  *y1 = _mm256_srai_epi32(x1, (7));
}


x86 assembly (clang, -O0):
<filter_16_2t_pixels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x40,%edi
call   1030 <_mm256_set1_epi32@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm256_madd_epi16@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm256_madd_epi16@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1060 <_mm256_add_epi32@plt>
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1060 <_mm256_add_epi32@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
mov    $0x7,%esi
call   1040 <_mm256_srai_epi32@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%edi
mov    $0x7,%esi
call   1040 <_mm256_srai_epi32@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_16_2t_pixels>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    $0x40,%edi
call   1030 <_mm256_set1_epi32@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
mov    (%r12),%esi
call   1050 <_mm256_madd_epi16@plt>
mov    %eax,%r13d
mov    0x4(%rbx),%edi
mov    (%r12),%esi
call   1050 <_mm256_madd_epi16@plt>
mov    %eax,%ebx
mov    %r13d,%edi
mov    %ebp,%esi
call   1060 <_mm256_add_epi32@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    %ebp,%esi
call   1060 <_mm256_add_epi32@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    $0x7,%esi
call   1040 <_mm256_srai_epi32@plt>
mov    %eax,(%r15)
mov    %ebx,%edi
mov    $0x7,%esi
call   1040 <_mm256_srai_epi32@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @filter_16_2t_pixels(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%12 = call i32 @_mm256_set1_epi32(i32 64)
store i32 %12, i32* %9
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = load i32*, i32** %6
%17 = load i32, i32* %16
%18 = call i32 @_mm256_madd_epi16(i32 %15, i32 %17)
store i32 %18, i32* %10
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* %20
%22 = load i32*, i32** %6
%23 = load i32, i32* %22
%24 = call i32 @_mm256_madd_epi16(i32 %21, i32 %23)
store i32 %24, i32* %11
%25 = load i32, i32* %10
%26 = load i32, i32* %9
%27 = call i32 @_mm256_add_epi32(i32 %25, i32 %26)
store i32 %27, i32* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %9
%30 = call i32 @_mm256_add_epi32(i32 %28, i32 %29)
store i32 %30, i32* %11
%31 = load i32, i32* %10
%32 = call i32 @_mm256_srai_epi32(i32 %31, i32 7)
%33 = load i32*, i32** %7
store i32 %32, i32* %33
%34 = load i32, i32* %11
%35 = call i32 @_mm256_srai_epi32(i32 %34, i32 7)
%36 = load i32*, i32** %8
store i32 %35, i32* %36
ret void
}

LLVM IR (-O2):
define void @filter_16_2t_pixels(i32* nocapture %0, i32* nocapture %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @_mm256_set1_epi32(i32 64)
%6 = load i32, i32* %0
%7 = load i32, i32* %1
%8 = tail call i32 @_mm256_madd_epi16(i32 %6, i32 %7)
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = load i32, i32* %1
%12 = tail call i32 @_mm256_madd_epi16(i32 %10, i32 %11)
%13 = tail call i32 @_mm256_add_epi32(i32 %8, i32 %5)
%14 = tail call i32 @_mm256_add_epi32(i32 %12, i32 %5)
%15 = tail call i32 @_mm256_srai_epi32(i32 %13, i32 7)
store i32 %15, i32* %2
%16 = tail call i32 @_mm256_srai_epi32(i32 %14, i32 7)
store i32 %16, i32* %3
ret void
}