float Q_RSqrt(float number) {
  int i;
  float x2, y;
  if (number == 0.0)
    return 0.0;
  x2 = number * 0.5f;
  y = number;
  i = *(int *)&y;
  i = 0x5f3759df - (i >> 1);
  y = *(float *)&i;
  y = y * (1.5f - (x2 * y * y));
  return y;
}


x86 assembly (clang, -O0):
<Q_RSqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1132 <Q_RSqrt+0x32>
jp     1132 <Q_RSqrt+0x32>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b2 <Q_RSqrt+0xb2>
movss  0xeca(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe65(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_RSqrt>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    110e <Q_RSqrt+0xe>
jp     110e <Q_RSqrt+0xe>
movaps %xmm1,%xmm0
ret
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
mulss  0xed9(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xecd(%rip),%xmm0
mulss  %xmm1,%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @Q_RSqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store float %0, float* %3
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store float 0.000000e+00, float* %2
br label %31
11: ; preds = %1
%12 = load float, float* %3
%13 = fmul float %12, 5.000000e-01
store float %13, float* %5
%14 = load float, float* %3
store float %14, float* %6
%15 = bitcast float* %6 to i32*
%16 = load i32, i32* %15
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = ashr i32 %17, 1
%19 = sub nsw i32 1597463007, %18
store i32 %19, i32* %4
%20 = bitcast i32* %4 to float*
%21 = load float, float* %20
store float %21, float* %6
%22 = load float, float* %6
%23 = load float, float* %5
%24 = load float, float* %6
%25 = fmul float %23, %24
%26 = load float, float* %6
%27 = fneg float %25
%28 = call float @llvm.fmuladd.f32(float %27, float %26, float 1.500000e+00)
%29 = fmul float %22, %28
store float %29, float* %6
%30 = load float, float* %6
store float %30, float* %2
br label %31
31: ; preds = %11, %10
%32 = load float, float* %2
ret float %32
}

LLVM IR (-O2):
define float @Q_RSqrt(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = bitcast float %0 to i32
%5 = ashr i32 %4, 1
%6 = sub nsw i32 1597463007, %5
%7 = bitcast i32 %6 to float
%8 = fmul float %0, -5.000000e-01
%9 = fmul float %8, %7
%10 = tail call float @llvm.fmuladd.f32(float %9, float %7, float 1.500000e+00)
%11 = fmul float %10, %7
br label %12
12: ; preds = %1, %3
%13 = phi float [ %11, %3 ], [ 0.000000e+00, %1 ]
ret float %13
}