Returns the entry code to call the function with param_types as its inputs and
return_types as outputs, located at code_offset. If finalize_for_proof is true,
will make sure to remove the segment arena after calling the function. For testing purposes,
finalize_for_proof can be set to false, to avoid a failure of the segment arena validation.