ISDVVVJ4Q47MFFMWYC3XP3KZXLAKRA2VGRQ56MSD44475UNYBWDAC FVAVNSGB7J3BNE4ON22YS6DHW3B3XHCRBDB53LJSRCKFTELCVNAQC CWW2IONR7WURTK3PWABHRIOHBAYF6J4TFDNB7L2EM753KNK6C6MQC AQQ7DH2OU4OKCVRQECS427ICA4OAT5NLQBE4TLKFBJ3TAUMQHXKAC O2DTNJ3ZOJJKDHGPNE2DZSZF7CFU4G5D65RIDOYZHYYBH3JZAAIAC 7VZF66GPW6DKQB4FU4PTU3CEE32MTYNP4MH6GY4SMICRERO76WDQC ZR7U7TRCUHXMBXQFA3XXNGJPPYFACMOWPQKGUH7E22KGFM35HSNAC YNPPEQEWMXS4B2EKRR54WUZMXO222YOWC2I5NPXPDG2ABOIBH7RAC Y7IBP4INTUL42R7TC7O4DXGR27CKTD6VEEL6BHJNGCVIFVUVGCMQC Q62EXKAKNM5FMIW3UZBUAJFKOZLE2O2VIRTJAVDOTTSWX5JSMX4QC defp do_parse_section_len(id, <<0::1, _::bitstring>> = chunk) do<<len::binary-size(1), rest::binary>> = chunklength = WaParser.LEB128.decode_unsigned(len){:ok, {{:section_length, length}, rest, parse_section_body(id, length)}}
defp do_parse_section_len(type, chunk) do{length, rest} = u32(chunk){:ok, {{:section_length, length}, rest, parse_section_body(type, length)}}
{:ok, {{:section_body, section}, rest, &parse_section/1}}
parsed_body = section_body(type, section){func_type, ""} = parsed_body{:ok, {{:section_body, func_type}, rest, &parse_section/1}}enddefp section_body(:type, section_data) dofunctype_vec(section_data)enddefp functype_vec(chunk) do{length, rest} = u32(chunk)do_functype_vec(length, rest)enddefp do_functype_vec(length, chunk) dodo_functype_vec(length, chunk, [])enddefp do_functype_vec(0, chunk, acc) do{acc |> Enum.reverse(), chunk}enddefp do_functype_vec(length, chunk, acc) do{func, rest} = functype(chunk)do_functype_vec(length - 1, rest, [func | acc])enddefp functype(<<0x60, rest::binary>>) do{param_type, rest} = resulttype(rest){result_type, rest} = resulttype(rest){{param_type, result_type}, rest}enddefp resulttype(chunk) dovaltype_vec(chunk)
defp valtype_vec(chunk) do{length, rest} = u32(chunk)do_valtype_vec(length, rest)enddefp do_valtype_vec(length, chunk) dodo_valtype_vec(length, chunk, [])enddefp do_valtype_vec(0, chunk, acc) do{acc |> Enum.reverse(), chunk}enddefp do_valtype_vec(length, chunk, acc) do<<vt, rest::binary>> = chunkdo_valtype_vec(length - 1, rest, [valtype(vt) | acc])enddefp valtype(0x7F), do: :i32defp u32(<<0::1, _::bitstring>> = chunk) do<<len::binary-size(1), rest::binary>> = chunklength = WaParser.LEB128.decode_unsigned(len){length, rest}end