Cache simulator in C