about summary refs log tree commit diff stats
path: root/example/expression/manip_expression3.py
blob: 06b3f77a0c446b8577665ec05a4bf8e685718f48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from miasm.arch.ia32_sem import *
from miasm.expression.expression_helper import *

print 'simple expression simplification demo'
print

a = ExprId('eax')
b = ExprId('ebx')
c = a + b
d = c - a
print d
# ((eax + ebx) - eax)
print "=>", expr_simp(d)
print
# ebx
e = ExprInt(uint32(0x12)) + ExprInt(uint32(0x30)) - a
print e
# ((0x12 + 0x30) - eax)
print "=>",  expr_simp(e)
# (0x42 - eax)