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

/* Variables and functions */
float maths_fast_sqrt(float number) {
  union {
    float f;
    int32_t l;
  } i;
  float x, y;
  const float f = 1.5f;
  x = number * 0.5f;
  i.f = number;
  i.l = 0x5f3759df - (i.l >> 1);
  y = i.f;
  y = y * (f - (x * y * y));
  y = y * (f - (x * y * y));
  return number * y;
}


x86 assembly (clang, -O0):
<maths_fast_sqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xee6(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe87(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe4d(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<maths_fast_sqrt>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
movss  0xee7(%rip),%xmm2
mulss  %xmm0,%xmm2
movaps %xmm2,%xmm3
mulss  %xmm1,%xmm3
mulss  %xmm1,%xmm3
movss  0xed4(%rip),%xmm4
addss  %xmm4,%xmm3
mulss  %xmm1,%xmm3
mulss  %xmm3,%xmm2
mulss  %xmm3,%xmm2
addss  %xmm4,%xmm2
mulss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @maths_fast_sqrt(float %0) {
%2 = alloca float
%3 = alloca %union.anon
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %2
store float 1.500000e+00, float* %6
%7 = load float, float* %2
%8 = fmul float %7, 5.000000e-01
store float %8, float* %4
%9 = load float, float* %2
%10 = bitcast %union.anon* %3 to float*
store float %9, float* %10
%11 = bitcast %union.anon* %3 to i32*
%12 = load i32, i32* %11
%13 = ashr i32 %12, 1
%14 = sub nsw i32 1597463007, %13
%15 = bitcast %union.anon* %3 to i32*
store i32 %14, i32* %15
%16 = bitcast %union.anon* %3 to float*
%17 = load float, float* %16
store float %17, float* %5
%18 = load float, float* %5
%19 = load float, float* %4
%20 = load float, float* %5
%21 = fmul float %19, %20
%22 = load float, float* %5
%23 = fneg float %21
%24 = call float @llvm.fmuladd.f32(float %23, float %22, float 1.500000e+00)
%25 = fmul float %18, %24
store float %25, float* %5
%26 = load float, float* %5
%27 = load float, float* %4
%28 = load float, float* %5
%29 = fmul float %27, %28
%30 = load float, float* %5
%31 = fneg float %29
%32 = call float @llvm.fmuladd.f32(float %31, float %30, float 1.500000e+00)
%33 = fmul float %26, %32
store float %33, float* %5
%34 = load float, float* %2
%35 = load float, float* %5
%36 = fmul float %34, %35
ret float %36
}

LLVM IR (-O2):
define float @maths_fast_sqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463007, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %0, -5.000000e-01
%7 = fmul float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 1.500000e+00)
%9 = fmul float %8, %5
%10 = fmul float %6, %9
%11 = tail call float @llvm.fmuladd.f32(float %10, float %9, float 1.500000e+00)
%12 = fmul float %9, %11
%13 = fmul float %12, %0
ret float %13
}