def get_type(stordefs): sizes = set() offsets = set() for s in stordefs: if s ~ ('stor', :size, :off, (:op, :idx, ...)) and op in ('map', 'array'): sizes.add(size) if safe_le_op(0, off) is True: offsets.add(off)
def get_type(stordefs): sizes = set() offsets = set() for s in stordefs: if (m := match( s, ("stor", ":size", ":off", (":op", ":idx", ...)))) and m.op in ("map", "array"): sizes.add(m.size) if safe_le_op(0, m.off) is True: offsets.add(m.off)
return f'ceil32({pret(num)})' else: return f'floor32({pret(val)})' if exp ~ ('call.data', ('add', 36, ('param', :p_name)), :size) and \ size == ('cd', ('add', 4, ('param', p_name))): return f"{col(p_name+'[', C.green)}"+'all'+col(']', C.green) if exp ~ (:name, :offset, :size) and is_array(name):# in ('call.data', 'ext_call.return_data'): if size == 32: return name+f'[{pret(offset)}]' else: return name+f'[{pret(offset)} len {pret(size)}]' if exp ~ ('mask_shl', :size, :offset, :shl, ('stor', :s_size, :s_off, :s_idx)) and \ safe_le_op(s_size, size) and shl == 0: return pret(('stor', s_size, s_off, s_idx)) if exp ~ ('stor', ...): return pretty_stor(exp, add_color=add_color) if exp ~ ('type', ...): return pretty_stor(exp, add_color=add_color) if exp ~ ('field', ...): return pretty_stor(exp, add_color=add_color) if exp ~ ('cd', :num): if num == 0: return(col('call.func_hash', C.green)) parsed_exp = get_param_name(exp, add_color=add_color)
m.name): # in ('call.data', 'ext_call.return_data'): if m.size == 32: return m.name + f"[{pret(m.offset)}]" else: return m.name + f"[{pret(m.offset)} len {pret(m.size)}]" if ((m := match( exp, ( "mask_shl", ":size", ":offset", ":shl", ("stor", ":s_size", ":s_off", ":s_idx"), ), )) and safe_le_op(m.s_size, m.size) and m.shl == 0): return pret(("stor", m.s_size, m.s_off, m.s_idx)) if opcode(exp) == "stor": return pretty_stor(exp, add_color=add_color) if opcode(exp) == "type": return pretty_stor(exp, add_color=add_color) if opcode(exp) == "field": return pretty_stor(exp, add_color=add_color) if m := match(exp, ("cd", ":num")): if m.num == 0: return col("call.func_hash", C.green) parsed_exp = get_param_name(exp, add_color=add_color)