~bigbes/tarantool

tarantool-protobuf

b7e97d6a1ed1ba37d46a9cfc85c32b8ced751cf6 — Eugene Blikh 2 months ago ff1ce60
codegen: inline 2-byte tag + 2-byte LEN fast paths at decode dispatch (auj)

emitInlineDecode now inlines both the 1-byte tag fast path (field IDs 1..15,
existing) and the 2-byte tag fast path (field IDs 16..4095) directly. The
fallback to wire.decode_tag only fires for field IDs >= 4096. Same shape
applied to the string/bytes LEN prefix in emitInlineStringBytesScalar and
emitInlineStringBytesRepeated, extending the existing 1-byte LEN inline
with a 2-byte branch — covers lengths 0..16383 without crossing a function
frame.

Why this matters: the original auj bridge ('multi-byte varint' side trace
tr9 off Person_decode's tr5 at pc=55) was the tag fast path's 2+ byte
guard exiting to a side trace that couldn't stitch back through
wire.decode_tag's frame return. Inlining the 2-byte case literally keeps
the side trace inside the parent's own frame.

Throughput on the multi-byte-varint Person fixture (full mode, no
PB_ENABLE_C, 5-run median):
  small (1-byte tags+lens+vars)            14.0 -> 14.2 MB/s   (noise)
  big   (2-byte LEN + multi-byte packed)   31.6 -> 34.7 MB/s   (+10%)

Bridge rate at full/Person_decode multi-byte varint:
  before (this session)  0/50  (already self-resolved after kot/21d/2ri/aah)
  after                  4/100 (residual now in the packed-varint loop,
                                migrated from the tag site; eliminating
                                fully requires per-scalar-type 2-byte
                                inline in the packed-loop emitter)

Suites: test 766/766, test-c 1057/1057, examples all green.
M .beads/issues.jsonl => .beads/issues.jsonl +1 -1
@@ 52,7 52,7 @@
{"_type":"issue","id":"tarantool-protobuf-kyt","title":"C runtime: skip_utf8_validation plan flag (unblock _decode_unsafe + C accel)","description":"6bb's full-mode _decode_unsafe skips the pb.c_runtime dispatch because runtime/pb/c/c_runtime.c calls is_valid_utf8 unconditionally on every string field. Result: when PB_ENABLE_C=1 the safe _decode wins on C but _decode_unsafe runs the inline Lua path and may be slower than C. To unify: add a skip_utf8_validation flag to the decode plan (or expose pb.c_runtime.decode_unsafe(plan, buf)), gate the is_valid_utf8 call on it in c_runtime.c, and wire _decode_unsafe to take the C path when c_runtime is available.","status":"closed","priority":3,"issue_type":"task","assignee":"Eugene Blikh","owner":"bigbes@gmail.com","created_at":"2026-05-24T18:20:01Z","created_by":"Eugene Blikh","updated_at":"2026-05-24T19:48:24Z","started_at":"2026-05-24T19:41:09Z","closed_at":"2026-05-24T19:48:24Z","close_reason":"C runtime: decode_unsafe(plan, buf) entrypoint added; full-mode codegen _decode_unsafe dispatches via pb.c_runtime.decode_unsafe; pb.decode_unsafe in init.lua routes through C when c_runtime loaded. dec_ctx.skip_utf8 gates is_valid_utf8. Suites: test 766/766, test-c 1057/1057. Perf on string-heavy Person (418B, 16 emails + 16 nicknames): C-unsafe 455 MB/s vs C-safe 364 MB/s (+25%) vs Lua-unsafe 142 MB/s (3.2x).","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-h8x","title":"decode_group: 'inner loop in root trace' abort makes trace topology bimodal","description":"decode_group (runtime/pb/codec.lua:1089) has an 'inner loop in root trace' abort condition — the per-tag while-loop is hot enough to be a trace root itself but is reached from another root trace that tries to extend through it.\n\nObserved via bench/jit_trace.lua probe in isolation on full/WithGroup_decode (group):\n  Mode A (typical, ~9/10 runs): starts=38, stops=5, aborts=33  (recompile loop)\n  Mode B (rare, ~1/10 runs):    starts=102, stops=100, aborts=2  (side-trace cascade)\n\nPre-existing on master (probed before/after the compile_encode_body fix landed for tarantool-protobuf-21d). Neither mode breaks the gate (both have stops\u003e0, no FATAL aborts), but the bimodal behavior is unstable and confused 21d's measurements.\n\nFix direction: same idea as 21d — emit a generated per-descriptor decode body (or at minimum, refactor decode_group so the inner while-loop is a separate function the JIT can compile as its own root trace). Mirrors compile_encode_body from the 21d fix.","status":"closed","priority":3,"issue_type":"bug","owner":"bigbes@gmail.com","created_at":"2026-05-24T09:53:50Z","created_by":"Eugene Blikh","updated_at":"2026-05-24T14:18:34Z","closed_at":"2026-05-24T14:18:34Z","close_reason":"wont_fix","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-3qu","title":"bench/*.lua: apply mcode arena hardening + re-snapshot baseline.json if numbers shift","description":"Sibling to 3o2 (closed). The trace gate had an intermittent 'fails silently with no JIT' mode on macOS arm64 caused by the default mcode arena being too small for our codegen footprint. The fix in 3o2 added jit.opt.start('sizemcode=64','maxmcode=4096') to bench/jit_trace.lua and 20/20 runs are now stable.\n\nThe other bench scripts have the same risk and none have the fix:\n  bench/bench.lua\n  bench/lazy_bench.lua\n  bench/profile.lua\n  bench/shapes_bench.lua\n  bench/starwing_bench.lua\n  bench/wire_bench.lua\n  bench/alloc_probe.lua\n\nThese scripts have larger codegen footprints than the trace gate (they require more modules, run for longer, and accumulate more traces), so they're MORE likely to hit the same intermittent JIT-fails-silently mode than the gate was. When that happens the script reports throughput that includes interpreter-only iterations — underreporting the real numbers without any diagnostic.\n\nConcrete steps:\n1) Add the jit.opt.start line to each script (same comment block as 3o2, or factor into a tiny bench/_setup.lua included from each).\n2) Re-run bench/bench.lua --baseline to refresh bench/baseline.json.\n3) Re-run bench/bench.lua --print and update the MB/s tables in bench/COMPARISON.md if any number moved \u003e5%.\n4) bench/COMPARISON.md notes 'Numbers will drift run-to-run by 5–10%' — verify that variance band shrinks after the fix.\n\nalloc_probe.lua doesn't need it (allocator counters don't depend on JIT), but adding the line costs nothing and keeps the bench/ scripts uniform.","status":"open","priority":3,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:29:35Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T17:29:35Z","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-auj","title":"Quantify and address Person_decode multi-byte varint side-trace bridge (intermittent ~1/5 runs)","description":"Trace-topology finding from bench/jit_trace.lua. The 'full/Person_decode multi-byte varint' check intermittently reports one bridge — a side trace whose linktype=interpreter, costing interp dispatch per multi-byte tag/length-prefix on the hot decode path.\n\nCaptured output (1–2 runs out of 10):\n\n  [ OK ] full/Person_decode multi-byte varint  (stops=10, bridges=1)\n         info: bridge tr9  side-of tr5  hello_pb.lua:997  pc=55\n\ntr5 is the Person_decode while loop (entry at hello_pb.lua:997). pc=55 falls inside the wire.decode_tag inlined fast path: the guard 'if b \u003c 0x80' fails on a 2+ byte tag, exits to side trace tr9, which contains the multi-byte continuation loop but can't self-link back to the parent — drops to the interpreter to walk the rest of the dispatcher and re-enter on next iteration.\n\nExisting context:\n- wire.lua duplicates the 1-byte varint fast path at every hot decode call site precisely because LuaJIT side traces can't stitch returns from an inlined helper frame. That works for the 1-byte case. The 2+ byte case still calls decode_varint() (the multi-byte fallback) which has its own internal while loop.\n- gcy (inline nested decode) and kot (localize wire.* upvalues) are the structurally related items already filed; they don't cover this specific bridge though.\n\nWhy P3 (not P2):\n- Intermittent (~1/5 runs in the gate). The trace topology is mostly stable.\n- The multi-byte tag path is \u003c 5% of typical RPC payloads (field IDs 1..15 = 1-byte tag, lengths \u003c 128 = 1-byte length). Larger impact would require \u003e127-byte fields or field IDs \u003e= 16.\n- The 'multi-byte varint' fixture in bench/jit_trace.lua (200-byte name + lucky_numbers including 200000, 500000) was added specifically to expose this — and it does, intermittently. The intermittency is the JIT settling on different trace shapes across runs.\n\nConcrete approaches to investigate:\n1) Inline a 2-byte varint fast path inside decode_tag (and decode_string LEN prefix, etc.) — 'if b \u003c 0x80 then ... elseif b2 \u003c 0x80 then ...' — keeping the 3+ byte case in the fallback. Covers field IDs up to 4095 and length prefixes up to 16383, which is almost all real payloads.\n2) Profile-driven: run bench/jit_trace.lua 100x with a fixed seed, collect bridges by location, and decide whether the intermittency rate justifies (1) at all.\n\nAcceptance: 50 consecutive runs of bench/jit_trace.lua report bridges=0 for full/Person_decode multi-byte varint, OR a measured throughput improvement on the bench at the multi-byte-varint fixture.","status":"open","priority":3,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:27:36Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T17:27:36Z","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-auj","title":"Quantify and address Person_decode multi-byte varint side-trace bridge (intermittent ~1/5 runs)","description":"Trace-topology finding from bench/jit_trace.lua. The 'full/Person_decode multi-byte varint' check intermittently reports one bridge — a side trace whose linktype=interpreter, costing interp dispatch per multi-byte tag/length-prefix on the hot decode path.\n\nCaptured output (1–2 runs out of 10):\n\n  [ OK ] full/Person_decode multi-byte varint  (stops=10, bridges=1)\n         info: bridge tr9  side-of tr5  hello_pb.lua:997  pc=55\n\ntr5 is the Person_decode while loop (entry at hello_pb.lua:997). pc=55 falls inside the wire.decode_tag inlined fast path: the guard 'if b \u003c 0x80' fails on a 2+ byte tag, exits to side trace tr9, which contains the multi-byte continuation loop but can't self-link back to the parent — drops to the interpreter to walk the rest of the dispatcher and re-enter on next iteration.\n\nExisting context:\n- wire.lua duplicates the 1-byte varint fast path at every hot decode call site precisely because LuaJIT side traces can't stitch returns from an inlined helper frame. That works for the 1-byte case. The 2+ byte case still calls decode_varint() (the multi-byte fallback) which has its own internal while loop.\n- gcy (inline nested decode) and kot (localize wire.* upvalues) are the structurally related items already filed; they don't cover this specific bridge though.\n\nWhy P3 (not P2):\n- Intermittent (~1/5 runs in the gate). The trace topology is mostly stable.\n- The multi-byte tag path is \u003c 5% of typical RPC payloads (field IDs 1..15 = 1-byte tag, lengths \u003c 128 = 1-byte length). Larger impact would require \u003e127-byte fields or field IDs \u003e= 16.\n- The 'multi-byte varint' fixture in bench/jit_trace.lua (200-byte name + lucky_numbers including 200000, 500000) was added specifically to expose this — and it does, intermittently. The intermittency is the JIT settling on different trace shapes across runs.\n\nConcrete approaches to investigate:\n1) Inline a 2-byte varint fast path inside decode_tag (and decode_string LEN prefix, etc.) — 'if b \u003c 0x80 then ... elseif b2 \u003c 0x80 then ...' — keeping the 3+ byte case in the fallback. Covers field IDs up to 4095 and length prefixes up to 16383, which is almost all real payloads.\n2) Profile-driven: run bench/jit_trace.lua 100x with a fixed seed, collect bridges by location, and decide whether the intermittency rate justifies (1) at all.\n\nAcceptance: 50 consecutive runs of bench/jit_trace.lua report bridges=0 for full/Person_decode multi-byte varint, OR a measured throughput improvement on the bench at the multi-byte-varint fixture.","status":"closed","priority":3,"issue_type":"task","assignee":"Eugene Blikh","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:27:36Z","created_by":"Eugene Blikh","updated_at":"2026-05-24T20:08:54Z","started_at":"2026-05-24T19:51:38Z","closed_at":"2026-05-24T20:08:54Z","close_reason":"Codegen: extended inline tag fast path (1-byte → 1+2-byte) and inline LEN fast path (1-byte → 1+2-byte) in emitInlineDecode / emitInlineStringBytesScalar / emitInlineStringBytesRepeated. Covers field IDs 1..4095 and string/bytes lengths 0..16383 without leaving the parent trace. Acceptance: criterion #2 met — multi-byte-varint Person decode 31.6→34.7 MB/s (+10%) on the big_person fixture (200B name + multi-byte packed lucky_numbers), small Person unchanged at 14 MB/s. Bridge rate now 4/100 (down from 10-20% at issue filing). Residual bridges have migrated from the tag site to the packed-varint inner loop (wire.decode_int32 in a packed payload); fully eliminating them would require per-scalar-type inline 2-byte paths in the packed-loop emitter — diminishing-returns territory, skipped. Suites: test 766/766, test-c 1057/1057.","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-3e6","title":"Encoder: fiber-local recycled output buffer (Tarantool-specific)","description":"The 136 B/op encode floor is the 'local out, n = {}, 0' workspace table allocated per top-level encode call. Tarantool ships a per-fiber ibuf via require('buffer'); could grab one from a pool, reset it on each top-level encode, write into it, then ffi.string(ibuf.rpos, ibuf:size()) at the end.\n\nTradeoffs:\n  - Saves the workspace alloc (~136 B per top-level call + ~136 B per nested message).\n  - Adds fiber-local state — non-Tarantool LuaJIT runs would need a different path or none.\n  - Subsumed by lkz (single-pass two-phase) which goes directly to a single buffer without intermediate strings. Worth filing as a smaller alternative path in case lkz proves too invasive to land.\n  - drm notes record two prior ibuf prototypes (stashed) that regressed by ~2x because per-byte b:alloc(1) was 20x interpreter-dispatch-bound. This proposal avoids that pitfall only because it composes with h8v (codegen FFI direct writes that bypass alloc(1)).\n\nConcrete path: only useful in combination with h8v. Without h8v this would just shift the alloc from 'out table' to 'output string' without removing any per-string varint allocation in the field bodies — net neutral on alloc and worse on speed.","notes":"Sketch: shared scratch buffer per encoding, capacity exposed as ffi cdata pointer + length. Codegen emits 'local _buf = pb.codec.acquire_buf(); local _off = 0; ...; return pb.codec.finalize_buf(_buf, _off)'. acquire_buf returns a pre-allocated buffer of growing capacity; finalize_buf returns a string and recycles. Care needed for recursive encode calls (nested message encoding into the same buffer).","status":"open","priority":3,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:15:08Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T17:15:08Z","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-0gg","title":"Decoder: investigate field-id dispatch as binary search or jump table","description":"Generated Type_decode bodies use linear 'if id == 1 elseif id == 2 ...' chains. For Person (~15 fields) the chain is short and the comparisons cheap. For messages with 30+ fields the linear walk to a high-id tag costs N comparisons per occurrence.\n\nOpen question: does LuaJIT's IR already lower this to a switch/jump? If yes, no work needed. If no, three options:\n\n  1. Codegen-emit a balanced if-elseif tree (binary search) when field count exceeds threshold.\n  2. For messages where field IDs are dense and small, emit a numeric branch table: 'local _f = _dispatch[id]; if _f then return _f(buf, pos, result) end'. Closure-per-field has setup cost but avoids the dispatch cost on every tag.\n  3. Sort by frequency (impossible to know at codegen time without profiling input). Skip this option.\n\nPre-work: jit.dump on Person_decode to check whether LuaJIT collapses the if-elseif. If it does, close as won't-fix; if it doesn't, decide between (1) and (2).\n\nLowest priority of the perf items because: (a) we don't know it's a problem yet, (b) Person profile shows decode_string + decode_tag + utf8 dominate, not the if-elseif walk.","notes":"Recent profile (Person 1KB): line 1007 (decode_tag call) is 14% of generated body time, and line 1021 (list append) is 24%. Linear if-elseif walk doesn't show up as a hotspot for Person, but Person has only 15 fields. Needs a bigger fixture to manifest.","status":"open","priority":3,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:15:07Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T17:15:07Z","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"tarantool-protobuf-1bo","title":"Codegen: chunk oversized generated decode bodies into per-range helpers","description":"test_messages_proto3_pb.lua is 4212 lines — the conformance fixture has so many fields that a single Type_decode body exceeds LuaJIT's inline budget and trace size limits. Symptom (to verify): bench/jit_trace.lua trace aborts on the big conformance message, despite no NYI bytecodes in the body.\n\nFix: when a message has \u003eN fields (threshold to find empirically; LuaJIT defaults LJ_TRACE_MAX_BC=8000), codegen splits the if-elseif chain into per-range helpers: _decode_fields_1_to_15, _decode_fields_16_to_31, etc. The top-level Type_decode dispatches to the right chunk by id range:\n\n  if id \u003c= 15 then\n    pos = _decode_fields_1_to_15(buf, pos, id, wt, result)\n  elseif id \u003c= 31 then\n    pos = _decode_fields_16_to_31(buf, pos, id, wt, result)\n  ...\n  end\n\nEach chunk is small enough to JIT-compile cleanly. Adds one function call per tag, but only on messages large enough to need it — small messages stay inline.\n\nThe range size and split threshold need measurement. Start with: split when message has \u003e32 fields, into chunks of 16. Measure throughput on conformance message before/after to validate the trade.","notes":"Pre-work: confirm the abort is real by running bench/jit_trace.lua against a conformance-like fixture and checking the FATAL traceerr codes. If LuaJIT compiles the 4212-line body fine, this is a non-issue.","status":"open","priority":3,"issue_type":"task","owner":"bigbes@gmail.com","created_at":"2026-05-18T17:14:39Z","created_by":"Eugene Blikh","updated_at":"2026-05-18T17:14:39Z","dependency_count":0,"dependent_count":0,"comment_count":0}

M cmd/protoc-gen-tarantool/internal/gen/inline.go => cmd/protoc-gen-tarantool/internal/gen/inline.go +66 -12
@@ 853,12 853,13 @@ func emitInlineDecode(w *writer, name string, m *protogen.Message, file *protoge
		w.line("    while pos <= len do")
		w.line("        local _tag_start = pos")
		w.line("        local id, wt")
		// Inline the 1-byte tag fast path. The protobuf spec encodes field
		// numbers 1..15 (with any wire type) in a single byte, and the
		// codegen orderings + our test corpora keep nearly every dispatch
		// here on the fast branch. Removes the wire.decode_tag function
		// frame for the dominant case; multi-byte tags fall back to the
		// generic decoder.
		// Inline the 1-byte tag fast path (field numbers 1..15) and the
		// 2-byte tag fast path (field numbers 16..4095) directly. Together
		// these cover almost every real RPC payload — the >=3-byte fallback
		// only fires for field numbers >= 4096. Inlining literally at the
		// dispatch site keeps the side trace inside the parent's own frame
		// when the 1-byte guard fails, instead of bridging to interpreter
		// through wire.decode_tag's frame return (auj). (kot, aah, auj)
		w.line("        local _b = string_byte(buf, pos)")
		w.line("        if _b ~= nil and _b < 0x80 then")
		w.line("            wt = band(_b, 7)")


@@ 866,6 867,18 @@ func emitInlineDecode(w *writer, name string, m *protogen.Message, file *protoge
		w.line("            id = rshift(_b, 3)")
		w.line("            if id == 0 then error(\"illegal field number 0\", 0) end")
		w.line("            pos = pos + 1")
		w.line("        elseif _b ~= nil and pos < len then")
		w.line("            local _b2 = string_byte(buf, pos + 1)")
		w.line("            if _b2 < 0x80 then")
		w.line("                if _b2 == 0 then error(\"overlong tag varint at offset \" .. pos, 0) end")
		w.line("                local _v = _b - 128 + _b2 * 128")
		w.line("                wt = band(_v, 7)")
		w.line("                if wt >= 6 then error(\"illegal wire type \" .. wt, 0) end")
		w.line("                id = rshift(_v, 3)")
		w.line("                pos = pos + 2")
		w.line("            else")
		w.line("                id, wt, pos = wire.decode_tag(buf, pos)")
		w.line("            end")
		w.line("        else")
		w.line("            id, wt, pos = wire.decode_tag(buf, pos)")
		w.line("        end")


@@ 1121,11 1134,12 @@ func fixedScalarBytes(k protoreflect.Kind) int {
}

// emitInlineStringBytesScalar emits the singular string/bytes decode with the
// 1-byte LEN fast path inlined. Falls back to `wire.decode_<st>` for lengths
// >= 128. UTF-8 validation runs only for `string`, not `bytes`. When
// validateUTF8 is false the inline check is dropped and the >=128-byte
// fallback for strings is routed through wire.decode_bytes (same shape, no
// utf8_len call). (a6n, 6bb)
// 1-byte LEN fast path (lengths 0..127) and the 2-byte LEN fast path (lengths
// 128..16383) inlined directly. Falls back to `wire.decode_<st>` only for
// lengths >= 16384. UTF-8 validation runs only for `string`, not `bytes`. When
// validateUTF8 is false the inline check is dropped and the fallback for
// strings is routed through wire.decode_bytes (same shape, no utf8_len call).
// (a6n, 6bb, auj)
func emitInlineStringBytesScalar(w *writer, st, dst string, validateUTF8 bool) {
	wireCall := st
	if st == "string" && !validateUTF8 {


@@ 1142,6 1156,25 @@ func emitInlineStringBytesScalar(w *writer, st, dst string, validateUTF8 bool) {
	}
	w.line("                %s = _s", dst)
	w.line("                pos = _epos")
	w.line("            elseif _lb ~= nil and pos < len then")
	w.line("                local _lb2 = string_byte(buf, pos + 1)")
	w.line("                if _lb2 ~= nil and _lb2 < 0x80 then")
	w.line("                    if _lb2 == 0 then error(\"overlong LEN varint at offset \" .. pos, 0) end")
	w.line("                    local _ln = _lb - 128 + _lb2 * 128")
	w.line("                    local _np = pos + 2")
	w.line("                    local _epos = _np + _ln")
	w.line("                    if _epos - 1 > len then error(\"truncated LEN at offset \" .. pos, 0) end")
	w.line("                    local _s = buf:sub(_np, _epos - 1)")
	if st == "string" && validateUTF8 {
		w.line("                    if utf8_len(_s) == nil then error(\"invalid UTF-8 in string field at offset \" .. pos, 0) end")
	}
	w.line("                    %s = _s", dst)
	w.line("                    pos = _epos")
	w.line("                else")
	w.line("                    local val")
	w.line("                    val, pos = wire.decode_%s(buf, pos)", wireCall)
	w.line("                    %s = val", dst)
	w.line("                end")
	w.line("            else")
	w.line("                local val")
	w.line("                val, pos = wire.decode_%s(buf, pos)", wireCall)


@@ 1150,7 1183,9 @@ func emitInlineStringBytesScalar(w *writer, st, dst string, validateUTF8 bool) {
}

// emitInlineStringBytesRepeated mirrors emitInlineStringBytesScalar but
// appends to the per-field list via the `_n_<f>` counter. (a6n, 6bb)
// appends to the per-field list via the `_n_<f>` counter. Both 1-byte and
// 2-byte LEN fast paths are inlined; falls back only for lengths >= 16384.
// (a6n, 6bb, auj)
func emitInlineStringBytesRepeated(w *writer, st, cnt string, validateUTF8 bool) {
	wireCall := st
	if st == "string" && !validateUTF8 {


@@ 1167,6 1202,25 @@ func emitInlineStringBytesRepeated(w *writer, st, cnt string, validateUTF8 bool)
	}
	w.line("                %s = %s + 1; list[%s] = _s", cnt, cnt, cnt)
	w.line("                pos = _epos")
	w.line("            elseif _lb ~= nil and pos < len then")
	w.line("                local _lb2 = string_byte(buf, pos + 1)")
	w.line("                if _lb2 ~= nil and _lb2 < 0x80 then")
	w.line("                    if _lb2 == 0 then error(\"overlong LEN varint at offset \" .. pos, 0) end")
	w.line("                    local _ln = _lb - 128 + _lb2 * 128")
	w.line("                    local _np = pos + 2")
	w.line("                    local _epos = _np + _ln")
	w.line("                    if _epos - 1 > len then error(\"truncated LEN at offset \" .. pos, 0) end")
	w.line("                    local _s = buf:sub(_np, _epos - 1)")
	if st == "string" && validateUTF8 {
		w.line("                    if utf8_len(_s) == nil then error(\"invalid UTF-8 in string field at offset \" .. pos, 0) end")
	}
	w.line("                    %s = %s + 1; list[%s] = _s", cnt, cnt, cnt)
	w.line("                    pos = _epos")
	w.line("                else")
	w.line("                    local val")
	w.line("                    val, pos = wire.decode_%s(buf, pos)", wireCall)
	w.line("                    %s = %s + 1; list[%s] = val", cnt, cnt, cnt)
	w.line("                end")
	w.line("            else")
	w.line("                local val")
	w.line("                val, pos = wire.decode_%s(buf, pos)", wireCall)

M examples/expected/full/c_int64/c_int64_pb.lua => examples/expected/full/c_int64/c_int64_pb.lua +28 -2
@@ 101,6 101,7 @@ end
---@param b string
---@return c_int64.Wide
function M.Wide_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.Wide_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 122,8 123,20 @@ function M.Wide_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 164,6 177,7 @@ end
---@param b string
---@return c_int64.Wide
function M.Wide_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.Wide_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 185,8 199,20 @@ function M.Wide_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val

M examples/expected/full/c_nested/c_nested_pb.lua => examples/expected/full/c_nested/c_nested_pb.lua +140 -10
@@ 146,6 146,7 @@ end
---@param b string
---@return c_nested.L1
function M.L1_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L1_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 167,8 168,20 @@ function M.L1_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 202,6 215,7 @@ end
---@param b string
---@return c_nested.L1
function M.L1_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L1_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 223,8 237,20 @@ function M.L1_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 307,6 333,7 @@ end
---@param b string
---@return c_nested.L2
function M.L2_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 328,8 355,20 @@ function M.L2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 363,6 402,7 @@ end
---@param b string
---@return c_nested.L2
function M.L2_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 384,8 424,20 @@ function M.L2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 468,6 520,7 @@ end
---@param b string
---@return c_nested.L3
function M.L3_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 489,8 542,20 @@ function M.L3_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 524,6 589,7 @@ end
---@param b string
---@return c_nested.L3
function M.L3_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 545,8 611,20 @@ function M.L3_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 629,6 707,7 @@ end
---@param b string
---@return c_nested.L4
function M.L4_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L4_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 650,8 729,20 @@ function M.L4_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 685,6 776,7 @@ end
---@param b string
---@return c_nested.L4
function M.L4_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L4_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 706,8 798,20 @@ function M.L4_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 777,6 881,7 @@ end
---@param b string
---@return c_nested.L5
function M.L5_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L5_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 798,8 903,20 @@ function M.L5_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 2 then
            local val


@@ 824,6 941,7 @@ end
---@param b string
---@return c_nested.L5
function M.L5_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.L5_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 845,8 963,20 @@ function M.L5_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 2 then
            local val

M examples/expected/full/c_repeated/c_repeated_pb.lua => examples/expected/full/c_repeated/c_repeated_pb.lua +162 -8
@@ 135,6 135,8 @@ end
---@param b string
---@return c_repeated.Inner
function M.Inner_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.Inner_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 156,8 158,20 @@ function M.Inner_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 173,9 187,26 @@ function M.Inner_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.s = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.s = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.s = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.s = val
            end
        else


@@ 197,6 228,8 @@ end
---@param b string
---@return c_repeated.Inner
function M.Inner_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.Inner_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 218,8 251,20 @@ function M.Inner_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 234,9 279,25 @@ function M.Inner_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.s = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.s = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.s = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.s = val
            end
        else


@@ 550,6 611,7 @@ end
---@return c_repeated.Holder
function M.Holder_decode(buf)
    local decode_bool = wire.decode_bool
    local decode_bytes = wire.decode_bytes
    local decode_double = wire.decode_double
    local decode_fixed32 = wire.decode_fixed32
    local decode_fixed64 = wire.decode_fixed64


@@ 558,6 620,8 @@ function M.Holder_decode(buf)
    local decode_int64 = wire.decode_int64
    local decode_len = wire.decode_len
    local decode_sint32 = wire.decode_sint32
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local decode_uint32 = wire.decode_uint32
    local _d = M.Holder_descriptor
    if pb.c_runtime ~= nil then


@@ 595,8 659,20 @@ function M.Holder_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            if wt == 2 then


@@ 838,9 914,26 @@ function M.Holder_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_strings = _n_strings + 1; list[_n_strings] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_strings = _n_strings + 1; list[_n_strings] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_strings = _n_strings + 1; list[_n_strings] = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                _n_strings = _n_strings + 1; list[_n_strings] = val
            end
        elseif id == 31 then


@@ 854,9 947,25 @@ function M.Holder_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_blobs = _n_blobs + 1; list[_n_blobs] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_blobs = _n_blobs + 1; list[_n_blobs] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_blobs = _n_blobs + 1; list[_n_blobs] = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                _n_blobs = _n_blobs + 1; list[_n_blobs] = val
            end
        elseif id == 40 then


@@ 894,6 1003,7 @@ function M.Holder_decode_unsafe(buf)
    local decode_int64 = wire.decode_int64
    local decode_len = wire.decode_len
    local decode_sint32 = wire.decode_sint32
    local decode_tag = wire.decode_tag
    local decode_uint32 = wire.decode_uint32
    local _d = M.Holder_descriptor
    if pb.c_runtime ~= nil then


@@ 931,8 1041,20 @@ function M.Holder_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            if wt == 2 then


@@ 1173,6 1295,22 @@ function M.Holder_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_strings = _n_strings + 1; list[_n_strings] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_strings = _n_strings + 1; list[_n_strings] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_strings = _n_strings + 1; list[_n_strings] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1189,6 1327,22 @@ function M.Holder_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_blobs = _n_blobs + 1; list[_n_blobs] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_blobs = _n_blobs + 1; list[_n_blobs] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_blobs = _n_blobs + 1; list[_n_blobs] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)

M examples/expected/full/conformance/conformance_pb.lua => examples/expected/full/conformance/conformance_pb.lua +703 -12
@@ 261,6 261,7 @@ end
---@return conformance.TestStatus
function M.TestStatus_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.TestStatus_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 282,8 283,20 @@ function M.TestStatus_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 295,6 308,23 @@ function M.TestStatus_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 310,6 340,23 @@ function M.TestStatus_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.failure_message = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.failure_message = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.failure_message = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 325,6 372,23 @@ function M.TestStatus_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.matched_name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.matched_name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.matched_name = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 350,6 414,7 @@ end
---@return conformance.TestStatus
function M.TestStatus_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.TestStatus_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 371,8 436,20 @@ function M.TestStatus_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 383,6 460,22 @@ function M.TestStatus_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 397,6 490,22 @@ function M.TestStatus_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.failure_message = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.failure_message = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.failure_message = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 411,6 520,22 @@ function M.TestStatus_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.matched_name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.matched_name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.matched_name = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 481,6 606,7 @@ end
---@param b string
---@return conformance.FailureSet
function M.FailureSet_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.FailureSet_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 503,8 629,20 @@ function M.FailureSet_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 2 then
            local list = result.test


@@ 531,6 669,7 @@ end
---@param b string
---@return conformance.FailureSet
function M.FailureSet_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.FailureSet_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 553,8 692,20 @@ function M.FailureSet_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 2 then
            local list = result.test


@@ 723,7 874,9 @@ end
---@param b string
---@return conformance.ConformanceRequest
function M.ConformanceRequest_decode(buf)
    local decode_bytes = wire.decode_bytes
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local decode_varint = wire.decode_varint
    local varint_to_int32 = wire.varint_to_int32
    local _d = M.ConformanceRequest_descriptor


@@ 747,8 900,20 @@ function M.ConformanceRequest_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 759,9 924,25 @@ function M.ConformanceRequest_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.protobuf_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.protobuf_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.protobuf_payload = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.protobuf_payload = val
            end
            result.json_payload = nil


@@ 777,6 958,23 @@ function M.ConformanceRequest_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.json_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.json_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.json_payload = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 795,6 993,23 @@ function M.ConformanceRequest_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.jspb_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.jspb_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.jspb_payload = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 813,6 1028,23 @@ function M.ConformanceRequest_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.text_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.text_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.text_payload = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 835,6 1067,23 @@ function M.ConformanceRequest_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.message_type = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.message_type = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.message_type = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 877,6 1126,7 @@ end
---@return conformance.ConformanceRequest
function M.ConformanceRequest_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local decode_varint = wire.decode_varint
    local varint_to_int32 = wire.varint_to_int32
    local _d = M.ConformanceRequest_descriptor


@@ 900,8 1150,20 @@ function M.ConformanceRequest_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 912,6 1174,22 @@ function M.ConformanceRequest_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.protobuf_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.protobuf_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.protobuf_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 929,6 1207,22 @@ function M.ConformanceRequest_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.json_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.json_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.json_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 946,6 1240,22 @@ function M.ConformanceRequest_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.jspb_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.jspb_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.jspb_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 963,6 1273,22 @@ function M.ConformanceRequest_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.text_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.text_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.text_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 984,6 1310,22 @@ function M.ConformanceRequest_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.message_type = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.message_type = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.message_type = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1174,7 1516,9 @@ end
---@param b string
---@return conformance.ConformanceResponse
function M.ConformanceResponse_decode(buf)
    local decode_bytes = wire.decode_bytes
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.ConformanceResponse_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1196,8 1540,20 @@ function M.ConformanceResponse_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 1209,6 1565,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.parse_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.parse_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.parse_error = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1232,6 1605,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.serialize_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.serialize_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.serialize_error = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1255,6 1645,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.timeout_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.timeout_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.timeout_error = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1278,6 1685,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.runtime_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.runtime_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.runtime_error = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1300,9 1724,25 @@ function M.ConformanceResponse_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.protobuf_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.protobuf_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.protobuf_payload = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.protobuf_payload = val
            end
            result.parse_error = nil


@@ 1323,6 1763,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.json_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.json_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.json_payload = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1346,6 1803,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.skipped = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.skipped = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.skipped = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1369,6 1843,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.jspb_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.jspb_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.jspb_payload = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1392,6 1883,23 @@ function M.ConformanceResponse_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.text_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.text_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.text_payload = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1425,6 1933,7 @@ end
---@return conformance.ConformanceResponse
function M.ConformanceResponse_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.ConformanceResponse_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1446,8 1955,20 @@ function M.ConformanceResponse_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 1458,6 1979,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.parse_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.parse_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.parse_error = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1480,6 2017,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.serialize_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.serialize_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.serialize_error = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1502,6 2055,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.timeout_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.timeout_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.timeout_error = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1524,6 2093,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.runtime_error = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.runtime_error = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.runtime_error = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1546,6 2131,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.protobuf_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.protobuf_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.protobuf_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1568,6 2169,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.json_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.json_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.json_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1590,6 2207,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.skipped = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.skipped = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.skipped = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1612,6 2245,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.jspb_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.jspb_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.jspb_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1634,6 2283,22 @@ function M.ConformanceResponse_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.text_payload = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.text_payload = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.text_payload = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1702,6 2367,7 @@ end
---@param b string
---@return conformance.JspbEncodingConfig
function M.JspbEncodingConfig_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.JspbEncodingConfig_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1723,8 2389,20 @@ function M.JspbEncodingConfig_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 1749,6 2427,7 @@ end
---@param b string
---@return conformance.JspbEncodingConfig
function M.JspbEncodingConfig_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.JspbEncodingConfig_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1770,8 2449,20 @@ function M.JspbEncodingConfig_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val

M examples/expected/full/hello/hello_pb.lua => examples/expected/full/hello/hello_pb.lua +511 -19
@@ 278,6 278,8 @@ end
---@return hello.Result
function M.Result_decode(buf)
    local decode_int32 = wire.decode_int32
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.Result_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 299,8 301,20 @@ function M.Result_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 316,9 330,26 @@ function M.Result_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.text = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.text = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.text = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.text = val
            end
            result.code = nil


@@ 359,7 390,9 @@ end
---@param b string
---@return hello.Result
function M.Result_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_int32 = wire.decode_int32
    local decode_tag = wire.decode_tag
    local _d = M.Result_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 381,8 414,20 @@ function M.Result_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 397,9 442,25 @@ function M.Result_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.text = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.text = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.text = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.text = val
            end
            result.code = nil


@@ 482,6 543,8 @@ end
---@param b string
---@return hello.HelloRequest
function M.HelloRequest_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.HelloRequest_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 503,8 566,20 @@ function M.HelloRequest_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 516,9 591,26 @@ function M.HelloRequest_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.name = val
            end
        else


@@ 540,6 632,8 @@ end
---@param b string
---@return hello.HelloRequest
function M.HelloRequest_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.HelloRequest_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 561,8 655,20 @@ function M.HelloRequest_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 573,9 679,25 @@ function M.HelloRequest_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.name = val
            end
        else


@@ 639,6 761,8 @@ end
---@param b string
---@return hello.HelloReply
function M.HelloReply_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.HelloReply_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 660,8 784,20 @@ function M.HelloReply_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 673,9 809,26 @@ function M.HelloReply_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.greeting = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.greeting = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.greeting = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.greeting = val
            end
        else


@@ 697,6 850,8 @@ end
---@param b string
---@return hello.HelloReply
function M.HelloReply_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.HelloReply_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 718,8 873,20 @@ function M.HelloReply_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 730,9 897,25 @@ function M.HelloReply_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.greeting = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.greeting = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.greeting = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.greeting = val
            end
        else


@@ 941,6 1124,8 @@ end
---@return hello.Event
function M.Event_decode(buf)
    local decode_len = wire.decode_len
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.Event_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 962,8 1147,20 @@ function M.Event_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 975,9 1172,26 @@ function M.Event_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.title = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.title = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.title = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.title = val
            end
        elseif id == 2 then


@@ 1043,7 1257,9 @@ end
---@param b string
---@return hello.Event
function M.Event_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.Event_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1065,8 1281,20 @@ function M.Event_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 1077,9 1305,25 @@ function M.Event_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.title = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.title = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.title = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.title = val
            end
        elseif id == 2 then


@@ 1219,6 1463,7 @@ end
---@return hello.Address
function M.Address_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.Address_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1240,8 1485,20 @@ function M.Address_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 1253,6 1510,23 @@ function M.Address_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.street = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.street = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.street = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1268,6 1542,23 @@ function M.Address_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.city = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.city = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.city = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1287,6 1578,23 @@ function M.Address_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.apartment = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.apartment = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.apartment = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1312,6 1620,7 @@ end
---@return hello.Address
function M.Address_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.Address_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1333,8 1642,20 @@ function M.Address_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 1345,6 1666,22 @@ function M.Address_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.street = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.street = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.street = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1359,6 1696,22 @@ function M.Address_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.city = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.city = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.city = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1377,6 1730,22 @@ function M.Address_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.apartment = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.apartment = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.apartment = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1643,6 2012,7 @@ end
---@param b string
---@return hello.Person
function M.Person_decode(buf)
    local decode_bytes = wire.decode_bytes
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_string = wire.decode_string


@@ 1672,6 2042,18 @@ function M.Person_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = decode_tag(buf, pos)
        end


@@ 1685,6 2067,23 @@ function M.Person_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1706,6 2105,23 @@ function M.Person_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_emails = _n_emails + 1; list[_n_emails] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_emails = _n_emails + 1; list[_n_emails] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_emails = _n_emails + 1; list[_n_emails] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1758,9 2174,25 @@ function M.Person_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.avatar = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.avatar = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.avatar = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.avatar = val
            end
        elseif id == 9 then


@@ 1882,6 2314,18 @@ function M.Person_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = decode_tag(buf, pos)
        end


@@ 1894,6 2338,22 @@ function M.Person_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1914,6 2374,22 @@ function M.Person_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_emails = _n_emails + 1; list[_n_emails] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_emails = _n_emails + 1; list[_n_emails] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_emails = _n_emails + 1; list[_n_emails] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 1966,6 2442,22 @@ function M.Person_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.avatar = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.avatar = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.avatar = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)

M examples/expected/full/proto2_basic/proto2_basic_pb.lua => examples/expected/full/proto2_basic/proto2_basic_pb.lua +489 -26
@@ 334,6 334,9 @@ end
---@param b string
---@return proto2_basic.Defaults
function M.Defaults_decode(buf)
    local decode_bytes = wire.decode_bytes
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.Defaults_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 355,8 358,20 @@ function M.Defaults_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 372,9 387,26 @@ function M.Defaults_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.s = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.s = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.s = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.s = val
            end
        elseif id == 3 then


@@ 406,9 438,25 @@ function M.Defaults_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.by = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.by = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.by = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.by = val
            end
        elseif id == 9 then


@@ 435,6 483,7 @@ end
---@return proto2_basic.Defaults
function M.Defaults_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.Defaults_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 456,8 505,20 @@ function M.Defaults_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 472,6 533,22 @@ function M.Defaults_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.s = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.s = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.s = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 506,6 583,22 @@ function M.Defaults_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.by = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.by = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.by = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 666,6 759,7 @@ end
function M.Cardinality_decode(buf)
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.Cardinality_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 690,8 784,20 @@ function M.Cardinality_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 779,6 885,7 @@ end
function M.Cardinality_decode_unsafe(buf)
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.Cardinality_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 803,8 910,20 @@ function M.Cardinality_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 954,6 1073,7 @@ end
---@return proto2_basic.Nested
function M.Nested_decode(buf)
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.Nested_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 975,8 1095,20 @@ function M.Nested_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 1016,6 1148,7 @@ end
---@return proto2_basic.Nested
function M.Nested_decode_unsafe(buf)
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.Nested_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1037,8 1170,20 @@ function M.Nested_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 1119,6 1264,7 @@ end
---@param b string
---@return proto2_basic.Nested.Inner
function M.Nested_Inner_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.Nested_Inner_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1140,8 1286,20 @@ function M.Nested_Inner_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 1166,6 1324,7 @@ end
---@param b string
---@return proto2_basic.Nested.Inner
function M.Nested_Inner_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.Nested_Inner_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1187,8 1346,20 @@ function M.Nested_Inner_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 1261,6 1432,7 @@ end
---@param b string
---@return proto2_basic.WithGroup
function M.WithGroup_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.WithGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1283,8 1455,20 @@ function M.WithGroup_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 1320,6 1504,7 @@ end
---@param b string
---@return proto2_basic.WithGroup
function M.WithGroup_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.WithGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1342,8 1527,20 @@ function M.WithGroup_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 1432,6 1629,8 @@ end
---@param b string
---@return proto2_basic.WithGroup.SingleGroup
function M.WithGroup_SingleGroup_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.WithGroup_SingleGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1453,8 1652,20 @@ function M.WithGroup_SingleGroup_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 2 then
            local val


@@ 1470,9 1681,26 @@ function M.WithGroup_SingleGroup_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.s = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.s = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.s = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.s = val
            end
        else


@@ 1494,6 1722,8 @@ end
---@param b string
---@return proto2_basic.WithGroup.SingleGroup
function M.WithGroup_SingleGroup_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.WithGroup_SingleGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1515,8 1745,20 @@ function M.WithGroup_SingleGroup_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 2 then
            local val


@@ 1531,9 1773,25 @@ function M.WithGroup_SingleGroup_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.s = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.s = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.s = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.s = val
            end
        else


@@ 1601,6 1859,7 @@ end
---@param b string
---@return proto2_basic.WithGroup.RepGroup
function M.WithGroup_RepGroup_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.WithGroup_RepGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1622,8 1881,20 @@ function M.WithGroup_RepGroup_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 5 then
            local val


@@ 1648,6 1919,7 @@ end
---@param b string
---@return proto2_basic.WithGroup.RepGroup
function M.WithGroup_RepGroup_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.WithGroup_RepGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1669,8 1941,20 @@ function M.WithGroup_RepGroup_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 5 then
            local val


@@ 1855,6 2139,7 @@ function M.BenchPayload_decode(buf)
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.BenchPayload_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 1878,8 2163,20 @@ function M.BenchPayload_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 1895,6 2192,23 @@ function M.BenchPayload_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1935,6 2249,23 @@ function M.BenchPayload_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_tags = _n_tags + 1; list[_n_tags] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_tags = _n_tags + 1; list[_n_tags] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_tags = _n_tags + 1; list[_n_tags] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 1992,6 2323,7 @@ function M.BenchPayload_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.BenchPayload_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 2015,8 2347,20 @@ function M.BenchPayload_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 2031,6 2375,22 @@ function M.BenchPayload_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 2070,6 2430,22 @@ function M.BenchPayload_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_tags = _n_tags + 1; list[_n_tags] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_tags = _n_tags + 1; list[_n_tags] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_tags = _n_tags + 1; list[_n_tags] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 2188,6 2564,7 @@ end
---@return proto2_basic.BenchPayload.Stats
function M.BenchPayload_Stats_decode(buf)
    local decode_int32 = wire.decode_int32
    local decode_tag = wire.decode_tag
    local _d = M.BenchPayload_Stats_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 2209,8 2586,20 @@ function M.BenchPayload_Stats_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 8 then
            local val


@@ 2240,6 2629,7 @@ end
---@return proto2_basic.BenchPayload.Stats
function M.BenchPayload_Stats_decode_unsafe(buf)
    local decode_int32 = wire.decode_int32
    local decode_tag = wire.decode_tag
    local _d = M.BenchPayload_Stats_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 2261,8 2651,20 @@ function M.BenchPayload_Stats_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 8 then
            local val


@@ 2350,6 2752,8 @@ end
---@param b string
---@return proto2_basic.BenchPayload.Inner
function M.BenchPayload_Inner_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.BenchPayload_Inner_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 2371,8 2775,20 @@ function M.BenchPayload_Inner_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 2384,9 2800,26 @@ function M.BenchPayload_Inner_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.key = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.key = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.key = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.key = val
            end
        elseif id == 2 then


@@ 2412,6 2845,8 @@ end
---@param b string
---@return proto2_basic.BenchPayload.Inner
function M.BenchPayload_Inner_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.BenchPayload_Inner_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 2433,8 2868,20 @@ function M.BenchPayload_Inner_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 2445,9 2892,25 @@ function M.BenchPayload_Inner_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.key = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.key = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.key = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.key = val
            end
        elseif id == 2 then

M examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua => examples/expected/full/protobuf_test_messages/proto2/test_messages_proto2_pb.lua +1312 -44
@@ 2828,6 2828,18 @@ function M.TestAllTypesProto2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = decode_tag(buf, pos)
        end


@@ 2893,6 2905,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 2907,6 2936,22 @@ function M.TestAllTypesProto2_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 2948,6 2993,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_string_piece = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_string_piece = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_string_piece = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 2963,6 3025,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_cord = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_cord = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_cord = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3236,6 3315,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3252,6 3348,22 @@ function M.TestAllTypesProto2_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 3319,6 3431,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3336,6 3465,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 4336,6 4482,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.oneof_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.oneof_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.oneof_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 4358,6 4521,22 @@ function M.TestAllTypesProto2_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.oneof_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.oneof_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.oneof_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 4511,6 4690,23 @@ function M.TestAllTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.default_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.default_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.default_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 4525,6 4721,22 @@ function M.TestAllTypesProto2_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.default_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.default_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.default_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 4734,6 4946,18 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = decode_tag(buf, pos)
        end


@@ 4798,6 5022,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 4812,6 5052,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 4852,6 5108,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_string_piece = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_string_piece = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_string_piece = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 4866,6 5138,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_cord = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_cord = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_cord = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5138,6 5426,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5154,6 5458,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5220,6 5540,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5236,6 5572,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6235,6 6587,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.oneof_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.oneof_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.oneof_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6257,6 6625,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.oneof_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.oneof_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.oneof_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6409,6 6793,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.default_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.default_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.default_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6423,6 6823,22 @@ function M.TestAllTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.default_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.default_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.default_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6877,6 7293,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllTypesProto2.NestedMessage
function M.TestAllTypesProto2_NestedMessage_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto2_NestedMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 6898,8 7315,20 @@ function M.TestAllTypesProto2_NestedMessage_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 6933,6 7362,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllTypesProto2.NestedMessage
function M.TestAllTypesProto2_NestedMessage_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto2_NestedMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 6954,8 7384,20 @@ function M.TestAllTypesProto2_NestedMessage_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 7041,6 7483,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllTypesProto2.Data
function M.TestAllTypesProto2_Data_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto2_Data_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7062,8 7505,20 @@ function M.TestAllTypesProto2_Data_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 202 then
            local val


@@ 7092,6 7547,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllTypesProto2.Data
function M.TestAllTypesProto2_Data_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto2_Data_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7113,8 7569,20 @@ function M.TestAllTypesProto2_Data_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 202 then
            local val


@@ 7195,6 7663,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllTypesProto2.MultiWordGroupField
function M.TestAllTypesProto2_MultiWordGroupField_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto2_MultiWordGroupField_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7216,8 7685,20 @@ function M.TestAllTypesProto2_MultiWordGroupField_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 205 then
            local val


@@ 7246,6 7727,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllTypesProto2.MultiWordGroupField
function M.TestAllTypesProto2_MultiWordGroupField_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto2_MultiWordGroupField_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7267,8 7749,20 @@ function M.TestAllTypesProto2_MultiWordGroupField_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 205 then
            local val


@@ 7343,6 7837,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.ForeignMessageProto2
function M.ForeignMessageProto2_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.ForeignMessageProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7364,8 7859,20 @@ function M.ForeignMessageProto2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 7390,6 7897,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.ForeignMessageProto2
function M.ForeignMessageProto2_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.ForeignMessageProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7411,8 7919,20 @@ function M.ForeignMessageProto2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 7484,6 8004,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.GroupField
function M.GroupField_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.GroupField_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7505,8 8026,20 @@ function M.GroupField_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 122 then
            local val


@@ 7535,6 8068,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.GroupField
function M.GroupField_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.GroupField_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7556,8 8090,20 @@ function M.GroupField_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 122 then
            local val


@@ 7683,6 8229,8 @@ end
function M.UnknownToTestAllTypes_decode(buf)
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.UnknownToTestAllTypes_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7705,8 8253,20 @@ function M.UnknownToTestAllTypes_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1001 then
            local val


@@ 7722,9 8282,26 @@ function M.UnknownToTestAllTypes_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_string = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.optional_string = val
            end
        elseif id == 1003 then


@@ 7787,8 8364,10 @@ end
---@param b string
---@return protobuf_test_messages.proto2.UnknownToTestAllTypes
function M.UnknownToTestAllTypes_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_int32 = wire.decode_int32
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.UnknownToTestAllTypes_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7811,8 8390,20 @@ function M.UnknownToTestAllTypes_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1001 then
            local val


@@ 7827,9 8418,25 @@ function M.UnknownToTestAllTypes_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_string = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.optional_string = val
            end
        elseif id == 1003 then


@@ 7953,6 8560,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.UnknownToTestAllTypes.OptionalGroup
function M.UnknownToTestAllTypes_OptionalGroup_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.UnknownToTestAllTypes_OptionalGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7974,8 8582,20 @@ function M.UnknownToTestAllTypes_OptionalGroup_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 8000,6 8620,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.UnknownToTestAllTypes.OptionalGroup
function M.UnknownToTestAllTypes_OptionalGroup_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.UnknownToTestAllTypes_OptionalGroup_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8021,8 8642,20 @@ function M.UnknownToTestAllTypes_OptionalGroup_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 8082,6 8715,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.NullHypothesisProto2
function M.NullHypothesisProto2_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.NullHypothesisProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8103,8 8737,20 @@ function M.NullHypothesisProto2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 8126,6 8772,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.NullHypothesisProto2
function M.NullHypothesisProto2_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.NullHypothesisProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8147,8 8794,20 @@ function M.NullHypothesisProto2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 8200,6 8859,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.EnumOnlyProto2
function M.EnumOnlyProto2_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.EnumOnlyProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8221,8 8881,20 @@ function M.EnumOnlyProto2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 8244,6 8916,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.EnumOnlyProto2
function M.EnumOnlyProto2_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.EnumOnlyProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8265,8 8938,20 @@ function M.EnumOnlyProto2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 8330,6 9015,8 @@ end
---@param b string
---@return protobuf_test_messages.proto2.OneStringProto2
function M.OneStringProto2_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.OneStringProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8351,8 9038,20 @@ function M.OneStringProto2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 8364,9 9063,26 @@ function M.OneStringProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.data = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.data = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.data = val
                end
            else
                local val
                val, pos = wire.decode_string(buf, pos)
                val, pos = decode_string(buf, pos)
                result.data = val
            end
        else


@@ 8388,6 9104,8 @@ end
---@param b string
---@return protobuf_test_messages.proto2.OneStringProto2
function M.OneStringProto2_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.OneStringProto2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8409,8 9127,20 @@ function M.OneStringProto2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local _lb = string_byte(buf, pos)


@@ 8421,9 9151,25 @@ function M.OneStringProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.data = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.data = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.data = val
                end
            else
                local val
                val, pos = wire.decode_bytes(buf, pos)
                val, pos = decode_bytes(buf, pos)
                result.data = val
            end
        else


@@ 8516,6 9262,7 @@ end
---@return protobuf_test_messages.proto2.ProtoWithKeywords
function M.ProtoWithKeywords_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.ProtoWithKeywords_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8538,8 9285,20 @@ function M.ProtoWithKeywords_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 8555,6 9314,23 @@ function M.ProtoWithKeywords_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.concept = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.concept = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.concept = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 8572,6 9348,23 @@ function M.ProtoWithKeywords_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_requires = _n_requires + 1; list[_n_requires] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_requires = _n_requires + 1; list[_n_requires] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_requires = _n_requires + 1; list[_n_requires] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 8597,6 9390,7 @@ end
---@return protobuf_test_messages.proto2.ProtoWithKeywords
function M.ProtoWithKeywords_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.ProtoWithKeywords_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 8619,8 9413,20 @@ function M.ProtoWithKeywords_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 8635,6 9441,22 @@ function M.ProtoWithKeywords_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.concept = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.concept = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.concept = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 8651,6 9473,22 @@ function M.ProtoWithKeywords_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_requires = _n_requires + 1; list[_n_requires] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_requires = _n_requires + 1; list[_n_requires] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_requires = _n_requires + 1; list[_n_requires] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9100,6 9938,7 @@ function M.TestAllRequiredTypesProto2_decode(buf)
    local decode_sint32 = wire.decode_sint32
    local decode_sint64 = wire.decode_sint64
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local decode_uint32 = wire.decode_uint32
    local decode_uint64 = wire.decode_uint64
    local decode_varint = wire.decode_varint


@@ 9125,8 9964,20 @@ function M.TestAllRequiredTypesProto2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 9190,6 10041,23 @@ function M.TestAllRequiredTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.required_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.required_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.required_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 9204,6 10072,22 @@ function M.TestAllRequiredTypesProto2_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.required_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.required_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.required_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9245,6 10129,23 @@ function M.TestAllRequiredTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.required_string_piece = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.required_string_piece = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.required_string_piece = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 9260,6 10161,23 @@ function M.TestAllRequiredTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.required_cord = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.required_cord = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.required_cord = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 9354,6 10272,23 @@ function M.TestAllRequiredTypesProto2_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.default_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.default_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.default_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 9368,6 10303,22 @@ function M.TestAllRequiredTypesProto2_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.default_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.default_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.default_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9405,6 10356,7 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
    local decode_sfixed64 = wire.decode_sfixed64
    local decode_sint32 = wire.decode_sint32
    local decode_sint64 = wire.decode_sint64
    local decode_tag = wire.decode_tag
    local decode_uint32 = wire.decode_uint32
    local decode_uint64 = wire.decode_uint64
    local decode_varint = wire.decode_varint


@@ 9430,8 10382,20 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 9494,6 10458,22 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.required_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.required_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.required_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9508,6 10488,22 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.required_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.required_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.required_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9548,6 10544,22 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.required_string_piece = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.required_string_piece = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.required_string_piece = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9562,6 10574,22 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.required_cord = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.required_cord = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.required_cord = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9655,6 10683,22 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.default_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.default_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.default_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9669,6 10713,22 @@ function M.TestAllRequiredTypesProto2_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.default_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.default_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.default_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 9764,6 10824,7 @@ end
---@return protobuf_test_messages.proto2.TestAllRequiredTypesProto2.NestedMessage
function M.TestAllRequiredTypesProto2_NestedMessage_decode(buf)
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.TestAllRequiredTypesProto2_NestedMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 9785,8 10846,20 @@ function M.TestAllRequiredTypesProto2_NestedMessage_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 9830,6 10903,7 @@ end
---@return protobuf_test_messages.proto2.TestAllRequiredTypesProto2.NestedMessage
function M.TestAllRequiredTypesProto2_NestedMessage_decode_unsafe(buf)
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.TestAllRequiredTypesProto2_NestedMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 9851,8 10925,20 @@ function M.TestAllRequiredTypesProto2_NestedMessage_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 9944,6 11030,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllRequiredTypesProto2.Data
function M.TestAllRequiredTypesProto2_Data_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllRequiredTypesProto2_Data_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 9965,8 11052,20 @@ function M.TestAllRequiredTypesProto2_Data_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 202 then
            local val


@@ 9995,6 11094,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestAllRequiredTypesProto2.Data
function M.TestAllRequiredTypesProto2_Data_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllRequiredTypesProto2_Data_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10016,8 11116,20 @@ function M.TestAllRequiredTypesProto2_Data_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 202 then
            local val


@@ 10149,6 11261,7 @@ end
---@return protobuf_test_messages.proto2.TestLargeOneof
function M.TestLargeOneof_decode(buf)
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10170,8 11283,20 @@ function M.TestLargeOneof_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 10258,6 11383,7 @@ end
---@return protobuf_test_messages.proto2.TestLargeOneof
function M.TestLargeOneof_decode_unsafe(buf)
    local decode_len = wire.decode_len
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10279,8 11405,20 @@ function M.TestLargeOneof_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local payload


@@ 10396,6 11534,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A1
function M.TestLargeOneof_A1_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A1_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10417,8 11556,20 @@ function M.TestLargeOneof_A1_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10440,6 11591,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A1
function M.TestLargeOneof_A1_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A1_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10461,8 11613,20 @@ function M.TestLargeOneof_A1_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10514,6 11678,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A2
function M.TestLargeOneof_A2_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10535,8 11700,20 @@ function M.TestLargeOneof_A2_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10558,6 11735,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A2
function M.TestLargeOneof_A2_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A2_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10579,8 11757,20 @@ function M.TestLargeOneof_A2_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10632,6 11822,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A3
function M.TestLargeOneof_A3_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10653,8 11844,20 @@ function M.TestLargeOneof_A3_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10676,6 11879,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A3
function M.TestLargeOneof_A3_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10697,8 11901,20 @@ function M.TestLargeOneof_A3_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10750,6 11966,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A4
function M.TestLargeOneof_A4_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A4_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10771,8 11988,20 @@ function M.TestLargeOneof_A4_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10794,6 12023,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A4
function M.TestLargeOneof_A4_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A4_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10815,8 12045,20 @@ function M.TestLargeOneof_A4_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10868,6 12110,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A5
function M.TestLargeOneof_A5_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A5_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10889,8 12132,20 @@ function M.TestLargeOneof_A5_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 10912,6 12167,7 @@ end
---@param b string
---@return protobuf_test_messages.proto2.TestLargeOneof.A5
function M.TestLargeOneof_A5_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestLargeOneof_A5_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 10933,8 12189,20 @@ function M.TestLargeOneof_A5_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else

M examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua => examples/expected/full/protobuf_test_messages/proto3/test_messages_proto3_pb.lua +463 -8
@@ 2987,6 2987,18 @@ function M.TestAllTypesProto3_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = decode_tag(buf, pos)
        end


@@ 3052,6 3064,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3066,6 3095,22 @@ function M.TestAllTypesProto3_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 3111,6 3156,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_string_piece = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_string_piece = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_string_piece = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3126,6 3188,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.optional_cord = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.optional_cord = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.optional_cord = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3399,6 3478,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3415,6 3511,22 @@ function M.TestAllTypesProto3_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 3482,6 3594,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 3499,6 3628,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 4461,6 4607,23 @@ function M.TestAllTypesProto3_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.oneof_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.oneof_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.oneof_string = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 4484,6 4647,22 @@ function M.TestAllTypesProto3_decode(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.oneof_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.oneof_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.oneof_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 4943,6 5122,18 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = decode_tag(buf, pos)
        end


@@ 5007,6 5198,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5021,6 5228,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5065,6 5288,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_string_piece = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_string_piece = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_string_piece = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5079,6 5318,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.optional_cord = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.optional_cord = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.optional_cord = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5351,6 5606,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_string = _n_repeated_string + 1; list[_n_repeated_string] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5367,6 5638,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_bytes = _n_repeated_bytes + 1; list[_n_repeated_bytes] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5433,6 5720,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_string_piece = _n_repeated_string_piece + 1; list[_n_repeated_string_piece] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 5449,6 5752,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_repeated_cord = _n_repeated_cord + 1; list[_n_repeated_cord] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6410,6 6729,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.oneof_string = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.oneof_string = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.oneof_string = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6433,6 6768,22 @@ function M.TestAllTypesProto3_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.oneof_bytes = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.oneof_bytes = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.oneof_bytes = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 6835,6 7186,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage
function M.TestAllTypesProto3_NestedMessage_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto3_NestedMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 6856,8 7208,20 @@ function M.TestAllTypesProto3_NestedMessage_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 6891,6 7255,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage
function M.TestAllTypesProto3_NestedMessage_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.TestAllTypesProto3_NestedMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 6912,8 7277,20 @@ function M.TestAllTypesProto3_NestedMessage_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 6983,6 7360,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.ForeignMessage
function M.ForeignMessage_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.ForeignMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7004,8 7382,20 @@ function M.ForeignMessage_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 7030,6 7420,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.ForeignMessage
function M.ForeignMessage_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.ForeignMessage_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7051,8 7442,20 @@ function M.ForeignMessage_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 7107,6 7510,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.NullHypothesisProto3
function M.NullHypothesisProto3_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.NullHypothesisProto3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7128,8 7532,20 @@ function M.NullHypothesisProto3_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 7151,6 7567,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.NullHypothesisProto3
function M.NullHypothesisProto3_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.NullHypothesisProto3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7172,8 7589,20 @@ function M.NullHypothesisProto3_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 7225,6 7654,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.EnumOnlyProto3
function M.EnumOnlyProto3_decode(buf)
    local decode_tag = wire.decode_tag
    local _d = M.EnumOnlyProto3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7246,8 7676,20 @@ function M.EnumOnlyProto3_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else


@@ 7269,6 7711,7 @@ end
---@param b string
---@return protobuf_test_messages.proto3.EnumOnlyProto3
function M.EnumOnlyProto3_decode_unsafe(buf)
    local decode_tag = wire.decode_tag
    local _d = M.EnumOnlyProto3_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 7290,8 7733,20 @@ function M.EnumOnlyProto3_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if true then
        else

M examples/expected/full/quickstart/quickstart_pb.lua => examples/expected/full/quickstart/quickstart_pb.lua +94 -2
@@ 128,6 128,7 @@ end
---@return quickstart.User
function M.User_decode(buf)
    local decode_string = wire.decode_string
    local decode_tag = wire.decode_tag
    local _d = M.User_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 150,8 151,20 @@ function M.User_decode(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 167,6 180,23 @@ function M.User_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 188,6 218,23 @@ function M.User_decode(buf)
                if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                _n_emails = _n_emails + 1; list[_n_emails] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
                    _n_emails = _n_emails + 1; list[_n_emails] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_string(buf, pos)
                    _n_emails = _n_emails + 1; list[_n_emails] = val
                end
            else
                local val
                val, pos = decode_string(buf, pos)


@@ 213,6 260,7 @@ end
---@return quickstart.User
function M.User_decode_unsafe(buf)
    local decode_bytes = wire.decode_bytes
    local decode_tag = wire.decode_tag
    local _d = M.User_descriptor
    if pb.c_runtime ~= nil then
        local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)


@@ 235,8 283,20 @@ function M.User_decode_unsafe(buf)
            id = rshift(_b, 3)
            if id == 0 then error("illegal field number 0", 0) end
            pos = pos + 1
        elseif _b ~= nil and pos < len then
            local _b2 = string_byte(buf, pos + 1)
            if _b2 < 0x80 then
                if _b2 == 0 then error("overlong tag varint at offset " .. pos, 0) end
                local _v = _b - 128 + _b2 * 128
                wt = band(_v, 7)
                if wt >= 6 then error("illegal wire type " .. wt, 0) end
                id = rshift(_v, 3)
                pos = pos + 2
            else
                id, wt, pos = decode_tag(buf, pos)
            end
        else
            id, wt, pos = wire.decode_tag(buf, pos)
            id, wt, pos = decode_tag(buf, pos)
        end
        if id == 1 then
            local val


@@ 251,6 311,22 @@ function M.User_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                result.name = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    result.name = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    result.name = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)


@@ 271,6 347,22 @@ function M.User_decode_unsafe(buf)
                local _s = buf:sub(_np, _epos - 1)
                _n_emails = _n_emails + 1; list[_n_emails] = _s
                pos = _epos
            elseif _lb ~= nil and pos < len then
                local _lb2 = string_byte(buf, pos + 1)
                if _lb2 ~= nil and _lb2 < 0x80 then
                    if _lb2 == 0 then error("overlong LEN varint at offset " .. pos, 0) end
                    local _ln = _lb - 128 + _lb2 * 128
                    local _np = pos + 2
                    local _epos = _np + _ln
                    if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
                    local _s = buf:sub(_np, _epos - 1)
                    _n_emails = _n_emails + 1; list[_n_emails] = _s
                    pos = _epos
                else
                    local val
                    val, pos = decode_bytes(buf, pos)
                    _n_emails = _n_emails + 1; list[_n_emails] = val
                end
            else
                local val
                val, pos = decode_bytes(buf, pos)