#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_cos_taylor(double *, double *);
int /*<<< orphan*/ dd_inc(double *, double *);
int /*<<< orphan*/ dd_mul_pwr2(double *, double, double *);
int /*<<< orphan*/ dd_sin_taylor(double *, double *);
int /*<<< orphan*/ dd_sincos_taylor(double *, double *, double *);
int /*<<< orphan*/ dd_sqr(double *, double *);
int /*<<< orphan*/ dd_write(double *, int);
int /*<<< orphan*/ printf(char *, ...);
int test_sincostaylor(void) {
  double dd_pi16[2];
  double dd_pi32[2];
  double sinpi32a[2], sinpi32b[2];
  double cospi32a[2], cospi32b[2];
  double x[2];
  double y[2];
  const double pi16_hi = 1.963495408493620697e-01;
  const double pi16_lo = 7.654042494670957545e-18;
  dd_pi16[0] = pi16_hi;
  dd_pi16[1] = pi16_lo;
  dd_mul_pwr2(dd_pi16, 0.5, dd_pi32);
  dd_sin_taylor(dd_pi32, sinpi32a);
  dd_cos_taylor(dd_pi32, cospi32a);
  dd_sincos_taylor(dd_pi32, sinpi32b, cospi32b);
  printf("test on sincostaylor ...\n");
  printf("sin(pi/32) : ");
  dd_write(sinpi32a, 32);
  printf("\n");
  printf("sin(pi/32) : ");
  dd_write(sinpi32b, 32);
  printf("\n");
  printf("cos(pi/32) : ");
  dd_write(cospi32a, 32);
  printf("\n");
  printf("cos(pi/32) : ");
  dd_write(cospi32b, 32);
  printf("\n");
  printf("cospi32b hi : %.16e\n", cospi32b[0]);
  printf("cospi32b lo : %.16e\n", cospi32b[1]);
  dd_sqr(sinpi32a, x);
  dd_sqr(cospi32a, y);
  dd_inc(x, y);
  printf("sin(pi/32)^2 + cos(pi/32)^2 : ");
  dd_write(x, 32);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<test_sincostaylor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe65(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe5d(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
movsd  0xe2b(%rip),%xmm0
call   1030 <dd_mul_pwr2@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1090 <dd_sin_taylor@plt>
lea    -0x20(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1070 <dd_cos_taylor@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1060 <dd_sincos_taylor@plt>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   10a0 <dd_write@plt>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x20,%esi
call   10a0 <dd_write@plt>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x20,%esi
call   10a0 <dd_write@plt>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x20,%esi
call   10a0 <dd_write@plt>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x60(%rbp),%xmm0
lea    0xd87(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x58(%rbp),%xmm0
lea    0xd89(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1080 <dd_sqr@plt>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1080 <dd_sqr@plt>
lea    -0x70(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <dd_inc@plt>
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x20,%esi
call   10a0 <dd_write@plt>
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sincostaylor>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
movaps 0xe49(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
movsd  0xe47(%rip),%xmm0
lea    0x70(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <dd_mul_pwr2@plt>
lea    0x60(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <dd_sin_taylor@plt>
lea    0x40(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <dd_cos_taylor@plt>
lea    0x50(%rsp),%r13
mov    %rsp,%r12
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1080 <dd_sincos_taylor@plt>
lea    0xe6a(%rip),%rdi
call   1050 <puts@plt>
lea    0xdf9(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
mov    $0x20,%esi
call   10c0 <dd_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
mov    $0x20,%esi
call   10c0 <dd_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdbe(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
mov    $0x20,%esi
call   10c0 <dd_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
mov    $0x20,%esi
call   10c0 <dd_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  (%rsp),%xmm0
lea    0xd7e(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xd7f(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0x30(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   10a0 <dd_sqr@plt>
lea    0x20(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <dd_sqr@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <dd_inc@plt>
lea    0xd5b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
mov    $0x20,%esi
call   10c0 <dd_write@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"test on sincostaylor ...\0A\00"
@.str.1 = [14 x i8] c"sin(pi/32) : \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [14 x i8] c"cos(pi/32) : \00"
@.str.4 = [21 x i8] c"cospi32b hi : %.16e\0A\00"
@.str.5 = [21 x i8] c"cospi32b lo : %.16e\0A\00"
@.str.6 = [31 x i8] c"sin(pi/32)^2 + cos(pi/32)^2 : \00"
define i32 @test_sincostaylor() {
%1 = alloca [2 x double]
%2 = alloca [2 x double]
%3 = alloca [2 x double]
%4 = alloca [2 x double]
%5 = alloca [2 x double]
%6 = alloca [2 x double]
%7 = alloca [2 x double]
%8 = alloca [2 x double]
%9 = alloca double
%10 = alloca double
store double 0x3FC921FB54442D18, double* %9
store double 0x3C61A62633145C07, double* %10
%11 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
store double 0x3FC921FB54442D18, double* %11
%12 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 1
store double 0x3C61A62633145C07, double* %12
%13 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
%14 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%15 = call i32 @dd_mul_pwr2(double* %13, double 5.000000e-01, double* %14)
%16 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%17 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%18 = call i32 @dd_sin_taylor(double* %16, double* %17)
%19 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%20 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%21 = call i32 @dd_cos_taylor(double* %19, double* %20)
%22 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%23 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%24 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%25 = call i32 @dd_sincos_taylor(double* %22, double* %23, double* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%28 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%29 = call i32 @dd_write(double* %28, i32 32)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%32 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%33 = call i32 @dd_write(double* %32, i32 32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%36 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%37 = call i32 @dd_write(double* %36, i32 32)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%40 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%41 = call i32 @dd_write(double* %40, i32 32)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%44 = load double, double* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %44)
%46 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 1
%47 = load double, double* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %47)
%49 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%50 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
%51 = call i32 @dd_sqr(double* %49, double* %50)
%52 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%53 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%54 = call i32 @dd_sqr(double* %52, double* %53)
%55 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
%56 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%57 = call i32 @dd_inc(double* %55, double* %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%59 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
%60 = call i32 @dd_write(double* %59, i32 32)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"sin(pi/32) : \00"
@.str.3 = [14 x i8] c"cos(pi/32) : \00"
@.str.4 = [21 x i8] c"cospi32b hi : %.16e\0A\00"
@.str.5 = [21 x i8] c"cospi32b lo : %.16e\0A\00"
@.str.6 = [31 x i8] c"sin(pi/32)^2 + cos(pi/32)^2 : \00"
@str = [25 x i8] c"test on sincostaylor ...\00"
define i32 @test_sincostaylor() {
%1 = alloca <2 x double>
%2 = alloca [2 x double]
%3 = alloca [2 x double]
%4 = alloca [2 x double]
%5 = alloca [2 x double]
%6 = alloca [2 x double]
%7 = alloca [2 x double]
%8 = alloca [2 x double]
%9 = bitcast <2 x double>* %1 to i8*
%10 = bitcast [2 x double]* %2 to i8*
%11 = bitcast [2 x double]* %3 to i8*
%12 = bitcast [2 x double]* %4 to i8*
%13 = bitcast [2 x double]* %5 to i8*
%14 = bitcast [2 x double]* %6 to i8*
%15 = bitcast [2 x double]* %7 to i8*
%16 = bitcast [2 x double]* %8 to i8*
%17 = getelementptr inbounds <2 x double>, <2 x double>* %1, i64 0, i64 0
store <2 x double> <double 0x3FC921FB54442D18, double 0x3C61A62633145C07>, <2 x double>* %1
%18 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%19 = call i32 @dd_mul_pwr2(double* %17, double 5.000000e-01, double* %18)
%20 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%21 = call i32 @dd_sin_taylor(double* %18, double* %20)
%22 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%23 = call i32 @dd_cos_taylor(double* %18, double* %22)
%24 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%25 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%26 = call i32 @dd_sincos_taylor(double* %18, double* %24, double* %25)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @dd_write(double* %20, i32 32)
%30 = call i32 @putchar(i32 10)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @dd_write(double* %24, i32 32)
%33 = call i32 @putchar(i32 10)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @dd_write(double* %22, i32 32)
%36 = call i32 @putchar(i32 10)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 @dd_write(double* %25, i32 32)
%39 = call i32 @putchar(i32 10)
%40 = load double, double* %25
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %40)
%42 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 1
%43 = load double, double* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %43)
%45 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
%46 = call i32 @dd_sqr(double* %20, double* %45)
%47 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%48 = call i32 @dd_sqr(double* %22, double* %47)
%49 = call i32 @dd_inc(double* %45, double* %47)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%51 = call i32 @dd_write(double* %45, i32 32)
%52 = call i32 @putchar(i32 10)
ret i32 0
}