foreign income for such taxable year, bears to (2) the sum of the currently-taxed foreign income and deferred foreign income for such year. The portion of the total foreign income taxes for any taxable year not taken into account under the preceding sentence for a taxable year shall only be taken into account as provided in subsection (b) (and shall not be taken into account for purposes of applying sections 902 and 960). (b) Allowance related to repatriated deferred foreign income (1) In general If there is repatriated foreign income for any taxable year, the portion of the previously deferred foreign income taxes paid or accrued during such taxable year shall be taken into account for the taxable year as foreign taxes paid or accrued. Any such taxes so taken into account shall not be included in foreign income taxes for purposes of applying subsection (a) to such taxable year. (2) Portion of previously deferred foreign income taxes For purposes of paragraph (1), the portion of the previously deferred foreign income taxes allocated to repatriated deferred foreign income is— (A) the amount which bears the same proportion to such taxes, as (B) the repatriated deferred income bears to the previously deferred foreign income. (c) Definitions and special rule For purposes of this section— (1) Previously deferred foreign income taxes The term previously deferred foreign income taxes means the aggregate amount of total foreign income taxes not taken into account under subsection (a) for all prior taxable years (determined as of the beginning of the taxable year), reduced by any amounts taken into account under subsection (b) for such prior taxable years. (2) Total foreign income taxes The term total foreign income taxes means the sum of foreign income taxes paid or accrued during the taxable year (determined without regard to section 904(c)) plus the increase in foreign income taxes that would be paid or accrued during the taxable year under sections 902 and 960 if— (A) all controlled foreign corporations were treated