Charmed particles from two-gluon annihilation in proton-proton collisions