// SDB-CGEN V2.6.2
#include <ctype.h>
#include <stdio.h>
#include <string.h>

struct kv { const char *name; const char *value; };
static const struct kv kvs[] = {
// gcc -DMAIN=1 vax.c ; ./a.out > vax.h
	{"adc", "add with carry"},
	{"addf2", "add floating (2-operand)"},
	{"addf3", "add floating (3-operand)"},
	{"addl", "add longword"},
	{"addl2", "add longword (2-operand)"},
	{"addl3", "add longword (3-operand)"},
	{"addr", "add address"},
	{"addw2", "add word (2-operand)"},
	{"addw3", "add word (3-operand)"},
	{"and", "bitwise AND"},
	{"andb", "bitwise AND (byte)"},
	{"andl", "bitwise AND (long)"},
	{"ashl", "arithmetic shift left"},
	{"ashr", "arithmetic shift right"},
	{"asl", "arithmetic shift left"},
	{"asr", "arithmetic shift right"},
	{"bacom", "byte align/compress (arch specific)"},
	{"bcc", "branch on carry clear"},
	{"bcs", "branch on carry set"},
	{"beql", "branch if equal (zero)"},
	{"bne", "branch if not equal"},
	{"bneq", "branch if not equal"},
	{"br", "branch always"},
	{"brb", "branch byte displacement"},
	{"brw", "branch word displacement"},
	{"brz", "branch if zero"},
	{"bvc", "branch if overflow clear"},
	{"bvs", "branch if overflow set"},
	{"call", "call (alias)"},
	{"callg", "call general"},
	{"calls", "calls (call with arg count)"},
	{"cbits", "change bits (bit-field ops)"},
	{"ccflg", "conditional clear flag"},
	{"clr", "clear"},
	{"clrb", "clear byte"},
	{"clrl", "clear long"},
	{"cmp", "compare"},
	{"cmpb", "compare byte"},
	{"cmpl", "compare long"},
	{"cmpw", "compare word"},
	{"cvtb", "convert to byte"},
	{"cvtd", "convert to double"},
	{"cvtl", "convert to long"},
	{"cvtw", "convert to word"},
	{"dec", "decrement"},
	{"decl", "decrement long"},
	{"divf", "divide floating"},
	{"divl", "divide long"},
	{"divw", "divide word"},
	{"ent", "enter (stack frame)"},
	{"halt", "halt processor"},
	{"inc", "increment"},
	{"incl", "increment long"},
	{"invalid", "invalid instruction"},
	{"jmp", "jump"},
	{"jsb", "jump to subroutine and branch"},
	{"jsr", "jump to subroutine"},
	{"lea", "load effective address"},
	{"mcoml", "move complemented long? (VAX specific mcoml)"},
	{"mov", "move"},
	{"movab", "move address of symbol to register"},
	{"moval", "move address (alias)"},
	{"movb", "move byte"},
	{"movc3", "move bytes (3-arg)"},
	{"movc5", "move bytes (5-arg)"},
	{"movl", "move longword"},
	{"movq", "move quadword"},
	{"movw", "move word"},
	{"movzbl", "move zero-extended byte to long"},
	{"movzwl", "move zero-extended word to long"},
	{"mul", " multiply"},
	{"mulf", " multiply floating"},
	{"mulh", " multiply high"},
	{"mulw", " multiply word"},
	{"neg", "negate"},
	{"negx", "negate with extend"},
	{"nop", "no operation"},
	{"pop", "pop from stack"},
	{"push", "push to stack"},
	{"pushab", "push address of label"},
	{"pushal", "push address long? (arch specific)"},
	{"pushl", "push longword"},
	{"reb", "readback (arch specific)"},
	{"rem", " remainder"},
	{"ren", "rename/return (context specific)"},
	{"ret", "return from subroutine"},
	{"rol", "rotate left"},
	{"ror", "rotate right"},
	{"rti", "return from interrupt"},
	{"rts", "return from subroutine"},
	{"sbbl", "subtract with borrow long"},
	{"sbw", "subtract word"},
	{"sdiv", " signed divide"},
	{"shl", "shift left"},
	{"shll", "shift left logical"},
	{"shr", "shift right"},
	{"stb", "store byte"},
	{"stl", "store long"},
	{"stor", "store (alias)"},
	{"stq", "store quad"},
	{"stw", "store word"},
	{"sub", " subtract"},
	{"subf", " subtract floating"},
	{"subl2", "subtract long (2-operand)"},
	{"subl3", "subtract long (3-operand)"},
	{"swab", "swap bytes in word"},
	{"swap", "swap registers/words"},
	{"sync", "synchronize"},
	{"syscall", "system call"},
	{"trap", "software trap"},
	{"trapv", "trap on overflow"},
	{"tst", "test"},
	{"tstb", "test byte"},
	{"tstl", "test long"},
	{"tstw", "test word"},
	{"unlk", "unlink frame"},
	{"xor", "bitwise exclusive OR"},
	{"xorb", "xor byte"},
	{"xorl", "xor long"},
  {NULL, NULL}
};
typedef int (*GperfForeachCallback)(void *user, const char *k, const char *v);
int gperf_vax_foreach(GperfForeachCallback cb, void *user) {
  int i = 0; while (kvs[i].name) {
  cb (user, kvs[i].name, kvs[i].value);
  i++;}
  return 0;
}
const char *gperf_vax_get(const char *s) {
  int i = 0; while (kvs[i].name) {
  if (!strcmp (s, kvs[i].name)) return kvs[i].value;
  i++;}
  return NULL;
}
#define sdb_hash_c_vax(x,y) gperf_vax_hash(x)
const unsigned int gperf_vax_hash(const char *s) {
  int sum = strlen (s);
  while (*s) { sum += *s; s++; }
  return sum;
}
struct {const char *name;void *get;void *hash;void *foreach;} gperf_vax = {
  .name = "vax",
  .get = &gperf_vax_get,
  .hash = &gperf_vax_hash,
  .foreach = &gperf_vax_foreach
};

#if MAIN
int main () {
	const char *s = ((char*(*)(char*))gperf_vax.get)("foo");
	printf ("%s\n", s);
}
#endif
