Would asking a question about converting a 200 line code series of 4-5 functions to a different language be considered off topic? It is a dynamic memory allocator and the issue is how to reimplement it so that the allocation is self-contained within an array. Primarily the issue is proper indexing for the first element in the list of memory blocks. Ordinarily that sort of stuff was determined by the operating system function for allocating a new page.