node/lib/metasm/metasm/decompile.rb
# checks if an expr has sideeffects (funcall, var assignment, mem dereference, use var out of scope if specified)
checks if an expr has sideeffects (funcall, var assignment, mem dereference, use var out of scope if specified)
checks if an expr has sideeffects ( funcall var assignment mem dereference use var out of scope if specified )
def sideeffect(exp, scope=nil)
		case exp
		when nil, ::Numeric, ::String; false
		when ::Array; exp.any? { |_e| sideeffect _e, scope }
		when C::Variable; (scope and not scope.symbol[exp.name]) or exp.type.qualifier.to_a.include? :volatile
		when C::CExpression; (exp.op == :* and not exp.lexpr) or exp.op == :funcall or AssignOp.include?(exp.op) or
				sideeffect(exp.lexpr, scope) or sideeffect(exp.rexpr, scope)
		else true	
		end
	end
def sideeffect ( exp , scope = nil ) case exp when nil , :: Numeric , :: String ; false when :: Array ; exp . any? { | _e | sideeffect _e , scope } when C :: Variable ; ( scope and not scope . symbol [ exp . name ] ) or exp . type . qualifier . to_a . include? :volatile when C :: CExpression ; ( exp . op == :* and not exp . lexpr ) or exp . op == :funcall or AssignOp . include? ( exp . op ) or sideeffect ( exp . lexpr , scope ) or sideeffect ( exp . rexpr , scope ) else true end end
checks if an expr has sideeffects (funcall, var assignment, mem dereference, use var out of scope if specified)
checks if an expr has sideeffects ( funcall var assignment mem dereference use var out of scope if specified )
# failsafe
exp
scope