Here's the rule (from the Hypertext d20 SRD):
"To determine whether your target has cover from your ranged attack, choose a corner of your square. If any line from this corner to any corner of the target’s square passes through a square or border that blocks line of effect or provides cover, or through a square occupied by a creature, the target has cover (+4 to AC)."
And you can pick any square of a multi-square creature when determining cover.
Now, I read "square" to mean "cube" in a three-dimensional situation. This is largely because you have to trace to the back corners of the square when considering the more common 2D situation--I think the most reasonable way to read that is that you have to be able to trace to all 8 corners of a 5' cube.
So, using your picture and that interpretation, #1 could shoot at the large character without worrying about cover, but there is no corner of #1 that can trace to every corner of the medium creature without intersecting some part of #4, so the medium creature gets cover.