  We compute the genus-two chiral partition function of the left-moving
heterotic string for a $\mathbb{Z}_2$ CHL orbifold. The required twisted
determinants can be evaluated explicitly in terms of the untwisted determinants
and theta functions using orbifold techniques. The dependence on Prym periods
cancels neatly once summation over odd charges is properly taken into account.
The resulting partition function is a Siegel modular form of level two and
precisely equals recently proposed dyon partition function for this model. This
result provides an independent weak coupling derivation of the dyon partition
function using the M-theory lift of string webs representing the dyons. We
discuss generalization of this technique to general $\mathbb{Z}_N$ orbifolds.
