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

/* Variables and functions */
int /*<<< orphan*/ _mm256_cvtpd_ps(int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_cvtps_pd(int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_mul_pd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_set1_pd(double);
int /*<<< orphan*/ _mm256_sub_pd(int /*<<< orphan*/ const, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_rcp_ps(int /*<<< orphan*/);
__m256d gmx_mm256_inv_pd(__m256d x) {
  const __m256d two = _mm256_set1_pd(2.0);
  __m256d lu = _mm256_cvtps_pd(_mm_rcp_ps(_mm256_cvtpd_ps(x)));
  lu = _mm256_mul_pd(lu, _mm256_sub_pd(two, _mm256_mul_pd(x, lu)));
  return _mm256_mul_pd(lu, _mm256_sub_pd(two, _mm256_mul_pd(x, lu)));
}


x86 assembly (clang, -O0):
<gmx_mm256_inv_pd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  0xe8d(%rip),%xmm0
call   1080 <_mm256_set1_pd@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <_mm256_cvtpd_ps@plt>
mov    %eax,%edi
call   1050 <_mm_rcp_ps@plt>
mov    %eax,%edi
call   1060 <_mm256_cvtps_pd@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm256_mul_pd@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm256_sub_pd@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1030 <_mm256_mul_pd@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm256_mul_pd@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm256_sub_pd@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1030 <_mm256_mul_pd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmx_mm256_inv_pd>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
movsd  0xe92(%rip),%xmm0
call   1080 <_mm256_set1_pd@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1070 <_mm256_cvtpd_ps@plt>
mov    %eax,%edi
call   1050 <_mm_rcp_ps@plt>
mov    %eax,%edi
call   1060 <_mm256_cvtps_pd@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <_mm256_mul_pd@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1040 <_mm256_sub_pd@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <_mm256_mul_pd@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <_mm256_mul_pd@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1040 <_mm256_sub_pd@plt>
mov    %ebp,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <_mm256_mul_pd@plt>

LLVM IR (-O0):
define i32 @gmx_mm256_inv_pd(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @_mm256_set1_pd(double 2.000000e+00)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @_mm256_cvtpd_ps(i32 %6)
%8 = call i32 @_mm_rcp_ps(i32 %7)
%9 = call i32 @_mm256_cvtps_pd(i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = call i32 @_mm256_mul_pd(i32 %12, i32 %13)
%15 = call i32 @_mm256_sub_pd(i32 %11, i32 %14)
%16 = call i32 @_mm256_mul_pd(i32 %10, i32 %15)
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = call i32 @_mm256_mul_pd(i32 %19, i32 %20)
%22 = call i32 @_mm256_sub_pd(i32 %18, i32 %21)
%23 = call i32 @_mm256_mul_pd(i32 %17, i32 %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @gmx_mm256_inv_pd(i32 %0) {
%2 = tail call i32 @_mm256_set1_pd(double 2.000000e+00)
%3 = tail call i32 @_mm256_cvtpd_ps(i32 %0)
%4 = tail call i32 @_mm_rcp_ps(i32 %3)
%5 = tail call i32 @_mm256_cvtps_pd(i32 %4)
%6 = tail call i32 @_mm256_mul_pd(i32 %0, i32 %5)
%7 = tail call i32 @_mm256_sub_pd(i32 %2, i32 %6)
%8 = tail call i32 @_mm256_mul_pd(i32 %5, i32 %7)
%9 = tail call i32 @_mm256_mul_pd(i32 %0, i32 %8)
%10 = tail call i32 @_mm256_sub_pd(i32 %2, i32 %9)
%11 = tail call i32 @_mm256_mul_pd(i32 %8, i32 %10)
ret i32 %11
}