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

/* Variables and functions */
int /*<<< orphan*/ dd_div(double *, double *, double *);
int /*<<< orphan*/ dd_sqr(double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int div_sqr_of_pi(void) {
  const double pi_hi = 3.141592653589793116e+00;
  const double pi_lo = 1.224646799147353207e-16;
  double dd_pi[2];
  double sqr_of_pi[2];
  double div_of_sqr_of_pi[2];
  printf("\ntesting sqr(pi)/pi ...\n");
  dd_pi[0] = pi_hi;
  dd_pi[1] = pi_lo;
  printf("     pi hi = %21.14e        pi lo = %21.14e\n", dd_pi[0], dd_pi[1]);
  dd_sqr(dd_pi, sqr_of_pi);
  printf("   pi^2 hi = %21.14e      pi^2 lo = %21.14e\n", sqr_of_pi[0],
         sqr_of_pi[1]);
  dd_div(sqr_of_pi, dd_pi, div_of_sqr_of_pi);
  printf("pi^2/pi hi = %21.14e   pi^2/pi lo = %21.14e\n", div_of_sqr_of_pi[0],
         div_of_sqr_of_pi[1]);
  return 0;
}


x86 assembly (clang, -O0):
<div_sqr_of_pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8b(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe9e(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <dd_sqr@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xea6(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <dd_div@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xeaa(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<div_sqr_of_pi>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xeba(%rip),%rdi
movsd  0xea2(%rip),%xmm0
movsd  0xea2(%rip),%xmm1
mov    $0x2,%al
call   1050 <printf@plt>
lea    0x20(%rsp),%r14
lea    0x10(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <dd_sqr@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
lea    0xea8(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <dd_div@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
lea    0xeae(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0Atesting sqr(pi)/pi ...\0A\00"
@.str.1 = [45 x i8] c" pi hi = %21.14e pi lo = %21.14e\0A\00"
@.str.2 = [45 x i8] c" pi^2 hi = %21.14e pi^2 lo = %21.14e\0A\00"
@.str.3 = [45 x i8] c"pi^2/pi hi = %21.14e pi^2/pi lo = %21.14e\0A\00"
define i32 @div_sqr_of_pi() {
%1 = alloca double
%2 = alloca double
%3 = alloca [2 x double]
%4 = alloca [2 x double]
%5 = alloca [2 x double]
store double 0x400921FB54442D18, double* %1
store double 0x3CA1A62633145C07, double* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
store double 0x400921FB54442D18, double* %7
%8 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
store double 0x3CA1A62633145C07, double* %8
%9 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%10 = load double, double* %9
%11 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), double %10, double %12)
%14 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%15 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%16 = call i32 @dd_sqr(double* %14, double* %15)
%17 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%18 = load double, double* %17
%19 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), double %18, double %20)
%22 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%23 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%24 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%25 = call i32 @dd_div(double* %22, double* %23, double* %24)
%26 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%27 = load double, double* %26
%28 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
%29 = load double, double* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), double %27, double %29)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c" pi hi = %21.14e pi lo = %21.14e\0A\00"
@.str.2 = [45 x i8] c" pi^2 hi = %21.14e pi^2 lo = %21.14e\0A\00"
@.str.3 = [45 x i8] c"pi^2/pi hi = %21.14e pi^2/pi lo = %21.14e\0A\00"
@str = [24 x i8] c"\0Atesting sqr(pi)/pi ...\00"
define i32 @div_sqr_of_pi() {
%1 = alloca <2 x double>
%2 = alloca [2 x double]
%3 = alloca [2 x double]
%4 = bitcast <2 x double>* %1 to i8*
%5 = bitcast [2 x double]* %2 to i8*
%6 = bitcast [2 x double]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds <2 x double>, <2 x double>* %1, i64 0, i64 0
store <2 x double> <double 0x400921FB54442D18, double 0x3CA1A62633145C07>, <2 x double>* %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), double 0x400921FB54442D18, double 0x3CA1A62633145C07)
%10 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%11 = call i32 @dd_sqr(double* %8, double* %10)
%12 = load double, double* %10
%13 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 1
%14 = load double, double* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), double %12, double %14)
%16 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%17 = call i32 @dd_div(double* %10, double* %8, double* %16)
%18 = load double, double* %16
%19 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), double %18, double %20)
ret i32 0
}