High-resolution investigations of C2 and CN optical emissions in laser-induced plasmas during graphite ablation