// File: /workspace/github_cpp_makefile_star2_O3/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 0x25b75
testb %al, %al
je 0x1a14c
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%r15)
movq $0x0, (%r14)
movapd 0x10(%rsp), %xmm0
jmp 0x1a178
xorpd %xmm1, %xmm1
movaps 0x10(%rsp), %xmm0
callq 0x25b75
testb %al, %al
je 0x1a188
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 0x25e30
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x25e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x25bf9
testb %al, %al
je 0x1a1dc
movaps 0x10(%rsp), %xmm0
movq %r12, %rdi
callq 0x25e30
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
jmp 0x1a1fc
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x25e30
movsd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x25e43
addsd 0x18fd4(%rip), %xmm0    # 0x331e0
movq %r12, %rdi
callq 0x25e48
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 0x25e30
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
movq %r12, %rdi
callq 0x25e30
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x25bf9
testb %al, %al
je 0x1a17c
movsd (%r15), %xmm0
xorpd %xmm1, %xmm1
callq 0x25bb9
testb %al, %al
je 0x1a17c
movsd (%r15), %xmm0
movapd 0x18f16(%rip), %xmm1    # 0x331b0
xorpd %xmm1, %xmm0
movlpd %xmm0, (%r15)
movsd (%r14), %xmm0
xorpd %xmm1, %xmm0
movlpd %xmm0, (%r14)
movsd (%rbx), %xmm0
xorpd %xmm1, %xmm0
jmp 0x1a178