Unless the functions are inline or have internal linkage (that is unless the compiler can see the definitions of these functions), or the compiler can determine that the person object involved is not programmatically visible to those functions,
int person_age = personptr->age;
(Any of those functions could have modified the age member of the person object involved, and the compiler would have to take that into account.)
But, as LB points out,
Don't ever worry about speed or optimizing unless you know something is a bottleneck when you profile your runtime.
Or to paraphrase it, in general, leave low level optimizations to the compiler - it is very good, probably better than you are, at doing that. Concern yourself with high level design decisions like choice of data structures and algorithms - the compiler can't decide for you whether you should use a std::vector<> or a std::set<>