// File: /workspace/github_cpp_makefile_star2_O2/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
andq $0x0, (%rdi)
movapd %xmm1, %xmm2
andq $0x0, (%rsi)
movaps %xmm0, 0x10(%rsp)
andq $0x0, (%rdx)
xorpd %xmm1, %xmm1
movsd %xmm2, 0x8(%rsp)
movapd %xmm2, %xmm0
callq 0x241f5
testb %al, %al
je 0x18e6c
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%r15)
andq $0x0, (%r14)
movapd 0x10(%rsp), %xmm0
jmp 0x18e95
xorpd %xmm1, %xmm1
movaps 0x10(%rsp), %xmm0
callq 0x241f5
testb %al, %al
je 0x18ea5
andq $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 0x2440c
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x2440c
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x24279
testb %al, %al
je 0x18ef9
movaps 0x10(%rsp), %xmm0
movq %r12, %rdi
callq 0x2440c
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
jmp 0x18f19
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x2440c
movsd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x2441f
addsd 0x172cf(%rip), %xmm0    # 0x301f8
movq %r12, %rdi
callq 0x24424
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 0x2440c
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x2440c
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x24279
testb %al, %al
je 0x18e99
movsd (%r15), %xmm0
xorpd %xmm1, %xmm1
callq 0x24239
testb %al, %al
je 0x18e99
movsd (%r15), %xmm0
movapd 0x171f9(%rip), %xmm1    # 0x301b0
xorpd %xmm1, %xmm0
movlpd %xmm0, (%r15)
movsd (%r14), %xmm0
xorpd %xmm1, %xmm0
movlpd %xmm0, (%r14)
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm0
jmp 0x18e95