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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double);
double rsqrt(double x) {
  double xhalf = 0.5 * x;
  union {
    double float64;
    int64_t int64;
  } u;
  u.float64 = x;
  printf("  a = %.13a = %.16e\n", u.float64, u.float64);
  u.int64 = 0x5fe6eb50c7aa19f9LL - (u.int64 >> 1);
  printf(" r0 = %.13a = %.16e\n", u.float64, u.float64);
  u.float64 = u.float64 * (1.5 - xhalf * u.float64 * u.float64);
  printf(" r1 = %.13a = %.16e\n", u.float64, u.float64);
  u.float64 = u.float64 * (1.5 - xhalf * u.float64 * u.float64);
  printf(" r2 = %.13a = %.16e\n", u.float64, u.float64);
  u.float64 = u.float64 * (1.5 - xhalf * u.float64 * u.float64);
  printf(" r3 = %.13a = %.16e\n", u.float64, u.float64);
  u.float64 = u.float64 * (1.5 - xhalf * u.float64 * u.float64);
  printf(" r4 = %.13a = %.16e\n", u.float64, u.float64);
  u.float64 = u.float64 * (1.5 - xhalf * u.float64 * u.float64);
  printf(" r5 = %.13a = %.16e\n", u.float64, u.float64);
  return u.float64;
}


x86 assembly (clang, -O0):
<rsqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
sar    $0x1,%eax
movslq %eax,%rcx
movabs $0x5fe6eb50c7aa19f9,%rax
eb e6 5f
sub    %rcx,%rax
mov    %eax,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe4b(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xdf1(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd97(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xddd(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd3d(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xd98(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xce3(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xd53(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsqrt>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
lea    0xeef(%rip),%rdi
movaps %xmm0,%xmm1
call   1030 <printf@plt>
movq   0x10(%rsp),%xmm0
movq   %xmm0,%rax
movabs $0xffffffff00000000,%rcx
ff ff ff
and    %rax,%rcx
sar    %eax
mov    $0xc7aa19f9,%edx
sub    %eax,%edx
or     %rdx,%rcx
movq   %rcx,%xmm0
movq   %xmm0,0x8(%rsp)
lea    0xec6(%rip),%rdi
movdqa %xmm0,%xmm1
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xe8a(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe76(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe97(%rip),%rdi
movapd %xmm0,%xmm1
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe40(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe76(%rip),%rdi
movapd %xmm0,%xmm1
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe0a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe55(%rip),%rdi
movapd %xmm0,%xmm1
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xdd4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe34(%rip),%rdi
movapd %xmm0,%xmm1
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xd9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe13(%rip),%rdi
movapd %xmm0,%xmm1
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%union.anon = type { double }
@.str = [21 x i8] c" a = %.13a = %.16e\0A\00"
@.str.1 = [21 x i8] c" r0 = %.13a = %.16e\0A\00"
@.str.2 = [21 x i8] c" r1 = %.13a = %.16e\0A\00"
@.str.3 = [21 x i8] c" r2 = %.13a = %.16e\0A\00"
@.str.4 = [21 x i8] c" r3 = %.13a = %.16e\0A\00"
@.str.5 = [21 x i8] c" r4 = %.13a = %.16e\0A\00"
@.str.6 = [21 x i8] c" r5 = %.13a = %.16e\0A\00"
define double @rsqrt(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca %union.anon
store double %0, double* %2
%5 = load double, double* %2
%6 = fmul double 5.000000e-01, %5
store double %6, double* %3
%7 = load double, double* %2
%8 = bitcast %union.anon* %4 to double*
store double %7, double* %8
%9 = bitcast %union.anon* %4 to double*
%10 = load double, double* %9
%11 = bitcast %union.anon* %4 to double*
%12 = load double, double* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %10, double %12)
%14 = bitcast %union.anon* %4 to i32*
%15 = load i32, i32* %14
%16 = ashr i32 %15, 1
%17 = sext i32 %16 to i64
%18 = sub nsw i64 6910469410426329593, %17
%19 = trunc i64 %18 to i32
%20 = bitcast %union.anon* %4 to i32*
store i32 %19, i32* %20
%21 = bitcast %union.anon* %4 to double*
%22 = load double, double* %21
%23 = bitcast %union.anon* %4 to double*
%24 = load double, double* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %22, double %24)
%26 = bitcast %union.anon* %4 to double*
%27 = load double, double* %26
%28 = load double, double* %3
%29 = bitcast %union.anon* %4 to double*
%30 = load double, double* %29
%31 = fmul double %28, %30
%32 = bitcast %union.anon* %4 to double*
%33 = load double, double* %32
%34 = fneg double %31
%35 = call double @llvm.fmuladd.f64(double %34, double %33, double 1.500000e+00)
%36 = fmul double %27, %35
%37 = bitcast %union.anon* %4 to double*
store double %36, double* %37
%38 = bitcast %union.anon* %4 to double*
%39 = load double, double* %38
%40 = bitcast %union.anon* %4 to double*
%41 = load double, double* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %39, double %41)
%43 = bitcast %union.anon* %4 to double*
%44 = load double, double* %43
%45 = load double, double* %3
%46 = bitcast %union.anon* %4 to double*
%47 = load double, double* %46
%48 = fmul double %45, %47
%49 = bitcast %union.anon* %4 to double*
%50 = load double, double* %49
%51 = fneg double %48
%52 = call double @llvm.fmuladd.f64(double %51, double %50, double 1.500000e+00)
%53 = fmul double %44, %52
%54 = bitcast %union.anon* %4 to double*
store double %53, double* %54
%55 = bitcast %union.anon* %4 to double*
%56 = load double, double* %55
%57 = bitcast %union.anon* %4 to double*
%58 = load double, double* %57
%59 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %56, double %58)
%60 = bitcast %union.anon* %4 to double*
%61 = load double, double* %60
%62 = load double, double* %3
%63 = bitcast %union.anon* %4 to double*
%64 = load double, double* %63
%65 = fmul double %62, %64
%66 = bitcast %union.anon* %4 to double*
%67 = load double, double* %66
%68 = fneg double %65
%69 = call double @llvm.fmuladd.f64(double %68, double %67, double 1.500000e+00)
%70 = fmul double %61, %69
%71 = bitcast %union.anon* %4 to double*
store double %70, double* %71
%72 = bitcast %union.anon* %4 to double*
%73 = load double, double* %72
%74 = bitcast %union.anon* %4 to double*
%75 = load double, double* %74
%76 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %73, double %75)
%77 = bitcast %union.anon* %4 to double*
%78 = load double, double* %77
%79 = load double, double* %3
%80 = bitcast %union.anon* %4 to double*
%81 = load double, double* %80
%82 = fmul double %79, %81
%83 = bitcast %union.anon* %4 to double*
%84 = load double, double* %83
%85 = fneg double %82
%86 = call double @llvm.fmuladd.f64(double %85, double %84, double 1.500000e+00)
%87 = fmul double %78, %86
%88 = bitcast %union.anon* %4 to double*
store double %87, double* %88
%89 = bitcast %union.anon* %4 to double*
%90 = load double, double* %89
%91 = bitcast %union.anon* %4 to double*
%92 = load double, double* %91
%93 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %90, double %92)
%94 = bitcast %union.anon* %4 to double*
%95 = load double, double* %94
%96 = load double, double* %3
%97 = bitcast %union.anon* %4 to double*
%98 = load double, double* %97
%99 = fmul double %96, %98
%100 = bitcast %union.anon* %4 to double*
%101 = load double, double* %100
%102 = fneg double %99
%103 = call double @llvm.fmuladd.f64(double %102, double %101, double 1.500000e+00)
%104 = fmul double %95, %103
%105 = bitcast %union.anon* %4 to double*
store double %104, double* %105
%106 = bitcast %union.anon* %4 to double*
%107 = load double, double* %106
%108 = bitcast %union.anon* %4 to double*
%109 = load double, double* %108
%110 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %107, double %109)
%111 = bitcast %union.anon* %4 to double*
%112 = load double, double* %111
ret double %112
}

LLVM IR (-O2):
@.str = [21 x i8] c" a = %.13a = %.16e\0A\00"
@.str.1 = [21 x i8] c" r0 = %.13a = %.16e\0A\00"
@.str.2 = [21 x i8] c" r1 = %.13a = %.16e\0A\00"
@.str.3 = [21 x i8] c" r2 = %.13a = %.16e\0A\00"
@.str.4 = [21 x i8] c" r3 = %.13a = %.16e\0A\00"
@.str.5 = [21 x i8] c" r4 = %.13a = %.16e\0A\00"
@.str.6 = [21 x i8] c" r5 = %.13a = %.16e\0A\00"
define double @rsqrt(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %0, double %0)
%3 = bitcast double %0 to i64
%4 = trunc i64 %3 to i32
%5 = ashr i32 %4, 1
%6 = sub nsw i32 -945153543, %5
%7 = zext i32 %6 to i64
%8 = and i64 %3, -4294967296
%9 = or i64 %8, %7
%10 = bitcast i64 %9 to double
%11 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %10, double %10)
%12 = fmul double %0, -5.000000e-01
%13 = fmul double %12, %10
%14 = tail call double @llvm.fmuladd.f64(double %13, double %10, double 1.500000e+00)
%15 = fmul double %14, %10
%16 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %15, double %15)
%17 = fmul double %12, %15
%18 = tail call double @llvm.fmuladd.f64(double %17, double %15, double 1.500000e+00)
%19 = fmul double %15, %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %19, double %19)
%21 = fmul double %12, %19
%22 = tail call double @llvm.fmuladd.f64(double %21, double %19, double 1.500000e+00)
%23 = fmul double %19, %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %23, double %23)
%25 = fmul double %12, %23
%26 = tail call double @llvm.fmuladd.f64(double %25, double %23, double 1.500000e+00)
%27 = fmul double %23, %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %27, double %27)
%29 = fmul double %12, %27
%30 = tail call double @llvm.fmuladd.f64(double %29, double %27, double 1.500000e+00)
%31 = fmul double %27, %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %31, double %31)
ret double %31
}