Remove duplicate call to get_entity_kind().
Remove duplicate call to get_type_size_bytes().
Reduce scope of type, which is only used in specific cases.
Avoid duplicate function header in different #if cases.