#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*/ const,
                                    int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm256_madd_epi16(int /*<<< orphan*/ const,
                                     int /*<<< orphan*/ const);
__m256i mm256_madd_add_epi32(const __m256i *const src_0,
                             const __m256i *const src_1,
                             const __m256i *const ker_0,
                             const __m256i *const ker_1) {
  const __m256i tmp_0 = _mm256_madd_epi16(*src_0, *ker_0);
  const __m256i tmp_1 = _mm256_madd_epi16(*src_1, *ker_1);
  return _mm256_add_epi32(tmp_0, tmp_1);
}


x86 assembly (clang, -O0):
<mm256_madd_add_epi32>:
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    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <_mm256_madd_epi16@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1030 <_mm256_madd_epi16@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1040 <_mm256_add_epi32@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm256_madd_add_epi32>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%rbx
mov    (%rdi),%edi
mov    (%rdx),%esi
call   1030 <_mm256_madd_epi16@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
mov    (%r14),%esi
call   1030 <_mm256_madd_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <_mm256_add_epi32@plt>

LLVM IR (-O0):
define i32 @mm256_madd_add_epi32(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
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = call i32 @_mm256_madd_epi16(i32 %12, i32 %14)
store i32 %15, i32* %9
%16 = load i32*, i32** %6
%17 = load i32, i32* %16
%18 = load i32*, i32** %8
%19 = load i32, i32* %18
%20 = call i32 @_mm256_madd_epi16(i32 %17, i32 %19)
store i32 %20, i32* %10
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = call i32 @_mm256_add_epi32(i32 %21, i32 %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @mm256_madd_add_epi32(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = load i32, i32* %0
%6 = load i32, i32* %2
%7 = tail call i32 @_mm256_madd_epi16(i32 %5, i32 %6)
%8 = load i32, i32* %1
%9 = load i32, i32* %3
%10 = tail call i32 @_mm256_madd_epi16(i32 %8, i32 %9)
%11 = tail call i32 @_mm256_add_epi32(i32 %7, i32 %10)
ret i32 %11
}