Honor CS_OPT_UNSIGNED on x86 and add cstool -u (#945)

diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index 5ea5835..25ba93e 100644
--- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c
@@ -444,7 +444,7 @@
 		printRegName(O, MCOperand_getReg(Op));
 	} else if (MCOperand_isImm(Op)) {
 		int64_t imm = MCOperand_getImm(Op);
-		printImm(MI->csh->syntax, O, imm, false);
+		printImm(MI->csh->syntax, O, imm, MI->csh->imm_unsigned);
 	}
 }
 
@@ -887,7 +887,7 @@
 		// printf(">>> id = %u\n", MI->flat_insn->id);
 		switch(MI->flat_insn->id) {
 			default:
-				printImm(MI->csh->syntax, O, imm, false);
+				printImm(MI->csh->syntax, O, imm, MI->csh->imm_unsigned);
 				break;
 
 			case X86_INS_MOVABS:
diff --git a/cstool/cstool.c b/cstool/cstool.c
index ef88ccb..ca430c3 100644
--- a/cstool/cstool.c
+++ b/cstool/cstool.c
@@ -72,7 +72,7 @@
 static void usage(char *prog)
 {
 	printf("Cstool for Capstone Disassembler Engine v%u.%u.%u\n\n", CS_VERSION_MAJOR, CS_VERSION_MINOR, CS_VERSION_EXTRA);
-	printf("Syntax: %s [-d] <arch+mode> <assembly-hexstring> [start-address-in-hex-format]\n", prog);
+	printf("Syntax: %s [-u|-d] <arch+mode> <assembly-hexstring> [start-address-in-hex-format]\n", prog);
 	printf("\nThe following <arch+mode> options are supported:\n");
 
 	if (cs_support(CS_ARCH_X86)) {
@@ -144,18 +144,23 @@
 	cs_mode md;
 	cs_arch arch;
 	bool detail_flag = false;
+	bool unsigned_flag = false;
 
 	if (argc != 3 && argc != 4 && argc != 5) {
 		usage(argv[0]);
 		return -1;
 	}
 
-	if (!strcmp(argv[1], "-d")) {
+	if (!strcmp(argv[1], "-d") || !strcmp(argv[1], "-u")) {
 		if (argc == 3) {
 			usage(argv[0]);
 			return -1;
 		}
-		detail_flag = true;
+		if (argv[1][1] == 'd') {
+			detail_flag = true;
+		} else {
+			unsigned_flag = true;
+		}
 		mode = argv[2];
 		assembly = preprocess(argv[3], &size);
 		if (argc == 5) {
@@ -345,6 +350,9 @@
 	if (detail_flag) {
 		cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
 	}
+	if (unsigned_flag) {
+		cs_option(handle, CS_OPT_UNSIGNED, CS_OPT_ON);
+	}
 
 	count = cs_disasm(handle, assembly, size, address, 0, &insn);
 	if (count > 0) {