If I understand correctly, the second photo is directly about the first photo. I.e. if you cut just above the cracked joint in the second photo, the assembly below that cut would be loose, due to the loose fitting at the bottom.
If it's loose like you could pull it out (after removing a section of pipe to have room to move it), then you might be able to just scrape the hub. You could get a new street 45 and see if it fits--it should go half way in. If so, just scrape the inside of the hub with the edge of a utility blade to knock off any high spots, and with the proper amount of ABS cement you should be able to securely glue in the new street 45. If not, or if the joint doesn't actually come apart, you'd need to use a reamer like Terry described.
Once you have the street 45 replaced, you can glue in a new section of pipe, but obviously not full height, as you need clearance to insert the pipe into the hubs. So what you do is leave out around 4" of pipe, making sure that at each side of the gap you have > 1" of clean pipe.
Then you use two Fernco shielded couplings (3005 series is for plastic to plastic). You cut a piece of pipe to fill the gap but 3/8" short, and make sure all the ends are cleaned and reamed. Slide the shields off the rubber couplings and onto the fixed pipe ends (or one shield can go around the insert piece of pipe. Take the rubber portion of each coupling, put it on one of the fixed ends, and then take the open portion and fold it back on top of itself as far as you can. There's an ~1/8" rubber stop in the middle of the coupling, which should be touching the pipe end, and then the coupling should not project much farther than that into the gap.
Now you should be able to wiggle the pipe segment into place with a bit of effort. Then you can unfold the rubber portion that goes onto the pipe segment, slide the shields into place, and torque to spec.
Cutting the pipe segment 3/8" short is based on 1/8" for each stop, and 1/8" for play because the couplings extend beyond the stop. It's possible that's too little play, and a 1/4" play would be necessary, meaning cut the new pipe segment 1/2" shorter than the gap in the pipe.
If for some reason the wye is damaged, there's a similar procedure using 3 shielded rubber couplings that involves gluing up the wye, street 45, and 3 pipe segments, and inserting that assembly all at once, but that requires more coordination.
Cheers, Wayne
Cheers, Wayne