The calloc() function is being used to allocate a dynamic array of zeroed integers that can be referenced via the pointer shiftregs.

The value in l2index is going to be zero unless the allocation failed (calloc() returned NULL). If the allocation failed, you invoke undefined behaviour; anything could happen, but your program will probably crash. Check the allocation so that it doesn't crash!

l2index is 0. calloc set memory to zero. Following is Linux Programmer's Manual:

calloc() allocates memory for an array of nmemb elements of size
bytes each and returns a pointer to the allocated memory. The memory
is set to zero. If nmemb or size is 0, then calloc() returns
either NULL, or a unique pointer value that can later be successfully
passed to free().