def common_instructions(profile):
 if (has_pairs(profile) and profile):
  inst_list = profile[(-1)]
 else:
  inst_list = profile
 result = [(op, opcode.opname[op], count) for (op, count) in enumerate(inst_list) if (count > 0)]
 result.sort(key=operator.itemgetter(2), reverse=True)
 return result

def common_instructions ( profile ) : if ( has_pairs ( profile ) and profile ) : inst_list = profile [ ( - 1 ) ] else : inst_list = profile result = [ ( op , opcode . opname [ op ] , count ) for ( op , count ) in enumerate ( inst_list ) if ( count > 0 ) ] result . sort ( key = operator . itemgetter ( 2 ) , reverse = True ) return result
returns the most common opcodes in order of descending frequency .