docs: protected BranchCounts readBranchCounts(final BitInputStream in,
      final Bits code, final long size) throws IOException {
      final BranchCounts branchCounts = new BranchCounts(code, size);
      final CodeType currentCodeType = this.getType(code);
      long maximum = size;
  
      // Get terminals
      if (currentCodeType == CodeType.Unknown) {
        branchCounts.terminals = this.readTerminalCount(in, maximum);
      }
      else if (currentCodeType == CodeType.Terminal) {
        branchCounts.terminals = size;
      }
      else {
        branchCounts.terminals = 0;
      }
      maximum -= branchCounts.terminals;
  
      // Get zero-suffixed primary
      if (maximum > 0) {
        assert Thread.currentThread().getStackTrace().length < 100;
        branchCounts.zeroCount = this.readZeroBranchSize(in, maximum, code);
      }
      maximum -= branchCounts.zeroCount;
      branchCounts.oneCount = maximum;
      return branchCounts;
    }