each place it appears. (e) Special rules (1) Credits not allowed against tax on unrepatriated earnings and unrecognized gains In the case of any expatriated entity and any United States shareholder of an applicable controlled foreign corporation, credits (other than the credit allowed by section 901) shall be allowed against the tax imposed by chapter 1 on such entity or corporation for any taxable year with respect to which any amount is included in income under subsection (a) only to the extent such tax exceeds the product of— (A) the amount so included in income, and (B) the highest rate of tax specified in section 11(b)(1). For purposes of determining the credit allowed by section 901, such income shall be treated as from sources within the United States. (2) Coordination with section 172 and minimum tax Rules similar to the rules of paragraphs (3) and (4) of section 860E(a) shall apply for purposes of subsection (a). (f) Special rule for treaties Nothing in section 894 or 7852(d) or in any other provision of law shall be construed as permitting an exemption, by reason of any treaty obligation of the United States heretofore or hereafter entered into, from the provisions of this section. (g) Regulations The Secretary shall provide such regulations as are necessary to carry out this section, including regulations providing for such adjustments to the application of this section as are necessary to prevent the avoidance of the purposes of this section, including the avoidance of such purposes through— (1) the use of related persons, pass-through or other noncorporate entities, or other intermediaries, or (2) transactions designed to have persons cease to be (or not become) members of expanded affiliated groups or related persons. . (b) Modifications to rules relating to corporate inversions completed on or before January 4, 2017 (1) In general Subsection (b) of section 7874 of the Internal Revenue Code of 1986 is amended to read as follows: (b) Inverted corporations treated as domestic corporations (1) In