// File: 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 %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movsd %xmm0, -0x8(%rbp)
movsd %xmm1, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x3c3d0
testb $0x1, %al
jne 0x28856
jmp 0x28883
movq -0x18(%rbp), %rax
movsd 0x2c7a6(%rip), %xmm0    # 0x55008
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movsd -0x8(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x28aa1
movsd -0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x3c3d0
testb $0x1, %al
jne 0x28896
jmp 0x288c3
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
movsd 0x2c75b(%rip), %xmm0    # 0x55008
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x28a9f
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0x48(%rbp)
movsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
callq 0x3c4c0
testb $0x1, %al
jne 0x2890b
jmp 0x2895f
movsd -0x38(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0x50(%rbp)
movsd -0x40(%rbp), %xmm0
divsd -0x38(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c870
movaps %xmm0, %xmm1
movsd 0x2c6cc(%rip), %xmm0    # 0x55008
addsd %xmm1, %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c890
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x289b1
movsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0x58(%rbp)
movsd -0x38(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c870
movaps %xmm0, %xmm1
movsd 0x2c678(%rip), %xmm0    # 0x55008
addsd %xmm1, %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c890
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x38(%rbp), %xmm0
movq -0x28(%rbp), %rax
divsd (%rax), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x40(%rbp), %xmm0
movq -0x28(%rbp), %rax
divsd (%rax), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x8(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movsd %xmm0, -0x60(%rbp)
movsd -0x10(%rbp), %xmm0
movq -0x30(%rbp), %rdi
callq 0x3c820
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
callq 0x3c4c0
testb $0x1, %al
jne 0x28a12
jmp 0x28a9d
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
callq 0x3c440
testb $0x1, %al
jne 0x28a28
jmp 0x28a9d
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x28a9f
jmp 0x28aa1
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)