simplified version of IRS link:
I) If the FMV of the property at the time of the gift is less than the donor’s adjusted basis, your adjusted basis depends on whether you have a gain or loss when you dispose of the property.
A)Your basis for figuring a gain is the same as the donor’s adjusted basis, …………..
B)Your basis for figuring a loss is the FMV of the property when you received the gift,…………………….
C) Note: If you use the donor’s adjusted basis for figuring a gain and get a loss, and then use the FMV for figuring a loss and get a gain, you have neither a gain nor loss on the sale or disposition of the property.
If the FMV is equal to or greater than the donor’s adjusted basis, your basis is the donor’s adjusted basis at the time you received the gift.
Translate simplified version to decision chart:
I) if FMV < donor basis :
A)Gain on both FMV/donor basis: use donor basis
B)Loss on both FMV/donor basis: use FMV basis
C)Gain on 1 basis/loss on other basis: no gain or loss
II) If FMV >= donor basis, use donor basis
In your cases, FMV < donor basis so you use I). In one case you have loss using both basis; in the other you have gain using both basis
so you use IB and IA.