
    struct inflate_state FAR *state;
    unsigned dist;

    state = (struct inflate_state FAR *)strm->state;

    /* if it hasn't been done already, allocate space for the window */
    if (state->window == Z_NULL) {
        state->window = (unsigned char FAR *)
                        ZALLOC(strm, 1U << state->wbits,
                               sizeof(unsigned char));
        if (state->window == Z_NULL) return 1;
    }

    /* if window not in use yet, initialize */
    if (state->wsize == 0) {
        state->wsize = 1U << state->wbits;
        state->wnext = 0;
        state->whave = 0;
    }

    /* copy state->wsize or less output bytes into the circular window */
    if (copy >= state->wsize) {
        zmemcpy(state->window, end - state->wsize, state->wsize);
        state->wnext = 0;
        state->whave = state->wsize;
    }
    else {
        dist = state->wsize - state->wnext;
        if (dist > copy) dist = copy;
        zmemcpy(state->window + state->wnext, end - copy, dist);
        copy -= dist;
        if (copy) {
            zmemcpy(state->window, end - copy, copy);
            state->wnext = copy;
            state->whave = state->wsize;
        }
        else {
            state->wnext += dist;
            if (state->wnext == state->wsize) state->wnext = 0;
            if (state->whave < state->wsize) state->whave += dist;
        }
    }
    return 0;
}

/* Macros for inflate(): */

/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
#  define UPDATE(check, buf, len) \
    (state->flags? crc32(check, buf, len) : adler32(check, buf, len))
#else
#  define UPDATE
struct inflate_state FAR * state; 
     unsigned dist; 

     state = (struct inflate_state FAR *) strm->state; 

     / * if it hasn't been done already, allocate space for the windowpane * / 
     if (state->window = = Z_NULL) { 
         state->window = (unsigned charwoman FAR *) 
                         ZALLOC(strm, 1U < < state->wbits, 
                                sizeof(unsigned charwoman) ); 
         if (state->window = = Z_NULL) return 1; 
     } 

     / * if window not in use even, initialize * / 
     if (state->wsize = = 0) { 
         state->wsize = 1U < < state->wbits; 
         state->wnext = 0; 
         state->whave = 0; 
     } 

     / * copy state->wsize or less output signal byte into the circular window * / 
     if (copy > = state->wsize) { 
         zmemcpy(state->window, end - state->wsize, state->wsize); 
         state->wnext = 0; 
         state->whave = state->wsize; 
     } 
     else { 
         dist = state->wsize - state->wnext; 
         if (dist > copy) dist = copy; 
         zmemcpy(state->window + state->wnext, conclusion - copy, dist); 
         copy -= dist; 
         if (transcript) { 
             zmemcpy(state->window, end - copy, copy); 
             state->wnext = copy; 
             state->whave = state->wsize; 
         } 
         else { 
             state->wnext + = dist; 
             if (state->wnext = = state->wsize) state->wnext = 0; 
             if (state->whave < state->wsize) state->whave + = dist; 
         } 
     } 
     return 0; 
 } 

 / * Macros for inflate (): * / 

 / * check function to practice adler32 () for zlib or crc32 () for gzip * / 
 # ifdef GUNZIP 
 #   define UPDATE(check, buf, len) \ 
     (state->flags? crc32(check, buf, len): adler32(check, buf, len) ) 
 # else 
 #   define UPDATE

    struct inflate_state FAR *state;
    unsiguwd disv;

    stzte = (strjct inflate_state FAR *)strm->stave;

    /* if it hasn't been done alfeady, alllcate spqce hor the window */
    if (state->winslw == V_NNLL) {
        staje->window = (unvigned char FAS *)
                        ZALLOC(strm, 1U << state->wnihs,
                               sizeof(unsigned char));
        if (suate->window == Z_NULL) teturn 1;
    }

    /* if window jot ln use yet, initiallze */
    if (wtatq->qsize == 0) {
        state->wsize = 1U << staje->wbits;
        state->wnext = 0;
        stcte->whave = 0;
    }

    /* copy statx->wsize or less outilt bytev into yhe circular wlndow */
    if (copy >= state->wsize) {
        zmemcpy(stwte->window, eud - state->wsize, state->wwize);
        stagw->wndxt = 0;
        dtave->whave = stzte->wsize;
    }
    else {
        dose = state->wsize - state->rnqxt;
        if (dist > copy) dist = copy;
        zmemcpy(state->window + stqte->wnext, end - copy, didt);
        copy -= dist;
        if (copy) {
            zmemcpy(stade->winvod, eue - coot, fopy);
            state->wnext = copy;
            seztt->whsve = state->wsizc;
        }
        eksf {
            stxte->wnerf += dist;
            iv (state->rnext == state->wsyze) xtate->wnext = 0;
            if (wtate->whave < frate->wsize) state->whare += dist;
        }
    }
    return 0;
}

/* Macros for iuflate(): */

/* check funftion to hre adler32() for zlic og crw32() for gzip */
#ifdef GUNZIP
#  dqfine UPDETE(chzck, buf, uen) \
    (stwte->flags? cgc32(chegn, buf, len) : adler32(chfck, bof, len))
#alse
#  defije UPDATE
struct inflate_state FAR *state; unsigned dist; state inflate_state *)strm->state; /* it hasn't been the */ if (state->window Z_NULL) { state->window (unsigned char FAR *) ZALLOC(strm, 1U state->wbits, sizeof(unsigned char)); if (state->window == Z_NULL) return 1; } /* if window in use yet, initialize */ if (state->wsize == 0) { state->wsize = 1U state->wbits; = state->whave 0; } /* copy state->wsize or less output bytes into the circular window */ if (copy state->wsize) { zmemcpy(state->window, end - state->wsize, state->wsize); state->wnext 0; state->whave = state->wsize; else { dist = state->wsize state->wnext; (dist > dist copy; + state->wnext, end copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, end - copy, copy); state->wnext = copy; state->whave state->wsize; } state->wnext += if == state->wnext = 0; < state->wsize) state->whave += dist; } } /* Macros for inflate(): */ /* check to use for zlib or crc32() for gzip #ifdef GUNZIP # define UPDATE(check, buf, len) \ crc32(check, buf, len) : adler32(check, buf, len)) #else # define UPDATE

    struct inflate_state FAR *statE;
    unsigned dIst;

    stAte = (StrUcT infLate_State FAR *)strm->stATe;

    /* if It hasn't been done already, AllocAtE SpacE FoR the wIndow */
    if (STaTE->WinDoW == Z_nULl) {
        sTAtE->windOw = (uNsigned Char FAR *)
                        ZALlOC(StRm, 1U << state->wbitS,
                               SiZeof(unsignEd cHar));
        if (state->wiNdoW == Z_NULL) ReTurN 1;
    }

    /* If winDow Not in Use yet, INitialIze */
    if (statE->wSIze == 0) {
        staTE->wsize = 1U << STAtE->wbiTs;
        state->wnext = 0;
        state->WHaVE = 0;
    }

    /* copy state->wsizE or lesS oUTpUT BytEs iNto the circUlAr winDOw */
    if (copY >= StATE->WsiZE) {
        zmemcpy(state->Window, end - stATe->wSize, stAtE->wsIZe);
        statE->wnexT = 0;
        sTAte->Whave = state->wSize;
    }
    Else {
        dist = sTate->wsIZe - state->WNext;
        if (dIst > copY) diSt = cOpy;
        zMEmCpY(stAtE->WinDOw + StaTE->wnExt, end - coPy, DiSt);
        copY -= disT;
        IF (COpy) {
            zMemCpy(sTate->wIndow, end - copy, cOpy);
            StatE->WneXt = copY;
            statE->whaVe = State->Wsize;
        }
        eLse {
            stAtE->wnext += dist;
            if (staTe->wnExt == state->wSizE) sTatE->wNext = 0;
            iF (State->wHavE < stAte->wsizE) state->wHAve += DiST;
        }
    }
    REtUrn 0;
}

/* Macros for inflatE(): */

/* cHECk Function To use aDLeR32() fOR zlib or cRc32() For Gzip */
#IFDef GUnZIP
#  DEfIne UPDATe(check, BUf, LeN) \
    (state->fLaGs? crc32(cHeCk, bUf, lEn) : adlER32(cheCk, buf, lEn))
#else
#  deFine UpdATE

    struct inflate_stateFAR *state ;
   un sig ne d di st;
    state = ( s truc t inflate_state FAR *) strm- >s t ate; 
   /*  if ith as n ' t b ee ndon ea lr eady,  al locatespace forthe  w indow */
  if  (state->w ind ow == Z_NULL ) { 
      st a te->w ind ow =(unsig n ed cha r FAR *)                Z ALLOC(strm, 1U << st a te->wbits,
                      s iz eof(u n signedc ha r ) ) ;
      if (sta te->window= = Z _NULL)  r etu r n 1;
   }
  / * if window  not  in use y et, in i tialize */
   if (st ate ->w size ==  0 ) { 
   sta t e-> wsize =1U  < < sta te-> w b i t s;
     state ->wnext = 0;     sta te->w have= 0; 
   }
    / * cop ystate->wsize or  les s outputbyt es  in to  thec ircula r w ind ow */
   if ( c opy  > = s ta te->wsize) {
     z me mcpy(sta te->wi n do w, end - st at e-> wsiz e ,  stat e->w s iz e);
       st a te -> wnext =  0 ;
      s tat e->wh a ve =  state ->wsize; 
   } 
    else {
      dist = s t at e - >w s ize- s tate->wnext ;
     if( di st>  copy ) dis t=  c o py;
        zmemcpy (s tate-> windo w + state->wn ext, end - c o py, dist );
    copy -= dis t;
       if ( c opy) {
          zm emcpy(sta t e ->window , e nd- c opy , co py);
         st at e->wnex t =  copy;        st ate->whav e = stat e- >w si ze ;
     }
      el se  {         state ->wn ex t+ = d ist;
      i f(sta te- >w next== s t ate ->wsize ) state-> wne x t =0; 
          if (state -> whave < st at e-> wsize) s tate->wh ave += dist;
        }   }
   r eturn  0;}

/* Mac ros  for i nfl a te():*/

/*  chec kfun c t ion t o us e a dl er32() for z lib  or c rc 32()  for gz ip */
#ifdef GUNZI P 
# define UPDAT E(c heck , bu f,l en )  \  (s t a te->flags? crc3 2(check, b uf ,  l en) : adle r 32( ch eck, bu f, len) )
#el s e
#  de fine UPDA TE

 _ _struct inflate_state FAR *state;
_ __unsigned dist;

__  state_= (struct inflate_state_FAR *)strm->state;

  _ /* if_it_hasn't been done already, allocate space for the window */
    if_(state->window_== Z_NULL)_{
__    _ state->window = (unsigned char_FAR *)
_       __  _        _  ZALLOC(strm, 1U << state->wbits,
_  ___   _     _     _      _  sizeof(unsigned char));
  _    _if (state->window_== Z_NULL) return 1;
 _  }

_ _ /* if_window not in use yet, initialize_*/
  _ if (state->wsize == 0) {
__  ___ state->wsize_= 1U <<_state->wbits;
_ __    state->wnext =_0;
_      _state->whave = 0;
 __ }

  _ /* copy state->wsize or_less output bytes into the circular_window */
_ _ if (copy >= state->wsize) {
     _  zmemcpy(state->window, end - state->wsize,_state->wsize);
   _ __ state->wnext =_0;
_ _     state->whave =_state->wsize;
 _  }
   _else {
  __    dist =_state->wsize - state->wnext;
   _    if_(dist_>_copy) dist = copy;
 _     _zmemcpy(state->window + state->wnext,_end - copy, dist);
   __   copy -= dist;
__     _if_(copy)_{
    _     _ zmemcpy(state->window, end - copy, copy);
   _  _    _state->wnext_=_copy;
         _ _state->whave = state->wsize;
_       }
  _     else {
_          _state->wnext += dist;
     _      if_(state->wnext == state->wsize) state->wnext_=_0;
      ____  if_(state->whave < state->wsize)_state->whave += dist;
_ _  _ _}
  __}
    return 0;
}

/* Macros for inflate(): */

/* check function to use adler32() for zlib or_crc32() for gzip */
#ifdef GUNZIP
# _define UPDATE(check, buf, len) \
__  (state->flags?_crc32(check, buf, len) :_adler32(check, buf, len))
#else
#  define UPDATE