function readHuffmanCodeLengths(codeLengthCodeLengths, numSymbols, codeLengths, s) {
    let /** @type{number} */ symbol = 0;
    let /** @type{number} */ prevCodeLen = 8;
    let /** @type{number} */ repeat = 0;
    let /** @type{number} */ repeatCodeLen = 0;
    let /** @type{number} */ space = 32768;
    let /** @type{!Int32Array} */ table = new Int32Array(32 + 1);
    let /** @type{number} */ tableIdx = table.length - 1;
    buildHuffmanTable(table, tableIdx, 5, codeLengthCodeLengths, 18);
    while (symbol < numSymbols && space > 0) {
      if (s.halfOffset > 2030) {
        doReadMoreInput(s);
      }
      if (s.bitOffset >= 16) {
        s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
        s.bitOffset -= 16;
      }
      let /** @type{number} */ p = (s.accumulator32 >>> s.bitOffset) & 31;
      s.bitOffset += table[p] >> 16;
      let /** @type{number} */ codeLen = table[p] & 0xFFFF;
      if (codeLen < 16) {
        repeat = 0;
        codeLengths[symbol++] = codeLen;
        if (codeLen != 0) {
          prevCodeLen = codeLen;
          space -= 32768 >> codeLen;
        }
      } else {
        let /** @type{number} */ extraBits = codeLen - 14;
        let /** @type{number} */ newLen = 0;
        if (codeLen == 16) {
          newLen = prevCodeLen;
        }
        if (repeatCodeLen != newLen) {
          repeat = 0;
          repeatCodeLen = newLen;
        }
        let /** @type{number} */ oldRepeat = repeat;
        if (repeat > 0) {
          repeat -= 2;
          repeat <<= extraBits;
        }
        if (s.bitOffset >= 16) {
          s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
          s.bitOffset -= 16;
        }
        repeat += readFewBits(s, extraBits) + 3;
        let /** @type{number} */ repeatDelta = repeat - oldRepeat;
        if (symbol + repeatDelta > numSymbols) {
          throw "symbol + repeatDelta > numSymbols";
        }
        for (let /** @type{number} */ i = 0; i < repeatDelta; i++) {
          codeLengths[symbol++] = repeatCodeLen;
        }
        if (repeatCodeLen != 0) {
          space -= repeatDelta << (15 - repeatCodeLen);
        }
      }
    }
    if (space != 0) {
      throw "Unused space";
    }
    codeLengths.fill(0, symbol, numSymbols);
  }
@param {!Int32Array} codeLengthCodeLengths
@param {number} numSymbols
@param {!Int32Array} codeLengths
@param {!State} s
@return {void}