#define	EXTERN
#include "a.h"
#include "y.tab.h"
#include <ctype.h>

void
main(int argc, char *argv[])
{
	char *p;
	int nout, nproc, status, i, c;

	thechar = '6';
	thestring = "amd64";
	memset(debug, 0, sizeof(debug));
	cinit();
	outfile = 0;
	include[ninclude++] = ".";
	ARGBEGIN {
	default:
		c = ARGC();
		if(c >= 0 || c < sizeof(debug))
			debug[c] = 1;
		break;

	case 'o':
		outfile = ARGF();
		break;

	case 'D':
		p = ARGF();
		if(p)
			Dlist[nDlist++] = p;
		break;

	case 'I':
		p = ARGF();
		setinclude(p);
		break;
	} ARGEND
	if(*argv == 0) {
		print("usage: %ca [-options] file.s\n", thechar);
		errorexit();
	}
	if(argc > 1 && systemtype(Windows)){
		print("can't assemble multiple files on windows\n");
		errorexit();
	}
	if(argc > 1 && !systemtype(Windows)) {
		nproc = 1;
		if(p = getenv("NPROC"))
			nproc = atol(p);	/* */
		c = 0;
		nout = 0;
		for(;;) {
			while(nout < nproc && argc > 0) {
				i = myfork();
				if(i < 0) {
					i = mywait(&status);
					if(i < 0)
						errorexit();
					if(status)
						c++;
					nout--;
					continue;
				}
				if(i == 0) {
					print("%s:\n", *argv);
					if(assemble(*argv))
						errorexit();
					exits(0);
				}
				nout++;
				argc--;
				argv++;
			}
			i = mywait(&status);
			if(i < 0) {
				if(c)
					errorexit();
				exits(0);
			}
			if(status)
				c++;
			nout--;
		}
	}
	if(assemble(argv[0]))
		errorexit();
	exits(0);
}

int
assemble(char *file)
{
	char ofile[100], incfile[20], *p;
	int i, of;

	strcpy(ofile, file);
	p = utfrrune(ofile, pathchar());
	if(p) {
		include[0] = ofile;
		*p++ = 0;
	} else
		p = ofile;
	if(outfile == 0) {
		outfile = p;
		if(outfile){
			p = utfrrune(outfile, '.');
			if(p)
				if(p[1] == 's' && p[2] == 0)
					p[0] = 0;
			p = utfrune(outfile, 0);
			p[0] = '.';
			p[1] = thechar;
			p[2] = 0;
		} else
			outfile = "/dev/null";
	}
	p = getenv("INCLUDE");
	if(p) {
		setinclude(p);
	} else {
		if(systemtype(Plan9)) {
			p = getenv("ccroot");
			if(p == nil)
				p = "";
			snprint(incfile, sizeof(incfile), "%s/%s/include", p, thestring);
			setinclude(strdup(incfile));
		}
	}

	of = mycreat(outfile, 0664);
	if(of < 0) {
		yyerror("%ca: cannot create %s", thechar, outfile);
		errorexit();
	}
	Binit(&obuf, of, OWRITE);

	pass = 1;
	pinit(file);
	for(i=0; i<nDlist; i++)
		dodefine(Dlist[i]);
	yyparse();
	if(nerrors) {
		cclean();
		return nerrors;
	}

	pass = 2;
	outhist();
	pinit(file);
	for(i=0; i<nDlist; i++)
		dodefine(Dlist[i]);
	yyparse();
	cclean();
	return nerrors;
}

struct
{
	char	*name;
	ushort	type;
	ushort	value;
} itab[] =
{
	"SP",		LSP,	D_AUTO,
	"SB",		LSB,	D_EXTERN,
	"FP",		LFP,	D_PARAM,
	"PC",		LPC,	D_BRANCH,

	"AL",		LBREG,	D_AL,
	"CL",		LBREG,	D_CL,
	"DL",		LBREG,	D_DL,
	"BL",		LBREG,	D_BL,
/*	"SPB",		LBREG,	D_SPB,	*/
	"SIB",		LBREG,	D_SIB,
	"DIB",		LBREG,	D_DIB,
	"BPB",		LBREG,	D_BPB,
	"R8B",		LBREG,	D_R8B,
	"R9B",		LBREG,	D_R9B,
	"R10B",		LBREG,	D_R10B,
	"R11B",		LBREG,	D_R11B,
	"R12B",		LBREG,	D_R12B,
	"R13B",		LBREG,	D_R13B,
	"R14B",		LBREG,	D_R14B,
	"R15B",		LBREG,	D_R15B,

	"AH",		LBREG,	D_AH,
	"CH",		LBREG,	D_CH,
	"DH",		LBREG,	D_DH,
	"BH",		LBREG,	D_BH,

	"AX",		LLREG,	D_AX,
	"CX",		LLREG,	D_CX,
	"DX",		LLREG,	D_DX,
	"BX",		LLREG,	D_BX,
/*	"SP",		LLREG,	D_SP,	*/
	"BP",		LLREG,	D_BP,
	"SI",		LLREG,	D_SI,
	"DI",		LLREG,	D_DI,
	"R8",		LLREG,	D_R8,
	"R9",		LLREG,	D_R9,
	"R10",		LLREG,	D_R10,
	"R11",		LLREG,	D_R11,
	"R12",		LLREG,	D_R12,
	"R13",		LLREG,	D_R13,
	"R14",		LLREG,	D_R14,
	"R15",		LLREG,	D_R15,

	"RARG",		LLREG,	REGARG,

/*
	"F0",		LFREG,	D_F0+0,
	"F1",		LFREG,	D_F0+1,
	"F2",		LFREG,	D_F0+2,
	"F3",		LFREG,	D_F0+3,
	"F4",		LFREG,	D_F0+4,
	"F5",		LFREG,	D_F0+5,
	"F6",		LFREG,	D_F0+6,
	"F7",		LFREG,	D_F0+7,
*/

	"M0",		LMREG,	D_M0+0,
	"M1",		LMREG,	D_M0+1,
	"M2",		LMREG,	D_M0+2,
	"M3",		LMREG,	D_M0+3,
	"M4",		LMREG,	D_M0+4,
	"M5",		LMREG,	D_M0+5,
	"M6",		LMREG,	D_M0+6,
	"M7",		LMREG,	D_M0+7,

	"X0",		LXREG,	D_X0+0,
	"X1",		LXREG,	D_X0+1,
	"X2",		LXREG,	D_X0+2,
	"X3",		LXREG,	D_X0+3,
	"X4",		LXREG,	D_X0+4,
	"X5",		LXREG,	D_X0+5,
	"X6",		LXREG,	D_X0+6,
	"X7",		LXREG,	D_X0+7,
	"X8",		LXREG,	D_X0+8,
	"X9",		LXREG,	D_X0+9,
	"X10",		LXREG,	D_X0+10,
	"X11",		LXREG,	D_X0+11,
	"X12",		LXREG,	D_X0+12,
	"X13",		LXREG,	D_X0+13,
	"X14",		LXREG,	D_X0+14,
	"X15",		LXREG,	D_X0+15,

	"Y0",		LYREG,	D_Y0+0,
	"Y1",		LYREG,	D_Y0+1,
	"Y2",		LYREG,	D_Y0+2,
	"Y3",		LYREG,	D_Y0+3,
	"Y4",		LYREG,	D_Y0+4,
	"Y5",		LYREG,	D_Y0+5,
	"Y6",		LYREG,	D_Y0+6,
	"Y7",		LYREG,	D_Y0+7,
	"Y8",		LYREG,	D_Y0+8,
	"Y9",		LYREG,	D_Y0+9,
	"Y10",		LYREG,	D_Y0+10,
	"Y11",		LYREG,	D_Y0+11,
	"Y12",		LYREG,	D_Y0+12,
	"Y13",		LYREG,	D_Y0+13,
	"Y14",		LYREG,	D_Y0+14,
	"Y15",		LYREG,	D_Y0+15,

	"CS",		LSREG,	D_CS,
	"SS",		LSREG,	D_SS,
	"DS",		LSREG,	D_DS,
	"ES",		LSREG,	D_ES,
	"FS",		LSREG,	D_FS,
	"GS",		LSREG,	D_GS,

	"GDTR",		LBREG,	D_GDTR,
	"IDTR",		LBREG,	D_IDTR,
	"LDTR",		LBREG,	D_LDTR,
	"MSW",		LBREG,	D_MSW,
	"TASK",		LBREG,	D_TASK,

	"CR0",		LBREG,	D_CR+0,
	"CR1",		LBREG,	D_CR+1,
	"CR2",		LBREG,	D_CR+2,
	"CR3",		LBREG,	D_CR+3,
	"CR4",		LBREG,	D_CR+4,
	"CR5",		LBREG,	D_CR+5,
	"CR6",		LBREG,	D_CR+6,
	"CR7",		LBREG,	D_CR+7,
	"CR8",		LBREG,	D_CR+8,
	"CR9",		LBREG,	D_CR+9,
	"CR10",		LBREG,	D_CR+10,
	"CR11",		LBREG,	D_CR+11,
	"CR12",		LBREG,	D_CR+12,
	"CR13",		LBREG,	D_CR+13,
	"CR14",		LBREG,	D_CR+14,
	"CR15",		LBREG,	D_CR+15,

	"DR0",		LBREG,	D_DR+0,
	"DR1",		LBREG,	D_DR+1,
	"DR2",		LBREG,	D_DR+2,
	"DR3",		LBREG,	D_DR+3,
	"DR4",		LBREG,	D_DR+4,
	"DR5",		LBREG,	D_DR+5,
	"DR6",		LBREG,	D_DR+6,
	"DR7",		LBREG,	D_DR+7,

	"TR0",		LBREG,	D_TR+0,
	"TR1",		LBREG,	D_TR+1,
	"TR2",		LBREG,	D_TR+2,
	"TR3",		LBREG,	D_TR+3,
	"TR4",		LBREG,	D_TR+4,
	"TR5",		LBREG,	D_TR+5,
	"TR6",		LBREG,	D_TR+6,
	"TR7",		LBREG,	D_TR+7,

	"AAA",		LTYPE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0,	AINB,
	"INL",		LTYPE0,	AINL,
	"INW",		LTYPE0,	AINW,
	"INCB",		LTYPE1,	AINCB,
	"INCL",		LTYPE1,	AINCL,
	"INCQ",		LTYPE1,	AINCQ,
	"INCW",		LTYPE1,	AINCW,
	"INSB",		LTYPE0,	AINSB,
	"INSL",		LTYPE0,	AINSL,
	"INSW",		LTYPE0,	AINSW,
	"INT",		LTYPE2,	AINT,
	"INTO",		LTYPE0,	AINTO,
	"INVD",		LTYPE0,	AINVD,
	"INVLPG",	LTYPE2,	AINVLPG,
	"IRETL",	LTYPE0,	AIRETL,
	"IRETQ",	LTYPE0,	AIRETQ,
	"IRETW",	LTYPE0,	AIRETW,

	"JOS",		LTYPER,	AJOS,
	"JO",		LTYPER,	AJOS,	/* alternate */
	"JOC",		LTYPER,	AJOC,
	"JNO",		LTYPER,	AJOC,	/* alternate */
	"JCS",		LTYPER,	AJCS,
	"JB",		LTYPER,	AJCS,	/* alternate */
	"JC",		LTYPER,	AJCS,	/* alternate */
	"JNAE",		LTYPER,	AJCS,	/* alternate */
	"JLO",		LTYPER,	AJCS,	/* alternate */
	"JCC",		LTYPER,	AJCC,
	"JAE",		LTYPER,	AJCC,	/* alternate */
	"JNB",		LTYPER,	AJCC,	/* alternate */
	"JNC",		LTYPER,	AJCC,	/* alternate */
	"JHS",		LTYPER,	AJCC,	/* alternate */
	"JEQ",		LTYPER,	AJEQ,
	"JE",		LTYPER,	AJEQ,	/* alternate */
	"JZ",		LTYPER,	AJEQ,	/* alternate */
	"JNE",		LTYPER,	AJNE,
	"JNZ",		LTYPER,	AJNE,	/* alternate */
	"JLS",		LTYPER,	AJLS,
	"JBE",		LTYPER,	AJLS,	/* alternate */
	"JNA",		LTYPER,	AJLS,	/* alternate */
	"JHI",		LTYPER,	AJHI,
	"JA",		LTYPER,	AJHI,	/* alternate */
	"JNBE",		LTYPER,	AJHI,	/* alternate */
	"JMI",		LTYPER,	AJMI,
	"JS",		LTYPER,	AJMI,	/* alternate */
	"JPL",		LTYPER,	AJPL,
	"JNS",		LTYPER,	AJPL,	/* alternate */
	"JPS",		LTYPER,	AJPS,
	"JP",		LTYPER,	AJPS,	/* alternate */
	"JPE",		LTYPER,	AJPS,	/* alternate */
	"JPC",		LTYPER,	AJPC,
	"JNP",		LTYPER,	AJPC,	/* alternate */
	"JPO",		LTYPER,	AJPC,	/* alternate */
	"JLT",		LTYPER,	AJLT,
	"JL",		LTYPER,	AJLT,	/* alternate */
	"JNGE",		LTYPER,	AJLT,	/* alternate */
	"JGE",		LTYPER,	AJGE,
	"JNL",		LTYPER,	AJGE,	/* alternate */
	"JLE",		LTYPER,	AJLE,
	"JNG",		LTYPER,	AJLE,	/* alternate */
	"JGT",		LTYPER,	AJGT,
	"JG",		LTYPER,	AJGT,	/* alternate */
	"JNLE",		LTYPER,	AJGT,	/* alternate */

	"JCXZ",		LTYPER,	AJCXZ,
	"JMP",		LTYPEC,	AJMP,
	"LAHF",		LTYPE0,	ALAHF,
	"LARL",		LTYPE3,	ALARL,
	"LARW",		LTYPE3,	ALARW,
	"LEAL",		LTYPE3,	ALEAL,
	"LEAQ",		LTYPE3,	ALEAQ,
	"LEAW",		LTYPE3,	ALEAW,
	"LEAVEL",	LTYPE0,	ALEAVEL,
	"LEAVEQ",	LTYPE0,	ALEAVEQ,
	"LEAVEW",	LTYPE0,	ALEAVEW,
	"LFENCE",	LTYPE0,	ALFENCE,
	"LOCK",		LTYPE0,	ALOCK,
	"LODSB",	LTYPE0,	ALODSB,
	"LODSL",	LTYPE0,	ALODSL,
	"LODSQ",	LTYPE0,	ALODSQ,
	"LODSW",	LTYPE0,	ALODSW,
	"LONG",		LTYPE2,	ALONG,
	"LOOP",		LTYPER,	ALOOP,
	"LOOPEQ",	LTYPER,	ALOOPEQ,
	"LOOPNE",	LTYPER,	ALOOPNE,
	"LSLL",		LTYPE3,	ALSLL,
	"LSLW",		LTYPE3,	ALSLW,
	"MFENCE",	LTYPE0,	AMFENCE,
	"MODE",		LTYPE2,	AMODE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	"ROLL",		LTYPE3,	AROLL,
	"ROLQ",		LTYPE3,	AROLQ,
	"ROLW",		LTYPE3,	AROLW,
	"RORB",		LTYPE3,	ARORB,
	"RORL",		LTYPE3,	ARORL,
	"RORQ",		LTYPE3,	ARORQ,
	"RORW",		LTYPE3,	ARORW,
	"RSM",		LTYPE0,	ARSM,
	"SAHF",		LTYPE0,	ASAHF,
	"SALB",		LTYPE3,	ASALB,
	"SALL",		LTYPE3,	ASALL,
	"SALQ",		LTYPE3,	ASALQ,
	"SALW",		LTYPE3,	ASALW,
	"SARB",		LTYPE3,	ASARB,
	"SARL",		LTYPE3,	ASARL,
	"SARQ",		LTYPE3,	ASARQ,
	"SARW",		LTYPE3,	ASARW,
	"SBBB",		LTYPE3,	ASBBB,
	"SBBL",		LTYPE3,	ASBBL,
	"SBBQ",		LTYPE3,	ASBBQ,
	"SBBW",		LTYPE3,	ASBBW,
	"SCASB",	LTYPE0,	ASCASB,
	"SCASL",	LTYPE0,	ASCASL,
	"SCASQ",	LTYPE0,	ASCASQ,
	"SCASW",	LTYPE0,	ASCASW,
	"SETCC",	LTYPE1,	ASETCC,
	"SETCS",	LTYPE1,	ASETCS,
	"SETEQ",	LTYPE1,	ASETEQ,
	"SETGE",	LTYPE1,	ASETGE,
	"SETGT",	LTYPE1,	ASETGT,
	"SETHI",	LTYPE1,	ASETHI,
	"SETLE",	LTYPE1,	ASETLE,
	"SETLS",	LTYPE1,	ASETLS,
	"SETLT",	LTYPE1,	ASETLT,
	"SETMI",	LTYPE1,	ASETMI,
	"SETNE",	LTYPE1,	ASETNE,
	"SETOC",	LTYPE1,	ASETOC,
	"SETOS",	LTYPE1,	ASETOS,
	"SETPC",	LTYPE1,	ASETPC,
	"SETPL",	LTYPE1,	ASETPL,
	"SETPS",	LTYPE1,	ASETPS,
	"SFENCE",	LTYPE0,	ASFENCE,
	"CDQ",		LTYPE0,	ACDQ,
	"CWD",		LTYPE0,	ACWD,
	"CQO",		LTYPE0,	ACQO,
	"SHLB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YPE3, AFCOMW,
	"FCOMWP",	LTYPE3, AFCOMWP,
	"FUCOM",	LTYPE3, AFUCOM,
	"FUCOMP",	LTYPE3, AFUCOMP,
	"FUCOMPP",	LTYPE3, AFUCOMPP,
	"FADDW",	LTYPE3, AFADDW,
	"FADDL",	LTYPE3, AFADDL,
	"FADDF",	LTYPE3, AFADDF,
	"FADDD",	LTYPE3, AFADDD,
	"FADDDP",	LTYPE3, AFADDDP,
	"FSUBDP",	LTYPE3, AFSUBDP,
	"FSUBW",	LTYPE3, AFSUBW,
	"FSUBL",	LTYPE3, AFSUBL,
	"FSUBF",	LTYPE3, AFSUBF,
	"FSUBD",	LTYPE3, AFSUBD,
	"FSUBRDP",	LTYPE3, AFSUBRDP,
	"FSUBRW",	LTYPE3, AFSUBRW,
	"FSUBRL",	LTYPE3, AFSUBRL,
	"FSUBRF",	LTYPE3, AFSUBRF,
	"FSUBRD",	LTYPE3, AFSUBRD,
	"FMULDP",	LTYPE3, AFMULDP,
	"FMULW",	LTYPE3, AFMULW,
	"FMULL",	LTYPE3, AFMULL,
	"FMULF",	LTYPE3, AFMULF,
	"FMULD",	LTYPE3, AFMULD,
	"FDIVDP",	LTYPE3, AFDIVDP,
	"FDIVW",	LTYPE3, AFDIVW,
	"FDIVL",	LTYPE3, AFDIVL,
	"FDIVF",	LTYPE3, AFDIVF,
	"FDIVD",	LTYPE3, AFDIVD,
	"FDIVRDP",	LTYPE3, AFDIVRDP,
	"FDIVRW",	LTYPE3, AFDIVRW,
	"FDIVRL",	LTYPE3, AFDIVRL,
	"FDIVRF",	LTYPE3, AFDIVRF,
	"FDIVRD",	LTYPE3, AFDIVRD,
	"FXCHD",	LTYPE3, AFXCHD,
	"FFREE",	LTYPE1, AFFREE,
	"FLDCW",	LTYPE2, AFLDCW,
	"FLDENV",	LTYPE1, AFLDENV,
	"FRSTOR",	LTYPE2, AFRSTOR,
	"FSAVE",	LTYPE1, AFSAVE,
	"FSTCW",	LTYPE1, AFSTCW,
	"FSTENV",	LTYPE1, AFSTENV,
	"FSTSW",	LTYPE1, AFSTSW,
	"F2XM1",	LTYPE0, AF2XM1,
	"FABS",		LTYPE0, AFABS,
	"FCHS",		LTYPE0, AFCHS,
	"FCLEX",	LTYPE0, AFCLEX,
	"FCOS",		LTYPE0, AFCOS,
	"FDECSTP",	LTYPE0, AFDECSTP,
	"FINCSTP",	LTYPE0, AFINCSTP,
	"FINIT",	LTYPE0, AFINIT,
	"FLD1",		LTYPE0, AFLD1,
	"FLDL2E",	LTYPE0, AFLDL2E,
	"FLDL2T",	LTYPE0, AFLDL2T,
	"FLDLG2",	LTYPE0, AFLDLG2,
	"FLDLN2",	LTYPE0, AFLDLN2,
	"FLDPI",	LTYPE0, AFLDPI,
	"FLDZ",		LTYPE0, AFLDZ,
	"FNOP",		LTYPE0, AFNOP,
	"FPATAN",	LTYPE0, AFPATAN,
	"FPREM",	LTYPE0, AFPREM,
	"FPREM1",	LTYPE0, AFPREM1,
	"FPTAN",	LTYPE0, AFPTAN,
	"FRNDINT",	LTYPE0, AFRNDINT,
	"FSCALE",	LTYPE0, AFSCALE,
	"FSIN",		LTYPE0, AFSIN,
	"FSINCOS",	LTYPE0, AFSINCOS,
	"FSQRT",	LTYPE0, AFSQRT,
	"FTST",		LTYPE0, AFTST,
	"FXAM",		LTYPE0, AFXAM,
	"FXTRACT",	LTYPE0, AFXTRACT,
	"FYL2X",	LTYPE0, AFYL2X,
	"FYL2XP1",	LTYPE0, AFYL2XP1,

	"ADDPD",	LTYPEY,	AADDPD,
	"ADDPS",	LTYPEY,	AADDPS,
	"ADDSD",	LTYPEY,	AADDSD,
	"ADDSS",	LTYPEY,	AADDSS,
	"ANDNPD",	LTYPEY,	AANDNPD,
	"ANDNPS",	LTYPEY,	AANDNPS,
	"ANDPD",	LTYPEY,	AANDPD,
	"ANDPS",	LTYPEY,	AANDPS,
	"CMPPD",	LTYPEXC,ACMPPD,
	"CMPPS",	LTYPEXC,ACMPPS,
	"CMPSD",	LTYPEXC,AC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LTYPE3,	AMOVNTQ,
	"MOVQOZX",	LTYPE3,	AMOVQOZX,
	"MOVSD",	LTYPE3,	AMOVSD,
	"MOVSS",	LTYPE3,	AMOVSS,
	"MOVUPD",	LTYPE3,	AMOVUPD,
	"MOVUPS",	LTYPE3,	AMOVUPS,
	"MULPD",	LTYPEY,	AMULPD,
	"MULPS",	LTYPEY,	AMULPS,
	"MULSD",	LTYPEY,	AMULSD,
	"MULSS",	LTYPEY,	AMULSS,
	"ORPD",		LTYPEY,	AORPD,
	"ORPS",		LTYPEY,	AORPS,
	"PACKSSLW",	LTYPEY,	APACKSSLW,
	"PACKSSWB",	LTYPEY,	APACKSSWB,
	"PACKUSWB",	LTYPEY,	APACKUSWB,
	"PADDB",	LTYPEY,	APADDB,
	"PADDL",	LTYPEY,	APADDL,
	"PADDQ",	LTYPEY,	APADDQ,
	"PADDSB",	LTYPEY,	APADDSB,
	"PADDSW",	LTYPEY,	APADDSW,
	"PADDUSB",	LTYPEY,	APADDUSB,
	"PADDUSW",	LTYPEY,	APADDUSW,
	"PADDW",	LTYPEY,	APADDW,
	"PAND",		LTYPEY, APAND,
	"PANDB",	LTYPEY,	APANDB,
	"PANDL",	LTYPEY,	APANDL,
	"PANDSB",	LTYPEY,	APANDSB,
	"PANDSW",	LTYPEY,	APANDSW,
	"PANDUSB",	LTYPEY,	APANDUSB,
	"PANDUSW",	LTYPEY,	APANDUSW,
	"PANDW",	LTYPEY,	APANDW,
	"PANDN",	LTYPEY, APANDN,
	"PAVGB",	LTYPEY,	APAVGB,
	"PAVGW",	LTYPEY,	APAVGW,
	"PCMPEQB",	LTYPEY,	APCMPEQB,
	"PCMPEQL",	LTYPEY,	APCMPEQL,
	"PCMPEQW",	LTYPEY,	APCMPEQW,
	"PCMPGTB",	LTYPEY,	APCMPGTB,
	"PCMPGTL",	LTYPEY,	APCMPGTL,	
	"PCMPGTW",	LTYPEY,	APCMPGTW,
	"PEXTRW",	LTYPEX,	APEXTRW,
	"PINSRW",	LTYPE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ST",	LTYPEY,	AAESKEYGENASSIST,
	"BLENDPD",	LTYPEY,	ABLENDPD,
	"BLENDPS",	LTYPEY,	ABLENDPS,
	"BLENDVPD",	LTYPEY,	ABLENDVPD,
	"BLENDVPS",	LTYPEY,	ABLENDVPS,
	"CRC32B",	LTYPE3,	ACRC32B,
	"CRC32L",	LTYPE3,	ACRC32L,
	"CRC32Q",	LTYPE3,	ACRC32Q,
	"CRC32W",	LTYPE3,	ACRC32W,
	"DPPD",	LTYPEY,	ADPPD,
	"DPPS",	LTYPEY,	ADPPS,
	"EXTRACTPS",	LTYPEY,	AEXTRACTPS,
	"INSERTPS",	LTYPEY,	AINSERTPS,
	"MOVNTDQA",	LTYPEY,	AMOVNTDQA,
	"MPSADBW",	LTYPEY,	AMPSADBW,
	"PABSB",	LTYPEY,	APABSB,
	"PABSL",	LTYPEY,	APABSL,
	"PABSD",	LTYPEY,	APABSL,	/* syn */
	"PABSW",	LTYPEY,	APABSW,
	"PACKUSDW",	LTYPEY,	APACKUSDW,
	"PALIGNR",	LTYPEX,	APALIGNR,
	"PBLENDVB",	LTYPEY,	APBLENDVB,
	"PBLENDW",	LTYPEY,	APBLENDW,
	"PCLMULHQHQDQ",	LTYPEY,	APCLMULHQHQDQ,
	"PCLMULHQLQDQ",	LTYPEY,	APCLMULHQLQDQ,
	"PCLMULLQHQDQ",	LTYPEY,	APCLMULLQHQDQ,
	"PCLMULLQLQDQ",	LTYPEY,	APCLMULLQLQDQ,
	"PCLMULQDQ",	LTYPEY,	APCLMULQDQ,
	"PCMPEQQ",	LTYPEY,	APCMPEQQ,
	"PCMPESTRI",	LTYPEY,	APCMPESTRI,
	"PCMPESTRM",	LTYPEY,	APCMPESTRM,
	"PCMPGTQ",	LTYPEY,	APCMPGTQ,
	"PCMPISTRI",	LTYPEY,	APCMPISTRI,
	"PCMPISTRM",	LTYPEY,	APCMPISTRM,
	"PEXTRB",	LTYPEY,	APEXTRB,
	"PEXTRL",	LTYPEY,	APEXTRL,
	"PHAD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PEY,	APTEST,
	"ROUNDPD",	LTYPEY,	AROUNDPD,
	"ROUNDPS",	LTYPEY,	AROUNDPS,
	"ROUNDSD",	LTYPEY,	AROUNDSD,
	"ROUNDSS",	LTYPEY,	AROUNDSS,

	/* vex only */
	"VBROADCASTF128",	LTYPEY,	AVBROADCASTF128,
	"VBROADCASTSL",	LTYPEY,	AVBROADCASTSL,
	"VBROADCASTSS",	LTYPEY,	AVBROADCASTSS,
	"VMASKMOVPD",	LTYPEY,	AVMASKMOVPD,
	"VMASKMOVPS",	LTYPEY,	AVMASKMOVPS,
	"VPERMILPD",	LTYPEY,	AVPERMILPD,
	"VPERMILPS",	LTYPEY,	AVPERMILPS,
	"VTESTPD",	LTYPEY,	AVTESTPD,
	"VTESTPS",	LTYPEY,	AVTESTPS,

	/* V* synonyms */
	"VADDPD",	LTYPEY,	AADDPD,
	"VADDPS",	LTYPEY,	AADDPS,
	"VADDSD",	LTYPEY,	AADDSD,
	"VADDSS",	LTYPEY,	AADDSS,
	"VANDNPD",	LTYPEY,	AANDNPD,
	"VANDNPS",	LTYPEY,	AANDNPS,
	"VANDPD",	LTYPEY,	AANDPD,
	"VANDPS",	LTYPEY,	AANDPS,
	"VCMPPD",	LTYPEXC,ACMPPD,
	"VCMPPS",	LTYPEXC,ACMPPS,
	"VCMPSD",	LTYPEXC,ACMPSD,
	"VCMPSS",	LTYPEXC,ACMPSS,
	"VCOMISD",	LTYPEY,	ACOMISD,
	"VCOMISS",	LTYPEY,	ACOMISS,
	"VCVTPL2PD",	LTYPEY,	ACVTPL2PD,
	"VCVTPL2PS",	LTYPEY,	ACVTPL2PS,
	"VCVTPD2PL",	LTYPEY,	ACVTPD2PL,
	"VCVTPD2PS",	LTYPEY,	ACVTPD2PS,
	"VCVTPS2PL",	LTYPEY,	ACVTPS2PL,
	"VCVTPS2PD",	LTYPEY,	ACVTPS2PD,
	"VCVTSD2SL",	LTYPEY,	ACVTSD2SL,
	"VCVTSD2SQ",	LTYPEY,	ACVTSD2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LTYPEY,	AUNPCKHPS,
	"VUNPCKLPD",	LTYPEY,	AUNPCKLPD,
	"VUNPCKLPS",	LTYPEY,	AUNPCKLPS,
	"VXORPD",	LTYPEY,	AXORPD,
	"VXORPS",	LTYPEY,	AXORPS,
	"VAESDEC",	LTYPEY,	AAESDEC,
	"VAESDECLAST",	LTYPEY,	AAESDECLAST,
	"VAESENC",	LTYPEY,	AAESENC,
	"VAESENCLAST",	LTYPEY,	AAESENCLAST,
	"VAESIMC",	LTYPEY,	AAESIMC,
	"VAESKEYGENASSIST",	LTYPEY,	AAESKEYGENASSIST,
	"VBLENDPD",	LTYPEY,	ABLENDPD,
	"VBLENDPS",	LTYPEY,	ABLENDPS,
	"VBLENDVPD",	LTYPEY,	ABLENDVPD,
	"VBLENDVPS",	LTYPEY,	ABLENDVPS,
	"VDPPD",	LTYPEY,	ADPPD,
	"VDPPS",	LTYPEY,	ADPPS,
	"VEXTRACTPS",	LTYPEY,	AEXTRACTPS,
	"VINSERTPS",	LTYPEY,	AINSERTPS,
	"VMOVNTDQA",	LTYPEY,	AMOVNTDQA,
	"VMPSADBW",	LTYPEY,	AMPSADBW,
	"VPABSB",	LTYPEY,	APABSB,
	"VPABSD",	LTYPEY,	APABSL,	/* syn */
	"VPABSL",	LTYPEY,	APABSL,
	"VPABSW",	LTYPEY,	APABSW,
	"VPACKUSDW",	LTYPEY,	APACKUSDW,
	"VPALIGNR",	LTYPEX,	APALIGNR,
	"VPBLENDVB",	LTYPEY,	APBLENDVB,
	"VPBLENDW",	LTYPEY,	APBLENDW,
	"VPCLMULHQHQDQ",	LTYPEY,	APCLMULHQHQDQ,
	"VPCLMULHQLQDQ",	LTYPEY,	APCLMULHQLQDQ,
	"VPCLMULLQHQDQ",	LTYPEY,	APCLMULLQHQDQ,
	"VPCLMULLQLQDQ",	LTYPEY,	APCLMULLQLQDQ,
	"VPCLMULQDQ",	LTYPEY,	APCLMULQDQ,
	"VPCMPEQQ",	LTYPEY,	APCMPEQQ,
	"VPC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Y,	APMOVZXWL,
	"VPMOVZXWQ",	LTYPEY,	APMOVZXWQ,
	"VPMULHRSW",	LTYPEY,	APMULHRSW,
	"VPMULLL",	LTYPEY,	APMULLL,
	"VPMULLQ",	LTYPEY,	APMULLQ,
	"VPSHUFB",	LTYPEY,	APSHUFB,
	"VPSIGNB",	LTYPEY,	APSIGNB,
	"VPSIGNL",	LTYPEY,	APSIGNL,
	"VPSIGNW",	LTYPEY,	APSIGNW,
	"VPTEST",	LTYPEY,	APTEST,
	"VROUNDPD",	LTYPEY,	AROUNDPD,
	"VROUNDPS",	LTYPEY,	AROUNDPS,
	"VROUNDSD",	LTYPEY,	AROUNDSD,
	"VROUNDSS",	LTYPEY,	AROUNDSS,
	0
};

int
isxyreg(int t)
{
	return t >= D_X0 && t <= D_X15 || t >= D_Y0 && t <= D_Y15;
}

void
cinit(void)
{
	Sym *s;
	int i;

	nullgen.sym = S;
	nullgen.offset = 0;
	if(FPCHIP)
		nullgen.dval = 0;
	for(i=0; i<sizeof(nullgen.sval); i++)
		nullgen.sval[i] = 0;
	nullgen.type = D_NONE;
	nullgen.index = D_NONE;
	nullgen.scale = 0;

	nerrors = 0;
	iostack = I;
	iofree = I;
	peekc = IGN;
	nhunk = 0;
	for(i=0; i<NHASH; i++)
		hash[i] = S;
	for(i=0; itab[i].name; i++) {
		s = slookup(itab[i].name);
		if(s->type != LNAME)
			yyerror("double initialization %s", itab[i].name);
		s->type = itab[i].type;
		s->value = itab[i].value;
	}

	pathname = allocn(pathname, 0, 100);
	if(mygetwd(pathname, 99) == 0) {
		pathname = allocn(pathname, 100, 900);
		if(mygetwd(pathname, 999) == 0)
			strcpy(pathname, "/???");
	}
}

void
checkscale(int scale)
{

	switch(scale) {
	case 1:
	case 2:
	case 4:
	case 8:
		return;
	}
	yyerror("scale must be 1248: %d", scale);
}

void
syminit(Sym *s)
{

	s->type = LNAME;
	s->value = 0;
}

void
cclean(void)
{
	Gen2 g2;

	g2.from = nullgen;
	g2.to = nullgen;
	outcode(AEND, &g2);
	Bflush(&obuf);
}

void
zname(char *n, int t, int s)
{

	Bputc(&obuf, ANAME);		/* as(2) */
	Bputc(&obuf, ANAME>>8);
	Bputc(&obuf, t);		/* type */
	Bputc(&obuf, s);		/* sym */
	while(*n) {
		Bputc(&obuf, *n);
		n++;
	}
	Bputc(&obuf, 0);
}

void
zaddr(Gen *a, int s)
{
	int i, l, t;
	char *n;
	Ieee e;

	t = 0;
	if(a->index != D_NONE || a->scale != 0)
		t |= T_INDEX;
	if(a->offset != 0) {
		t |= T_OFFSET;
		l = a->offset;
		if((vlong)l != a->offset)
			t |= T_64;
	}
	if(s != 0)
		t |= T_SYM;

	switch(a->type) {
	default:
		t |= T_TYPE;
		break;
	case D_FCONST:
		t |= T_FCONST;
		break;
	case D_SCONST:
		t |= T_SCONST;
		break;
	case D_NONE:
		break;
	}
	Bputc(&obuf, t);

	if(t & T_INDEX) {	/* implies index, scale */
		Bputc(&obuf, a->index);
		Bputc(&obuf, a->scale);
	}
	if(t & T_OFFSET) {	/* implies offset */
		l = a->offset;
		Bputc(&obuf, l);
		Bputc(&obuf, l>>8);
		Bputc(&obuf, l>>16);
		Bputc(&obuf, l>>24);
		if(t & T_64) {
			l = a->offset>>32;
			Bputc(&obuf, l);
			Bputc(&obuf, l>>8);
			Bputc(&obuf, l>>16);
			Bputc(&obuf, l>>24);
		}
	}
	if(t & T_SYM)		/* implies sym */
		Bputc(&obuf, s);
	if(t & T_FCONST) {
		ieeedtod(&e, a->dval);
		l = e.l;
		Bputc(&obuf, l);
		Bputc(&obuf, l>>8);
		Bputc(&obuf, l>>16);
		Bputc(&obuf, l>>24);
		l = e.h;
		Bputc(&obuf, l);
		Bputc(&obuf, l>>8);
		Bputc(&obuf, l>>16);
		Bputc(&obuf, l>>24);
		return;
	}
	if(t & T_SCONST) {
		n = a->sval;
		for(i=0; i<NSNAME; i++) {
			Bputc(&obuf, *n);
			n++;
		}
		return;
	}
	if(t & T_TYPE)
		Bputc(&obuf, a->type);
}

void
outcode(int a, Gen2 *g2)
{
	int sf, st, t;
	Sym *s;

	if(pass == 1)
		goto out;

jackpot:
	sf = 0;
	s = g2->from.sym;
	while(s != S) {
		sf = s->sym;
		if(sf < 0 || sf >= NSYM)
			sf = 0;
		t = g2->from.type;
		if(t == D_ADDR)
			t = g2->from.index;
		if(h[sf].type == t)
		if(h[sf].sym == s)
			break;
		zname(s->name, t, sym);
		s->sym = sym;
		h[sym].sym = s;
		h[sym].type = t;
		sf = sym;
		sym++;
		if(sym >= NSYM)
			sym = 1;
		break;
	}
	st = 0;
	s = g2->to.sym;
	while(s != S) {
		st = s->sym;
		if(st < 0 || st >= NSYM)
			st = 0;
		t = g2->to.type;
		if(t == D_ADDR)
			t = g2->to.index;
		if(h[st].type == t)
		if(h[st].sym == s)
			break;
		zname(s->name, t, sym);
		s->sym = sym;
		h[sym].sym = s;
		h[sym].type = t;
		st = sym;
		sym++;
		if(sym >= NSYM)
			sym = 1;
		if(st == sf)
			goto jackpot;
		break;
	}
	Bputc(&obuf, a);
	Bputc(&obuf, a>>8);
	Bputc(&obuf, lineno);
	Bputc(&obuf, lineno>>8);
	Bputc(&obuf, lineno>>16);
	Bputc(&obuf, lineno>>24);
	zaddr(&g2->from, sf);
	zaddr(&g2->to, st);

out:
	if(a != AGLOBL && a != ADATA && a != AMODE)
		pc++;
}

void
outhist(void)
{
	Gen g;
	Hist *h;
	char *p, *q, *op, c;
	int n;

	g = nullgen;
	c = pathchar();
	for(h = hist; h != H; h = h->link) {
		p = h->name;
		op = 0;
		/* on windows skip drive specifier in pathname */
		if(systemtype(Windows) && p && p[1] == ':'){
			p += 2;
			c = *p;
		}
		if(p && p[0] != c && h->offset == 0 && pathname){
			/* on windows skip drive specifier in pathname */
			if(systemtype(Windows) && pathname[1] == ':') {
				op = p;
				p = pathname+2;
				c = *p;
			} else if(pathname[0] == c){
				op = p;
				p = pathname;
			}
		}
		while(p) {
			q = strchr(p, c);
			if(q) {
				n = q-p;
				if(n == 0){
					n = 1;	/* leading "/" */
					*p = '/';	/* don't emit "\" on windows */
				}
				q++;
			} else {
				n = strlen(p);
				q = 0;
			}
			if(n) {
				Bputc(&obuf, ANAME);
				Bputc(&obuf, ANAME>>8);
				Bputc(&obuf, D_FILE);	/* type */
				Bputc(&obuf, 1);	/* sym */
				Bputc(&obuf, '<');
				Bwrite(&obuf, p, n);
				Bputc(&obuf, 0);
			}
			p = q;
			if(p == 0 && op) {
				p = op;
				op = 0;
			}
		}
		g.offset = h->offset;

		Bputc(&obuf, AHISTORY);
		Bputc(&obuf, AHISTORY>>8);
		Bputc(&obuf, h->line);
		Bputc(&obuf, h->line>>8);
		Bputc(&obuf, h->line>>16);
		Bputc(&obuf, h->line>>24);
		zaddr(&nullgen, 0);
		zaddr(&g, 0);
	}
}

#include "../cc/lexbody"
#include "../cc/macbody"
#include "../cc/compat"
