refactor functions of asmcmp