#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_add_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ const _mm_add_ps(int /*<<< orphan*/ const,
                                    int /*<<< orphan*/ const);
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_castps_si128(int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_castsi128_ps(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_cmpgt_ps(int /*<<< orphan*/ const,
                                int /*<<< orphan*/ const);
int /*<<< orphan*/ const _mm_cvtepi32_ps(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_cvtps_epi32(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_div_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_epi32(int);
int /*<<< orphan*/ const _mm_set1_ps(float);
__m128 lab_f_m_sse2(const __m128 x) {
  const __m128 epsilon = _mm_set1_ps(216.0f / 24389.0f);
  const __m128 kappa = _mm_set1_ps(24389.0f / 27.0f);
  const __m128 a = _mm_castsi128_ps(_mm_add_epi32(
      _mm_cvtps_epi32(
          _mm_div_ps(_mm_cvtepi32_ps(_mm_castps_si128(x)), _mm_set1_ps(3.0f))),
      _mm_set1_epi32(709921077)));
  const __m128 a3 = _mm_mul_ps(_mm_mul_ps(a, a), a);
  const __m128 res_big =
      _mm_div_ps(_mm_mul_ps(a, _mm_add_ps(a3, _mm_add_ps(x, x))),
                 _mm_add_ps(_mm_add_ps(a3, a3), x));
  const __m128 res_small =
      _mm_div_ps(_mm_add_ps(_mm_mul_ps(kappa, x), _mm_set1_ps(16.0f)),
                 _mm_set1_ps(116.0f));
  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_m_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movss  0xe1d(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %eax,-0x8(%rbp)
movss  0xe09(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_mm_castps_si128@plt>
mov    %eax,%edi
call   1030 <_mm_cvtepi32_ps@plt>
mov    %eax,-0x40(%rbp)
movss  0xde3(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    -0x40(%rbp),%edi
mov    %eax,%esi
call   1080 <_mm_div_ps@plt>
mov    %eax,%edi
call   10e0 <_mm_cvtps_epi32@plt>
mov    %eax,-0x3c(%rbp)
mov    $0x2a508935,%edi
call   10a0 <_mm_set1_epi32@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_add_epi32@plt>
mov    %eax,%edi
call   1050 <_mm_castsi128_ps@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   10c0 <_mm_add_ps@plt>
mov    -0x38(%rbp),%edi
mov    %eax,%esi
call   10c0 <_mm_add_ps@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10c0 <_mm_add_ps@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   10c0 <_mm_add_ps@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%esi
call   1080 <_mm_div_ps@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,-0x2c(%rbp)
movss  0xd2a(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%esi
call   10c0 <_mm_add_ps@plt>
mov    %eax,-0x28(%rbp)
movss  0xd0c(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%esi
call   1080 <_mm_div_ps@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <_mm_cmpgt_ps@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1100 <_mm_and_ps@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10f0 <_mm_andnot_ps@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   10d0 <_mm_or_ps@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lab_f_m_sse2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r12d
movss  0xe0a(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %eax,%r14d
movss  0xdfe(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %eax,%r15d
mov    %r12d,%edi
call   1040 <_mm_castps_si128@plt>
mov    %eax,%edi
call   1030 <_mm_cvtepi32_ps@plt>
mov    %eax,%ebp
movss  0xde1(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <_mm_div_ps@plt>
mov    %eax,%edi
call   10e0 <_mm_cvtps_epi32@plt>
mov    %eax,%ebp
mov    $0x2a508935,%edi
call   10a0 <_mm_set1_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <_mm_add_epi32@plt>
mov    %eax,%edi
call   1050 <_mm_castsi128_ps@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %eax,%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,%edi
mov    %ebp,%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %r12d,%esi
call   10c0 <_mm_add_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   10c0 <_mm_add_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %ebx,%esi
call   10c0 <_mm_add_ps@plt>
mov    %eax,%edi
mov    %r12d,%esi
call   10c0 <_mm_add_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <_mm_div_ps@plt>
mov    %eax,%r13d
mov    %r15d,%edi
mov    %r12d,%esi
call   1090 <_mm_mul_ps@plt>
mov    %eax,%ebx
movss  0xd4b(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   10c0 <_mm_add_ps@plt>
mov    %eax,%ebx
movss  0xd37(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1080 <_mm_div_ps@plt>
mov    %eax,%r15d
mov    %r12d,%edi
mov    %r14d,%esi
call   1070 <_mm_cmpgt_ps@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r13d,%esi
call   1100 <_mm_and_ps@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %r15d,%esi
call   10f0 <_mm_andnot_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10d0 <_mm_or_ps@plt>

LLVM IR (-O0):
define i32 @lab_f_m_sse2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
%10 = call i32 @_mm_set1_ps(float 0x3F822354E0000000)
store i32 %10, i32* %3
%11 = call i32 @_mm_set1_ps(float 0x408C3A5EE0000000)
store i32 %11, i32* %4
%12 = load i32, i32* %2
%13 = call i32 @_mm_castps_si128(i32 %12)
%14 = call i32 @_mm_cvtepi32_ps(i32 %13)
%15 = call i32 @_mm_set1_ps(float 3.000000e+00)
%16 = call i32 @_mm_div_ps(i32 %14, i32 %15)
%17 = call i32 @_mm_cvtps_epi32(i32 %16)
%18 = call i32 @_mm_set1_epi32(i32 709921077)
%19 = call i32 @_mm_add_epi32(i32 %17, i32 %18)
%20 = call i32 @_mm_castsi128_ps(i32 %19)
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = load i32, i32* %5
%23 = call i32 @_mm_mul_ps(i32 %21, i32 %22)
%24 = load i32, i32* %5
%25 = call i32 @_mm_mul_ps(i32 %23, i32 %24)
store i32 %25, i32* %6
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = load i32, i32* %2
%29 = load i32, i32* %2
%30 = call i32 @_mm_add_ps(i32 %28, i32 %29)
%31 = call i32 @_mm_add_ps(i32 %27, i32 %30)
%32 = call i32 @_mm_mul_ps(i32 %26, i32 %31)
%33 = load i32, i32* %6
%34 = load i32, i32* %6
%35 = call i32 @_mm_add_ps(i32 %33, i32 %34)
%36 = load i32, i32* %2
%37 = call i32 @_mm_add_ps(i32 %35, i32 %36)
%38 = call i32 @_mm_div_ps(i32 %32, i32 %37)
store i32 %38, i32* %7
%39 = load i32, i32* %4
%40 = load i32, i32* %2
%41 = call i32 @_mm_mul_ps(i32 %39, i32 %40)
%42 = call i32 @_mm_set1_ps(float 1.600000e+01)
%43 = call i32 @_mm_add_ps(i32 %41, i32 %42)
%44 = call i32 @_mm_set1_ps(float 1.160000e+02)
%45 = call i32 @_mm_div_ps(i32 %43, i32 %44)
store i32 %45, i32* %8
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = call i32 @_mm_cmpgt_ps(i32 %46, i32 %47)
store i32 %48, i32* %9
%49 = load i32, i32* %9
%50 = load i32, i32* %7
%51 = call i32 @_mm_and_ps(i32 %49, i32 %50)
%52 = load i32, i32* %9
%53 = load i32, i32* %8
%54 = call i32 @_mm_andnot_ps(i32 %52, i32 %53)
%55 = call i32 @_mm_or_ps(i32 %51, i32 %54)
ret i32 %55
}

LLVM IR (-O2):
define i32 @lab_f_m_sse2(i32 %0) {
%2 = tail call i32 @_mm_set1_ps(float 0x3F822354E0000000)
%3 = tail call i32 @_mm_set1_ps(float 0x408C3A5EE0000000)
%4 = tail call i32 @_mm_castps_si128(i32 %0)
%5 = tail call i32 @_mm_cvtepi32_ps(i32 %4)
%6 = tail call i32 @_mm_set1_ps(float 3.000000e+00)
%7 = tail call i32 @_mm_div_ps(i32 %5, i32 %6)
%8 = tail call i32 @_mm_cvtps_epi32(i32 %7)
%9 = tail call i32 @_mm_set1_epi32(i32 709921077)
%10 = tail call i32 @_mm_add_epi32(i32 %8, i32 %9)
%11 = tail call i32 @_mm_castsi128_ps(i32 %10)
%12 = tail call i32 @_mm_mul_ps(i32 %11, i32 %11)
%13 = tail call i32 @_mm_mul_ps(i32 %12, i32 %11)
%14 = tail call i32 @_mm_add_ps(i32 %0, i32 %0)
%15 = tail call i32 @_mm_add_ps(i32 %13, i32 %14)
%16 = tail call i32 @_mm_mul_ps(i32 %11, i32 %15)
%17 = tail call i32 @_mm_add_ps(i32 %13, i32 %13)
%18 = tail call i32 @_mm_add_ps(i32 %17, i32 %0)
%19 = tail call i32 @_mm_div_ps(i32 %16, i32 %18)
%20 = tail call i32 @_mm_mul_ps(i32 %3, i32 %0)
%21 = tail call i32 @_mm_set1_ps(float 1.600000e+01)
%22 = tail call i32 @_mm_add_ps(i32 %20, i32 %21)
%23 = tail call i32 @_mm_set1_ps(float 1.160000e+02)
%24 = tail call i32 @_mm_div_ps(i32 %22, i32 %23)
%25 = tail call i32 @_mm_cmpgt_ps(i32 %0, i32 %2)
%26 = tail call i32 @_mm_and_ps(i32 %25, i32 %19)
%27 = tail call i32 @_mm_andnot_ps(i32 %25, i32 %24)
%28 = tail call i32 @_mm_or_ps(i32 %26, i32 %27)
ret i32 %28
}