// File: /workspace/github_cpp_makefile_star2_O3/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 $0x58, %rsp
movq %r9, %r15
movq %r8, %r14
movq %rcx, %r13
testl %edi, %edi
movq %r9, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, (%rsp)
je 0x19b92
cmpq %rdx, %rsi
jne 0x19c71
subq %r13, %r14
jle 0x1a0df
shlq $0x3, %r13
xorl %ebx, %ebx
movq 0x28(%r15), %rax
movsd 0x8(%rax,%rbx,8), %xmm0
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
movsd 0x8(%rax,%rbx,8), %xmm1
movsd %xmm1, (%rsp)
movsd %xmm0, 0x8(%rsp)
movsd 0x196db(%rip), %xmm1    # 0x331e0
callq 0x25b97
testb %al, %al
jne 0x19b20
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm0
callq 0x25b97
testb %al, %al
je 0x19b81
movq 0x98(%rsp), %rdx
movq 0x38(%rdx), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
addq %r13, %rax
movsd 0x8(%rax,%rbx,8), %xmm0
movsd (%rax,%rbx,8), %xmm1
movsd (%rsp), %xmm4
mulsd %xmm4, %xmm1
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rax,%rbx,8)
movq 0x38(%rdx), %rax
movq (%rax,%rcx,8), %rax
addq %r13, %rax
mulsd (%rax,%rbx,8), %xmm3
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rax,%rbx,8)
incq %rbx
cmpq %rbx, %r14
jne 0x19ad6
jmp 0x1a0df
cmpq %rdx, %rsi
jne 0x19ead
cmpq %r13, %r14
jle 0x1a0df
leaq (,%r13,8), %rbx
negq %rbx
movq 0x28(%r15), %rax
addq %rbx, %rax
movsd (%rax,%r14,8), %xmm0
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
addq %rbx, %rax
movsd (%rax,%r14,8), %xmm1
movsd %xmm1, (%rsp)
movsd %xmm0, 0x8(%rsp)
movsd 0x195fc(%rip), %xmm1    # 0x331e0
callq 0x25b97
testb %al, %al
jne 0x19bff
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm0
callq 0x25b97
testb %al, %al
je 0x19c60
movq 0x98(%rsp), %rdx
movq 0x38(%rdx), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax,%r14,8), %xmm0
movsd -0x8(%rax,%r14,8), %xmm1
movsd (%rsp), %xmm4
mulsd %xmm4, %xmm1
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movsd %xmm2, (%rax,%r14,8)
movq 0x38(%rdx), %rax
movq (%rax,%rcx,8), %rax
mulsd -0x8(%rax,%r14,8), %xmm3
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, -0x8(%rax,%r14,8)
decq %r14
cmpq %r13, %r14
jg 0x19baf
jmp 0x1a0df
cmpq %r13, %r14
jle 0x1a0df
movq 0x18(%rsp), %rax
leaq (,%rax,8), %rax
movq %rax, 0x20(%rsp)
movq %r13, %r12
movq %r14, 0x48(%rsp)
movq 0x28(%r15), %rax
movq %r12, %rcx
subq %r13, %rcx
movsd 0x8(%rax,%rcx,8), %xmm1
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
movsd 0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, 0x10(%rsp)
movapd %xmm1, %xmm0
movsd 0x19512(%rip), %xmm1    # 0x331e0
callq 0x25b97
testb %al, %al
jne 0x19cee
xorpd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x25b97
testb %al, %al
je 0x19e9c
leaq 0x1(%r12), %rax
movq %rax, 0x30(%rsp)
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
movq 0x20(%rsp), %rax
addq %rax, %rbx
movq %rax, %rbp
movq 0x98(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
leaq 0x8(,%r12,8), %rcx
movq %rcx, 0x28(%rsp)
movq 0x18(%rsp), %r14
movq (%rax,%r14,8), %r13
addq %rcx, %r13
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x2897c
movl $0x1, %esi
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x2870e
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %r15
addq %rbp, %r15
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x50(%rsp)
movq 0x38(%rax), %rax
leaq (,%r12,8), %rbx
movq (%rax,%r14,8), %rbp
addq %rbx, %rbp
movq %r14, %rdi
movq (%rsp), %r13
movq %r13, %rsi
callq 0x2897c
movl $0x1, %esi
movq %r15, %rdi
movq %rbp, %rdx
movq 0x50(%rsp), %rcx
movq %rax, %r8
movsd 0x8(%rsp), %xmm0
callq 0x2892d
movq 0x98(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
addq (%rax,%r14,8), %rbx
movq %r14, %rdi
movq %r13, %rbp
movq %r13, %rsi
callq 0x2897c
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
movsd 0x10(%rsp), %xmm0
callq 0x28939
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r14,8), %rax
leaq (%rax,%r12,8), %r15
leaq (%rax,%r12,8), %r13
addq $0x8, %r13
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2897c
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq 0x38(%rsp), %r13
movq %rbx, %rcx
movq %rax, %r8
movsd 0x8(%rsp), %xmm0
callq 0x28815
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq 0x28(%rsp), %r12
addq (%rax,%r14,8), %r12
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %r15
addq 0x20(%rsp), %r15
movq %r14, %rdi
movq 0x48(%rsp), %r14
movq %rbp, %rsi
callq 0x2897c
movl $0x1, %ecx
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq 0x40(%rsp), %r15
movq %rax, %r8
callq 0x2860a
movq 0x30(%rsp), %r12
jmp 0x19e9f
incq %r12
cmpq %r14, %r12
jne 0x19c94
jmp 0x1a0df
cmpq %r13, %r14
jle 0x1a0df
leaq -0x8(,%r14,8), %rbp
leaq (,%r13,8), %rax
negq %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %rax
leaq (,%rax,8), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %r12
movq 0x28(%r15), %rax
movq 0x28(%rsp), %rcx
addq %rcx, %rax
movsd 0x8(%rbp,%rax), %xmm1
movq 0x90(%rsp), %rax
movq 0x28(%rax), %rax
addq %rcx, %rax
movsd 0x8(%rbp,%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, 0x10(%rsp)
movapd %xmm1, %xmm0
movsd 0x192bc(%rip), %xmm1    # 0x331e0
callq 0x25b97
testb %al, %al
jne 0x19f44
xorpd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0x25b97
testb %al, %al
je 0x1a0cf
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
movq 0x20(%rsp), %r15
addq %r15, %rbx
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %rax
leaq (%rax,%rbp), %r13
addq $0x8, %r13
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x2897c
movl $0x1, %esi
movq %rbx, %rdi
movq %r13, %rdx
movq 0x30(%rsp), %rcx
movq %rax, %r8
movsd 0x10(%rsp), %xmm0
callq 0x2870e
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %rbx
addq %r15, %rbx
movq 0x98(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %r13
addq %rbp, %r13
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x2897c
movl $0x1, %esi
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
movsd 0x8(%rsp), %xmm0
callq 0x2892d
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %r15
addq %rbp, %r15
movq %r12, %rdi
movq (%rsp), %r13
movq %r13, %rsi
callq 0x2897c
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x10(%rsp), %xmm0
callq 0x28939
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %r15
leaq (%r15,%rbp), %rax
addq $0x8, %rax
movq %rax, 0x10(%rsp)
addq %rbp, %r15
movq %r12, %rdi
movq %r13, %rsi
callq 0x2897c
movq %r15, %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
movq %rax, %r8
movsd 0x8(%rsp), %xmm0
callq 0x28815
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rbx
movq 0x38(%rax), %rax
movq (%rax,%r12,8), %rax
leaq (%rax,%rbp), %r15
addq $0x8, %r15
movq 0xa0(%rsp), %rax
movq 0x28(%rax), %r13
addq 0x20(%rsp), %r13
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x2897c
movl $0x1, %ecx
movq %r15, %rdi
movq 0x40(%rsp), %r15
movq %rbx, %rsi
movq %r13, %rdx
movq 0x38(%rsp), %r13
movq %rax, %r8
callq 0x2860a
decq %r14
addq $-0x8, %rbp
cmpq %r13, %r14
jg 0x19ee5
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq