Heavy-flavor production in pp and heavy-ion collisions in QCD up-to-LHC energies