// File: /workspace/github_cpp_makefile_star2_O1/mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::applyrotationsfromtheright(bool, long, long, long, long, alglib_impl::ae_vector*, alglib_impl::ae_vector*, alglib_impl::ae_matrix*, alglib_impl::ae_vector*, alglib_impl::ae_state*)
void applyrotationsfromtheright(ae_bool isforward,
     ae_int_t m1,
     ae_int_t m2,
     ae_int_t n1,
     ae_int_t n2,
     /* Real    */ ae_vector* c,
     /* Real    */ ae_vector* s,
     /* Real    */ ae_matrix* a,
     /* Real    */ ae_vector* work,
     ae_state *_state)
{
    ae_int_t j;
    ae_int_t jp1;
    double ctemp;
    double stemp;
    double temp;


    
    /*
     * Form A * P'
     */
    if( isforward )
    {
        if( m1!=m2 )
        {
            
            /*
             * Common case: M1<>M2
             */
            for(j=n1; j<=n2-1; j++)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    jp1 = j+1;
                    ae_v_moved(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_subd(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_muld(&a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_addd(&a->ptr.pp_double[m1][j], a->stride, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_move(&a->ptr.pp_double[m1][jp1], a->stride, &work->ptr.p_double[m1], 1, ae_v_len(m1,m2));
                }
            }
        }
        else
        {
            
            /*
             * Special case: M1=M2
             */
            for(j=n1; j<=n2-1; j++)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    temp = a->ptr.pp_double[m1][j+1];
                    a->ptr.pp_double[m1][j+1] = ctemp*temp-stemp*a->ptr.pp_double[m1][j];
                    a->ptr.pp_double[m1][j] = stemp*temp+ctemp*a->ptr.pp_double[m1][j];
                }
            }
        }
    }
    else
    {
        if( m1!=m2 )
        {
            
            /*
             * Common case: M1<>M2
             */
            for(j=n2-1; j>=n1; j--)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    jp1 = j+1;
                    ae_v_moved(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_subd(&work->ptr.p_double[m1], 1, &a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_muld(&a->ptr.pp_double[m1][j], a->stride, ae_v_len(m1,m2), ctemp);
                    ae_v_addd(&a->ptr.pp_double[m1][j], a->stride, &a->ptr.pp_double[m1][jp1], a->stride, ae_v_len(m1,m2), stemp);
                    ae_v_move(&a->ptr.pp_double[m1][jp1], a->stride, &work->ptr.p_double[m1], 1, ae_v_len(m1,m2));
                }
            }
        }
        else
        {
            
            /*
             * Special case: M1=M2
             */
            for(j=n2-1; j>=n1; j--)
            {
                ctemp = c->ptr.p_double[j-n1+1];
                stemp = s->ptr.p_double[j-n1+1];
                if( ae_fp_neq(ctemp,1)||ae_fp_neq(stemp,0) )
                {
                    temp = a->ptr.pp_double[m1][j+1];
                    a->ptr.pp_double[m1][j+1] = ctemp*temp-stemp*a->ptr.pp_double[m1][j];
                    a->ptr.pp_double[m1][j] = stemp*temp+ctemp*a->ptr.pp_double[m1][j];
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r15
movq %r8, %r14
movq %rcx, (%rsp)
movq %rsi, 0x18(%rsp)
movq 0x80(%rsp), %r12
testl %edi, %edi
movq %r9, 0x40(%rsp)
movq %rdx, 0x8(%rsp)
je 0x1a214
cmpq %rdx, 0x18(%rsp)
jne 0x1a2f7
subq (%rsp), %r14
jle 0x1a76e
shlq $0x3, (%rsp)
xorl %ebx, %ebx
movq 0x28(%r15), %rax
movsd 0x8(%rax,%rbx,8), %xmm0
movq 0x28(%r12), %rax
movsd 0x8(%rax,%rbx,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd 0x1a01f(%rip), %xmm1    # 0x341a0
callq 0x262dc
testb %al, %al
jne 0x1a19d
xorpd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x262dc
testb %al, %al
je 0x1a203
movq 0x88(%rsp), %rdx
movq 0x38(%rdx), %rax
movq 0x18(%rsp), %rsi
movq (%rax,%rsi,8), %rax
movq (%rsp), %rcx
addq %rcx, %rax
movsd 0x8(%rax,%rbx,8), %xmm0
movsd (%rax,%rbx,8), %xmm1
movsd 0x8(%rsp), %xmm4
mulsd %xmm4, %xmm1
movsd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rax,%rbx,8)
movq 0x38(%rdx), %rax
movq (%rax,%rsi,8), %rax
addq %rcx, %rax
mulsd (%rax,%rbx,8), %xmm3
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rax,%rbx,8)
incq %rbx
cmpq %rbx, %r14
jne 0x1a158
jmp 0x1a76e
cmpq %rdx, 0x18(%rsp)
jne 0x1a534
cmpq (%rsp), %r14
jle 0x1a76e
movq (%rsp), %rax
leaq (,%rax,8), %rbx
negq %rbx
movq 0x28(%r15), %rax
addq %rbx, %rax
movsd (%rax,%r14,8), %xmm0
movq 0x28(%r12), %rax
addq %rbx, %rax
movsd (%rax,%r14,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd 0x19f39(%rip), %xmm1    # 0x341a0
callq 0x262dc
testb %al, %al
jne 0x1a283
xorpd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x262dc
testb %al, %al
je 0x1a2e5
movq 0x88(%rsp), %rcx
movq 0x38(%rcx), %rax
movq 0x18(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movsd (%rax,%r14,8), %xmm0
movsd -0x8(%rax,%r14,8), %xmm1
movsd 0x8(%rsp), %xmm4
mulsd %xmm4, %xmm1
movsd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, (%rax,%r14,8)
movq 0x38(%rcx), %rax
movq (%rax,%rdx,8), %rax
mulsd -0x8(%rax,%r14,8), %xmm3
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, -0x8(%rax,%r14,8)
decq %r14
cmpq (%rsp), %r14
jg 0x1a238
jmp 0x1a76e
subq (%rsp), %r14
jle 0x1a76e
shlq $0x3, (%rsp)
xorl %r13d, %r13d
movq 0x18(%rsp), %rax
leaq (,%rax,8), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%r15), %rax
movsd 0x8(%rax,%r13), %xmm1
movq 0x28(%r12), %rax
movsd 0x8(%rax,%r13), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x20(%rsp)
movapd %xmm1, %xmm0
movsd 0x19e56(%rip), %xmm1    # 0x341a0
callq 0x262dc
testb %al, %al
jne 0x1a36a
xorpd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x262dc
testb %al, %al
je 0x1a522
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rbp
movq 0x28(%rsp), %r15
addq %r15, %rbp
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %r14, 0x38(%rsp)
movq %rcx, %r14
movq (%rsp), %r12
addq %r12, %rax
leaq (%rax,%r13), %rbx
addq $0x8, %rbx
movq %rcx, %rdi
movq 0x8(%rsp), %rsi
callq 0x2923f
movl $0x1, %esi
movq %rbp, %rdi
movq %rbx, %rdx
movq 0x30(%rsp), %rcx
movq %rax, %r8
movsd 0x20(%rsp), %xmm0
callq 0x28fd1
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rbx
addq %r15, %rbx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %rbp
addq %r12, %rbp
addq %r13, %rbp
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x2923f
movl $0x1, %esi
movq %rbx, %rdi
movq %rbp, %rdx
movq %r15, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x291f0
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %r15
movq %r12, %rbp
movq %r12, (%rsp)
addq %r12, %r15
addq %r13, %r15
movq %r14, %rdi
movq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x2923f
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x20(%rsp), %xmm0
callq 0x291fc
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %r15
addq %rbp, %r15
leaq (%r15,%r13), %rbp
addq $0x8, %rbp
addq %r13, %r15
movq %r14, %rdi
movq %r12, %rsi
callq 0x2923f
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x290d8
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %rax
addq (%rsp), %rax
movq 0x80(%rsp), %r12
movq %r14, %rdi
movq 0x38(%rsp), %r14
leaq (%rax,%r13), %r15
addq $0x8, %r15
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rbp
addq 0x28(%rsp), %rbp
movq 0x8(%rsp), %rsi
callq 0x2923f
movl $0x1, %ecx
movq %r15, %rdi
movq 0x40(%rsp), %r15
movq %rbx, %rsi
movq %rbp, %rdx
movq %rax, %r8
callq 0x28ecd
addq $0x8, %r13
decq %r14
jne 0x1a31b
jmp 0x1a76e
cmpq (%rsp), %r14
jle 0x1a76e
leaq -0x8(,%r14,8), %r13
movq (%rsp), %rax
leaq (,%rax,8), %rax
negq %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
leaq (,%rax,8), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%r15), %rax
movq 0x30(%rsp), %rcx
addq %rcx, %rax
movsd 0x8(%r13,%rax), %xmm1
movq 0x28(%r12), %rax
addq %rcx, %rax
movsd 0x8(%r13,%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x20(%rsp)
movapd %xmm1, %xmm0
movsd 0x19bfa(%rip), %xmm1    # 0x341a0
callq 0x262dc
testb %al, %al
jne 0x1a5c6
xorpd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm0
callq 0x262dc
testb %al, %al
je 0x1a75d
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rbx
movq 0x28(%rsp), %r15
addq %r15, %rbx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x38(%rax), %rax
movq 0x18(%rsp), %r12
movq (%rax,%r12,8), %rax
leaq (%rax,%r13), %rbp
addq $0x8, %rbp
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x2923f
movl $0x1, %esi
movq %rbx, %rdi
movq %rbp, %rdx
movq 0x38(%rsp), %rcx
movq %rax, %r8
movsd 0x20(%rsp), %xmm0
callq 0x28fd1
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rbx
addq %r15, %rbx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %rbp
addq %r13, %rbp
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x2923f
movl $0x1, %esi
movq %rbx, %rdi
movq %rbp, %rdx
movq %r15, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x291f0
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %r15
addq %r13, %r15
movq %r12, %rdi
movq 0x8(%rsp), %rbp
movq %rbp, %rsi
callq 0x2923f
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x20(%rsp), %xmm0
callq 0x291fc
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %r15
leaq (%r15,%r13), %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
addq %r13, %r15
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2923f
movq %r15, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x290d8
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %rax
leaq (%rax,%r13), %r15
addq $0x8, %r15
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rbp
addq 0x28(%rsp), %rbp
movq %r12, %rdi
movq 0x80(%rsp), %r12
movq 0x8(%rsp), %rsi
callq 0x2923f
movl $0x1, %ecx
movq %r15, %rdi
movq 0x40(%rsp), %r15
movq %rbx, %rsi
movq %rbp, %rdx
movq %rax, %r8
callq 0x28ecd
decq %r14
addq $-0x8, %r13
cmpq (%rsp), %r14
jg 0x1a56c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq