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

/* Variables and functions */
int /*<<< orphan*/ _mm_and_ps(int /*<<< orphan*/ const,
                              int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_andnot_ps(int /*<<< orphan*/ const,
                                 int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_cmpgt_ps(int /*<<< orphan*/ const,
                                int /*<<< orphan*/ const);
int /*<<< orphan*/ const _mm_mul_ps(int /*<<< orphan*/ const,
                                    int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_or_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_set1_ps(float);
int /*<<< orphan*/ _mm_sub_ps(int /*<<< orphan*/ const,
                              int /*<<< orphan*/ const);
__m128 lab_f_inv_m(const __m128 x) {
  const __m128 epsilon = _mm_set1_ps(0.20689655172413796f);
  const __m128 kappa_rcp_x16 = _mm_set1_ps(16.0f * 27.0f / 24389.0f);
  const __m128 kappa_rcp_x116 = _mm_set1_ps(116.0f * 27.0f / 24389.0f);
  const __m128 res_big = _mm_mul_ps(_mm_mul_ps(x, x), x);
  const __m128 res_small =
      _mm_sub_ps(_mm_mul_ps(kappa_rcp_x116, x), kappa_rcp_x16);
  const __m128 mask = _mm_cmpgt_ps(x, epsilon);
  return _mm_or_ps(_mm_and_ps(mask, res_big), _mm_andnot_ps(mask, res_small));
}


x86 assembly (clang, -O0):
<lab_f_inv_m>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  0xe85(%rip),%xmm0
call   1060 <_mm_set1_ps@plt>
mov    %eax,-0x8(%rbp)
movss  0xe71(%rip),%xmm0
call   1060 <_mm_set1_ps@plt>
mov    %eax,-0xc(%rbp)
movss  0xe5d(%rip),%xmm0
call   1060 <_mm_set1_ps@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <_mm_mul_ps@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <_mm_mul_ps@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <_mm_mul_ps@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%esi
call   1050 <_mm_sub_ps@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <_mm_cmpgt_ps@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1090 <_mm_and_ps@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1080 <_mm_andnot_ps@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1070 <_mm_or_ps@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lab_f_inv_m>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebx
movss  0xe7e(%rip),%xmm0
call   1060 <_mm_set1_ps@plt>
mov    %eax,%r14d
movss  0xe72(%rip),%xmm0
call   1060 <_mm_set1_ps@plt>
mov    %eax,%r15d
movss  0xe66(%rip),%xmm0
call   1060 <_mm_set1_ps@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %ebx,%esi
call   1040 <_mm_mul_ps@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <_mm_mul_ps@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <_mm_mul_ps@plt>
mov    %eax,%edi
mov    %r15d,%esi
call   1050 <_mm_sub_ps@plt>
mov    %eax,%r15d
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <_mm_cmpgt_ps@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r12d,%esi
call   1090 <_mm_and_ps@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %r15d,%esi
call   1080 <_mm_andnot_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <_mm_or_ps@plt>

LLVM IR (-O0):
define i32 @lab_f_inv_m(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %2
%9 = call i32 @_mm_set1_ps(float 0x3FCA7B9620000000)
store i32 %9, i32* %3
%10 = call i32 @_mm_set1_ps(float 0x3F922354E0000000)
store i32 %10, i32* %4
%11 = call i32 @_mm_set1_ps(float 0x3FC07004E0000000)
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = call i32 @_mm_mul_ps(i32 %12, i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @_mm_mul_ps(i32 %14, i32 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %5
%18 = load i32, i32* %2
%19 = call i32 @_mm_mul_ps(i32 %17, i32 %18)
%20 = load i32, i32* %4
%21 = call i32 @_mm_sub_ps(i32 %19, i32 %20)
store i32 %21, i32* %7
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = call i32 @_mm_cmpgt_ps(i32 %22, i32 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = load i32, i32* %6
%27 = call i32 @_mm_and_ps(i32 %25, i32 %26)
%28 = load i32, i32* %8
%29 = load i32, i32* %7
%30 = call i32 @_mm_andnot_ps(i32 %28, i32 %29)
%31 = call i32 @_mm_or_ps(i32 %27, i32 %30)
ret i32 %31
}

LLVM IR (-O2):
define i32 @lab_f_inv_m(i32 %0) {
%2 = tail call i32 @_mm_set1_ps(float 0x3FCA7B9620000000)
%3 = tail call i32 @_mm_set1_ps(float 0x3F922354E0000000)
%4 = tail call i32 @_mm_set1_ps(float 0x3FC07004E0000000)
%5 = tail call i32 @_mm_mul_ps(i32 %0, i32 %0)
%6 = tail call i32 @_mm_mul_ps(i32 %5, i32 %0)
%7 = tail call i32 @_mm_mul_ps(i32 %4, i32 %0)
%8 = tail call i32 @_mm_sub_ps(i32 %7, i32 %3)
%9 = tail call i32 @_mm_cmpgt_ps(i32 %0, i32 %2)
%10 = tail call i32 @_mm_and_ps(i32 %9, i32 %6)
%11 = tail call i32 @_mm_andnot_ps(i32 %9, i32 %8)
%12 = tail call i32 @_mm_or_ps(i32 %10, i32 %11)
ret i32 %12
}