I'll clarify in the comment.

I really wanted to call inc_ref in the AsChainLink constructor and dec_ref in the AsChainLink destructor; that would nicely make all this automatic (i.e., RAII). But if we did that we'd be doing lots of spurious incs and decs as the AsChainLinks get copied and assigned all over the place. I tried disabling copying and assignment in the hope that -O2 would have optimized them away, but sadly that's not the case. So instead of automatic RAII we have a clear rule as to what the caller of create_as_chain must do. This is good enough I think, and clear.