// SDB-CGEN V1.8.0
// gcc -DMAIN=1 dalvik.c ; ./a.out > dalvik.h
#include <ctype.h>
#include <stdio.h>
#include <string.h>

struct kv { const char *name; const char *value; };
static struct kv kvs[] = {
  {"add-double","adding, result stored in third register"}, 
  {"add-double/2addr","adding"}, 
  {"add-float","adding, result stored in third register"}, 
  {"add-float/2addr","adding"}, 
  {"add-int","adding, result stored in third register"}, 
  {"add-int/2addr","adding"}, 
  {"add-int/lit16","adding"}, 
  {"add-int/lit8","adding"}, 
  {"add-long","adding, result stored in third register"}, 
  {"add-long/2addr","adding"}, 
  {"aget","perform get array at the identified index of array"}, 
  {"aget-boolean","perform get array at the identified index of array"}, 
  {"aget-byte","perform get array at the identified index of array"}, 
  {"aget-char","perform get array at the identified index of array"}, 
  {"aget-object","perform get array at the identified index of array"}, 
  {"aget-short","perform get array at the identified index of array"}, 
  {"aget-wide","perform get array at the identified index of array"}, 
  {"and-int","adding, result stored in third register"}, 
  {"and-int/2addr","adding "}, 
  {"and-int/lit16","adding "}, 
  {"and-int/lit8","adding "}, 
  {"and-long","adding, result stored in third register"}, 
  {"and-long/2addr","adding "}, 
  {"aput","perform put array at the identified index of array"}, 
  {"aput-boolean","perform put array at the identified index of array"}, 
  {"aput-byte","perform put array at the identified index of array"}, 
  {"aput-char","perform put array at the identified index of array"}, 
  {"aput-object","perform put array at the identified index of array"}, 
  {"aput-short","perform put array at the identified index of array"}, 
  {"aput-wide","perform put array at the identified index of array"}, 
  {"array-length","store in the given destination register the length of the indicated array, in entrie"}, 
  {"check-cast","throw a classcastexception if the reference in the given register cannot be cast"}, 
  {"cmp-long","compare long"}, 
  {"cmpg-double","compare long based on g"}, 
  {"cmpg-float","compare float based on g"}, 
  {"cmpl-double","compare long based on l"}, 
  {"cmpl-float","compare float based on l"}, 
  {"const","move the given literal value into the specified register"}, 
  {"const-class","move a reference to the class specified by the given index into the specified register"}, 
  {"const-string","move a reference to the string specified by the given index into the specified register"}, 
  {"const-string/jumbo","move a reference to the string specified by the given index into the specified register"}, 
  {"const-wide","move literal into the specified register-pair"}, 
  {"const-wide/16","move literal into the specified register-pair"}, 
  {"const-wide/32","move literal into the specified register-pair"}, 
  {"const-wide/high16","move literal into the specified register-pair"}, 
  {"const/16","move literal into the specified register"}, 
  {"const/4","move literal into the specified register"}, 
  {"const/high16","move literal into the specified register"}, 
  {"div-double","division, result stored in third register"}, 
  {"div-double/2addr","division "}, 
  {"div-float","division, result stored in third register"}, 
  {"div-float/2addr","division "}, 
  {"div-int","division, result stored in third register"}, 
  {"div-int/2addr","division "}, 
  {"div-int/lit16","division "}, 
  {"div-int/lit8","division "}, 
  {"div-long","division, result stored in third register"}, 
  {"div-long/2addr","division "}, 
  {"double-to-float","cast types"}, 
  {"double-to-int","cast types"}, 
  {"double-to-long","cast types"}, 
  {"fill-array-data","fill the given array with the indicated data"}, 
  {"filled-new-array","construct an array of the given type and size, filling it with the supplied contents"}, 
  {"filled-new-array/range","construct an array of the given type and size, filling it with the supplied contents"}, 
  {"float-to-double","cast types"}, 
  {"float-to-int","cast types"}, 
  {"float-to-long","cast types"}, 
  {"goto","unconditionally jump"}, 
  {"goto/16","unconditionally jump"}, 
  {"goto/32","unconditionally jump"}, 
  {"if-eq","branch to the given destination if equal"}, 
  {"if-eqz","Branch to the given destination if equal with 0"}, 
  {"if-ge","branch to the given destination if greater or equal"}, 
  {"if-gez","Branch to the given destination if greater or equal with 0"}, 
  {"if-gt","branch to the given destination if greater"}, 
  {"if-gtz","Branch to the given destination if greater with 0"}, 
  {"if-le","branch to the given destination if lesser or equal"}, 
  {"if-lez","Branch to the given destination if lesser or equal with 0"}, 
  {"if-lt","branch to the given destination if lesser"}, 
  {"if-ltz","Branch to the given destination if lesser with 0"}, 
  {"if-ne","branch to the given destination if not equal"}, 
  {"if-nez","Branch to the given destination if not equal with 0"}, 
  {"iget","perform get object instance with the identified field"}, 
  {"iget-boolean","perform get object instance with the identified field"}, 
  {"iget-byte","perform get object instance with the identified field"}, 
  {"iget-char","perform get object instance with the identified field"}, 
  {"iget-object","perform get object instance with the identified field"}, 
  {"iget-short","perform get object instance with the identified field"}, 
  {"iget-wide","perform get object instance with the identified field"}, 
  {"instance-of","store in the given destination register if the indicated reference is an instance of the given type or 0 if not"}, 
  {"int-to-byte","cast types"}, 
  {"int-to-char","cast types"}, 
  {"int-to-double","cast types"}, 
  {"int-to-float","cast types"}, 
  {"int-to-long","cast types"}, 
  {"int-to-short","cast types"}, 
  {"invoke-direct","call method"}, 
  {"invoke-direct/range","call method"}, 
  {"invoke-interface","call method"}, 
  {"invoke-interface/range","call method"}, 
  {"invoke-static","call method"}, 
  {"invoke-static/range","call method"}, 
  {"invoke-super","call method"}, 
  {"invoke-super/range","call method"}, 
  {"invoke-virtual","call method"}, 
  {"invoke-virtual/range","call method"}, 
  {"iput","perform put object instance with the identified field"}, 
  {"iput-boolean","perform put object instance with the identified field"}, 
  {"iput-byte","perform put object instance with the identified field"}, 
  {"iput-char","perform put object instance with the identified field"}, 
  {"iput-object","perform put object instance with the identified field"}, 
  {"iput-short","perform put object instance with the identified field"}, 
  {"iput-wide","perform put object instance with the identified field"}, 
  {"long-to-double","cast types"}, 
  {"long-to-float","cast types"}, 
  {"long-to-int","cast types"}, 
  {"monitor-enter","acquire the monitor for the indicated object"}, 
  {"monitor-exit","release the monitor for the indicated object"}, 
  {"move","move the contents of one non-object register to another"}, 
  {"move-exception","save a just-caught exception into the given register"}, 
  {"move-object","move the contents of one object-bearing register to anothe"}, 
  {"move-object/16","move the contents of one object-bearing register to anothe"}, 
  {"move-object/from16","move the contents of one object-bearing register to anothe"}, 
  {"move-result","move the single-word non-object result of the most recent invoke-kind into the indicated registe"}, 
  {"move-result-object","move the object result of the most recent invoke-kind into the indicated registe"}, 
  {"move-result-wide","move the double-word result of the most recent invoke-kind into the indicated register pai"}, 
  {"move-wide","move the contents of one register-pair to another"}, 
  {"move-wide/16","move the contents of one register-pair to another"}, 
  {"move-wide/from16","move the contents of one register-pair to another"}, 
  {"move/16","move the contents of one non-object register to another"}, 
  {"move/from16","move the contents of one non-object register to another"}, 
  {"mul-double","multiplication, result stored in third register"}, 
  {"mul-double/2addr","multiplication"}, 
  {"mul-float","multiplication, result stored in third register"}, 
  {"mul-float/2addr","multiplication"}, 
  {"mul-int","multiplication, result stored in third register"}, 
  {"mul-int/2addr","multiplication"}, 
  {"mul-int/lit16","multiplication"}, 
  {"mul-int/lit8","multiplication"}, 
  {"mul-long","multiplication, result stored in third register"}, 
  {"mul-long/2addr","multiplication"}, 
  {"neg-double","perform not operation"}, 
  {"neg-float","perform invertion"}, 
  {"neg-int","perform invertion"}, 
  {"neg-long","perform invertion"}, 
  {"new-array","construct a new array of the indicated type and size"}, 
  {"new-instance","construct a new instance of the indicated type, storing reference to it in the destination"}, 
  {"nop","no operation"}, 
  {"not-int","perform not operation"}, 
  {"not-long","perform not operation"}, 
  {"or-int","logical OR, result stored in third register"}, 
  {"or-int/2addr","logical OR"}, 
  {"or-int/lit16","logical OR"}, 
  {"or-int/lit8","logical OR"}, 
  {"or-long","logical OR, result stored in third register"}, 
  {"or-long/2addr","logical OR"}, 
  {"packed-switch","jump to a new instruction based on register or fall"}, 
  {"rem-double","remainder, result stored in third register"}, 
  {"rem-double/2addr","remainder"}, 
  {"rem-float","remainder, result stored in third register"}, 
  {"rem-float/2addr","remainder"}, 
  {"rem-int","remainder, result stored in third register"}, 
  {"rem-int/2addr","remainder"}, 
  {"rem-int/lit16","remainder"}, 
  {"rem-int/lit8","remainder"}, 
  {"rem-long","remainder, result stored in third register"}, 
  {"rem-long/2addr","remainder"}, 
  {"return","return from a single-width  non-object value-returning method"}, 
  {"return-object","return from an object-returning method"}, 
  {"return-void","return from a void method"}, 
  {"return-wide","return from a double-width  value-returning method"}, 
  {"rsub-int","reverse subtraction"}, 
  {"rsub-int/lit8","reverse subtraction"}, 
  {"sget","perform get object static field operation with the static field"}, 
  {"sget-boolean","perform get object static field operation with the static field"}, 
  {"sget-byte","perform get object static field operation with the static field"}, 
  {"sget-char","perform get object static field operation with the static field"}, 
  {"sget-object","perform get object static field operation with the static field"}, 
  {"sget-short","perform get object static field operation with the static field"}, 
  {"sget-wide","perform get object static field operation with the static field"}, 
  {"shl-int","bitwise signed shift right, result stored in third register"}, 
  {"shl-int/2addr","bitwise signed shift right"}, 
  {"shl-int/lit8","bitwise signed shift right"}, 
  {"shl-long","bitwise signed shift right, result stored in third register"}, 
  {"shl-long/2addr","bitwise signed shift right"}, 
  {"shr-int","bitwise signed shift right, result stored in third register"}, 
  {"shr-int/2addr","bitwise signed shift right"}, 
  {"shr-int/lit8","bitwise signed shift right"}, 
  {"shr-long","bitwise signed shift right, result stored in third register"}, 
  {"shr-long/2addr","bitwise signed shift right"}, 
  {"sparse-switch","jump to a new instruction based on register or fall"}, 
  {"sput","perform put object static field operation with the static field"}, 
  {"sput-boolean","perform put object static field operation with the static field"}, 
  {"sput-byte","perform put object static field operation with the static field"}, 
  {"sput-char","perform put object static field operation with the static field"}, 
  {"sput-object","perform put object static field operation with the static field"}, 
  {"sput-short","perform put object static field operation with the static field"}, 
  {"sput-wide","perform put object static field operation with the static field"}, 
  {"sub-double","subtraction, result stored in third register"}, 
  {"sub-double/2addr","subtraction"}, 
  {"sub-float","subtraction, result stored in third register"}, 
  {"sub-float/2addr","subtraction"}, 
  {"sub-int","subtraction, result stored in third register"}, 
  {"sub-int/2addr","subtraction"}, 
  {"sub-long","subtraction, result stored in third register"}, 
  {"sub-long/2addr","subtraction"}, 
  {"throw","throw the indicated exception"}, 
  {"ushr-int","bitwise unsigned shift right, result stored in third register"}, 
  {"ushr-int/2addr","bitwise unsigned shift right"}, 
  {"ushr-int/lit8","bitwise unsigned shift right"}, 
  {"ushr-long","bitwise unsigned shift right, result stored in third register"}, 
  {"ushr-long/2addr","bitwise unsigned shift right"}, 
  {"xor-int","logical XOR, result stored in third register"}, 
  {"xor-int/2addr","logical XOR"}, 
  {"xor-int/lit16","logical XOR"}, 
  {"xor-int/lit8","logical XOR"}, 
  {"xor-long","logical XOR, result stored in third register"}, 
  {"xor-long/2addr","logical XOR"}, 
  {NULL, NULL}
};
// 0x4420c8
// TODO
typedef int (*GperfForeachCallback)(void *user, const char *k, const char *v);
int gperf_dalvik_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_dalvik_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_dalvik(x,y) gperf_dalvik_hash(x)
const unsigned int gperf_dalvik_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_dalvik = {
  .name = "dalvik",
  .get = &gperf_dalvik_get,
  .hash = &gperf_dalvik_hash,
  .foreach = &gperf_dalvik_foreach
};

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