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

/* Variables and functions */
float fastpow2(float p) {
  float offset = (p < 0) ? 1.0f : 0.0f;
  float clipp = (p < -126) ? -126.0f : p;
  int w = clipp;
  float z = clipp - w + offset;
  union {
    uint32_t i;
    float f;
  } v = {(uint32_t)((1 << 23) *
                    (clipp + 121.2740575f + 27.7280233f / (4.84252568f - z) -
                     1.49012907f * z))};
  return v.f;
}


x86 assembly (clang, -O0):
<fastpow2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeee(%rip),%xmm3
xorps  %xmm2,%xmm2
cmpltss %xmm2,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec9(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1153 <fastpow2+0x53>
movss  0xeb7(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    115d <fastpow2+0x5d>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
subss  %xmm1,%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe89(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xe78(%rip),%xmm2
subss  -0x14(%rbp),%xmm2
movss  0xe67(%rip),%xmm1
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
movss  0xe4e(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe3a(%rip),%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastpow2>:
xorps  %xmm1,%xmm1
movss  0xef9(%rip),%xmm2
maxss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movss  0xee4(%rip),%xmm1
andps  %xmm0,%xmm1
cvttps2dq %xmm2,%xmm0
cvtdq2ps %xmm0,%xmm0
movaps %xmm2,%xmm3
subss  %xmm0,%xmm3
addss  %xmm1,%xmm3
addss  0xecf(%rip),%xmm2
movss  0xecb(%rip),%xmm0
subss  %xmm3,%xmm0
movss  0xec3(%rip),%xmm1
divss  %xmm0,%xmm1
mulss  0xebb(%rip),%xmm3
addss  %xmm2,%xmm1
addss  %xmm1,%xmm3
mulss  0xeaf(%rip),%xmm3
cvttss2si %xmm3,%eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define float @fastpow2(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
%7 = alloca %union.anon
store float %0, float* %2
%8 = load float, float* %2
%9 = fcmp olt float %8, 0.000000e+00
%10 = zext i1 %9 to i64
%11 = select i1 %9, float 1.000000e+00, float 0.000000e+00
store float %11, float* %3
%12 = load float, float* %2
%13 = fcmp olt float %12, -1.260000e+02
br i1 %13, label %14, label %15
14: ; preds = %1
br label %17
15: ; preds = %1
%16 = load float, float* %2
br label %17
17: ; preds = %15, %14
%18 = phi float [ -1.260000e+02, %14 ], [ %16, %15 ]
store float %18, float* %4
%19 = load float, float* %4
%20 = fptosi float %19 to i32
store i32 %20, i32* %5
%21 = load float, float* %4
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to float
%24 = fsub float %21, %23
%25 = load float, float* %3
%26 = fadd float %24, %25
store float %26, float* %6
%27 = bitcast %union.anon* %7 to i32*
%28 = load float, float* %4
%29 = fadd float %28, 0x405E518A20000000
%30 = load float, float* %6
%31 = fsub float 0x40135EBF00000000, %30
%32 = fdiv float 0x403BBA5FC0000000, %31
%33 = fadd float %29, %32
%34 = load float, float* %6
%35 = call float @llvm.fmuladd.f32(float 0xBFF7D791A0000000, float %34, float %33)
%36 = fmul float 0x4160000000000000, %35
%37 = fptosi float %36 to i32
store i32 %37, i32* %27
%38 = bitcast %union.anon* %7 to float*
%39 = load float, float* %38
ret float %39
}

LLVM IR (-O2):
define float @fastpow2(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = select i1 %2, float 1.000000e+00, float 0.000000e+00
%4 = fcmp olt float %0, -1.260000e+02
%5 = select i1 %4, float -1.260000e+02, float %0
%6 = fptosi float %5 to i32
%7 = sitofp i32 %6 to float
%8 = fsub float %5, %7
%9 = fadd float %3, %8
%10 = fadd float %5, 0x405E518A20000000
%11 = fsub float 0x40135EBF00000000, %9
%12 = fdiv float 0x403BBA5FC0000000, %11
%13 = fadd float %10, %12
%14 = tail call float @llvm.fmuladd.f32(float %9, float 0xBFF7D791A0000000, float %13)
%15 = fmul float %14, 0x4160000000000000
%16 = fptosi float %15 to i32
%17 = bitcast i32 %16 to float
ret float %17
}