#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*/ DBL_EPSILON;
double aa_tf_cos_series(double);
double aa_tf_sinc_series(double);
double cos(double);
double sin(double);
double sqrt(int /*<<< orphan*/);
void aa_tf_sinccos(double theta, double *sc, double *c) {
  if (theta * theta < sqrt(DBL_EPSILON)) {
    *sc = aa_tf_sinc_series(theta);
    *c = aa_tf_cos_series(theta);
  } else {
    double s = sin(theta);
    *c = cos(theta);
    *sc = s / theta;
  }
}


x86 assembly (clang, -O0):
<aa_tf_sinccos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1070 <sqrt@plt>
movsd  -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ba <aa_tf_sinccos+0x6a>
movsd  -0x8(%rbp),%xmm0
call   1030 <aa_tf_sinc_series@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
call   1040 <aa_tf_cos_series@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11ed <aa_tf_sinccos+0x9d>
movsd  -0x8(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_tf_sinccos>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1070 <sqrt@plt>
ucomisd 0x10(%rsp),%xmm0
jbe    11a4 <aa_tf_sinccos+0x54>
movsd  0x8(%rsp),%xmm0
call   1030 <aa_tf_sinc_series@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <aa_tf_cos_series@plt>
movsd  %xmm0,(%r14)
jmp    11d5 <aa_tf_sinccos+0x85>
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,(%r14)
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@DBL_EPSILON = global i32 0
define void @aa_tf_sinccos(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double, double* %4
%9 = load double, double* %4
%10 = fmul double %8, %9
%11 = load i32, i32* @DBL_EPSILON
%12 = call double @sqrt(i32 %11)
%13 = fcmp olt double %10, %12
br i1 %13, label %14, label %21
14: ; preds = %3
%15 = load double, double* %4
%16 = call double @aa_tf_sinc_series(double %15)
%17 = load double*, double** %5
store double %16, double* %17
%18 = load double, double* %4
%19 = call double @aa_tf_cos_series(double %18)
%20 = load double*, double** %6
store double %19, double* %20
br label %31
21: ; preds = %3
%22 = load double, double* %4
%23 = call double @sin(double %22)
store double %23, double* %7
%24 = load double, double* %4
%25 = call double @cos(double %24)
%26 = load double*, double** %6
store double %25, double* %26
%27 = load double, double* %7
%28 = load double, double* %4
%29 = fdiv double %27, %28
%30 = load double*, double** %5
store double %29, double* %30
br label %31
31: ; preds = %21, %14
ret void
}

LLVM IR (-O2):
@DBL_EPSILON = global i32 0
define void @aa_tf_sinccos(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = fmul double %0, %0
%5 = load i32, i32* @DBL_EPSILON
%6 = tail call double @sqrt(i32 %5)
%7 = fcmp olt double %4, %6
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = tail call double @aa_tf_sinc_series(double %0)
store double %9, double* %1
%10 = tail call double @aa_tf_cos_series(double %0)
store double %10, double* %2
br label %15
11: ; preds = %3
%12 = tail call double @sin(double %0)
%13 = tail call double @cos(double %0)
store double %13, double* %2
%14 = fdiv double %12, %0
store double %14, double* %1
br label %15
15: ; preds = %11, %8
ret void
}