It seems that the third - if (bnd_index[0]==1 && bnd_index[2]==1 && bnd_index[3]==1) and fourth - if (bnd_index[0]==1 && bnd_index[3]==1 && bnd_index[2]==1) conditions in the boundary_int() function of NIRFAST/toolbox/mex/gen_matrices_3d.c are the same.
It appears to me that the fourth condition should be changed to check indices 1, 2, and 3.