about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/arch/x86/sem.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 46302de3..781b3321 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3377,17 +3377,14 @@ class ir_x86_16(ir):
             if e.dst == zf:
                 zf_val = e.src
 
+        cond_dec = ExprCond(c_reg - ExprInt_from(c_reg, 1), ExprInt1(0), ExprInt1(1))
         # end condition
         if zf_val is None:
-            c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1))
+            c_cond = cond_dec
         elif instr.additional_info.g1.value & 2:  # REPNE
-            # c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1)) | (zf_val)
-            c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1)) | (zf)
+            c_cond = cond_dec | zf
         elif instr.additional_info.g1.value & 4:  # REP
-            # c_cond = ExprCond(c_reg, ExprInt1(0), ExprInt1(1)) |
-            # (zf_val^ExprInt32(1))
-            c_cond = ExprCond(
-                c_reg, ExprInt1(0), ExprInt1(1)) | (zf ^ ExprInt1(1))
+            c_cond = cond_dec | (zf ^ ExprInt1(1))
 
         # gen while
         lbl_do = ExprId(self.gen_label(), instr.mode)