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

/* Variables and functions */
float fastlog2(float x) {
  union {
    float f;
    uint32_t i;
  } vx = {x};
  union {
    uint32_t i;
    float f;
  } mx = {(vx.i & 0x007FFFFF) | 0x3f000000};
  float y = vx.i;
  y *= 1.1920928955078125e-7f;
  return y - 124.22551499f - 1.498030302f * mx.f -
         1.72587999f / (0.3520887068f + mx.f);
}


x86 assembly (clang, -O0):
<fastlog2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7fffff,%eax
or     $0x3f000000,%eax
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xedb(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm1
movss  0xec0(%rip),%xmm0
subss  %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
movss  0xeab(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe97(%rip),%xmm2
addss  -0x10(%rbp),%xmm2
movss  0xe86(%rip),%xmm1
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastlog2>:
movd   %xmm0,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
and    $0x7fffff,%eax
mulss  0xee8(%rip),%xmm0
or     $0x3f000000,%eax
addss  0xedf(%rip),%xmm0
movd   %eax,%xmm1
movss  0xed7(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xecf(%rip),%xmm1
addss  %xmm0,%xmm2
movss  0xec7(%rip),%xmm0
divss  %xmm1,%xmm0
addss  %xmm2,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
%union.anon.0 = type { i32 }
define float @fastlog2(float %0) {
%2 = alloca float
%3 = alloca %union.anon
%4 = alloca %union.anon.0
%5 = alloca float
store float %0, float* %2
%6 = bitcast %union.anon* %3 to float*
%7 = load float, float* %2
store float %7, float* %6
%8 = bitcast %union.anon.0* %4 to i32*
%9 = bitcast %union.anon* %3 to i32*
%10 = load i32, i32* %9
%11 = and i32 %10, 8388607
%12 = or i32 %11, 1056964608
store i32 %12, i32* %8
%13 = bitcast %union.anon* %3 to i32*
%14 = load i32, i32* %13
%15 = sitofp i32 %14 to float
store float %15, float* %5
%16 = load float, float* %5
%17 = fmul float %16, 0x3E80000000000000
store float %17, float* %5
%18 = load float, float* %5
%19 = fsub float %18, 0x405F0E6EE0000000
%20 = bitcast %union.anon.0* %4 to float*
%21 = load float, float* %20
%22 = call float @llvm.fmuladd.f32(float 0xBFF7F7EEA0000000, float %21, float %19)
%23 = bitcast %union.anon.0* %4 to float*
%24 = load float, float* %23
%25 = fadd float 0x3FD6889F20000000, %24
%26 = fdiv float 0x3FFB9D3460000000, %25
%27 = fsub float %22, %26
ret float %27
}

LLVM IR (-O2):
define float @fastlog2(float %0) {
%2 = bitcast float %0 to i32
%3 = and i32 %2, 8388607
%4 = or i32 %3, 1056964608
%5 = sitofp i32 %2 to float
%6 = fmul float %5, 0x3E80000000000000
%7 = fadd float %6, 0xC05F0E6EE0000000
%8 = bitcast i32 %4 to float
%9 = tail call float @llvm.fmuladd.f32(float %8, float 0xBFF7F7EEA0000000, float %7)
%10 = fadd float %8, 0x3FD6889F20000000
%11 = fdiv float 0x3FFB9D3460000000, %10
%12 = fsub float %9, %11
ret float %12
}