/* LzmaDec.c -- LZMA Decoder
 2008-11-06 : Igor Pavlov : Public domain */
 
+#include <config.h>
+#include <common.h>
+#include <watchdog.h>
 #include "LzmaDec.h"
 
 #include <string.h>
   UInt32 range = p->range;
   UInt32 code = p->code;
 
+  WATCHDOG_RESET();
+
   do
   {
     CLzmaProb *prob;
       if (state < kNumLitStates)
       {
         symbol = 1;
+
+        WATCHDOG_RESET();
+
         do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
       }
       else
         unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
         unsigned offs = 0x100;
         symbol = 1;
+
+        WATCHDOG_RESET();
+
         do
         {
           unsigned bit;
             {
               UInt32 mask = 1;
               unsigned i = 1;
+
+              WATCHDOG_RESET();
+
               do
               {
                 GET_BIT2(prob + i, i, ; , distance |= mask);
           else
           {
             numDirectBits -= kNumAlignBits;
+
+            WATCHDOG_RESET();
+
             do
             {
               NORMALIZE
           ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
           const Byte *lim = dest + curLen;
           dicPos += curLen;
+
+          WATCHDOG_RESET();
+
           do
             *(dest) = (Byte)*(dest + src);
           while (++dest != lim);
         }
         else
         {
+
+          WATCHDOG_RESET();
+
           do
           {
             dic[dicPos++] = dic[pos];
     }
   }
   while (dicPos < limit && buf < bufLimit);
+
+  WATCHDOG_RESET();
+
   NORMALIZE;
   p->buf = buf;
   p->range = range;
 
 
 #include <config.h>
 #include <common.h>
+#include <watchdog.h>
 
 #ifdef CONFIG_LZMA
 
 
     /* Decompress */
     outProcessed = outSizeFull;
+
+    WATCHDOG_RESET();
+
     res = LzmaDecode(
         outStream, &outProcessed,
         inStream + LZMA_DATA_OFFSET, &compressedSize,