Hello jay2333. I take it you are a medical student. Rather than attempting to describe the many possible meanings of "of" (a huge task), I'll try to recast your three phrases without the use of "of".
pneumonia that develops during the course of another disease = pneumonia secondary to another disease
second most [frequent or common] cause of community pneumonia = the agent that gives rise to most community pneumonia after [the single more frequent cause]
is composed of hundreds of = is made from hundreds of
Student or Learner