// File: mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::ae_matrix_init(alglib_impl::ae_matrix*, long, long, long, alglib_impl::ae_state*, bool)
ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
{
    /* ensure that size is >=0
       two ways to exit: 1) through ae_assert, if we have non-NULL state, 2) by returning ae_false */
    if( state!=NULL )
        ae_assert(rows>=0 && cols>=0, "ae_matrix_init(): negative length", state);
    if( rows<0 || cols<0 )
        return ae_false;

    /* if one of rows/cols is zero, another MUST be too */
    if( rows==0 || cols==0 )
    {
        rows = 0;
        cols = 0;
    }

    /* init */
    dst->rows = rows;
    dst->cols = cols;
    dst->stride = cols;
    while( dst->stride*ae_sizeof(datatype)%AE_DATA_ALIGN!=0 )
        dst->stride++;
    dst->datatype = datatype;
    if( !ae_db_malloc(&dst->data, dst->rows*((ae_int_t)sizeof(void*)+dst->stride*ae_sizeof(datatype))+AE_DATA_ALIGN-1, state, make_automatic) )
        return ae_false;
    ae_matrix_update_row_pointers(dst, ae_align((char*)dst->data.ptr+dst->rows*sizeof(void*),AE_DATA_ALIGN));
    return ae_true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %r9b, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3b82b
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x32(%rbp)
jl 0x3b812
cmpq $0x0, -0x20(%rbp)
setge %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
movq -0x30(%rbp), %rdx
movzbl %al, %edi
andl $0x1, %edi
leaq 0x1c948(%rip), %rsi     # 0x5816e
callq 0x3b240
cmpq $0x0, -0x18(%rbp)
jl 0x3b839
cmpq $0x0, -0x20(%rbp)
jge 0x3b842
movb $0x0, -0x1(%rbp)
jmp 0x3b973
cmpq $0x0, -0x18(%rbp)
je 0x3b850
cmpq $0x0, -0x20(%rbp)
jne 0x3b860
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3ae20
movq %rax, %rcx
movq -0x40(%rbp), %rax
imulq %rcx, %rax
movl $0x10, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x3b8c5
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x3b883
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3ae20
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movq -0x48(%rbp), %rax
imulq %rcx, %rax
addq $0x8, %rax
imulq %rax, %rsi
addq $0x10, %rsi
subq $0x1, %rsi
movq -0x30(%rbp), %rdx
movb -0x31(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x3b170
testb $0x1, %al
jne 0x3b93b
movb $0x0, -0x1(%rbp)
jmp 0x3b973
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdi
movl $0x10, %esi
callq 0x3aab0
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x3ad60
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nop