Do you really pass all these heavy structs on the stack?
I would strongly advice to pass enV, attrL and res by reference.
Either '*' or '&', not so important.