Objective
Reimplement realloc's grow/shrink pattern with an explicit old size: move a heap block to a buffer of a new size while keeping its leading bytes.
Steps
$ p = malloc(4); /* 'A','B','C','D' */ q = mem_resize(p, 4, 8);
first 4 bytes of q: ABCD
$ p = malloc(8); /* 'A'..'H' */ q = mem_resize(p, 8, 4);
first 4 bytes of q: ABCD
$ q = mem_resize(NULL, 0, 6); /* like malloc(6) */
q is a fresh 6-byte block
Expected files
Allowed functions
Allowed headers
Standard C library
Implements the contract of a function from the standard C library.

Objective
Reimplement realloc's grow/shrink pattern with an explicit old size: move a heap block to a buffer of a new size while keeping its leading bytes.
Steps
$ p = malloc(4); /* 'A','B','C','D' */ q = mem_resize(p, 4, 8);
first 4 bytes of q: ABCD
$ p = malloc(8); /* 'A'..'H' */ q = mem_resize(p, 8, 4);
first 4 bytes of q: ABCD
$ q = mem_resize(NULL, 0, 6); /* like malloc(6) */
q is a fresh 6-byte block
Expected files
Allowed functions
Allowed headers
Standard C library
Implements the contract of a function from the standard C library.

Tests
Run the tests to grade your code