To expand on your question, each segment of cable is treated to its conditions. Sounds like you have a run of NM in the attic, a run of THHN in the attic, and a run of THHN bundled with other circuits. The attic sections have an ambient temperature derating. The bundled section has a bundling derating. If you bundled in the attic, that would be the worst portion and you would apply both factors. But as was pointed out by Infinity, both NM and THHN use the 90C rating for derating purposes so type doesn't matter.