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

/* Variables and functions */
int /*<<< orphan*/ _mm256_hadd_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_mul_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_permute2f128_ps(int /*<<< orphan*/,
                                          int /*<<< orphan*/, int);
__m256 _mm256_magnitudesquared_ps(__m256 cplxValue1, __m256 cplxValue2) {
  __m256 complex1, complex2;
  cplxValue1 = _mm256_mul_ps(cplxValue1, cplxValue1);
  cplxValue2 = _mm256_mul_ps(cplxValue2, cplxValue2);
  complex1 = _mm256_permute2f128_ps(cplxValue1, cplxValue2, 0x20);
  complex2 = _mm256_permute2f128_ps(cplxValue1, cplxValue2, 0x31);
  return _mm256_hadd_ps(complex1, complex2);
}


x86 assembly (clang, -O0):
<_mm256_magnitudesquared_ps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <_mm256_mul_ps@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <_mm256_mul_ps@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x20,%edx
call   1040 <_mm256_permute2f128_ps@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x31,%edx
call   1040 <_mm256_permute2f128_ps@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <_mm256_hadd_ps@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm256_magnitudesquared_ps>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%esi
call   1050 <_mm256_mul_ps@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %ebx,%esi
call   1050 <_mm256_mul_ps@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
mov    $0x20,%edx
call   1040 <_mm256_permute2f128_ps@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x31,%edx
call   1040 <_mm256_permute2f128_ps@plt>
mov    %r14d,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <_mm256_hadd_ps@plt>

LLVM IR (-O0):
define i32 @_mm256_magnitudesquared_ps(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @_mm256_mul_ps(i32 %7, i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @_mm256_mul_ps(i32 %10, i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @_mm256_permute2f128_ps(i32 %13, i32 %14, i32 32)
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @_mm256_permute2f128_ps(i32 %16, i32 %17, i32 49)
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = call i32 @_mm256_hadd_ps(i32 %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @_mm256_magnitudesquared_ps(i32 %0, i32 %1) {
%3 = tail call i32 @_mm256_mul_ps(i32 %0, i32 %0)
%4 = tail call i32 @_mm256_mul_ps(i32 %1, i32 %1)
%5 = tail call i32 @_mm256_permute2f128_ps(i32 %3, i32 %4, i32 32)
%6 = tail call i32 @_mm256_permute2f128_ps(i32 %3, i32 %4, i32 49)
%7 = tail call i32 @_mm256_hadd_ps(i32 %5, i32 %6)
ret i32 %7
}