Index: /trunk/Decompiler.class.php
===================================================================
--- /trunk/Decompiler.class.php	(revision 790)
+++ /trunk/Decompiler.class.php	(revision 791)
@@ -585,5 +585,5 @@
 				$ret = foldToCode($ret, $EX);
 			}
-			if ($free) {
+			if ($free && empty($this->keepTs)) {
 				unset($T[$op['var']]);
 			}
@@ -880,14 +880,13 @@
 		$opcodes = &$EX['opcodes'];
 
-		$i = $starti = $first;
-		while ($i <= $last) {
+		$starti = $first;
+		for ($i = $starti; $i <= $last; ++$i) {
 			$op = $opcodes[$i];
 			if (!empty($op['jmpins']) || !empty($op['jmpouts'])) {
 				$blockFirst = $i;
 				$blockLast = -1;
-				$i = $blockFirst;
-				// $this->dumpRange($EX, $i, $last, $indent);
+				$j = $blockFirst;
 				do {
-					$op = $opcodes[$i];
+					$op = $opcodes[$j];
 					if (!empty($op['jmpins'])) {
 						// care about jumping from blocks behind, not before
@@ -901,6 +900,6 @@
 						$blockLast = max($blockLast, max($op['jmpouts']) - 1);
 					}
-					++$i;
-				} while ($i <= $blockLast);
+					++$j;
+				} while ($j <= $blockLast);
 				assert('$blockLast <= $last');
 
@@ -910,9 +909,9 @@
 					}
 					$this->decompileComplexBlock($EX, $blockFirst, $blockLast, $indent);
-					$i = $starti = $blockLast + 1;
+					$starti = $blockLast + 1;
+					$i = $starti - 1;
 					continue;
 				}
 			}
-			++$i;
 		}
 		if ($starti <= $last) {
@@ -1030,4 +1029,5 @@
 
 		/* dump whole array
+		$this->keepTs = true;
 		$this->dasmBasicBlock($EX, $first, $last);
 		for ($i = $first; $i <= $last; ++$i) {
@@ -1778,5 +1778,5 @@
 					// }}}
 				case XC_FE_FETCH: // {{{
-					$op['fe_src'] = $this->getOpVal($op1, $EX);
+					$op['fe_src'] = $this->getOpVal($op1, $EX, false, true);
 					$fe = new Decompiler_ForeachBox($op);
 					$fe->iskey = false;
