Modeling the evolution of infrared galaxies: clustering of galaxies in the cosmic infrared background