mips: properly map alias instruction back to public id. this fixes the crash reported by Pancake
diff --git a/arch/Mips/MipsInstPrinter.c b/arch/Mips/MipsInstPrinter.c
index f9e9fae..dac3387 100644
--- a/arch/Mips/MipsInstPrinter.c
+++ b/arch/Mips/MipsInstPrinter.c
@@ -153,8 +153,8 @@
 		default: break;
 		case Mips_RDHWR:
 		case Mips_RDHWR64:
-			SStream_concat(O, "\t.set\tpush\n");
-			SStream_concat(O, "\t.set\tmips32r2\n");
+			SStream_concat(O, ".set\tpush\n");
+			SStream_concat(O, ".set\tmips32r2\n");
 			break;
 	}
 
@@ -168,7 +168,6 @@
 		if (tab)
 			*tab = '\0';
 
-		// printf(">>> mnem = '%s': %u\n", mnem, Mips_map_insn(mnem));
 		// reflect the new insn name (alias) in the opcode
 		MCInst_setOpcode(MI, Mips_get_insn_id2(Mips_map_insn(mnem)));
 		free(mnem);
@@ -178,7 +177,7 @@
 		default: break;
 		case Mips_RDHWR:
 		case Mips_RDHWR64:
-			SStream_concat(O, "\n\t.set\tpop");
+			SStream_concat(O, "\n.set\tpop");
 			break;
 	}
 }
@@ -270,7 +269,7 @@
 
 static bool printAlias1(char *Str, MCInst *MI, unsigned OpNo, SStream *OS)
 {
-	SStream_concat(OS, "\t%s\t", Str);
+	SStream_concat(OS, "%s\t", Str);
 	printOperand(MI, OpNo, OS);
 	return true;
 }
diff --git a/arch/Mips/mapping.c b/arch/Mips/mapping.c
index 7117c24..120b3e6 100644
--- a/arch/Mips/mapping.c
+++ b/arch/Mips/mapping.c
@@ -1899,8 +1899,13 @@
 };
 
 // special alias insn
-static name_map insn_name_maps2[] = {
+static name_map alias_insn_names[] = {
 	{ MIPS_INS_NOP, "NOP" },
+	{ MIPS_INS_BEQ, "BEQZ" },
+	{ MIPS_INS_BNE, "BNEZ" },
+	{ MIPS_INS_BGEZAL, "BAL" },
+	{ MIPS_INS_BC1T, "BC1T" },
+	{ MIPS_INS_BC1F, "BC1F" },
 };
 
 char *Mips_insn_name(unsigned int id)
@@ -1910,9 +1915,9 @@
 
 	// handle special alias first
 	int i;
-	for (i = 0; i < ARR_SIZE(insn_name_maps2); i++) {
-		if (insn_name_maps2[i].id == id)
-			return insn_name_maps2[i].name;
+	for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
+		if (alias_insn_names[i].id == id)
+			return alias_insn_names[i].name;
 	}
 
 	return insn_name_maps[id].name;
@@ -1923,9 +1928,9 @@
 	// handle special alias first
 	int i;
 
-	for (i = 0; i < ARR_SIZE(insn_name_maps2); i++) {
-		if (!strcasecmp(insn_name_maps2[i].name, name))
-			return insn_name_maps2[i].id;
+	for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
+		if (!strcasecmp(alias_insn_names[i].name, name))
+			return alias_insn_names[i].id;
 	}
 
 	// NOTE: skip first NULL name in insn_name_maps
diff --git a/tests/test_mips.c b/tests/test_mips.c
index b173f99..92ff8f1 100644
--- a/tests/test_mips.c
+++ b/tests/test_mips.c
@@ -73,6 +73,7 @@
 //#define MIPS_CODE "\xc6\x23\xe9\xe4"	// swc1	$f9, 0x23c6($7)
 //#define MIPS_CODE "\x21\x38\x00\x01"	// move $7, $8
 #define MIPS_CODE "\x0C\x10\x00\x97\x00\x00\x00\x00\x24\x02\x00\x0c\x8f\xa2\x00\x00\x34\x21\x34\x56"
+//#define MIPS_CODE "\x04\x11\x00\x01"	// bal	0x8
 #define MIPS_CODE2 "\x56\x34\x21\x34\xc2\x17\x01\x00"
 
 	struct platform platforms[] = {