```\nfunction processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n    bytes32 computedHash = leaf;\n    for (uint256 i = 0; i < proof.length; i++) {\n        bytes32 proofElement = proof[i];\n        if (computedHash <= proofElement) {\n            // Hash(current computed hash + current element of the proof)\n            computedHash = _efficientHash(computedHash, proofElement);\n        } else {\n            // Hash(current element of the proof + current computed hash)\n            computedHash = _efficientHash(proofElement, computedHash);\n        }\n    }\n    return computedHash;\n}\n```\n