%% Generated by prepare_templates. DO NOT EDIT THIS FILE.
%%
%% Input files:
%%  asn1rtt_check.beam
%%  asn1rtt_ext.beam
%%  asn1rtt_per_common.beam
%%  asn1rtt_real_common.beam
%%  asn1rtt_ber.beam
%%  asn1rtt_jer.beam
%%  asn1rtt_per.beam
%%  asn1rtt_uper.beam

-module(asn1ct_rtt).
-export([assert_defined/1,dependencies/1,code/0]).

assert_defined({ber,ber_decode_erlang,1}) -> ok;
assert_defined({ber,ber_decode_nif,1}) -> ok;
assert_defined({ber,ber_encode,1}) -> ok;
assert_defined({ber,compact_bit_string_size,1}) -> ok;
assert_defined({ber,decode_BMP_string,2}) -> ok;
assert_defined({ber,decode_UTF8_string,2}) -> ok;
assert_defined({ber,decode_boolean,2}) -> ok;
assert_defined({ber,decode_compact_bit_string,2}) -> ok;
assert_defined({ber,decode_integer,2}) -> ok;
assert_defined({ber,decode_named_bit_string,3}) -> ok;
assert_defined({ber,decode_native_bit_string,2}) -> ok;
assert_defined({ber,decode_null,2}) -> ok;
assert_defined({ber,decode_object_identifier,2}) -> ok;
assert_defined({ber,decode_octet_string,2}) -> ok;
assert_defined({ber,decode_open_type,2}) -> ok;
assert_defined({ber,decode_open_type_as_binary,2}) -> ok;
assert_defined({ber,decode_primitive_incomplete,2}) -> ok;
assert_defined({ber,decode_relative_oid,2}) -> ok;
assert_defined({ber,decode_restricted_string,2}) -> ok;
assert_defined({ber,decode_selective,2}) -> ok;
assert_defined({ber,decode_universal_string,2}) -> ok;
assert_defined({ber,dynamicsort_SETOF,1}) -> ok;
assert_defined({ber,dynamicsort_SET_components,1}) -> ok;
assert_defined({ber,encode_BMP_string,2}) -> ok;
assert_defined({ber,encode_UTF8_string,2}) -> ok;
assert_defined({ber,encode_bit_string,4}) -> ok;
assert_defined({ber,encode_boolean,2}) -> ok;
assert_defined({ber,encode_integer,2}) -> ok;
assert_defined({ber,encode_integer,3}) -> ok;
assert_defined({ber,encode_named_bit_string,3}) -> ok;
assert_defined({ber,encode_named_bit_string,4}) -> ok;
assert_defined({ber,encode_null,2}) -> ok;
assert_defined({ber,encode_object_identifier,2}) -> ok;
assert_defined({ber,encode_open_type,2}) -> ok;
assert_defined({ber,encode_relative_oid,2}) -> ok;
assert_defined({ber,encode_restricted_string,2}) -> ok;
assert_defined({ber,encode_tags,3}) -> ok;
assert_defined({ber,encode_universal_string,2}) -> ok;
assert_defined({ber,encode_unnamed_bit_string,2}) -> ok;
assert_defined({ber,encode_unnamed_bit_string,3}) -> ok;
assert_defined({ber,match_tags,2}) -> ok;
assert_defined({ber,native_to_legacy_bit_string,1}) -> ok;
assert_defined({ber,number2name,2}) -> ok;
assert_defined({ber,skip_ExtensionAdditions,2}) -> ok;
assert_defined({check,check_fail,1}) -> ok;
assert_defined({check,check_int,3}) -> ok;
assert_defined({check,check_legacy_bitstring,2}) -> ok;
assert_defined({check,check_legacy_named_bitstring,3}) -> ok;
assert_defined({check,check_legacy_named_bitstring,4}) -> ok;
assert_defined({check,check_literal_sof,2}) -> ok;
assert_defined({check,check_named_bitstring,3}) -> ok;
assert_defined({check,check_named_bitstring,4}) -> ok;
assert_defined({check,check_objectdescriptor,2}) -> ok;
assert_defined({check,check_objectidentifier,2}) -> ok;
assert_defined({check,check_octetstring,2}) -> ok;
assert_defined({check,check_real,2}) -> ok;
assert_defined({check,check_restrictedstring,2}) -> ok;
assert_defined({ext,transform_to_EXTERNAL1990,1}) -> ok;
assert_defined({ext,transform_to_EXTERNAL1990_maps,1}) -> ok;
assert_defined({ext,transform_to_EXTERNAL1994,1}) -> ok;
assert_defined({ext,transform_to_EXTERNAL1994_maps,1}) -> ok;
assert_defined({jer,decode_jer,3}) -> ok;
assert_defined({jer,encode_jer,3}) -> ok;
assert_defined({per,complete,1}) -> ok;
assert_defined({per,encode_fragmented_sof,3}) -> ok;
assert_defined({per,skipextensions,3}) -> ok;
assert_defined({per_common,adjust_trailing_zeroes,2}) -> ok;
assert_defined({per_common,bitstring_from_positions,1}) -> ok;
assert_defined({per_common,bitstring_from_positions,2}) -> ok;
assert_defined({per_common,bs_drop_trailing_zeroes,1}) -> ok;
assert_defined({per_common,decode_big_chars,2}) -> ok;
assert_defined({per_common,decode_chars,2}) -> ok;
assert_defined({per_common,decode_chars,3}) -> ok;
assert_defined({per_common,decode_chars_16bit,1}) -> ok;
assert_defined({per_common,decode_compact_bit_string,1}) -> ok;
assert_defined({per_common,decode_fragmented,3}) -> ok;
assert_defined({per_common,decode_legacy_bit_string,1}) -> ok;
assert_defined({per_common,decode_named_bit_string,2}) -> ok;
assert_defined({per_common,decode_oid,1}) -> ok;
assert_defined({per_common,decode_relative_oid,1}) -> ok;
assert_defined({per_common,encode_big_chars,1}) -> ok;
assert_defined({per_common,encode_chars,2}) -> ok;
assert_defined({per_common,encode_chars,3}) -> ok;
assert_defined({per_common,encode_chars_16bit,1}) -> ok;
assert_defined({per_common,encode_chars_compact_map,3}) -> ok;
assert_defined({per_common,encode_fragmented,2}) -> ok;
assert_defined({per_common,encode_oid,1}) -> ok;
assert_defined({per_common,encode_relative_oid,1}) -> ok;
assert_defined({per_common,encode_unconstrained_number,1}) -> ok;
assert_defined({per_common,extension_bitmap,3}) -> ok;
assert_defined({per_common,is_default_bitstring,3}) -> ok;
assert_defined({per_common,is_default_bitstring,5}) -> ok;
assert_defined({per_common,legacy_open_type_to_binary,1}) -> ok;
assert_defined({per_common,open_type_to_binary,1}) -> ok;
assert_defined({per_common,to_bitstring,1}) -> ok;
assert_defined({per_common,to_bitstring,2}) -> ok;
assert_defined({per_common,to_named_bitstring,1}) -> ok;
assert_defined({per_common,to_named_bitstring,2}) -> ok;
assert_defined({real_common,ber_encode_real,1}) -> ok;
assert_defined({real_common,decode_real,1}) -> ok;
assert_defined({real_common,encode_real,1}) -> ok;
assert_defined({uper,complete,1}) -> ok;
assert_defined({uper,complete_NFP,1}) -> ok;
assert_defined({uper,encode_fragmented_sof,3}) -> ok;
assert_defined({uper,skipextensions,3}) -> ok.

dependencies({ber,ber_decode_erlang,1}) ->
[{ber,decode_primitive,1}];
dependencies({ber,collect_parts,1}) ->
[{ber,collect_parts,2}];
dependencies({ber,collect_parts,2}) ->
[{ber,collect_parts,1},{ber,collect_parts,2},{ber,collect_parts_bit,3}];
dependencies({ber,dec_subidentifiers,3}) ->
[{ber,dec_subidentifiers,3}];
dependencies({ber,decode_BMP_string,2}) ->
[{ber,match_and_collect,2},{ber,mk_BMP_string,1}];
dependencies({ber,decode_UTF8_string,2}) ->
[{ber,collect_parts,1},{ber,match_tags,2}];
dependencies({ber,decode_bitstring_NNL,2}) ->
[{ber,decode_bitstring_NNL,4}];
dependencies({ber,decode_bitstring_NNL,4}) ->
[{ber,decode_bitstring_NNL,4}];
dependencies({ber,decode_boolean,2}) ->
[{ber,match_tags,2}];
dependencies({ber,decode_compact_bit_string,2}) ->
[{ber,match_and_collect,2}];
dependencies({ber,decode_constr_indef_incomplete,3}) ->
[{ber,decode_constr_indef_incomplete,3},{ber,decode_primitive_incomplete,2}];
dependencies({ber,decode_constructed,1}) ->
[{ber,decode_primitive,1}];
dependencies({ber,decode_constructed_incomplete,2}) ->
[{ber,decode_constructed_incomplete,2},
 {ber,decode_parts_incomplete,1},
 {ber,decode_primitive,1},
 {ber,decode_primitive_incomplete,2},
 {ber,decode_tag_and_length,1},
 {ber,incomplete_choice_alt,2}];
dependencies({ber,decode_constructed_indefinite,2}) ->
[{ber,decode_primitive,1}];
dependencies({ber,decode_incomplete2,5}) ->
[{ber,decode_constr_indef_incomplete,3},{ber,decode_constructed_incomplete,2}];
dependencies({ber,decode_incomplete_bin,1}) ->
[{ber,skip_length_and_value,1},{ber,skip_tag,1}];
dependencies({ber,decode_integer,2}) ->
[{ber,match_tags,2}];
dependencies({ber,decode_named_bit_string,3}) ->
[{ber,decode_bitstring2,3},
 {ber,decode_bitstring_NNL,2},
 {ber,match_and_collect,2}];
dependencies({ber,decode_native_bit_string,2}) ->
[{ber,match_and_collect,2}];
dependencies({ber,decode_null,2}) ->
[{ber,match_tags,2}];
dependencies({ber,decode_object_identifier,2}) ->
[{ber,dec_subidentifiers,3},{ber,match_tags,2}];
dependencies({ber,decode_octet_string,2}) ->
[{ber,match_and_collect,2}];
dependencies({ber,decode_open_type,2}) ->
[{ber,ber_decode_nif,1},{ber,match_tags,2}];
dependencies({ber,decode_open_type_as_binary,2}) ->
[{ber,ber_encode,1},{ber,match_tags,2}];
dependencies({ber,decode_parts_incomplete,1}) ->
[{ber,skip_length_and_value,1},{ber,skip_tag,1}];
dependencies({ber,decode_primitive,1}) ->
[{ber,decode_constructed,1},
 {ber,decode_constructed_indefinite,2},
 {ber,decode_tag_and_length,1}];
dependencies({ber,decode_primitive_incomplete,2}) ->
[{ber,decode_incomplete2,5},
 {ber,decode_incomplete_bin,1},
 {ber,decode_parts_incomplete,1},
 {ber,decode_primitive,1},
 {ber,decode_primitive_incomplete,2},
 {ber,decode_tag_and_length,1}];
dependencies({ber,decode_relative_oid,2}) ->
[{ber,dec_subidentifiers,3},{ber,match_tags,2}];
dependencies({ber,decode_restricted_string,2}) ->
[{ber,match_and_collect,2}];
dependencies({ber,decode_selective,2}) ->
[{ber,decode_selective,2},
 {ber,get_value,1},
 {ber,return_value,2},
 {ber,skip_length_and_value,1},
 {ber,skip_optional_tag,2},
 {ber,skip_tag,1}];
dependencies({ber,decode_tag_and_length,1}) ->
[{ber,decode_length,1},{ber,decode_tag,2}];
dependencies({ber,decode_universal_string,2}) ->
[{ber,match_and_collect,2},{ber,mk_universal_string,1}];
dependencies({ber,do_encode_named_bit_string,3}) ->
[{ber,encode_bitstring,1},
 {ber,encode_tags,3},
 {ber,get_all_bitposes,3},
 {ber,make_and_set_list,3}];
dependencies({ber,do_encode_named_bit_string,4}) ->
[{ber,encode_bitstring,1},
 {ber,encode_tags,3},
 {ber,get_all_bitposes,3},
 {ber,make_and_set_list,3}];
dependencies({ber,dynamicsort_SET_components,1}) ->
[{ber,dynsort_decode_tag,1}];
dependencies({ber,dynsort_decode_tag,1}) ->
[{ber,dynsort_decode_tag,2}];
dependencies({ber,e_object_identifier,1}) ->
[{ber,e_object_identifier,1},{ber,enc_obj_id_tail,2},{ber,mk_object_val,1}];
dependencies({ber,enc_obj_id_tail,2}) ->
[{ber,mk_object_val,1}];
dependencies({ber,enc_relative_oid,1}) ->
[{ber,mk_object_val,1}];
dependencies({ber,encode_BMP_string,2}) ->
[{ber,encode_tags,3},{ber,mk_BMP_list,1}];
dependencies({ber,encode_UTF8_string,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_bin_bit_string,4}) ->
[{ber,remove_unused_then_dotag,3}];
dependencies({ber,encode_bit_string,4}) ->
[{ber,encode_bin_bit_string,4},
 {ber,encode_bit_string_bits,4},
 {ber,encode_bit_string_named,4},
 {ber,encode_tags,3},
 {ber,int_to_bitlist,1}];
dependencies({ber,encode_bit_string_bits,4}) ->
[{ber,encode_bitstring,1},
 {ber,encode_constr_bit_str_bits,3},
 {ber,encode_tags,3},
 {ber,pad_bit_list,2}];
dependencies({ber,encode_bit_string_named,4}) ->
[{ber,encode_bitstring,1},
 {ber,encode_tags,3},
 {ber,get_all_bitposes,3},
 {ber,make_and_set_list,3}];
dependencies({ber,encode_bitstring,1}) ->
[{ber,encode_bitstring,3},{ber,unused_bitlist,3}];
dependencies({ber,encode_bitstring,3}) ->
[{ber,unused_bitlist,3}];
dependencies({ber,encode_boolean,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_constr_bit_str_bits,3}) ->
[{ber,encode_bitstring,1},{ber,encode_tags,3}];
dependencies({ber,encode_integer,1}) ->
[{ber,encode_integer_neg,2},{ber,encode_integer_pos,2}];
dependencies({ber,encode_integer,2}) ->
[{ber,encode_integer,1},{ber,encode_tags,2}];
dependencies({ber,encode_integer,3}) ->
[{ber,encode_integer,1},{ber,encode_tags,2}];
dependencies({ber,encode_length,1}) ->
[{ber,minimum_octets,1}];
dependencies({ber,encode_named_bit_string,3}) ->
[{ber,do_encode_named_bit_string,3},{ber,encode_unnamed_bit_string,2}];
dependencies({ber,encode_named_bit_string,4}) ->
[{ber,do_encode_named_bit_string,4},{ber,encode_unnamed_bit_string,3}];
dependencies({ber,encode_null,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_object_identifier,2}) ->
[{ber,e_object_identifier,1},{ber,encode_tags,2}];
dependencies({ber,encode_open_type,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_relative_oid,2}) ->
[{ber,enc_relative_oid,1},{ber,encode_tags,2}];
dependencies({ber,encode_restricted_string,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_tags,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_tags,3}) ->
[{ber,encode_length,1}];
dependencies({ber,encode_universal_string,2}) ->
[{ber,encode_tags,3},{ber,mk_uni_list,1}];
dependencies({ber,encode_unnamed_bit_string,2}) ->
[{ber,encode_tags,3}];
dependencies({ber,encode_unnamed_bit_string,3}) ->
[{ber,encode_tags,3}];
dependencies({ber,get_all_bitposes,3}) ->
[{ber,get_all_bitposes,3}];
dependencies({ber,get_indefinite_length_and_value,1}) ->
[{ber,get_indefinite_length_and_value,2}];
dependencies({ber,get_indefinite_length_and_value,2}) ->
[{ber,get_length_and_value,1},{ber,get_tag,1}];
dependencies({ber,get_indefinite_value,2}) ->
[{ber,get_length_and_value,1},{ber,get_tag,1}];
dependencies({ber,get_length_and_value,1}) ->
[{ber,get_indefinite_length_and_value,1}];
dependencies({ber,get_tag,1}) ->
[{ber,get_long_tag,2}];
dependencies({ber,get_value,1}) ->
[{ber,decode_length,1},{ber,get_indefinite_value,2}];
dependencies({ber,incomplete_choice_alt,2}) ->
[{ber,incomplete_choice_alt,2}];
dependencies({ber,make_and_set_list,3}) ->
[{ber,make_and_set_list,3}];
dependencies({ber,match_and_collect,2}) ->
[{ber,collect_parts,1},{ber,match_tags,2}];
dependencies({ber,match_tags,2}) ->
[{ber,match_tags,2}];
dependencies({ber,minimum_octets,1}) ->
[{ber,minimum_octets,2}];
dependencies({ber,mk_BMP_list,1}) ->
[{ber,mk_BMP_list,2}];
dependencies({ber,mk_BMP_list,2}) ->
[{ber,mk_BMP_list,2}];
dependencies({ber,mk_BMP_string,1}) ->
[{ber,mk_BMP_string,2}];
dependencies({ber,mk_BMP_string,2}) ->
[{ber,mk_BMP_string,2}];
dependencies({ber,mk_object_val,1}) ->
[{ber,mk_object_val,3}];
dependencies({ber,mk_uni_list,1}) ->
[{ber,mk_uni_list,2}];
dependencies({ber,mk_uni_list,2}) ->
[{ber,mk_uni_list,2}];
dependencies({ber,mk_universal_string,1}) ->
[{ber,mk_universal_string,2}];
dependencies({ber,mk_universal_string,2}) ->
[{ber,mk_universal_string,2}];
dependencies({ber,remove_unused_then_dotag,3}) ->
[{ber,encode_tags,3}];
dependencies({ber,return_value,2}) ->
[{ber,get_length_and_value,1},{ber,get_tag,1}];
dependencies({ber,skip_indefinite_value,1}) ->
[{ber,skip_length_and_value,1},{ber,skip_tag,1}];
dependencies({ber,skip_length_and_value,1}) ->
[{ber,decode_length,1},{ber,skip_indefinite_value,1}];
dependencies({ber,skip_tag,1}) ->
[{ber,skip_long_tag,1}];
dependencies({check,check_bitstring,2}) ->
[{check,check_bitstring_integer,2},{check,check_bitstring_list,2}];
dependencies({check,check_legacy_bitstring,2}) ->
[{check,check_bitstring,2}];
dependencies({check,check_legacy_named_bitstring,3}) ->
[{check,check_named_bitstring,3},{check,legacy_int_to_bitlist,1}];
dependencies({check,check_legacy_named_bitstring,4}) ->
[{check,check_named_bitstring,4},{check,legacy_int_to_bitlist,1}];
dependencies({check,check_objectidentifier,2}) ->
[{check,check_oid,3}];
dependencies({check,check_restrictedstring,2}) ->
[{check,check_restrictedstring,2}];
dependencies({ext,transform_to_EXTERNAL1990,1}) ->
[{ext,transform_to_EXTERNAL1990,2}];
dependencies({ext,transform_to_EXTERNAL1990,2}) ->
[{ext,transform_to_EXTERNAL1990,2}];
dependencies({jer,bitstring2json,1}) ->
[{jer,octetstring2json,1}];
dependencies({jer,decode_jer,2}) ->
[{jer,decode_jer,2},
 {jer,decode_jer_component,3},
 {jer,decode_jer_component_map,3},
 {jer,jer_bitstr2compact,1},
 {jer,jer_bitstr2names,2},
 {jer,json2bitstring,2},
 {jer,json2octetstring2binary,1},
 {jer,json2octetstring2string,1},
 {jer,json2oid,1}];
dependencies({jer,decode_jer,3}) ->
[{jer,decode_jer,2}];
dependencies({jer,decode_jer_component,3}) ->
[{jer,decode_jer,2},{jer,decode_jer_component,3}];
dependencies({jer,decode_jer_component_map,3}) ->
[{jer,decode_jer,2},{jer,decode_jer_component_map,3}];
dependencies({jer,encode_bitstring,1}) ->
[{jer,encode_bitstring,2},{jer,unused_bitlist,2}];
dependencies({jer,encode_bitstring,2}) ->
[{jer,unused_bitlist,2}];
dependencies({jer,encode_jer,2}) ->
[{jer,bitstring2json,1},
 {jer,encode_jer,2},
 {jer,encode_jer_component,3},
 {jer,encode_jer_component_map,3},
 {jer,encode_jer_component_tab,4},
 {jer,jer_bit_str2bitstr,2},
 {jer,jer_compact2bitstr,1},
 {jer,jer_padbitstr,2},
 {jer,oid2json,1}];
dependencies({jer,encode_jer,3}) ->
[{jer,encode_jer,2}];
dependencies({jer,encode_jer_component,3}) ->
[{jer,encode_jer,2},{jer,encode_jer_component,3}];
dependencies({jer,encode_jer_component_map,3}) ->
[{jer,encode_jer,2},{jer,encode_jer_component_map,3}];
dependencies({jer,encode_jer_component_tab,4}) ->
[{jer,encode_jer,2},{jer,encode_jer_component_tab,4}];
dependencies({jer,jer_bit_str2bitstr,2}) ->
[{jer,jer_compact2bitstr,1},{jer,jer_do_encode_named_bit_string,2}];
dependencies({jer,jer_bitstr2names,2}) ->
[{jer,jer_bitstr2names,4}];
dependencies({jer,jer_bitstr2names,4}) ->
[{jer,jer_bitstr2names,4}];
dependencies({jer,jer_compact2bitstr,1}) ->
[{jer,jer_int2bitstr,1},{jer,jer_skip_trailing_zeroes,2}];
dependencies({jer,jer_do_encode_named_bit_string,2}) ->
[{jer,encode_bitstring,1},
 {jer,jer_get_all_bitposes,3},
 {jer,jer_make_and_set_list,3}];
dependencies({jer,jer_get_all_bitposes,3}) ->
[{jer,jer_get_all_bitposes,3}];
dependencies({jer,jer_int2bitstr,1}) ->
[{jer,jer_int2bitstr,2}];
dependencies({jer,jer_make_and_set_list,3}) ->
[{jer,jer_make_and_set_list,3}];
dependencies({jer,jer_skip_trailing_zeroes,2}) ->
[{jer,jer_skip_trailing_zeroes,2}];
dependencies({jer,json2bitstring,2}) ->
[{jer,json2bitstring,3}];
dependencies({jer,json2octetstring2binary,1}) ->
[{jer,json2octetstring,2}];
dependencies({jer,json2octetstring2string,1}) ->
[{jer,json2octetstring,2}];
dependencies({jer,oid2json,1}) ->
[{jer,oid2json,2}];
dependencies({jer,oid2json,2}) ->
[{jer,oid2json,2}];
dependencies({per,complete,1}) ->
[{per,complete,2}];
dependencies({per,complete,2}) ->
[{per,complete,2},{per,complete,3}];
dependencies({per,complete,3}) ->
[{per,complete,2},{per,complete,3}];
dependencies({per,decode_length,1}) ->
[{per,align,1}];
dependencies({per,encode_fragmented_sof,3}) ->
[{per,encode_fragmented_sof_1,4}];
dependencies({per,encode_fragmented_sof_1,4}) ->
[{per,encode_components,4},{per,encode_fragmented_sof_1,4}];
dependencies({per,skipextensions,3}) ->
[{per,decode_length,1},{per,skipextensions,3}];
dependencies({per_common,adjust_trailing_zeroes,2}) ->
[{per_common,bs_drop_trailing_zeroes,1}];
dependencies({per_common,bitstring_from_positions,1}) ->
[{per_common,diff,2}];
dependencies({per_common,bitstring_from_positions,2}) ->
[{per_common,diff,3}];
dependencies({per_common,bs_drop_trailing_zeroes,1}) ->
[{per_common,bs_drop_trailing_zeroes,2}];
dependencies({per_common,bs_drop_trailing_zeroes,2}) ->
[{per_common,ntz,1}];
dependencies({per_common,dec_subidentifiers,3}) ->
[{per_common,dec_subidentifiers,3}];
dependencies({per_common,decode_big_chars,2}) ->
[{per_common,decode_big_chars_1,1},{per_common,decode_chars,2}];
dependencies({per_common,decode_big_chars_1,1}) ->
[{per_common,decode_big_chars_1,1}];
dependencies({per_common,decode_chars_16bit,1}) ->
[{per_common,decode_chars_16bit_1,1}];
dependencies({per_common,decode_chars_16bit_1,1}) ->
[{per_common,decode_chars_16bit_1,1}];
dependencies({per_common,decode_fragmented,3}) ->
[{per_common,decode_fragmented_1,3}];
dependencies({per_common,decode_named_bit_string,2}) ->
[{per_common,decode_named_bit_string_1,4}];
dependencies({per_common,decode_named_bit_string_1,4}) ->
[{per_common,decode_named_bit_string_1,4}];
dependencies({per_common,decode_oid,1}) ->
[{per_common,dec_subidentifiers,3}];
dependencies({per_common,decode_relative_oid,1}) ->
[{per_common,dec_subidentifiers,3}];
dependencies({per_common,e_object_element,1}) ->
[{per_common,e_o_e,1}];
dependencies({per_common,e_object_elements,2}) ->
[{per_common,e_object_element,1}];
dependencies({per_common,e_object_identifier,1}) ->
[{per_common,e_object_elements,2}];
dependencies({per_common,enc_char,3}) ->
[{per_common,illegal_char_error,0}];
dependencies({per_common,enc_char_cm,3}) ->
[{per_common,illegal_char_error,0}];
dependencies({per_common,encode_chars,3}) ->
[{per_common,enc_char,3}];
dependencies({per_common,encode_chars_compact_map,3}) ->
[{per_common,enc_char_cm,3}];
dependencies({per_common,encode_fragmented,2}) ->
[{per_common,encode_fragmented_1,3}];
dependencies({per_common,encode_fragmented_1,3}) ->
[{per_common,encode_fragmented_1,3}];
dependencies({per_common,encode_oid,1}) ->
[{per_common,e_object_identifier,1}];
dependencies({per_common,encode_relative_oid,1}) ->
[{per_common,e_object_element,1}];
dependencies({per_common,encode_unconstrained_number,1}) ->
[{per_common,enint,2}];
dependencies({per_common,extension_bitmap,3}) ->
[{per_common,extension_bitmap,4}];
dependencies({per_common,is_default_bitstring,5}) ->
[{per_common,is_default_bitstring_list,2}];
dependencies({per_common,to_bitstring,1}) ->
[{per_common,int_to_bitlist,1}];
dependencies({per_common,to_bitstring,2}) ->
[{per_common,adjust_size,2},{per_common,int_to_bitlist,1}];
dependencies({per_common,to_named_bitstring,1}) ->
[{per_common,bs_drop_trailing_zeroes,1},{per_common,to_bitstring,1}];
dependencies({per_common,to_named_bitstring,2}) ->
[{per_common,adjust_trailing_zeroes,2},{per_common,to_bitstring,1}];
dependencies({real_common,ber_encode_real,1}) ->
[{real_common,encode_real,1}];
dependencies({real_common,decode_real,1}) ->
[{real_common,decode_real2,4}];
dependencies({real_common,decode_real2,4}) ->
[{real_common,decode_integer2,3}];
dependencies({real_common,encode_real,1}) ->
[{real_common,encode_real,2}];
dependencies({real_common,encode_real,2}) ->
[{real_common,encode_neg_integer,2},
 {real_common,encode_pos_integer,2},
 {real_common,encode_real_as_string,3},
 {real_common,real_mininum_octets,1},
 {real_common,remove_trailing_zeros,1},
 {real_common,truncate_zeros,1}];
dependencies({real_common,encode_real_as_string,3}) ->
[{real_common,remove_trailing_zeros,1}];
dependencies({real_common,real_mininum_octets,1}) ->
[{real_common,real_mininum_octets,2}];
dependencies({real_common,truncate_zeros,1}) ->
[{real_common,truncate_zeros,2}];
dependencies({uper,encode_fragmented_sof,3}) ->
[{uper,encode_fragmented_sof_1,4}];
dependencies({uper,encode_fragmented_sof_1,4}) ->
[{uper,encode_components,4},{uper,encode_fragmented_sof_1,4}];
dependencies({uper,skipextensions,3}) ->
[{uper,decode_length,1},{uper,skipextensions,3}];
dependencies(_) -> [].

code() ->
[{{ber,ber_encode,1},
  <<"\nber_encode([Tlv]) ->\n    ber_encode(Tlv);\nber_encode(Tlv) when is_binary(Tlv) ->\n    Tlv;\nber_encode(Tlv) ->\n    asn1rt_nif:encode_ber_tlv(Tlv).\n">>},
 {{ber,ber_decode_nif,1},
  <<"\nber_decode_nif(B) ->\n    asn1rt_nif:decode_ber_tlv(B).\n">>},
 {{ber,ber_decode_erlang,1},
  <<"\nber_decode_erlang(B) when is_binary(B) ->\n    decode_primitive(B);\nber_decode_erlang(Tlv) ->\n    {Tlv, <<>>}.\n">>},
 {{ber,decode_primitive,1},
  <<"\ndecode_primitive(Bin) ->\n    {Form, TagNo, V, Rest} = decode_tag_and_length(Bin),\n    case Form of\n        1 ->\n            {{TagNo, decode_constructed(V)}, Rest};\n        0 ->\n            {{TagNo, V}, Rest};\n        2 ->\n            {Vlist, Rest2} = decode_constructed_indefinite(V, []),\n            {{TagNo, Vlist}, Rest2}\n    end.\n">>},
 {{ber,decode_constructed,1},
  <<"\ndecode_constructed(Bin) when byte_size(Bin) =:= 0 ->\n    [];\ndecode_constructed(Bin) ->\n    {Tlv, Rest} = decode_primitive(Bin),\n    [Tlv | decode_constructed(Rest)].\n">>},
 {{ber,decode_constructed_indefinite,2},
  <<"\ndecode_constructed_indefinite(<<0,0,Rest/binary>>, Acc) ->\n    {lists:reverse(Acc), Rest};\ndecode_constructed_indefinite(Bin, Acc) ->\n    {Tlv, Rest} = decode_primitive(Bin),\n    decode_constructed_indefinite(Rest, [Tlv | Acc]).\n">>},
 {{ber,decode_primitive_incomplete,2},
  <<"\ndecode_primitive_incomplete([[default, TagNo]], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {Form, TagNo, V, Rest} ->\n            decode_incomplete2(Form, TagNo, V, [], Rest);\n        _ ->\n            asn1_NOVALUE\n    end;\ndecode_primitive_incomplete([[default, TagNo, Directives]], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {Form, TagNo, V, Rest} ->\n            decode_incomplete2(Form, TagNo, V, Directives, Rest);\n        _ ->\n            asn1_NOVALUE\n    end;\ndecode_primitive_incomplete([[opt, TagNo]], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {Form, TagNo, V, Rest} ->\n            decode_incomplete2(Form, TagNo, V, [], Rest);\n        _ ->\n            asn1_NOVALUE\n    end;\ndecode_primitive_incomplete([[opt, TagNo, Directives]], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {Form, TagNo, V, Rest} ->\n            decode_incomplete2(Form, TagNo, V, Directives, Rest);\n        _ ->\n            asn1_NOVALUE\n    end;\ndecode_primitive_incomplete([[opt_undec, Tag]], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {_, Tag, _, _} ->\n            decode_incomplete_bin(Bin);\n        _ ->\n            asn1_NOVALUE\n    end;\ndecode_primitive_incomplete([[alt_undec, TagNo] | RestAlts], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {_, TagNo, _, _} ->\n            decode_incomplete_bin(Bin);\n        _ ->\n            decode_primitive_incomplete(RestAlts, Bin)\n    end;\ndecode_primitive_incomplete([[alt, TagNo] | RestAlts], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {_Form, TagNo, V, Rest} ->\n            {{TagNo, V}, Rest};\n        _ ->\n            decode_primitive_incomplete(RestAlts, Bin)\n    end;\ndecode_primitive_incomplete([[alt, TagNo, Directives] | RestAlts], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {Form, TagNo, V, Rest} ->\n            decode_incomplete2(Form, TagNo, V, Directives, Rest);\n        _ ->\n            decode_primitive_incomplete(RestAlts, Bin)\n    end;\ndecode_primitive_incomplete([[alt_parts, TagNo]], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {_Form, TagNo, V, Rest} ->\n            {{TagNo, V}, Rest};\n        _ ->\n            asn1_NOVALUE\n    end;\ndecode_primitive_incomplete([[alt_parts, TagNo] | RestAlts], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {_Form, TagNo, V, Rest} ->\n            {{TagNo, decode_parts_incomplete(V)}, Rest};\n        _ ->\n            decode_primitive_incomplete(RestAlts, Bin)\n    end;\ndecode_primitive_incomplete([[undec, _TagNo] | _RestTag], Bin) ->\n    decode_incomplete_bin(Bin);\ndecode_primitive_incomplete([[parts, TagNo] | _RestTag], Bin) ->\n    case decode_tag_and_length(Bin) of\n        {_Form, TagNo, V, Rest} ->\n            {{TagNo, decode_parts_incomplete(V)}, Rest};\n        Err ->\n            {error, {asn1, \"tag failure\", TagNo, Err}}\n    end;\ndecode_primitive_incomplete([mandatory | RestTag], Bin) ->\n    {Form, TagNo, V, Rest} = decode_tag_and_length(Bin),\n    decode_incomplete2(Form, TagNo, V, RestTag, Rest);\ndecode_primitive_incomplete([[mandatory | Directives]], Bin) ->\n    {Form, TagNo, V, Rest} = decode_tag_and_length(Bin),\n    decode_incomplete2(Form, TagNo, V, Directives, Rest);\ndecode_primitive_incomplete([], Bin) ->\n    decode_primitive(Bin).\n">>},
 {{ber,decode_parts_incomplete,1},
  <<"\ndecode_parts_incomplete(<<>>) ->\n    [];\ndecode_parts_incomplete(Bin) ->\n    {ok, Rest} = skip_tag(Bin),\n    {ok, Rest2} = skip_length_and_value(Rest),\n    LenPart = byte_size(Bin) - byte_size(Rest2),\n    <<Part:LenPart/binary,RestBin/binary>> = Bin,\n    [Part | decode_parts_incomplete(RestBin)].\n">>},
 {{ber,decode_incomplete2,5},
  <<"\ndecode_incomplete2(_Form = 2, TagNo, V, TagMatch, _) ->\n    {Vlist, Rest2} = decode_constr_indef_incomplete(TagMatch, V, []),\n    {{TagNo, Vlist}, Rest2};\ndecode_incomplete2(1, TagNo, V, [TagMatch], Rest) when is_list(TagMatch) ->\n    {{TagNo, decode_constructed_incomplete(TagMatch, V)}, Rest};\ndecode_incomplete2(1, TagNo, V, TagMatch, Rest) ->\n    {{TagNo, decode_constructed_incomplete(TagMatch, V)}, Rest};\ndecode_incomplete2(0, TagNo, V, _TagMatch, Rest) ->\n    {{TagNo, V}, Rest}.\n">>},
 {{ber,decode_constructed_incomplete,2},
  <<"\ndecode_constructed_incomplete([Tags = [Ts]], Bin) when is_list(Ts) ->\n    decode_constructed_incomplete(Tags, Bin);\ndecode_constructed_incomplete(_TagMatch, <<>>) ->\n    [];\ndecode_constructed_incomplete([mandatory | RestTag], Bin) ->\n    {Tlv, Rest} = decode_primitive(Bin),\n    [Tlv | decode_constructed_incomplete(RestTag, Rest)];\ndecode_constructed_incomplete(Directives = [[Alt, _] | _], Bin)\n    when Alt =:= alt_undec; Alt =:= alt; Alt =:= alt_parts ->\n    {_Form, TagNo, V, Rest} = decode_tag_and_length(Bin),\n    case incomplete_choice_alt(TagNo, Directives) of\n        {alt_undec, _} ->\n            LenA = byte_size(Bin) - byte_size(Rest),\n            <<A:LenA/binary,Rest/binary>> = Bin,\n            A;\n        {alt, InnerDirectives} ->\n            {Tlv, Rest} =\n                decode_primitive_incomplete(InnerDirectives, V),\n            {TagNo, Tlv};\n        {alt_parts, _} ->\n            [{TagNo, decode_parts_incomplete(V)}];\n        no_match ->\n            {Tlv, _} = decode_primitive(Bin),\n            Tlv\n    end;\ndecode_constructed_incomplete([TagNo | RestTag], Bin) ->\n    case decode_primitive_incomplete([TagNo], Bin) of\n        {Tlv, Rest} ->\n            [Tlv | decode_constructed_incomplete(RestTag, Rest)];\n        asn1_NOVALUE ->\n            decode_constructed_incomplete(RestTag, Bin)\n    end;\ndecode_constructed_incomplete([], Bin) ->\n    {Tlv, Rest} = decode_primitive(Bin),\n    [Tlv | decode_constructed_incomplete([], Rest)].\n">>},
 {{ber,decode_constr_indef_incomplete,3},
  <<"\ndecode_constr_indef_incomplete(_TagMatch, <<0,0,Rest/binary>>, Acc) ->\n    {lists:reverse(Acc), Rest};\ndecode_constr_indef_incomplete([Tag | RestTags], Bin, Acc) ->\n    case decode_primitive_incomplete([Tag], Bin) of\n        {Tlv, Rest} ->\n            decode_constr_indef_incomplete(RestTags, Rest, [Tlv | Acc]);\n        asn1_NOVALUE ->\n            decode_constr_indef_incomplete(RestTags, Bin, Acc)\n    end.\n">>},
 {{ber,decode_incomplete_bin,1},
  <<"\ndecode_incomplete_bin(Bin) ->\n    {ok, Rest} = skip_tag(Bin),\n    {ok, Rest2} = skip_length_and_value(Rest),\n    IncLen = byte_size(Bin) - byte_size(Rest2),\n    <<IncBin:IncLen/binary,Ret/binary>> = Bin,\n    {IncBin, Ret}.\n">>},
 {{ber,incomplete_choice_alt,2},
  <<"\nincomplete_choice_alt(TagNo, [[Alt, TagNo] | Directives]) ->\n    {Alt, Directives};\nincomplete_choice_alt(TagNo, [D]) when is_list(D) ->\n    incomplete_choice_alt(TagNo, D);\nincomplete_choice_alt(TagNo, [_H | Directives]) ->\n    incomplete_choice_alt(TagNo, Directives);\nincomplete_choice_alt(_, []) ->\n    no_match.\n">>},
 {{ber,decode_selective,2},
  <<"\ndecode_selective([], Binary) ->\n    {ok, Binary};\ndecode_selective([skip | RestPattern], Binary) ->\n    {ok, RestBinary} = skip_tag(Binary),\n    {ok, RestBinary2} = skip_length_and_value(RestBinary),\n    decode_selective(RestPattern, RestBinary2);\ndecode_selective([[skip_optional, Tag] | RestPattern], Binary) ->\n    case skip_optional_tag(Tag, Binary) of\n        {ok, RestBinary} ->\n            {ok, RestBinary2} = skip_length_and_value(RestBinary),\n            decode_selective(RestPattern, RestBinary2);\n        missing ->\n            decode_selective(RestPattern, Binary)\n    end;\ndecode_selective([[choosen, Tag]], Binary) ->\n    return_value(Tag, Binary);\ndecode_selective([[choosen, Tag] | RestPattern], Binary) ->\n    case skip_optional_tag(Tag, Binary) of\n        {ok, RestBinary} ->\n            {ok, Value} = get_value(RestBinary),\n            decode_selective(RestPattern, Value);\n        missing ->\n            {ok, <<>>}\n    end;\ndecode_selective(P, _) ->\n    {error, {asn1, {partial_decode, \"bad pattern\", P}}}.\n">>},
 {{ber,return_value,2},
  <<"\nreturn_value(Tag, Binary) ->\n    {ok, {Tag, RestBinary}} = get_tag(Binary),\n    {ok, {LenVal, _RestBinary2}} = get_length_and_value(RestBinary),\n    {ok, <<Tag/binary,LenVal/binary>>}.\n">>},
 {{ber,skip_tag,1},
  <<"\nskip_tag(<<_:3,31:5,Rest/binary>>) ->\n    skip_long_tag(Rest);\nskip_tag(<<_:3,_Tag:5,Rest/binary>>) ->\n    {ok, Rest}.\n">>},
 {{ber,skip_long_tag,1},
  <<"\nskip_long_tag(<<1:1,_:7,Rest/binary>>) ->\n    skip_long_tag(Rest);\nskip_long_tag(<<0:1,_:7,Rest/binary>>) ->\n    {ok, Rest}.\n">>},
 {{ber,skip_optional_tag,2},
  <<"\nskip_optional_tag(<<>>, Binary) ->\n    {ok, Binary};\nskip_optional_tag(<<Tag,RestTag/binary>>, <<Tag,Rest/binary>>) ->\n    skip_optional_tag(RestTag, Rest);\nskip_optional_tag(_, _) ->\n    missing.\n">>},
 {{ber,skip_length_and_value,1},
  <<"\nskip_length_and_value(Binary) ->\n    case decode_length(Binary) of\n        {indefinite, RestBinary} ->\n            skip_indefinite_value(RestBinary);\n        {Length, RestBinary} ->\n            <<_:Length/unit:8,Rest/binary>> = RestBinary,\n            {ok, Rest}\n    end.\n">>},
 {{ber,skip_indefinite_value,1},
  <<"\nskip_indefinite_value(<<0,0,Rest/binary>>) ->\n    {ok, Rest};\nskip_indefinite_value(Binary) ->\n    {ok, RestBinary} = skip_tag(Binary),\n    {ok, RestBinary2} = skip_length_and_value(RestBinary),\n    skip_indefinite_value(RestBinary2).\n">>},
 {{ber,get_value,1},
  <<"\nget_value(Binary) ->\n    case decode_length(Binary) of\n        {indefinite, RestBinary} ->\n            get_indefinite_value(RestBinary, []);\n        {Length, RestBinary} ->\n            <<Value:Length/binary,_Rest/binary>> = RestBinary,\n            {ok, Value}\n    end.\n">>},
 {{ber,get_indefinite_value,2},
  <<"\nget_indefinite_value(<<0,0,_Rest/binary>>, Acc) ->\n    {ok, list_to_binary(lists:reverse(Acc))};\nget_indefinite_value(Binary, Acc) ->\n    {ok, {Tag, RestBinary}} = get_tag(Binary),\n    {ok, {LenVal, RestBinary2}} = get_length_and_value(RestBinary),\n    get_indefinite_value(RestBinary2, [LenVal, Tag | Acc]).\n">>},
 {{ber,get_tag,1},
  <<"\nget_tag(<<H:1/binary,Rest/binary>>) ->\n    case H of\n        <<_:3,31:5>> ->\n            get_long_tag(Rest, [H]);\n        _ ->\n            {ok, {H, Rest}}\n    end.\n">>},
 {{ber,get_long_tag,2},
  <<"\nget_long_tag(<<H:1/binary,Rest/binary>>, Acc) ->\n    case H of\n        <<0:1,_:7>> ->\n            {ok, {list_to_binary(lists:reverse([H | Acc])), Rest}};\n        _ ->\n            get_long_tag(Rest, [H | Acc])\n    end.\n">>},
 {{ber,get_length_and_value,1},
  <<"\nget_length_and_value(Bin = <<0:1,Length:7,_T/binary>>) ->\n    <<Len,Val:Length/binary,Rest/binary>> = Bin,\n    {ok, {<<Len,Val/binary>>, Rest}};\nget_length_and_value(Bin = <<1:1,0:7,_T/binary>>) ->\n    get_indefinite_length_and_value(Bin);\nget_length_and_value(<<1:1,LL:7,T/binary>>) ->\n    <<Length:LL/unit:8,Rest/binary>> = T,\n    <<Value:Length/binary,Rest2/binary>> = Rest,\n    {ok, {<<1:1,LL:7,Length:LL/unit:8,Value/binary>>, Rest2}}.\n">>},
 {{ber,get_indefinite_length_and_value,1},
  <<"\nget_indefinite_length_and_value(<<H,T/binary>>) ->\n    get_indefinite_length_and_value(T, [H]).\n">>},
 {{ber,get_indefinite_length_and_value,2},
  <<"\nget_indefinite_length_and_value(<<0,0,Rest/binary>>, Acc) ->\n    {ok, {list_to_binary(lists:reverse(Acc)), Rest}};\nget_indefinite_length_and_value(Binary, Acc) ->\n    {ok, {Tag, RestBinary}} = get_tag(Binary),\n    {ok, {LenVal, RestBinary2}} = get_length_and_value(RestBinary),\n    get_indefinite_length_and_value(RestBinary2, [LenVal, Tag | Acc]).\n">>},
 {{ber,match_tags,2},
  <<"\nmatch_tags({T, V}, [T]) ->\n    V;\nmatch_tags({T, V}, [T | Tt]) ->\n    match_tags(V, Tt);\nmatch_tags([{T, V}], [T | Tt]) ->\n    match_tags(V, Tt);\nmatch_tags([{T, _V} | _] = Vlist, [T]) ->\n    Vlist;\nmatch_tags(Tlv, []) ->\n    Tlv;\nmatch_tags({Tag, _V} = Tlv, [T | _Tt]) ->\n    exit({error, {asn1, {wrong_tag, {{expected, T}, {got, Tag, Tlv}}}}}).\n">>},
 {{ber,skip_ExtensionAdditions,2},
  <<"\nskip_ExtensionAdditions([], _Tags) ->\n    [];\nskip_ExtensionAdditions([{Tag, _} | Rest] = TLV, Tags) ->\n    case\n        [ \n         X ||\n             X = T <- Tags,\n             T =:= Tag\n        ]\n    of\n        [] ->\n            skip_ExtensionAdditions(Rest, Tags);\n        _ ->\n            TLV\n    end.\n">>},
 {{ber,decode_tag_and_length,1},
  <<"\ndecode_tag_and_length(<<Class:2,\n                        Form:1,\n                        TagNo:5,\n                        0:1,\n                        Length:7,\n                        V:Length/binary,\n                        RestBuffer/binary>>)\n    when TagNo < 31 ->\n    {Form, Class bsl 16 bor TagNo, V, RestBuffer};\ndecode_tag_and_length(<<Class:2,1:1,TagNo:5,1:1,0:7,T/binary>>)\n    when TagNo < 31 ->\n    {2, Class bsl 16 + TagNo, T, <<>>};\ndecode_tag_and_length(<<Class:2,\n                        Form:1,\n                        TagNo:5,\n                        1:1,\n                        LL:7,\n                        Length:LL/unit:8,\n                        V:Length/binary,\n                        T/binary>>)\n    when TagNo < 31 ->\n    {Form, Class bsl 16 bor TagNo, V, T};\ndecode_tag_and_length(<<Class:2,\n                        Form:1,\n                        31:5,\n                        0:1,\n                        TagNo:7,\n                        0:1,\n                        Length:7,\n                        V:Length/binary,\n                        RestBuffer/binary>>) ->\n    {Form, Class bsl 16 bor TagNo, V, RestBuffer};\ndecode_tag_and_length(<<Class:2,1:1,31:5,0:1,TagNo:7,1:1,0:7,T/binary>>) ->\n    {2, Class bsl 16 bor TagNo, T, <<>>};\ndecode_tag_and_length(<<Class:2,\n                        Form:1,\n                        31:5,\n                        0:1,\n                        TagNo:7,\n                        1:1,\n                        LL:7,\n                        Length:LL/unit:8,\n                        V:Length/binary,\n                        T/binary>>) ->\n    {Form, Class bsl 16 bor TagNo, V, T};\ndecode_tag_and_length(<<Class:2,\n                        Form:1,\n                        31:5,\n                        1:1,\n                        TagPart1:7,\n                        0:1,\n                        TagPartLast,\n                        Buffer/binary>>) ->\n    TagNo = TagPart1 bsl 7 bor TagPartLast,\n    {Length, RestBuffer} = decode_length(Buffer),\n    <<V:Length/binary,RestBuffer2/binary>> = RestBuffer,\n    {Form, Class bsl 16 bor TagNo, V, RestBuffer2};\ndecode_tag_and_length(<<Class:2,Form:1,31:5,Buffer/binary>>) ->\n    {TagNo, Buffer1} = decode_tag(Buffer, 0),\n    {Length, RestBuffer} = decode_length(Buffer1),\n    <<V:Length/binary,RestBuffer2/binary>> = RestBuffer,\n    {Form, Class bsl 16 bor TagNo, V, RestBuffer2}.\n">>},
 {{ber,decode_tag,2},
  <<"\ndecode_tag(<<0:1,PartialTag:7,Buffer/binary>>, TagAck) ->\n    TagNo = TagAck bsl 7 bor PartialTag,\n    {TagNo, Buffer};\ndecode_tag(<<_:1,PartialTag:7,Buffer/binary>>, TagAck) ->\n    TagAck1 = TagAck bsl 7 bor PartialTag,\n    decode_tag(Buffer, TagAck1).\n">>},
 {{ber,encode_tags,3},
  <<"\nencode_tags([Tag | Trest], BytesSoFar, LenSoFar) ->\n    {Bytes2, L2} = encode_length(LenSoFar),\n    encode_tags(Trest,\n                [Tag, Bytes2 | BytesSoFar],\n                LenSoFar + byte_size(Tag) + L2);\nencode_tags([], BytesSoFar, LenSoFar) ->\n    {BytesSoFar, LenSoFar}.\n">>},
 {{ber,encode_tags,2},
  <<"\nencode_tags(TagIn, {BytesSoFar, LenSoFar}) ->\n    encode_tags(TagIn, BytesSoFar, LenSoFar).\n">>},
 {{ber,encode_open_type,2},
  <<"\nencode_open_type(Val, T) when is_list(Val) ->\n    encode_open_type(list_to_binary(Val), T);\nencode_open_type(Val, Tag) ->\n    encode_tags(Tag, Val, byte_size(Val)).\n">>},
 {{ber,decode_open_type,2},
  <<"\ndecode_open_type(Tlv, TagIn) ->\n    case match_tags(Tlv, TagIn) of\n        Bin when is_binary(Bin) ->\n            {InnerTlv, _} = ber_decode_nif(Bin),\n            InnerTlv;\n        TlvBytes ->\n            TlvBytes\n    end.\n">>},
 {{ber,decode_open_type_as_binary,2},
  <<"\ndecode_open_type_as_binary(Tlv, TagIn) ->\n    ber_encode(match_tags(Tlv, TagIn)).\n">>},
 {{ber,encode_boolean,2},
  <<"\nencode_boolean(true, TagIn) ->\n    encode_tags(TagIn, [255], 1);\nencode_boolean(false, TagIn) ->\n    encode_tags(TagIn, [0], 1);\nencode_boolean(X, _) ->\n    exit({error, {asn1, {encode_boolean, X}}}).\n">>},
 {{ber,decode_boolean,2},
  <<"\ndecode_boolean(Tlv, TagIn) ->\n    Val = match_tags(Tlv, TagIn),\n    case Val of\n        <<0:8>> ->\n            false;\n        <<_:8>> ->\n            true;\n        _ ->\n            exit({error, {asn1, {decode_boolean, Val}}})\n    end.\n">>},
 {{ber,encode_integer,2},
  <<"\nencode_integer(Val, Tag) when is_integer(Val) ->\n    encode_tags(Tag, encode_integer(Val));\nencode_integer(Val, _Tag) ->\n    exit({error, {asn1, {encode_integer, Val}}}).\n">>},
 {{ber,encode_integer,3},
  <<"\nencode_integer(Val, NamedNumberList, Tag) when is_atom(Val) ->\n    case lists:keyfind(Val, 1, NamedNumberList) of\n        {_, NewVal} ->\n            encode_tags(Tag, encode_integer(NewVal));\n        _ ->\n            exit({error, {asn1, {encode_integer_namednumber, Val}}})\n    end;\nencode_integer(Val, _NamedNumberList, Tag) ->\n    encode_tags(Tag, encode_integer(Val)).\n">>},
 {{ber,encode_integer,1},
  <<"\nencode_integer(Val) ->\n    Bytes =\n        if\n            Val >= 0 ->\n                encode_integer_pos(Val, []);\n            true ->\n                encode_integer_neg(Val, [])\n        end,\n    {Bytes, length(Bytes)}.\n">>},
 {{ber,encode_integer_pos,2},
  <<"\nencode_integer_pos(0, [B | _Acc] = L) when B < 128 ->\n    L;\nencode_integer_pos(N, Acc) ->\n    encode_integer_pos(N bsr 8, [N band 255 | Acc]).\n">>},
 {{ber,encode_integer_neg,2},
  <<"\nencode_integer_neg(- 1, [B1 | _T] = L) when B1 > 127 ->\n    L;\nencode_integer_neg(N, Acc) ->\n    encode_integer_neg(N bsr 8, [N band 255 | Acc]).\n">>},
 {{ber,decode_integer,2},
  <<"\ndecode_integer(Tlv, TagIn) ->\n    Bin = match_tags(Tlv, TagIn),\n    Len = byte_size(Bin),\n    <<Int:Len/signed-unit:8>> = Bin,\n    Int.\n">>},
 {{ber,number2name,2},
  <<"\nnumber2name(Int, NamedNumberList) ->\n    case lists:keyfind(Int, 2, NamedNumberList) of\n        {NamedVal, _} ->\n            NamedVal;\n        _ ->\n            Int\n    end.\n">>},
 {{ber,encode_unnamed_bit_string,2},
  <<"\nencode_unnamed_bit_string(Bits, TagIn) ->\n    Unused = (8 - bit_size(Bits) band 7) band 7,\n    Bin = <<Unused,Bits/bitstring,0:Unused>>,\n    encode_tags(TagIn, Bin, byte_size(Bin)).\n">>},
 {{ber,encode_unnamed_bit_string,3},
  <<"\nencode_unnamed_bit_string(MaxBits, Bits, TagIn) ->\n    NumBits = bit_size(Bits),\n    Unused = (8 - NumBits band 7) band 7,\n    Bin = <<Unused,Bits/bitstring,0:Unused>>,\n    if\n        NumBits > MaxBits ->\n            exit({error,\n                  {asn1,\n                   {bitstring_length,\n                    {{was, NumBits}, {maximum, MaxBits}}}}});\n        true ->\n            encode_tags(TagIn, Bin, byte_size(Bin))\n    end.\n">>},
 {{ber,encode_named_bit_string,3},
  <<"\nencode_named_bit_string([H | _] = Bits, NamedBitList, TagIn)\n    when is_atom(H) ->\n    do_encode_named_bit_string(Bits, NamedBitList, TagIn);\nencode_named_bit_string([{bit, _} | _] = Bits, NamedBitList, TagIn) ->\n    do_encode_named_bit_string(Bits, NamedBitList, TagIn);\nencode_named_bit_string([], _NamedBitList, TagIn) ->\n    encode_unnamed_bit_string(<<>>, TagIn);\nencode_named_bit_string(Bits, _NamedBitList, TagIn)\n    when is_bitstring(Bits) ->\n    encode_unnamed_bit_string(Bits, TagIn).\n">>},
 {{ber,encode_named_bit_string,4},
  <<"\nencode_named_bit_string(C, [H | _] = Bits, NamedBitList, TagIn)\n    when is_atom(H) ->\n    do_encode_named_bit_string(C, Bits, NamedBitList, TagIn);\nencode_named_bit_string(C, [{bit, _} | _] = Bits, NamedBitList, TagIn) ->\n    do_encode_named_bit_string(C, Bits, NamedBitList, TagIn);\nencode_named_bit_string(C, [], _NamedBitList, TagIn) ->\n    encode_unnamed_bit_string(C, <<>>, TagIn);\nencode_named_bit_string(C, Bits, _NamedBitList, TagIn)\n    when is_bitstring(Bits) ->\n    encode_unnamed_bit_string(C, Bits, TagIn).\n">>},
 {{ber,do_encode_named_bit_string,3},
  <<"\ndo_encode_named_bit_string([FirstVal | RestVal], NamedBitList, TagIn) ->\n    ToSetPos = get_all_bitposes([FirstVal | RestVal], NamedBitList, []),\n    Size = lists:max(ToSetPos) + 1,\n    BitList = make_and_set_list(Size, ToSetPos, 0),\n    {Len, Unused, OctetList} = encode_bitstring(BitList),\n    encode_tags(TagIn, [Unused | OctetList], Len + 1).\n">>},
 {{ber,do_encode_named_bit_string,4},
  <<"\ndo_encode_named_bit_string(Size,\n                           [FirstVal | RestVal],\n                           NamedBitList, TagIn) ->\n    ToSetPos = get_all_bitposes([FirstVal | RestVal], NamedBitList, []),\n    BitList = make_and_set_list(Size, ToSetPos, 0),\n    {Len, Unused, OctetList} = encode_bitstring(BitList),\n    encode_tags(TagIn, [Unused | OctetList], Len + 1).\n">>},
 {{ber,encode_bit_string,4},
  <<"\nencode_bit_string(C, Bits, NamedBitList, TagIn) when is_bitstring(Bits) ->\n    PadLen = (8 - bit_size(Bits) band 7) band 7,\n    Compact = {PadLen, <<Bits/bitstring,0:PadLen>>},\n    encode_bin_bit_string(C, Compact, NamedBitList, TagIn);\nencode_bit_string(C, Bin = {Unused, BinBits}, NamedBitList, TagIn)\n    when is_integer(Unused), is_binary(BinBits) ->\n    encode_bin_bit_string(C, Bin, NamedBitList, TagIn);\nencode_bit_string(C, [FirstVal | RestVal], NamedBitList, TagIn)\n    when is_atom(FirstVal) ->\n    encode_bit_string_named(C,\n                            [FirstVal | RestVal],\n                            NamedBitList, TagIn);\nencode_bit_string(C, [{bit, X} | RestVal], NamedBitList, TagIn) ->\n    encode_bit_string_named(C,\n                            [{bit, X} | RestVal],\n                            NamedBitList, TagIn);\nencode_bit_string(C, [FirstVal | RestVal], NamedBitList, TagIn)\n    when is_integer(FirstVal) ->\n    encode_bit_string_bits(C, [FirstVal | RestVal], NamedBitList, TagIn);\nencode_bit_string(_C, 0, _NamedBitList, TagIn) ->\n    encode_tags(TagIn, <<0>>, 1);\nencode_bit_string(_C, [], _NamedBitList, TagIn) ->\n    encode_tags(TagIn, <<0>>, 1);\nencode_bit_string(C, IntegerVal, NamedBitList, TagIn)\n    when is_integer(IntegerVal) ->\n    BitListVal = int_to_bitlist(IntegerVal),\n    encode_bit_string_bits(C, BitListVal, NamedBitList, TagIn).\n">>},
 {{ber,int_to_bitlist,1},
  <<"\nint_to_bitlist(0) ->\n    [];\nint_to_bitlist(Int) when is_integer(Int), Int >= 0 ->\n    [Int band 1 | int_to_bitlist(Int bsr 1)].\n">>},
 {{ber,encode_bin_bit_string,4},
  <<"\nencode_bin_bit_string(C, {Unused, BinBits}, _NamedBitList, TagIn) ->\n    case C of\n        [] ->\n            remove_unused_then_dotag(TagIn, Unused, BinBits);\n        {_Min, Max} ->\n            BBLen = byte_size(BinBits) * 8 - Unused,\n            if\n                BBLen > Max ->\n                    exit({error,\n                          {asn1,\n                           {bitstring_length,\n                            {{was, BBLen}, {maximum, Max}}}}});\n                true ->\n                    remove_unused_then_dotag(TagIn, Unused, BinBits)\n            end;\n        Size ->\n            case byte_size(BinBits) * 8 - Unused of\n                BBSize when BBSize =< Size ->\n                    remove_unused_then_dotag(TagIn, Unused, BinBits);\n                BBSize ->\n                    exit({error,\n                          {asn1,\n                           {bitstring_length,\n                            {{was, BBSize}, {should_be, Size}}}}})\n            end\n    end.\n">>},
 {{ber,remove_unused_then_dotag,3},
  <<"\nremove_unused_then_dotag(TagIn, Unused, BinBits) ->\n    case Unused of\n        0 when byte_size(BinBits) =:= 0 ->\n            encode_tags(TagIn, <<0>>, 1);\n        0 ->\n            Bin = <<Unused,BinBits/binary>>,\n            encode_tags(TagIn, Bin, byte_size(Bin));\n        Num ->\n            N = byte_size(BinBits) - 1,\n            <<BBits:N/binary,LastByte>> = BinBits,\n            encode_tags(TagIn,\n                        [Unused,\n                         binary_to_list(BBits)\n                         ++\n                         [LastByte bsr Num bsl Num]],\n                        1 + byte_size(BinBits))\n    end.\n">>},
 {{ber,encode_bit_string_named,4},
  <<"\nencode_bit_string_named(C, [FirstVal | RestVal], NamedBitList, TagIn) ->\n    ToSetPos = get_all_bitposes([FirstVal | RestVal], NamedBitList, []),\n    Size =\n        case C of\n            [] ->\n                lists:max(ToSetPos) + 1;\n            {_Min, Max} ->\n                Max;\n            TSize ->\n                TSize\n        end,\n    BitList = make_and_set_list(Size, ToSetPos, 0),\n    {Len, Unused, OctetList} = encode_bitstring(BitList),\n    encode_tags(TagIn, [Unused | OctetList], Len + 1).\n">>},
 {{ber,get_all_bitposes,3},
  <<"\nget_all_bitposes([{bit, ValPos} | Rest], NamedBitList, Ack) ->\n    get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]);\nget_all_bitposes([Val | Rest], NamedBitList, Ack) when is_atom(Val) ->\n    case lists:keyfind(Val, 1, NamedBitList) of\n        {_ValName, ValPos} ->\n            get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]);\n        _ ->\n            exit({error, {asn1, {bitstring_namedbit, Val}}})\n    end;\nget_all_bitposes([], _NamedBitList, Ack) ->\n    lists:sort(Ack).\n">>},
 {{ber,make_and_set_list,3},
  <<"\nmake_and_set_list(0, [], _) ->\n    [];\nmake_and_set_list(0, _, _) ->\n    exit({error, {asn1, bitstring_sizeconstraint}});\nmake_and_set_list(Len, [XPos | SetPos], XPos) ->\n    [1 | make_and_set_list(Len - 1, SetPos, XPos + 1)];\nmake_and_set_list(Len, [Pos | SetPos], XPos) ->\n    [0 | make_and_set_list(Len - 1, [Pos | SetPos], XPos + 1)];\nmake_and_set_list(Len, [], XPos) ->\n    [0 | make_and_set_list(Len - 1, [], XPos + 1)].\n">>},
 {{ber,encode_bit_string_bits,4},
  <<"\nencode_bit_string_bits(C, BitListVal, _NamedBitList, TagIn)\n    when is_list(BitListVal) ->\n    case C of\n        [] ->\n            {Len, Unused, OctetList} = encode_bitstring(BitListVal),\n            encode_tags(TagIn, [Unused | OctetList], Len + 1);\n        Constr = {Min, _Max} when is_integer(Min) ->\n            encode_constr_bit_str_bits(Constr, BitListVal, TagIn);\n        {Constr = {_, _}, []} ->\n            encode_constr_bit_str_bits(Constr, BitListVal, TagIn);\n        Constr = {{_, _}, {_, _}} ->\n            encode_constr_bit_str_bits(Constr, BitListVal, TagIn);\n        Size when is_integer(Size) ->\n            case length(BitListVal) of\n                BitSize when BitSize == Size ->\n                    {Len, Unused, OctetList} =\n                        encode_bitstring(BitListVal),\n                    encode_tags(TagIn, [Unused | OctetList], Len + 1);\n                BitSize when BitSize < Size ->\n                    PaddedList =\n                        pad_bit_list(Size - BitSize, BitListVal),\n                    {Len, Unused, OctetList} =\n                        encode_bitstring(PaddedList),\n                    encode_tags(TagIn, [Unused | OctetList], Len + 1);\n                BitSize ->\n                    exit({error,\n                          {asn1,\n                           {bitstring_length,\n                            {{was, BitSize}, {should_be, Size}}}}})\n            end\n    end.\n">>},
 {{ber,encode_constr_bit_str_bits,3},
  <<"\nencode_constr_bit_str_bits({{_Min1, Max1}, {Min2, Max2}},\n                           BitListVal, TagIn) ->\n    BitLen = length(BitListVal),\n    case BitLen of\n        Len when Len > Max2 ->\n            exit({error,\n                  {asn1,\n                   {bitstring_length, {{was, BitLen}, {maximum, Max2}}}}});\n        Len when Len > Max1, Len < Min2 ->\n            exit({error,\n                  {asn1,\n                   {bitstring_length,\n                    {{was, BitLen}, {not_allowed_interval, Max1, Min2}}}}});\n        _ ->\n            {Len, Unused, OctetList} = encode_bitstring(BitListVal),\n            encode_tags(TagIn, [Unused, OctetList], Len + 1)\n    end;\nencode_constr_bit_str_bits({Min, Max}, BitListVal, TagIn) ->\n    BitLen = length(BitListVal),\n    if\n        BitLen > Max ->\n            exit({error,\n                  {asn1,\n                   {bitstring_length, {{was, BitLen}, {maximum, Max}}}}});\n        BitLen < Min ->\n            exit({error,\n                  {asn1,\n                   {bitstring_length, {{was, BitLen}, {minimum, Max}}}}});\n        true ->\n            {Len, Unused, OctetList} = encode_bitstring(BitListVal),\n            encode_tags(TagIn, [Unused, OctetList], Len + 1)\n    end.\n">>},
 {{ber,pad_bit_list,2},
  <<"\npad_bit_list(Size, BitListVal) ->\n    Tail = lists:duplicate(Size, 0),\n    lists:append(BitListVal, Tail).\n">>},
 {{ber,encode_bitstring,1},
  <<"\nencode_bitstring([B8, B7, B6, B5, B4, B3, B2, B1 | Rest]) ->\n    Val =\n        B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4)\n        bor\n        (B4 bsl 3)\n        bor\n        (B3 bsl 2)\n        bor\n        (B2 bsl 1)\n        bor\n        B1,\n    encode_bitstring(Rest, [Val], 1);\nencode_bitstring(Val) ->\n    {Unused, Octet} = unused_bitlist(Val, 7, 0),\n    {1, Unused, [Octet]}.\n">>},
 {{ber,encode_bitstring,3},
  <<"\nencode_bitstring([B8, B7, B6, B5, B4, B3, B2, B1 | Rest], Ack, Len) ->\n    Val =\n        B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4)\n        bor\n        (B4 bsl 3)\n        bor\n        (B3 bsl 2)\n        bor\n        (B2 bsl 1)\n        bor\n        B1,\n    encode_bitstring(Rest, [Ack, Val], Len + 1);\nencode_bitstring([], Ack, Len) ->\n    {Len, 0, Ack};\nencode_bitstring(Rest, Ack, Len) ->\n    {Unused, Val} = unused_bitlist(Rest, 7, 0),\n    {Len + 1, Unused, [Ack, Val]}.\n">>},
 {{ber,unused_bitlist,3},
  <<"\nunused_bitlist([], Trail, Ack) ->\n    {Trail + 1, Ack};\nunused_bitlist([Bit | Rest], Trail, Ack) ->\n    unused_bitlist(Rest, Trail - 1, Bit bsl Trail bor Ack).\n">>},
 {{ber,decode_compact_bit_string,2},
  <<"\ndecode_compact_bit_string(Buffer, Tags) ->\n    case match_and_collect(Buffer, Tags) of\n        <<0>> ->\n            {0, <<>>};\n        <<Unused,Bits/binary>> ->\n            {Unused, Bits}\n    end.\n">>},
 {{ber,compact_bit_string_size,1},
  <<"\ncompact_bit_string_size({Unused, Bits}) ->\n    bit_size(Bits) - Unused.\n">>},
 {{ber,decode_native_bit_string,2},
  <<"\ndecode_native_bit_string(Buffer, Tags) ->\n    case match_and_collect(Buffer, Tags) of\n        <<0>> ->\n            <<>>;\n        <<Unused,Bits/binary>> ->\n            Size = bit_size(Bits) - Unused,\n            <<Val:Size/bitstring,_:Unused/bitstring>> = Bits,\n            Val\n    end.\n">>},
 {{ber,decode_named_bit_string,3},
  <<"\ndecode_named_bit_string(Buffer, NamedNumberList, Tags) ->\n    case match_and_collect(Buffer, Tags) of\n        <<0>> ->\n            [];\n        <<Unused,Bits/binary>> ->\n            BitString = decode_bitstring2(byte_size(Bits), Unused, Bits),\n            decode_bitstring_NNL(BitString, NamedNumberList)\n    end.\n">>},
 {{ber,decode_bitstring2,3},
  <<"\ndecode_bitstring2(1, Unused,\n                  <<B7:1,B6:1,B5:1,B4:1,B3:1,B2:1,B1:1,B0:1,_/binary>>) ->\n    lists:sublist([B7, B6, B5, B4, B3, B2, B1, B0], 8 - Unused);\ndecode_bitstring2(Len, Unused,\n                  <<B7:1,\n                    B6:1,\n                    B5:1,\n                    B4:1,\n                    B3:1,\n                    B2:1,\n                    B1:1,\n                    B0:1,\n                    Buffer/binary>>) ->\n    [B7, B6, B5, B4, B3, B2, B1, B0 |\n     decode_bitstring2(Len - 1, Unused, Buffer)].\n">>},
 {{ber,native_to_legacy_bit_string,1},
  <<"\nnative_to_legacy_bit_string(Bits) ->\n    [ \n     B ||\n         <<B:1>> <= Bits\n    ].\n">>},
 {{ber,decode_bitstring_NNL,2},
  <<"\ndecode_bitstring_NNL(BitList, NamedNumberList) ->\n    decode_bitstring_NNL(BitList, NamedNumberList, 0, []).\n">>},
 {{ber,decode_bitstring_NNL,4},
  <<"\ndecode_bitstring_NNL([], _, _No, Result) ->\n    lists:reverse(Result);\ndecode_bitstring_NNL([B | BitList],\n                     [{Name, No} | NamedNumberList],\n                     No, Result) ->\n    if\n        B =:= 0 ->\n            decode_bitstring_NNL(BitList, NamedNumberList,\n                                 No + 1,\n                                 Result);\n        true ->\n            decode_bitstring_NNL(BitList, NamedNumberList,\n                                 No + 1,\n                                 [Name | Result])\n    end;\ndecode_bitstring_NNL([1 | BitList], NamedNumberList, No, Result) ->\n    decode_bitstring_NNL(BitList, NamedNumberList,\n                         No + 1,\n                         [{bit, No} | Result]);\ndecode_bitstring_NNL([0 | BitList], NamedNumberList, No, Result) ->\n    decode_bitstring_NNL(BitList, NamedNumberList, No + 1, Result).\n">>},
 {{ber,encode_null,2},
  <<"\nencode_null(_Val, TagIn) ->\n    encode_tags(TagIn, [], 0).\n">>},
 {{ber,decode_null,2},
  <<"\ndecode_null(Tlv, Tags) ->\n    Val = match_tags(Tlv, Tags),\n    case Val of\n        <<>> ->\n            'NULL';\n        _ ->\n            exit({error, {asn1, {decode_null, Val}}})\n    end.\n">>},
 {{ber,encode_object_identifier,2},
  <<"\nencode_object_identifier(Val, TagIn) ->\n    encode_tags(TagIn, e_object_identifier(Val)).\n">>},
 {{ber,e_object_identifier,1},
  <<"\ne_object_identifier({'OBJECT IDENTIFIER', V}) ->\n    e_object_identifier(V);\ne_object_identifier(V) when is_tuple(V) ->\n    e_object_identifier(tuple_to_list(V));\ne_object_identifier([E1, E2 | Tail]) ->\n    Head = 40 * E1 + E2,\n    {H, Lh} = mk_object_val(Head),\n    {R, Lr} = lists:mapfoldl(fun enc_obj_id_tail/2, 0, Tail),\n    {[H | R], Lh + Lr}.\n">>},
 {{ber,enc_obj_id_tail,2},
  <<"\nenc_obj_id_tail(H, Len) ->\n    {B, L} = mk_object_val(H),\n    {B, Len + L}.\n">>},
 {{ber,mk_object_val,1},
  <<"\nmk_object_val(Val) when Val =< 127 ->\n    {[255 band Val], 1};\nmk_object_val(Val) ->\n    mk_object_val(Val bsr 7, [Val band 127], 1).\n">>},
 {{ber,mk_object_val,3},
  <<"\nmk_object_val(0, Ack, Len) ->\n    {Ack, Len};\nmk_object_val(Val, Ack, Len) ->\n    mk_object_val(Val bsr 7, [Val band 127 bor 128 | Ack], Len + 1).\n">>},
 {{ber,decode_object_identifier,2},
  <<"\ndecode_object_identifier(Tlv, Tags) ->\n    Val = match_tags(Tlv, Tags),\n    [AddedObjVal | ObjVals] = dec_subidentifiers(Val, 0, []),\n    {Val1, Val2} =\n        if\n            AddedObjVal < 40 ->\n                {0, AddedObjVal};\n            AddedObjVal < 80 ->\n                {1, AddedObjVal - 40};\n            true ->\n                {2, AddedObjVal - 80}\n        end,\n    list_to_tuple([Val1, Val2 | ObjVals]).\n">>},
 {{ber,dec_subidentifiers,3},
  <<"\ndec_subidentifiers(<<>>, _Av, Al) ->\n    lists:reverse(Al);\ndec_subidentifiers(<<1:1,H:7,T/binary>>, Av, Al) ->\n    dec_subidentifiers(T, Av bsl 7 + H, Al);\ndec_subidentifiers(<<H,T/binary>>, Av, Al) ->\n    dec_subidentifiers(T, 0, [Av bsl 7 + H | Al]).\n">>},
 {{ber,encode_relative_oid,2},
  <<"\nencode_relative_oid(Val, TagIn) when is_tuple(Val) ->\n    encode_relative_oid(tuple_to_list(Val), TagIn);\nencode_relative_oid(Val, TagIn) ->\n    encode_tags(TagIn, enc_relative_oid(Val)).\n">>},
 {{ber,enc_relative_oid,1},
  <<"\nenc_relative_oid(Tuple) when is_tuple(Tuple) ->\n    enc_relative_oid(tuple_to_list(Tuple));\nenc_relative_oid(Val) ->\n    lists:mapfoldl(fun(X, AccIn) ->\n                          {SO, L} = mk_object_val(X),\n                          {SO, L + AccIn}\n                   end,\n                   0, Val).\n">>},
 {{ber,decode_relative_oid,2},
  <<"\ndecode_relative_oid(Tlv, Tags) ->\n    Val = match_tags(Tlv, Tags),\n    ObjVals = dec_subidentifiers(Val, 0, []),\n    list_to_tuple(ObjVals).\n">>},
 {{ber,encode_restricted_string,2},
  <<"\nencode_restricted_string(OctetList, TagIn) when is_binary(OctetList) ->\n    encode_tags(TagIn, OctetList, byte_size(OctetList));\nencode_restricted_string(OctetList, TagIn) when is_list(OctetList) ->\n    encode_tags(TagIn, OctetList, length(OctetList)).\n">>},
 {{ber,decode_octet_string,2},
  <<"\ndecode_octet_string(Tlv, TagsIn) ->\n    Bin = match_and_collect(Tlv, TagsIn),\n    binary:copy(Bin).\n">>},
 {{ber,decode_restricted_string,2},
  <<"\ndecode_restricted_string(Tlv, TagsIn) ->\n    match_and_collect(Tlv, TagsIn).\n">>},
 {{ber,encode_universal_string,2},
  <<"\nencode_universal_string(Universal, TagIn) ->\n    OctetList = mk_uni_list(Universal),\n    encode_tags(TagIn, OctetList, length(OctetList)).\n">>},
 {{ber,mk_uni_list,1},<<"\nmk_uni_list(In) ->\n    mk_uni_list(In, []).\n">>},
 {{ber,mk_uni_list,2},
  <<"\nmk_uni_list([], List) ->\n    lists:reverse(List);\nmk_uni_list([{A, B, C, D} | T], List) ->\n    mk_uni_list(T, [D, C, B, A | List]);\nmk_uni_list([H | T], List) ->\n    mk_uni_list(T, [H, 0, 0, 0 | List]).\n">>},
 {{ber,decode_universal_string,2},
  <<"\ndecode_universal_string(Buffer, Tags) ->\n    Bin = match_and_collect(Buffer, Tags),\n    mk_universal_string(binary_to_list(Bin)).\n">>},
 {{ber,mk_universal_string,1},
  <<"\nmk_universal_string(In) ->\n    mk_universal_string(In, []).\n">>},
 {{ber,mk_universal_string,2},
  <<"\nmk_universal_string([], Acc) ->\n    lists:reverse(Acc);\nmk_universal_string([0, 0, 0, D | T], Acc) ->\n    mk_universal_string(T, [D | Acc]);\nmk_universal_string([A, B, C, D | T], Acc) ->\n    mk_universal_string(T, [{A, B, C, D} | Acc]).\n">>},
 {{ber,encode_UTF8_string,2},
  <<"\nencode_UTF8_string(UTF8String, TagIn) when is_binary(UTF8String) ->\n    encode_tags(TagIn, UTF8String, byte_size(UTF8String));\nencode_UTF8_string(UTF8String, TagIn) ->\n    encode_tags(TagIn, UTF8String, length(UTF8String)).\n">>},
 {{ber,decode_UTF8_string,2},
  <<"\ndecode_UTF8_string(Tlv, TagsIn) ->\n    Val = match_tags(Tlv, TagsIn),\n    case Val of\n        [_ | _] = PartList ->\n            collect_parts(PartList);\n        Bin ->\n            Bin\n    end.\n">>},
 {{ber,encode_BMP_string,2},
  <<"\nencode_BMP_string(BMPString, TagIn) ->\n    OctetList = mk_BMP_list(BMPString),\n    encode_tags(TagIn, OctetList, length(OctetList)).\n">>},
 {{ber,mk_BMP_list,1},<<"\nmk_BMP_list(In) ->\n    mk_BMP_list(In, []).\n">>},
 {{ber,mk_BMP_list,2},
  <<"\nmk_BMP_list([], List) ->\n    lists:reverse(List);\nmk_BMP_list([{0, 0, C, D} | T], List) ->\n    mk_BMP_list(T, [D, C | List]);\nmk_BMP_list([H | T], List) ->\n    mk_BMP_list(T, [H, 0 | List]).\n">>},
 {{ber,decode_BMP_string,2},
  <<"\ndecode_BMP_string(Buffer, Tags) ->\n    Bin = match_and_collect(Buffer, Tags),\n    mk_BMP_string(binary_to_list(Bin)).\n">>},
 {{ber,mk_BMP_string,1},
  <<"\nmk_BMP_string(In) ->\n    mk_BMP_string(In, []).\n">>},
 {{ber,mk_BMP_string,2},
  <<"\nmk_BMP_string([], US) ->\n    lists:reverse(US);\nmk_BMP_string([0, B | T], US) ->\n    mk_BMP_string(T, [B | US]);\nmk_BMP_string([C, D | T], US) ->\n    mk_BMP_string(T, [{0, 0, C, D} | US]).\n">>},
 {{ber,encode_length,1},
  <<"\nencode_length(L) when L =< 127 ->\n    {[L], 1};\nencode_length(L) ->\n    Oct = minimum_octets(L),\n    Len = length(Oct),\n    if\n        Len =< 126 ->\n            {[128 bor Len | Oct], Len + 1};\n        true ->\n            exit({error, {asn1, too_long_length_oct, Len}})\n    end.\n">>},
 {{ber,minimum_octets,1},
  <<"\nminimum_octets(Val) ->\n    minimum_octets(Val, []).\n">>},
 {{ber,minimum_octets,2},
  <<"\nminimum_octets(0, Acc) ->\n    Acc;\nminimum_octets(Val, Acc) ->\n    minimum_octets(Val bsr 8, [Val band 255 | Acc]).\n">>},
 {{ber,decode_length,1},
  <<"\ndecode_length(<<1:1,0:7,T/binary>>) ->\n    {indefinite, T};\ndecode_length(<<0:1,Length:7,T/binary>>) ->\n    {Length, T};\ndecode_length(<<1:1,LL:7,Length:LL/unit:8,T/binary>>) ->\n    {Length, T}.\n">>},
 {{ber,dynamicsort_SET_components,1},
  <<"\ndynamicsort_SET_components(ListOfEncCs) ->\n    TagBinL =\n        [ \n         begin\n             Bin = list_to_binary(L),\n             {dynsort_decode_tag(Bin), Bin}\n         end ||\n             L <- ListOfEncCs\n        ],\n    [ \n     E ||\n         {_, E} <- lists:keysort(1, TagBinL)\n    ].\n">>},
 {{ber,dynamicsort_SETOF,1},
  <<"\ndynamicsort_SETOF(ListOfEncVal) ->\n    BinL =\n        lists:map(fun(L) when is_list(L) ->\n                         list_to_binary(L);\n                     (B) ->\n                         B\n                  end,\n                  ListOfEncVal),\n    lists:sort(BinL).\n">>},
 {{ber,dynsort_decode_tag,1},
  <<"\ndynsort_decode_tag(<<Class:2,_Form:1,31:5,Buffer/binary>>) ->\n    TagNum = dynsort_decode_tag(Buffer, 0),\n    {Class, TagNum};\ndynsort_decode_tag(<<Class:2,_Form:1,TagNum:5,_/binary>>) ->\n    {Class, TagNum}.\n">>},
 {{ber,dynsort_decode_tag,2},
  <<"\ndynsort_decode_tag(<<0:1,PartialTag:7,_/binary>>, TagAcc) ->\n    TagAcc bsl 7 bor PartialTag;\ndynsort_decode_tag(<<_:1,PartialTag:7,Buffer/binary>>, TagAcc0) ->\n    TagAcc = TagAcc0 bsl 7 bor PartialTag,\n    dynsort_decode_tag(Buffer, TagAcc).\n">>},
 {{ber,match_and_collect,2},
  <<"\nmatch_and_collect(Tlv, TagsIn) ->\n    Val = match_tags(Tlv, TagsIn),\n    case Val of\n        [_ | _] = PartList ->\n            collect_parts(PartList);\n        Bin when is_binary(Bin) ->\n            Bin\n    end.\n">>},
 {{ber,collect_parts,1},
  <<"\ncollect_parts(TlvList) ->\n    collect_parts(TlvList, []).\n">>},
 {{ber,collect_parts,2},
  <<"\ncollect_parts([{_, L} | Rest], Acc) when is_list(L) ->\n    collect_parts(Rest, [collect_parts(L) | Acc]);\ncollect_parts([{3, <<Unused,Bits/binary>>} | Rest], _Acc) ->\n    collect_parts_bit(Rest, [Bits], Unused);\ncollect_parts([{_T, V} | Rest], Acc) ->\n    collect_parts(Rest, [V | Acc]);\ncollect_parts([], Acc) ->\n    list_to_binary(lists:reverse(Acc)).\n">>},
 {{ber,collect_parts_bit,3},
  <<"\ncollect_parts_bit([{3, <<Unused,Bits/binary>>} | Rest], Acc, Uacc) ->\n    collect_parts_bit(Rest, [Bits | Acc], Unused + Uacc);\ncollect_parts_bit([], Acc, Uacc) ->\n    list_to_binary([Uacc | lists:reverse(Acc)]).\n">>},
 {{check,check_fail,1},<<"\ncheck_fail(_) ->\n    throw(false).\n">>},
 {{check,check_int,3},
  <<"\ncheck_int(Value, Value, _) when is_integer(Value) ->\n    true;\ncheck_int(Value, DefValue, NNL) when is_atom(Value) ->\n    case lists:keyfind(Value, 1, NNL) of\n        {_, DefValue} ->\n            true;\n        _ ->\n            throw(false)\n    end;\ncheck_int(_, _, _) ->\n    throw(false).\n">>},
 {{check,check_legacy_bitstring,2},
  <<"\ncheck_legacy_bitstring(Value, Default) ->\n    check_bitstring(Default, Value).\n">>},
 {{check,check_bitstring,2},
  <<"\ncheck_bitstring(DefVal, {Unused, Binary}) ->\n    Sz = bit_size(Binary) - Unused,\n    <<Val:Sz/bitstring,_:Unused>> = Binary,\n    check_bitstring(DefVal, Val);\ncheck_bitstring(DefVal, Val) when is_bitstring(Val) ->\n    case Val =:= DefVal of\n        false ->\n            throw(false);\n        true ->\n            true\n    end;\ncheck_bitstring(Def, Val) when is_list(Val) ->\n    check_bitstring_list(Def, Val);\ncheck_bitstring(Def, Val) when is_integer(Val) ->\n    check_bitstring_integer(Def, Val).\n">>},
 {{check,check_bitstring_list,2},
  <<"\ncheck_bitstring_list(<<H:1,T1/bitstring>>, [H | T2]) ->\n    check_bitstring_list(T1, T2);\ncheck_bitstring_list(<<>>, []) ->\n    true;\ncheck_bitstring_list(_, _) ->\n    throw(false).\n">>},
 {{check,check_bitstring_integer,2},
  <<"\ncheck_bitstring_integer(<<H:1,T1/bitstring>>, Int) when H =:= Int band 1 ->\n    check_bitstring_integer(T1, Int bsr 1);\ncheck_bitstring_integer(<<>>, 0) ->\n    true;\ncheck_bitstring_integer(_, _) ->\n    throw(false).\n">>},
 {{check,check_legacy_named_bitstring,3},
  <<"\ncheck_legacy_named_bitstring([Int | _] = Val, Bs, BsSize)\n    when is_integer(Int) ->\n    check_named_bitstring(<< \n                            <<B:1>> ||\n                                B <- Val\n                          >>,\n                          Bs, BsSize);\ncheck_legacy_named_bitstring({Unused, Val0}, Bs, BsSize) ->\n    Sz = bit_size(Val0) - Unused,\n    <<Val:Sz/bits,_/bits>> = Val0,\n    check_named_bitstring(Val, Bs, BsSize);\ncheck_legacy_named_bitstring(Val, Bs, BsSize) when is_integer(Val) ->\n    L = legacy_int_to_bitlist(Val),\n    check_named_bitstring(<< \n                            <<B:1>> ||\n                                B <- L\n                          >>,\n                          Bs, BsSize);\ncheck_legacy_named_bitstring(Val, Bs, BsSize) ->\n    check_named_bitstring(Val, Bs, BsSize).\n">>},
 {{check,check_legacy_named_bitstring,4},
  <<"\ncheck_legacy_named_bitstring([Int | _] = Val, Names, Bs, BsSize)\n    when is_integer(Int) ->\n    check_named_bitstring(<< \n                            <<B:1>> ||\n                                B <- Val\n                          >>,\n                          Names, Bs, BsSize);\ncheck_legacy_named_bitstring({Unused, Val0}, Names, Bs, BsSize) ->\n    Sz = bit_size(Val0) - Unused,\n    <<Val:Sz/bits,_/bits>> = Val0,\n    check_named_bitstring(Val, Names, Bs, BsSize);\ncheck_legacy_named_bitstring(Val, Names, Bs, BsSize)\n    when is_integer(Val) ->\n    L = legacy_int_to_bitlist(Val),\n    check_named_bitstring(<< \n                            <<B:1>> ||\n                                B <- L\n                          >>,\n                          Names, Bs, BsSize);\ncheck_legacy_named_bitstring(Val, Names, Bs, BsSize) ->\n    check_named_bitstring(Val, Names, Bs, BsSize).\n">>},
 {{check,legacy_int_to_bitlist,1},
  <<"\nlegacy_int_to_bitlist(0) ->\n    [];\nlegacy_int_to_bitlist(Int) ->\n    [Int band 1 | legacy_int_to_bitlist(Int bsr 1)].\n">>},
 {{check,check_named_bitstring,3},
  <<"\ncheck_named_bitstring(Bs, Bs, _) ->\n    true;\ncheck_named_bitstring(Val, Bs, BsSize) ->\n    Rest = bit_size(Val) - BsSize,\n    case Val of\n        <<Bs:BsSize/bits,0:Rest>> ->\n            true;\n        _ ->\n            throw(false)\n    end.\n">>},
 {{check,check_named_bitstring,4},
  <<"\ncheck_named_bitstring([_ | _] = Val, Names, _, _) ->\n    case lists:sort(Val) of\n        Names ->\n            true;\n        _ ->\n            throw(false)\n    end;\ncheck_named_bitstring(Bs, _, Bs, _) ->\n    true;\ncheck_named_bitstring(Val, _, Bs, BsSize) ->\n    Rest = bit_size(Val) - BsSize,\n    case Val of\n        <<Bs:BsSize/bits,0:Rest>> ->\n            true;\n        _ ->\n            throw(false)\n    end.\n">>},
 {{check,check_octetstring,2},
  <<"\ncheck_octetstring(V, V) ->\n    true;\ncheck_octetstring(V, Def) when is_list(V) ->\n    case list_to_binary(V) of\n        Def ->\n            true;\n        _ ->\n            throw(false)\n    end;\ncheck_octetstring(_, _) ->\n    throw(false).\n">>},
 {{check,check_objectidentifier,2},
  <<"\ncheck_objectidentifier(Value, {Prefix, Tail}) when is_tuple(Value) ->\n    check_oid(tuple_to_list(Value), Prefix, Tail);\ncheck_objectidentifier(_, _) ->\n    throw(false).\n">>},
 {{check,check_oid,3},
  <<"\ncheck_oid([H | T], [K | Ks], Tail) ->\n    case lists:member(H, K) of\n        false ->\n            throw(false);\n        true ->\n            check_oid(T, Ks, Tail)\n    end;\ncheck_oid(Tail, [], Tail) ->\n    true;\ncheck_oid(_, _, _) ->\n    throw(false).\n">>},
 {{check,check_objectdescriptor,2},
  <<"\ncheck_objectdescriptor(_, asn1_DEFAULT) ->\n    true;\ncheck_objectdescriptor(OD, OD) ->\n    true;\ncheck_objectdescriptor(OD, OD) ->\n    throw({error, {not_implemented_yet, check_objectdescriptor}}).\n">>},
 {{check,check_real,2},
  <<"\ncheck_real(_, asn1_DEFAULT) ->\n    true;\ncheck_real(R, R) ->\n    true;\ncheck_real(_, _) ->\n    throw({error, {not_implemented_yet, check_real}}).\n">>},
 {{check,check_restrictedstring,2},
  <<"\ncheck_restrictedstring(Val, Val) ->\n    true;\ncheck_restrictedstring([V | Rest1], [V | Rest2]) ->\n    check_restrictedstring(Rest1, Rest2);\ncheck_restrictedstring([V1 | Rest1], [V2 | Rest2]) ->\n    check_restrictedstring(V1, V2),\n    check_restrictedstring(Rest1, Rest2);\ncheck_restrictedstring({V1, V2}, [V1, V2]) ->\n    true;\ncheck_restrictedstring([V1, V2], {V1, V2}) ->\n    true;\ncheck_restrictedstring({V1, V2, V3, V4}, [V1, V2, V3, V4]) ->\n    true;\ncheck_restrictedstring([V1, V2, V3, V4], {V1, V2, V3, V4}) ->\n    true;\ncheck_restrictedstring(V1, V2) when is_tuple(V1) ->\n    check_restrictedstring(tuple_to_list(V1), V2);\ncheck_restrictedstring(_, _) ->\n    throw(false).\n">>},
 {{check,check_literal_sof,2},
  <<"\ncheck_literal_sof(Value, Default) ->\n    case lists:sort(Value) of\n        Default ->\n            true;\n        _ ->\n            throw(false)\n    end.\n">>},
 {{ext,transform_to_EXTERNAL1990,1},
  <<"\ntransform_to_EXTERNAL1990({_, _, _, _} = Val) ->\n    transform_to_EXTERNAL1990(tuple_to_list(Val), []);\ntransform_to_EXTERNAL1990(Val) when is_tuple(Val) ->\n    Val.\n">>},
 {{ext,transform_to_EXTERNAL1990,2},
  <<"\ntransform_to_EXTERNAL1990(['EXTERNAL' | Rest], Acc) ->\n    transform_to_EXTERNAL1990(Rest, ['EXTERNAL' | Acc]);\ntransform_to_EXTERNAL1990([{syntax, Syntax} | Rest], Acc) ->\n    transform_to_EXTERNAL1990(Rest, [asn1_NOVALUE, Syntax | Acc]);\ntransform_to_EXTERNAL1990([{'presentation-context-id', PCid} | Rest],\n                          Acc) ->\n    transform_to_EXTERNAL1990(Rest, [PCid, asn1_NOVALUE | Acc]);\ntransform_to_EXTERNAL1990([{'context-negotiation', Context_negot} |\n                           Rest],\n                          Acc) ->\n    {_, Presentation_Cid, Transfer_syntax} = Context_negot,\n    transform_to_EXTERNAL1990(Rest,\n                              [Presentation_Cid, Transfer_syntax | Acc]);\ntransform_to_EXTERNAL1990([asn1_NOVALUE | Rest], Acc) ->\n    transform_to_EXTERNAL1990(Rest, [asn1_NOVALUE | Acc]);\ntransform_to_EXTERNAL1990([Data_val_desc, Data_value], Acc)\n    when is_list(Data_value); is_binary(Data_value) ->\n    list_to_tuple(lists:reverse([{'octet-aligned', Data_value},\n                                 Data_val_desc | Acc]));\ntransform_to_EXTERNAL1990([Data_val_desc, Data_value], Acc)\n    when is_binary(Data_value) ->\n    list_to_tuple(lists:reverse([{'single-ASN1-type', Data_value},\n                                 Data_val_desc | Acc]));\ntransform_to_EXTERNAL1990([Data_value], Acc)\n    when is_list(Data_value); is_binary(Data_value) ->\n    list_to_tuple(lists:reverse([{'octet-aligned', Data_value} | Acc])).\n">>},
 {{ext,transform_to_EXTERNAL1990_maps,1},
  <<"\ntransform_to_EXTERNAL1990_maps(#{identification := Id,\n                                 'data-value' := Value} =\n                                   V) ->\n    M0 =\n        case Id of\n            {syntax, DRef} ->\n                #{'direct-reference' => DRef};\n            {'presentation-context-id', IndRef} ->\n                #{'indirect-reference' => IndRef};\n            {'context-negotiation',\n             #{'presentation-context-id' := IndRef,\n               'transfer-syntax' := DRef}} ->\n                #{'direct-reference' => DRef,\n                  'indirect-reference' => IndRef}\n        end,\n    M = case V of\n            #{'data-value-descriptor' := Dvd} ->\n                M0#{'data-value-descriptor' => Dvd};\n            #{} ->\n                M0\n        end,\n    M#{encoding => {'octet-aligned', Value}};\ntransform_to_EXTERNAL1990_maps(#{encoding := _} = V) ->\n    V.\n">>},
 {{ext,transform_to_EXTERNAL1994,1},
  <<"\ntransform_to_EXTERNAL1994({'EXTERNAL', DRef, IndRef, Data_v_desc,\n                           Encoding} =\n                              V) ->\n    Identification =\n        case {DRef, IndRef} of\n            {DRef, asn1_NOVALUE} ->\n                {syntax, DRef};\n            {asn1_NOVALUE, IndRef} ->\n                {'presentation-context-id', IndRef};\n            _ ->\n                {'context-negotiation',\n                 {'EXTERNAL_identification_context-negotiation', IndRef,\n                  DRef}}\n        end,\n    case Encoding of\n        {'octet-aligned', Val} when is_list(Val); is_binary(Val) ->\n            {'EXTERNAL', Identification, Data_v_desc, Val};\n        _ ->\n            V\n    end.\n">>},
 {{ext,transform_to_EXTERNAL1994_maps,1},
  <<"\ntransform_to_EXTERNAL1994_maps(V0) ->\n    Identification =\n        case V0 of\n            #{'direct-reference' := DRef,\n              'indirect-reference' := asn1_NOVALUE} ->\n                {syntax, DRef};\n            #{'direct-reference' := asn1_NOVALUE,\n              'indirect-reference' := IndRef} ->\n                {'presentation-context-id', IndRef};\n            #{'direct-reference' := DRef,\n              'indirect-reference' := IndRef} ->\n                {'context-negotiation',\n                 #{'transfer-syntax' => DRef,\n                   'presentation-context-id' => IndRef}}\n        end,\n    case V0 of\n        #{encoding := {'octet-aligned', Val}}\n            when is_list(Val); is_binary(Val) ->\n            V = #{identification => Identification, 'data-value' => Val},\n            case V0 of\n                #{'data-value-descriptor' := asn1_NOVALUE} ->\n                    V;\n                #{'data-value-descriptor' := Dvd} ->\n                    V#{'data-value-descriptor' => Dvd}\n            end;\n        _ ->\n            V = [ \n                 {K, V} ||\n                     {K, V} <- maps:to_list(V0),\n                     V =/= asn1_NOVALUE\n                ],\n            maps:from_list(V)\n    end.\n">>},
 {{jer,encode_jer,3},
  <<"\nencode_jer(Module, InfoFunc, Val) ->\n    Info = Module:InfoFunc(),\n    encode_jer(Info, Val).\n">>},
 {{jer,encode_jer,2},
  <<"\nencode_jer({sequence_tab, Simple, Sname, Arity, CompInfos}, Value)\n    when tuple_size(Value) == Arity + 1 ->\n    [Sname | Clist] = tuple_to_list(Value),\n    encode_jer_component_tab(CompInfos, Clist, Simple, #{});\nencode_jer({sequence_map, _Sname, _Arity, CompInfos}, Value)\n    when is_map(Value) ->\n    encode_jer_component_map(CompInfos, Value, []);\nencode_jer({sequence, Sname, Arity, CompInfos}, Value)\n    when tuple_size(Value) == Arity + 1 ->\n    [Sname | Clist] = tuple_to_list(Value),\n    encode_jer_component(CompInfos, Clist, []);\nencode_jer(string, Str) when is_list(Str) ->\n    list_to_binary(Str);\nencode_jer({string, _Prop}, Str) when is_list(Str) ->\n    list_to_binary(Str);\nencode_jer(string, Str) when is_binary(Str) ->\n    Str;\nencode_jer({string, _Prop}, Str) when is_binary(Str) ->\n    Str;\nencode_jer('INTEGER', Int) when is_integer(Int) ->\n    Int;\nencode_jer({'INTEGER', {Min, Max}}, Int)\n    when is_integer(Int), Max >= Int, Int >= Min ->\n    Int;\nencode_jer({'INTEGER_NNL', _NNL}, Int) when is_integer(Int) ->\n    Int;\nencode_jer(Type = {'INTEGER_NNL', NNList}, Int) when is_atom(Int) ->\n    case lists:keyfind(Int, 1, NNList) of\n        {_, NewVal} ->\n            NewVal;\n        _ ->\n            exit({error, {asn1, {Type, Int}}})\n    end;\nencode_jer({Type = {'INTEGER_NNL', _NNList}, _Constraint}, Int)\n    when is_atom(Int) ->\n    encode_jer(Type, Int);\nencode_jer({{'INTEGER_NNL', _NNList}, Constraint}, Int)\n    when is_integer(Int) ->\n    encode_jer({'INTEGER', Constraint}, Int);\nencode_jer('BOOLEAN', Bool) when is_boolean(Bool) ->\n    Bool;\nencode_jer({'BOOLEAN', _Prop}, Bool) when is_boolean(Bool) ->\n    Bool;\nencode_jer('NULL', _) ->\n    null;\nencode_jer(legacy_octet_string, Value) when is_list(Value) ->\n    bitstring2json(list_to_binary(Value));\nencode_jer({legacy_octet_string, _Prop}, Value) when is_list(Value) ->\n    bitstring2json(list_to_binary(Value));\nencode_jer(octet_string, Value) when is_binary(Value) ->\n    encode_jer({octet_string, []}, Value);\nencode_jer({octet_string, _Prop}, Value) when is_binary(Value) ->\n    bitstring2json(Value);\nencode_jer({'ENUMERATED', EnumMap}, Val) when is_map_key(Val, EnumMap) ->\n    Val;\nencode_jer({Type = {'ENUMERATED', _EnumList}, _Constr}, Val) ->\n    encode_jer(Type, Val);\nencode_jer({'ENUMERATED_EXT', _EnumMap}, Val) when is_atom(Val) ->\n    Val;\nencode_jer({Type = {'ENUMERATED_EXT', _EnumList}, _Constr}, Val) ->\n    encode_jer(Type, Val);\nencode_jer({typeinfo, {Module, Func}}, Val) ->\n    TypeInfo = Module:Func(),\n    encode_jer(TypeInfo, Val);\nencode_jer({sof, Type}, Vals) when is_list(Vals) ->\n    [ \n     encode_jer(Type, Val) ||\n         Val <- Vals\n    ];\nencode_jer({choice, Choices}, {Alt, Value}) ->\n    case is_map_key(AltBin = atom_to_binary(Alt, utf8), Choices) of\n        true ->\n            EncodedVal = encode_jer(maps:get(AltBin, Choices), Value),\n            #{AltBin => EncodedVal};\n        false ->\n            exit({error, {asn1, {invalid_choice, Alt, Choices}}})\n    end;\nencode_jer(bit_string, Value) ->\n    Str = bitstring2json(Value),\n    #{value => Str, length => bit_size(Value)};\nencode_jer({bit_string, FixedLength}, Value)\n    when is_bitstring(Value), is_integer(FixedLength) ->\n    Value2 = jer_padbitstr(Value, FixedLength),\n    bitstring2json(Value2);\nencode_jer(compact_bit_string, Compact) ->\n    BitStr = jer_compact2bitstr(Compact),\n    encode_jer(bit_string, BitStr);\nencode_jer({compact_bit_string, FixedLength},\n           Compact = {_Unused, Binary})\n    when is_binary(Binary) ->\n    BitStr = jer_compact2bitstr(Compact),\n    encode_jer({bit_string, FixedLength}, BitStr);\nencode_jer({bit_string_nnl, NNL}, Value) ->\n    Value1 = jer_bit_str2bitstr(Value, NNL),\n    encode_jer(bit_string, Value1);\nencode_jer({{bit_string_nnl, NNL}, FixedLength}, Value) ->\n    Value1 = jer_bit_str2bitstr(Value, NNL),\n    encode_jer({bit_string, FixedLength}, Value1);\nencode_jer({compact_bit_string_nnl, NNL}, Value) ->\n    Value1 = jer_bit_str2bitstr(Value, NNL),\n    encode_jer(bit_string, Value1);\nencode_jer({{compact_bit_string_nnl, NNL}, FixedLength}, Value) ->\n    Value1 = jer_bit_str2bitstr(Value, NNL),\n    encode_jer({bit_string, FixedLength}, Value1);\nencode_jer('OBJECT IDENTIFIER', Oid) when is_tuple(Oid) ->\n    oid2json(Oid);\nencode_jer('RELATIVE-OID', Oid) when is_tuple(Oid) ->\n    oid2json(Oid);\nencode_jer({'ObjClassFieldType', _, _}, Val) when is_binary(Val) ->\n    Val;\nencode_jer('ASN1_OPEN_TYPE', Val) when is_binary(Val) ->\n    Val;\nencode_jer(Type, Val) ->\n    exit({error, {asn1, {{encode, Type}, Val}}}).\n">>},
 {{jer,encode_jer_component_tab,4},
  <<"\nencode_jer_component_tab([{_Name, _Type, 'OPTIONAL'} | CompInfos],\n                         [asn1_NOVALUE | Rest],\n                         Simple, MapAcc) ->\n    encode_jer_component_tab(CompInfos, Rest, Simple, MapAcc);\nencode_jer_component_tab([{_Name, _Type, {'DEFAULT', _}} | CompInfos],\n                         [asn1_DEFAULT | Rest],\n                         Simple, MapAcc) ->\n    encode_jer_component_tab(CompInfos, Rest, Simple, MapAcc);\nencode_jer_component_tab([{Name, Type, _OptOrDefault} | CompInfos],\n                         [Value | Rest],\n                         Simple, MapAcc) ->\n    Enc = encode_jer(Type, Value),\n    encode_jer_component_tab(CompInfos, Rest, Simple,\n                             MapAcc#{Name => Enc});\nencode_jer_component_tab([], _, _Simple, MapAcc) ->\n    MapAcc.\n">>},
 {{jer,encode_jer_component_map,3},
  <<"\nencode_jer_component_map([{Name, AName, Type, _OptOrDefault} |\n                          CompInfos],\n                         MapVal, Acc)\n    when is_map_key(AName, MapVal) ->\n    Value = maps:get(AName, MapVal),\n    Enc = encode_jer(Type, Value),\n    encode_jer_component_map(CompInfos, MapVal, [{Name, Enc} | Acc]);\nencode_jer_component_map([{_Name, _AName, _Type, 'OPTIONAL'} |\n                          CompInfos],\n                         MapVal, Acc) ->\n    encode_jer_component_map(CompInfos, MapVal, Acc);\nencode_jer_component_map([{_Name, _AName, _Type, {'DEFAULT', _}} |\n                          CompInfos],\n                         MapVal, Acc) ->\n    encode_jer_component_map(CompInfos, MapVal, Acc);\nencode_jer_component_map([], MapVal, []) when map_size(MapVal) == 0 ->\n    #{};\nencode_jer_component_map([], MapVal, Acc)\n    when map_size(MapVal) == length(Acc) ->\n    lists:reverse(Acc);\nencode_jer_component_map(_, MapVal, Acc) ->\n    ErroneousKeys =\n        maps:keys(MapVal)\n        --\n        [ \n         K ||\n             {K, _V} <- Acc\n        ],\n    exit({error,\n          {asn1,\n           {{encode, 'SEQUENCE'}, {erroneous_keys, ErroneousKeys}}}}).\n">>},
 {{jer,encode_jer_component,3},
  <<"\nencode_jer_component([{_Name, _Type, 'OPTIONAL'} | CompInfos],\n                     [asn1_NOVALUE | Rest],\n                     Acc) ->\n    encode_jer_component(CompInfos, Rest, Acc);\nencode_jer_component([{_Name, _Type, {'DEFAULT', _}} | CompInfos],\n                     [asn1_DEFAULT | Rest],\n                     Acc) ->\n    encode_jer_component(CompInfos, Rest, Acc);\nencode_jer_component([{Name, Type, _OptOrDefault} | CompInfos],\n                     [Value | Rest],\n                     Acc) ->\n    Enc = encode_jer(Type, Value),\n    encode_jer_component(CompInfos, Rest, [{Name, Enc} | Acc]);\nencode_jer_component([], _, []) ->\n    #{};\nencode_jer_component([], _, Acc) ->\n    lists:reverse(Acc).\n">>},
 {{jer,decode_jer,3},
  <<"\ndecode_jer(Module, InfoFunc, Val) ->\n    Info = Module:InfoFunc(),\n    decode_jer(Info, Val).\n">>},
 {{jer,decode_jer,2},
  <<"\ndecode_jer({'ENUMERATED', _EnumList}, Val) when is_binary(Val) ->\n    binary_to_existing_atom(Val, utf8);\ndecode_jer({'ENUMERATED', _EnumList}, Val) when is_boolean(Val) ->\n    Val;\ndecode_jer({'ENUMERATED', _EnumList}, null) ->\n    null;\ndecode_jer({Type = {'ENUMERATED', _EnumList}, _Constr}, Val) ->\n    decode_jer(Type, Val);\ndecode_jer({'ENUMERATED_EXT', EnumList}, Val) ->\n    decode_jer({'ENUMERATED', EnumList}, Val);\ndecode_jer({Type = {'ENUMERATED_EXT', _EnumList}, _Constr}, Val) ->\n    decode_jer(Type, Val);\ndecode_jer({typeinfo, {Module, Func}}, Val) ->\n    TypeInfo = Module:Func(),\n    decode_jer(TypeInfo, Val);\ndecode_jer({sequence, Sname, _Arity, CompInfos}, Value)\n    when is_map(Value) ->\n    DecodedComps = decode_jer_component(CompInfos, Value, []),\n    list_to_tuple([Sname | DecodedComps]);\ndecode_jer({sequence_map, _Sname, _Arity, CompInfos}, Value)\n    when is_map(Value) ->\n    decode_jer_component_map(CompInfos, Value, []);\ndecode_jer(string, Str) when is_binary(Str) ->\n    binary_to_list(Str);\ndecode_jer({string, _Prop}, Str) when is_binary(Str) ->\n    binary_to_list(Str);\ndecode_jer('INTEGER', Int) when is_integer(Int) ->\n    Int;\ndecode_jer({'INTEGER', {Min, Max}}, Int)\n    when is_integer(Int), Max >= Int, Int >= Min ->\n    Int;\ndecode_jer({Type = {'INTEGER_NNL', _NNList}, _}, Int) ->\n    decode_jer(Type, Int);\ndecode_jer({'INTEGER_NNL', NNList}, Int) ->\n    case lists:keyfind(Int, 2, NNList) of\n        {NewName, _} ->\n            NewName;\n        _ ->\n            Int\n    end;\ndecode_jer('BOOLEAN', Bool) when is_boolean(Bool) ->\n    Bool;\ndecode_jer({'BOOLEAN', _Prop}, Bool) when is_boolean(Bool) ->\n    Bool;\ndecode_jer('NULL', null) ->\n    'NULL';\ndecode_jer(legacy_octet_string, Str) when is_binary(Str) ->\n    json2octetstring2string(binary_to_list(Str));\ndecode_jer(octet_string, Str) when is_binary(Str) ->\n    json2octetstring2binary(binary_to_list(Str));\ndecode_jer({sof, Type}, Vals) when is_list(Vals) ->\n    [ \n     decode_jer(Type, Val) ||\n         Val <- Vals\n    ];\ndecode_jer({choice, ChoiceTypes}, ChoiceVal) ->\n    [{Alt, Val}] = maps:to_list(ChoiceVal),\n    case ChoiceTypes of\n        #{Alt := Type} ->\n            Type = maps:get(Alt, ChoiceTypes),\n            {binary_to_atom(Alt, utf8), decode_jer(Type, Val)};\n        _ ->\n            exit({error,\n                  {asn1, {invalid_choice, Alt, maps:keys(ChoiceTypes)}}})\n    end;\ndecode_jer(bit_string, #{<<\"value\">> := Str, <<\"length\">> := Length}) ->\n    json2bitstring(binary_to_list(Str), Length);\ndecode_jer({bit_string, FixedLength}, Str) when is_binary(Str) ->\n    json2bitstring(binary_to_list(Str), FixedLength);\ndecode_jer({bit_string_nnl, NNL},\n           #{<<\"value\">> := Str, <<\"length\">> := Length}) ->\n    BitStr = json2bitstring(binary_to_list(Str), Length),\n    jer_bitstr2names(BitStr, NNL);\ndecode_jer({{bit_string_nnl, NNL}, FixedLength}, Str)\n    when is_binary(Str) ->\n    BitStr = json2bitstring(binary_to_list(Str), FixedLength),\n    jer_bitstr2names(BitStr, NNL);\ndecode_jer({compact_bit_string_nnl, NNL}, Value) ->\n    decode_jer({bit_string_nnl, NNL}, Value);\ndecode_jer({{compact_bit_string_nnl, NNL}, FixedLength}, Value) ->\n    decode_jer({{bit_string_nnl, NNL}, FixedLength}, Value);\ndecode_jer(compact_bit_string,\n           #{<<\"value\">> := Str, <<\"length\">> := Length}) ->\n    BitStr = json2bitstring(binary_to_list(Str), Length),\n    jer_bitstr2compact(BitStr);\ndecode_jer({compact_bit_string, FixedLength}, Str) ->\n    BitStr = json2bitstring(binary_to_list(Str), FixedLength),\n    Unused = (8 - FixedLength rem 8) band 7,\n    {Unused, <<BitStr/bitstring,0:Unused>>};\ndecode_jer('OBJECT IDENTIFIER', OidBin) when is_binary(OidBin) ->\n    json2oid(OidBin);\ndecode_jer('RELATIVE-OID', OidBin) when is_binary(OidBin) ->\n    json2oid(OidBin);\ndecode_jer({'ObjClassFieldType', _, _}, Bin) when is_binary(Bin) ->\n    Bin;\ndecode_jer('ASN1_OPEN_TYPE', Bin) when is_binary(Bin) ->\n    Bin;\ndecode_jer(Type, Val) ->\n    exit({error, {asn1, {{decode, Type}, Val}}}).\n">>},
 {{jer,decode_jer_component,3},
  <<"\ndecode_jer_component([{Name, Type, _OptOrDefault} | CompInfos],\n                     VMap, Acc)\n    when is_map_key(Name, VMap) ->\n    Value = maps:get(Name, VMap),\n    Dec = decode_jer(Type, Value),\n    decode_jer_component(CompInfos, VMap, [Dec | Acc]);\ndecode_jer_component([{_Name, _Type, 'OPTIONAL'} | CompInfos],\n                     VMap, Acc) ->\n    decode_jer_component(CompInfos, VMap, [asn1_NOVALUE | Acc]);\ndecode_jer_component([{_Name, _Type, {'DEFAULT', Dvalue}} | CompInfos],\n                     VMap, Acc) ->\n    decode_jer_component(CompInfos, VMap, [Dvalue | Acc]);\ndecode_jer_component([{Name, _Type, _OptOrDefault} | _CompInfos],\n                     VMap, _Acc) ->\n    exit({error,\n          {asn1, {{decode, {mandatory_component_missing, Name}}, VMap}}});\ndecode_jer_component([], _, Acc) ->\n    lists:reverse(Acc).\n">>},
 {{jer,decode_jer_component_map,3},
  <<"\ndecode_jer_component_map([{Name, AtomName, Type, _OptOrDefault} |\n                          CompInfos],\n                         VMap, Acc)\n    when is_map_key(Name, VMap) ->\n    Value = maps:get(Name, VMap),\n    Dec = decode_jer(Type, Value),\n    decode_jer_component_map(CompInfos, VMap, [{AtomName, Dec} | Acc]);\ndecode_jer_component_map([{_Name, _AtomName, _Type, 'OPTIONAL'} |\n                          CompInfos],\n                         VMap, Acc) ->\n    decode_jer_component_map(CompInfos, VMap, Acc);\ndecode_jer_component_map([{_Name, AtomName, _Type, {'DEFAULT', Dvalue}} |\n                          CompInfos],\n                         VMap, Acc) ->\n    decode_jer_component_map(CompInfos, VMap,\n                             [{AtomName, Dvalue} | Acc]);\ndecode_jer_component_map([{Name, _AtomName, _Type, _OptOrDefault} |\n                          _CompInfos],\n                         VMap, _Acc) ->\n    exit({error,\n          {asn1, {{decode, {mandatory_component_missing, Name}}, VMap}}});\ndecode_jer_component_map([], _, Acc) ->\n    maps:from_list(Acc).\n">>},
 {{jer,json2octetstring2binary,1},
  <<"\njson2octetstring2binary(Value) ->\n    list_to_binary(json2octetstring(Value, [])).\n">>},
 {{jer,json2octetstring2string,1},
  <<"\njson2octetstring2string(Value) ->\n    json2octetstring(Value, []).\n">>},
 {{jer,json2octetstring,2},
  <<"\njson2octetstring([A1, A2 | Rest], Acc) ->\n    Int = list_to_integer([A1, A2], 16),\n    json2octetstring(Rest, [Int | Acc]);\njson2octetstring([], Acc) ->\n    lists:reverse(Acc).\n">>},
 {{jer,json2bitstring,2},
  <<"\njson2bitstring(Value, Length) ->\n    json2bitstring(Value, Length, []).\n">>},
 {{jer,json2bitstring,3},
  <<"\njson2bitstring([A1, A2], Length, Acc) ->\n    Int = list_to_integer([A1, A2], 16) bsr (8 - Length),\n    Bin = list_to_binary(lists:reverse(Acc)),\n    <<Bin/binary,Int:Length>>;\njson2bitstring([A1, A2 | Rest], Length, Acc) ->\n    Int = list_to_integer([A1, A2], 16),\n    json2bitstring(Rest, Length - 8, [Int | Acc]);\njson2bitstring([], 0, Acc) ->\n    Bin = list_to_binary(lists:reverse(Acc)),\n    Bin.\n">>},
 {{jer,bitstring2json,1},
  <<"\nbitstring2json(BitStr) when is_binary(BitStr) ->\n    octetstring2json(binary_to_list(BitStr));\nbitstring2json(BitStr) ->\n    Pad = 8 - bit_size(BitStr) rem 8,\n    NewStr = <<BitStr/bitstring,0:Pad>>,\n    octetstring2json(binary_to_list(NewStr)).\n">>},
 {{jer,octetstring2json,1},
  <<"\noctetstring2json(List) when is_list(List) ->\n    list_to_binary([ \n                    begin\n                        Num = integer_to_list(X, 16),\n                        if\n                            length(Num) == 1 ->\n                                \"0\" ++ Num;\n                            true ->\n                                Num\n                        end\n                    end ||\n                        X <- List\n                   ]).\n">>},
 {{jer,oid2json,1},
  <<"\noid2json(Oid) when is_tuple(Oid) ->\n    OidList = tuple_to_list(Oid),\n    OidNumberStr =\n        [ \n         integer_to_list(V) ||\n             V <- OidList\n        ],\n    oid2json(OidNumberStr, []).\n">>},
 {{jer,oid2json,2},
  <<"\noid2json([Num | T], []) ->\n    oid2json(T, [Num]);\noid2json([Num | T], Acc) ->\n    oid2json(T, [Num, $. | Acc]);\noid2json([], Acc) ->\n    list_to_binary(lists:reverse(Acc)).\n">>},
 {{jer,json2oid,1},
  <<"\njson2oid(OidStr) when is_binary(OidStr) ->\n    OidList = binary:split(OidStr, [<<\".\">>], [global]),\n    OidNumList =\n        [ \n         binary_to_integer(Num) ||\n             Num <- OidList\n        ],\n    list_to_tuple(OidNumList).\n">>},
 {{jer,jer_bit_str2bitstr,2},
  <<"\njer_bit_str2bitstr(Compact = {_Unused, _Binary}, _NamedBitList) ->\n    jer_compact2bitstr(Compact);\njer_bit_str2bitstr(Int, _NamedBitList) when is_integer(Int) ->\n    jer_compact2bitstr(Int);\njer_bit_str2bitstr(BitList = [Bit | _], _NamedBitList)\n    when Bit == 1; Bit == 0 ->\n    Int =\n        list_to_integer([ \n                         case B of\n                             0 ->\n                                 $0;\n                             1 ->\n                                 $1\n                         end ||\n                             B <- BitList\n                        ],\n                        2),\n    Len = length(BitList),\n    <<Int:Len>>;\njer_bit_str2bitstr([H | _] = Bits, NamedBitList) when is_atom(H) ->\n    jer_do_encode_named_bit_string(Bits, NamedBitList);\njer_bit_str2bitstr([{bit, _} | _] = Bits, NamedBitList) ->\n    jer_do_encode_named_bit_string(Bits, NamedBitList);\njer_bit_str2bitstr([], _NamedBitList) ->\n    <<>>;\njer_bit_str2bitstr(BitStr, _NamedBitList) when is_bitstring(BitStr) ->\n    BitStr.\n">>},
 {{jer,jer_compact2bitstr,1},
  <<"\njer_compact2bitstr({Unused, Binary}) ->\n    Size = bit_size(Binary) - Unused,\n    <<BitStr:Size/bitstring,_/bitstring>> = Binary,\n    BitStr;\njer_compact2bitstr(Int) when is_integer(Int) ->\n    jer_int2bitstr(Int);\njer_compact2bitstr(BitList = [Bit | _]) when Bit == 1; Bit == 0 ->\n    IntStr = jer_skip_trailing_zeroes(BitList, []),\n    Int = list_to_integer(IntStr, 2),\n    Len = length(IntStr),\n    <<Int:Len>>.\n">>},
 {{jer,jer_skip_trailing_zeroes,2},
  <<"\njer_skip_trailing_zeroes([1 | Rest], Acc) ->\n    jer_skip_trailing_zeroes(Rest, [$1 | Acc]);\njer_skip_trailing_zeroes([0 | Rest], Acc) ->\n    jer_skip_trailing_zeroes(Rest, [$0 | Acc]);\njer_skip_trailing_zeroes([], [$0 | Acc]) ->\n    jer_skip_trailing_zeroes([], Acc);\njer_skip_trailing_zeroes([], Acc) ->\n    lists:reverse(Acc).\n">>},
 {{jer,jer_padbitstr,2},
  <<"\njer_padbitstr(BitStr, FixedLength) when bit_size(BitStr) == FixedLength ->\n    BitStr;\njer_padbitstr(BitStr, FixedLength) when bit_size(BitStr) < FixedLength ->\n    Len = bit_size(BitStr),\n    PadLen = FixedLength - Len,\n    <<BitStr/bitstring,0:PadLen>>.\n">>},
 {{jer,jer_int2bitstr,1},
  <<"\njer_int2bitstr(Int) when is_integer(Int), Int >= 0 ->\n    jer_int2bitstr(Int, <<>>).\n">>},
 {{jer,jer_int2bitstr,2},
  <<"\njer_int2bitstr(0, Acc) ->\n    Acc;\njer_int2bitstr(Int, Acc) ->\n    Bit = Int band 1,\n    jer_int2bitstr(Int bsr 1, <<Acc/bitstring,Bit:1>>).\n">>},
 {{jer,jer_bitstr2compact,1},
  <<"\njer_bitstr2compact(BitStr) ->\n    Size = bit_size(BitStr),\n    Unused = (8 - Size rem 8) band 7,\n    {Unused, <<BitStr/bitstring,0:Unused>>}.\n">>},
 {{jer,jer_do_encode_named_bit_string,2},
  <<"\njer_do_encode_named_bit_string([FirstVal | RestVal], NamedBitList) ->\n    ToSetPos =\n        jer_get_all_bitposes([FirstVal | RestVal], NamedBitList, []),\n    Size = lists:max(ToSetPos) + 1,\n    BitList = jer_make_and_set_list(Size, ToSetPos, 0),\n    encode_bitstring(BitList).\n">>},
 {{jer,jer_get_all_bitposes,3},
  <<"\njer_get_all_bitposes([{bit, ValPos} | Rest], NamedBitList, Ack) ->\n    jer_get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]);\njer_get_all_bitposes([Val | Rest], NamedBitList, Ack) when is_atom(Val) ->\n    case lists:keyfind(Val, 1, NamedBitList) of\n        {_ValName, ValPos} ->\n            jer_get_all_bitposes(Rest, NamedBitList, [ValPos | Ack]);\n        _ ->\n            exit({error, {asn1, {bitstring_namedbit, Val}}})\n    end;\njer_get_all_bitposes([], _NamedBitList, Ack) ->\n    lists:sort(Ack).\n">>},
 {{jer,jer_make_and_set_list,3},
  <<"\njer_make_and_set_list(0, [], _) ->\n    [];\njer_make_and_set_list(0, _, _) ->\n    exit({error, {asn1, bitstring_sizeconstraint}});\njer_make_and_set_list(Len, [XPos | SetPos], XPos) ->\n    [1 | jer_make_and_set_list(Len - 1, SetPos, XPos + 1)];\njer_make_and_set_list(Len, [Pos | SetPos], XPos) ->\n    [0 | jer_make_and_set_list(Len - 1, [Pos | SetPos], XPos + 1)];\njer_make_and_set_list(Len, [], XPos) ->\n    [0 | jer_make_and_set_list(Len - 1, [], XPos + 1)].\n">>},
 {{jer,encode_bitstring,1},
  <<"\nencode_bitstring([B8, B7, B6, B5, B4, B3, B2, B1 | Rest]) ->\n    Val =\n        B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4)\n        bor\n        (B4 bsl 3)\n        bor\n        (B3 bsl 2)\n        bor\n        (B2 bsl 1)\n        bor\n        B1,\n    encode_bitstring(Rest, <<Val>>);\nencode_bitstring(Val) ->\n    unused_bitlist(Val, <<>>).\n">>},
 {{jer,encode_bitstring,2},
  <<"\nencode_bitstring([B8, B7, B6, B5, B4, B3, B2, B1 | Rest], Ack) ->\n    Val =\n        B8 bsl 7 bor (B7 bsl 6) bor (B6 bsl 5) bor (B5 bsl 4)\n        bor\n        (B4 bsl 3)\n        bor\n        (B3 bsl 2)\n        bor\n        (B2 bsl 1)\n        bor\n        B1,\n    encode_bitstring(Rest, [Ack, Val]);\nencode_bitstring([], Ack) ->\n    Ack;\nencode_bitstring(Rest, Ack) ->\n    unused_bitlist(Rest, Ack).\n">>},
 {{jer,unused_bitlist,2},
  <<"\nunused_bitlist([], Ack) ->\n    Ack;\nunused_bitlist([Bit | Rest], Ack) ->\n    unused_bitlist(Rest, <<Ack/bitstring,Bit:1>>).\n">>},
 {{jer,jer_bitstr2names,2},
  <<"\njer_bitstr2names(BitStr, []) ->\n    BitStr;\njer_bitstr2names(BitStr, NNL) ->\n    SortedList = lists:keysort(2, NNL),\n    jer_bitstr2names(BitStr, SortedList, 0, []).\n">>},
 {{jer,jer_bitstr2names,4},
  <<"\njer_bitstr2names(<<1:1,BitStr/bitstring>>,\n                 [{Name, Pos} | Rest],\n                 Pos, Acc) ->\n    jer_bitstr2names(BitStr, Rest, Pos + 1, [Name | Acc]);\njer_bitstr2names(<<1:1,BitStr/bitstring>>, NNL, Num, Acc) ->\n    jer_bitstr2names(BitStr, NNL, Num + 1, [{bit, Num} | Acc]);\njer_bitstr2names(<<0:1,BitStr/bitstring>>, [{_, Num} | Rest], Num, Acc) ->\n    jer_bitstr2names(BitStr, Rest, Num + 1, Acc);\njer_bitstr2names(<<0:1,BitStr/bitstring>>, NNL, Num, Acc) ->\n    jer_bitstr2names(BitStr, NNL, Num + 1, Acc);\njer_bitstr2names(<<>>, _, _, Acc) ->\n    lists:reverse(Acc).\n">>},
 {{per,skipextensions,3},
  <<"\nskipextensions(Bytes0, Nr, ExtensionBitstr)\n    when is_bitstring(ExtensionBitstr) ->\n    Prev = Nr - 1,\n    case ExtensionBitstr of\n        <<_:Prev,1:1,_/bitstring>> ->\n            {Len, Bytes1} = decode_length(Bytes0),\n            <<_:Len/binary,Bytes2/bitstring>> = Bytes1,\n            skipextensions(Bytes2, Nr + 1, ExtensionBitstr);\n        <<_:Prev,0:1,_/bitstring>> ->\n            skipextensions(Bytes0, Nr + 1, ExtensionBitstr);\n        _ ->\n            Bytes0\n    end.\n">>},
 {{per,align,1},
  <<"\nalign(Bin) when is_binary(Bin) ->\n    Bin;\nalign(BitStr) when is_bitstring(BitStr) ->\n    AlignBits = bit_size(BitStr) rem 8,\n    <<_:AlignBits,Rest/binary>> = BitStr,\n    Rest.\n">>},
 {{per,decode_length,1},
  <<"\ndecode_length(Buffer) ->\n    case align(Buffer) of\n        <<0:1,Oct:7,Rest/binary>> ->\n            {Oct, Rest};\n        <<2:2,Val:14,Rest/binary>> ->\n            {Val, Rest};\n        <<3:2,_Val:14,_Rest/binary>> ->\n            exit({error, {asn1, {decode_length, {nyi, above_16k}}}})\n    end.\n">>},
 {{per,complete,1},
  <<"\ncomplete(L0) ->\n    L = complete(L0, []),\n    case list_to_bitstring(L) of\n        <<>> ->\n            <<0>>;\n        Bin ->\n            Bin\n    end.\n">>},
 {{per,complete,2},
  <<"\ncomplete([], []) ->\n    [];\ncomplete([], [H | More]) ->\n    complete(H, More);\ncomplete([align | T], More) ->\n    complete(T, More);\ncomplete([[] | T], More) ->\n    complete(T, More);\ncomplete([[_ | _] = H], More) ->\n    complete(H, More);\ncomplete([[_ | _] = H | T], More) ->\n    complete(H, [T | More]);\ncomplete([H | T], More) when is_integer(H); is_binary(H) ->\n    [H | complete(T, More)];\ncomplete([H | T], More) ->\n    [H | complete(T, bit_size(H), More)];\ncomplete(Bin, More) when is_binary(Bin) ->\n    [Bin | complete([], More)];\ncomplete(Bin, More) ->\n    [Bin | complete([], bit_size(Bin), More)].\n">>},
 {{per,complete,3},
  <<"\ncomplete([], Bits, []) ->\n    case Bits band 7 of\n        0 ->\n            [];\n        N ->\n            [<<0:(8 - N)>>]\n    end;\ncomplete([], Bits, [H | More]) ->\n    complete(H, Bits, More);\ncomplete([align | T], Bits, More) ->\n    case Bits band 7 of\n        0 ->\n            complete(T, More);\n        1 ->\n            [<<0:7>> | complete(T, More)];\n        2 ->\n            [<<0:6>> | complete(T, More)];\n        3 ->\n            [<<0:5>> | complete(T, More)];\n        4 ->\n            [<<0:4>> | complete(T, More)];\n        5 ->\n            [<<0:3>> | complete(T, More)];\n        6 ->\n            [<<0:2>> | complete(T, More)];\n        7 ->\n            [<<0:1>> | complete(T, More)]\n    end;\ncomplete([[] | T], Bits, More) ->\n    complete(T, Bits, More);\ncomplete([[_ | _] = H], Bits, More) ->\n    complete(H, Bits, More);\ncomplete([[_ | _] = H | T], Bits, More) ->\n    complete(H, Bits, [T | More]);\ncomplete([H | T], Bits, More) when is_integer(H); is_binary(H) ->\n    [H | complete(T, Bits, More)];\ncomplete([H | T], Bits, More) ->\n    [H | complete(T, Bits + bit_size(H), More)];\ncomplete(Bin, Bits, More) when is_binary(Bin) ->\n    [Bin | complete([], Bits, More)];\ncomplete(Bin, Bits, More) ->\n    [Bin | complete([], Bits + bit_size(Bin), More)].\n">>},
 {{per,encode_fragmented_sof,3},
  <<"\nencode_fragmented_sof(Fun, Comps, Len) ->\n    encode_fragmented_sof_1(Fun, Comps, Len, 4).\n">>},
 {{per,encode_fragmented_sof_1,4},
  <<"\nencode_fragmented_sof_1(Encoder, Comps0, Len0, N) ->\n    SegSz = N * 16384,\n    if\n        Len0 >= SegSz ->\n            {Comps, B} = encode_components(Comps0, Encoder, SegSz, []),\n            Len = Len0 - SegSz,\n            [align,\n             <<3:2,N:6>>,\n             B |\n             encode_fragmented_sof_1(Encoder, Comps, Len, N)];\n        N > 1 ->\n            encode_fragmented_sof_1(Encoder, Comps0, Len0, N - 1);\n        Len0 < 128 ->\n            {[], B} = encode_components(Comps0, Encoder, Len0, []),\n            [align, Len0 | B];\n        Len0 < 16384 ->\n            {[], B} = encode_components(Comps0, Encoder, Len0, []),\n            [align, <<2:2,Len0:14>> | B]\n    end.\n">>},
 {{per,encode_components,4},
  <<"\nencode_components(Cs, _Encoder, 0, Acc) ->\n    {Cs, lists:reverse(Acc)};\nencode_components([C | Cs], Encoder, Size, Acc) ->\n    B = Encoder(C),\n    encode_components(Cs, Encoder, Size - 1, [B | Acc]).\n">>},
 {{per_common,decode_fragmented,3},
  <<"\ndecode_fragmented(SegSz0, Buf0, Unit) ->\n    SegSz = SegSz0 * Unit * 16384,\n    <<Res:SegSz/bitstring,Buf/bitstring>> = Buf0,\n    decode_fragmented_1(Buf, Unit, Res).\n">>},
 {{per_common,decode_fragmented_1,3},
  <<"\ndecode_fragmented_1(<<0:1,N:7,Buf0/bitstring>>, Unit, Res) ->\n    Sz = N * Unit,\n    <<S:Sz/bitstring,Buf/bitstring>> = Buf0,\n    {<<Res/bitstring,S/bitstring>>, Buf};\ndecode_fragmented_1(<<1:1,0:1,N:14,Buf0/bitstring>>, Unit, Res) ->\n    Sz = N * Unit,\n    <<S:Sz/bitstring,Buf/bitstring>> = Buf0,\n    {<<Res/bitstring,S/bitstring>>, Buf};\ndecode_fragmented_1(<<1:1,1:1,SegSz0:6,Buf0/bitstring>>, Unit, Res0) ->\n    SegSz = SegSz0 * Unit * 16384,\n    <<Frag:SegSz/bitstring,Buf/bitstring>> = Buf0,\n    Res = <<Res0/bitstring,Frag/bitstring>>,\n    decode_fragmented_1(Buf, Unit, Res).\n">>},
 {{per_common,decode_named_bit_string,2},
  <<"\ndecode_named_bit_string(Val, NNL) ->\n    Bits =\n        [ \n         B ||\n             <<B:1>> <= Val\n        ],\n    decode_named_bit_string_1(0, Bits, NNL, []).\n">>},
 {{per_common,decode_legacy_bit_string,1},
  <<"\ndecode_legacy_bit_string(Val) ->\n    [ \n     B ||\n         <<B:1>> <= Val\n    ].\n">>},
 {{per_common,decode_compact_bit_string,1},
  <<"\ndecode_compact_bit_string(Val) ->\n    PadLen = (8 - bit_size(Val) band 7) band 7,\n    {PadLen, <<Val/bitstring,0:PadLen>>}.\n">>},
 {{per_common,decode_chars,2},
  <<"\ndecode_chars(Val, N) ->\n    [ \n     C ||\n         <<C:N>> <= Val\n    ].\n">>},
 {{per_common,decode_chars,3},
  <<"\ndecode_chars(Val, N, Chars) ->\n    [ \n     element(C + 1, Chars) ||\n         <<C:N>> <= Val\n    ].\n">>},
 {{per_common,decode_chars_16bit,1},
  <<"\ndecode_chars_16bit(Val) ->\n    Cs =\n        [ \n         C ||\n             <<C:16>> <= Val\n        ],\n    decode_chars_16bit_1(Cs).\n">>},
 {{per_common,decode_big_chars,2},
  <<"\ndecode_big_chars(Val, N) ->\n    decode_big_chars_1(decode_chars(Val, N)).\n">>},
 {{per_common,decode_oid,1},
  <<"\ndecode_oid(Octets) ->\n    [First | Rest] = dec_subidentifiers(Octets, 0, []),\n    Idlist =\n        if\n            First < 40 ->\n                [0, First | Rest];\n            First < 80 ->\n                [1, First - 40 | Rest];\n            true ->\n                [2, First - 80 | Rest]\n        end,\n    list_to_tuple(Idlist).\n">>},
 {{per_common,decode_relative_oid,1},
  <<"\ndecode_relative_oid(Octets) ->\n    list_to_tuple(dec_subidentifiers(Octets, 0, [])).\n">>},
 {{per_common,encode_chars,2},
  <<"\nencode_chars(Val, NumBits) ->\n    << \n      <<C:NumBits>> ||\n          C <- Val\n    >>.\n">>},
 {{per_common,encode_chars,3},
  <<"\nencode_chars(Val, NumBits, {Lb, Tab}) ->\n    << \n      <<(enc_char(C, Lb, Tab)):NumBits>> ||\n          C <- Val\n    >>.\n">>},
 {{per_common,encode_chars_compact_map,3},
  <<"\nencode_chars_compact_map(Val, NumBits, {Lb, Limit}) ->\n    << \n      <<(enc_char_cm(C, Lb, Limit)):NumBits>> ||\n          C <- Val\n    >>.\n">>},
 {{per_common,encode_chars_16bit,1},
  <<"\nencode_chars_16bit(Val) ->\n    L = [ \n         case C of\n             {0, 0, A, B} ->\n                 [A, B];\n             C when is_integer(C) ->\n                 [0, C]\n         end ||\n             C <- Val\n        ],\n    iolist_to_binary(L).\n">>},
 {{per_common,encode_big_chars,1},
  <<"\nencode_big_chars(Val) ->\n    L = [ \n         case C of\n             {_, _, _, _} ->\n                 tuple_to_list(C);\n             C when is_integer(C) ->\n                 [<<0,0,0>>, C]\n         end ||\n             C <- Val\n        ],\n    iolist_to_binary(L).\n">>},
 {{per_common,encode_fragmented,2},
  <<"\nencode_fragmented(Bin, Unit) ->\n    encode_fragmented_1(Bin, Unit, 4).\n">>},
 {{per_common,encode_oid,1},
  <<"\nencode_oid(Val) when is_tuple(Val) ->\n    encode_oid(tuple_to_list(Val));\nencode_oid(Val) ->\n    iolist_to_binary(e_object_identifier(Val)).\n">>},
 {{per_common,encode_relative_oid,1},
  <<"\nencode_relative_oid(Val) when is_tuple(Val) ->\n    encode_relative_oid(tuple_to_list(Val));\nencode_relative_oid(Val) when is_list(Val) ->\n    list_to_binary([ \n                    e_object_element(X) ||\n                        X <- Val\n                   ]).\n">>},
 {{per_common,encode_unconstrained_number,1},
  <<"\nencode_unconstrained_number(Val) when not is_integer(Val) ->\n    exit({error, {asn1, {illegal_integer, Val}}});\nencode_unconstrained_number(Val) when Val >= 0 ->\n    if\n        Val < 128 ->\n            [1, Val];\n        Val < 256 ->\n            [<<2,0>>, Val];\n        true ->\n            case binary:encode_unsigned(Val) of\n                <<0:1,_/bitstring>> = Bin ->\n                    case byte_size(Bin) of\n                        Sz when Sz < 128 ->\n                            [Sz, Bin];\n                        Sz when Sz < 16384 ->\n                            [<<2:2,Sz:14>>, Bin]\n                    end;\n                <<1:1,_/bitstring>> = Bin ->\n                    case byte_size(Bin) + 1 of\n                        Sz when Sz < 128 ->\n                            [Sz, 0, Bin];\n                        Sz when Sz < 16384 ->\n                            [<<2:2,Sz:14,0:8>>, Bin]\n                    end\n            end\n    end;\nencode_unconstrained_number(Val) ->\n    Oct = enint(Val, []),\n    Len = length(Oct),\n    if\n        Len < 128 ->\n            [Len | Oct];\n        Len < 16384 ->\n            [<<2:2,Len:14>> | Oct]\n    end.\n">>},
 {{per_common,bitstring_from_positions,1},
  <<"\nbitstring_from_positions([]) ->\n    <<>>;\nbitstring_from_positions([_ | _] = L0) ->\n    L1 = lists:sort(L0),\n    L = diff(L1, - 1),\n    << \n      <<1:(N + 0)>> ||\n          N <- L\n    >>.\n">>},
 {{per_common,bitstring_from_positions,2},
  <<"\nbitstring_from_positions(L0, Lb) ->\n    L1 = lists:sort(L0),\n    L = diff(L1, - 1, Lb - 1),\n    << \n      <<B:(N + 0)>> ||\n          {B, N} <- L\n    >>.\n">>},
 {{per_common,to_bitstring,1},
  <<"\nto_bitstring({0, Bs}) when is_binary(Bs) ->\n    Bs;\nto_bitstring({Unused, Bs0}) when is_binary(Bs0) ->\n    Sz = bit_size(Bs0) - Unused,\n    <<Bs:Sz/bits,_/bits>> = Bs0,\n    Bs;\nto_bitstring(Bs) when is_bitstring(Bs) ->\n    Bs;\nto_bitstring(Int) when is_integer(Int), Int >= 0 ->\n    L = int_to_bitlist(Int),\n    << \n      <<B:1>> ||\n          B <- L\n    >>;\nto_bitstring(L) when is_list(L) ->\n    << \n      <<B:1>> ||\n          B <- L\n    >>.\n">>},
 {{per_common,to_bitstring,2},
  <<"\nto_bitstring({0, Bs}, Lb) when is_binary(Bs) ->\n    case bit_size(Bs) of\n        Sz when Sz < Lb ->\n            <<Bs/bits,0:(Lb - Sz)>>;\n        _ ->\n            Bs\n    end;\nto_bitstring({Unused, Bs0}, Lb) when is_binary(Bs0) ->\n    Sz = bit_size(Bs0) - Unused,\n    if\n        Sz < Lb ->\n            <<Bs0:Sz/bits,0:(Lb - Sz)>>;\n        true ->\n            <<Bs:Sz/bits,_/bits>> = Bs0,\n            Bs\n    end;\nto_bitstring(Bs, Lb) when is_bitstring(Bs) ->\n    adjust_size(Bs, Lb);\nto_bitstring(Int, Lb) when is_integer(Int), Int >= 0 ->\n    L = int_to_bitlist(Int),\n    Bs =\n        << \n          <<B:1>> ||\n              B <- L\n        >>,\n    adjust_size(Bs, Lb);\nto_bitstring(L, Lb) when is_list(L) ->\n    Bs =\n        << \n          <<B:1>> ||\n              B <- L\n        >>,\n    adjust_size(Bs, Lb).\n">>},
 {{per_common,to_named_bitstring,1},
  <<"\nto_named_bitstring(Val) ->\n    Bs = to_bitstring(Val),\n    bs_drop_trailing_zeroes(Bs).\n">>},
 {{per_common,to_named_bitstring,2},
  <<"\nto_named_bitstring({0, Bs}, Lb) when is_binary(Bs) ->\n    adjust_trailing_zeroes(Bs, Lb);\nto_named_bitstring({Unused, Bs0}, Lb) when is_binary(Bs0) ->\n    Sz = bit_size(Bs0) - Unused,\n    <<Bs:Sz/bits,_/bits>> = Bs0,\n    adjust_trailing_zeroes(Bs, Lb);\nto_named_bitstring(Bs, Lb) when is_bitstring(Bs) ->\n    adjust_trailing_zeroes(Bs, Lb);\nto_named_bitstring(Val, Lb) ->\n    adjust_trailing_zeroes(to_bitstring(Val), Lb).\n">>},
 {{per_common,is_default_bitstring,3},
  <<"\nis_default_bitstring(asn1_DEFAULT, _, _) ->\n    true;\nis_default_bitstring(Named, Named, _) ->\n    true;\nis_default_bitstring(Bs, _, Bs) ->\n    true;\nis_default_bitstring(Val, _, Def) when is_bitstring(Val) ->\n    Sz = bit_size(Def),\n    case Val of\n        <<Def:Sz/bitstring,T/bitstring>> ->\n            NumZeroes = bit_size(T),\n            case T of\n                <<0:NumZeroes>> ->\n                    true;\n                _ ->\n                    false\n            end;\n        _ ->\n            false\n    end.\n">>},
 {{per_common,is_default_bitstring,5},
  <<"\nis_default_bitstring(asn1_DEFAULT, _, _, _, _) ->\n    true;\nis_default_bitstring({Unused, Bin}, V0, V1, V2, V3)\n    when is_integer(Unused) ->\n    Sz = bit_size(Bin) - Unused,\n    <<Bs:Sz/bitstring,_:Unused>> = Bin,\n    is_default_bitstring(Bs, V0, V1, V2, V3);\nis_default_bitstring(Named, Named, _, _, _) ->\n    true;\nis_default_bitstring(Bs, _, Bs, _, _) ->\n    true;\nis_default_bitstring(List, _, _, List, _) ->\n    true;\nis_default_bitstring(Int, _, _, _, Int) ->\n    true;\nis_default_bitstring(Val, _, Def, _, _) when is_bitstring(Val) ->\n    Sz = bit_size(Def),\n    case Val of\n        <<Def:Sz/bitstring,T/bitstring>> ->\n            NumZeroes = bit_size(T),\n            case T of\n                <<0:NumZeroes>> ->\n                    true;\n                _ ->\n                    false\n            end;\n        _ ->\n            false\n    end;\nis_default_bitstring(Val, _, _, List, _) when is_list(Val) ->\n    is_default_bitstring_list(List, Val);\nis_default_bitstring(_, _, _, _, _) ->\n    false.\n">>},
 {{per_common,extension_bitmap,3},
  <<"\nextension_bitmap(Val, Pos, Limit) ->\n    extension_bitmap(Val, Pos, Limit, 0).\n">>},
 {{per_common,open_type_to_binary,1},
  <<"\nopen_type_to_binary({asn1_OPENTYPE, Bin}) when is_binary(Bin) ->\n    Bin.\n">>},
 {{per_common,legacy_open_type_to_binary,1},
  <<"\nlegacy_open_type_to_binary({asn1_OPENTYPE, Bin}) when is_binary(Bin) ->\n    Bin;\nlegacy_open_type_to_binary(Bin) when is_binary(Bin) ->\n    Bin;\nlegacy_open_type_to_binary(List) when is_list(List) ->\n    List.\n">>},
 {{per_common,decode_named_bit_string_1,4},
  <<"\ndecode_named_bit_string_1(Pos, [0 | Bt], Names, Acc) ->\n    decode_named_bit_string_1(Pos + 1, Bt, Names, Acc);\ndecode_named_bit_string_1(Pos, [1 | Bt], Names, Acc) ->\n    case lists:keyfind(Pos, 2, Names) of\n        {Name, _} ->\n            decode_named_bit_string_1(Pos + 1, Bt, Names, [Name | Acc]);\n        false ->\n            decode_named_bit_string_1(Pos + 1,\n                                      Bt, Names,\n                                      [{bit, Pos} | Acc])\n    end;\ndecode_named_bit_string_1(_Pos, [], _Names, Acc) ->\n    lists:reverse(Acc).\n">>},
 {{per_common,decode_chars_16bit_1,1},
  <<"\ndecode_chars_16bit_1([H | T]) when H < 256 ->\n    [H | decode_chars_16bit_1(T)];\ndecode_chars_16bit_1([H | T]) ->\n    [{0, 0, H bsr 8, H band 255} | decode_chars_16bit_1(T)];\ndecode_chars_16bit_1([]) ->\n    [].\n">>},
 {{per_common,decode_big_chars_1,1},
  <<"\ndecode_big_chars_1([H | T]) when H < 256 ->\n    [H | decode_big_chars_1(T)];\ndecode_big_chars_1([H | T]) ->\n    [list_to_tuple(binary_to_list(<<H:32>>)) | decode_big_chars_1(T)];\ndecode_big_chars_1([]) ->\n    [].\n">>},
 {{per_common,dec_subidentifiers,3},
  <<"\ndec_subidentifiers([H | T], Av, Al) when H >= 128 ->\n    dec_subidentifiers(T, Av bsl 7 bor H band 127, Al);\ndec_subidentifiers([H | T], Av, Al) ->\n    dec_subidentifiers(T, 0, [Av bsl 7 bor H | Al]);\ndec_subidentifiers([], _Av, Al) ->\n    lists:reverse(Al).\n">>},
 {{per_common,enc_char,3},
  <<"\nenc_char(C0, Lb, Tab) ->\n    try element(C0 - Lb, Tab) of\n        ill ->\n            illegal_char_error();\n        C ->\n            C\n    catch\n        error:badarg ->\n            illegal_char_error()\n    end.\n">>},
 {{per_common,enc_char_cm,3},
  <<"\nenc_char_cm(C0, Lb, Limit) ->\n    C = C0 - Lb,\n    if\n        0 =< C, C < Limit ->\n            C;\n        true ->\n            illegal_char_error()\n    end.\n">>},
 {{per_common,illegal_char_error,0},
  <<"\nillegal_char_error() ->\n    error({error, {asn1, \"value forbidden by FROM constraint\"}}).\n">>},
 {{per_common,encode_fragmented_1,3},
  <<"\nencode_fragmented_1(Bin, Unit, N) ->\n    SegSz = Unit * N * 16384,\n    case Bin of\n        <<B:SegSz/bitstring,T/bitstring>> ->\n            [<<3:2,N:6>>, B | encode_fragmented_1(T, Unit, N)];\n        _ when N > 1 ->\n            encode_fragmented_1(Bin, Unit, N - 1);\n        _ ->\n            case bit_size(Bin) div Unit of\n                Len when Len < 128 ->\n                    [Len, Bin];\n                Len when Len < 16384 ->\n                    [<<2:2,Len:14>>, Bin]\n            end\n    end.\n">>},
 {{per_common,e_object_identifier,1},
  <<"\ne_object_identifier([E1, E2 | Tail])\n    when E1 >= 0, E1 < 2, E2 < 40; E1 =:= 2 ->\n    Head = 40 * E1 + E2,\n    e_object_elements([Head | Tail], []);\ne_object_identifier([_, _ | _Tail] = Oid) ->\n    exit({error, {asn1, {illegal_value, Oid}}}).\n">>},
 {{per_common,e_object_elements,2},
  <<"\ne_object_elements([], Acc) ->\n    lists:reverse(Acc);\ne_object_elements([H | T], Acc) ->\n    e_object_elements(T, [e_object_element(H) | Acc]).\n">>},
 {{per_common,e_object_element,1},
  <<"\ne_object_element(Num) when Num < 128 ->\n    [Num];\ne_object_element(Num) ->\n    [e_o_e(Num bsr 7), Num band 127].\n">>},
 {{per_common,e_o_e,1},
  <<"\ne_o_e(Num) when Num < 128 ->\n    Num bor 128;\ne_o_e(Num) ->\n    [e_o_e(Num bsr 7), Num band 127 bor 128].\n">>},
 {{per_common,enint,2},
  <<"\nenint(- 1, [B1 | T]) when B1 > 127 ->\n    [B1 | T];\nenint(N, Acc) ->\n    enint(N bsr 8, [N band 255 | Acc]).\n">>},
 {{per_common,diff,2},
  <<"\ndiff([H | T], Prev) ->\n    [H - Prev | diff(T, H)];\ndiff([], _) ->\n    [].\n">>},
 {{per_common,diff,3},
  <<"\ndiff([H | T], Prev, Last) ->\n    [{1, H - Prev} | diff(T, H, Last)];\ndiff([], Prev, Last) when Last >= Prev ->\n    [{0, Last - Prev}];\ndiff([], _, _) ->\n    [].\n">>},
 {{per_common,int_to_bitlist,1},
  <<"\nint_to_bitlist(0) ->\n    [];\nint_to_bitlist(Int) ->\n    [Int band 1 | int_to_bitlist(Int bsr 1)].\n">>},
 {{per_common,adjust_size,2},
  <<"\nadjust_size(Bs, Lb) ->\n    case bit_size(Bs) of\n        Sz when Sz < Lb ->\n            <<Bs:Sz/bits,0:(Lb - Sz)>>;\n        _ ->\n            Bs\n    end.\n">>},
 {{per_common,adjust_trailing_zeroes,2},
  <<"\nadjust_trailing_zeroes(Bs0, Lb) ->\n    case bit_size(Bs0) of\n        Sz when Sz < Lb ->\n            <<Bs0:Sz/bits,0:(Lb - Sz)>>;\n        Lb ->\n            Bs0;\n        _ ->\n            <<_:Lb/bits,Tail/bits>> = Bs0,\n            Sz = Lb + bit_size(bs_drop_trailing_zeroes(Tail)),\n            <<Bs:Sz/bits,_/bits>> = Bs0,\n            Bs\n    end.\n">>},
 {{per_common,bs_drop_trailing_zeroes,1},
  <<"\nbs_drop_trailing_zeroes(Bs) ->\n    bs_drop_trailing_zeroes(Bs, bit_size(Bs)).\n">>},
 {{per_common,bs_drop_trailing_zeroes,2},
  <<"\nbs_drop_trailing_zeroes(Bs, 0) ->\n    Bs;\nbs_drop_trailing_zeroes(Bs0, Sz0) when Sz0 < 8 ->\n    <<Byte:Sz0>> = Bs0,\n    Sz = Sz0 - ntz(Byte),\n    <<Bs:Sz/bits,_/bits>> = Bs0,\n    Bs;\nbs_drop_trailing_zeroes(Bs0, Sz0) ->\n    Sz1 = Sz0 - 8,\n    <<Bs1:Sz1/bits,Byte:8>> = Bs0,\n    case ntz(Byte) of\n        8 ->\n            bs_drop_trailing_zeroes(Bs1, Sz1);\n        Ntz ->\n            Sz = Sz0 - Ntz,\n            <<Bs:Sz/bits,_:Ntz/bits>> = Bs0,\n            Bs\n    end.\n">>},
 {{per_common,ntz,1},
  <<"\nntz(Byte) ->\n    T = {8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2,\n         0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0,\n         1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1,\n         0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0,\n         2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3,\n         0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0,\n         1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1,\n         0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0,\n         3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2,\n         0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0,\n         1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1,\n         0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0,\n         2, 0, 1, 0},\n    element(Byte + 1, T).\n">>},
 {{per_common,is_default_bitstring_list,2},
  <<"\nis_default_bitstring_list([H | Def], [H | Val]) ->\n    is_default_bitstring_list(Def, Val);\nis_default_bitstring_list([], []) ->\n    true;\nis_default_bitstring_list([], [_ | _] = Val) ->\n    lists:all(fun(0) ->\n                     true;\n                 (_) ->\n                     false\n              end,\n              Val);\nis_default_bitstring_list(_, _) ->\n    false.\n">>},
 {{per_common,extension_bitmap,4},
  <<"\nextension_bitmap(_Val, Pos, Limit, Acc) when Pos >= Limit ->\n    Acc;\nextension_bitmap(Val, Pos, Limit, Acc) ->\n    Bit =\n        case element(Pos, Val) of\n            asn1_NOVALUE ->\n                0;\n            asn1_DEFAULT ->\n                0;\n            _ ->\n                1\n        end,\n    extension_bitmap(Val, Pos + 1, Limit, Acc bsl 1 bor Bit).\n">>},
 {{real_common,ber_encode_real,1},
  <<"\nber_encode_real(0) ->\n    {[], 0};\nber_encode_real('PLUS-INFINITY') ->\n    {[64], 1};\nber_encode_real('MINUS-INFINITY') ->\n    {[65], 1};\nber_encode_real(Val) when is_tuple(Val); is_list(Val) ->\n    encode_real(Val).\n">>},
 {{real_common,encode_real,1},
  <<"\nencode_real(Real) ->\n    encode_real([], Real).\n">>},
 {{real_common,encode_real,2},
  <<"\nencode_real(_C, {Mantissa, Base, Exponent}) when Base =:= 2 ->\n    {Man, ExpAdd} = truncate_zeros(Mantissa),\n    Exp = Exponent + ExpAdd,\n    OctExp =\n        if\n            Exp >= 0 ->\n                list_to_binary(encode_pos_integer(Exp, []));\n            true ->\n                list_to_binary(encode_neg_integer(Exp, []))\n        end,\n    SignBit =\n        if\n            Man > 0 ->\n                0;\n            true ->\n                1\n        end,\n    SFactor = 0,\n    OctExpLen = byte_size(OctExp),\n    if\n        OctExpLen > 255 ->\n            exit({error, {asn1, {to_big_exp_in_encode_real, OctExpLen}}});\n        true ->\n            true\n    end,\n    {LenCode, EOctets} =\n        case OctExpLen of\n            1 ->\n                {0, OctExp};\n            2 ->\n                {1, OctExp};\n            3 ->\n                {2, OctExp};\n            _ ->\n                {3, <<OctExpLen,OctExp/binary>>}\n        end,\n    BB = 0,\n    FirstOctet = <<1:1,SignBit:1,BB:2,SFactor:2,LenCode:2>>,\n    OctMantissa =\n        if\n            Man > 0 ->\n                list_to_binary(real_mininum_octets(Man));\n            true ->\n                list_to_binary(real_mininum_octets(- Man))\n        end,\n    <<FirstOctet/binary,EOctets/binary,OctMantissa/binary>>;\nencode_real(C, {Mantissa, Base, Exponent})\n    when Base =:= 10, is_integer(Mantissa), is_integer(Exponent) ->\n    ManStr = integer_to_list(Mantissa),\n    encode_real_as_string(C, ManStr, Exponent);\nencode_real(_C, {_, Base, _}) ->\n    exit({error, {asn1, {encode_real_non_supported_encoding, Base}}});\nencode_real(C, Real) when is_list(Real) ->\n    {Mantissa, Exponent} =\n        case string:lexemes(Real, \"Ee\") of\n            [NR2] ->\n                {NR2, 0};\n            [NR3MB, NR3E] ->\n                {NR3MB, list_to_integer(NR3E)}\n        end,\n    ZeroDecimal =\n        fun(\"0\") ->\n               \"\";\n           (L) ->\n               L\n        end,\n    {NewMantissa, LenDecimal} =\n        case Mantissa of\n            [$. | Dec] ->\n                NewMan = remove_trailing_zeros(Dec),\n                {NewMan, length(ZeroDecimal(NewMan))};\n            _ ->\n                case string:lexemes(Mantissa, \",.\") of\n                    [Num] ->\n                        {integer_to_list(list_to_integer(Num)), 0};\n                    [Num, Dec] ->\n                        NewDec = ZeroDecimal(remove_trailing_zeros(Dec)),\n                        NewMan =\n                            integer_to_list(list_to_integer(Num))\n                            ++\n                            NewDec,\n                        {integer_to_list(list_to_integer(NewMan)),\n                         length(NewDec)}\n                end\n        end,\n    encode_real_as_string(C, NewMantissa, Exponent - LenDecimal).\n">>},
 {{real_common,encode_real_as_string,3},
  <<"\nencode_real_as_string(_C, Mantissa, Exponent)\n    when is_list(Mantissa), is_integer(Exponent) ->\n    TruncMant = remove_trailing_zeros(Mantissa),\n    ExpIncr = length(Mantissa) - length(TruncMant),\n    ExpStr = integer_to_list(Exponent + ExpIncr),\n    ExpBin =\n        case ExpStr of\n            \"0\" ->\n                <<\"E+0\">>;\n            _ ->\n                ExpB = list_to_binary(ExpStr),\n                <<$E,ExpB/binary>>\n        end,\n    ManBin = list_to_binary(TruncMant),\n    NR3 = 3,\n    <<NR3,ManBin/binary,$.,ExpBin/binary>>.\n">>},
 {{real_common,remove_trailing_zeros,1},
  <<"\nremove_trailing_zeros(IntStr) ->\n    case\n        lists:dropwhile(fun($0) ->\n                               true;\n                           (_) ->\n                               false\n                        end,\n                        lists:reverse(IntStr))\n    of\n        [] ->\n            \"0\";\n        ReversedIntStr ->\n            lists:reverse(ReversedIntStr)\n    end.\n">>},
 {{real_common,truncate_zeros,1},
  <<"\ntruncate_zeros(Num) ->\n    truncate_zeros(Num, 0).\n">>},
 {{real_common,truncate_zeros,2},
  <<"\ntruncate_zeros(0, Sum) ->\n    {0, Sum};\ntruncate_zeros(M, Sum) ->\n    case M band 15 =:= M band 14 of\n        true ->\n            truncate_zeros(M bsr 1, Sum + 1);\n        _ ->\n            {M, Sum}\n    end.\n">>},
 {{real_common,decode_real,1},
  <<"\ndecode_real(Buffer) ->\n    Sz = byte_size(Buffer),\n    {RealVal, <<>>, Sz} = decode_real2(Buffer, [], Sz, 0),\n    RealVal.\n">>},
 {{real_common,decode_real2,4},
  <<"\ndecode_real2(Buffer, _C, 0, _RemBytes) ->\n    {0, Buffer};\ndecode_real2(Buffer0, _C, Len, RemBytes1) ->\n    <<First,Buffer2/binary>> = Buffer0,\n    if\n        First =:= 64 ->\n            {'PLUS-INFINITY', Buffer2};\n        First =:= 65 ->\n            {'MINUS-INFINITY', Buffer2};\n        First =:= 1\n        orelse\n        First =:= 2\n        orelse\n        First =:= 3 ->\n            {NRx, Rest} = split_binary(Buffer2, Len - 1),\n            {binary_to_list(NRx), Rest, Len};\n        true ->\n            <<_B7:1,Sign:1,BB:2,_FF:2,EE:2>> = <<First>>,\n            Base =\n                case BB of\n                    0 ->\n                        2;\n                    _ ->\n                        exit({error, {asn1, {non_supported_base, BB}}})\n                end,\n            {FirstLen, {Exp, Buffer3, _Rb2}, RemBytes2} =\n                case EE of\n                    0 ->\n                        {2,\n                         decode_integer2(1, Buffer2, RemBytes1),\n                         RemBytes1 + 1};\n                    1 ->\n                        {3,\n                         decode_integer2(2, Buffer2, RemBytes1),\n                         RemBytes1 + 2};\n                    2 ->\n                        {4,\n                         decode_integer2(3, Buffer2, RemBytes1),\n                         RemBytes1 + 3};\n                    3 ->\n                        <<ExpLen1,RestBuffer/binary>> = Buffer2,\n                        {ExpLen1 + 2,\n                         decode_integer2(ExpLen1, RestBuffer, RemBytes1),\n                         RemBytes1 + ExpLen1}\n                end,\n            Length = Len - FirstLen,\n            <<LongInt:Length/unit:8,RestBuff/binary>> = Buffer3,\n            {{Mantissa, Buffer4}, RemBytes3} =\n                if\n                    Sign =:= 0 ->\n                        {{LongInt, RestBuff}, 1 + Length};\n                    true ->\n                        {{- LongInt, RestBuff}, 1 + Length}\n                end,\n            {{Mantissa, Base, Exp}, Buffer4, RemBytes2 + RemBytes3}\n    end.\n">>},
 {{real_common,encode_pos_integer,2},
  <<"\nencode_pos_integer(0, [B | _Acc] = L) when B < 128 ->\n    L;\nencode_pos_integer(N, Acc) ->\n    encode_pos_integer(N bsr 8, [N band 255 | Acc]).\n">>},
 {{real_common,encode_neg_integer,2},
  <<"\nencode_neg_integer(- 1, [B1 | _T] = L) when B1 > 127 ->\n    L;\nencode_neg_integer(N, Acc) ->\n    encode_neg_integer(N bsr 8, [N band 255 | Acc]).\n">>},
 {{real_common,real_mininum_octets,1},
  <<"\nreal_mininum_octets(Val) ->\n    real_mininum_octets(Val, []).\n">>},
 {{real_common,real_mininum_octets,2},
  <<"\nreal_mininum_octets(0, Acc) ->\n    Acc;\nreal_mininum_octets(Val, Acc) ->\n    real_mininum_octets(Val bsr 8, [Val band 255 | Acc]).\n">>},
 {{real_common,decode_integer2,3},
  <<"\ndecode_integer2(Len, <<0:1,_:7,_Bs/binary>> = Bin, RemovedBytes) ->\n    <<Int:Len/unit:8,Buffer2/binary>> = Bin,\n    {Int, Buffer2, RemovedBytes};\ndecode_integer2(Len, <<1:1,B2:7,Bs/binary>>, RemovedBytes) ->\n    <<N:Len/unit:8,Buffer2/binary>> = <<B2,Bs/binary>>,\n    Int = N - (1 bsl (8 * Len - 1)),\n    {Int, Buffer2, RemovedBytes}.\n">>},
 {{uper,skipextensions,3},
  <<"\nskipextensions(Bytes0, Nr, ExtensionBitstr)\n    when is_bitstring(ExtensionBitstr) ->\n    Prev = Nr - 1,\n    case ExtensionBitstr of\n        <<_:Prev,1:1,_/bitstring>> ->\n            {Len, Bytes1} = decode_length(Bytes0),\n            <<_:Len/binary,Bytes2/bitstring>> = Bytes1,\n            skipextensions(Bytes2, Nr + 1, ExtensionBitstr);\n        <<_:Prev,0:1,_/bitstring>> ->\n            skipextensions(Bytes0, Nr + 1, ExtensionBitstr);\n        _ ->\n            Bytes0\n    end.\n">>},
 {{uper,decode_length,1},
  <<"\ndecode_length(<<0:1,Oct:7,Rest/bitstring>>) ->\n    {Oct, Rest};\ndecode_length(<<2:2,Val:14,Rest/bitstring>>) ->\n    {Val, Rest};\ndecode_length(<<3:2,_:14,_Rest/bitstring>>) ->\n    exit({error, {asn1, {decode_length, {nyi, above_16k}}}}).\n">>},
 {{uper,complete,1},
  <<"\ncomplete(InList) when is_list(InList) ->\n    case list_to_bitstring(InList) of\n        <<>> ->\n            <<0>>;\n        Res ->\n            Sz = bit_size(Res),\n            case Sz band 7 of\n                0 ->\n                    Res;\n                Bits ->\n                    <<Res:Sz/bitstring,0:(8 - Bits)>>\n            end\n    end;\ncomplete(Bin) when is_binary(Bin) ->\n    case Bin of\n        <<>> ->\n            <<0>>;\n        _ ->\n            Bin\n    end;\ncomplete(InList) when is_bitstring(InList) ->\n    Sz = bit_size(InList),\n    PadLen = 8 - Sz band 7,\n    <<InList:Sz/bitstring,0:PadLen>>.\n">>},
 {{uper,complete_NFP,1},
  <<"\ncomplete_NFP(InList) when is_list(InList) ->\n    list_to_bitstring(InList);\ncomplete_NFP(InList) when is_bitstring(InList) ->\n    InList.\n">>},
 {{uper,encode_fragmented_sof,3},
  <<"\nencode_fragmented_sof(Fun, Comps, Len) ->\n    encode_fragmented_sof_1(Fun, Comps, Len, 4).\n">>},
 {{uper,encode_fragmented_sof_1,4},
  <<"\nencode_fragmented_sof_1(Encoder, Comps0, Len0, N) ->\n    SegSz = N * 16384,\n    if\n        Len0 >= SegSz ->\n            {Comps, B} = encode_components(Comps0, Encoder, SegSz, []),\n            Len = Len0 - SegSz,\n            [<<3:2,N:6>>,\n             B |\n             encode_fragmented_sof_1(Encoder, Comps, Len, N)];\n        N > 1 ->\n            encode_fragmented_sof_1(Encoder, Comps0, Len0, N - 1);\n        Len0 < 128 ->\n            {[], B} = encode_components(Comps0, Encoder, Len0, []),\n            [Len0 | B];\n        Len0 < 16384 ->\n            {[], B} = encode_components(Comps0, Encoder, Len0, []),\n            [<<2:2,Len0:14>> | B]\n    end.\n">>},
 {{uper,encode_components,4},
  <<"\nencode_components(Cs, _Encoder, 0, Acc) ->\n    {Cs, lists:reverse(Acc)};\nencode_components([C | Cs], Encoder, Size, Acc) ->\n    B = Encoder(C),\n    encode_components(Cs, Encoder, Size - 1, [B | Acc]).\n">>}].

