// File: mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::_ialglib_cmatrixgemm(long, long, long, alglib_impl::ae_complex, alglib_impl::ae_complex*, long, long, alglib_impl::ae_complex*, long, long, alglib_impl::ae_complex, alglib_impl::ae_complex*, long)
ae_bool _ialglib_cmatrixgemm(ae_int_t m,
     ae_int_t n,
     ae_int_t k,
     ae_complex alpha,
     ae_complex *_a,
     ae_int_t _a_stride,
     ae_int_t optypea,
     ae_complex *_b,
     ae_int_t _b_stride,
     ae_int_t optypeb,
     ae_complex beta,
     ae_complex *_c,
     ae_int_t _c_stride)
 {
    const ae_complex *arow;
    ae_complex *crow;
    ae_int_t i;
    double _loc_abuf[2*alglib_c_block+alglib_simd_alignment];
    double _loc_b[2*alglib_c_block*alglib_c_block+alglib_simd_alignment];
    double * const abuf = (double * const) ae_align(_loc_abuf,alglib_simd_alignment);
    double * const b    = (double * const) ae_align(_loc_b,   alglib_simd_alignment);
    ae_int_t brows;
    ae_int_t bcols;
    void (*cmv)(ae_int_t, ae_int_t, const double *, const double *, ae_complex *, double *, ae_int_t, ae_complex, ae_complex) = &_ialglib_cmv;
    
    if( m>alglib_c_block || n>alglib_c_block || k>alglib_c_block )
        return ae_false;

    /*
     * Check for SSE2 support
     */
#ifdef AE_HAS_SSE2_INTRINSICS
    if( ae_cpuid() & CPU_SSE2 )
    {
        cmv = &_ialglib_cmv_sse2;
    }    
#endif
    
    /*
     * copy b
     */
    brows = optypeb==0 ? k : n;
    bcols = optypeb==0 ? n : k;
    if( optypeb==0 )
        _ialglib_mcopyblock_complex(brows, bcols, _b, 1, _b_stride, b);
    if( optypeb==1 )
        _ialglib_mcopyblock_complex(brows, bcols, _b, 0, _b_stride, b);
    if( optypeb==2 )
        _ialglib_mcopyblock_complex(brows, bcols, _b, 3, _b_stride, b);

    /*
     * multiply B by A (from the right, by rows)
     * and store result in C
     */
    arow  = _a;
    crow  = _c;
    for(i=0; i<m; i++)
    {
        if( optypea==0 )
        {
            _ialglib_vcopy_complex(k, arow, 1, abuf, 1, "No conj");
            arow += _a_stride;
        }
        else if( optypea==1 )
        {
            _ialglib_vcopy_complex(k, arow, _a_stride, abuf, 1, "No conj");
            arow++;
        }
        else
        {
            _ialglib_vcopy_complex(k, arow, _a_stride, abuf, 1, "Conj");
            arow++;
        }
        if( beta.x==0 && beta.y==0 )
            _ialglib_vzero_complex(n, crow, 1);
        cmv(n, k, b, abuf, crow, NULL, 1, alpha, beta);
        crow += _c_stride;
    }
    return ae_true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2750, %rsp           # imm = 0x2750
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x10(%rbp)
movsd %xmm2, -0x28(%rbp)
movsd %xmm3, -0x20(%rbp)
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
leaq -0x270(%rbp), %rdi
movl $0x10, %esi
callq 0x3aab0
movq %rax, -0x26f8(%rbp)
leaq -0x26f0(%rbp), %rdi
movl $0x10, %esi
callq 0x3aab0
movq %rax, -0x2700(%rbp)
leaq -0x16d2(%rip), %rax     # 0x4d780
movq %rax, -0x2718(%rbp)
cmpq $0x18, -0x30(%rbp)
jg 0x4ee6e
cmpq $0x18, -0x38(%rbp)
jg 0x4ee6e
cmpq $0x18, -0x40(%rbp)
jle 0x4ee77
movb $0x0, -0x1(%rbp)
jmp 0x4f0fb
cmpq $0x0, 0x20(%rbp)
jne 0x4ee8b
movq -0x40(%rbp), %rax
movq %rax, -0x2740(%rbp)
jmp 0x4ee96
movq -0x38(%rbp), %rax
movq %rax, -0x2740(%rbp)
movq -0x2740(%rbp), %rax
movq %rax, -0x2708(%rbp)
cmpq $0x0, 0x20(%rbp)
jne 0x4eeb8
movq -0x38(%rbp), %rax
movq %rax, -0x2748(%rbp)
jmp 0x4eec3
movq -0x40(%rbp), %rax
movq %rax, -0x2748(%rbp)
movq -0x2748(%rbp), %rax
movq %rax, -0x2710(%rbp)
cmpq $0x0, 0x20(%rbp)
jne 0x4eeff
movq -0x2708(%rbp), %rdi
movq -0x2710(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %r8
movq -0x2700(%rbp), %r9
movl $0x1, %ecx
callq 0x4e410
cmpq $0x1, 0x20(%rbp)
jne 0x4ef2c
movq -0x2708(%rbp), %rdi
movq -0x2710(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %r8
movq -0x2700(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
callq 0x4e410
cmpq $0x2, 0x20(%rbp)
jne 0x4ef5a
movq -0x2708(%rbp), %rdi
movq -0x2710(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %r8
movq -0x2700(%rbp), %r9
movl $0x3, %ecx
callq 0x4e410
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x4f0f7
cmpq $0x0, -0x58(%rbp)
jne 0x4efbd
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x26f8(%rbp), %rcx
movl $0x1, %r8d
leaq 0x95b3(%rip), %r9       # 0x58556
movq %r8, %rdx
callq 0x4dd80
movq -0x50(%rbp), %rax
shlq $0x4, %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x4f02a
cmpq $0x1, -0x58(%rbp)
jne 0x4eff7
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x26f8(%rbp), %rcx
movl $0x1, %r8d
leaq 0x9572(%rip), %r9       # 0x58556
callq 0x4dd80
movq -0x60(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
jmp 0x4f028
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x26f8(%rbp), %rcx
movl $0x1, %r8d
leaq 0x8d1b(%rip), %r9       # 0x57d32
callq 0x4dd80
movq -0x60(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
jmp 0x4f02a
movsd -0x28(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4f05c
jp 0x4f05c
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4f05c
jp 0x4f05c
movq -0x38(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl $0x1, %edx
callq 0x4dbb0
movq -0x2718(%rbp), %rax
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x2700(%rbp), %rdx
movq -0x26f8(%rbp), %rcx
movq -0x68(%rbp), %r8
movq -0x18(%rbp), %r9
movq %r9, -0x2728(%rbp)
movq -0x10(%rbp), %r9
movq %r9, -0x2720(%rbp)
movq -0x28(%rbp), %r9
movq %r9, -0x2738(%rbp)
movq -0x20(%rbp), %r9
movq %r9, -0x2730(%rbp)
movsd -0x2728(%rbp), %xmm0
movsd -0x2720(%rbp), %xmm1
movsd -0x2738(%rbp), %xmm2
movsd -0x2730(%rbp), %xmm3
xorl %r9d, %r9d
movq $0x1, (%rsp)
callq *%rax
movq 0x30(%rbp), %rax
shlq $0x4, %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x4ef72
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x2750, %rsp           # imm = 0x2750
popq %rbp
retq
nopl (%rax)