// File: mouda[P]LTE_random_access-simulate/ap.cpp
// Function: alglib_impl::ae_matrix_set_length(alglib_impl::ae_matrix*, long, long, alglib_impl::ae_state*)
ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state)
{
    /* 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_set_length(): negative length", state);
    if( rows<0 || cols<0 )
        return ae_false;

    if( dst->rows==rows && dst->cols==cols )
        return ae_true;    
    dst->rows = rows;
    dst->cols = cols;
    dst->stride = cols;
    while( dst->stride*ae_sizeof(dst->datatype)%AE_DATA_ALIGN!=0 )
        dst->stride++;
    if( !ae_db_realloc(&dst->data, dst->rows*((ae_int_t)sizeof(void*)+dst->stride*ae_sizeof(dst->datatype))+AE_DATA_ALIGN-1, state) )
        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
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3bc7f
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x29(%rbp)
jl 0x3bc66
cmpq $0x0, -0x20(%rbp)
setge %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
movq -0x28(%rbp), %rdx
movzbl %al, %edi
andl $0x1, %edi
leaq 0x1c516(%rip), %rsi     # 0x58190
callq 0x3b240
cmpq $0x0, -0x18(%rbp)
jl 0x3bc8d
cmpq $0x0, -0x20(%rbp)
jge 0x3bc96
movb $0x0, -0x1(%rbp)
jmp 0x3bdc1
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x3bcba
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0x3bcba
movb $0x1, -0x1(%rbp)
jmp 0x3bdc1
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, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3ae20
movq %rax, %rcx
movq -0x38(%rbp), %rax
imulq %rcx, %rax
movl $0x10, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x3bd23
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x3bcdd
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3ae20
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movq -0x40(%rbp), %rax
imulq %rcx, %rax
addq $0x8, %rax
imulq %rax, %rsi
addq $0x10, %rsi
subq $0x1, %rsi
movq -0x28(%rbp), %rdx
callq 0x3b280
testb $0x1, %al
jne 0x3bd89
movb $0x0, -0x1(%rbp)
jmp 0x3bdc1
movq -0x10(%rbp), %rax
movq %rax, -0x58(%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 -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x3ad60
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)