Updated with aligned_alloc implementation.