// File: /workspace/github_cpp_makefile_star2_O1/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::generaterotation(double, double, double*, double*, double*, alglib_impl::ae_state*)
void generaterotation(double f,
     double g,
     double* cs,
     double* sn,
     double* r,
     ae_state *_state)
{
    double f1;
    double g1;

    *cs = 0;
    *sn = 0;
    *r = 0;

    if( ae_fp_eq(g,0) )
    {
        *cs = 1;
        *sn = 0;
        *r = f;
    }
    else
    {
        if( ae_fp_eq(f,0) )
        {
            *cs = 0;
            *sn = 1;
            *r = g;
        }
        else
        {
            f1 = f;
            g1 = g;
            if( ae_fp_greater(ae_fabs(f1, _state),ae_fabs(g1, _state)) )
            {
                *r = ae_fabs(f1, _state)*ae_sqrt(1+ae_sqr(g1/f1, _state), _state);
            }
            else
            {
                *r = ae_fabs(g1, _state)*ae_sqrt(1+ae_sqr(f1/g1, _state), _state);
            }
            *cs = f1/(*r);
            *sn = g1/(*r);
            if( ae_fp_greater(ae_fabs(f, _state),ae_fabs(g, _state))&&ae_fp_less(*cs,0) )
            {
                *cs = -*cs;
                *sn = -*sn;
                *r = -*r;
            }
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movapd %xmm1, %xmm2
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, (%rdi)
movq %rax, (%rsi)
movq %rax, (%rdx)
xorpd %xmm1, %xmm1
movsd %xmm2, 0x8(%rsp)
movapd %xmm2, %xmm0
callq 0x262ba
testb %al, %al
je 0x1a7db
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%r15)
movq $0x0, (%r14)
movapd 0x10(%rsp), %xmm0
jmp 0x1a807
xorpd %xmm1, %xmm1
movaps 0x10(%rsp), %xmm0
callq 0x262ba
testb %al, %al
je 0x1a817
movq $0x0, (%r15)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%r14)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movaps 0x10(%rsp), %xmm0
movq %r12, %rdi
callq 0x26575
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x26575
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x2633e
testb %al, %al
je 0x1a86b
movaps 0x10(%rsp), %xmm0
movq %r12, %rdi
callq 0x26575
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
jmp 0x1a88b
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x26575
movsd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x26588
addsd 0x19905(%rip), %xmm0    # 0x341a0
movq %r12, %rdi
callq 0x2658d
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rbx)
movapd 0x10(%rsp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r15)
movsd 0x8(%rsp), %xmm0
divsd (%rbx), %xmm0
movsd %xmm0, (%r14)
movapd %xmm2, %xmm0
movq %r12, %rdi
callq 0x26575
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x26575
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x2633e
testb %al, %al
je 0x1a80b
movsd (%r15), %xmm0
xorpd %xmm1, %xmm1
callq 0x262fe
testb %al, %al
je 0x1a80b
movsd (%r15), %xmm0
movapd 0x198b7(%rip), %xmm1    # 0x341e0
xorpd %xmm1, %xmm0
movlpd %xmm0, (%r15)
movsd (%r14), %xmm0
xorpd %xmm1, %xmm0
movlpd %xmm0, (%r14)
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm0
jmp 0x1a807