Clean up function analysis and emission code