Simplify the logic of accessing codec function for specific TYPE
diff --git a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice
index 9ab79e9..9a9c007 100644
--- a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice
+++ b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice
@@ -37,6 +37,8 @@
 /*** <<< FUNC-DECLS [Everything] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Everything;
+extern asn_SEQUENCE_specifics_t asn_SPC_Everything_specs_1;
+extern asn_TYPE_member_t asn_MBR_Everything_1[10];
 
 /*** <<< POST-INCLUDE [Everything] >>> ***/
 
@@ -46,7 +48,7 @@
 
 /*** <<< STAT-DEFS [Everything] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_Everything_1[] = {
+asn_TYPE_member_t asn_MBR_Everything_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct Everything, ch1),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = +1,	/* EXPLICIT tag at current level */
@@ -163,7 +165,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* tt */
     { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* to */
 };
-static asn_SEQUENCE_specifics_t asn_SPC_Everything_specs_1 = {
+asn_SEQUENCE_specifics_t asn_SPC_Everything_specs_1 = {
 	sizeof(struct Everything),
 	offsetof(struct Everything, _asn_ctx),
 	asn_MAP_Everything_tag2el_1,
@@ -236,6 +238,8 @@
 /*** <<< FUNC-DECLS [Choice1] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Choice1;
+extern asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1;
+extern asn_TYPE_member_t asn_MBR_Choice1_1[2];
 
 /*** <<< POST-INCLUDE [Choice1] >>> ***/
 
@@ -243,7 +247,7 @@
 
 /*** <<< STAT-DEFS [Choice1] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_Choice1_1[] = {
+asn_TYPE_member_t asn_MBR_Choice1_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct Choice1, choice.something),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -269,7 +273,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* something */
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* some2 */
 };
-static asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1 = {
+asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1 = {
 	sizeof(struct Choice1),
 	offsetof(struct Choice1, _asn_ctx),
 	offsetof(struct Choice1, present),
@@ -342,6 +346,8 @@
 /*** <<< FUNC-DECLS [Choice2] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Choice2;
+extern asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1;
+extern asn_TYPE_member_t asn_MBR_Choice2_1[2];
 
 /*** <<< POST-INCLUDE [Choice2] >>> ***/
 
@@ -350,7 +356,7 @@
 
 /*** <<< STAT-DEFS [Choice2] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_Choice2_1[] = {
+asn_TYPE_member_t asn_MBR_Choice2_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct Choice2, choice.typeref),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -376,7 +382,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* typeref */
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* some3 */
 };
-static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = {
+asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = {
 	sizeof(struct Choice2),
 	offsetof(struct Choice2, _asn_ctx),
 	offsetof(struct Choice2, present),
@@ -459,6 +465,8 @@
 /*** <<< FUNC-DECLS [Choice3] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Choice3;
+extern asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1;
+extern asn_TYPE_member_t asn_MBR_Choice3_1[3];
 
 /*** <<< POST-INCLUDE [Choice3] >>> ***/
 
@@ -570,7 +578,7 @@
 	&asn_SPC_c_specs_5	/* Additional specs */
 };
 
-static asn_TYPE_member_t asn_MBR_Choice3_1[] = {
+asn_TYPE_member_t asn_MBR_Choice3_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct Choice3, choice.a),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = 0,
@@ -607,7 +615,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b */
     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* c */
 };
-static asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1 = {
+asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1 = {
 	sizeof(struct Choice3),
 	offsetof(struct Choice3, _asn_ctx),
 	offsetof(struct Choice3, present),
@@ -683,6 +691,8 @@
 /*** <<< FUNC-DECLS [Set] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Set;
+extern asn_SET_OF_specifics_t asn_SPC_Set_specs_1;
+extern asn_TYPE_member_t asn_MBR_Set_1[1];
 
 /*** <<< POST-INCLUDE [Set] >>> ***/
 
@@ -789,7 +799,7 @@
 	&asn_SPC_Member_specs_2	/* Additional specs */
 };
 
-static asn_TYPE_member_t asn_MBR_Set_1[] = {
+asn_TYPE_member_t asn_MBR_Set_1[] = {
 	{ ATF_POINTER, 0, 0,
 		.tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
 		.tag_mode = 0,
@@ -804,7 +814,7 @@
 static const ber_tlv_tag_t asn_DEF_Set_tags_1[] = {
 	(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
 };
-static asn_SET_OF_specifics_t asn_SPC_Set_specs_1 = {
+asn_SET_OF_specifics_t asn_SPC_Set_specs_1 = {
 	sizeof(struct Set),
 	offsetof(struct Set, _asn_ctx),
 	0,	/* XER encoding is XMLDelimitedItemList */
@@ -865,6 +875,8 @@
 /*** <<< FUNC-DECLS [Sequence] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Sequence;
+extern asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1;
+extern asn_TYPE_member_t asn_MBR_Sequence_1[4];
 
 /*** <<< POST-INCLUDE [Sequence] >>> ***/
 
@@ -873,7 +885,7 @@
 
 /*** <<< STAT-DEFS [Sequence] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
+asn_TYPE_member_t asn_MBR_Sequence_1[] = {
 	{ ATF_NOFLAGS, 0, offsetof(struct Sequence, a),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -924,7 +936,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* b */
     { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* set */
 };
-static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = {
+asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = {
 	sizeof(struct Sequence),
 	offsetof(struct Sequence, _asn_ctx),
 	asn_MAP_Sequence_tag2el_1,
@@ -981,84 +993,10 @@
 
 /*** <<< CODE [TypeRef] >>> ***/
 
-int
-TypeRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
-			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
-	/* Replace with underlying type checker */
-	td->check_constraints = asn_DEF_Sequence.check_constraints;
-	return td->check_constraints(td, sptr, ctfailcb, app_key);
-}
-
 /*
  * This type is implemented using Sequence,
  * so here we adjust the DEF accordingly.
  */
-static void
-TypeRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
-	td->free_struct    = asn_DEF_Sequence.free_struct;
-	td->print_struct   = asn_DEF_Sequence.print_struct;
-	td->check_constraints = asn_DEF_Sequence.check_constraints;
-	td->ber_decoder    = asn_DEF_Sequence.ber_decoder;
-	td->der_encoder    = asn_DEF_Sequence.der_encoder;
-	td->xer_decoder    = asn_DEF_Sequence.xer_decoder;
-	td->xer_encoder    = asn_DEF_Sequence.xer_encoder;
-	td->uper_decoder   = asn_DEF_Sequence.uper_decoder;
-	td->uper_encoder   = asn_DEF_Sequence.uper_encoder;
-	td->oer_decoder    = asn_DEF_Sequence.oer_decoder;
-	td->oer_encoder    = asn_DEF_Sequence.oer_encoder;
-	if(!td->oer_constraints)
-		td->oer_constraints = asn_DEF_Sequence.oer_constraints;
-	if(!td->per_constraints)
-		td->per_constraints = asn_DEF_Sequence.per_constraints;
-	td->elements       = asn_DEF_Sequence.elements;
-	td->elements_count = asn_DEF_Sequence.elements_count;
-	td->specifics      = asn_DEF_Sequence.specifics;
-}
-
-void
-TypeRef_free(asn_TYPE_descriptor_t *td,
-		void *struct_ptr, int contents_only) {
-	TypeRef_1_inherit_TYPE_descriptor(td);
-	td->free_struct(td, struct_ptr, contents_only);
-}
-
-int
-TypeRef_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
-		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
-	TypeRef_1_inherit_TYPE_descriptor(td);
-	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
-}
-
-asn_dec_rval_t
-TypeRef_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-		void **structure, const void *bufptr, size_t size, int tag_mode) {
-	TypeRef_1_inherit_TYPE_descriptor(td);
-	return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
-}
-
-asn_enc_rval_t
-TypeRef_encode_der(asn_TYPE_descriptor_t *td,
-		void *structure, int tag_mode, ber_tlv_tag_t tag,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	TypeRef_1_inherit_TYPE_descriptor(td);
-	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
-}
-
-asn_dec_rval_t
-TypeRef_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
-		void **structure, const char *opt_mname, const void *bufptr, size_t size) {
-	TypeRef_1_inherit_TYPE_descriptor(td);
-	return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
-}
-
-asn_enc_rval_t
-TypeRef_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
-		int ilevel, enum xer_encoder_flags_e flags,
-		asn_app_consume_bytes_f *cb, void *app_key) {
-	TypeRef_1_inherit_TYPE_descriptor(td);
-	return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
-}
-
 
 /*** <<< STAT-DEFS [TypeRef] >>> ***/
 
@@ -1068,13 +1006,13 @@
 asn_TYPE_descriptor_t asn_DEF_TypeRef = {
 	"TypeRef",
 	"TypeRef",
-	TypeRef_free,
-	TypeRef_print,
-	TypeRef_constraint,
-	TypeRef_decode_ber,
-	TypeRef_encode_der,
-	TypeRef_decode_xer,
-	TypeRef_encode_xer,
+	SEQUENCE_free,
+	SEQUENCE_print,
+	SEQUENCE_constraint,
+	SEQUENCE_decode_ber,
+	SEQUENCE_encode_der,
+	SEQUENCE_decode_xer,
+	SEQUENCE_encode_xer,
 	0, 0,	/* No OER support, use "-gen-OER" to enable */
 	0, 0,	/* No PER support, use "-gen-PER" to enable */
 	0,	/* Use generic outmost tag fetcher */
@@ -1086,8 +1024,9 @@
 		/sizeof(asn_DEF_TypeRef_tags_1[0]), /* 1 */
 	0,	/* No OER visible constraints */
 	0,	/* No PER visible constraints */
-	0, 0,	/* Defined elsewhere */
-	0	/* No specifics */
+	asn_MBR_Sequence_1,
+	4,	/* Elements count */
+	&asn_SPC_Sequence_specs_1	/* Additional specs */
 };
 
 
@@ -1117,6 +1056,8 @@
 /*** <<< FUNC-DECLS [Alpha] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Alpha;
+extern asn_SEQUENCE_specifics_t asn_SPC_Alpha_specs_1;
+extern asn_TYPE_member_t asn_MBR_Alpha_1[2];
 
 /*** <<< POST-INCLUDE [Alpha] >>> ***/
 
@@ -1179,7 +1120,7 @@
 	&asn_SPC_b_specs_3	/* Additional specs */
 };
 
-static asn_TYPE_member_t asn_MBR_Alpha_1[] = {
+asn_TYPE_member_t asn_MBR_Alpha_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct Alpha, a),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -1208,7 +1149,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* b */
 };
-static asn_SEQUENCE_specifics_t asn_SPC_Alpha_specs_1 = {
+asn_SEQUENCE_specifics_t asn_SPC_Alpha_specs_1 = {
 	sizeof(struct Alpha),
 	offsetof(struct Alpha, _asn_ctx),
 	asn_MAP_Alpha_tag2el_1,
@@ -1266,6 +1207,8 @@
 /*** <<< FUNC-DECLS [Beta] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Beta;
+extern asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1;
+extern asn_TYPE_member_t asn_MBR_Beta_1[2];
 
 /*** <<< POST-INCLUDE [Beta] >>> ***/
 
@@ -1274,7 +1217,7 @@
 
 /*** <<< STAT-DEFS [Beta] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_Beta_1[] = {
+asn_TYPE_member_t asn_MBR_Beta_1[] = {
 	{ ATF_POINTER, 2, offsetof(struct Beta, b),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -1303,7 +1246,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* b */
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* g */
 };
-static asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = {
+asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = {
 	sizeof(struct Beta),
 	offsetof(struct Beta, _asn_ctx),
 	asn_MAP_Beta_tag2el_1,
@@ -1363,6 +1306,8 @@
 /*** <<< FUNC-DECLS [Gamma] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_Gamma;
+extern asn_SEQUENCE_specifics_t asn_SPC_Gamma_specs_1;
+extern asn_TYPE_member_t asn_MBR_Gamma_1[3];
 
 /*** <<< POST-INCLUDE [Gamma] >>> ***/
 
@@ -1372,7 +1317,7 @@
 
 /*** <<< STAT-DEFS [Gamma] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_Gamma_1[] = {
+asn_TYPE_member_t asn_MBR_Gamma_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct Gamma, o),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -1412,7 +1357,7 @@
     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* a */
     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* b */
 };
-static asn_SEQUENCE_specifics_t asn_SPC_Gamma_specs_1 = {
+asn_SEQUENCE_specifics_t asn_SPC_Gamma_specs_1 = {
 	sizeof(struct Gamma),
 	offsetof(struct Gamma, _asn_ctx),
 	asn_MAP_Gamma_tag2el_1,
@@ -1482,6 +1427,8 @@
 /*** <<< FUNC-DECLS [OneTwo] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_OneTwo;
+extern asn_SET_specifics_t asn_SPC_OneTwo_specs_1;
+extern asn_TYPE_member_t asn_MBR_OneTwo_1[1];
 
 /*** <<< POST-INCLUDE [OneTwo] >>> ***/
 
@@ -1489,7 +1436,7 @@
 
 /*** <<< STAT-DEFS [OneTwo] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_OneTwo_1[] = {
+asn_TYPE_member_t asn_MBR_OneTwo_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct OneTwo, m12),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -1510,7 +1457,7 @@
 static const uint8_t asn_MAP_OneTwo_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = {
 	(1 << 7)
 };
-static asn_SET_specifics_t asn_SPC_OneTwo_specs_1 = {
+asn_SET_specifics_t asn_SPC_OneTwo_specs_1 = {
 	sizeof(struct OneTwo),
 	offsetof(struct OneTwo, _asn_ctx),
 	offsetof(struct OneTwo, _presence_map),
@@ -1582,6 +1529,8 @@
 /*** <<< FUNC-DECLS [TwoThree] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_TwoThree;
+extern asn_SET_specifics_t asn_SPC_TwoThree_specs_1;
+extern asn_TYPE_member_t asn_MBR_TwoThree_1[1];
 
 /*** <<< POST-INCLUDE [TwoThree] >>> ***/
 
@@ -1589,7 +1538,7 @@
 
 /*** <<< STAT-DEFS [TwoThree] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_TwoThree_1[] = {
+asn_TYPE_member_t asn_MBR_TwoThree_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct TwoThree, m23),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -1610,7 +1559,7 @@
 static const uint8_t asn_MAP_TwoThree_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = {
 	(1 << 7)
 };
-static asn_SET_specifics_t asn_SPC_TwoThree_specs_1 = {
+asn_SET_specifics_t asn_SPC_TwoThree_specs_1 = {
 	sizeof(struct TwoThree),
 	offsetof(struct TwoThree, _asn_ctx),
 	offsetof(struct TwoThree, _presence_map),
@@ -1685,6 +1634,8 @@
 /*** <<< FUNC-DECLS [ThreeOne] >>> ***/
 
 extern asn_TYPE_descriptor_t asn_DEF_ThreeOne;
+extern asn_SET_specifics_t asn_SPC_ThreeOne_specs_1;
+extern asn_TYPE_member_t asn_MBR_ThreeOne_1[2];
 
 /*** <<< POST-INCLUDE [ThreeOne] >>> ***/
 
@@ -1693,7 +1644,7 @@
 
 /*** <<< STAT-DEFS [ThreeOne] >>> ***/
 
-static asn_TYPE_member_t asn_MBR_ThreeOne_1[] = {
+asn_TYPE_member_t asn_MBR_ThreeOne_1[] = {
 	{ ATF_POINTER, 0, offsetof(struct ThreeOne, m31),
 		.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
 		.tag_mode = -1,	/* IMPLICIT tag at current level */
@@ -1725,7 +1676,7 @@
 static const uint8_t asn_MAP_ThreeOne_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = {
 	(1 << 7) | (1 << 6)
 };
-static asn_SET_specifics_t asn_SPC_ThreeOne_specs_1 = {
+asn_SET_specifics_t asn_SPC_ThreeOne_specs_1 = {
 	sizeof(struct ThreeOne),
 	offsetof(struct ThreeOne, _asn_ctx),
 	offsetof(struct ThreeOne, _presence_map),