defined in section 245A) with respect to which it is a United States shareholder after such transfer, such domestic corporation shall include in gross income for the taxable year which includes such transfer an amount equal to the transferred loss amount with respect to such transfer. (b) Limitation and carryforward based on foreign-source dividends received (1) In general The amount included in the gross income of the taxpayer under subsection (a) for any taxable year shall not exceed the amount allowed as a deduction under section 245A for such taxable year (taking into account dividends received from all specified 10-percent owned foreign corporations with respect to which the taxpayer is a United States shareholder). (2) Amounts not included carried forward Any amount not included in gross income for any taxable year by reason of paragraph (1) shall, subject to the application of paragraph (1) to the succeeding taxable year, be included in gross income for the succeeding taxable year. (c) Transferred loss amount For purposes of this section, the term transferred loss amount means, with respect to any transfer of substantially all of the assets of a foreign branch, the excess (if any) of— (1) the sum of losses— (A) which were incurred by the foreign branch after December 31, 2017, and before the transfer, and (B) with respect to which a deduction was allowed to the taxpayer, over (2) the sum of— (A) any taxable income of such branch for a taxable year after the taxable year in which the loss was incurred and through the close of the taxable year of the transfer, and (B) any amount which is recognized under section 904(f)(3) on account of the transfer. (d) Reduction for recognized gains The transferred loss amount shall be reduced (but not below zero) by the amount of gain recognized by the taxpayer on account of the transfer (other than amounts taken into account under subsection (c)(2)(B)). (e) Source of income Amounts included in gross income under this section shall be treated as derived from sources