#include "../../cmd/ld/textflag.h"
#define PosOne 0x3FF0000000000000
#define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001
#define PI4A 0.7853981554508209228515625
#define PI4B 0.794662735614792836713604629039764404296875e-8
#define PI4C 0.306161699786838294306516483068750264552437361480769e-16
#define M4PI 1.273239544735162542821171882678754627704620361328125
#define T0 1.0
#define T1 -8.33333333333333333333333e-02
#define T2 2.77777777777777777777778e-03
#define T3 -4.96031746031746031746032e-05
#define T4 5.51146384479717813051146e-07
TEXT ·Sincos(SB),NOSPLIT,$0
MOVQ $~(1<<63), DX
MOVQ x+0(FP), BX
ANDQ BX, DX
JEQ isZero
MOVQ $PosInf, AX
CMPQ AX, DX
JLE isInfOrNaN
MOVQ BX, X7
MOVQ DX, X0
MOVSD $M4PI, X2
MULSD X0, X2
CVTTSD2SQ X2, BX
MOVQ $1, AX
ANDQ BX, AX
ADDQ BX, AX
CVTSQ2SD AX, X2
MOVSD $PI4A, X3
MULSD X2, X3
SUBSD X3, X0
MOVSD $PI4B, X3
MULSD X2, X3
SUBSD X3, X0
MOVSD $PI4C, X3
MULSD X2, X3
SUBSD X3, X0
MULSD $0.125, X0
MULSD X0, X0
MOVSD $T4, X2
MULSD X0, X2
ADDSD $T3, X2
MULSD X0, X2
ADDSD $T2, X2
MULSD X0, X2
ADDSD $T1, X2
MULSD X0, X2
ADDSD $T0, X2
MULSD X2, X0
MOVSD $4.0, X2
SUBSD X0, X2
MULSD X2, X0
MOVSD $4.0, X2
SUBSD X0, X2
MULSD X2, X0
MOVSD $4.0, X2
SUBSD X0, X2
MULSD X2, X0
MULSD $0.5, X0
MOVSD $2.0, X2
SUBSD X0, X2
MULSD X0, X2
SQRTSD X2, X2
MOVSD $1.0, X1
SUBSD X0, X1
MOVQ $1, DX
ADDQ BX, DX
MOVQ $2, AX
ANDQ AX, DX
MOVQ DX, X0
MOVSD $0.0, X3
CMPSD X0, X3, 0
MOVAPD X2, X0
ANDPD X3, X0
MOVAPD X3, X4
ANDNPD X1, X4
ORPD X4, X0
ANDPD X3, X1
ANDNPD X2, X3
ORPD X3, X1
MOVQ BX, AX
MOVQ $61, CX
SHLQ CX, AX
MOVQ AX, X3
XORPD X7, X3
MOVQ $(1<<63), AX
MOVQ AX, X2
ANDPD X2, X3
ORPD X3, X0
MOVQ $2, AX
ADDQ AX, BX
MOVQ $61, CX
SHLQ CX, BX
MOVQ BX, X3
ANDPD X2, X3
ORPD X3, X1
MOVSD X0, sin+8(FP)
MOVSD X1, cos+16(FP)
RET
isZero:
MOVQ BX, sin+8(FP)
MOVQ $PosOne, AX
MOVQ AX, cos+16(FP)
RET
isInfOrNaN:
MOVQ $NaN, AX
MOVQ AX, sin+8(FP)
MOVQ AX, cos+16(FP)
RET