corporation ends an amount equal to the shareholder's pro rata share (determined in the same manner as under section 951(a)(2)) of the amount treated as subpart F income under clause (i), and (iii) the deduction under section 245A(a) shall be allowable to the United States shareholder with respect to the subpart F income included in gross income under clause (ii) in the same manner as if such subpart F income were a dividend received by the shareholder from the selling controlled foreign corporation. (B) Effect of loss on earnings and profits For purposes of this title, in the case of a sale or exchange by a controlled foreign corporation of stock in another foreign corporation in a taxable year of the selling controlled foreign corporation beginning after December 31, 2017, to which this paragraph would apply if gain were recognized, the earnings and profits of the selling controlled foreign corporation shall not be reduced by reason of any loss from such sale or exchange. (C) Foreign-source portion For purposes of this paragraph, the foreign-source portion of any amount treated as a dividend under paragraph (1) shall be determined in the same manner as under section 245A(c). . (d) Treatment of foreign branch losses transferred to specified 10-percent owned foreign corporations (1) In general Part II of subchapter B of chapter 1 is amended by adding at the end the following new section: 91. Certain foreign branch losses transferred to specified 10-percent owned foreign corporations (a) In general If a domestic corporation transfers substantially all of the assets of a foreign branch (within the meaning of section 367(a)(3)(C), as in effect before the date of the enactment of the Tax Cuts and Jobs Act ) to a specified 10-percent owned foreign corporation (as 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