+ if (set_scale) {
+ p = strchr(buf, '[');
+ if (p != NULL)
+ p = strchr(p, '+');
+ if (p != NULL && p[1] == 'e') {
+ p += 4;
+ // scale is 1, must specify it explicitly so that
+ // masm chooses the right scaled reg
+ memmove(p + 2, p, strlen(p) + 1);
+ memcpy(p, "*1", 2);
+ }
+ }
+ else if (jmp_near) {
+ p = strchr(buf, 'j');
+ while (p && *p != ' ')
+ p++;
+ while (p && *p == ' ')
+ p++;
+ if (p != NULL) {
+ memmove(p + 9, p, strlen(p) + 1);
+ memcpy(p, "near ptr ", 9);
+ }
+ }
+ if (word_imm) {
+ p = strstr(buf, ", ");
+ if (p != NULL && '0' <= p[2] && p[2] <= '9') {
+ p += 2;
+ memmove(p + 9, p, strlen(p) + 1);
+ memcpy(p, "word ptr ", 9);
+ }
+ }
+ else if (dword_imm) {
+ p = strstr(buf, ", ");
+ if (p != NULL && '0' <= p[2] && p[2] <= '9') {
+ p += 2;
+ memmove(p + 10, p, strlen(p) + 1);
+ memcpy(p, "dword ptr ", 10);
+ }
+ }
+ else if (do_pushf) {
+ p = strstr(buf, "pushf");
+ if (p == NULL)
+ p = strstr(buf, "popf");
+ if (p != NULL) {
+ p = strchr(p, 'f') + 1;
+ memmove(p + 1, p, strlen(p) + 1);
+ *p = 'd';
+ }
+ }