	.file	"618285.c"
	.intel_syntax noprefix
	.text
	.globl	TEXT_std_java
	.section	.rodata
	.align 8
.LC0:
	.ascii	"public static <T> void w_arrRemove(ArrayList<T> a, int i, in"
	.ascii	"t n){a.subList(i,i+n).clear();}\npublic static <T> ArrayList"
	.ascii	"<T> w_arrSlice(ArrayList<T> a, int i, int n){return new Arra"
	.ascii	"yList<T>(a.subList(i,i+n));}\npublic static String w_strSlic"
	.ascii	"e(String a, int i, int n){return a.substring(i,i+n);}\npubli"
	.ascii	"c static <K,V> V w_mapGet(HashMap<K,V> map, K ke"
	.string	"y, V defaultValue) {V v;return (((v = map.get(key)) != null) || map.containsKey(key))? v: defaultValue;}\npublic static boolean w_BOOL(int x){return x!=0;}\npublic static int w_INT(boolean x){return x?1:0;}\npublic static int w_NOT(int x){return (x==0)?1:0;}\n"
	.section	.data.rel.local,"aw"
	.align 8
	.type	TEXT_std_java, @object
	.size	TEXT_std_java, 8
TEXT_std_java:
	.quad	.LC0
	.globl	TEXT_std_c
	.section	.rodata
	.align 8
.LC1:
	.ascii	"#ifndef WAX_STD\n#define WAX_STD\n#include <stdlib.h>\n#incl"
	.ascii	"ude <stdio.h>\n#include <string.h>\n#include <stdarg.h>\n#in"
	.ascii	"clude <stdint.h>\n#include <math.h>\n#define W_MIN(a,b) (((a"
	.ascii	")<(b))?(a):(b))\n#define W_MAX(a,b) (((a)>(b))?(a):(b))\nvoi"
	.ascii	"d *w_malloc(size_t size){void *mem = malloc(size);if(!mem){e"
	.ascii	"xit(-1);}return mem;}\nvoid *w_realloc(void* curr_mem, size_"
	.ascii	"t size){void *mem = realloc(curr_mem, size);if(!mem){exit(-1"
	.ascii	");}return mem;}\nvoid w_free(void* x){if (x){free(x);}}\ntyp"
	.ascii	"edef struct w_arr_st {void* data;size_t len;size_t cap;size_"
	.ascii	"t elem_size;} w_arr_t;\nw_arr_t* w_arr_new_impl(int elem_siz"
	.ascii	"e){w_arr_t* arr = (w_arr_t*)w_malloc(sizeof(w_arr_t));arr->e"
	.ascii	"lem_size = elem_size;arr->len = 0;arr->cap = 16;arr->data = "
	.ascii	"w_malloc((arr->cap)*elem_size);return arr;}\nw_arr_t* w_arr_"
	.ascii	"new_ints(int count,...){va_list vals;w_arr_t* arr = (w_arr_t"
	.ascii	"*)w_malloc(sizeof(w_arr_t));arr->elem_size = sizeof(int);arr"
	.ascii	"->len = count;arr->cap = count;arr->data = w_malloc((arr->ca"
	.ascii	"p)*arr->elem_size);va_start(vals, count);for (int i = 0; i <"
	.ascii	" count; i++) {((int*)arr->data)[i]=va_arg(vals, int);}va_end"
	.ascii	"(vals);return arr;}\nw_arr_t* w_arr_new_flts(int count,...){"
	.ascii	"va_list vals;w_arr_t* arr = (w_arr_t*)w_malloc(sizeof(w_arr_"
	.ascii	"t));arr->elem_size = sizeof(float);arr->len = count;arr->cap"
	.ascii	" = count;arr->data = w_malloc((arr->cap)*arr->elem_size);va_"
	.ascii	"start(vals, count);for (int i = 0; i < count; i++) {((float*"
	.ascii	")arr->data)[i]=(float)va_arg(vals, double);}va_end(vals);ret"
	.ascii	"urn arr;}\nw_arr_t* w_arr_new_strs(int count,...){va_list va"
	.ascii	"ls;w_arr_t* arr = (w_arr_t*)w_malloc(sizeof(w_arr_t));arr->e"
	.ascii	"lem_size = sizeof(char*);arr->len = count;arr->cap = count;a"
	.ascii	"rr->data = w_malloc((arr->cap)*arr->elem_size);va_start(vals"
	.ascii	", count);for (int i = 0; i < count; i++) {((char**)arr->data"
	.ascii	")[i]=(char*)va_arg(vals, char*);}va_end(vals);return arr;}\n"
	.ascii	"int* w_vec_new_ints(int count,...){va_list vals;int* vec = ("
	.ascii	"int*)w_malloc(sizeof(int)*count);va_start(vals, count);for ("
	.ascii	"int i = 0; i < count; i++) {vec[i]=va_arg(vals, int);}va_end"
	.ascii	"(vals);return vec;}\nfloat* w_vec_new_f"
	.ascii	"lts(int count,...){va_list vals;float* vec = (float*)w_mallo"
	.ascii	"c(sizeof(float)*count);va_start(vals, count);for (int i = 0;"
	.ascii	" i < count; i++) {vec[i]=(float)va_arg(vals, double);}va_end"
	.ascii	"(vals);return vec;}\nchar** w_vec_new_strs(int count,...){va"
	.ascii	"_list vals;char** vec = (char**)w_malloc(sizeof(char*)*count"
	.ascii	");va_start(vals, count);for (int i = 0; i < count; i++) {vec"
	.ascii	"[i]=va_arg(vals, char*);}va_end(vals);return vec;}\n#define "
	.ascii	"w_arr_new(type)         (w_arr_new_impl(sizeof(type)))\n#def"
	.ascii	"ine w_arr_get(type,arr,i  ) (((type *)((arr)->data))[(i)])\n"
	.ascii	"#define w_arr_set(type,arr,i,x) (((type *)((arr)->data))[(i)"
	.ascii	"]=(x))\nvoid w_arr_insert_impl(w_arr_t* arr,int i) {if ((arr"
	.ascii	")->len >= (arr)->cap){(arr)->cap = (arr)->cap+W_MAX(4,(arr)-"
	.ascii	">cap/2);(arr)->data = w_realloc((arr)->data, (arr)->elem_siz"
	.ascii	"e*((arr)->cap));}if ((i) < (arr)->len){memmove((char*)((arr)"
	.ascii	"->data)+((i)+1)*(arr)->elem_size,(char*)((arr)->data)+(i)*(a"
	.ascii	"rr)->elem_size,((arr)->len-(i))*(arr)->elem_size );}(arr)->l"
	.ascii	"en++;}\n#define w_arr_insert(type,arr,i,x) { type tmp__x_ = "
	.ascii	"x; int tmp__i_ = i; w_arr_t* tmp__a_ = arr; w_arr_insert_imp"
	.ascii	"l((tmp__a_),(tmp__i_)); (((type *)((tmp__a_)->data))[(tmp__i"
	.ascii	"_)]=(tmp__x_)); }\nvoid w_arr_remove(w_arr_t* arr,int i,int "
	.ascii	"n) {memmove((char*)((arr)->data)+(i)*(arr)->elem_size,(char*"
	.ascii	")((arr)->data)+((i)+(n))*(arr)->elem_size,((arr->len)-(i)-(n"
	.ascii	"))*(arr)->elem_size );(arr)->len-=(n);}\nw_arr_t* w_arr_slic"
	.ascii	"e(w_arr_t*arr,int i,int n) {w_arr_t* brr = (w_arr_t*)w_mallo"
	.ascii	"c(sizeof(w_arr_t));brr->elem_size = (arr)->elem_size;brr->le"
	.ascii	"n = n;brr->cap = n;brr->data = w_malloc((brr->cap)*(brr->ele"
	.ascii	"m_size));memcpy((char*)(brr->data), (char*)((arr)->data) + ("
	.ascii	"i), (n)*((arr)->elem_size));return brr;}\n#define W_NUM_MAP_"
	.ascii	"SLOTS 64\ntypedef struct w_slot_st {int keylen;void* key;int"
	.ascii	"64_t data;struct w_slot_st* next;} w_slot_t;\ntypedef struct"
	.ascii	" w_map_st {int key_is_ptr;size_t len;w_slot_t* slots[W_NUM_M"
	.ascii	"AP_SLOTS];} w_map_t;\nw_map_t* w_map_new(char key_is_ptr){w_"
	.ascii	"map_t* map = (w_map_t*)w_malloc(sizeof(w_map_t));map->key_is"
	.ascii	"_ptr = key_is_ptr;for (int i = 0"
	.ascii	"; i < W_NUM_MAP_SLOTS; i++){map->slots[i] = NULL;}map->len ="
	.ascii	" 0;return map;}\nint w_map_hash(void* ptr, size_t len){int x"
	.ascii	" = 0;for (size_t i = 0; i < len; i++){unsigned char y = *((u"
	.ascii	"nsigned char*)((unsigned char*)ptr+i));x ^= y;}x %= W_NUM_MA"
	.ascii	"P_SLOTS;return x;}\nvoid w_map_set(w_map_t* map, int64_t key"
	.ascii	", int64_t data){int keylen;void* keyptr;if (map->key_is_ptr)"
	.ascii	"{keylen = strlen((char*)key);keyptr = (char*)key;}else{keyle"
	.ascii	"n = sizeof(key);keyptr = &key;}int k = w_map_hash(keyptr,key"
	.ascii	"len);w_slot_t* it = map->slots[k];while (it){if (keylen == i"
	.ascii	"t->keylen){if (memcmp(it->key,keyptr,keylen)==0){it->data = "
	.ascii	"data;return;}}it = it -> next;}w_slot_t* nxt = map->slots[k]"
	.ascii	";w_slot_t* slot = (w_slot_t*)w_malloc(sizeof(w_slot_t));slot"
	.ascii	"->key = w_malloc(keylen);memcpy(slot->key,keyptr,keylen);slo"
	.ascii	"t->data=data;slot->next = nxt;slot->keylen = keylen;map->slo"
	.ascii	"ts[k] = slot;map->len++;}\nint64_t w_map_get(w_map_t* map, i"
	.ascii	"nt64_t key){int keylen;void* keyptr;if (map->key_is_ptr){key"
	.ascii	"len = strlen((char*)key);keyptr = (char*)key;}else{keylen = "
	.ascii	"sizeof(key);keyptr = &key;}int k = w_map_hash(keyptr,keylen)"
	.ascii	";w_slot_t* it = map->slots[k];while (it){if (keylen == it->k"
	.ascii	"eylen){if (memcmp(it->key,keyptr,keylen)==0){return it->data"
	.ascii	";}}it = it -> next;}return 0;}\nvoid w_map_remove(w_map_t* m"
	.ascii	"ap, int64_t key){size_t keylen;void* keyptr;if (map->key_is_"
	.ascii	"ptr){keylen = strlen((char*)key);keyptr = (char*)key;}else{k"
	.ascii	"eylen = sizeof(key);keyptr = &key;}int k = w_map_hash(keyptr"
	.ascii	",keylen);w_slot_t* it = map->slots[k];w_slot_t* prev = NULL;"
	.ascii	"while (it){if (keylen == it->keylen){if (memcmp(it->key,keyp"
	.ascii	"tr,keylen)==0){if (prev){prev->next = it->next;}else{map->sl"
	.ascii	"ots[k] = it->next;}map->len--;w_free(it->key);w_free(it);ret"
	.ascii	"urn;}}prev = it;it = it -> next;}return;}\nint w_reinterp_f2"
	.ascii	"i(float x){return *((int *)&x);}\nfloat w_reinterp_i2f(int x"
	.ascii	"){return *((float *)&x);}\ntypedef struct {char data[32];} w"
	.ascii	"_shortstr_t;\nw_shortstr_t w_int2str(int x){w_shortstr_t str"
	.ascii	";sprintf(str.data, \"%d\", x);return str;}\nw_shortstr_t w_f"
	.ascii	"lt2str(float x){w_shortstr_t st"
	.ascii	"r;sprintf(str.data, \"%g\", x);return str;}\nchar* w_str_new"
	.ascii	"(char* x){size_t l = strlen(x);char* str = (char*)w_malloc(l"
	.ascii	");strncpy(str,x,l);str[l] = 0;return str;}\nchar* w_str_cat("
	.ascii	"char* x, char* y){size_t l0 = strlen(x);size_t l1 = strlen(y"
	.ascii	");x = (char*)w_realloc(x,l0+l1+1);memcpy(x+l0,y,l1);x[l0+l1]"
	.ascii	" = 0;return x;}\nchar* w_str_add(char* x, int y){char c = (c"
	.ascii	"har)y;size_t l = strlen(x);x = (char*)w_realloc(x,l+2);x[l] "
	.ascii	"= c;x[l+1]=0;return x;}\nchar* w_str_cpy(char* x, int i, int"
	.ascii	" l){char* y = (char*)w_malloc(l+1);memcpy(y,x+i,l);y[l] = 0;"
	.ascii	"return y;}\nvoid w_free_arr(w_arr_"
	.string	"t* x){if (x){w_free(x->data);w_free(x);}}\nvoid w_free_map(w_map_t* map){if (!map){return;}for (int i = 0; i < W_NUM_MAP_SLOTS; i++){w_slot_t* it = map->slots[i];while (it){w_slot_t* nxt = it->next;w_free(it->key);w_free(it);it = nxt;}}w_free(map);}\n#endif\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_c, @object
	.size	TEXT_std_c, 8
TEXT_std_c:
	.quad	.LC1
	.globl	TEXT_std_py
	.section	.rodata
	.align 8
.LC2:
	.string	"def w_arr_remove(a,i,n):del a[i:i+n]\ndef w_slice(a,i,n):return a[i:i+n]\ndef w_map_get(m,k,d):\n    try:return m[k]\n    except:return d\ndef w_map_remove(m,k):\n    try:del m[k]\n    except:pass\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_py, @object
	.size	TEXT_std_py, 8
TEXT_std_py:
	.quad	.LC2
	.globl	TEXT_std_swift
	.section	.rodata
	.align 8
.LC3:
	.ascii	"class w_Arr<T>{\n  var data : Array<T> = [];\n  init(data:[T"
	.ascii	"]){self.data = data;}\n  init(zero:T,n:Int){self.data = Arra"
	.ascii	"y<T>(repeating:zero,count:n);}\n  func remove(i:Int,n:Int){s"
	.ascii	"elf.data.removeSubrange(i..<(i+n));}\n  func slice(i:Int,n:I"
	.ascii	"nt)->w_Arr<T>{\n    return w_Arr<T>(data:Array(self.data[i.."
	.ascii	"<(i+n)]));\n  }\n}\nclass w_Map<K:Hashable,V>{\n  var data :"
	.ascii	" Dictionary<K,V> = [:];\n}\nstatic func w_charCode(x:String)"
	.ascii	" -> Int{\n  return (Int)(x.unicodeScalars[x.unicodeScalars.s"
	.ascii	"tartIndex].value);\n}\nstatic func w_strSlice(x:String,i:Int"
	.ascii	",n:Int)-"
	.string	">String{\n  return String(Array(x)[i..<(i+n)]);\n}\nstatic func w_INT(x:Bool)->Int{return x ? 1 : 0;}\nstatic func w_BOOL(x:Int)->Bool{return x != 0;}\nstatic func w_NOT(x:Int)->Int{return (x == 0) ? 1 : 0;}\nstatic func w_strBang(x:String?)->String{return x!;}\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_swift, @object
	.size	TEXT_std_swift, 8
TEXT_std_swift:
	.quad	.LC3
	.globl	TEXT_std_cs
	.section	.rodata
	.align 8
.LC4:
	.ascii	"public static V w_mapGet<K,V>(Di"
	.string	"ctionary<K,V> map, K key, V defaultValue) {V v;if (map.TryGetValue(key,out v)){return v;}return defaultValue;}\npublic static bool w_BOOL(int x){return x!=0;}\npublic static int w_INT(bool x){return x?1:0;}\npublic static int w_NOT(int x){return (x==0)?1:0;}\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_cs, @object
	.size	TEXT_std_cs, 8
TEXT_std_cs:
	.quad	.LC4
	.globl	TEXT_std_cpp
	.section	.rodata
	.align 8
.LC5:
	.ascii	"template <typename T>\ninline void w_arr_insert (std::vector"
	.ascii	"<T>* arr, int i, T x){arr->insert(arr->begin()+i,x);}\ntempl"
	.ascii	"ate <typename T>\ninline void w_arr_remove (std::vector<T>* "
	.ascii	"arr, int i, int n){arr->erase(arr->begin()+i,arr->begin()+i+"
	.ascii	"n);}\ntemplate <typename T>\ninline std::vector<T>* w_arr_sl"
	.ascii	"ice (std::vector<T>* arr, int i, int n){return new std::vect"
	.ascii	"or<T>(arr->begin()+i,arr->begin()+i+n);}\ntemplate <typename"
	.ascii	" K, typename V>\ninline V w_map_get (std::map<K,V>* m, K k, "
	.ascii	"V d"
	.string	"efau){typename std::map<K,V>::iterator it = m->find(k);if (it != m->end()){return it->second;}return defau;}\ntemplate <typename T, std::size_t N>\ninline std::array<T,N>* w_vec_init (T v){std::array<T,N>* vec = new std::array<T,N>;vec->fill(v);return vec;}\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_cpp, @object
	.size	TEXT_std_cpp, 8
TEXT_std_cpp:
	.quad	.LC5
	.globl	TEXT_std_ts
	.section	.rodata
	.align 8
.LC6:
	.string	"const w_slice=(x:Array<any>|string,i:number,n:number)=>x.slice(i,i+n);\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_ts, @object
	.size	TEXT_std_ts, 8
TEXT_std_ts:
	.quad	.LC6
	.globl	TEXT_std_lua
	.section	.rodata
	.align 8
.LC7:
	.ascii	"function w_trunc(x)         if x < 0 then return math.ceil(x"
	.ascii	") else return math.floor(x) end end\nfunction w_vec_init(z,n"
	.ascii	")    local x = {} for i=1,n do x[i]=z end return x end\nfunc"
	.ascii	"tion w_arr_slice(x,i,n) local y = {} for j=(i+1),(i+n) do y["
	.ascii	"j-i]=x[j"
	.string	"] end return y end\nfunction w_arr_remove(x,i,n)for j=(i+n),(i+1),-1 do table.remove(x,j) end end\nfunction w_map_len(x)       local cnt = 0 for k,v in pairs(x) do cnt = cnt + 1 end return cnt end\nfunction w_strcpy(x,i,n)    return string.sub(x,i+1,i+n) end\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_lua, @object
	.size	TEXT_std_lua, 8
TEXT_std_lua:
	.quad	.LC7
	.globl	TEXT_math_wax
	.section	.rodata
	.align 8
.LC8:
	.ascii	"(@pragma once)  (extern acos   (param x float) (result float"
	.ascii	")) (extern asin   (param x float) (result float)) (extern at"
	.ascii	"an   (param x float) (result float)) (extern cos    (param x"
	.ascii	" float) (result float)) (extern cosh   (param x float) (resu"
	.ascii	"lt float)) (extern sin    (param x float) (result float)) (e"
	.ascii	"xtern sinh   (param x float) (result float)) (extern tan    "
	.ascii	"(param x float) (result float)) (extern tanh   (param x floa"
	.ascii	"t) (result float)) (extern exp    (param x float) (result fl"
	.ascii	"oat)) (extern log    (param x float) (result float)) (extern"
	.ascii	" sqrt   (param x float) (result float)) (extern ceil   (para"
	.ascii	"m x float) (result float)) (extern floor  (param x float) (r"
	.ascii	"esult float)) (extern fabs   (param x float) (result float))"
	.ascii	" (extern round  (param x float) (result float)) (extern atan"
	.ascii	"2  (param x float) (param y float) (result float)) (extern p"
	.ascii	"ow    (param x float) (param y float) (result float)) (exter"
	.ascii	"n fmax   (param x float) (param y float) (result float)) (ex"
	.ascii	"tern fmin   (param x float) (param y float) (result float)) "
	.ascii	"(extern abs    (param x int) (result int)) (extern random (r"
	.ascii	"esult float)) (extern INFINITY float)   (@if TARGET_C 1 \t(a"
	.ascii	"sm \"#define random() ((float)rand()/RAND_MAX)\n\") )  (@if "
	.ascii	"TARGET_CPP 1 \t(asm \"#define random() ((float)rand()/RAND_M"
	.ascii	"AX)\n\") )  (@if TARGET_JAVA 1 \t(asm \"public static float "
	.ascii	"fabs(float x){return Math.abs(x);}\n\") \t(asm \"public stat"
	.ascii	"ic float fmin(float x, float y){return Math.min(x,y);}\n\") "
	.ascii	"\t(asm \"public static float fmax(float x, float y){return M"
	.ascii	"ath.max(x,y);}\n\") \t(asm \"public static final float INFIN"
	.ascii	"ITY = Float.POSITIVE_INFINITY;\n\") )  (@if TARGET_TS 1 \t(a"
	.ascii	"sm \"const acos  = Math.acos  ;\n\") \t(asm \"const asin  = "
	.ascii	"Math.asin  ;\n\") \t(asm \"const atan  = Math.atan  ;\n\") \t"
	.ascii	"(asm \"const cos   = Math.cos   ;\n\") \t(asm \"const sin   "
	.ascii	"= Math.sin   ;\n\") \t(asm \"const tan   = Math.tan   ;\n\")"
	.ascii	" \t(asm \"const exp   = Math.exp   ;\n\") \t(asm \"const log"
	.ascii	"   = Math.log   ;\n\") \t(asm \"const sqrt  = Math.sqrt  ;\n"
	.ascii	"\") \t(asm \"const ceil  = Math.ceil  ;\n\") \t(asm \"const "
	.ascii	"floor = Math.floor ;\n\") \t"
	.ascii	"(asm \"const fabs  = Math.abs   ;\n\") \t(asm \"const fmin  "
	.ascii	"= Math.min   ;\n\") \t(asm \"const fmax  = Math.max   ;\n\")"
	.ascii	" \t(asm \"const atan2 = Math.atan2 ;\n\") \t(asm \"const pow"
	.ascii	"   = Math.pow   ;\n\") \t(asm \"const abs   = Math.abs   ;\n"
	.ascii	"\") \t(asm \"const round = Math.round ;\n\") \t(asm \"const "
	.ascii	"random= Math.random;\n\") \t(asm \"const INFINITY = Infinity"
	.ascii	";\n\") \t(asm \"// @ts-ignore\n\") \t(asm \"const sinh  = Ma"
	.ascii	"th.sinh ;\n\") \t(asm \"// @ts-ignore\n\") \t(asm \"const co"
	.ascii	"sh  = Math.cosh ;\n\") \t(asm \"// @ts-ignore\n\") \t(asm \""
	.ascii	"const tanh  = Math.tanh ;\n\") )  (@if TARGET_PY 1 \t(asm \""
	.ascii	"from math import *\n\") \t(asm \"from random import random\n"
	.ascii	"\") \t(asm \"INFINITY = float('inf')\n\") \t(asm \"fabs = ab"
	.ascii	"s\n\") \t(asm \"fmin = min\n\") \t(asm \"fmax = max\n\") )  "
	.ascii	" (@if TARGET_CS 1 \t(asm \"public static Func<double,double>"
	.ascii	" acos     = Math.Acos   ;\n\") \t(asm \"public static Func<d"
	.ascii	"ouble,double> asin     = Math.Asin   ;\n\") \t(asm \"public "
	.ascii	"static Func<double,double> atan     = Math.Atan   ;\n\") \t("
	.ascii	"asm \"public static Func<double,double> cos      = Math.Cos "
	.ascii	"   ;\n\") \t(asm \"public static Func<double,double> sin    "
	.ascii	"  = Math.Sin    ;\n\") \t(asm \"public static Func<double,do"
	.ascii	"uble> tan      = Math.Tan    ;\n\") \t(asm \"public static F"
	.ascii	"unc<double,double> exp      = Math.Exp    ;\n\") \t(asm \"pu"
	.ascii	"blic static Func<double,double> log      = Math.Log    ;\n\""
	.ascii	") \t(asm \"public static Func<double,double> sqrt     = Math"
	.ascii	".Sqrt   ;\n\") \t(asm \"public static Func<double,double> ce"
	.ascii	"il     = Math.Ceiling;\n\") \t(asm \"public static Func<doub"
	.ascii	"le,double> floor    = Math.Floor  ;\n\") \t(asm \"public sta"
	.ascii	"tic Func<double,double> fabs     = Math.Abs    ;\n\") \t(asm"
	.ascii	" \"public static Func<double,double> sinh     = Math.Sinh   "
	.ascii	";\n\") \t(asm \"public static Func<double,double> cosh     ="
	.ascii	" Math.Cosh   ;\n\") \t(asm \"public static Func<double,doubl"
	.ascii	"e> tanh     = Math.Tanh   ;\n\") \t(asm \"public static Func"
	.ascii	"<double,double> round    = Math.Round  ;\n\") \t(asm \"publi"
	.ascii	"c static Func<int,int> abs            = Math.Abs    ;\n\") \t"
	.ascii	"(asm \"public static Func<double,double,double> atan2 = Math"
	.ascii	".Atan2 ;\n\") \t(asm \"public static Func<double,double,"
	.ascii	"double> pow   = Math.Pow   ;\n\") \t(asm \"public static Fun"
	.ascii	"c<double,double,double> fmin  = Math.Min   ;\n\") \t(asm \"p"
	.ascii	"ublic static Func<double,double,double> fmax  = Math.Max   ;"
	.ascii	"\n\") \t(asm \"public static float INFINITY = Single.Positiv"
	.ascii	"eInfinity;\n\") \t(asm \"public static Random w_RNG = new Ra"
	.ascii	"ndom();\n\") \t(asm \"public static float random(){ return ("
	.ascii	"float)w_RNG.NextDouble(); }\n\")  )   (@if TARGET_SWIFT 1 \t"
	.ascii	"(asm \"static var w_seed : UInt32 = 0x5EED;\n\") \t(asm \"st"
	.ascii	"atic func random()->Float{w_seed^=(w_seed<<17);w_seed^=(w_se"
	.ascii	"ed>>13);w_seed^=(w_seed<<5);return Float(w_seed)/Float(42949"
	.ascii	"67295);}\n\") \t(asm \"static var INFINITY : Float = Float.i"
	.ascii	"nfinity\n\") \t(asm \"static func acos (x:Float)->Float{retu"
	.ascii	"rn Foundation.acos (x);}\n\") \t(asm \"static func asin (x:F"
	.ascii	"loat)->Float{return Foundation.asin (x);}\n\") \t(asm \"stat"
	.ascii	"ic func atan (x:Float)->Float{return Foundation.atan (x);}\n"
	.ascii	"\") \t(asm \"static func cos  (x:Float)->Float{return Founda"
	.ascii	"tion.cos  (x);}\n\") \t(asm \"static func cosh (x:Float)->Fl"
	.ascii	"oat{return Foundation.cosh (x);}\n\") \t(asm \"static func s"
	.ascii	"in  (x:Float)->Float{return Foundation.sin  (x);}\n\") \t(as"
	.ascii	"m \"static func sinh (x:Float)->Float{return Foundation.sinh"
	.ascii	" (x);}\n\") \t(asm \"static func tan  (x:Float)->Float{retur"
	.ascii	"n Foundation.tan  (x);}\n\") \t(asm \"static func tanh (x:Fl"
	.ascii	"oat)->Float{return Foundation.tanh (x);}\n\") \t(asm \"stati"
	.ascii	"c func exp  (x:Float)->Float{return Foundation.exp  (x);}\n\""
	.ascii	") \t(asm \"static func log  (x:Float)->Float{return Foundati"
	.ascii	"on.log  (x);}\n\") \t(asm \"static func sqrt (x:Float)->Floa"
	.ascii	"t{return Foundation.sqrt (x);}\n\") \t(asm \"static func cei"
	.ascii	"l (x:Float)->Float{return Foundation.ceil (x);}\n\") \t(asm "
	.ascii	"\"static func floor(x:Float)->Float{return Foundation.floor("
	.ascii	"x);}\n\") \t(asm \"static func fabs (x:Float)->Float{return "
	.ascii	"Swift.abs   (x);}\n\") \t(asm \"static func round(x:Float)->"
	.ascii	"Float{return Foundation.round(x);}\n\") \t(asm \"static func"
	.ascii	" atan2(x:Float,y:Float)->Float{return Foundation.atan2(x,y);"
	.ascii	"}\n\") \t(asm \"static func pow  (x:Float,y:Float)->Float{re"
	.ascii	"turn Foundation.pow  (x,y);}\n\") \t(asm \"static func fmax "
	.ascii	"(x:Floa"
	.ascii	"t,y:Float)->Float{return Foundation.fmax (x,y);}\n\") \t(asm"
	.ascii	" \"static func fmin (x:Float,y:Float)->Float{return Foundati"
	.ascii	"on.fmin (x,y);}\n\") \t(asm \"static func abs  (x:Int)      "
	.ascii	"    ->Int  {return Swift.abs   (x);  }\n\") )  (@if TARGET_L"
	.ascii	"UA 1 \t"
	.string	"(asm \"do for k,v in pairs(math) do _G[k]=v end end\n\") \t(asm \"function round(x) return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5) end\n\") \t(asm \"local INFINITY = huge\n\") \t(asm \"local fmax = max\n\") \t(asm \"local fmin = min\n\") \t(asm \"local fabs = abs\n\n\") )\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_math_wax, @object
	.size	TEXT_math_wax, 8
TEXT_math_wax:
	.quad	.LC8
	.globl	TEXT_math_wat
	.section	.rodata
	.align 8
.LC9:
	.ascii	"(import \"Math\" \"log\"    (func $log   (param f32) (result"
	.ascii	" f32)))\n(import \"Math\" \"exp\"    (func $exp   (param f32"
	.ascii	") (result f32)))\n(import \"Math\" \"cos\"    (func $cos   ("
	.ascii	"param f32) (result f32)))\n(import \"Math\" \"sin\"    (func"
	.ascii	" $sin   (param f32) (result f32)))\n(import \"Math\" \"tan\""
	.ascii	"    (func $tan   (param f32) (result f32)))\n(import \"Math\""
	.ascii	" \"cosh\"   (func $cosh  (param f32) (result f32)))\n(import"
	.ascii	" \"Math\" \"sinh\"   (func $sinh  (param f32) (result f32)))"
	.ascii	"\n(import \"Math\" \"tanh\"   (func $tanh  (param f32) (resu"
	.ascii	"lt f32)))\n(import \"Math\" \"acos\"   (func $acos  (param f"
	.ascii	"32) (result f32)))\n(import \"Math\" \"asin\"   (func $asin "
	.ascii	" (param f32) (result f32)))\n(import \"Math\" \"atan2\"  (fu"
	.ascii	"nc $atan2 (param f32) (param  f32) (result f32)))\n(import \""
	.ascii	"Math\" \"pow\"    (func $pow   (param f32) (param  f32) (res"
	.ascii	"ult f32)))\n(import \"Math\" \"random\" (func $random       "
	.ascii	"     (result f32)))\n\n(func $fmax (param $x f32) (param $y "
	.ascii	"f32) (result f32) (f32.max (local.get $x) (local.get $y)))\n"
	.ascii	"(func $fmin (param $x f32) (param $y f32) (result f32) (f32."
	.ascii	"min (local.get $x) (local.get $y)))\n(func $fabs (param $x f"
	.ascii	"32) (result f32) (f32.abs (local.get $x)))\n(func $floor (pa"
	.ascii	"ram $x f32) (result f32) (f32.floor (local.get $x)))\n(func "
	.ascii	"$ceil (param $x f32) (result f32) (f32.ceil (local.get $x)))"
	.ascii	"\n(func $sqrt (param $x f32) (result f32) (f32.sqrt (local.g"
	.ascii	"et $x)))\n(func $round (param $x f32) (result f32) (f32.near"
	.ascii	"est (local.get"
	.string	" $x)))\n\n(func $abs (param $x i32) (result i32)\n  (if (i32.lt_s (local.get $x) (i32.const 0))(then\n      (i32.sub (i32.const 0) (local.get $x))\n      return\n  ))\n  (local.get $x)\n)\n\n(global $INFINITY f32 (f32.const 340282346638528859811704183484516925440))\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_math_wat, @object
	.size	TEXT_math_wat, 8
TEXT_math_wat:
	.quad	.LC9
	.globl	TEXT_std_arr_wat
	.section	.rodata
	.align 8
.LC10:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;               ARRAY              ;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;; addapted from htt"
	.ascii	"ps://github.com/LingDong-/wasm-fun\n\n;;   Continous, resiza"
	.ascii	"ble storage for a sequence of values,\n;;   similar to C++ v"
	.ascii	"ector<T>\n;;\n;;   +--------------------+\n;;   |data|length"
	.ascii	"|capacity|\n;;   +-|------------------+\n;;     |        +--"
	.ascii	"-------------------------\n;;     `------> |elem 0|elem 1|el"
	.ascii	"em 2|......\n;;              +---------------------------\n\n"
	.ascii	";; struct arr {\n;;   i32/f32/(void*) data\n;;   int length\n"
	.ascii	";;   int capacity\n;; }\n\n(global $wax::DEFAULT_CAPACITY (m"
	.ascii	"ut i32) (i32.const 8))\n\n;; (internal) getter/setters for a"
	.ascii	"rr struct fields\n\n(func $wax::_arr_set_data (param $ptr i3"
	.ascii	"2) (param $data i32)\n  (i32.store (local.get $ptr) (local.g"
	.ascii	"et $data))\n)\n(func $wax::_arr_set_length (param $ptr i32) "
	.ascii	"(param $length i32)\n  (i32.store (i32.add (local.get $ptr) "
	.ascii	"(i32.const 4)) (local.get $length))\n)\n(func $wax::_arr_set"
	.ascii	"_capacity (param $ptr i32) (param $capacity i32)\n  (i32.sto"
	.ascii	"re (i32.add (local.get $ptr) (i32.const 8)) (local.get $capa"
	.ascii	"city))\n)\n(func $wax::_arr_get_data (param $ptr i32) (resul"
	.ascii	"t i32)\n  (i32.load (local.get $ptr))\n)\n(func $wax::_arr_g"
	.ascii	"et_capacity (param $ptr i32) (result i32)\n  (i32.load (i32."
	.ascii	"add (local.get $ptr) (i32.const 8)))\n)\n\n;; returns length"
	.ascii	" of an array given an arr pointer\n(func $wax::arr_length (p"
	.ascii	"aram $ptr i32) (result i32)\n  (i32.load (i32.add (local.get"
	.ascii	" $ptr) (i32.const 4)) )\n)\n\n;; initialize a new arr, retur"
	.ascii	"ns a pointer to it\n;; elem_size: size of each element, in b"
	.ascii	"ytes\n(func $wax::arr_new (param $len i32) (result i32)\n  ("
	.ascii	"local $ptr i32)\n  (local $cap i32)\n  (local $data i32)\n  "
	.ascii	"(if (i32.lt_u (local.get $len) (global.get $wax::DEFAULT_CAP"
	.ascii	"ACITY)) (then\n    (local.set $cap (global.get $wax::DEFAULT"
	.ascii	"_CAPACITY))\n  )(else\n    (local.set $cap (local.get $len))"
	.ascii	"\n  ))\n  (local.se"
	.ascii	"t $ptr (call $wax::malloc (i32.const 12)))\n  (local.set $da"
	.ascii	"ta (call $wax::calloc (i32.mul (local.get $cap) (i32.const 4"
	.ascii	"))))\n  (call $wax::_arr_set_data (local.get $ptr) (local.ge"
	.ascii	"t $data))\n  (call $wax::_arr_set_length (local.get $ptr) (l"
	.ascii	"ocal.get $len))\n  (call $wax::_arr_set_capacity (local.get "
	.ascii	"$ptr) (local.get $cap))\n  (local.get $ptr)\n)\n\n;; free al"
	.ascii	"located memory given an arr pointer\n(func $wax::arr_free (p"
	.ascii	"aram $a i32)\n  (call $wax::free (call $wax::_arr_get_data ("
	.ascii	"local.get $a)))\n  (call $wax::free (local.get $a))\n)\n\n\n"
	.ascii	"\n;; get ith element of an array\n(func $wax::arr_get (param"
	.ascii	" $a i32) (param $i i32) (result i32)\n  (local $data i32)\n "
	.ascii	" (local $elem_size i32)\n  (local.set $data (call $wax::_arr"
	.ascii	"_get_data (local.get $a)))\n  (local.set $elem_size (i32.con"
	.ascii	"st 4))\n  (i32.load (i32.add (i32.mul (local.get $i) (local."
	.ascii	"get $elem_size)) (local.get $data)))\n)\n\n;; set ith elemen"
	.ascii	"t of an array\n(func $wax::arr_set (param $a i32) (param $i "
	.ascii	"i32) (param $v i32)\n  (local $data i32)\n  (local $elem_siz"
	.ascii	"e i32)\n  (local.set $data (call $wax::_arr_get_data (local."
	.ascii	"get $a)))\n  (local.set $elem_size (i32.const 4))\n  (i32.st"
	.ascii	"ore (i32.add (i32.mul (local.get $i) (local.get $elem_size))"
	.ascii	" (local.get $data)) (local.get $v))\n)\n\n;; remove n elemen"
	.ascii	"ts from an array starting at index i\n(func $wax::arr_remove"
	.ascii	" (param $a i32) (param $i i32) (param $n i32)\n  (local $dat"
	.ascii	"a i32)\n  (local $elem_size i32)\n  (local $length i32)\n  ("
	.ascii	"local $offset i32)\n\n  (local.set $length (call $wax::arr_l"
	.ascii	"ength (local.get $a)))\n  (local.set $data (call $wax::_arr_"
	.ascii	"get_data (local.get $a)))\n  (local.set $elem_size (i32.cons"
	.ascii	"t 4))\n\n  (local.set $offset \n    (i32.add (local.get $dat"
	.ascii	"a) (i32.mul (local.get $i) (local.get $elem_size) ))\n  )\n\n"
	.ascii	"  (call $wax::memmove \n    (local.get $offset)\n    (i32.ad"
	.ascii	"d (local.get $offset) (i32.mul (local.get $n) (local.get $el"
	.ascii	"em_size)))\n    (i32.mul (i32.sub (local.get $length) (i32.a"
	.ascii	"dd (local.get $i) (local.get $n)) ) (local.get $elem_size))\n"
	.ascii	"  )\n  (call $wax::_arr_set_length  (local.get $a) (i32.sub "
	.ascii	"(local.get $"
	.ascii	"length) (local.get $n) ))\n)\n\n\n;; add an element to the e"
	.ascii	"nd of the array\n;; does not write the element, instead, ret"
	.ascii	"urns a pointer\n;; to the new last element for the user to w"
	.ascii	"rite at\n(func $wax::arr_push (param $a i32) (result i32)\n "
	.ascii	" (local $length i32)\n  (local $capacity i32)\n  (local $dat"
	.ascii	"a i32)\n  (local $elem_size i32)\n\n  (local.set $length (ca"
	.ascii	"ll $wax::arr_length (local.get $a)))\n  (local.set $capacity"
	.ascii	" (call $wax::_arr_get_capacity (local.get $a)))\n  (local.se"
	.ascii	"t $data (call $wax::_arr_get_data (local.get $a)))\n  (local"
	.ascii	".set $elem_size (i32.const 4))\n\n  (if (i32.lt_u (local.get"
	.ascii	" $length) (local.get $capacity) ) (then) (else\n    (local.s"
	.ascii	"et $capacity (i32.add\n      (i32.add (local.get $capacity) "
	.ascii	"(i32.const 1))\n      (local.get $capacity)\n    ))\n    (ca"
	.ascii	"ll $wax::_arr_set_capacity (local.get $a) (local.get $capaci"
	.ascii	"ty))\n\n    (local.set $data \n      (call $wax::realloc (lo"
	.ascii	"cal.get $data) (i32.mul (local.get $elem_size) (local.get $c"
	.ascii	"apacity) ))\n    )\n    (call $wax::_arr_set_data (local.get"
	.ascii	" $a) (local.get $data))\n  ))\n  (call $wax::_arr_set_length"
	.ascii	" (local.get $a) (i32.add (local.get $length) (i32.const 1)))"
	.ascii	"\n  \n  ;; (i32.store (i32.add (local.get $data) (i32.mul (l"
	.ascii	"ocal.get $length) (local.get $elem_size))) (i32.const 0))\n\n"
	.ascii	"  (i32.add (local.get $data) (i32.mul (local.get $length) (l"
	.ascii	"ocal.get $elem_size)))\n)\n\n;; insert into an array at give"
	.ascii	"n index\n(func $wax::arr_insert (param $a i32) (param $i i32"
	.ascii	") (param $v i32)\n  (local $data i32)\n  (local $elem_size i"
	.ascii	"32)\n  (local $length i32)\n  (local $offset i32)\n\n  (loca"
	.ascii	"l.set $length (call $wax::arr_length (local.get $a)))\n\n  ("
	.ascii	"drop (call $wax::arr_push (local.get $a)))\n\n  (local.set $"
	.ascii	"data (call $wax::_arr_get_data (local.get $a)))\n  (local.se"
	.ascii	"t $elem_size (i32.const 4))\n\n  (local.set $offset \n    (i"
	.ascii	"32.add (local.get $data) (i32.mul (local.get $i) (local.get "
	.ascii	"$elem_size) ))\n  )\n\n  (call $wax::memmove\n    (i32.add ("
	.ascii	"local.get $offset) (local.get $elem_size))\n    (local.get $"
	.ascii	"offset)\n    (i32.mul \n      (i32.sub (local.get $length) ("
	.ascii	"local.get $i) ) \n "
	.ascii	"     (local.get $elem_size)\n    )\n  )\n\n  (i32.store (loc"
	.ascii	"al.get $offset) (local.get $v))\n\n)\n\n;; slice an array, p"
	.ascii	"roducing a copy of a range of elements \n;; i = starting ind"
	.ascii	"ex (inclusive), j = stopping index (exclusive)\n;; returns p"
	.ascii	"ointer to new array\n(func $wax::arr_slice (param $a i32) (p"
	.ascii	"aram $i i32) (param $n i32) (result i32)\n  (local $a_length"
	.ascii	" i32)\n  (local $length i32)\n  (local $elem_size i32)\n  (l"
	.ascii	"ocal $ptr i32)\n  (local $data i32)\n  (local $j i32)\n\n  ("
	.ascii	"local.set $j (i32.add (local.get $i) (local.get $n)))\n\n  ("
	.ascii	"local.set $a_length (call $wax::arr_length (local.get $a)))\n"
	.ascii	"\n  (if (i32.lt_s (local.get $i) (i32.const 0) )(then\n    ("
	.ascii	"local.set $i (i32.add (local.get $a_length) (local.get $i)))"
	.ascii	"\n  ))\n  (if (i32.lt_s (local.get $j) (i32.const 0) )(then\n"
	.ascii	"    (local.set $j (i32.add (local.get $a_length) (local.get "
	.ascii	"$j)))\n  ))\n\n  (local.set $length (i32.sub (local.get $j) "
	.ascii	"(local.get $i)))\n  (local.set $elem_size (i32.const 4))\n\n"
	.ascii	"  (local.set $ptr (call $wax::malloc (i32.const 12)))\n  (lo"
	.ascii	"cal.set $data (call $wax::malloc (i32.mul (local.get $length"
	.ascii	") (local.get $elem_size))))\n  (call $wax::_arr_set_data (lo"
	.ascii	"cal.get $ptr) (local.get $data))\n  (call $wax::_arr_set_len"
	.ascii	"gth (local.get $ptr) (local.get $length))\n  (call $wax::_ar"
	.ascii	"r_set_capacity (local.get $ptr) (local.get $"
	.string	"length))\n\n  (call $wax::memcpy (local.get $data) \n    (i32.add\n      (call $wax::_arr_get_data (local.get $a))\n      (i32.mul (local.get $i) (local.get $elem_size))\n    )\n    (i32.mul (local.get $length) (local.get $elem_size))\n  )\n\n  (local.get $ptr)\n)\n\n\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_arr_wat, @object
	.size	TEXT_std_arr_wat, 8
TEXT_std_arr_wat:
	.quad	.LC10
	.globl	TEXT_std_str_wat
	.section	.rodata
	.align 8
.LC11:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;              STRING              ;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n(func $wax::fmod ("
	.ascii	"param $x f32) (param $y f32) (result f32)\n  (f32.sub (local"
	.ascii	".get $x) (f32.mul (local.get $y) (f32.trunc (f32.div (local."
	.ascii	"get $x) (local.get $y)) )))\n)\n\n(func $wax::str_new (param"
	.ascii	" $ptr i32) (result i32)\n  (if (i32.eqz (local.get $ptr))(th"
	.ascii	"en\n    (call $wax::calloc (i32.const 1))\n    return\n  ))\n"
	.ascii	"  (call $wax::str_slice (local.get $ptr) (i32.const 0) (call"
	.ascii	" $wax::str_len (local.get $ptr)) )\n  return\n)\n\n(func $wa"
	.ascii	"x::str_get (param $ptr i32) (param $i i32) (result i32)\n  ("
	.ascii	"i32.load8_s (i32.add (local.get $ptr) (local.get $i)))\n  re"
	.ascii	"turn\n)\n\n(func $wax::str_add (param $ptr i32) (param $c i3"
	.ascii	"2) (result i32)\n  (local $l i32)\n  (local.set $l (call $wa"
	.ascii	"x::str_len (local.get $ptr)))\n  (local.set $ptr (call $wax:"
	.ascii	":realloc (local.get $ptr) (i32.add (local.get $l) (i32.const"
	.ascii	" 2) ) ) )\n  (i32.store8 (i32.add (local.get $ptr) (local.ge"
	.ascii	"t $l)) (local.get $c)  )\n  (i32.store8 (i32.add (i32.add (l"
	.ascii	"ocal.get $ptr) (local.get $l)) (i32.const 1)) (i32.const 0) "
	.ascii	" )\n\n  (local.get $ptr)\n  (return)\n)\n\n(func $wax::str_c"
	.ascii	"at (param $s0 i32) (param $s1 i32) (result i32)\n  (local $l"
	.ascii	"0 i32)\n  (local $l1 i32)\n  (local.set $l0 (call $wax::str_"
	.ascii	"len (local.get $s0)))\n  (local.set $l1 (call $wax::str_len "
	.ascii	"(local.get $s1)))\n\n  (local.set $s0 (call $wax::realloc (l"
	.ascii	"ocal.get $s0) (i32.add (i32.add (local.get $l0) (local.get $"
	.ascii	"l1) ) (i32.const 1)) ))\n\n  (call $wax::memcpy (i32.add (lo"
	.ascii	"cal.get $s0) (local.get $l0)) (local.get $s1) (local.get $l1"
	.ascii	") )\n  (i32.store8 (i32.add (i32.add (local.get $s0) (local."
	.ascii	"get $l0)) (local.get $l1)) (i32.const 0)  )\n  (local.get $s"
	.ascii	"0)\n  return\n)\n\n(func $wax::str_cmp (param $s0 i32) (para"
	.ascii	"m $s1 i32) (result i32)\n  (local $offset i32)\n  (local $x "
	.ascii	"i32)\n  (local $y i32)\n  (local.set $offset (i32.const 0))\n"
	.ascii	"  loop $cmp\n  "
	.ascii	"  (local.set $x (i32.load8_u (i32.add (local.get $s0) (local"
	.ascii	".get $offset))) )\n    (local.set $y (i32.load8_u (i32.add ("
	.ascii	"local.get $s1) (local.get $offset))) )\n\n    (if (i32.eq (l"
	.ascii	"ocal.get $x) (local.get $y)) (then\n      (if (i32.eqz (loca"
	.ascii	"l.get $x)) (then\n        (i32.const 1)\n        return\n   "
	.ascii	"   ))\n    )(else\n      (i32.const 0)\n      return\n    ))"
	.ascii	"\n\n    (local.set $offset (i32.add (local.get $offset) (i32"
	.ascii	".const 1)))\n    (br $cmp)\n  end\n  (i32.const 0) ;;impossi"
	.ascii	"ble, just shut compiler up\n  return\n)\n\n(func $wax::str_l"
	.ascii	"en (param $ptr i32) (result i32)\n  (local $offset i32)\n  ("
	.ascii	"local.set $offset (i32.const 0))\n  loop $zero\n    (if (i32"
	.ascii	".load8_u (i32.add (local.get $ptr) (local.get $offset))) (th"
	.ascii	"en\n      (local.set $offset (i32.add (local.get $offset) (i"
	.ascii	"32.const 1)))\n      (br $zero)\n    ))\n  end\n  (local.get"
	.ascii	" $offset)\n  return\n)\n\n(func $wax::str_slice (param $ptr "
	.ascii	"i32) (param $i i32) (param $n i32) (result i32)\n  (local $n"
	.ascii	"ptr i32)\n  (local.set $nptr (call $wax::malloc (i32.add (lo"
	.ascii	"cal.get $n) (i32.const 1))))\n  (call $wax::memcpy \n    (lo"
	.ascii	"cal.get $nptr) \n    (i32.add (local.get $ptr) (local.get $i"
	.ascii	")) \n    (local.get $n)\n  )\n  (i32.store8 (i32.add (local."
	.ascii	"get $nptr) (local.get $n) ) (i32.const 0))\n  (local.get $np"
	.ascii	"tr)\n  return\n)\n\n(func $wax::print (param $ptr i32)\n  (l"
	.ascii	"ocal $len i32)\n  (local.set $len (call $wax::str_len (local"
	.ascii	".get $ptr)))\n  (call $wax::js::console.log (local.get $ptr)"
	.ascii	" (local.get $len))\n)\n\n(func $wax::int2str (param $x i32) "
	.ascii	"(result i32)\n  (local $ptr i32)\n  (local $rem i32)\n  (loc"
	.ascii	"al $isneg i32)\n  (local $str i32)\n\n  (local.set $str (cal"
	.ascii	"l $wax::alloca (i32.const 16)))\n  (local.set $ptr (i32.add "
	.ascii	"(local.get $str) (i32.const 15)))\n  (i32.store8 (local.get "
	.ascii	"$ptr) (i32.const 0))\n  \n  (local.set $isneg (i32.const 0))"
	.ascii	"\n  (if (i32.lt_s (local.get $x) (i32.const 0)) (then\n    ("
	.ascii	"local.set $isneg (i32.const 1))\n    (local.set $x (i32.sub "
	.ascii	"(i32.const 0) (local.get $x) ))\n  ))\n\n  loop $digits\n   "
	.ascii	" (local.set $ptr (i32.sub (local.get $ptr) (i32.const 1)))\n"
	.ascii	"\n    (local.set $rem (i32.rem_"
	.ascii	"u (local.get $x) (i32.const 10)))\n    (i32.store8 (local.ge"
	.ascii	"t $ptr) (i32.add (local.get $rem) (i32.const 48)))\n\n    (l"
	.ascii	"ocal.set $x (i32.div_u (local.get $x) (i32.const 10)))\n\n  "
	.ascii	"  (if (i32.eqz (i32.eqz (local.get $x))) (then\n      (br $d"
	.ascii	"igits)\n    ))\n  end\n\n  (if (local.get $isneg) (then\n   "
	.ascii	" (local.set $ptr (i32.sub (local.get $ptr) (i32.const 1)))\n"
	.ascii	"    (i32.store8 (local.get $ptr) (i32.const 45)) ;; '-'\n  )"
	.ascii	")\n\n  (local.get $ptr)\n  return\n)\n\n(func $wax::fint2str"
	.ascii	" (param $x f32) (result i32)\n  (local $ptr i32)\n  (local $"
	.ascii	"rem i32)\n  (local $isneg i32)\n  (local $str i32)\n  (local"
	.ascii	".set $x (f32.trunc (local.get $x)))\n\n  (local.set $str (ca"
	.ascii	"ll $wax::alloca (i32.const 48)))\n  (local.set $ptr (i32.add"
	.ascii	" (local.get $str) (i32.const 47)))\n  (i32.store8 (local.get"
	.ascii	" $ptr) (i32.const 0))\n  \n  (if (f32.lt (local.get $x) (f32"
	.ascii	".const 0)) (then\n    (local.set $isneg (i32.const 1))\n    "
	.ascii	"(local.set $x (f32.sub (f32.const 0) (local.get $x) ))\n  ))"
	.ascii	"\n\n  loop $digits\n    (local.set $ptr (i32.sub (local.get "
	.ascii	"$ptr) (i32.const 1)))\n\n    (local.set $rem (i32.trunc_f32_"
	.ascii	"s (call $wax::fmod (local.get $x) (f32.const 10.0))))\n    ("
	.ascii	"i32.store8 (local.get $ptr) (i32.add (local.get $rem) (i32.c"
	.ascii	"onst 48)))\n\n    (local.set $x (f32.div (local.get $x) (f32"
	.ascii	".const 10.0)))\n\n    (if (f32.gt (local.get $x) (f32.const "
	.ascii	"0.99999994) ) (then ;;nextafterf(1.00000001,0.0);\n      (br"
	.ascii	" $digits)\n    ))\n  end\n\n  (if (local.get $isneg) (then\n"
	.ascii	"    (local.set $ptr (i32.sub (local.get $ptr) (i32.const 1))"
	.ascii	")\n    (i32.store8 (local.get $ptr) (i32.const 45)) ;; '-'\n"
	.ascii	"  ))\n\n  (local.get $ptr)\n  return\n)\n\n\n\n\n(func $wax:"
	.ascii	":flt2str (param $x f32) (result i32)\n  (local $ptr0 i32)\n "
	.ascii	" (local $ptr i32)\n  (local $rem i32)\n  (local $isneg i32)\n"
	.ascii	"  (local $str i32)\n\n  (local.set $ptr0 (call $wax::fint2st"
	.ascii	"r (local.get $x)))\n\n  (if (f32.lt (local.get $x) (f32.cons"
	.ascii	"t 0)) (then\n    (local.set $x (f32.sub (f32.const 0.0) (loc"
	.ascii	"al.get $x)))\n  ))\n  (local.set $x (f32.sub (local.get $x) "
	.ascii	"(f32.trunc (local.get $x))))\n  \n  (local.set $str (call $w"
	.ascii	"ax::alloca (i32.const 16)))\n  (i3"
	.ascii	"2.store8 (i32.sub (local.get $str) (i32.const 1)) (i32.const"
	.ascii	" 46)  )\n  (local.set $ptr (local.get $str))\n  \n  loop $di"
	.ascii	"gits\n    \n    (local.set $rem (i32.trunc_f32_s (f32.mul (l"
	.ascii	"ocal.get $x) (f32.const 10.0)) ))\n    (i32.store8 (local.ge"
	.ascii	"t $ptr) (i32.add (local.get $rem) (i32.const 48)))\n\n    (l"
	.ascii	"ocal.set $x (f32.sub (f32.mul (local.get $x) (f32.const 10.0"
	.ascii	")) (f32.convert_i32_s (local.get $rem))) )\n\n    (local.set"
	.ascii	" $ptr (i32.add (local.get $ptr) (i32.const 1)))\n\n    (if ("
	.ascii	"i32.and\n      (f32.gt (local.get $x) (f32.const 1.192092895"
	.ascii	"5078126e-7) ) ;; floating-point epsilon\n      (i32.lt_s (i3"
	.ascii	"2.sub (local.get $ptr) (local.get $str)) (i32.const 15))\n  "
	.ascii	"  )(then\n      (br $digits)\n    ))\n  end\n  (i32.store8 ("
	.ascii	"local.get $ptr) (i32.const 0))\n\n  (local.get $ptr0)\n  ret"
	.ascii	"urn\n\n)\n\n(func $wax::str2int (param $s i32) (result i32)\n"
	.ascii	"  (local $x i32)\n  (local $ptr i32)\n  (local $d i32)\n  (l"
	.ascii	"ocal $sign i32)\n  (local.set $x (i32.const 0))\n\n  (local."
	.ascii	"set $ptr (local.get $s))\n\n  (local.set $sign (i32.const 1)"
	.ascii	")\n  (if (i32.eq (i32.load8_s (local.get $ptr) ) (i32.const "
	.ascii	"45) ) (then ;;'-'\n    (local.set $sign (i32.const -1))\n   "
	.ascii	" (local.set $ptr (i32.add (local.get $ptr) (i32.const 1)))\n"
	.ascii	"  )(else(if (i32.eq (i32.load8_s (local.get $ptr) ) (i32.con"
	.ascii	"st 43) ) (then ;;'+'\n    (local.set $ptr (i32.add (local.ge"
	.ascii	"t $ptr) (i32.const 1))) ;;redundant\n  ))))\n\n  loop $digit"
	.ascii	"s\n    (local.set $d (i32.load8_s (local.get $ptr) ))\n    ("
	.ascii	"if (i32.or\n      (i32.lt_s (local.get $d) (i32.const 48))\n"
	.ascii	"      (i32.gt_s (local.get $d) (i32.const 57))\n    )(then\n"
	.ascii	"      (i32.mul (local.get $sign) (local.get $x))\n      retu"
	.ascii	"rn\n    ))\n    \n    (local.set $x (i32.mul (local.get $x) "
	.ascii	"(i32.const 10)))\n    (local.set $x (i32.add (local.get $x) "
	.ascii	"(i32.sub (local.get $d) (i32.const 48))))\n    \n    (local."
	.ascii	"set $ptr (i32.add (local.get $ptr) (i32.const 1)))\n    (br "
	.ascii	"$digits)\n  end\n\n  (i32.mul (local.get $sign) (local.get $"
	.ascii	"x))\n  return\n)\n\n(func $wax::str2flt (param $s i32) (resu"
	.ascii	"lt f32)\n  (local $x f32)\n  (local $ptr i32)\n  (local $d i"
	.ascii	"32)\n  (local $sign f32)\n  "
	.ascii	"(local $mlt f32)\n\n  (local.set $x (f32.const 0.0))\n\n  (l"
	.ascii	"ocal.set $ptr (local.get $s))\n\n\n  (local.set $sign (f32.c"
	.ascii	"onst 1.0))\n  (if (i32.eq (i32.load8_s (local.get $ptr) ) (i"
	.ascii	"32.const 45) ) (then ;;'-'\n    (local.set $sign (f32.const "
	.ascii	"-1))\n    (local.set $ptr (i32.add (local.get $ptr) (i32.con"
	.ascii	"st 1)))\n  )(else(if (i32.eq (i32.load8_s (local.get $ptr) )"
	.ascii	" (i32.const 43) ) (then ;;'+'\n    (local.set $ptr (i32.add "
	.ascii	"(local.get $ptr) (i32.const 1))) ;;redundant\n  ))))\n\n  bl"
	.ascii	"ock $out\n  loop $digits\n    (local.set $d (i32.load8_s (lo"
	.ascii	"cal.get $ptr) ))\n    (if (i32.eq (local.get $d) (i32.const "
	.ascii	"46)) (then ;; '.'\n      (local.set $ptr (i32.add (local.get"
	.ascii	" $ptr) (i32.const 1)))\n      (br $out)\n    ))\n    (if (i3"
	.ascii	"2.or\n      (i32.lt_s (local.get $d) (i32.const 48))\n      "
	.ascii	"(i32.gt_s (local.get $d) (i32.const 57))\n    )(then\n      "
	.ascii	"(f32.mul (local.get $sign) (local.get $x))\n      return\n  "
	.ascii	"  ))\n    \n    (local.set $x (f32.mul (local.get $x) (f32.c"
	.ascii	"onst 10.0)))\n    (local.set $x (f32.add (local.get $x) (f32"
	.ascii	".convert_i32_s (i32.sub (local.get $d) (i32.const 48)))))\n "
	.ascii	"   \n    (local.set $ptr (i32.add (local.get $ptr) (i32.cons"
	.ascii	"t 1)))\n    (br $digits)\n  end\n  end\n\n  (local.set $mlt "
	.ascii	"(f32.const 0.1))\n  loop $fracs\n    (local.set $d (i32.load"
	.ascii	"8_s (local.get $ptr) ))\n\n    (if (i32.or\n      (i32.lt_s "
	.ascii	"(local.get $d) (i32.const 48))\n      (i32.gt_s (local.get $"
	.ascii	"d) (i32.const 57))\n    )(then\n      (f32.mul (local.get $s"
	.ascii	"ign) (local.get $x))\n      return\n    ))\n    (local.set $"
	.ascii	"x (f32.add\n      (local.get $x)\n      (f32.mul (f32.conver"
	.ascii	"t_i32_s (i32.sub (local.get $"
	.string	"d) (i32.const 48))) (local.get $mlt))\n    ))\n    (local.set $mlt (f32.mul (local.get $mlt) (f32.const 0.1)))\n    \n    (local.set $ptr (i32.add (local.get $ptr) (i32.const 1)))\n\n    (br $fracs)\n  end\n\n  (f32.mul (local.get $sign) (local.get $x))\n  return\n)\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_str_wat, @object
	.size	TEXT_std_str_wat, 8
TEXT_std_str_wat:
	.quad	.LC11
	.globl	TEXT_std_malloc_wat
	.section	.rodata
	.align 8
.LC12:
	.ascii	";;========================================================;;"
	.ascii	"\n;;     BASELINE MALLOC WITH HANDWRITTEN WEBASSEMBLY       "
	.ascii	";;\n;;======================================================"
	.ascii	"==;;\n;; 32-bit implicit-free-list first-fit baseline malloc"
	.ascii	"    ;;\n;;--------------------------------------------------"
	.ascii	"------;;\n\n;; IMPLICIT FREE LIST:\n;; Worse utilization and"
	.ascii	" throughput than explicit/segregated, but easier\n;; to impl"
	.ascii	"ement :P\n;;\n;; HEAP LO                                    "
	.ascii	"                     HEAP HI\n;; +---------------------+----"
	.ascii	"-----------------+...+---------------------+\n;; | HDR | PAY"
	.ascii	"LOAD | FTR | HDR | PAYLOAD | FTR |...+ HDR | PAYLOAD | FTR |"
	.ascii	"\n;; +----------^----------+---------------------+...+------"
	.ascii	"---------------+\n;;            |_ i.e. user data\n;;       "
	.ascii	"    \n;; LAYOUT OF A BLOCK:\n;; Since memory is aligned to m"
	.ascii	"ultiple of 4 bytes, the last two bits of\n;; payload_size is"
	.ascii	" redundant. Therefore the last bit of header is used to\n;; "
	.ascii	"store the is_free flag.\n;; \n;; |---- HEADER (4b)----\n;; |"
	.ascii	"    ,--payload size (x4)--.     ,-is free?\n;; | 0b . . . . "
	.ascii	". . . . . . . . 0  0\n;; |------ PAYLOAD -----\n;; |\n;; |  "
	.ascii	"user data (N x 4b)\n;; |\n;; |---- FOOTER (4b)---- (duplicat"
	.ascii	"e of header)\n;; |    ,--payload size (x4)--.     ,-is free?"
	.ascii	"\n;; | 0b . . . . . . . . . . . . 0  0\n;; |----------------"
	.ascii	"----\n;;\n;; FORMULAS:\n;; (these formulas are used througho"
	.ascii	"ut the code, so they're listed here\n;; instead of explained"
	.ascii	" each time encountered)\n;;\n;; payload_size = block_size - "
	.ascii	"(header_size + footer_size) = block_size - 8\n;; \n;; payloa"
	.ascii	"d_pointer = header_pointer + header_size = header_pointer + "
	.ascii	"4\n;;\n;; footer_pointer = header_pointer + header_size + pa"
	.ascii	"yload_size\n;;                = (header_pointer + payload_si"
	.ascii	"ze) + 4\n;;\n;; next_header_pointer = footer_pointer + foote"
	.ascii	"r_size = footer_pointer + 4\n;;\n;; prev_footer_pointer = he"
	.ascii	"ader_pointer - footer_size = header_pointer - 4\n\n(memory $"
	.ascii	"wax::mem 1)                                ;; start with 1 p"
	.ascii	"age (64K)\n(export \"mem\" (memory $wax::mem))\n;;// (global"
	.ascii	" $wax::min_a"
	.ascii	"ddr (mut i32) (i32.const 0))  ;; set by wax compiler dependi"
	.ascii	"ng on data section size\n(global $wax::max_addr (mut i32) (i"
	.ascii	"32.const 65536)) ;; initial heap size (64K)\n(global $wax::h"
	.ascii	"eap_did_init (mut i32) (i32.const 0))     ;; init() called?\n"
	.ascii	"\n;; helpers to pack/unpack payload_size/is_free from header"
	.ascii	"/footer\n;; by masking out bits\n\n;; read payload_size from"
	.ascii	" header/footer given pointer to header/footer\n(func $wax::h"
	.ascii	"dr_get_size (param $ptr i32) (result i32)\n  (i32.and (i32.l"
	.ascii	"oad (local.get $ptr)) (i32.const 0xFFFFFFFC))\n)\n;; read is"
	.ascii	"_free from header/footer\n(func $wax::hdr_get_free (param $p"
	.ascii	"tr i32) (result i32)\n  (i32.and (i32.load (local.get $ptr))"
	.ascii	" (i32.const 0x00000001))\n)\n;; write payload_size to header"
	.ascii	"/footer\n(func $wax::hdr_set_size (param $ptr i32) (param $n"
	.ascii	" i32) \n  (i32.store (local.get $ptr) (i32.or\n    (i32.and "
	.ascii	"(i32.load (local.get $ptr)) (i32.const 0x00000003))\n    (lo"
	.ascii	"cal.get $n)\n  ))\n)\n;; write is_free to header/footer\n(fu"
	.ascii	"nc $wax::hdr_set_free (param $ptr i32) (param $n i32)\n  (i3"
	.ascii	"2.store (local.get $ptr) (i32.or\n    (i32.and (i32.load (lo"
	.ascii	"cal.get $ptr)) (i32.const 0xFFFFFFFE))\n    (local.get $n)\n"
	.ascii	"  ))\n)\n;; align memory by 4 bytes\n(func $wax::align4 (par"
	.ascii	"am $x i32) (result i32)\n  (i32.and\n    (i32.add (local.get"
	.ascii	" $x) (i32.const 3))\n    (i32.const -4)\n  )\n)\n\n;; initia"
	.ascii	"lize heap\n;; make the whole heap a big free block\n;; - aut"
	.ascii	"omatically invoked by first malloc() call\n;; - can be manua"
	.ascii	"lly called to nuke the whole heap\n(func $wax::init_heap\n  "
	.ascii	"(i32.store (i32.const 0) (global.get $wax::min_addr) )\n  ;;"
	.ascii	" write payload_size to header and footer\n  (call $wax::hdr_"
	.ascii	"set_size (global.get $wax::min_addr) \n    (i32.sub (i32.sub"
	.ascii	" (global.get $wax::max_addr) (global.get $wax::min_addr)) (i"
	.ascii	"32.const 8))\n  )\n  (call $wax::hdr_set_size (i32.sub (glob"
	.ascii	"al.get $wax::max_addr) (i32.const 4))\n    (i32.sub (i32.sub"
	.ascii	" (global.get $wax::max_addr) (global.get $wax::min_addr)) (i"
	.ascii	"32.const 8))\n  )\n  ;; write is_free to header and footer\n"
	.ascii	"  (call $wax::hdr_set_free (global.get $wax::min_addr) (i32."
	.ascii	"const 1))\n"
	.ascii	"  (call $wax::hdr_set_free (i32.sub (global.get $wax::max_ad"
	.ascii	"dr) (i32.const 4)) (i32.const 1))\n\n  ;; set flag to tell m"
	.ascii	"alloc() that we've already called init()\n  (global.set $wax"
	.ascii	"::heap_did_init (i32.const 1)) \n)\n\n;; extend (grow) the h"
	.ascii	"eap (to accomodate more blocks)\n;; parameter: number of pag"
	.ascii	"es (64K) to grow\n;; - automatically invoked by malloc() whe"
	.ascii	"n current heap has insufficient free space\n;; - can be manu"
	.ascii	"ally called to get more space in advance\n(func $wax::extend"
	.ascii	" (param $n_pages i32)\n  (local $n_bytes i32)\n  (local $ftr"
	.ascii	" i32)\n  (local $prev_ftr i32)\n  (local $prev_hdr i32)\n  ("
	.ascii	"local $prev_size i32)\n\n  (local.set $prev_ftr (i32.sub (gl"
	.ascii	"obal.get $wax::max_addr) (i32.const 4)) )\n\n  ;; compute nu"
	.ascii	"mber of bytes from page count (1page = 64K = 65536bytes)\n  "
	.ascii	"(local.set $n_bytes (i32.mul (local.get $n_pages) (i32.const"
	.ascii	" 65536)))\n\n  ;; system call to grow memory (`drop` discard"
	.ascii	"s the (useless) return value of memory.grow)\n  (drop (memor"
	.ascii	"y.grow (local.get $n_pages) ))\n\n  ;; make the newly acquir"
	.ascii	"ed memory a big free block\n  (call $wax::hdr_set_size (glob"
	.ascii	"al.get $wax::max_addr) (i32.sub (local.get $n_bytes) (i32.co"
	.ascii	"nst 8)))\n  (call $wax::hdr_set_free (global.get $wax::max_a"
	.ascii	"ddr) (i32.const 1))\n\n  (global.set $wax::max_addr (i32.add"
	.ascii	" (global.get $wax::max_addr) (local.get $n_bytes) ))\n  (loc"
	.ascii	"al.set $ftr (i32.sub (global.get $wax::max_addr) (i32.const "
	.ascii	"4)))\n\n  (call $wax::hdr_set_size (local.get $ftr)\n    (i3"
	.ascii	"2.sub (local.get $n_bytes) (i32.const 8))\n  )\n  (call $wax"
	.ascii	"::hdr_set_free (local.get $ftr) (i32.const 1))\n\n  ;; see i"
	.ascii	"f we can join the new block with the last block of the old h"
	.ascii	"eap\n  (if (i32.eqz (call $wax::hdr_get_free (local.get $pre"
	.ascii	"v_ftr)))(then)(else\n\n    ;; the last block is free, join i"
	.ascii	"t.\n    (local.set $prev_size (call $wax::hdr_get_size (loca"
	.ascii	"l.get $prev_ftr)))\n    (local.set $prev_hdr\n      (i32.sub"
	.ascii	" (i32.sub (local.get $prev_ftr) (local.get $prev_size)) (i32"
	.ascii	".const 4))\n    )\n    (call $wax::hdr_set_size (local.get $"
	.ascii	"prev_hdr)\n      (i32.add (local.get $prev_size) (local.get "
	.ascii	"$n_byt"
	.ascii	"es) )\n    )\n    (call $wax::hdr_set_size (local.get $ftr)\n"
	.ascii	"      (i32.add (local.get $prev_size) (local.get $n_bytes) )"
	.ascii	"\n    )\n  ))\n\n)\n\n;; find a free block that fit the requ"
	.ascii	"est number of bytes\n;; modifies the heap once a candidate i"
	.ascii	"s found\n;; first-fit: not the best policy, but the simplest"
	.ascii	"\n(func $wax::find (param $n_bytes i32) (result i32)\n  (loc"
	.ascii	"al $ptr i32)\n  (local $size i32)\n  (local $is_free i32)\n "
	.ascii	" (local $pay_ptr i32)\n  (local $rest i32)\n\n  ;; loop thro"
	.ascii	"ugh all blocks\n  (local.set $ptr (global.get $wax::min_addr"
	.ascii	"))\n  loop $search\n    ;; we reached the end of heap and ha"
	.ascii	"ven't found anything, return NULL\n    (if (i32.lt_u (local."
	.ascii	"get $ptr) (global.get $wax::max_addr))(then)(else\n      (i3"
	.ascii	"2.const 0)\n      return\n    ))\n\n    ;; read info about c"
	.ascii	"urrent block\n    (local.set $size    (call $wax::hdr_get_si"
	.ascii	"ze (local.get $ptr)))\n    (local.set $is_free (call $wax::h"
	.ascii	"dr_get_free (local.get $ptr)))\n    (local.set $pay_ptr (i32"
	.ascii	".add (local.get $ptr) (i32.const 4) ))\n\n    ;; check if th"
	.ascii	"e current block is free\n    (if (i32.eq (local.get $is_free"
	.ascii	") (i32.const 1))(then\n\n      ;; it's free, but too small, "
	.ascii	"move on\n      (if (i32.gt_u (local.get $n_bytes) (local.get"
	.ascii	" $size))(then\n        (local.set $ptr (i32.add (local.get $"
	.ascii	"ptr) (i32.add (local.get $size) (i32.const 8))))\n        (b"
	.ascii	"r $search)\n\n      ;; it's free, and large enough to be spl"
	.ascii	"it into two blocks\n      )(else(if (i32.lt_u (local.get $n_"
	.ascii	"bytes) (i32.sub (local.get $size) (i32.const 8)))(then\n    "
	.ascii	"    ;; OLD HEAP\n        ;; ...+----------------------------"
	.ascii	"---------------+...\n        ;; ...| HDR |              FREE"
	.ascii	"             | FTR |...\n        ;; ...+--------------------"
	.ascii	"-----------------------+...\n        ;; NEW HEAP\n        ;;"
	.ascii	" ...+---------------------+---------------------+...\n      "
	.ascii	"  ;; ...| HDR | ALLOC   | FTR | HDR |  FREE   | FTR |...\n  "
	.ascii	"      ;; ...+---------------------+---------------------+..."
	.ascii	"\n\n        ;; size of the remaining half\n        (local.se"
	.ascii	"t $rest (i32.sub (i32.sub (local.get $size) (local.get $n_by"
	.ascii	"tes) ) (i32."
	.ascii	"const 8)))\n\n        ;; update headers and footers to refle"
	.ascii	"ct the change (see FORMULAS)\n\n        (call $wax::hdr_set_"
	.ascii	"size (local.get $ptr) (local.get $n_bytes))\n        (call $"
	.ascii	"wax::hdr_set_free (local.get $ptr) (i32.const 0))\n\n       "
	.ascii	" (call $wax::hdr_set_size (i32.add (i32.add (local.get $ptr)"
	.ascii	" (local.get $n_bytes)) (i32.const 4))\n          (local.get "
	.ascii	"$n_bytes)\n        )\n        (call $wax::hdr_set_free (i32."
	.ascii	"add (i32.add (local.get $ptr) (local.get $n_bytes)) (i32.con"
	.ascii	"st 4))\n          (i32.const 0)\n        )\n        (call $w"
	.ascii	"ax::hdr_set_size (i32.add (i32.add (local.get $ptr) (local.g"
	.ascii	"et $n_bytes)) (i32.const 8))\n          (local.get $rest)\n "
	.ascii	"       )\n        (call $wax::hdr_set_free (i32.add (i32.add"
	.ascii	" (local.get $ptr) (local.get $n_bytes)) (i32.const 8))\n    "
	.ascii	"      (i32.const 1)\n        )\n        (call $wax::hdr_set_"
	.ascii	"size (i32.add (i32.add (local.get $ptr) (local.get $size)) ("
	.ascii	"i32.const 4))\n          (local.get $rest)\n        )\n\n   "
	.ascii	"     (local.get $pay_ptr)\n        return\n\n      )(else\n "
	.ascii	"       ;; the block is free, but not large enough to be spli"
	.ascii	"t into two blocks \n        ;; we return the whole block as "
	.ascii	"one\n        (call $wax::hdr_set_free (local.get $ptr) (i32."
	.ascii	"const 0))\n        (call $wax::hdr_set_free (i32.add (i32.ad"
	.ascii	"d (local.get $ptr) (local.get $size)) (i32.const 4))\n      "
	.ascii	"    (i32.const 0)\n        )\n        (local.get $pay_ptr)\n"
	.ascii	"        return\n      ))))\n    )(else\n      ;; the block i"
	.ascii	"s not free, we move on to the next block\n      (local.set $"
	.ascii	"ptr (i32.add (local.get $ptr) (i32.add (local.get $size) (i3"
	.ascii	"2.const 8))))\n      (br $search)\n    ))\n  end\n\n  ;; the"
	.ascii	"oratically we will not reach here\n  ;; return NULL\n  (i32."
	.ascii	"const 0)\n)\n\n\n;; malloc - allocate the requested number o"
	.ascii	"f bytes on the heap\n;; returns a pointer to the block of me"
	.ascii	"mory allocated\n;; returns NULL (0) when OOM\n;; if heap is "
	.ascii	"not large enough, grows it via extend()\n(func $wax::malloc "
	.ascii	"(param $n_bytes i32) (result i32)\n  (local $ptr i32)\n  (lo"
	.ascii	"cal $n_pages i32)\n\n  ;; call init() if we haven't done so "
	.ascii	"yet\n  (if (i32.eq"
	.ascii	"z (global.get $wax::heap_did_init)) (then\n    (call $wax::i"
	.ascii	"nit_heap)\n  ))\n\n  ;; payload size is aligned to multiple "
	.ascii	"of 4\n  (local.set $n_bytes (call $wax::align4 (local.get $n"
	.ascii	"_bytes)))\n\n  ;; attempt allocation\n  (local.set $ptr (cal"
	.ascii	"l $wax::find (local.get $n_bytes)) )\n\n  ;; NULL -> OOM -> "
	.ascii	"extend heap\n  (if (i32.eqz (local.get $ptr))(then\n    ;; c"
	.ascii	"ompute # of pages from # of bytes, rounding up\n    (local.s"
	.ascii	"et $n_pages\n      (i32.div_u \n        (i32.add (local.get "
	.ascii	"$n_bytes) (i32.const 65527) )\n        (i32.const 65528)\n  "
	.ascii	"    )\n    )\n    (call $wax::extend (local.get $n_pages))\n"
	.ascii	"\n    ;; try again\n    (local.set $ptr (call $wax::find (lo"
	.ascii	"cal.get $n_bytes)) )\n  ))\n  (local.get $ptr)\n)\n\n;; free"
	.ascii	" - free an allocated block given a pointer to it\n(func $wax"
	.ascii	"::free (param $ptr i32)\n  (local $hdr i32)\n  (local $ftr i"
	.ascii	"32)\n  (local $size i32)\n  (local $prev_hdr i32)\n  (local "
	.ascii	"$prev_ftr i32)\n  (local $prev_size i32)\n  (local $prev_fre"
	.ascii	"e i32)\n  (local $next_hdr i32)\n  (local $next_ftr i32)\n  "
	.ascii	"(local $next_size i32)\n  (local $next_free i32)\n  \n  ;; s"
	.ascii	"tep I: mark the block as free\n\n  (local.set $hdr (i32.sub "
	.ascii	"(local.get $ptr) (i32.const 4)))\n  (local.set $size (call $"
	.ascii	"wax::hdr_get_size (local.get $hdr)))\n  (local.set $ftr (i32"
	.ascii	".add (i32.add (local.get $hdr) (local.get $size)) (i32.const"
	.ascii	" 4)))\n\n  (call $wax::hdr_set_free (local.get $hdr) (i32.co"
	.ascii	"nst 1))\n  (call $wax::hdr_set_free (local.get $ftr) (i32.co"
	.ascii	"nst 1))\n\n  ;; step II: try coalasce\n\n  ;; coalasce with "
	.ascii	"previous block\n\n  ;; check that we're not already the firs"
	.ascii	"t block\n  (if (i32.eq (local.get $hdr) (global.get $wax::mi"
	.ascii	"n_addr)) (then)(else\n\n    ;; read info about previous bloc"
	.ascii	"k\n    (local.set $prev_ftr (i32.sub (local.get $hdr) (i32.c"
	.ascii	"onst 4)))\n    (local.set $prev_size (call $wax::hdr_get_siz"
	.ascii	"e (local.get $prev_ftr)))\n    (local.set $prev_hdr \n      "
	.ascii	"(i32.sub (i32.sub (local.get $prev_ftr) (local.get $prev_siz"
	.ascii	"e)) (i32.const 4))\n    )\n\n    ;; check if previous block "
	.ascii	"is free -> merge them\n    (if (i32.eqz (call $wax::hdr_get_"
	.ascii	"free (local.get $prev_ftr"
	.ascii	"))) (then) (else\n      (local.set $size (i32.add (i32.add ("
	.ascii	"local.get $size) (local.get $prev_size)) (i32.const 8)))\n  "
	.ascii	"    (call $wax::hdr_set_size (local.get $prev_hdr) (local.ge"
	.ascii	"t $size))\n      (call $wax::hdr_set_size (local.get $ftr) ("
	.ascii	"local.get $size))\n\n      ;; set current header pointer to "
	.ascii	"previous header\n      (local.set $hdr (local.get $prev_hdr)"
	.ascii	")\n    ))\n  ))\n\n  ;; coalasce with next block\n\n  (local"
	.ascii	".set $next_hdr (i32.add (local.get $ftr) (i32.const 4)))\n\n"
	.ascii	"  ;; check that we're not already the last block\n  (if (i32"
	.ascii	".eq (local.get $next_hdr) (global.get $wax::max_addr)) (then"
	.ascii	")(else\n    \n    ;; read info about next block\n    (local."
	.ascii	"set $next_size (call $wax::hdr_get_size (local.get $next_hdr"
	.ascii	")))\n    (local.set $next_ftr \n      (i32.add (i32.add (loc"
	.ascii	"al.get $next_hdr) (local.get $next_size)) (i32.const 4))\n  "
	.ascii	"  )\n\n    ;; check if next block is free -> merge them\n   "
	.ascii	" (if (i32.eqz (call $wax::hdr_get_free (local.get $next_hdr)"
	.ascii	")) (then) (else\n      (local.set $size (i32.add (i32.add (l"
	.ascii	"ocal.get $size) (local.get $next_size)) (i32.const 8)))\n   "
	.ascii	"   (call $wax::hdr_set_size (local.get $hdr) (local.get $siz"
	.ascii	"e))\n      (call $wax::hdr_set_size (local.get $next_ftr) (l"
	.ascii	"ocal.get $size))\n    ))\n\n  ))\n\n)\n;; copy a block of me"
	.ascii	"mory over, from src pointer to dst pointer\n;; WebAssembly s"
	.ascii	"eems to be planning to support memory.copy\n;; until then, t"
	.ascii	"his function uses a loop and i32.store8/load8\n(func $wax::m"
	.ascii	"emcpy (param $dst i32) (param $src i32) (param $n_bytes i32)"
	.ascii	"\n  (local $ptr i32)\n  (local $offset i32)\n  (local $data "
	.ascii	"i32)\n\n  (if (i32.eqz (local.get $n_bytes))(then\n    retur"
	.ascii	"n\n  ))\n\n  (local.set $offset (i32.const 0))\n\n  loop $cp"
	.ascii	"y\n    (local.set $data (i32.load8_u (i32.add (local.get $sr"
	.ascii	"c) (local.get $offset))))\n    (i32.store8 (i32.add (local.g"
	.ascii	"et $dst) (local.get $offset)) (local.get $data))\n\n    (loc"
	.ascii	"al.set $offset (i32.add (local.get $offset) (i32.const 1)))\n"
	.ascii	"    (br_if $cpy (i32.lt_u (local.get $offset) (local.get $n_"
	.ascii	"bytes)))\n  end\n)\n\n;; reallocate memory to new size\n;; c"
	.ascii	"urrently does no"
	.ascii	"t support contraction\n;; nothing will happen if n_bytes is "
	.ascii	"smaller than current payload size\n(func $wax::realloc (para"
	.ascii	"m $ptr i32) (param $n_bytes i32) (result i32)\n  (local $hdr"
	.ascii	" i32)\n  (local $next_hdr i32)\n  (local $next_ftr i32)\n  ("
	.ascii	"local $next_size i32)\n  (local $ftr i32)\n  (local $size i3"
	.ascii	"2)\n  (local $rest_hdr i32)\n  (local $rest_size i32)\n  (lo"
	.ascii	"cal $new_ptr i32)\n\n  (local.set $hdr (i32.sub (local.get $"
	.ascii	"ptr) (i32.const 4)))\n  (local.set $size (call $wax::hdr_get"
	.ascii	"_size (local.get $hdr)))\n\n  (if (i32.gt_u (local.get $n_by"
	.ascii	"tes) (local.get $size)) (then) (else\n    (local.get $ptr)\n"
	.ascii	"    return\n  ))\n\n  ;; payload size is aligned to multiple"
	.ascii	" of 4\n  (local.set $n_bytes (call $wax::align4 (local.get $"
	.ascii	"n_bytes)))\n\n  (local.set $next_hdr (i32.add (i32.add (loca"
	.ascii	"l.get $hdr) (local.get $size)) (i32.const 8)))\n\n  ;; Metho"
	.ascii	"d I: try to expand the current block\n\n  ;; check that we'r"
	.ascii	"e not already the last block\n  (if (i32.lt_u (local.get $ne"
	.ascii	"xt_hdr) (global.get $wax::max_addr) )(then\n    (if (call $w"
	.ascii	"ax::hdr_get_free (local.get $next_hdr)) (then\n\n      (loca"
	.ascii	"l.set $next_size (call $wax::hdr_get_size (local.get $next_h"
	.ascii	"dr)))\n      (local.set $rest_size (i32.sub \n        (local"
	.ascii	".get $next_size)\n        (i32.sub (local.get $n_bytes) (loc"
	.ascii	"al.get $size))\n      ))\n      (local.set $next_ftr (i32.ad"
	.ascii	"d (i32.add (local.get $next_hdr) (local.get $next_size)) (i3"
	.ascii	"2.const 4)))\n\n      ;; next block is big enough to be spli"
	.ascii	"t into two\n      (if (i32.gt_s (local.get $rest_size) (i32."
	.ascii	"const 0) ) (then\n        \n        (call $wax::hdr_set_size"
	.ascii	" (local.get $hdr) (local.get $n_bytes))\n        \n        ("
	.ascii	"local.set $ftr (i32.add (i32.add (local.get $hdr) (local.get"
	.ascii	" $n_bytes) ) (i32.const 4)))\n        (call $wax::hdr_set_si"
	.ascii	"ze (local.get $ftr) (local.get $n_bytes))\n        (call $wa"
	.ascii	"x::hdr_set_free (local.get $ftr) (i32.const 0))\n\n        ("
	.ascii	"local.set $rest_hdr (i32.add (local.get $ftr) (i32.const 4) "
	.ascii	"))\n        (call $wax::hdr_set_size (local.get $rest_hdr) ("
	.ascii	"local.get $rest_size))\n        (call $wax::hdr_set_free (lo"
	.ascii	"cal.get $r"
	.ascii	"est_hdr) (i32.const 1))\n\n        (call $wax::hdr_set_size "
	.ascii	"(local.get $next_ftr) (local.get $rest_size))\n        (call"
	.ascii	" $wax::hdr_set_free (local.get $next_ftr) (i32.const 1))\n\n"
	.ascii	"        (local.get $ptr)\n        return\n\n      ;; next bl"
	.ascii	"ock is not big enough to be split, but is\n      ;; big enou"
	.ascii	"gh to merge with the current one into one\n      )(else (if "
	.ascii	"(i32.gt_s (local.get $rest_size) (i32.const -9) ) (then\n   "
	.ascii	"   \n        (local.set $size (i32.add (i32.add (local.get $"
	.ascii	"size) (i32.const 8) ) (local.get $next_size)))\n        (cal"
	.ascii	"l $wax::hdr_set_size (local.get $hdr) (local.get $size))\n  "
	.ascii	"      (call $wax::hdr_set_size (local.get $next_ftr) (local."
	.ascii	"get $size))\n        (call $wax::hdr_set_free (local.get $ne"
	.ascii	"xt_ftr) (i32.const 0))\n\n        (local.get $ptr)\n        "
	.ascii	"return\n      ))))\n\n    ))\n  ))\n\n  ;; Method II: alloca"
	.ascii	"te a new block and copy over\n\n  (local.set $new_ptr (call "
	.ascii	"$wax::malloc (local.get $n_bytes)))\n  (call $wax::memcpy (l"
	.ascii	"ocal.get $new_ptr) (local.get $ptr) (local.get $size))\n  (c"
	.ascii	"all $wax::free (local.get $ptr))\n  (local.get $new_ptr)\n\n"
	.ascii	")\n\n(func $wax::calloc (param $n_bytes i32) (result i32)\n "
	.ascii	" (local $ptr i32)\n  (local $offset i32)\n  (local.set $ptr "
	.ascii	"(call $wax::malloc (local.get $n_bytes)))\n  (local.set $off"
	.ascii	"set (i32.const 0))\n  loop $zero\n    (if (i32.lt_u (local.g"
	.ascii	"et $offset) (local.get $n_bytes)) (then\n      (i32.store8 ("
	.ascii	"i32.add (local.get $offset) (local.get $ptr) ) (i32.const 0)"
	.ascii	")\n      (local.set $offset (i32.add (local.get $offset) (i3"
	.ascii	"2.const 1)))\n      (br $zero)\n    ))\n  end\n  (local.get "
	.ascii	"$ptr)\n  return\n)\n\n(func $wax::memmove (param $dst i32) ("
	.ascii	"param $src i32) (param $n_bytes i32)\n  (local $ptr i32)\n  "
	.ascii	"(local $offset i32)\n  (local $data i32)\n\n  (if (i32.eqz ("
	.ascii	"local.get $n_bytes))(then\n    return\n  ))\n  \n  (if (i32."
	.ascii	"gt_u (local.get $dst) (local.get $src)) (then\n    (local.se"
	.ascii	"t $offset (i32.sub (local.get $n_bytes) (i32.const 1)))\n   "
	.ascii	" loop $cpy_rev\n      (local.set $data (i32.load8_u (i32.add"
	.ascii	" (local.get $src) (local.get $offset))))\n      (i32.store8 "
	.ascii	"(i32.add (local.get $d"
	.ascii	"st) (local.get $offset)) (local.get $data))\n\n      (local."
	.ascii	"set $offset (i32.sub (local.get $offset) (i32.const 1)))\n  "
	.ascii	"    (br_if $cpy_rev (i32.gt_s (local.get $offset) (i32.const"
	.ascii	" -1)))\n    end\n  \n  )(else\n    (local.set $offset (i32.c"
	.ascii	"onst 0))\n    loop $cpy\n      (local.set $data (i32.load8_u"
	.ascii	" (i32.add (local.get $src) (local.ge"
	.string	"t $offset))))\n      (i32.store8 (i32.add (local.get $dst) (local.get $offset)) (local.get $data))\n\n      (local.set $offset (i32.add (local.get $offset) (i32.const 1)))\n      (br_if $cpy (i32.lt_u (local.get $offset) (local.get $n_bytes)))\n    end\n  ))\n)\n\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_malloc_wat, @object
	.size	TEXT_std_malloc_wat, 8
TEXT_std_malloc_wat:
	.quad	.LC12
	.globl	TEXT_std_map_wat
	.section	.rodata
	.align 8
.LC13:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;                MAP               ;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;; adapted from http"
	.ascii	"s://github.com/LingDong-/wasm-fun\n\n;;   Hash table (separa"
	.ascii	"te chaining with linked lists)\n;;   similar to C++ map<T,T>"
	.ascii	".\n;;\n;;   Entire key is stored in map node; val is 32 bit "
	.ascii	"int/float/pointer\n;;\n;;   Functions involving keys have tw"
	.ascii	"o versions, *_i and *_h.\n;;   _i takes an i32 as key direct"
	.ascii	"ly (for simple small keys), \n;;   while _h versions read th"
	.ascii	"e key from the heap given a \n;;   pointer and a byte count "
	.ascii	"(for larger keys)\n;;\n;;   +-----------+\n;;   |num_buckets"
	.ascii	"|          ,----------------------.\n;;   |-----------|     "
	.ascii	"   +-|-------------------+  |  +---------------------+\n;;  "
	.ascii	" | bucket 0  |------->|next|key_size|key|val|  `->|next|key_"
	.ascii	"size|key|val|\n;;   |-----------|        +------------------"
	.ascii	"---+     +---------------------+\n;;   | bucket 1  |\n;;   |"
	.ascii	"-----------|        +---------------------+\n;;   | bucket 2"
	.ascii	"  |------->|next|key_size|key|val|\n;;   |-----------|      "
	.ascii	"  +---------------------+\n;;   | ......... |\n\n\n;; struct"
	.ascii	" map{\n;;   int num_buckets;\n;;   int length;\n;;   mapnode"
	.ascii	"* bucket0;\n;;   mapnode* bucket1;\n;;   mapnode* bucket2;\n"
	.ascii	";;   ...\n;; }\n;; struct mapnode{\n;;   mapnode* next;\n;; "
	.ascii	"  int key_size;\n;;   key_t key;\n;;   int val;\n;; }\n\n;; "
	.ascii	"(internal) getters and setters for map struct\n\n(func $wax:"
	.ascii	":_map_get_num_buckets (param $m i32) (result i32)\n  (i32.lo"
	.ascii	"ad (local.get $m))\n)\n(func $wax::_map_set_num_buckets (par"
	.ascii	"am $m i32) (param $num_buckets i32)\n  (i32.store (local.get"
	.ascii	" $m) (local.get $num_buckets))\n)\n(func $wax::map_length (p"
	.ascii	"aram $m i32) (result i32)\n  (i32.load (i32.add (local.get $"
	.ascii	"m) (i32.const 4)))\n)\n(func $wax::_map_inc_length (param $m"
	.ascii	" i32) (param $dx i32)\n  (local $l i32)\n  (local $o i32)\n "
	.ascii	" (local.set $o (i32.add (local.get $m) (i32.const 4)))\n  (l"
	.ascii	"ocal.set $l (i32.load"
	.ascii	" (local.get $o)))\n  (i32.store (local.get $o) (i32.add (loc"
	.ascii	"al.get $l) (local.get $dx)))\n)\n(func $wax::_map_get_bucket"
	.ascii	" (param $m i32) (param $i i32) (result i32)\n  (i32.load (i3"
	.ascii	"2.add \n    (i32.add (local.get $m) (i32.const 8)) \n    (i3"
	.ascii	"2.mul (local.get $i) (i32.const 4))\n  ))\n)\n(func $wax::_m"
	.ascii	"ap_set_bucket (param $m i32) (param $i i32) (param $ptr i32)"
	.ascii	"\n  (i32.store (i32.add \n    (i32.add (local.get $m) (i32.c"
	.ascii	"onst 8)) \n    (i32.mul (local.get $i) (i32.const 4))\n  ) ("
	.ascii	"local.get $ptr) )\n)\n\n;; (internal) getters and setters fo"
	.ascii	"r map node struct\n\n(func $wax::_mapnode_get_next (param $m"
	.ascii	" i32) (result i32)\n  (i32.load (local.get $m))\n)\n(func $w"
	.ascii	"ax::_mapnode_get_key_size (param $m i32) (result i32)\n  (i3"
	.ascii	"2.load (i32.add (local.get $m) (i32.const 4)))\n)\n(func $wa"
	.ascii	"x::_mapnode_get_key_ptr (param $m i32) (result i32)\n  (i32."
	.ascii	"add (local.get $m) (i32.const 8))\n)\n(func $wax::_mapnode_g"
	.ascii	"et_val_ptr (param $m i32) (result i32)\n  (local $key_size i"
	.ascii	"32)\n  (local.set $key_size (call $wax::_mapnode_get_key_siz"
	.ascii	"e (local.get $m)))\n  (i32.add (i32.add (local.get $m) (i32."
	.ascii	"const 8)) (local.get $key_size))\n)\n\n(func $wax::_mapnode_"
	.ascii	"set_next (param $m i32) (param $v i32)\n  (i32.store (local."
	.ascii	"get $m) (local.get $v))\n)\n(func $wax::_mapnode_set_key_siz"
	.ascii	"e (param $m i32) (param $v i32)\n  (i32.store (i32.add (loca"
	.ascii	"l.get $m) (i32.const 4)) (local.get $v))\n)\n\n(func $wax::_"
	.ascii	"mapnode_set_key_h (param $m i32) (param $key_ptr i32) (param"
	.ascii	" $key_size i32)\n  (local $ptr i32)\n  (local $i i32)\n  (lo"
	.ascii	"cal.set $ptr (call $wax::_mapnode_get_key_ptr (local.get $m)"
	.ascii	"))\n  loop $loop_mapnode_set_key_h\n    (i32.store8 \n      "
	.ascii	"(i32.add (local.get $ptr) (local.get $i))\n      (i32.load8_"
	.ascii	"u (i32.add (local.get $key_ptr) (local.get $i)))\n    )\n   "
	.ascii	" (local.set $i (i32.add (local.get $i) (i32.const 1)))\n    "
	.ascii	"(br_if $loop_mapnode_set_key_h (i32.lt_u (local.get $i) (loc"
	.ascii	"al.get $key_size) ))\n  end\n)\n(func $wax::_mapnode_set_key"
	.ascii	"_i (param $m i32) (param $key i32)\n  (i32.store\n    (call "
	.ascii	"$wax::_mapnode_get_key_ptr (local.get $m))\n    (local.get $"
	.ascii	"key) \n  )\n)\n\n;; "
	.ascii	"Hash functions\n\n;; hash an integer with SHR3\n(func $wax::"
	.ascii	"_map_hash_i (param $num_buckets i32) (param $key i32) (resul"
	.ascii	"t i32)\n  (local.set $key (i32.xor (local.get $key) (i32.shl"
	.ascii	"   (local.get $key) (i32.const 17))))\n  (local.set $key (i3"
	.ascii	"2.xor (local.get $key) (i32.shr_u (local.get $key) (i32.cons"
	.ascii	"t 13))))\n  (local.set $key (i32.xor (local.get $key) (i32.s"
	.ascii	"hl   (local.get $key) (i32.const 5 ))))\n  (i32.rem_u (local"
	.ascii	".get $key) (local.get $num_buckets))\n)\n\n;; hash a sequenc"
	.ascii	"e of bytes by xor'ing them into an integer and calling _map_"
	.ascii	"hash_i\n(func $wax::_map_hash_h (param $num_buckets i32) (pa"
	.ascii	"ram $key_ptr i32) (param $key_size i32) (result i32)\n  (loc"
	.ascii	"al $key i32)\n  (local $i i32)\n  (local $byte i32)\n\n  (lo"
	.ascii	"cal.set $i (i32.const 0))\n  loop $loop_map_hash_h\n    (loc"
	.ascii	"al.set $byte (i32.load8_u (i32.add (local.get $key_ptr) (loc"
	.ascii	"al.get $i))))\n    \n    (local.set $key\n      (i32.xor (lo"
	.ascii	"cal.get $key) \n        (i32.shl (local.get $byte) (i32.mul "
	.ascii	"(i32.const 8) (i32.rem_u (local.get $i) (i32.const 4))))\n  "
	.ascii	"    )\n    )\n    (local.set $i (i32.add (local.get $i) (i32"
	.ascii	".const 1)))\n    (br_if $loop_map_hash_h (i32.lt_u (local.ge"
	.ascii	"t $i) (local.get $key_size) ))\n  end\n\n  (call $wax::_map_"
	.ascii	"hash_i (local.get $num_buckets) (local.get $key))\n)\n\n;; i"
	.ascii	"nitialize a new map, given number of buckets\n;; returns a p"
	.ascii	"ointer to the map\n(func $wax::map_new (param $num_buckets i"
	.ascii	"32) (result i32)\n  (local $m i32)\n  (local $i i32)\n  (loc"
	.ascii	"al.set $m (call $wax::malloc (i32.add (i32.mul (local.get $n"
	.ascii	"um_buckets) (i32.const 4)) (i32.const 8)) ))\n  (call $wax::"
	.ascii	"_map_set_num_buckets (local.get $m) (local.get $num_buckets)"
	.ascii	")\n\n  (local.set $i (i32.const 0))\n  loop $loop_map_new_cl"
	.ascii	"ear\n    (call $wax::_map_set_bucket (local.get $m) (local.g"
	.ascii	"et $i) (i32.const 0))\n    (local.set $i (i32.add (local.get"
	.ascii	" $i) (i32.const 1)))\n    (br_if $loop_map_new_clear (i32.lt"
	.ascii	"_u (local.get $i) (local.get $num_buckets) ))\n  end\n  (loc"
	.ascii	"al.get $m)\n)\n\n;; compare the key stored in a node agianst"
	.ascii	" a key on the heap\n(func $wax::_map_cmp_key_h (param $node "
	.ascii	"i32) (para"
	.ascii	"m $key_ptr i32) (param $key_size i32) (result i32)\n  (local"
	.ascii	" $key_ptr0 i32)\n  (local $key_size0 i32)\n  (local $i i32)\n"
	.ascii	"  (local.set $key_ptr0 (call $wax::_mapnode_get_key_ptr (loc"
	.ascii	"al.get $node)))\n  (local.set $key_size0 (call $wax::_mapnod"
	.ascii	"e_get_key_size (local.get $node)))\n  (if (i32.eq (local.get"
	.ascii	" $key_size0) (local.get $key_size))(then\n    (local.set $i "
	.ascii	"(i32.const 0))\n    loop $loop_map_cmp_key_h\n\n      (if (i"
	.ascii	"32.eq \n        (i32.load8_u (i32.add (local.get $key_ptr0) "
	.ascii	"(local.get $i)))\n        (i32.load8_u (i32.add (local.get $"
	.ascii	"key_ptr ) (local.get $i)))\n      )(then)(else\n        (i32"
	.ascii	".const 0)\n        return\n      ))\n      (local.set $i (i3"
	.ascii	"2.add (local.get $i) (i32.const 1)))\n      (br_if $loop_map"
	.ascii	"_cmp_key_h (i32.lt_u (local.get $i) (local.get $key_size) ))"
	.ascii	"\n    end\n    (i32.const 1)\n    return\n  ))\n  (i32.const"
	.ascii	" 0)\n  return\n)\n\n;; compare the key stored in a node agia"
	.ascii	"nst a key passed directly as i32 argument\n(func $wax::_map_"
	.ascii	"cmp_key_i (param $node i32) (param $key i32) (result i32)\n "
	.ascii	" (local $key_ptr0 i32)\n  (local $key_size0 i32)\n  (local.s"
	.ascii	"et $key_ptr0 (call $wax::_mapnode_get_key_ptr (local.get $no"
	.ascii	"de)))\n  (local.set $key_size0 (call $wax::_mapnode_get_key_"
	.ascii	"size (local.get $node)))\n\n  (if (i32.eq (local.get $key_si"
	.ascii	"ze0) (i32.const 4))(then\n    (i32.eq (i32.load (local.get $"
	.ascii	"key_ptr0))  (local.get $key) )\n    return\n  ))\n  (i32.con"
	.ascii	"st 0)\n  return\n)\n\n;; insert a new entry to the map, taki"
	.ascii	"ng a key stored on the heap\n;; m : the map\n;; key_ptr: poi"
	.ascii	"nter to the key on the heap\n;; key_size: size of the key in"
	.ascii	" bytes\n;; returns pointer to the value inserted in the map "
	.ascii	"for the user to write at\n\n(func $wax::map_set_h (param $m "
	.ascii	"i32) (param $key_ptr i32) (param $val i32)\n  (local $num_bu"
	.ascii	"ckets i32)\n  (local $hash i32)\n  (local $it i32)\n  (local"
	.ascii	" $node_size i32)\n  (local $prev i32)\n  (local $key_size i3"
	.ascii	"2)\n  (local.set $key_size (i32.add (call $wax::str_len (loc"
	.ascii	"al.get $key_ptr)) (i32.const 1)))\n\n  (local.set $num_bucke"
	.ascii	"ts (call $wax::_map_get_num_buckets (local.get $m)))\n  (loc"
	.ascii	"al.set $hash (cal"
	.ascii	"l $wax::_map_hash_h (local.get $num_buckets) (local.get $key"
	.ascii	"_ptr) (local.get $key_size)))\n  \n  (local.set $it (call $w"
	.ascii	"ax::_map_get_bucket (local.get $m) (local.get $hash)))\n  (l"
	.ascii	"ocal.set $node_size (i32.add (local.get $key_size) (i32.cons"
	.ascii	"t 12) ))\n\n\n  (if (i32.eqz (local.get $it))(then\n    (loc"
	.ascii	"al.set $it (call $wax::malloc (local.get $node_size)))\n\n  "
	.ascii	"  (call $wax::_mapnode_set_key_size (local.get $it) (local.g"
	.ascii	"et $key_size))\n    (call $wax::_mapnode_set_next (local.get"
	.ascii	" $it) (i32.const 0))\n    (call $wax::_mapnode_set_key_h (lo"
	.ascii	"cal.get $it) (local.get $key_ptr) (local.get $key_size))\n\n"
	.ascii	"    (call $wax::_map_set_bucket (local.get $m) (local.get $h"
	.ascii	"ash) (local.get $it))\n\n    (i32.store (call $wax::_mapnode"
	.ascii	"_get_val_ptr (local.get $it)) (local.get $val))\n    (call $"
	.ascii	"wax::_map_inc_length (local.get $m) (i32.const 1))\n    retu"
	.ascii	"rn\n  )(else\n    (local.set $prev (i32.const 0))\n    loop "
	.ascii	"$loop_map_set_h\n      (if (i32.eqz (local.get $it))(then)(e"
	.ascii	"lse\n        (if (call $wax::_map_cmp_key_h (local.get $it) "
	.ascii	"(local.get $key_ptr) (local.get $key_size) )(then\n         "
	.ascii	" (local.set $it (call $wax::realloc (local.get $it) (local.g"
	.ascii	"et $node_size)))\n\n          (if (i32.eqz (local.get $prev)"
	.ascii	") (then\n            (call $wax::_map_set_bucket (local.get "
	.ascii	"$m) (local.get $hash) (local.get $it))\n          )(else\n  "
	.ascii	"          (call $wax::_mapnode_set_next (local.get $prev) (l"
	.ascii	"ocal.get $it))\n          ))\n          (i32.store (call $wa"
	.ascii	"x::_mapnode_get_val_ptr (local.get $it)) (local.get $val))\n"
	.ascii	"          return\n        ))\n        (local.set $prev (loca"
	.ascii	"l.get $it))\n        (local.set $it (call $wax::_mapnode_get"
	.ascii	"_next (local.get $it)))\n        (br $loop_map_set_h)\n     "
	.ascii	" ))\n    end\n    (local.set $it (call $wax::malloc (local.g"
	.ascii	"et $node_size)))\n    (call $wax::_mapnode_set_key_size (loc"
	.ascii	"al.get $it) (local.get $key_size))\n    (call $wax::_mapnode"
	.ascii	"_set_next (local.get $it) (i32.const 0))\n    (call $wax::_m"
	.ascii	"apnode_set_key_h (local.get $it) (local.get $key_ptr) (local"
	.ascii	".get $key_size))\n\n    (call $wax::_mapnode_set_next (local"
	.ascii	".ge"
	.ascii	"t $prev) (local.get $it))\n    (i32.store (call $wax::_mapno"
	.ascii	"de_get_val_ptr (local.get $it)) (local.get $val))\n    (call"
	.ascii	" $wax::_map_inc_length (local.get $m) (i32.const 1))\n    re"
	.ascii	"turn\n  ))\n\n)\n\n;; insert a new entry to the map, taking "
	.ascii	"a key passed directly as i32 argument\n;; m : the map\n;; ke"
	.ascii	"y: the key\n;; returns pointer to the value inserted in the "
	.ascii	"map for the user to write at\n\n(func $wax::map_set_i (param"
	.ascii	" $m i32) (param $key i32)  (param $val i32)\n  (local $num_b"
	.ascii	"uckets i32)\n  (local $hash i32)\n  (local $it i32)\n  (loca"
	.ascii	"l $node_size i32)\n  (local $prev i32)\n\n  (local.set $num_"
	.ascii	"buckets (call $wax::_map_get_num_buckets (local.get $m)))\n "
	.ascii	" (local.set $hash (call $wax::_map_hash_i (local.get $num_bu"
	.ascii	"ckets) (local.get $key)))\n  \n  (local.set $it (call $wax::"
	.ascii	"_map_get_bucket (local.get $m) (local.get $hash)))\n  (local"
	.ascii	".set $node_size (i32.const 16) )\n\n\n  (if (i32.eqz (local."
	.ascii	"get $it))(then\n    (local.set $it (call $wax::malloc (local"
	.ascii	".get $node_size)))\n\n    (call $wax::_mapnode_set_key_size "
	.ascii	"(local.get $it) (i32.const 4))\n    (call $wax::_mapnode_set"
	.ascii	"_next (local.get $it) (i32.const 0))\n    (call $wax::_mapno"
	.ascii	"de_set_key_i (local.get $it) (local.get $key))\n\n    (call "
	.ascii	"$wax::_map_set_bucket (local.get $m) (local.get $hash) (loca"
	.ascii	"l.get $it))\n\n    (i32.store (call $wax::_mapnode_get_val_p"
	.ascii	"tr (local.get $it)) (local.get $val))\n    (call $wax::_map_"
	.ascii	"inc_length (local.get $m) (i32.const 1))\n    return\n  )(el"
	.ascii	"se\n    (local.set $prev (i32.const 0))\n    loop $loop_map_"
	.ascii	"set_i\n      (if (i32.eqz (local.get $it))(then)(else\n     "
	.ascii	"   (if (call $wax::_map_cmp_key_i (local.get $it) (local.get"
	.ascii	" $key) )(then\n          (local.set $it (call $wax::realloc "
	.ascii	"(local.get $it) (local.get $node_size)))\n\n          (if (i"
	.ascii	"32.eqz (local.get $prev)) (then\n            (call $wax::_ma"
	.ascii	"p_set_bucket (local.get $m) (local.get $hash) (local.get $it"
	.ascii	"))\n          )(else\n            (call $wax::_mapnode_set_n"
	.ascii	"ext (local.get $prev) (local.get $it))\n          ))\n      "
	.ascii	"    (i32.store (call $wax::_mapnode_get_val_ptr (local.get $"
	.ascii	"it)) (local"
	.ascii	".get $val))\n          return\n        ))\n        (local.se"
	.ascii	"t $prev (local.get $it))\n        (local.set $it (call $wax:"
	.ascii	":_mapnode_get_next (local.get $it)))\n        (br $loop_map_"
	.ascii	"set_i)\n      ))\n    end\n    (local.set $it (call $wax::ma"
	.ascii	"lloc (local.get $node_size)))\n    (call $wax::_mapnode_set_"
	.ascii	"key_size (local.get $it) (i32.const 4))\n    (call $wax::_ma"
	.ascii	"pnode_set_next (local.get $it) (i32.const 0))\n    (call $wa"
	.ascii	"x::_mapnode_set_key_i (local.get $it) (local.get $key))\n\n "
	.ascii	"   (call $wax::_mapnode_set_next (local.get $prev) (local.ge"
	.ascii	"t $it))\n    (i32.store (call $wax::_mapnode_get_val_ptr (lo"
	.ascii	"cal.get $it)) (local.get $val))\n    (call $wax::_map_inc_le"
	.ascii	"ngth (local.get $m) (i32.const 1))\n    return\n  ))\n\n)\n\n"
	.ascii	";; lookup a key for its value in the map, taking a key store"
	.ascii	"d on the heap\n;; m : the map\n;; key_ptr: pointer to the ke"
	.ascii	"y on the heap\n;; key_size: size of the key in bytes\n;; ret"
	.ascii	"urns pointer to the value in the map, NULL (0) if not found."
	.ascii	"\n\n(func $wax::map_get_h (param $m i32) (param $key_ptr i32"
	.ascii	") (result i32)\n  (local $num_buckets i32)\n  (local $hash i"
	.ascii	"32)\n  (local $it i32)\n  (local $key_size i32)\n  (local.se"
	.ascii	"t $key_size (i32.add (call $wax::str_len (local.get $key_ptr"
	.ascii	")) (i32.const 1)))\n\n  (local.set $num_buckets (call $wax::"
	.ascii	"_map_get_num_buckets (local.get $m)))\n  (local.set $hash (c"
	.ascii	"all $wax::_map_hash_h (local.get $num_buckets) (local.get $k"
	.ascii	"ey_ptr) (local.get $key_size)))\n  (local.set $it (call $wax"
	.ascii	"::_map_get_bucket (local.get $m) (local.get $hash)))\n\n  lo"
	.ascii	"op $loop_map_get_h\n    (if (i32.eqz (local.get $it))(then)("
	.ascii	"else\n      (if (call $wax::_map_cmp_key_h (local.get $it) ("
	.ascii	"local.get $key_ptr) (local.get $key_size) )(then\n        (i"
	.ascii	"32.load (call $wax::_mapnode_get_val_ptr (local.get $it)))\n"
	.ascii	"        return\n      ))\n      (local.set $it (call $wax::_"
	.ascii	"mapnode_get_next (local.get $it)))\n      (br $loop_map_get_"
	.ascii	"h)\n    ))\n  end\n\n  (i32.const 0)\n)\n\n;; lookup a key f"
	.ascii	"or its value in the map, taking a key passed directly as i32"
	.ascii	" argument\n;; m : the map\n;; key : the key\n;; returns poin"
	.ascii	"ter to the val"
	.ascii	"ue in the map, NULL (0) if not found.\n\n(func $wax::map_get"
	.ascii	"_i (param $m i32) (param $key i32) (result i32)\n  (local $n"
	.ascii	"um_buckets i32)\n  (local $hash i32)\n  (local $it i32)\n\n "
	.ascii	" (local.set $num_buckets (call $wax::_map_get_num_buckets (l"
	.ascii	"ocal.get $m)))\n  (local.set $hash (call $wax::_map_hash_i ("
	.ascii	"local.get $num_buckets) (local.get $key)))\n  (local.set $it"
	.ascii	" (call $wax::_map_get_bucket (local.get $m) (local.get $hash"
	.ascii	")))\n\n  loop $loop_map_get_i\n    (if (i32.eqz (local.get $"
	.ascii	"it))(then)(else\n      (if (call $wax::_map_cmp_key_i (local"
	.ascii	".get $it) (local.get $key) )(then\n        (i32.load (call $"
	.ascii	"wax::_mapnode_get_val_ptr (local.get $it)))\n        return\n"
	.ascii	"      ))\n      (local.set $it (call $wax::_mapnode_get_next"
	.ascii	" (local.get $it)))\n      (br $loop_map_get_i)\n    ))\n  en"
	.ascii	"d\n\n  (i32.const 0)\n)\n\n;; remove a key-value pair from t"
	.ascii	"he map, given a key stored on the heap\n;; m : the map\n;; k"
	.ascii	"ey_ptr: pointer to the key on the heap\n;; key_size: size of"
	.ascii	" the key in bytes\n\n(func $wax::map_remove_h (param $m i32)"
	.ascii	" (param $key_ptr i32) (param $key_size i32)\n  (local $num_b"
	.ascii	"uckets i32)\n  (local $hash i32)\n  (local $it i32)\n  (loca"
	.ascii	"l $prev i32)\n  (local $next i32)\n\n  (local.set $num_bucke"
	.ascii	"ts (call $wax::_map_get_num_buckets (local.get $m)))\n  (loc"
	.ascii	"al.set $hash (call $wax::_map_hash_h (local.get $num_buckets"
	.ascii	") (local.get $key_ptr) (local.get $key_size)))\n  (local.set"
	.ascii	" $it (call $wax::_map_get_bucket (local.get $m) (local.get $"
	.ascii	"hash)))\n  \n  (local.set $prev (i32.const 0))\n\n  loop $lo"
	.ascii	"op_map_remove_h\n    (if (i32.eqz (local.get $it))(then)(els"
	.ascii	"e\n      (if (call $wax::_map_cmp_key_h (local.get $it) (loc"
	.ascii	"al.get $key_ptr) (local.get $key_size) )(then\n        (loca"
	.ascii	"l.set $next (call $wax::_mapnode_get_next (local.get $it)))\n"
	.ascii	"\n        (if (i32.eqz (local.get $prev)) (then\n          ("
	.ascii	"call $wax::_map_set_bucket (local.get $m) (local.get $hash) "
	.ascii	"(local.get $next))\n        )(else\n          (call $wax::_m"
	.ascii	"apnode_set_next (local.get $prev) (local.get $next))\n      "
	.ascii	"  ))\n        (call $wax::free (local.get $it))\n        (ca"
	.ascii	"ll $wax::_ma"
	.ascii	"p_inc_length (local.get $m) (i32.const -1))\n        return\n"
	.ascii	"      ))\n      (local.set $prev (local.get $it))\n      (lo"
	.ascii	"cal.set $it (local.get $next))\n      (br $loop_map_remove_h"
	.ascii	")\n    ))\n  end\n)\n\n;; remove a key-value pair from the m"
	.ascii	"ap, given a key passed directly as i32 argument\n;; m : the "
	.ascii	"map\n;; key : the key\n(func $wax::map_remove_i (param $m i3"
	.ascii	"2) (param $key i32)\n  (local $num_buckets i32)\n  (local $h"
	.ascii	"ash i32)\n  (local $it i32)\n  (local $prev i32)\n  (local $"
	.ascii	"next i32)\n\n  (local.set $num_buckets (call $wax::_map_get_"
	.ascii	"num_buckets (local.get $m)))\n  (local.set $hash (call $wax:"
	.ascii	":_map_hash_i (local.get $num_buckets) (local.get $key)))\n  "
	.ascii	"(local.set $it (call $wax::_map_get_bucket (local.get $m) (l"
	.ascii	"ocal.get $hash)))\n  \n  (local.set $prev (i32.const 0))\n\n"
	.ascii	"  loop $loop_map_remove_i\n    (if (i32.eqz (local.get $it))"
	.ascii	"(then)(else\n      (if (call $wax::_map_cmp_key_i (local.get"
	.ascii	" $it) (local.get $key) )(then\n        (local.set $next (cal"
	.ascii	"l $wax::_mapnode_get_next (local.get $it)))\n\n        (if ("
	.ascii	"i32.eqz (local.get $prev)) (then\n          (call $wax::_map"
	.ascii	"_set_bucket (local.get $m) (local.get $hash) (local.get $nex"
	.ascii	"t))\n        )(else\n          (call $wax::_mapnode_set_next"
	.ascii	" (local.get $prev) (local.get $next))\n        ))\n        ("
	.ascii	"call $wax::free (local.get $it))\n        (call $wax::_map_i"
	.ascii	"nc_length (local.get $m) (i32.const 1))\n        return\n   "
	.ascii	"   ))\n      (local.set $prev (local.get $it))\n      (local"
	.ascii	".set $it (local.get $next))\n      (br $loop_map_remove_i)\n"
	.ascii	"    ))\n  end\n)\n\n\n;; generate a new iterator for travers"
	.ascii	"ing map pairs\n;; in effect, this returns a pointer to the f"
	.ascii	"irst node\n(func $wax::map_iter_new  (param $m i32) (result "
	.ascii	"i32)\n  (local $num_buckets i32)\n  (local $i i32)\n  (local"
	.ascii	" $node i32)\n\n  (local.set $num_buckets (call $wax::_map_ge"
	.ascii	"t_num_buckets (local.get $m)))\n\n  (local.set $i (i32.const"
	.ascii	" 0))\n  loop $loop_map_iter_new\n    (local.set $node (call "
	.ascii	"$wax::_map_get_bucket (local.get $m) (local.get $i)))\n    ("
	.ascii	"if (i32.eqz (local.get $node))(then)(else\n      (local.get "
	.ascii	"$node)\n      return\n"
	.ascii	"    ))\n    (local.set $i (i32.add (local.get $i) (i32.const"
	.ascii	" 1)))\n    (br_if $loop_map_iter_new (i32.lt_u (local.get $i"
	.ascii	") (local.get $num_buckets) ))\n  end\n  (i32.const 0)\n  ret"
	.ascii	"urn\n)\n\n;; increment an interator for traversing map pairs"
	.ascii	"\n;; in effect, this finds the next node of a given node, by"
	.ascii	" first looking\n;; at the linked list, then re-hashing the k"
	.ascii	"ey to look through the rest of the hash table\n(func $wax::m"
	.ascii	"ap_iter_next (param $m i32) (param $iter i32) (result i32)\n"
	.ascii	"  (local $next i32)\n  (local $num_buckets i32)\n  (local $n"
	.ascii	"ode i32)\n  (local $i i32)\n  \n  (local.set $num_buckets (c"
	.ascii	"all $wax::_map_get_num_buckets (local.get $m)))\n\n  (local."
	.ascii	"set $next (call $wax::_mapnode_get_next (local.get $iter)))\n"
	.ascii	"\n  (if (i32.eqz (local.get $next))(then\n\n    (local.set $"
	.ascii	"i (i32.add (call $wax::_map_hash_h\n      (local.get $num_bu"
	.ascii	"ckets)\n      (call $wax::_mapnode_get_key_ptr  (local.get $"
	.ascii	"iter))\n      (call $wax::_mapnode_get_key_size (local.get $"
	.ascii	"iter))\n    ) (i32.const 1)))\n\n    \n    (if (i32.eq (loca"
	.ascii	"l.get $i) (local.get $num_buckets)) (then\n      (i32.const "
	.ascii	"0)\n      return\n    ))\n    \n    loop $loop_map_iter_next"
	.ascii	"\n      (local.set $node (call $wax::_map_get_bucket (local."
	.ascii	"get $m) (local.get $i)))\n      (if (i32.eqz (local.get $nod"
	.ascii	"e))(then)(else\n        (local.get $node)\n        return\n "
	.ascii	"     ))\n      (local.set $i (i32.add (local.get $i) (i32.co"
	.ascii	"nst 1)))\n      (br_if $loop_map_iter_next (i32.lt_u (local."
	.ascii	"get $i) (local.get $num_buckets) ))\n    end\n\n    (i32.con"
	.ascii	"st 0)\n    return\n\n  )(else\n    (local.get $next)\n    re"
	.ascii	"turn\n  ))\n  (i32.const 0)\n  return\n)\n\n;; given a map i"
	.ascii	"terator, get a pointer to the key stored\n(func $wax::map_it"
	.ascii	"er_key_h (param $iter i32) (result i32)\n  (call $wax::_mapn"
	.ascii	"ode_get_key_ptr (local.get $iter))\n)\n;; given a map iterat"
	.ascii	"or, read the key stored as an int\n;; only works if your key"
	.ascii	" is an i32\n(func $wax::map_iter_key_i (param $iter i32) (re"
	.ascii	"sult i32)\n  (i32.load (call $wax::_mapnode_get_key_ptr (loc"
	.ascii	"al.get $iter)))\n)\n;; given a map iterator, get a pointer t"
	.ascii	"o the value stored\n(func"
	.ascii	" $wax::map_iter_val (param $iter i32) (result i32)\n  (i32.l"
	.ascii	"oad (call $wax::_mapnode_get_val_ptr (local.get $iter)))\n)\n"
	.ascii	"\n;; remove all key-values in the map\n(func $wax::map_clear"
	.ascii	" (param $m i32)\n  (local $num_buckets i32)\n  (local $hash "
	.ascii	"i32)\n  (local $it i32)\n\n  (local $next i32)\n\n  (local.s"
	.ascii	"et $num_buckets (call $wax::_map_get_num_buckets (local.get "
	.ascii	"$m)))\n\n  (local.set $hash (i32.const 0))\n\n  loop $loop_m"
	.ascii	"ap_clear_buckets\n\n    (local.set $it (call $wax::_map_get_"
	.ascii	"bucket (local.get $m) (local.get $hash)))\n\n    loop $loop_"
	.ascii	"map_clear_nodes\n      (if (i32.eqz (local.get $it))(then)(e"
	.ascii	"lse\n        (local.set $next (call $wax::_mapnode_get_next "
	.ascii	"(local.get $it)))\n\n        (call $wax::free (local.get $it"
	.ascii	"))\n\n        (local.set $it (local.get $next))\n        (br"
	.ascii	" $loop_map_clear_nodes)\n      ))\n    end\n\n    (call $wax"
	.ascii	"::_map_set_bucket (local.get $m) (local.get $hash) (i32.cons"
	.ascii	"t 0))\n\n    (local.set $hash (i32.add (local.get $hash) (i3"
	.ascii	"2.const 1))"
	.string	")\n    (br_if $loop_map_clear_buckets (i32.lt_u (local.get $hash) (local.get $num_buckets)))\n\n  end  \n)\n\n;; free all allocated memory for a map\n(func $wax::map_free (param $m i32)\n  (call $wax::map_clear (local.get $m))\n  (call $wax::free (local.get $m))\n)\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_map_wat, @object
	.size	TEXT_std_map_wat, 8
TEXT_std_map_wat:
	.quad	.LC13
	.globl	TEXT_std_stack_wat
	.section	.rodata
	.align 8
.LC14:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;               STACK              ;;\n;;                  "
	.ascii	"                ;;\n;;                                  ;;\n"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;; poor man's stack\n"
	.ascii	";; malloc a block of memory and pretend it's the stack, beca"
	.ascii	"use of the apparent lack(?) of stack address in webassembly\n"
	.ascii	"\n(global $wax::stack_indices_ptr (mut i32) (i32.const 0))\n"
	.ascii	"(global $wax::stack_content_ptr (mut i32) (i32.const 0))\n(g"
	.ascii	"lobal $wax::stack_count   (mut i32) (i32.const 32))\n(global"
	.ascii	" $wax::stack_size    (mut i32) (i32.const 128))\n(global $wa"
	.ascii	"x::stack_index   (mut i32) (i32.const 0))\n(global $wax::sta"
	.ascii	"ck_now     (mut i32) (i32.const 0))\n(global $wax::stack_did"
	.ascii	"_init(mut i32) (i32.const 0))\n\n(func $wax::init_stack\n  ("
	.ascii	"global.set $wax::stack_indices_ptr (call $wax::calloc (i32.m"
	.ascii	"ul (global.get $wax::stack_count) (i32.const 4))))\n  (globa"
	.ascii	"l.set $wax::stack_content_ptr (call $wax::malloc (global.get"
	.ascii	" $wax::stack_size)))\n  (global.set $wax::stack_index (i32.c"
	.ascii	"onst 0))\n  (global.set $wax::stack_did_init (i32.const 1))\n"
	.ascii	")\n(func $wax::stack_index_offset (result i32)\n  (i32.add ("
	.ascii	"global.get $wax::stack_indices_ptr) (i32.mul (global.get $wa"
	.ascii	"x::stack_index) (i32.const 4)))\n)\n(func $wax::push_stack\n"
	.ascii	"\n  (if (i32.eqz (global.get $wax::stack_did_init)) (then (c"
	.ascii	"all $wax::init_stack) ))\n\n  (global.set $wax::stack_index "
	.ascii	"(i32.add (global.get $wax::stack_index) (i32.const 1) ))\n\n"
	.ascii	"  (if (i32.ge_u (global.get $wax::stack_index) (global.get $"
	.ascii	"wax::stack_count)) (then\n    (global.set $wax::stack_count "
	.ascii	"(i32.add (global.get $wax::stack_count) (i32.const 128)))\n "
	.ascii	"   (global.set $wax::stack_indices_ptr (call $wax::realloc \n"
	.ascii	"      (global.get $wax::stack_indices_ptr) \n      (i32.mul "
	.ascii	"(global.get $wax::stack_count) (i32.const 4))\n    ))\n  ))\n"
	.ascii	"\n  (i32.store (call $wax::stack_index_offset) (global.get $"
	.ascii	"wax::stack_now) )\n\n)\n(func $wax::pop_stack\n\n  (global.s"
	.ascii	"et $wax::stack_now (i32.load (call $wax::stack_index_offset)"
	.ascii	" "
	.ascii	"))\n  (global.set $wax::stack_index (i32.sub (global.get $wa"
	.ascii	"x::stack_index) (i32.const 1) ))\n  \n)\n(func $wax::alloca "
	.ascii	"(param $n_bytes i32) (result i32)\n  (local $inc i32)\n  (if"
	.ascii	" (i32.ge_u (i32.add (global.get $wax::stack_now) (local.get "
	.ascii	"$n_bytes) ) (global.get $wax::stack_size)) (then\n    (local"
	.ascii	".set $inc (i32.const 512))\n    (if (i32.gt_u (local.get $n_"
	.ascii	"bytes) (local.get $inc)) (then\n      (local.set $inc (call "
	.ascii	"$wax::align4 (local.get $n_bytes)))\n    ))\n    (global.set"
	.ascii	" $wax::stack_size (i32.add (global.get $wax::stack_size) (lo"
	.ascii	"cal.get $inc) ))\n    (global.set $wax::stack_content_ptr\n "
	.ascii	"     (call $wax::realloc (global.get $wax::stack_content_ptr"
	.ascii	") (global.get $wax::stack_size))\n    )\n "
	.string	" ))\n\n  ;; repurpose $inc for ret val\n  (local.set $inc (i32.add (global.get $wax::stack_content_ptr ) (global.get $wax::stack_now)))\n\n  (global.set $wax::stack_now (i32.add (global.get $wax::stack_now) (local.get $n_bytes)))\n\n  (local.get $inc)\n  return\n)\n"
	.section	.data.rel.local
	.align 8
	.type	TEXT_std_stack_wat, @object
	.size	TEXT_std_stack_wat, 8
TEXT_std_stack_wat:
	.quad	.LC14
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"618285.c"
	.text
	.global	TEXT_std_java
	.section	.rodata
	.align	2
.LC0:
	.ascii	"public static <T> void w_arrRemove(ArrayList<T> a, "
	.ascii	"int i, int n){a.subList(i,i+n).clear();}\012public "
	.ascii	"static <T> ArrayList<T> w_arrSlice(ArrayList<T> a, "
	.ascii	"int i, int n){return new ArrayList<T>(a.subList(i,i"
	.ascii	"+n));}\012public static String w_strSlice(String a,"
	.ascii	" int i, int n){return a.substring(i,i+n);}\012publi"
	.ascii	"c static <K,V> V w_mapGet(HashMap<K,V> map, K key, "
	.ascii	"V defaultValue) {V v;return (((v = map.get(key)) !="
	.ascii	" null) || map.containsKey(key))? v: defaultValue;}\012"
	.ascii	"public static boolean w_BOOL(int x){return x!=0;}\012"
	.ascii	"public static int w_INT(boolean x){return x?1:0;}\012"
	.ascii	"public static int w_NOT(int x){return (x==0)?1:0;}\012"
	.ascii	"\000"
	.data
	.align	2
	.type	TEXT_std_java, %object
	.size	TEXT_std_java, 4
TEXT_std_java:
	.word	.LC0
	.global	TEXT_std_c
	.section	.rodata
	.align	2
.LC1:
	.ascii	"#ifndef WAX_STD\012#define WAX_STD\012#include <std"
	.ascii	"lib.h>\012#include <stdio.h>\012#include <string.h>"
	.ascii	"\012#include <stdarg.h>\012#include <stdint.h>\012#"
	.ascii	"include <math.h>\012#define W_MIN(a,b) (((a)<(b))?("
	.ascii	"a):(b))\012#define W_MAX(a,b) (((a)>(b))?(a):(b))\012"
	.ascii	"void *w_malloc(size_t size){void *mem = malloc(size"
	.ascii	");if(!mem){exit(-1);}return mem;}\012void *w_reallo"
	.ascii	"c(void* curr_mem, size_t size){void *mem = realloc("
	.ascii	"curr_mem, size);if(!mem){exit(-1);}return mem;}\012"
	.ascii	"void w_free(void* x){if (x){free(x);}}\012typedef s"
	.ascii	"truct w_arr_st {void* data;size_t len;size_t cap;si"
	.ascii	"ze_t elem_size;} w_arr_t;\012w_arr_t* w_arr_new_imp"
	.ascii	"l(int elem_size){w_arr_t* arr = (w_arr_t*)w_malloc("
	.ascii	"sizeof(w_arr_t));arr->elem_size = elem_size;arr->le"
	.ascii	"n = 0;arr->cap = 16;arr->data = w_malloc((arr->cap)"
	.ascii	"*elem_size);return arr;}\012w_arr_t* w_arr_new_ints"
	.ascii	"(int count,...){va_list vals;w_arr_t* arr = (w_arr_"
	.ascii	"t*)w_malloc(sizeof(w_arr_t));arr->elem_size = sizeo"
	.ascii	"f(int);arr->len = count;arr->cap = count;arr->data "
	.ascii	"= w_malloc((arr->cap)*arr->elem_size);va_start(vals"
	.ascii	", count);for (int i = 0; i < count; i++) {((int*)ar"
	.ascii	"r->data)[i]=va_arg(vals, int);}va_end(vals);return "
	.ascii	"arr;}\012w_arr_t* w_arr_new_flts(int count,...){va_"
	.ascii	"list vals;w_arr_t* arr = (w_arr_t*)w_malloc(sizeof("
	.ascii	"w_arr_t));arr->elem_size = sizeof(float);arr->len ="
	.ascii	" count;arr->cap = count;arr->data = w_malloc((arr->"
	.ascii	"cap)*arr->elem_size);va_start(vals, count);for (int"
	.ascii	" i = 0; i < count; i++) {((float*)arr->data)[i]=(fl"
	.ascii	"oat)va_arg(vals, double);}va_end(vals);return arr;}"
	.ascii	"\012w_arr_t* w_arr_new_strs(int count,...){va_list "
	.ascii	"vals;w_arr_t* arr = (w_arr_t*)w_malloc(sizeof(w_arr"
	.ascii	"_t));arr->elem_size = sizeof(char*);arr->len = coun"
	.ascii	"t;arr->cap = count;arr->data = w_malloc((arr->cap)*"
	.ascii	"arr->elem_size);va_start(vals, count);for (int i = "
	.ascii	"0; i < count; i++) {((char**)arr->data)[i]=(char*)v"
	.ascii	"a_arg(vals, char*);}va_end(vals);return arr;}\012in"
	.ascii	"t* w_vec_new_ints(int count,...){va_list vals;int* "
	.ascii	"vec = (int*)w_malloc(sizeof(int)*count);va_start(va"
	.ascii	"ls, count);for (int i = 0; i < count; i++) {vec[i]="
	.ascii	"va_arg(vals, int);}va_end(vals);return vec;}\012flo"
	.ascii	"at* w_vec_new_f"
	.ascii	"lts(int count,...){va_list vals;float* vec = (float"
	.ascii	"*)w_malloc(sizeof(float)*count);va_start(vals, coun"
	.ascii	"t);for (int i = 0; i < count; i++) {vec[i]=(float)v"
	.ascii	"a_arg(vals, double);}va_end(vals);return vec;}\012c"
	.ascii	"har** w_vec_new_strs(int count,...){va_list vals;ch"
	.ascii	"ar** vec = (char**)w_malloc(sizeof(char*)*count);va"
	.ascii	"_start(vals, count);for (int i = 0; i < count; i++)"
	.ascii	" {vec[i]=va_arg(vals, char*);}va_end(vals);return v"
	.ascii	"ec;}\012#define w_arr_new(type)         (w_arr_new_"
	.ascii	"impl(sizeof(type)))\012#define w_arr_get(type,arr,i"
	.ascii	"  ) (((type *)((arr)->data))[(i)])\012#define w_arr"
	.ascii	"_set(type,arr,i,x) (((type *)((arr)->data))[(i)]=(x"
	.ascii	"))\012void w_arr_insert_impl(w_arr_t* arr,int i) {i"
	.ascii	"f ((arr)->len >= (arr)->cap){(arr)->cap = (arr)->ca"
	.ascii	"p+W_MAX(4,(arr)->cap/2);(arr)->data = w_realloc((ar"
	.ascii	"r)->data, (arr)->elem_size*((arr)->cap));}if ((i) <"
	.ascii	" (arr)->len){memmove((char*)((arr)->data)+((i)+1)*("
	.ascii	"arr)->elem_size,(char*)((arr)->data)+(i)*(arr)->ele"
	.ascii	"m_size,((arr)->len-(i))*(arr)->elem_size );}(arr)->"
	.ascii	"len++;}\012#define w_arr_insert(type,arr,i,x) { typ"
	.ascii	"e tmp__x_ = x; int tmp__i_ = i; w_arr_t* tmp__a_ = "
	.ascii	"arr; w_arr_insert_impl((tmp__a_),(tmp__i_)); (((typ"
	.ascii	"e *)((tmp__a_)->data))[(tmp__i_)]=(tmp__x_)); }\012"
	.ascii	"void w_arr_remove(w_arr_t* arr,int i,int n) {memmov"
	.ascii	"e((char*)((arr)->data)+(i)*(arr)->elem_size,(char*)"
	.ascii	"((arr)->data)+((i)+(n))*(arr)->elem_size,((arr->len"
	.ascii	")-(i)-(n))*(arr)->elem_size );(arr)->len-=(n);}\012"
	.ascii	"w_arr_t* w_arr_slice(w_arr_t*arr,int i,int n) {w_ar"
	.ascii	"r_t* brr = (w_arr_t*)w_malloc(sizeof(w_arr_t));brr-"
	.ascii	">elem_size = (arr)->elem_size;brr->len = n;brr->cap"
	.ascii	" = n;brr->data = w_malloc((brr->cap)*(brr->elem_siz"
	.ascii	"e));memcpy((char*)(brr->data), (char*)((arr)->data)"
	.ascii	" + (i), (n)*((arr)->elem_size));return brr;}\012#de"
	.ascii	"fine W_NUM_MAP_SLOTS 64\012typedef struct w_slot_st"
	.ascii	" {int keylen;void* key;int64_t data;struct w_slot_s"
	.ascii	"t* next;} w_slot_t;\012typedef struct w_map_st {int"
	.ascii	" key_is_ptr;size_t len;w_slot_t* slots[W_NUM_MAP_SL"
	.ascii	"OTS];} w_map_t;\012w_map_t* w_map_new(char key_is_p"
	.ascii	"tr){w_map_t* map = (w_map_t*)w_malloc(sizeof(w_map_"
	.ascii	"t));map->key_is_ptr = key_is_ptr;for (int i = 0"
	.ascii	"; i < W_NUM_MAP_SLOTS; i++){map->slots[i] = NULL;}m"
	.ascii	"ap->len = 0;return map;}\012int w_map_hash(void* pt"
	.ascii	"r, size_t len){int x = 0;for (size_t i = 0; i < len"
	.ascii	"; i++){unsigned char y = *((unsigned char*)((unsign"
	.ascii	"ed char*)ptr+i));x ^= y;}x %= W_NUM_MAP_SLOTS;retur"
	.ascii	"n x;}\012void w_map_set(w_map_t* map, int64_t key, "
	.ascii	"int64_t data){int keylen;void* keyptr;if (map->key_"
	.ascii	"is_ptr){keylen = strlen((char*)key);keyptr = (char*"
	.ascii	")key;}else{keylen = sizeof(key);keyptr = &key;}int "
	.ascii	"k = w_map_hash(keyptr,keylen);w_slot_t* it = map->s"
	.ascii	"lots[k];while (it){if (keylen == it->keylen){if (me"
	.ascii	"mcmp(it->key,keyptr,keylen)==0){it->data = data;ret"
	.ascii	"urn;}}it = it -> next;}w_slot_t* nxt = map->slots[k"
	.ascii	"];w_slot_t* slot = (w_slot_t*)w_malloc(sizeof(w_slo"
	.ascii	"t_t));slot->key = w_malloc(keylen);memcpy(slot->key"
	.ascii	",keyptr,keylen);slot->data=data;slot->next = nxt;sl"
	.ascii	"ot->keylen = keylen;map->slots[k] = slot;map->len++"
	.ascii	";}\012int64_t w_map_get(w_map_t* map, int64_t key){"
	.ascii	"int keylen;void* keyptr;if (map->key_is_ptr){keylen"
	.ascii	" = strlen((char*)key);keyptr = (char*)key;}else{key"
	.ascii	"len = sizeof(key);keyptr = &key;}int k = w_map_hash"
	.ascii	"(keyptr,keylen);w_slot_t* it = map->slots[k];while "
	.ascii	"(it){if (keylen == it->keylen){if (memcmp(it->key,k"
	.ascii	"eyptr,keylen)==0){return it->data;}}it = it -> next"
	.ascii	";}return 0;}\012void w_map_remove(w_map_t* map, int"
	.ascii	"64_t key){size_t keylen;void* keyptr;if (map->key_i"
	.ascii	"s_ptr){keylen = strlen((char*)key);keyptr = (char*)"
	.ascii	"key;}else{keylen = sizeof(key);keyptr = &key;}int k"
	.ascii	" = w_map_hash(keyptr,keylen);w_slot_t* it = map->sl"
	.ascii	"ots[k];w_slot_t* prev = NULL;while (it){if (keylen "
	.ascii	"== it->keylen){if (memcmp(it->key,keyptr,keylen)==0"
	.ascii	"){if (prev){prev->next = it->next;}else{map->slots["
	.ascii	"k] = it->next;}map->len--;w_free(it->key);w_free(it"
	.ascii	");return;}}prev = it;it = it -> next;}return;}\012i"
	.ascii	"nt w_reinterp_f2i(float x){return *((int *)&x);}\012"
	.ascii	"float w_reinterp_i2f(int x){return *((float *)&x);}"
	.ascii	"\012typedef struct {char data[32];} w_shortstr_t;\012"
	.ascii	"w_shortstr_t w_int2str(int x){w_shortstr_t str;spri"
	.ascii	"ntf(str.data, \"%d\", x);return str;}\012w_shortstr"
	.ascii	"_t w_flt2str(float x){w_shortstr_t st"
	.ascii	"r;sprintf(str.data, \"%g\", x);return str;}\012char"
	.ascii	"* w_str_new(char* x){size_t l = strlen(x);char* str"
	.ascii	" = (char*)w_malloc(l);strncpy(str,x,l);str[l] = 0;r"
	.ascii	"eturn str;}\012char* w_str_cat(char* x, char* y){si"
	.ascii	"ze_t l0 = strlen(x);size_t l1 = strlen(y);x = (char"
	.ascii	"*)w_realloc(x,l0+l1+1);memcpy(x+l0,y,l1);x[l0+l1] ="
	.ascii	" 0;return x;}\012char* w_str_add(char* x, int y){ch"
	.ascii	"ar c = (char)y;size_t l = strlen(x);x = (char*)w_re"
	.ascii	"alloc(x,l+2);x[l] = c;x[l+1]=0;return x;}\012char* "
	.ascii	"w_str_cpy(char* x, int i, int l){char* y = (char*)w"
	.ascii	"_malloc(l+1);memcpy(y,x+i,l);y[l] = 0;return y;}\012"
	.ascii	"void w_free_arr(w_arr_t* x){if (x){w_free(x->data);"
	.ascii	"w_free(x);}}\012void w_free_map(w_map_t* map){if (!"
	.ascii	"map){return;}for (int i = 0; i < W_NUM_MAP_SLOTS; i"
	.ascii	"++){w_slot_t* it = map->slots[i];while (it){w_slot_"
	.ascii	"t* nxt = it->next;w_free(it->key);w_free(it);it = n"
	.ascii	"xt;}}w_free(map);}\012#endif\012\000"
	.data
	.align	2
	.type	TEXT_std_c, %object
	.size	TEXT_std_c, 4
TEXT_std_c:
	.word	.LC1
	.global	TEXT_std_py
	.section	.rodata
	.align	2
.LC2:
	.ascii	"def w_arr_remove(a,i,n):del a[i:i+n]\012def w_slice"
	.ascii	"(a,i,n):return a[i:i+n]\012def w_map_get(m,k,d):\012"
	.ascii	"    try:return m[k]\012    except:return d\012def w"
	.ascii	"_map_remove(m,k):\012    try:del m[k]\012    except"
	.ascii	":pass\012\000"
	.data
	.align	2
	.type	TEXT_std_py, %object
	.size	TEXT_std_py, 4
TEXT_std_py:
	.word	.LC2
	.global	TEXT_std_swift
	.section	.rodata
	.align	2
.LC3:
	.ascii	"class w_Arr<T>{\012  var data : Array<T> = [];\012 "
	.ascii	" init(data:[T]){self.data = data;}\012  init(zero:T"
	.ascii	",n:Int){self.data = Array<T>(repeating:zero,count:n"
	.ascii	");}\012  func remove(i:Int,n:Int){self.data.removeS"
	.ascii	"ubrange(i..<(i+n));}\012  func slice(i:Int,n:Int)->"
	.ascii	"w_Arr<T>{\012    return w_Arr<T>(data:Array(self.da"
	.ascii	"ta[i..<(i+n)]));\012  }\012}\012class w_Map<K:Hasha"
	.ascii	"ble,V>{\012  var data : Dictionary<K,V> = [:];\012}"
	.ascii	"\012static func w_charCode(x:String) -> Int{\012  r"
	.ascii	"eturn (Int)(x.unicodeScalars[x.unicodeScalars.start"
	.ascii	"Index].value);\012}\012static func w_strSlice(x:Str"
	.ascii	"ing,i:Int,n:Int)->String{\012  return String(Array("
	.ascii	"x)[i..<(i+n)]);\012}\012static func w_INT(x:Bool)->"
	.ascii	"Int{return x ? 1 : 0;}\012static func w_BOOL(x:Int)"
	.ascii	"->Bool{return x != 0;}\012static func w_NOT(x:Int)-"
	.ascii	">Int{return (x == 0) ? 1 : 0;}\012static func w_str"
	.ascii	"Bang(x:String?)->String{return x!;}\012\000"
	.data
	.align	2
	.type	TEXT_std_swift, %object
	.size	TEXT_std_swift, 4
TEXT_std_swift:
	.word	.LC3
	.global	TEXT_std_cs
	.section	.rodata
	.align	2
.LC4:
	.ascii	"public static V w_mapGet<K,V>(Dictionary<K,V> map, "
	.ascii	"K key, V defaultValue) {V v;if (map.TryGetValue(key"
	.ascii	",out v)){return v;}return defaultValue;}\012public "
	.ascii	"static bool w_BOOL(int x){return x!=0;}\012public s"
	.ascii	"tatic int w_INT(bool x){return x?1:0;}\012public st"
	.ascii	"atic int w_NOT(int x){return (x==0)?1:0;}\012\000"
	.data
	.align	2
	.type	TEXT_std_cs, %object
	.size	TEXT_std_cs, 4
TEXT_std_cs:
	.word	.LC4
	.global	TEXT_std_cpp
	.section	.rodata
	.align	2
.LC5:
	.ascii	"template <typename T>\012inline void w_arr_insert ("
	.ascii	"std::vector<T>* arr, int i, T x){arr->insert(arr->b"
	.ascii	"egin()+i,x);}\012template <typename T>\012inline vo"
	.ascii	"id w_arr_remove (std::vector<T>* arr, int i, int n)"
	.ascii	"{arr->erase(arr->begin()+i,arr->begin()+i+n);}\012t"
	.ascii	"emplate <typename T>\012inline std::vector<T>* w_ar"
	.ascii	"r_slice (std::vector<T>* arr, int i, int n){return "
	.ascii	"new std::vector<T>(arr->begin()+i,arr->begin()+i+n)"
	.ascii	";}\012template <typename K, typename V>\012inline V"
	.ascii	" w_map_get (std::map<K,V>* m, K k, V defau){typenam"
	.ascii	"e std::map<K,V>::iterator it = m->find(k);if (it !="
	.ascii	" m->end()){return it->second;}return defau;}\012tem"
	.ascii	"plate <typename T, std::size_t N>\012inline std::ar"
	.ascii	"ray<T,N>* w_vec_init (T v){std::array<T,N>* vec = n"
	.ascii	"ew std::array<T,N>;vec->fill(v);return vec;}\012\000"
	.data
	.align	2
	.type	TEXT_std_cpp, %object
	.size	TEXT_std_cpp, 4
TEXT_std_cpp:
	.word	.LC5
	.global	TEXT_std_ts
	.section	.rodata
	.align	2
.LC6:
	.ascii	"const w_slice=(x:Array<any>|string,i:number,n:numbe"
	.ascii	"r)=>x.slice(i,i+n);\012\000"
	.data
	.align	2
	.type	TEXT_std_ts, %object
	.size	TEXT_std_ts, 4
TEXT_std_ts:
	.word	.LC6
	.global	TEXT_std_lua
	.section	.rodata
	.align	2
.LC7:
	.ascii	"function w_trunc(x)         if x < 0 then return ma"
	.ascii	"th.ceil(x) else return math.floor(x) end end\012fun"
	.ascii	"ction w_vec_init(z,n)    local x = {} for i=1,n do "
	.ascii	"x[i]=z end return x end\012function w_arr_slice(x,i"
	.ascii	",n) local y = {} for j=(i+1),(i+n) do y[j-i]=x[j] e"
	.ascii	"nd return y end\012function w_arr_remove(x,i,n)for "
	.ascii	"j=(i+n),(i+1),-1 do table.remove(x,j) end end\012fu"
	.ascii	"nction w_map_len(x)       local cnt = 0 for k,v in "
	.ascii	"pairs(x) do cnt = cnt + 1 end return cnt end\012fun"
	.ascii	"ction w_strcpy(x,i,n)    return string.sub(x,i+1,i+"
	.ascii	"n) end\012\000"
	.data
	.align	2
	.type	TEXT_std_lua, %object
	.size	TEXT_std_lua, 4
TEXT_std_lua:
	.word	.LC7
	.global	TEXT_math_wax
	.section	.rodata
	.align	2
.LC8:
	.ascii	"(@pragma once)  (extern acos   (param x float) (res"
	.ascii	"ult float)) (extern asin   (param x float) (result "
	.ascii	"float)) (extern atan   (param x float) (result floa"
	.ascii	"t)) (extern cos    (param x float) (result float)) "
	.ascii	"(extern cosh   (param x float) (result float)) (ext"
	.ascii	"ern sin    (param x float) (result float)) (extern "
	.ascii	"sinh   (param x float) (result float)) (extern tan "
	.ascii	"   (param x float) (result float)) (extern tanh   ("
	.ascii	"param x float) (result float)) (extern exp    (para"
	.ascii	"m x float) (result float)) (extern log    (param x "
	.ascii	"float) (result float)) (extern sqrt   (param x floa"
	.ascii	"t) (result float)) (extern ceil   (param x float) ("
	.ascii	"result float)) (extern floor  (param x float) (resu"
	.ascii	"lt float)) (extern fabs   (param x float) (result f"
	.ascii	"loat)) (extern round  (param x float) (result float"
	.ascii	")) (extern atan2  (param x float) (param y float) ("
	.ascii	"result float)) (extern pow    (param x float) (para"
	.ascii	"m y float) (result float)) (extern fmax   (param x "
	.ascii	"float) (param y float) (result float)) (extern fmin"
	.ascii	"   (param x float) (param y float) (result float)) "
	.ascii	"(extern abs    (param x int) (result int)) (extern "
	.ascii	"random (result float)) (extern INFINITY float)   (@"
	.ascii	"if TARGET_C 1 \011(asm \"#define random() ((float)r"
	.ascii	"and()/RAND_MAX)\012\") )  (@if TARGET_CPP 1 \011(as"
	.ascii	"m \"#define random() ((float)rand()/RAND_MAX)\012\""
	.ascii	") )  (@if TARGET_JAVA 1 \011(asm \"public static fl"
	.ascii	"oat fabs(float x){return Math.abs(x);}\012\") \011("
	.ascii	"asm \"public static float fmin(float x, float y){re"
	.ascii	"turn Math.min(x,y);}\012\") \011(asm \"public stati"
	.ascii	"c float fmax(float x, float y){return Math.max(x,y)"
	.ascii	";}\012\") \011(asm \"public static final float INFI"
	.ascii	"NITY = Float.POSITIVE_INFINITY;\012\") )  (@if TARG"
	.ascii	"ET_TS 1 \011(asm \"const acos  = Math.acos  ;\012\""
	.ascii	") \011(asm \"const asin  = Math.asin  ;\012\") \011"
	.ascii	"(asm \"const atan  = Math.atan  ;\012\") \011(asm \""
	.ascii	"const cos   = Math.cos   ;\012\") \011(asm \"const "
	.ascii	"sin   = Math.sin   ;\012\") \011(asm \"const tan   "
	.ascii	"= Math.tan   ;\012\") \011(asm \"const exp   = Math"
	.ascii	".exp   ;\012\") \011(asm \"const log   = Math.log  "
	.ascii	" ;\012\") \011(asm \"const sqrt  = Math.sqrt  ;\012"
	.ascii	"\") \011(asm \"const ceil  = Math.ceil  ;\012\") \011"
	.ascii	"(asm \"const floor = Math.floor ;\012\") \011"
	.ascii	"(asm \"const fabs  = Math.abs   ;\012\") \011(asm \""
	.ascii	"const fmin  = Math.min   ;\012\") \011(asm \"const "
	.ascii	"fmax  = Math.max   ;\012\") \011(asm \"const atan2 "
	.ascii	"= Math.atan2 ;\012\") \011(asm \"const pow   = Math"
	.ascii	".pow   ;\012\") \011(asm \"const abs   = Math.abs  "
	.ascii	" ;\012\") \011(asm \"const round = Math.round ;\012"
	.ascii	"\") \011(asm \"const random= Math.random;\012\") \011"
	.ascii	"(asm \"const INFINITY = Infinity;\012\") \011(asm \""
	.ascii	"// @ts-ignore\012\") \011(asm \"const sinh  = Math."
	.ascii	"sinh ;\012\") \011(asm \"// @ts-ignore\012\") \011("
	.ascii	"asm \"const cosh  = Math.cosh ;\012\") \011(asm \"/"
	.ascii	"/ @ts-ignore\012\") \011(asm \"const tanh  = Math.t"
	.ascii	"anh ;\012\") )  (@if TARGET_PY 1 \011(asm \"from ma"
	.ascii	"th import *\012\") \011(asm \"from random import ra"
	.ascii	"ndom\012\") \011(asm \"INFINITY = float('inf')\012\""
	.ascii	") \011(asm \"fabs = abs\012\") \011(asm \"fmin = mi"
	.ascii	"n\012\") \011(asm \"fmax = max\012\") )   (@if TARG"
	.ascii	"ET_CS 1 \011(asm \"public static Func<double,double"
	.ascii	"> acos     = Math.Acos   ;\012\") \011(asm \"public"
	.ascii	" static Func<double,double> asin     = Math.Asin   "
	.ascii	";\012\") \011(asm \"public static Func<double,doubl"
	.ascii	"e> atan     = Math.Atan   ;\012\") \011(asm \"publi"
	.ascii	"c static Func<double,double> cos      = Math.Cos   "
	.ascii	" ;\012\") \011(asm \"public static Func<double,doub"
	.ascii	"le> sin      = Math.Sin    ;\012\") \011(asm \"publ"
	.ascii	"ic static Func<double,double> tan      = Math.Tan  "
	.ascii	"  ;\012\") \011(asm \"public static Func<double,dou"
	.ascii	"ble> exp      = Math.Exp    ;\012\") \011(asm \"pub"
	.ascii	"lic static Func<double,double> log      = Math.Log "
	.ascii	"   ;\012\") \011(asm \"public static Func<double,do"
	.ascii	"uble> sqrt     = Math.Sqrt   ;\012\") \011(asm \"pu"
	.ascii	"blic static Func<double,double> ceil     = Math.Cei"
	.ascii	"ling;\012\") \011(asm \"public static Func<double,d"
	.ascii	"ouble> floor    = Math.Floor  ;\012\") \011(asm \"p"
	.ascii	"ublic static Func<double,double> fabs     = Math.Ab"
	.ascii	"s    ;\012\") \011(asm \"public static Func<double,"
	.ascii	"double> sinh     = Math.Sinh   ;\012\") \011(asm \""
	.ascii	"public static Func<double,double> cosh     = Math.C"
	.ascii	"osh   ;\012\") \011(asm \"public static Func<double"
	.ascii	",double> tanh     = Math.Tanh   ;\012\") \011(asm \""
	.ascii	"public static Func<double,double> round    = Math.R"
	.ascii	"ound  ;\012\") \011(asm \"public static Func<int,in"
	.ascii	"t> abs            = Math.Abs    ;\012\") \011(asm \""
	.ascii	"public static Func<double,double,double> atan2 = Ma"
	.ascii	"th.Atan2 ;\012\") \011(asm \"public static Func<dou"
	.ascii	"ble,double,"
	.ascii	"double> pow   = Math.Pow   ;\012\") \011(asm \"publ"
	.ascii	"ic static Func<double,double,double> fmin  = Math.M"
	.ascii	"in   ;\012\") \011(asm \"public static Func<double,"
	.ascii	"double,double> fmax  = Math.Max   ;\012\") \011(asm"
	.ascii	" \"public static float INFINITY = Single.PositiveIn"
	.ascii	"finity;\012\") \011(asm \"public static Random w_RN"
	.ascii	"G = new Random();\012\") \011(asm \"public static f"
	.ascii	"loat random(){ return (float)w_RNG.NextDouble(); }\012"
	.ascii	"\")  )   (@if TARGET_SWIFT 1 \011(asm \"static var "
	.ascii	"w_seed : UInt32 = 0x5EED;\012\") \011(asm \"static "
	.ascii	"func random()->Float{w_seed^=(w_seed<<17);w_seed^=("
	.ascii	"w_seed>>13);w_seed^=(w_seed<<5);return Float(w_seed"
	.ascii	")/Float(4294967295);}\012\") \011(asm \"static var "
	.ascii	"INFINITY : Float = Float.infinity\012\") \011(asm \""
	.ascii	"static func acos (x:Float)->Float{return Foundation"
	.ascii	".acos (x);}\012\") \011(asm \"static func asin (x:F"
	.ascii	"loat)->Float{return Foundation.asin (x);}\012\") \011"
	.ascii	"(asm \"static func atan (x:Float)->Float{return Fou"
	.ascii	"ndation.atan (x);}\012\") \011(asm \"static func co"
	.ascii	"s  (x:Float)->Float{return Foundation.cos  (x);}\012"
	.ascii	"\") \011(asm \"static func cosh (x:Float)->Float{re"
	.ascii	"turn Foundation.cosh (x);}\012\") \011(asm \"static"
	.ascii	" func sin  (x:Float)->Float{return Foundation.sin  "
	.ascii	"(x);}\012\") \011(asm \"static func sinh (x:Float)-"
	.ascii	">Float{return Foundation.sinh (x);}\012\") \011(asm"
	.ascii	" \"static func tan  (x:Float)->Float{return Foundat"
	.ascii	"ion.tan  (x);}\012\") \011(asm \"static func tanh ("
	.ascii	"x:Float)->Float{return Foundation.tanh (x);}\012\")"
	.ascii	" \011(asm \"static func exp  (x:Float)->Float{retur"
	.ascii	"n Foundation.exp  (x);}\012\") \011(asm \"static fu"
	.ascii	"nc log  (x:Float)->Float{return Foundation.log  (x)"
	.ascii	";}\012\") \011(asm \"static func sqrt (x:Float)->Fl"
	.ascii	"oat{return Foundation.sqrt (x);}\012\") \011(asm \""
	.ascii	"static func ceil (x:Float)->Float{return Foundation"
	.ascii	".ceil (x);}\012\") \011(asm \"static func floor(x:F"
	.ascii	"loat)->Float{return Foundation.floor(x);}\012\") \011"
	.ascii	"(asm \"static func fabs (x:Float)->Float{return Swi"
	.ascii	"ft.abs   (x);}\012\") \011(asm \"static func round("
	.ascii	"x:Float)->Float{return Foundation.round(x);}\012\")"
	.ascii	" \011(asm \"static func atan2(x:Float,y:Float)->Flo"
	.ascii	"at{return Foundation.atan2(x,y);}\012\") \011(asm \""
	.ascii	"static func pow  (x:Float,y:Float)->Float{return Fo"
	.ascii	"undation.pow  (x,y);}\012\") \011(asm \"static func"
	.ascii	" fmax (x:Floa"
	.ascii	"t,y:Float)->Float{return Foundation.fmax (x,y);}\012"
	.ascii	"\") \011(asm \"static func fmin (x:Float,y:Float)->"
	.ascii	"Float{return Foundation.fmin (x,y);}\012\") \011(as"
	.ascii	"m \"static func abs  (x:Int)          ->Int  {retur"
	.ascii	"n Swift.abs   (x);  }\012\") )  (@if TARGET_LUA 1 \011"
	.ascii	"(asm \"do for k,v in pairs(math) do _G[k]=v end end"
	.ascii	"\012\") \011(asm \"function round(x) return x>=0 an"
	.ascii	"d math.floor(x+0.5) or math.ceil(x-0.5) end\012\") "
	.ascii	"\011(asm \"local INFINITY = huge\012\") \011(asm \""
	.ascii	"local fmax = max\012\") \011(asm \"local fmin = min"
	.ascii	"\012\") \011(asm \"local fabs = abs\012\012\") )\012"
	.ascii	"\000"
	.data
	.align	2
	.type	TEXT_math_wax, %object
	.size	TEXT_math_wax, 4
TEXT_math_wax:
	.word	.LC8
	.global	TEXT_math_wat
	.section	.rodata
	.align	2
.LC9:
	.ascii	"(import \"Math\" \"log\"    (func $log   (param f32"
	.ascii	") (result f32)))\012(import \"Math\" \"exp\"    (fu"
	.ascii	"nc $exp   (param f32) (result f32)))\012(import \"M"
	.ascii	"ath\" \"cos\"    (func $cos   (param f32) (result f"
	.ascii	"32)))\012(import \"Math\" \"sin\"    (func $sin   ("
	.ascii	"param f32) (result f32)))\012(import \"Math\" \"tan"
	.ascii	"\"    (func $tan   (param f32) (result f32)))\012(i"
	.ascii	"mport \"Math\" \"cosh\"   (func $cosh  (param f32) "
	.ascii	"(result f32)))\012(import \"Math\" \"sinh\"   (func"
	.ascii	" $sinh  (param f32) (result f32)))\012(import \"Mat"
	.ascii	"h\" \"tanh\"   (func $tanh  (param f32) (result f32"
	.ascii	")))\012(import \"Math\" \"acos\"   (func $acos  (pa"
	.ascii	"ram f32) (result f32)))\012(import \"Math\" \"asin\""
	.ascii	"   (func $asin  (param f32) (result f32)))\012(impo"
	.ascii	"rt \"Math\" \"atan2\"  (func $atan2 (param f32) (pa"
	.ascii	"ram  f32) (result f32)))\012(import \"Math\" \"pow\""
	.ascii	"    (func $pow   (param f32) (param  f32) (result f"
	.ascii	"32)))\012(import \"Math\" \"random\" (func $random "
	.ascii	"           (result f32)))\012\012(func $fmax (param"
	.ascii	" $x f32) (param $y f32) (result f32) (f32.max (loca"
	.ascii	"l.get $x) (local.get $y)))\012(func $fmin (param $x"
	.ascii	" f32) (param $y f32) (result f32) (f32.min (local.g"
	.ascii	"et $x) (local.get $y)))\012(func $fabs (param $x f3"
	.ascii	"2) (result f32) (f32.abs (local.get $x)))\012(func "
	.ascii	"$floor (param $x f32) (result f32) (f32.floor (loca"
	.ascii	"l.get $x)))\012(func $ceil (param $x f32) (result f"
	.ascii	"32) (f32.ceil (local.get $x)))\012(func $sqrt (para"
	.ascii	"m $x f32) (result f32) (f32.sqrt (local.get $x)))\012"
	.ascii	"(func $round (param $x f32) (result f32) (f32.neare"
	.ascii	"st (local.get $x)))\012\012(func $abs (param $x i32"
	.ascii	") (result i32)\012  (if (i32.lt_s (local.get $x) (i"
	.ascii	"32.const 0))(then\012      (i32.sub (i32.const 0) ("
	.ascii	"local.get $x))\012      return\012  ))\012  (local."
	.ascii	"get $x)\012)\012\012(global $INFINITY f32 (f32.cons"
	.ascii	"t 340282346638528859811704183484516925440))\012\000"
	.data
	.align	2
	.type	TEXT_math_wat, %object
	.size	TEXT_math_wat, 4
TEXT_math_wat:
	.word	.LC9
	.global	TEXT_std_arr_wat
	.section	.rodata
	.align	2
.LC10:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;;       "
	.ascii	"                           ;;\012;;                "
	.ascii	"                  ;;\012;;               ARRAY     "
	.ascii	"         ;;\012;;                                  "
	.ascii	";;\012;;                                  ;;\012;;;"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;; addapted "
	.ascii	"from https://github.com/LingDong-/wasm-fun\012\012;"
	.ascii	";   Continous, resizable storage for a sequence of "
	.ascii	"values,\012;;   similar to C++ vector<T>\012;;\012;"
	.ascii	";   +--------------------+\012;;   |data|length|cap"
	.ascii	"acity|\012;;   +-|------------------+\012;;     |  "
	.ascii	"      +---------------------------\012;;     `-----"
	.ascii	"-> |elem 0|elem 1|elem 2|......\012;;              "
	.ascii	"+---------------------------\012\012;; struct arr {"
	.ascii	"\012;;   i32/f32/(void*) data\012;;   int length\012"
	.ascii	";;   int capacity\012;; }\012\012(global $wax::DEFA"
	.ascii	"ULT_CAPACITY (mut i32) (i32.const 8))\012\012;; (in"
	.ascii	"ternal) getter/setters for arr struct fields\012\012"
	.ascii	"(func $wax::_arr_set_data (param $ptr i32) (param $"
	.ascii	"data i32)\012  (i32.store (local.get $ptr) (local.g"
	.ascii	"et $data))\012)\012(func $wax::_arr_set_length (par"
	.ascii	"am $ptr i32) (param $length i32)\012  (i32.store (i"
	.ascii	"32.add (local.get $ptr) (i32.const 4)) (local.get $"
	.ascii	"length))\012)\012(func $wax::_arr_set_capacity (par"
	.ascii	"am $ptr i32) (param $capacity i32)\012  (i32.store "
	.ascii	"(i32.add (local.get $ptr) (i32.const 8)) (local.get"
	.ascii	" $capacity))\012)\012(func $wax::_arr_get_data (par"
	.ascii	"am $ptr i32) (result i32)\012  (i32.load (local.get"
	.ascii	" $ptr))\012)\012(func $wax::_arr_get_capacity (para"
	.ascii	"m $ptr i32) (result i32)\012  (i32.load (i32.add (l"
	.ascii	"ocal.get $ptr) (i32.const 8)))\012)\012\012;; retur"
	.ascii	"ns length of an array given an arr pointer\012(func"
	.ascii	" $wax::arr_length (param $ptr i32) (result i32)\012"
	.ascii	"  (i32.load (i32.add (local.get $ptr) (i32.const 4)"
	.ascii	") )\012)\012\012;; initialize a new arr, returns a "
	.ascii	"pointer to it\012;; elem_size: size of each element"
	.ascii	", in bytes\012(func $wax::arr_new (param $len i32) "
	.ascii	"(result i32)\012  (local $ptr i32)\012  (local $cap"
	.ascii	" i32)\012  (local $data i32)\012  (if (i32.lt_u (lo"
	.ascii	"cal.get $len) (global.get $wax::DEFAULT_CAPACITY)) "
	.ascii	"(then\012    (local.set $cap (global.get $wax::DEFA"
	.ascii	"ULT_CAPACITY))\012  )(else\012    (local.set $cap ("
	.ascii	"local.get $len))\012  ))\012  (local.se"
	.ascii	"t $ptr (call $wax::malloc (i32.const 12)))\012  (lo"
	.ascii	"cal.set $data (call $wax::calloc (i32.mul (local.ge"
	.ascii	"t $cap) (i32.const 4))))\012  (call $wax::_arr_set_"
	.ascii	"data (local.get $ptr) (local.get $data))\012  (call"
	.ascii	" $wax::_arr_set_length (local.get $ptr) (local.get "
	.ascii	"$len))\012  (call $wax::_arr_set_capacity (local.ge"
	.ascii	"t $ptr) (local.get $cap))\012  (local.get $ptr)\012"
	.ascii	")\012\012;; free allocated memory given an arr poin"
	.ascii	"ter\012(func $wax::arr_free (param $a i32)\012  (ca"
	.ascii	"ll $wax::free (call $wax::_arr_get_data (local.get "
	.ascii	"$a)))\012  (call $wax::free (local.get $a))\012)\012"
	.ascii	"\012\012\012;; get ith element of an array\012(func"
	.ascii	" $wax::arr_get (param $a i32) (param $i i32) (resul"
	.ascii	"t i32)\012  (local $data i32)\012  (local $elem_siz"
	.ascii	"e i32)\012  (local.set $data (call $wax::_arr_get_d"
	.ascii	"ata (local.get $a)))\012  (local.set $elem_size (i3"
	.ascii	"2.const 4))\012  (i32.load (i32.add (i32.mul (local"
	.ascii	".get $i) (local.get $elem_size)) (local.get $data))"
	.ascii	")\012)\012\012;; set ith element of an array\012(fu"
	.ascii	"nc $wax::arr_set (param $a i32) (param $i i32) (par"
	.ascii	"am $v i32)\012  (local $data i32)\012  (local $elem"
	.ascii	"_size i32)\012  (local.set $data (call $wax::_arr_g"
	.ascii	"et_data (local.get $a)))\012  (local.set $elem_size"
	.ascii	" (i32.const 4))\012  (i32.store (i32.add (i32.mul ("
	.ascii	"local.get $i) (local.get $elem_size)) (local.get $d"
	.ascii	"ata)) (local.get $v))\012)\012\012;; remove n eleme"
	.ascii	"nts from an array starting at index i\012(func $wax"
	.ascii	"::arr_remove (param $a i32) (param $i i32) (param $"
	.ascii	"n i32)\012  (local $data i32)\012  (local $elem_siz"
	.ascii	"e i32)\012  (local $length i32)\012  (local $offset"
	.ascii	" i32)\012\012  (local.set $length (call $wax::arr_l"
	.ascii	"ength (local.get $a)))\012  (local.set $data (call "
	.ascii	"$wax::_arr_get_data (local.get $a)))\012  (local.se"
	.ascii	"t $elem_size (i32.const 4))\012\012  (local.set $of"
	.ascii	"fset \012    (i32.add (local.get $data) (i32.mul (l"
	.ascii	"ocal.get $i) (local.get $elem_size) ))\012  )\012\012"
	.ascii	"  (call $wax::memmove \012    (local.get $offset)\012"
	.ascii	"    (i32.add (local.get $offset) (i32.mul (local.ge"
	.ascii	"t $n) (local.get $elem_size)))\012    (i32.mul (i32"
	.ascii	".sub (local.get $length) (i32.add (local.get $i) (l"
	.ascii	"ocal.get $n)) ) (local.get $elem_size))\012  )\012 "
	.ascii	" (call $wax::_arr_set_length  (local.get $a) (i32.s"
	.ascii	"ub (local.get $"
	.ascii	"length) (local.get $n) ))\012)\012\012\012;; add an"
	.ascii	" element to the end of the array\012;; does not wri"
	.ascii	"te the element, instead, returns a pointer\012;; to"
	.ascii	" the new last element for the user to write at\012("
	.ascii	"func $wax::arr_push (param $a i32) (result i32)\012"
	.ascii	"  (local $length i32)\012  (local $capacity i32)\012"
	.ascii	"  (local $data i32)\012  (local $elem_size i32)\012"
	.ascii	"\012  (local.set $length (call $wax::arr_length (lo"
	.ascii	"cal.get $a)))\012  (local.set $capacity (call $wax:"
	.ascii	":_arr_get_capacity (local.get $a)))\012  (local.set"
	.ascii	" $data (call $wax::_arr_get_data (local.get $a)))\012"
	.ascii	"  (local.set $elem_size (i32.const 4))\012\012  (if"
	.ascii	" (i32.lt_u (local.get $length) (local.get $capacity"
	.ascii	") ) (then) (else\012    (local.set $capacity (i32.a"
	.ascii	"dd\012      (i32.add (local.get $capacity) (i32.con"
	.ascii	"st 1))\012      (local.get $capacity)\012    ))\012"
	.ascii	"    (call $wax::_arr_set_capacity (local.get $a) (l"
	.ascii	"ocal.get $capacity))\012\012    (local.set $data \012"
	.ascii	"      (call $wax::realloc (local.get $data) (i32.mu"
	.ascii	"l (local.get $elem_size) (local.get $capacity) ))\012"
	.ascii	"    )\012    (call $wax::_arr_set_data (local.get $"
	.ascii	"a) (local.get $data))\012  ))\012  (call $wax::_arr"
	.ascii	"_set_length (local.get $a) (i32.add (local.get $len"
	.ascii	"gth) (i32.const 1)))\012  \012  ;; (i32.store (i32."
	.ascii	"add (local.get $data) (i32.mul (local.get $length) "
	.ascii	"(local.get $elem_size))) (i32.const 0))\012\012  (i"
	.ascii	"32.add (local.get $data) (i32.mul (local.get $lengt"
	.ascii	"h) (local.get $elem_size)))\012)\012\012;; insert i"
	.ascii	"nto an array at given index\012(func $wax::arr_inse"
	.ascii	"rt (param $a i32) (param $i i32) (param $v i32)\012"
	.ascii	"  (local $data i32)\012  (local $elem_size i32)\012"
	.ascii	"  (local $length i32)\012  (local $offset i32)\012\012"
	.ascii	"  (local.set $length (call $wax::arr_length (local."
	.ascii	"get $a)))\012\012  (drop (call $wax::arr_push (loca"
	.ascii	"l.get $a)))\012\012  (local.set $data (call $wax::_"
	.ascii	"arr_get_data (local.get $a)))\012  (local.set $elem"
	.ascii	"_size (i32.const 4))\012\012  (local.set $offset \012"
	.ascii	"    (i32.add (local.get $data) (i32.mul (local.get "
	.ascii	"$i) (local.get $elem_size) ))\012  )\012\012  (call"
	.ascii	" $wax::memmove\012    (i32.add (local.get $offset) "
	.ascii	"(local.get $elem_size))\012    (local.get $offset)\012"
	.ascii	"    (i32.mul \012      (i32.sub (local.get $length)"
	.ascii	" (local.get $i) ) \012 "
	.ascii	"     (local.get $elem_size)\012    )\012  )\012\012"
	.ascii	"  (i32.store (local.get $offset) (local.get $v))\012"
	.ascii	"\012)\012\012;; slice an array, producing a copy of"
	.ascii	" a range of elements \012;; i = starting index (inc"
	.ascii	"lusive), j = stopping index (exclusive)\012;; retur"
	.ascii	"ns pointer to new array\012(func $wax::arr_slice (p"
	.ascii	"aram $a i32) (param $i i32) (param $n i32) (result "
	.ascii	"i32)\012  (local $a_length i32)\012  (local $length"
	.ascii	" i32)\012  (local $elem_size i32)\012  (local $ptr "
	.ascii	"i32)\012  (local $data i32)\012  (local $j i32)\012"
	.ascii	"\012  (local.set $j (i32.add (local.get $i) (local."
	.ascii	"get $n)))\012\012  (local.set $a_length (call $wax:"
	.ascii	":arr_length (local.get $a)))\012\012  (if (i32.lt_s"
	.ascii	" (local.get $i) (i32.const 0) )(then\012    (local."
	.ascii	"set $i (i32.add (local.get $a_length) (local.get $i"
	.ascii	")))\012  ))\012  (if (i32.lt_s (local.get $j) (i32."
	.ascii	"const 0) )(then\012    (local.set $j (i32.add (loca"
	.ascii	"l.get $a_length) (local.get $j)))\012  ))\012\012  "
	.ascii	"(local.set $length (i32.sub (local.get $j) (local.g"
	.ascii	"et $i)))\012  (local.set $elem_size (i32.const 4))\012"
	.ascii	"\012  (local.set $ptr (call $wax::malloc (i32.const"
	.ascii	" 12)))\012  (local.set $data (call $wax::malloc (i3"
	.ascii	"2.mul (local.get $length) (local.get $elem_size))))"
	.ascii	"\012  (call $wax::_arr_set_data (local.get $ptr) (l"
	.ascii	"ocal.get $data))\012  (call $wax::_arr_set_length ("
	.ascii	"local.get $ptr) (local.get $length))\012  (call $wa"
	.ascii	"x::_arr_set_capacity (local.get $ptr) (local.get $l"
	.ascii	"ength))\012\012  (call $wax::memcpy (local.get $dat"
	.ascii	"a) \012    (i32.add\012      (call $wax::_arr_get_d"
	.ascii	"ata (local.get $a))\012      (i32.mul (local.get $i"
	.ascii	") (local.get $elem_size))\012    )\012    (i32.mul "
	.ascii	"(local.get $length) (local.get $elem_size))\012  )\012"
	.ascii	"\012  (local.get $ptr)\012)\012\012\012\000"
	.data
	.align	2
	.type	TEXT_std_arr_wat, %object
	.size	TEXT_std_arr_wat, 4
TEXT_std_arr_wat:
	.word	.LC10
	.global	TEXT_std_str_wat
	.section	.rodata
	.align	2
.LC11:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;;       "
	.ascii	"                           ;;\012;;                "
	.ascii	"                  ;;\012;;              STRING     "
	.ascii	"         ;;\012;;                                  "
	.ascii	";;\012;;                                  ;;\012;;;"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012\012(func $w"
	.ascii	"ax::fmod (param $x f32) (param $y f32) (result f32)"
	.ascii	"\012  (f32.sub (local.get $x) (f32.mul (local.get $"
	.ascii	"y) (f32.trunc (f32.div (local.get $x) (local.get $y"
	.ascii	")) )))\012)\012\012(func $wax::str_new (param $ptr "
	.ascii	"i32) (result i32)\012  (if (i32.eqz (local.get $ptr"
	.ascii	"))(then\012    (call $wax::calloc (i32.const 1))\012"
	.ascii	"    return\012  ))\012  (call $wax::str_slice (loca"
	.ascii	"l.get $ptr) (i32.const 0) (call $wax::str_len (loca"
	.ascii	"l.get $ptr)) )\012  return\012)\012\012(func $wax::"
	.ascii	"str_get (param $ptr i32) (param $i i32) (result i32"
	.ascii	")\012  (i32.load8_s (i32.add (local.get $ptr) (loca"
	.ascii	"l.get $i)))\012  return\012)\012\012(func $wax::str"
	.ascii	"_add (param $ptr i32) (param $c i32) (result i32)\012"
	.ascii	"  (local $l i32)\012  (local.set $l (call $wax::str"
	.ascii	"_len (local.get $ptr)))\012  (local.set $ptr (call "
	.ascii	"$wax::realloc (local.get $ptr) (i32.add (local.get "
	.ascii	"$l) (i32.const 2) ) ) )\012  (i32.store8 (i32.add ("
	.ascii	"local.get $ptr) (local.get $l)) (local.get $c)  )\012"
	.ascii	"  (i32.store8 (i32.add (i32.add (local.get $ptr) (l"
	.ascii	"ocal.get $l)) (i32.const 1)) (i32.const 0)  )\012\012"
	.ascii	"  (local.get $ptr)\012  (return)\012)\012\012(func "
	.ascii	"$wax::str_cat (param $s0 i32) (param $s1 i32) (resu"
	.ascii	"lt i32)\012  (local $l0 i32)\012  (local $l1 i32)\012"
	.ascii	"  (local.set $l0 (call $wax::str_len (local.get $s0"
	.ascii	")))\012  (local.set $l1 (call $wax::str_len (local."
	.ascii	"get $s1)))\012\012  (local.set $s0 (call $wax::real"
	.ascii	"loc (local.get $s0) (i32.add (i32.add (local.get $l"
	.ascii	"0) (local.get $l1) ) (i32.const 1)) ))\012\012  (ca"
	.ascii	"ll $wax::memcpy (i32.add (local.get $s0) (local.get"
	.ascii	" $l0)) (local.get $s1) (local.get $l1) )\012  (i32."
	.ascii	"store8 (i32.add (i32.add (local.get $s0) (local.get"
	.ascii	" $l0)) (local.get $l1)) (i32.const 0)  )\012  (loca"
	.ascii	"l.get $s0)\012  return\012)\012\012(func $wax::str_"
	.ascii	"cmp (param $s0 i32) (param $s1 i32) (result i32)\012"
	.ascii	"  (local $offset i32)\012  (local $x i32)\012  (loc"
	.ascii	"al $y i32)\012  (local.set $offset (i32.const 0))\012"
	.ascii	"  loop $cmp\012  "
	.ascii	"  (local.set $x (i32.load8_u (i32.add (local.get $s"
	.ascii	"0) (local.get $offset))) )\012    (local.set $y (i3"
	.ascii	"2.load8_u (i32.add (local.get $s1) (local.get $offs"
	.ascii	"et))) )\012\012    (if (i32.eq (local.get $x) (loca"
	.ascii	"l.get $y)) (then\012      (if (i32.eqz (local.get $"
	.ascii	"x)) (then\012        (i32.const 1)\012        retur"
	.ascii	"n\012      ))\012    )(else\012      (i32.const 0)\012"
	.ascii	"      return\012    ))\012\012    (local.set $offse"
	.ascii	"t (i32.add (local.get $offset) (i32.const 1)))\012 "
	.ascii	"   (br $cmp)\012  end\012  (i32.const 0) ;;impossib"
	.ascii	"le, just shut compiler up\012  return\012)\012\012("
	.ascii	"func $wax::str_len (param $ptr i32) (result i32)\012"
	.ascii	"  (local $offset i32)\012  (local.set $offset (i32."
	.ascii	"const 0))\012  loop $zero\012    (if (i32.load8_u ("
	.ascii	"i32.add (local.get $ptr) (local.get $offset))) (the"
	.ascii	"n\012      (local.set $offset (i32.add (local.get $"
	.ascii	"offset) (i32.const 1)))\012      (br $zero)\012    "
	.ascii	"))\012  end\012  (local.get $offset)\012  return\012"
	.ascii	")\012\012(func $wax::str_slice (param $ptr i32) (pa"
	.ascii	"ram $i i32) (param $n i32) (result i32)\012  (local"
	.ascii	" $nptr i32)\012  (local.set $nptr (call $wax::mallo"
	.ascii	"c (i32.add (local.get $n) (i32.const 1))))\012  (ca"
	.ascii	"ll $wax::memcpy \012    (local.get $nptr) \012    ("
	.ascii	"i32.add (local.get $ptr) (local.get $i)) \012    (l"
	.ascii	"ocal.get $n)\012  )\012  (i32.store8 (i32.add (loca"
	.ascii	"l.get $nptr) (local.get $n) ) (i32.const 0))\012  ("
	.ascii	"local.get $nptr)\012  return\012)\012\012(func $wax"
	.ascii	"::print (param $ptr i32)\012  (local $len i32)\012 "
	.ascii	" (local.set $len (call $wax::str_len (local.get $pt"
	.ascii	"r)))\012  (call $wax::js::console.log (local.get $p"
	.ascii	"tr) (local.get $len))\012)\012\012(func $wax::int2s"
	.ascii	"tr (param $x i32) (result i32)\012  (local $ptr i32"
	.ascii	")\012  (local $rem i32)\012  (local $isneg i32)\012"
	.ascii	"  (local $str i32)\012\012  (local.set $str (call $"
	.ascii	"wax::alloca (i32.const 16)))\012  (local.set $ptr ("
	.ascii	"i32.add (local.get $str) (i32.const 15)))\012  (i32"
	.ascii	".store8 (local.get $ptr) (i32.const 0))\012  \012  "
	.ascii	"(local.set $isneg (i32.const 0))\012  (if (i32.lt_s"
	.ascii	" (local.get $x) (i32.const 0)) (then\012    (local."
	.ascii	"set $isneg (i32.const 1))\012    (local.set $x (i32"
	.ascii	".sub (i32.const 0) (local.get $x) ))\012  ))\012\012"
	.ascii	"  loop $digits\012    (local.set $ptr (i32.sub (loc"
	.ascii	"al.get $ptr) (i32.const 1)))\012\012    (local.set "
	.ascii	"$rem (i32.rem_"
	.ascii	"u (local.get $x) (i32.const 10)))\012    (i32.store"
	.ascii	"8 (local.get $ptr) (i32.add (local.get $rem) (i32.c"
	.ascii	"onst 48)))\012\012    (local.set $x (i32.div_u (loc"
	.ascii	"al.get $x) (i32.const 10)))\012\012    (if (i32.eqz"
	.ascii	" (i32.eqz (local.get $x))) (then\012      (br $digi"
	.ascii	"ts)\012    ))\012  end\012\012  (if (local.get $isn"
	.ascii	"eg) (then\012    (local.set $ptr (i32.sub (local.ge"
	.ascii	"t $ptr) (i32.const 1)))\012    (i32.store8 (local.g"
	.ascii	"et $ptr) (i32.const 45)) ;; '-'\012  ))\012\012  (l"
	.ascii	"ocal.get $ptr)\012  return\012)\012\012(func $wax::"
	.ascii	"fint2str (param $x f32) (result i32)\012  (local $p"
	.ascii	"tr i32)\012  (local $rem i32)\012  (local $isneg i3"
	.ascii	"2)\012  (local $str i32)\012  (local.set $x (f32.tr"
	.ascii	"unc (local.get $x)))\012\012  (local.set $str (call"
	.ascii	" $wax::alloca (i32.const 48)))\012  (local.set $ptr"
	.ascii	" (i32.add (local.get $str) (i32.const 47)))\012  (i"
	.ascii	"32.store8 (local.get $ptr) (i32.const 0))\012  \012"
	.ascii	"  (if (f32.lt (local.get $x) (f32.const 0)) (then\012"
	.ascii	"    (local.set $isneg (i32.const 1))\012    (local."
	.ascii	"set $x (f32.sub (f32.const 0) (local.get $x) ))\012"
	.ascii	"  ))\012\012  loop $digits\012    (local.set $ptr ("
	.ascii	"i32.sub (local.get $ptr) (i32.const 1)))\012\012   "
	.ascii	" (local.set $rem (i32.trunc_f32_s (call $wax::fmod "
	.ascii	"(local.get $x) (f32.const 10.0))))\012    (i32.stor"
	.ascii	"e8 (local.get $ptr) (i32.add (local.get $rem) (i32."
	.ascii	"const 48)))\012\012    (local.set $x (f32.div (loca"
	.ascii	"l.get $x) (f32.const 10.0)))\012\012    (if (f32.gt"
	.ascii	" (local.get $x) (f32.const 0.99999994) ) (then ;;ne"
	.ascii	"xtafterf(1.00000001,0.0);\012      (br $digits)\012"
	.ascii	"    ))\012  end\012\012  (if (local.get $isneg) (th"
	.ascii	"en\012    (local.set $ptr (i32.sub (local.get $ptr)"
	.ascii	" (i32.const 1)))\012    (i32.store8 (local.get $ptr"
	.ascii	") (i32.const 45)) ;; '-'\012  ))\012\012  (local.ge"
	.ascii	"t $ptr)\012  return\012)\012\012\012\012\012(func $"
	.ascii	"wax::flt2str (param $x f32) (result i32)\012  (loca"
	.ascii	"l $ptr0 i32)\012  (local $ptr i32)\012  (local $rem"
	.ascii	" i32)\012  (local $isneg i32)\012  (local $str i32)"
	.ascii	"\012\012  (local.set $ptr0 (call $wax::fint2str (lo"
	.ascii	"cal.get $x)))\012\012  (if (f32.lt (local.get $x) ("
	.ascii	"f32.const 0)) (then\012    (local.set $x (f32.sub ("
	.ascii	"f32.const 0.0) (local.get $x)))\012  ))\012  (local"
	.ascii	".set $x (f32.sub (local.get $x) (f32.trunc (local.g"
	.ascii	"et $x))))\012  \012  (local.set $str (call $wax::al"
	.ascii	"loca (i32.const 16)))\012  (i3"
	.ascii	"2.store8 (i32.sub (local.get $str) (i32.const 1)) ("
	.ascii	"i32.const 46)  )\012  (local.set $ptr (local.get $s"
	.ascii	"tr))\012  \012  loop $digits\012    \012    (local."
	.ascii	"set $rem (i32.trunc_f32_s (f32.mul (local.get $x) ("
	.ascii	"f32.const 10.0)) ))\012    (i32.store8 (local.get $"
	.ascii	"ptr) (i32.add (local.get $rem) (i32.const 48)))\012"
	.ascii	"\012    (local.set $x (f32.sub (f32.mul (local.get "
	.ascii	"$x) (f32.const 10.0)) (f32.convert_i32_s (local.get"
	.ascii	" $rem))) )\012\012    (local.set $ptr (i32.add (loc"
	.ascii	"al.get $ptr) (i32.const 1)))\012\012    (if (i32.an"
	.ascii	"d\012      (f32.gt (local.get $x) (f32.const 1.1920"
	.ascii	"928955078126e-7) ) ;; floating-point epsilon\012   "
	.ascii	"   (i32.lt_s (i32.sub (local.get $ptr) (local.get $"
	.ascii	"str)) (i32.const 15))\012    )(then\012      (br $d"
	.ascii	"igits)\012    ))\012  end\012  (i32.store8 (local.g"
	.ascii	"et $ptr) (i32.const 0))\012\012  (local.get $ptr0)\012"
	.ascii	"  return\012\012)\012\012(func $wax::str2int (param"
	.ascii	" $s i32) (result i32)\012  (local $x i32)\012  (loc"
	.ascii	"al $ptr i32)\012  (local $d i32)\012  (local $sign "
	.ascii	"i32)\012  (local.set $x (i32.const 0))\012\012  (lo"
	.ascii	"cal.set $ptr (local.get $s))\012\012  (local.set $s"
	.ascii	"ign (i32.const 1))\012  (if (i32.eq (i32.load8_s (l"
	.ascii	"ocal.get $ptr) ) (i32.const 45) ) (then ;;'-'\012  "
	.ascii	"  (local.set $sign (i32.const -1))\012    (local.se"
	.ascii	"t $ptr (i32.add (local.get $ptr) (i32.const 1)))\012"
	.ascii	"  )(else(if (i32.eq (i32.load8_s (local.get $ptr) )"
	.ascii	" (i32.const 43) ) (then ;;'+'\012    (local.set $pt"
	.ascii	"r (i32.add (local.get $ptr) (i32.const 1))) ;;redun"
	.ascii	"dant\012  ))))\012\012  loop $digits\012    (local."
	.ascii	"set $d (i32.load8_s (local.get $ptr) ))\012    (if "
	.ascii	"(i32.or\012      (i32.lt_s (local.get $d) (i32.cons"
	.ascii	"t 48))\012      (i32.gt_s (local.get $d) (i32.const"
	.ascii	" 57))\012    )(then\012      (i32.mul (local.get $s"
	.ascii	"ign) (local.get $x))\012      return\012    ))\012 "
	.ascii	"   \012    (local.set $x (i32.mul (local.get $x) (i"
	.ascii	"32.const 10)))\012    (local.set $x (i32.add (local"
	.ascii	".get $x) (i32.sub (local.get $d) (i32.const 48))))\012"
	.ascii	"    \012    (local.set $ptr (i32.add (local.get $pt"
	.ascii	"r) (i32.const 1)))\012    (br $digits)\012  end\012"
	.ascii	"\012  (i32.mul (local.get $sign) (local.get $x))\012"
	.ascii	"  return\012)\012\012(func $wax::str2flt (param $s "
	.ascii	"i32) (result f32)\012  (local $x f32)\012  (local $"
	.ascii	"ptr i32)\012  (local $d i32)\012  (local $sign f32)"
	.ascii	"\012  "
	.ascii	"(local $mlt f32)\012\012  (local.set $x (f32.const "
	.ascii	"0.0))\012\012  (local.set $ptr (local.get $s))\012\012"
	.ascii	"\012  (local.set $sign (f32.const 1.0))\012  (if (i"
	.ascii	"32.eq (i32.load8_s (local.get $ptr) ) (i32.const 45"
	.ascii	") ) (then ;;'-'\012    (local.set $sign (f32.const "
	.ascii	"-1))\012    (local.set $ptr (i32.add (local.get $pt"
	.ascii	"r) (i32.const 1)))\012  )(else(if (i32.eq (i32.load"
	.ascii	"8_s (local.get $ptr) ) (i32.const 43) ) (then ;;'+'"
	.ascii	"\012    (local.set $ptr (i32.add (local.get $ptr) ("
	.ascii	"i32.const 1))) ;;redundant\012  ))))\012\012  block"
	.ascii	" $out\012  loop $digits\012    (local.set $d (i32.l"
	.ascii	"oad8_s (local.get $ptr) ))\012    (if (i32.eq (loca"
	.ascii	"l.get $d) (i32.const 46)) (then ;; '.'\012      (lo"
	.ascii	"cal.set $ptr (i32.add (local.get $ptr) (i32.const 1"
	.ascii	")))\012      (br $out)\012    ))\012    (if (i32.or"
	.ascii	"\012      (i32.lt_s (local.get $d) (i32.const 48))\012"
	.ascii	"      (i32.gt_s (local.get $d) (i32.const 57))\012 "
	.ascii	"   )(then\012      (f32.mul (local.get $sign) (loca"
	.ascii	"l.get $x))\012      return\012    ))\012    \012   "
	.ascii	" (local.set $x (f32.mul (local.get $x) (f32.const 1"
	.ascii	"0.0)))\012    (local.set $x (f32.add (local.get $x)"
	.ascii	" (f32.convert_i32_s (i32.sub (local.get $d) (i32.co"
	.ascii	"nst 48)))))\012    \012    (local.set $ptr (i32.add"
	.ascii	" (local.get $ptr) (i32.const 1)))\012    (br $digit"
	.ascii	"s)\012  end\012  end\012\012  (local.set $mlt (f32."
	.ascii	"const 0.1))\012  loop $fracs\012    (local.set $d ("
	.ascii	"i32.load8_s (local.get $ptr) ))\012\012    (if (i32"
	.ascii	".or\012      (i32.lt_s (local.get $d) (i32.const 48"
	.ascii	"))\012      (i32.gt_s (local.get $d) (i32.const 57)"
	.ascii	")\012    )(then\012      (f32.mul (local.get $sign)"
	.ascii	" (local.get $x))\012      return\012    ))\012    ("
	.ascii	"local.set $x (f32.add\012      (local.get $x)\012  "
	.ascii	"    (f32.mul (f32.convert_i32_s (i32.sub (local.get"
	.ascii	" $d) (i32.const 48))) (local.get $mlt))\012    ))\012"
	.ascii	"    (local.set $mlt (f32.mul (local.get $mlt) (f32."
	.ascii	"const 0.1)))\012    \012    (local.set $ptr (i32.ad"
	.ascii	"d (local.get $ptr) (i32.const 1)))\012\012    (br $"
	.ascii	"fracs)\012  end\012\012  (f32.mul (local.get $sign)"
	.ascii	" (local.get $x))\012  return\012)\012\000"
	.data
	.align	2
	.type	TEXT_std_str_wat, %object
	.size	TEXT_std_str_wat, 4
TEXT_std_str_wat:
	.word	.LC11
	.global	TEXT_std_malloc_wat
	.section	.rodata
	.align	2
.LC12:
	.ascii	";;================================================="
	.ascii	"=======;;\012;;     BASELINE MALLOC WITH HANDWRITTE"
	.ascii	"N WEBASSEMBLY       ;;\012;;======================="
	.ascii	"=================================;;\012;; 32-bit im"
	.ascii	"plicit-free-list first-fit baseline malloc    ;;\012"
	.ascii	";;-------------------------------------------------"
	.ascii	"-------;;\012\012;; IMPLICIT FREE LIST:\012;; Worse"
	.ascii	" utilization and throughput than explicit/segregate"
	.ascii	"d, but easier\012;; to implement :P\012;;\012;; HEA"
	.ascii	"P LO                                               "
	.ascii	"          HEAP HI\012;; +---------------------+----"
	.ascii	"-----------------+...+---------------------+\012;; "
	.ascii	"| HDR | PAYLOAD | FTR | HDR | PAYLOAD | FTR |...+ H"
	.ascii	"DR | PAYLOAD | FTR |\012;; +----------^----------+-"
	.ascii	"--------------------+...+---------------------+\012"
	.ascii	";;            |_ i.e. user data\012;;           \012"
	.ascii	";; LAYOUT OF A BLOCK:\012;; Since memory is aligned"
	.ascii	" to multiple of 4 bytes, the last two bits of\012;;"
	.ascii	" payload_size is redundant. Therefore the last bit "
	.ascii	"of header is used to\012;; store the is_free flag.\012"
	.ascii	";; \012;; |---- HEADER (4b)----\012;; |    ,--paylo"
	.ascii	"ad size (x4)--.     ,-is free?\012;; | 0b . . . . ."
	.ascii	" . . . . . . . 0  0\012;; |------ PAYLOAD -----\012"
	.ascii	";; |\012;; |  user data (N x 4b)\012;; |\012;; |---"
	.ascii	"- FOOTER (4b)---- (duplicate of header)\012;; |    "
	.ascii	",--payload size (x4)--.     ,-is free?\012;; | 0b ."
	.ascii	" . . . . . . . . . . . 0  0\012;; |----------------"
	.ascii	"----\012;;\012;; FORMULAS:\012;; (these formulas ar"
	.ascii	"e used throughout the code, so they're listed here\012"
	.ascii	";; instead of explained each time encountered)\012;"
	.ascii	";\012;; payload_size = block_size - (header_size + "
	.ascii	"footer_size) = block_size - 8\012;; \012;; payload_"
	.ascii	"pointer = header_pointer + header_size = header_poi"
	.ascii	"nter + 4\012;;\012;; footer_pointer = header_pointe"
	.ascii	"r + header_size + payload_size\012;;               "
	.ascii	" = (header_pointer + payload_size) + 4\012;;\012;; "
	.ascii	"next_header_pointer = footer_pointer + footer_size "
	.ascii	"= footer_pointer + 4\012;;\012;; prev_footer_pointe"
	.ascii	"r = header_pointer - footer_size = header_pointer -"
	.ascii	" 4\012\012(memory $wax::mem 1)                     "
	.ascii	"           ;; start with 1 page (64K)\012(export \""
	.ascii	"mem\" (memory $wax::mem))\012;;// (global $wax::min"
	.ascii	"_a"
	.ascii	"ddr (mut i32) (i32.const 0))  ;; set by wax compile"
	.ascii	"r depending on data section size\012(global $wax::m"
	.ascii	"ax_addr (mut i32) (i32.const 65536)) ;; initial hea"
	.ascii	"p size (64K)\012(global $wax::heap_did_init (mut i3"
	.ascii	"2) (i32.const 0))     ;; init() called?\012\012;; h"
	.ascii	"elpers to pack/unpack payload_size/is_free from hea"
	.ascii	"der/footer\012;; by masking out bits\012\012;; read"
	.ascii	" payload_size from header/footer given pointer to h"
	.ascii	"eader/footer\012(func $wax::hdr_get_size (param $pt"
	.ascii	"r i32) (result i32)\012  (i32.and (i32.load (local."
	.ascii	"get $ptr)) (i32.const 0xFFFFFFFC))\012)\012;; read "
	.ascii	"is_free from header/footer\012(func $wax::hdr_get_f"
	.ascii	"ree (param $ptr i32) (result i32)\012  (i32.and (i3"
	.ascii	"2.load (local.get $ptr)) (i32.const 0x00000001))\012"
	.ascii	")\012;; write payload_size to header/footer\012(fun"
	.ascii	"c $wax::hdr_set_size (param $ptr i32) (param $n i32"
	.ascii	") \012  (i32.store (local.get $ptr) (i32.or\012    "
	.ascii	"(i32.and (i32.load (local.get $ptr)) (i32.const 0x0"
	.ascii	"0000003))\012    (local.get $n)\012  ))\012)\012;; "
	.ascii	"write is_free to header/footer\012(func $wax::hdr_s"
	.ascii	"et_free (param $ptr i32) (param $n i32)\012  (i32.s"
	.ascii	"tore (local.get $ptr) (i32.or\012    (i32.and (i32."
	.ascii	"load (local.get $ptr)) (i32.const 0xFFFFFFFE))\012 "
	.ascii	"   (local.get $n)\012  ))\012)\012;; align memory b"
	.ascii	"y 4 bytes\012(func $wax::align4 (param $x i32) (res"
	.ascii	"ult i32)\012  (i32.and\012    (i32.add (local.get $"
	.ascii	"x) (i32.const 3))\012    (i32.const -4)\012  )\012)"
	.ascii	"\012\012;; initialize heap\012;; make the whole hea"
	.ascii	"p a big free block\012;; - automatically invoked by"
	.ascii	" first malloc() call\012;; - can be manually called"
	.ascii	" to nuke the whole heap\012(func $wax::init_heap\012"
	.ascii	"  (i32.store (i32.const 0) (global.get $wax::min_ad"
	.ascii	"dr) )\012  ;; write payload_size to header and foot"
	.ascii	"er\012  (call $wax::hdr_set_size (global.get $wax::"
	.ascii	"min_addr) \012    (i32.sub (i32.sub (global.get $wa"
	.ascii	"x::max_addr) (global.get $wax::min_addr)) (i32.cons"
	.ascii	"t 8))\012  )\012  (call $wax::hdr_set_size (i32.sub"
	.ascii	" (global.get $wax::max_addr) (i32.const 4))\012    "
	.ascii	"(i32.sub (i32.sub (global.get $wax::max_addr) (glob"
	.ascii	"al.get $wax::min_addr)) (i32.const 8))\012  )\012  "
	.ascii	";; write is_free to header and footer\012  (call $w"
	.ascii	"ax::hdr_set_free (global.get $wax::min_addr) (i32.c"
	.ascii	"onst 1))\012"
	.ascii	"  (call $wax::hdr_set_free (i32.sub (global.get $wa"
	.ascii	"x::max_addr) (i32.const 4)) (i32.const 1))\012\012 "
	.ascii	" ;; set flag to tell malloc() that we've already ca"
	.ascii	"lled init()\012  (global.set $wax::heap_did_init (i"
	.ascii	"32.const 1)) \012)\012\012;; extend (grow) the heap"
	.ascii	" (to accomodate more blocks)\012;; parameter: numbe"
	.ascii	"r of pages (64K) to grow\012;; - automatically invo"
	.ascii	"ked by malloc() when current heap has insufficient "
	.ascii	"free space\012;; - can be manually called to get mo"
	.ascii	"re space in advance\012(func $wax::extend (param $n"
	.ascii	"_pages i32)\012  (local $n_bytes i32)\012  (local $"
	.ascii	"ftr i32)\012  (local $prev_ftr i32)\012  (local $pr"
	.ascii	"ev_hdr i32)\012  (local $prev_size i32)\012\012  (l"
	.ascii	"ocal.set $prev_ftr (i32.sub (global.get $wax::max_a"
	.ascii	"ddr) (i32.const 4)) )\012\012  ;; compute number of"
	.ascii	" bytes from page count (1page = 64K = 65536bytes)\012"
	.ascii	"  (local.set $n_bytes (i32.mul (local.get $n_pages)"
	.ascii	" (i32.const 65536)))\012\012  ;; system call to gro"
	.ascii	"w memory (`drop` discards the (useless) return valu"
	.ascii	"e of memory.grow)\012  (drop (memory.grow (local.ge"
	.ascii	"t $n_pages) ))\012\012  ;; make the newly acquired "
	.ascii	"memory a big free block\012  (call $wax::hdr_set_si"
	.ascii	"ze (global.get $wax::max_addr) (i32.sub (local.get "
	.ascii	"$n_bytes) (i32.const 8)))\012  (call $wax::hdr_set_"
	.ascii	"free (global.get $wax::max_addr) (i32.const 1))\012"
	.ascii	"\012  (global.set $wax::max_addr (i32.add (global.g"
	.ascii	"et $wax::max_addr) (local.get $n_bytes) ))\012  (lo"
	.ascii	"cal.set $ftr (i32.sub (global.get $wax::max_addr) ("
	.ascii	"i32.const 4)))\012\012  (call $wax::hdr_set_size (l"
	.ascii	"ocal.get $ftr)\012    (i32.sub (local.get $n_bytes)"
	.ascii	" (i32.const 8))\012  )\012  (call $wax::hdr_set_fre"
	.ascii	"e (local.get $ftr) (i32.const 1))\012\012  ;; see i"
	.ascii	"f we can join the new block with the last block of "
	.ascii	"the old heap\012  (if (i32.eqz (call $wax::hdr_get_"
	.ascii	"free (local.get $prev_ftr)))(then)(else\012\012    "
	.ascii	";; the last block is free, join it.\012    (local.s"
	.ascii	"et $prev_size (call $wax::hdr_get_size (local.get $"
	.ascii	"prev_ftr)))\012    (local.set $prev_hdr\012      (i"
	.ascii	"32.sub (i32.sub (local.get $prev_ftr) (local.get $p"
	.ascii	"rev_size)) (i32.const 4))\012    )\012    (call $wa"
	.ascii	"x::hdr_set_size (local.get $prev_hdr)\012      (i32"
	.ascii	".add (local.get $prev_size) (local.get $n_byt"
	.ascii	"es) )\012    )\012    (call $wax::hdr_set_size (loc"
	.ascii	"al.get $ftr)\012      (i32.add (local.get $prev_siz"
	.ascii	"e) (local.get $n_bytes) )\012    )\012  ))\012\012)"
	.ascii	"\012\012;; find a free block that fit the request n"
	.ascii	"umber of bytes\012;; modifies the heap once a candi"
	.ascii	"date is found\012;; first-fit: not the best policy,"
	.ascii	" but the simplest\012(func $wax::find (param $n_byt"
	.ascii	"es i32) (result i32)\012  (local $ptr i32)\012  (lo"
	.ascii	"cal $size i32)\012  (local $is_free i32)\012  (loca"
	.ascii	"l $pay_ptr i32)\012  (local $rest i32)\012\012  ;; "
	.ascii	"loop through all blocks\012  (local.set $ptr (globa"
	.ascii	"l.get $wax::min_addr))\012  loop $search\012    ;; "
	.ascii	"we reached the end of heap and haven't found anythi"
	.ascii	"ng, return NULL\012    (if (i32.lt_u (local.get $pt"
	.ascii	"r) (global.get $wax::max_addr))(then)(else\012     "
	.ascii	" (i32.const 0)\012      return\012    ))\012\012   "
	.ascii	" ;; read info about current block\012    (local.set"
	.ascii	" $size    (call $wax::hdr_get_size (local.get $ptr)"
	.ascii	"))\012    (local.set $is_free (call $wax::hdr_get_f"
	.ascii	"ree (local.get $ptr)))\012    (local.set $pay_ptr ("
	.ascii	"i32.add (local.get $ptr) (i32.const 4) ))\012\012  "
	.ascii	"  ;; check if the current block is free\012    (if "
	.ascii	"(i32.eq (local.get $is_free) (i32.const 1))(then\012"
	.ascii	"\012      ;; it's free, but too small, move on\012 "
	.ascii	"     (if (i32.gt_u (local.get $n_bytes) (local.get "
	.ascii	"$size))(then\012        (local.set $ptr (i32.add (l"
	.ascii	"ocal.get $ptr) (i32.add (local.get $size) (i32.cons"
	.ascii	"t 8))))\012        (br $search)\012\012      ;; it'"
	.ascii	"s free, and large enough to be split into two block"
	.ascii	"s\012      )(else(if (i32.lt_u (local.get $n_bytes)"
	.ascii	" (i32.sub (local.get $size) (i32.const 8)))(then\012"
	.ascii	"        ;; OLD HEAP\012        ;; ...+-------------"
	.ascii	"------------------------------+...\012        ;; .."
	.ascii	".| HDR |              FREE             | FTR |...\012"
	.ascii	"        ;; ...+------------------------------------"
	.ascii	"-------+...\012        ;; NEW HEAP\012        ;; .."
	.ascii	".+---------------------+---------------------+...\012"
	.ascii	"        ;; ...| HDR | ALLOC   | FTR | HDR |  FREE  "
	.ascii	" | FTR |...\012        ;; ...+---------------------"
	.ascii	"+---------------------+...\012\012        ;; size o"
	.ascii	"f the remaining half\012        (local.set $rest (i"
	.ascii	"32.sub (i32.sub (local.get $size) (local.get $n_byt"
	.ascii	"es) ) (i32."
	.ascii	"const 8)))\012\012        ;; update headers and foo"
	.ascii	"ters to reflect the change (see FORMULAS)\012\012  "
	.ascii	"      (call $wax::hdr_set_size (local.get $ptr) (lo"
	.ascii	"cal.get $n_bytes))\012        (call $wax::hdr_set_f"
	.ascii	"ree (local.get $ptr) (i32.const 0))\012\012        "
	.ascii	"(call $wax::hdr_set_size (i32.add (i32.add (local.g"
	.ascii	"et $ptr) (local.get $n_bytes)) (i32.const 4))\012  "
	.ascii	"        (local.get $n_bytes)\012        )\012      "
	.ascii	"  (call $wax::hdr_set_free (i32.add (i32.add (local"
	.ascii	".get $ptr) (local.get $n_bytes)) (i32.const 4))\012"
	.ascii	"          (i32.const 0)\012        )\012        (ca"
	.ascii	"ll $wax::hdr_set_size (i32.add (i32.add (local.get "
	.ascii	"$ptr) (local.get $n_bytes)) (i32.const 8))\012     "
	.ascii	"     (local.get $rest)\012        )\012        (cal"
	.ascii	"l $wax::hdr_set_free (i32.add (i32.add (local.get $"
	.ascii	"ptr) (local.get $n_bytes)) (i32.const 8))\012      "
	.ascii	"    (i32.const 1)\012        )\012        (call $wa"
	.ascii	"x::hdr_set_size (i32.add (i32.add (local.get $ptr) "
	.ascii	"(local.get $size)) (i32.const 4))\012          (loc"
	.ascii	"al.get $rest)\012        )\012\012        (local.ge"
	.ascii	"t $pay_ptr)\012        return\012\012      )(else\012"
	.ascii	"        ;; the block is free, but not large enough "
	.ascii	"to be split into two blocks \012        ;; we retur"
	.ascii	"n the whole block as one\012        (call $wax::hdr"
	.ascii	"_set_free (local.get $ptr) (i32.const 0))\012      "
	.ascii	"  (call $wax::hdr_set_free (i32.add (i32.add (local"
	.ascii	".get $ptr) (local.get $size)) (i32.const 4))\012   "
	.ascii	"       (i32.const 0)\012        )\012        (local"
	.ascii	".get $pay_ptr)\012        return\012      ))))\012 "
	.ascii	"   )(else\012      ;; the block is not free, we mov"
	.ascii	"e on to the next block\012      (local.set $ptr (i3"
	.ascii	"2.add (local.get $ptr) (i32.add (local.get $size) ("
	.ascii	"i32.const 8))))\012      (br $search)\012    ))\012"
	.ascii	"  end\012\012  ;; theoratically we will not reach h"
	.ascii	"ere\012  ;; return NULL\012  (i32.const 0)\012)\012"
	.ascii	"\012\012;; malloc - allocate the requested number o"
	.ascii	"f bytes on the heap\012;; returns a pointer to the "
	.ascii	"block of memory allocated\012;; returns NULL (0) wh"
	.ascii	"en OOM\012;; if heap is not large enough, grows it "
	.ascii	"via extend()\012(func $wax::malloc (param $n_bytes "
	.ascii	"i32) (result i32)\012  (local $ptr i32)\012  (local"
	.ascii	" $n_pages i32)\012\012  ;; call init() if we haven'"
	.ascii	"t done so yet\012  (if (i32.eq"
	.ascii	"z (global.get $wax::heap_did_init)) (then\012    (c"
	.ascii	"all $wax::init_heap)\012  ))\012\012  ;; payload si"
	.ascii	"ze is aligned to multiple of 4\012  (local.set $n_b"
	.ascii	"ytes (call $wax::align4 (local.get $n_bytes)))\012\012"
	.ascii	"  ;; attempt allocation\012  (local.set $ptr (call "
	.ascii	"$wax::find (local.get $n_bytes)) )\012\012  ;; NULL"
	.ascii	" -> OOM -> extend heap\012  (if (i32.eqz (local.get"
	.ascii	" $ptr))(then\012    ;; compute # of pages from # of"
	.ascii	" bytes, rounding up\012    (local.set $n_pages\012 "
	.ascii	"     (i32.div_u \012        (i32.add (local.get $n_"
	.ascii	"bytes) (i32.const 65527) )\012        (i32.const 65"
	.ascii	"528)\012      )\012    )\012    (call $wax::extend "
	.ascii	"(local.get $n_pages))\012\012    ;; try again\012  "
	.ascii	"  (local.set $ptr (call $wax::find (local.get $n_by"
	.ascii	"tes)) )\012  ))\012  (local.get $ptr)\012)\012\012;"
	.ascii	"; free - free an allocated block given a pointer to"
	.ascii	" it\012(func $wax::free (param $ptr i32)\012  (loca"
	.ascii	"l $hdr i32)\012  (local $ftr i32)\012  (local $size"
	.ascii	" i32)\012  (local $prev_hdr i32)\012  (local $prev_"
	.ascii	"ftr i32)\012  (local $prev_size i32)\012  (local $p"
	.ascii	"rev_free i32)\012  (local $next_hdr i32)\012  (loca"
	.ascii	"l $next_ftr i32)\012  (local $next_size i32)\012  ("
	.ascii	"local $next_free i32)\012  \012  ;; step I: mark th"
	.ascii	"e block as free\012\012  (local.set $hdr (i32.sub ("
	.ascii	"local.get $ptr) (i32.const 4)))\012  (local.set $si"
	.ascii	"ze (call $wax::hdr_get_size (local.get $hdr)))\012 "
	.ascii	" (local.set $ftr (i32.add (i32.add (local.get $hdr)"
	.ascii	" (local.get $size)) (i32.const 4)))\012\012  (call "
	.ascii	"$wax::hdr_set_free (local.get $hdr) (i32.const 1))\012"
	.ascii	"  (call $wax::hdr_set_free (local.get $ftr) (i32.co"
	.ascii	"nst 1))\012\012  ;; step II: try coalasce\012\012  "
	.ascii	";; coalasce with previous block\012\012  ;; check t"
	.ascii	"hat we're not already the first block\012  (if (i32"
	.ascii	".eq (local.get $hdr) (global.get $wax::min_addr)) ("
	.ascii	"then)(else\012\012    ;; read info about previous b"
	.ascii	"lock\012    (local.set $prev_ftr (i32.sub (local.ge"
	.ascii	"t $hdr) (i32.const 4)))\012    (local.set $prev_siz"
	.ascii	"e (call $wax::hdr_get_size (local.get $prev_ftr)))\012"
	.ascii	"    (local.set $prev_hdr \012      (i32.sub (i32.su"
	.ascii	"b (local.get $prev_ftr) (local.get $prev_size)) (i3"
	.ascii	"2.const 4))\012    )\012\012    ;; check if previou"
	.ascii	"s block is free -> merge them\012    (if (i32.eqz ("
	.ascii	"call $wax::hdr_get_free (local.get $prev_ftr"
	.ascii	"))) (then) (else\012      (local.set $size (i32.add"
	.ascii	" (i32.add (local.get $size) (local.get $prev_size))"
	.ascii	" (i32.const 8)))\012      (call $wax::hdr_set_size "
	.ascii	"(local.get $prev_hdr) (local.get $size))\012      ("
	.ascii	"call $wax::hdr_set_size (local.get $ftr) (local.get"
	.ascii	" $size))\012\012      ;; set current header pointer"
	.ascii	" to previous header\012      (local.set $hdr (local"
	.ascii	".get $prev_hdr))\012    ))\012  ))\012\012  ;; coal"
	.ascii	"asce with next block\012\012  (local.set $next_hdr "
	.ascii	"(i32.add (local.get $ftr) (i32.const 4)))\012\012  "
	.ascii	";; check that we're not already the last block\012 "
	.ascii	" (if (i32.eq (local.get $next_hdr) (global.get $wax"
	.ascii	"::max_addr)) (then)(else\012    \012    ;; read inf"
	.ascii	"o about next block\012    (local.set $next_size (ca"
	.ascii	"ll $wax::hdr_get_size (local.get $next_hdr)))\012  "
	.ascii	"  (local.set $next_ftr \012      (i32.add (i32.add "
	.ascii	"(local.get $next_hdr) (local.get $next_size)) (i32."
	.ascii	"const 4))\012    )\012\012    ;; check if next bloc"
	.ascii	"k is free -> merge them\012    (if (i32.eqz (call $"
	.ascii	"wax::hdr_get_free (local.get $next_hdr))) (then) (e"
	.ascii	"lse\012      (local.set $size (i32.add (i32.add (lo"
	.ascii	"cal.get $size) (local.get $next_size)) (i32.const 8"
	.ascii	")))\012      (call $wax::hdr_set_size (local.get $h"
	.ascii	"dr) (local.get $size))\012      (call $wax::hdr_set"
	.ascii	"_size (local.get $next_ftr) (local.get $size))\012 "
	.ascii	"   ))\012\012  ))\012\012)\012;; copy a block of me"
	.ascii	"mory over, from src pointer to dst pointer\012;; We"
	.ascii	"bAssembly seems to be planning to support memory.co"
	.ascii	"py\012;; until then, this function uses a loop and "
	.ascii	"i32.store8/load8\012(func $wax::memcpy (param $dst "
	.ascii	"i32) (param $src i32) (param $n_bytes i32)\012  (lo"
	.ascii	"cal $ptr i32)\012  (local $offset i32)\012  (local "
	.ascii	"$data i32)\012\012  (if (i32.eqz (local.get $n_byte"
	.ascii	"s))(then\012    return\012  ))\012\012  (local.set "
	.ascii	"$offset (i32.const 0))\012\012  loop $cpy\012    (l"
	.ascii	"ocal.set $data (i32.load8_u (i32.add (local.get $sr"
	.ascii	"c) (local.get $offset))))\012    (i32.store8 (i32.a"
	.ascii	"dd (local.get $dst) (local.get $offset)) (local.get"
	.ascii	" $data))\012\012    (local.set $offset (i32.add (lo"
	.ascii	"cal.get $offset) (i32.const 1)))\012    (br_if $cpy"
	.ascii	" (i32.lt_u (local.get $offset) (local.get $n_bytes)"
	.ascii	"))\012  end\012)\012\012;; reallocate memory to new"
	.ascii	" size\012;; currently does no"
	.ascii	"t support contraction\012;; nothing will happen if "
	.ascii	"n_bytes is smaller than current payload size\012(fu"
	.ascii	"nc $wax::realloc (param $ptr i32) (param $n_bytes i"
	.ascii	"32) (result i32)\012  (local $hdr i32)\012  (local "
	.ascii	"$next_hdr i32)\012  (local $next_ftr i32)\012  (loc"
	.ascii	"al $next_size i32)\012  (local $ftr i32)\012  (loca"
	.ascii	"l $size i32)\012  (local $rest_hdr i32)\012  (local"
	.ascii	" $rest_size i32)\012  (local $new_ptr i32)\012\012 "
	.ascii	" (local.set $hdr (i32.sub (local.get $ptr) (i32.con"
	.ascii	"st 4)))\012  (local.set $size (call $wax::hdr_get_s"
	.ascii	"ize (local.get $hdr)))\012\012  (if (i32.gt_u (loca"
	.ascii	"l.get $n_bytes) (local.get $size)) (then) (else\012"
	.ascii	"    (local.get $ptr)\012    return\012  ))\012\012 "
	.ascii	" ;; payload size is aligned to multiple of 4\012  ("
	.ascii	"local.set $n_bytes (call $wax::align4 (local.get $n"
	.ascii	"_bytes)))\012\012  (local.set $next_hdr (i32.add (i"
	.ascii	"32.add (local.get $hdr) (local.get $size)) (i32.con"
	.ascii	"st 8)))\012\012  ;; Method I: try to expand the cur"
	.ascii	"rent block\012\012  ;; check that we're not already"
	.ascii	" the last block\012  (if (i32.lt_u (local.get $next"
	.ascii	"_hdr) (global.get $wax::max_addr) )(then\012    (if"
	.ascii	" (call $wax::hdr_get_free (local.get $next_hdr)) (t"
	.ascii	"hen\012\012      (local.set $next_size (call $wax::"
	.ascii	"hdr_get_size (local.get $next_hdr)))\012      (loca"
	.ascii	"l.set $rest_size (i32.sub \012        (local.get $n"
	.ascii	"ext_size)\012        (i32.sub (local.get $n_bytes) "
	.ascii	"(local.get $size))\012      ))\012      (local.set "
	.ascii	"$next_ftr (i32.add (i32.add (local.get $next_hdr) ("
	.ascii	"local.get $next_size)) (i32.const 4)))\012\012     "
	.ascii	" ;; next block is big enough to be split into two\012"
	.ascii	"      (if (i32.gt_s (local.get $rest_size) (i32.con"
	.ascii	"st 0) ) (then\012        \012        (call $wax::hd"
	.ascii	"r_set_size (local.get $hdr) (local.get $n_bytes))\012"
	.ascii	"        \012        (local.set $ftr (i32.add (i32.a"
	.ascii	"dd (local.get $hdr) (local.get $n_bytes) ) (i32.con"
	.ascii	"st 4)))\012        (call $wax::hdr_set_size (local."
	.ascii	"get $ftr) (local.get $n_bytes))\012        (call $w"
	.ascii	"ax::hdr_set_free (local.get $ftr) (i32.const 0))\012"
	.ascii	"\012        (local.set $rest_hdr (i32.add (local.ge"
	.ascii	"t $ftr) (i32.const 4) ))\012        (call $wax::hdr"
	.ascii	"_set_size (local.get $rest_hdr) (local.get $rest_si"
	.ascii	"ze))\012        (call $wax::hdr_set_free (local.get"
	.ascii	" $r"
	.ascii	"est_hdr) (i32.const 1))\012\012        (call $wax::"
	.ascii	"hdr_set_size (local.get $next_ftr) (local.get $rest"
	.ascii	"_size))\012        (call $wax::hdr_set_free (local."
	.ascii	"get $next_ftr) (i32.const 1))\012\012        (local"
	.ascii	".get $ptr)\012        return\012\012      ;; next b"
	.ascii	"lock is not big enough to be split, but is\012     "
	.ascii	" ;; big enough to merge with the current one into o"
	.ascii	"ne\012      )(else (if (i32.gt_s (local.get $rest_s"
	.ascii	"ize) (i32.const -9) ) (then\012      \012        (l"
	.ascii	"ocal.set $size (i32.add (i32.add (local.get $size) "
	.ascii	"(i32.const 8) ) (local.get $next_size)))\012       "
	.ascii	" (call $wax::hdr_set_size (local.get $hdr) (local.g"
	.ascii	"et $size))\012        (call $wax::hdr_set_size (loc"
	.ascii	"al.get $next_ftr) (local.get $size))\012        (ca"
	.ascii	"ll $wax::hdr_set_free (local.get $next_ftr) (i32.co"
	.ascii	"nst 0))\012\012        (local.get $ptr)\012        "
	.ascii	"return\012      ))))\012\012    ))\012  ))\012\012 "
	.ascii	" ;; Method II: allocate a new block and copy over\012"
	.ascii	"\012  (local.set $new_ptr (call $wax::malloc (local"
	.ascii	".get $n_bytes)))\012  (call $wax::memcpy (local.get"
	.ascii	" $new_ptr) (local.get $ptr) (local.get $size))\012 "
	.ascii	" (call $wax::free (local.get $ptr))\012  (local.get"
	.ascii	" $new_ptr)\012\012)\012\012(func $wax::calloc (para"
	.ascii	"m $n_bytes i32) (result i32)\012  (local $ptr i32)\012"
	.ascii	"  (local $offset i32)\012  (local.set $ptr (call $w"
	.ascii	"ax::malloc (local.get $n_bytes)))\012  (local.set $"
	.ascii	"offset (i32.const 0))\012  loop $zero\012    (if (i"
	.ascii	"32.lt_u (local.get $offset) (local.get $n_bytes)) ("
	.ascii	"then\012      (i32.store8 (i32.add (local.get $offs"
	.ascii	"et) (local.get $ptr) ) (i32.const 0))\012      (loc"
	.ascii	"al.set $offset (i32.add (local.get $offset) (i32.co"
	.ascii	"nst 1)))\012      (br $zero)\012    ))\012  end\012"
	.ascii	"  (local.get $ptr)\012  return\012)\012\012(func $w"
	.ascii	"ax::memmove (param $dst i32) (param $src i32) (para"
	.ascii	"m $n_bytes i32)\012  (local $ptr i32)\012  (local $"
	.ascii	"offset i32)\012  (local $data i32)\012\012  (if (i3"
	.ascii	"2.eqz (local.get $n_bytes))(then\012    return\012 "
	.ascii	" ))\012  \012  (if (i32.gt_u (local.get $dst) (loca"
	.ascii	"l.get $src)) (then\012    (local.set $offset (i32.s"
	.ascii	"ub (local.get $n_bytes) (i32.const 1)))\012    loop"
	.ascii	" $cpy_rev\012      (local.set $data (i32.load8_u (i"
	.ascii	"32.add (local.get $src) (local.get $offset))))\012 "
	.ascii	"     (i32.store8 (i32.add (local.get $d"
	.ascii	"st) (local.get $offset)) (local.get $data))\012\012"
	.ascii	"      (local.set $offset (i32.sub (local.get $offse"
	.ascii	"t) (i32.const 1)))\012      (br_if $cpy_rev (i32.gt"
	.ascii	"_s (local.get $offset) (i32.const -1)))\012    end\012"
	.ascii	"  \012  )(else\012    (local.set $offset (i32.const"
	.ascii	" 0))\012    loop $cpy\012      (local.set $data (i3"
	.ascii	"2.load8_u (i32.add (local.get $src) (local.get $off"
	.ascii	"set))))\012      (i32.store8 (i32.add (local.get $d"
	.ascii	"st) (local.get $offset)) (local.get $data))\012\012"
	.ascii	"      (local.set $offset (i32.add (local.get $offse"
	.ascii	"t) (i32.const 1)))\012      (br_if $cpy (i32.lt_u ("
	.ascii	"local.get $offset) (local.get $n_bytes)))\012    en"
	.ascii	"d\012  ))\012)\012\012\000"
	.data
	.align	2
	.type	TEXT_std_malloc_wat, %object
	.size	TEXT_std_malloc_wat, 4
TEXT_std_malloc_wat:
	.word	.LC12
	.global	TEXT_std_map_wat
	.section	.rodata
	.align	2
.LC13:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;;       "
	.ascii	"                           ;;\012;;                "
	.ascii	"                  ;;\012;;                MAP      "
	.ascii	"         ;;\012;;                                  "
	.ascii	";;\012;;                                  ;;\012;;;"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;; adapted f"
	.ascii	"rom https://github.com/LingDong-/wasm-fun\012\012;;"
	.ascii	"   Hash table (separate chaining with linked lists)"
	.ascii	"\012;;   similar to C++ map<T,T>.\012;;\012;;   Ent"
	.ascii	"ire key is stored in map node; val is 32 bit int/fl"
	.ascii	"oat/pointer\012;;\012;;   Functions involving keys "
	.ascii	"have two versions, *_i and *_h.\012;;   _i takes an"
	.ascii	" i32 as key directly (for simple small keys), \012;"
	.ascii	";   while _h versions read the key from the heap gi"
	.ascii	"ven a \012;;   pointer and a byte count (for larger"
	.ascii	" keys)\012;;\012;;   +-----------+\012;;   |num_buc"
	.ascii	"kets|          ,----------------------.\012;;   |--"
	.ascii	"---------|        +-|-------------------+  |  +----"
	.ascii	"-----------------+\012;;   | bucket 0  |------->|ne"
	.ascii	"xt|key_size|key|val|  `->|next|key_size|key|val|\012"
	.ascii	";;   |-----------|        +---------------------+  "
	.ascii	"   +---------------------+\012;;   | bucket 1  |\012"
	.ascii	";;   |-----------|        +---------------------+\012"
	.ascii	";;   | bucket 2  |------->|next|key_size|key|val|\012"
	.ascii	";;   |-----------|        +---------------------+\012"
	.ascii	";;   | ......... |\012\012\012;; struct map{\012;; "
	.ascii	"  int num_buckets;\012;;   int length;\012;;   mapn"
	.ascii	"ode* bucket0;\012;;   mapnode* bucket1;\012;;   map"
	.ascii	"node* bucket2;\012;;   ...\012;; }\012;; struct map"
	.ascii	"node{\012;;   mapnode* next;\012;;   int key_size;\012"
	.ascii	";;   key_t key;\012;;   int val;\012;; }\012\012;; "
	.ascii	"(internal) getters and setters for map struct\012\012"
	.ascii	"(func $wax::_map_get_num_buckets (param $m i32) (re"
	.ascii	"sult i32)\012  (i32.load (local.get $m))\012)\012(f"
	.ascii	"unc $wax::_map_set_num_buckets (param $m i32) (para"
	.ascii	"m $num_buckets i32)\012  (i32.store (local.get $m) "
	.ascii	"(local.get $num_buckets))\012)\012(func $wax::map_l"
	.ascii	"ength (param $m i32) (result i32)\012  (i32.load (i"
	.ascii	"32.add (local.get $m) (i32.const 4)))\012)\012(func"
	.ascii	" $wax::_map_inc_length (param $m i32) (param $dx i3"
	.ascii	"2)\012  (local $l i32)\012  (local $o i32)\012  (lo"
	.ascii	"cal.set $o (i32.add (local.get $m) (i32.const 4)))\012"
	.ascii	"  (local.set $l (i32.load"
	.ascii	" (local.get $o)))\012  (i32.store (local.get $o) (i"
	.ascii	"32.add (local.get $l) (local.get $dx)))\012)\012(fu"
	.ascii	"nc $wax::_map_get_bucket (param $m i32) (param $i i"
	.ascii	"32) (result i32)\012  (i32.load (i32.add \012    (i"
	.ascii	"32.add (local.get $m) (i32.const 8)) \012    (i32.m"
	.ascii	"ul (local.get $i) (i32.const 4))\012  ))\012)\012(f"
	.ascii	"unc $wax::_map_set_bucket (param $m i32) (param $i "
	.ascii	"i32) (param $ptr i32)\012  (i32.store (i32.add \012"
	.ascii	"    (i32.add (local.get $m) (i32.const 8)) \012    "
	.ascii	"(i32.mul (local.get $i) (i32.const 4))\012  ) (loca"
	.ascii	"l.get $ptr) )\012)\012\012;; (internal) getters and"
	.ascii	" setters for map node struct\012\012(func $wax::_ma"
	.ascii	"pnode_get_next (param $m i32) (result i32)\012  (i3"
	.ascii	"2.load (local.get $m))\012)\012(func $wax::_mapnode"
	.ascii	"_get_key_size (param $m i32) (result i32)\012  (i32"
	.ascii	".load (i32.add (local.get $m) (i32.const 4)))\012)\012"
	.ascii	"(func $wax::_mapnode_get_key_ptr (param $m i32) (re"
	.ascii	"sult i32)\012  (i32.add (local.get $m) (i32.const 8"
	.ascii	"))\012)\012(func $wax::_mapnode_get_val_ptr (param "
	.ascii	"$m i32) (result i32)\012  (local $key_size i32)\012"
	.ascii	"  (local.set $key_size (call $wax::_mapnode_get_key"
	.ascii	"_size (local.get $m)))\012  (i32.add (i32.add (loca"
	.ascii	"l.get $m) (i32.const 8)) (local.get $key_size))\012"
	.ascii	")\012\012(func $wax::_mapnode_set_next (param $m i3"
	.ascii	"2) (param $v i32)\012  (i32.store (local.get $m) (l"
	.ascii	"ocal.get $v))\012)\012(func $wax::_mapnode_set_key_"
	.ascii	"size (param $m i32) (param $v i32)\012  (i32.store "
	.ascii	"(i32.add (local.get $m) (i32.const 4)) (local.get $"
	.ascii	"v))\012)\012\012(func $wax::_mapnode_set_key_h (par"
	.ascii	"am $m i32) (param $key_ptr i32) (param $key_size i3"
	.ascii	"2)\012  (local $ptr i32)\012  (local $i i32)\012  ("
	.ascii	"local.set $ptr (call $wax::_mapnode_get_key_ptr (lo"
	.ascii	"cal.get $m)))\012  loop $loop_mapnode_set_key_h\012"
	.ascii	"    (i32.store8 \012      (i32.add (local.get $ptr)"
	.ascii	" (local.get $i))\012      (i32.load8_u (i32.add (lo"
	.ascii	"cal.get $key_ptr) (local.get $i)))\012    )\012    "
	.ascii	"(local.set $i (i32.add (local.get $i) (i32.const 1)"
	.ascii	"))\012    (br_if $loop_mapnode_set_key_h (i32.lt_u "
	.ascii	"(local.get $i) (local.get $key_size) ))\012  end\012"
	.ascii	")\012(func $wax::_mapnode_set_key_i (param $m i32) "
	.ascii	"(param $key i32)\012  (i32.store\012    (call $wax:"
	.ascii	":_mapnode_get_key_ptr (local.get $m))\012    (local"
	.ascii	".get $key) \012  )\012)\012\012;; "
	.ascii	"Hash functions\012\012;; hash an integer with SHR3\012"
	.ascii	"(func $wax::_map_hash_i (param $num_buckets i32) (p"
	.ascii	"aram $key i32) (result i32)\012  (local.set $key (i"
	.ascii	"32.xor (local.get $key) (i32.shl   (local.get $key)"
	.ascii	" (i32.const 17))))\012  (local.set $key (i32.xor (l"
	.ascii	"ocal.get $key) (i32.shr_u (local.get $key) (i32.con"
	.ascii	"st 13))))\012  (local.set $key (i32.xor (local.get "
	.ascii	"$key) (i32.shl   (local.get $key) (i32.const 5 ))))"
	.ascii	"\012  (i32.rem_u (local.get $key) (local.get $num_b"
	.ascii	"uckets))\012)\012\012;; hash a sequence of bytes by"
	.ascii	" xor'ing them into an integer and calling _map_hash"
	.ascii	"_i\012(func $wax::_map_hash_h (param $num_buckets i"
	.ascii	"32) (param $key_ptr i32) (param $key_size i32) (res"
	.ascii	"ult i32)\012  (local $key i32)\012  (local $i i32)\012"
	.ascii	"  (local $byte i32)\012\012  (local.set $i (i32.con"
	.ascii	"st 0))\012  loop $loop_map_hash_h\012    (local.set"
	.ascii	" $byte (i32.load8_u (i32.add (local.get $key_ptr) ("
	.ascii	"local.get $i))))\012    \012    (local.set $key\012"
	.ascii	"      (i32.xor (local.get $key) \012        (i32.sh"
	.ascii	"l (local.get $byte) (i32.mul (i32.const 8) (i32.rem"
	.ascii	"_u (local.get $i) (i32.const 4))))\012      )\012  "
	.ascii	"  )\012    (local.set $i (i32.add (local.get $i) (i"
	.ascii	"32.const 1)))\012    (br_if $loop_map_hash_h (i32.l"
	.ascii	"t_u (local.get $i) (local.get $key_size) ))\012  en"
	.ascii	"d\012\012  (call $wax::_map_hash_i (local.get $num_"
	.ascii	"buckets) (local.get $key))\012)\012\012;; initializ"
	.ascii	"e a new map, given number of buckets\012;; returns "
	.ascii	"a pointer to the map\012(func $wax::map_new (param "
	.ascii	"$num_buckets i32) (result i32)\012  (local $m i32)\012"
	.ascii	"  (local $i i32)\012  (local.set $m (call $wax::mal"
	.ascii	"loc (i32.add (i32.mul (local.get $num_buckets) (i32"
	.ascii	".const 4)) (i32.const 8)) ))\012  (call $wax::_map_"
	.ascii	"set_num_buckets (local.get $m) (local.get $num_buck"
	.ascii	"ets))\012\012  (local.set $i (i32.const 0))\012  lo"
	.ascii	"op $loop_map_new_clear\012    (call $wax::_map_set_"
	.ascii	"bucket (local.get $m) (local.get $i) (i32.const 0))"
	.ascii	"\012    (local.set $i (i32.add (local.get $i) (i32."
	.ascii	"const 1)))\012    (br_if $loop_map_new_clear (i32.l"
	.ascii	"t_u (local.get $i) (local.get $num_buckets) ))\012 "
	.ascii	" end\012  (local.get $m)\012)\012\012;; compare the"
	.ascii	" key stored in a node agianst a key on the heap\012"
	.ascii	"(func $wax::_map_cmp_key_h (param $node i32) (para"
	.ascii	"m $key_ptr i32) (param $key_size i32) (result i32)\012"
	.ascii	"  (local $key_ptr0 i32)\012  (local $key_size0 i32)"
	.ascii	"\012  (local $i i32)\012  (local.set $key_ptr0 (cal"
	.ascii	"l $wax::_mapnode_get_key_ptr (local.get $node)))\012"
	.ascii	"  (local.set $key_size0 (call $wax::_mapnode_get_ke"
	.ascii	"y_size (local.get $node)))\012  (if (i32.eq (local."
	.ascii	"get $key_size0) (local.get $key_size))(then\012    "
	.ascii	"(local.set $i (i32.const 0))\012    loop $loop_map_"
	.ascii	"cmp_key_h\012\012      (if (i32.eq \012        (i32"
	.ascii	".load8_u (i32.add (local.get $key_ptr0) (local.get "
	.ascii	"$i)))\012        (i32.load8_u (i32.add (local.get $"
	.ascii	"key_ptr ) (local.get $i)))\012      )(then)(else\012"
	.ascii	"        (i32.const 0)\012        return\012      ))"
	.ascii	"\012      (local.set $i (i32.add (local.get $i) (i3"
	.ascii	"2.const 1)))\012      (br_if $loop_map_cmp_key_h (i"
	.ascii	"32.lt_u (local.get $i) (local.get $key_size) ))\012"
	.ascii	"    end\012    (i32.const 1)\012    return\012  ))\012"
	.ascii	"  (i32.const 0)\012  return\012)\012\012;; compare "
	.ascii	"the key stored in a node agianst a key passed direc"
	.ascii	"tly as i32 argument\012(func $wax::_map_cmp_key_i ("
	.ascii	"param $node i32) (param $key i32) (result i32)\012 "
	.ascii	" (local $key_ptr0 i32)\012  (local $key_size0 i32)\012"
	.ascii	"  (local.set $key_ptr0 (call $wax::_mapnode_get_key"
	.ascii	"_ptr (local.get $node)))\012  (local.set $key_size0"
	.ascii	" (call $wax::_mapnode_get_key_size (local.get $node"
	.ascii	")))\012\012  (if (i32.eq (local.get $key_size0) (i3"
	.ascii	"2.const 4))(then\012    (i32.eq (i32.load (local.ge"
	.ascii	"t $key_ptr0))  (local.get $key) )\012    return\012"
	.ascii	"  ))\012  (i32.const 0)\012  return\012)\012\012;; "
	.ascii	"insert a new entry to the map, taking a key stored "
	.ascii	"on the heap\012;; m : the map\012;; key_ptr: pointe"
	.ascii	"r to the key on the heap\012;; key_size: size of th"
	.ascii	"e key in bytes\012;; returns pointer to the value i"
	.ascii	"nserted in the map for the user to write at\012\012"
	.ascii	"(func $wax::map_set_h (param $m i32) (param $key_pt"
	.ascii	"r i32) (param $val i32)\012  (local $num_buckets i3"
	.ascii	"2)\012  (local $hash i32)\012  (local $it i32)\012 "
	.ascii	" (local $node_size i32)\012  (local $prev i32)\012 "
	.ascii	" (local $key_size i32)\012  (local.set $key_size (i"
	.ascii	"32.add (call $wax::str_len (local.get $key_ptr)) (i"
	.ascii	"32.const 1)))\012\012  (local.set $num_buckets (cal"
	.ascii	"l $wax::_map_get_num_buckets (local.get $m)))\012  "
	.ascii	"(local.set $hash (cal"
	.ascii	"l $wax::_map_hash_h (local.get $num_buckets) (local"
	.ascii	".get $key_ptr) (local.get $key_size)))\012  \012  ("
	.ascii	"local.set $it (call $wax::_map_get_bucket (local.ge"
	.ascii	"t $m) (local.get $hash)))\012  (local.set $node_siz"
	.ascii	"e (i32.add (local.get $key_size) (i32.const 12) ))\012"
	.ascii	"\012\012  (if (i32.eqz (local.get $it))(then\012   "
	.ascii	" (local.set $it (call $wax::malloc (local.get $node"
	.ascii	"_size)))\012\012    (call $wax::_mapnode_set_key_si"
	.ascii	"ze (local.get $it) (local.get $key_size))\012    (c"
	.ascii	"all $wax::_mapnode_set_next (local.get $it) (i32.co"
	.ascii	"nst 0))\012    (call $wax::_mapnode_set_key_h (loca"
	.ascii	"l.get $it) (local.get $key_ptr) (local.get $key_siz"
	.ascii	"e))\012\012    (call $wax::_map_set_bucket (local.g"
	.ascii	"et $m) (local.get $hash) (local.get $it))\012\012  "
	.ascii	"  (i32.store (call $wax::_mapnode_get_val_ptr (loca"
	.ascii	"l.get $it)) (local.get $val))\012    (call $wax::_m"
	.ascii	"ap_inc_length (local.get $m) (i32.const 1))\012    "
	.ascii	"return\012  )(else\012    (local.set $prev (i32.con"
	.ascii	"st 0))\012    loop $loop_map_set_h\012      (if (i3"
	.ascii	"2.eqz (local.get $it))(then)(else\012        (if (c"
	.ascii	"all $wax::_map_cmp_key_h (local.get $it) (local.get"
	.ascii	" $key_ptr) (local.get $key_size) )(then\012        "
	.ascii	"  (local.set $it (call $wax::realloc (local.get $it"
	.ascii	") (local.get $node_size)))\012\012          (if (i3"
	.ascii	"2.eqz (local.get $prev)) (then\012            (call"
	.ascii	" $wax::_map_set_bucket (local.get $m) (local.get $h"
	.ascii	"ash) (local.get $it))\012          )(else\012      "
	.ascii	"      (call $wax::_mapnode_set_next (local.get $pre"
	.ascii	"v) (local.get $it))\012          ))\012          (i"
	.ascii	"32.store (call $wax::_mapnode_get_val_ptr (local.ge"
	.ascii	"t $it)) (local.get $val))\012          return\012  "
	.ascii	"      ))\012        (local.set $prev (local.get $it"
	.ascii	"))\012        (local.set $it (call $wax::_mapnode_g"
	.ascii	"et_next (local.get $it)))\012        (br $loop_map_"
	.ascii	"set_h)\012      ))\012    end\012    (local.set $it"
	.ascii	" (call $wax::malloc (local.get $node_size)))\012   "
	.ascii	" (call $wax::_mapnode_set_key_size (local.get $it) "
	.ascii	"(local.get $key_size))\012    (call $wax::_mapnode_"
	.ascii	"set_next (local.get $it) (i32.const 0))\012    (cal"
	.ascii	"l $wax::_mapnode_set_key_h (local.get $it) (local.g"
	.ascii	"et $key_ptr) (local.get $key_size))\012\012    (cal"
	.ascii	"l $wax::_mapnode_set_next (local.ge"
	.ascii	"t $prev) (local.get $it))\012    (i32.store (call $"
	.ascii	"wax::_mapnode_get_val_ptr (local.get $it)) (local.g"
	.ascii	"et $val))\012    (call $wax::_map_inc_length (local"
	.ascii	".get $m) (i32.const 1))\012    return\012  ))\012\012"
	.ascii	")\012\012;; insert a new entry to the map, taking a"
	.ascii	" key passed directly as i32 argument\012;; m : the "
	.ascii	"map\012;; key: the key\012;; returns pointer to the"
	.ascii	" value inserted in the map for the user to write at"
	.ascii	"\012\012(func $wax::map_set_i (param $m i32) (param"
	.ascii	" $key i32)  (param $val i32)\012  (local $num_bucke"
	.ascii	"ts i32)\012  (local $hash i32)\012  (local $it i32)"
	.ascii	"\012  (local $node_size i32)\012  (local $prev i32)"
	.ascii	"\012\012  (local.set $num_buckets (call $wax::_map_"
	.ascii	"get_num_buckets (local.get $m)))\012  (local.set $h"
	.ascii	"ash (call $wax::_map_hash_i (local.get $num_buckets"
	.ascii	") (local.get $key)))\012  \012  (local.set $it (cal"
	.ascii	"l $wax::_map_get_bucket (local.get $m) (local.get $"
	.ascii	"hash)))\012  (local.set $node_size (i32.const 16) )"
	.ascii	"\012\012\012  (if (i32.eqz (local.get $it))(then\012"
	.ascii	"    (local.set $it (call $wax::malloc (local.get $n"
	.ascii	"ode_size)))\012\012    (call $wax::_mapnode_set_key"
	.ascii	"_size (local.get $it) (i32.const 4))\012    (call $"
	.ascii	"wax::_mapnode_set_next (local.get $it) (i32.const 0"
	.ascii	"))\012    (call $wax::_mapnode_set_key_i (local.get"
	.ascii	" $it) (local.get $key))\012\012    (call $wax::_map"
	.ascii	"_set_bucket (local.get $m) (local.get $hash) (local"
	.ascii	".get $it))\012\012    (i32.store (call $wax::_mapno"
	.ascii	"de_get_val_ptr (local.get $it)) (local.get $val))\012"
	.ascii	"    (call $wax::_map_inc_length (local.get $m) (i32"
	.ascii	".const 1))\012    return\012  )(else\012    (local."
	.ascii	"set $prev (i32.const 0))\012    loop $loop_map_set_"
	.ascii	"i\012      (if (i32.eqz (local.get $it))(then)(else"
	.ascii	"\012        (if (call $wax::_map_cmp_key_i (local.g"
	.ascii	"et $it) (local.get $key) )(then\012          (local"
	.ascii	".set $it (call $wax::realloc (local.get $it) (local"
	.ascii	".get $node_size)))\012\012          (if (i32.eqz (l"
	.ascii	"ocal.get $prev)) (then\012            (call $wax::_"
	.ascii	"map_set_bucket (local.get $m) (local.get $hash) (lo"
	.ascii	"cal.get $it))\012          )(else\012            (c"
	.ascii	"all $wax::_mapnode_set_next (local.get $prev) (loca"
	.ascii	"l.get $it))\012          ))\012          (i32.store"
	.ascii	" (call $wax::_mapnode_get_val_ptr (local.get $it)) "
	.ascii	"(local"
	.ascii	".get $val))\012          return\012        ))\012  "
	.ascii	"      (local.set $prev (local.get $it))\012        "
	.ascii	"(local.set $it (call $wax::_mapnode_get_next (local"
	.ascii	".get $it)))\012        (br $loop_map_set_i)\012    "
	.ascii	"  ))\012    end\012    (local.set $it (call $wax::m"
	.ascii	"alloc (local.get $node_size)))\012    (call $wax::_"
	.ascii	"mapnode_set_key_size (local.get $it) (i32.const 4))"
	.ascii	"\012    (call $wax::_mapnode_set_next (local.get $i"
	.ascii	"t) (i32.const 0))\012    (call $wax::_mapnode_set_k"
	.ascii	"ey_i (local.get $it) (local.get $key))\012\012    ("
	.ascii	"call $wax::_mapnode_set_next (local.get $prev) (loc"
	.ascii	"al.get $it))\012    (i32.store (call $wax::_mapnode"
	.ascii	"_get_val_ptr (local.get $it)) (local.get $val))\012"
	.ascii	"    (call $wax::_map_inc_length (local.get $m) (i32"
	.ascii	".const 1))\012    return\012  ))\012\012)\012\012;;"
	.ascii	" lookup a key for its value in the map, taking a ke"
	.ascii	"y stored on the heap\012;; m : the map\012;; key_pt"
	.ascii	"r: pointer to the key on the heap\012;; key_size: s"
	.ascii	"ize of the key in bytes\012;; returns pointer to th"
	.ascii	"e value in the map, NULL (0) if not found.\012\012("
	.ascii	"func $wax::map_get_h (param $m i32) (param $key_ptr"
	.ascii	" i32) (result i32)\012  (local $num_buckets i32)\012"
	.ascii	"  (local $hash i32)\012  (local $it i32)\012  (loca"
	.ascii	"l $key_size i32)\012  (local.set $key_size (i32.add"
	.ascii	" (call $wax::str_len (local.get $key_ptr)) (i32.con"
	.ascii	"st 1)))\012\012  (local.set $num_buckets (call $wax"
	.ascii	"::_map_get_num_buckets (local.get $m)))\012  (local"
	.ascii	".set $hash (call $wax::_map_hash_h (local.get $num_"
	.ascii	"buckets) (local.get $key_ptr) (local.get $key_size)"
	.ascii	"))\012  (local.set $it (call $wax::_map_get_bucket "
	.ascii	"(local.get $m) (local.get $hash)))\012\012  loop $l"
	.ascii	"oop_map_get_h\012    (if (i32.eqz (local.get $it))("
	.ascii	"then)(else\012      (if (call $wax::_map_cmp_key_h "
	.ascii	"(local.get $it) (local.get $key_ptr) (local.get $ke"
	.ascii	"y_size) )(then\012        (i32.load (call $wax::_ma"
	.ascii	"pnode_get_val_ptr (local.get $it)))\012        retu"
	.ascii	"rn\012      ))\012      (local.set $it (call $wax::"
	.ascii	"_mapnode_get_next (local.get $it)))\012      (br $l"
	.ascii	"oop_map_get_h)\012    ))\012  end\012\012  (i32.con"
	.ascii	"st 0)\012)\012\012;; lookup a key for its value in "
	.ascii	"the map, taking a key passed directly as i32 argume"
	.ascii	"nt\012;; m : the map\012;; key : the key\012;; retu"
	.ascii	"rns pointer to the val"
	.ascii	"ue in the map, NULL (0) if not found.\012\012(func "
	.ascii	"$wax::map_get_i (param $m i32) (param $key i32) (re"
	.ascii	"sult i32)\012  (local $num_buckets i32)\012  (local"
	.ascii	" $hash i32)\012  (local $it i32)\012\012  (local.se"
	.ascii	"t $num_buckets (call $wax::_map_get_num_buckets (lo"
	.ascii	"cal.get $m)))\012  (local.set $hash (call $wax::_ma"
	.ascii	"p_hash_i (local.get $num_buckets) (local.get $key))"
	.ascii	")\012  (local.set $it (call $wax::_map_get_bucket ("
	.ascii	"local.get $m) (local.get $hash)))\012\012  loop $lo"
	.ascii	"op_map_get_i\012    (if (i32.eqz (local.get $it))(t"
	.ascii	"hen)(else\012      (if (call $wax::_map_cmp_key_i ("
	.ascii	"local.get $it) (local.get $key) )(then\012        ("
	.ascii	"i32.load (call $wax::_mapnode_get_val_ptr (local.ge"
	.ascii	"t $it)))\012        return\012      ))\012      (lo"
	.ascii	"cal.set $it (call $wax::_mapnode_get_next (local.ge"
	.ascii	"t $it)))\012      (br $loop_map_get_i)\012    ))\012"
	.ascii	"  end\012\012  (i32.const 0)\012)\012\012;; remove "
	.ascii	"a key-value pair from the map, given a key stored o"
	.ascii	"n the heap\012;; m : the map\012;; key_ptr: pointer"
	.ascii	" to the key on the heap\012;; key_size: size of the"
	.ascii	" key in bytes\012\012(func $wax::map_remove_h (para"
	.ascii	"m $m i32) (param $key_ptr i32) (param $key_size i32"
	.ascii	")\012  (local $num_buckets i32)\012  (local $hash i"
	.ascii	"32)\012  (local $it i32)\012  (local $prev i32)\012"
	.ascii	"  (local $next i32)\012\012  (local.set $num_bucket"
	.ascii	"s (call $wax::_map_get_num_buckets (local.get $m)))"
	.ascii	"\012  (local.set $hash (call $wax::_map_hash_h (loc"
	.ascii	"al.get $num_buckets) (local.get $key_ptr) (local.ge"
	.ascii	"t $key_size)))\012  (local.set $it (call $wax::_map"
	.ascii	"_get_bucket (local.get $m) (local.get $hash)))\012 "
	.ascii	" \012  (local.set $prev (i32.const 0))\012\012  loo"
	.ascii	"p $loop_map_remove_h\012    (if (i32.eqz (local.get"
	.ascii	" $it))(then)(else\012      (if (call $wax::_map_cmp"
	.ascii	"_key_h (local.get $it) (local.get $key_ptr) (local."
	.ascii	"get $key_size) )(then\012        (local.set $next ("
	.ascii	"call $wax::_mapnode_get_next (local.get $it)))\012\012"
	.ascii	"        (if (i32.eqz (local.get $prev)) (then\012  "
	.ascii	"        (call $wax::_map_set_bucket (local.get $m) "
	.ascii	"(local.get $hash) (local.get $next))\012        )(e"
	.ascii	"lse\012          (call $wax::_mapnode_set_next (loc"
	.ascii	"al.get $prev) (local.get $next))\012        ))\012 "
	.ascii	"       (call $wax::free (local.get $it))\012       "
	.ascii	" (call $wax::_ma"
	.ascii	"p_inc_length (local.get $m) (i32.const -1))\012    "
	.ascii	"    return\012      ))\012      (local.set $prev (l"
	.ascii	"ocal.get $it))\012      (local.set $it (local.get $"
	.ascii	"next))\012      (br $loop_map_remove_h)\012    ))\012"
	.ascii	"  end\012)\012\012;; remove a key-value pair from t"
	.ascii	"he map, given a key passed directly as i32 argument"
	.ascii	"\012;; m : the map\012;; key : the key\012(func $wa"
	.ascii	"x::map_remove_i (param $m i32) (param $key i32)\012"
	.ascii	"  (local $num_buckets i32)\012  (local $hash i32)\012"
	.ascii	"  (local $it i32)\012  (local $prev i32)\012  (loca"
	.ascii	"l $next i32)\012\012  (local.set $num_buckets (call"
	.ascii	" $wax::_map_get_num_buckets (local.get $m)))\012  ("
	.ascii	"local.set $hash (call $wax::_map_hash_i (local.get "
	.ascii	"$num_buckets) (local.get $key)))\012  (local.set $i"
	.ascii	"t (call $wax::_map_get_bucket (local.get $m) (local"
	.ascii	".get $hash)))\012  \012  (local.set $prev (i32.cons"
	.ascii	"t 0))\012\012  loop $loop_map_remove_i\012    (if ("
	.ascii	"i32.eqz (local.get $it))(then)(else\012      (if (c"
	.ascii	"all $wax::_map_cmp_key_i (local.get $it) (local.get"
	.ascii	" $key) )(then\012        (local.set $next (call $wa"
	.ascii	"x::_mapnode_get_next (local.get $it)))\012\012     "
	.ascii	"   (if (i32.eqz (local.get $prev)) (then\012       "
	.ascii	"   (call $wax::_map_set_bucket (local.get $m) (loca"
	.ascii	"l.get $hash) (local.get $next))\012        )(else\012"
	.ascii	"          (call $wax::_mapnode_set_next (local.get "
	.ascii	"$prev) (local.get $next))\012        ))\012        "
	.ascii	"(call $wax::free (local.get $it))\012        (call "
	.ascii	"$wax::_map_inc_length (local.get $m) (i32.const 1))"
	.ascii	"\012        return\012      ))\012      (local.set "
	.ascii	"$prev (local.get $it))\012      (local.set $it (loc"
	.ascii	"al.get $next))\012      (br $loop_map_remove_i)\012"
	.ascii	"    ))\012  end\012)\012\012\012;; generate a new i"
	.ascii	"terator for traversing map pairs\012;; in effect, t"
	.ascii	"his returns a pointer to the first node\012(func $w"
	.ascii	"ax::map_iter_new  (param $m i32) (result i32)\012  "
	.ascii	"(local $num_buckets i32)\012  (local $i i32)\012  ("
	.ascii	"local $node i32)\012\012  (local.set $num_buckets ("
	.ascii	"call $wax::_map_get_num_buckets (local.get $m)))\012"
	.ascii	"\012  (local.set $i (i32.const 0))\012  loop $loop_"
	.ascii	"map_iter_new\012    (local.set $node (call $wax::_m"
	.ascii	"ap_get_bucket (local.get $m) (local.get $i)))\012  "
	.ascii	"  (if (i32.eqz (local.get $node))(then)(else\012   "
	.ascii	"   (local.get $node)\012      return\012"
	.ascii	"    ))\012    (local.set $i (i32.add (local.get $i)"
	.ascii	" (i32.const 1)))\012    (br_if $loop_map_iter_new ("
	.ascii	"i32.lt_u (local.get $i) (local.get $num_buckets) ))"
	.ascii	"\012  end\012  (i32.const 0)\012  return\012)\012\012"
	.ascii	";; increment an interator for traversing map pairs\012"
	.ascii	";; in effect, this finds the next node of a given n"
	.ascii	"ode, by first looking\012;; at the linked list, the"
	.ascii	"n re-hashing the key to look through the rest of th"
	.ascii	"e hash table\012(func $wax::map_iter_next (param $m"
	.ascii	" i32) (param $iter i32) (result i32)\012  (local $n"
	.ascii	"ext i32)\012  (local $num_buckets i32)\012  (local "
	.ascii	"$node i32)\012  (local $i i32)\012  \012  (local.se"
	.ascii	"t $num_buckets (call $wax::_map_get_num_buckets (lo"
	.ascii	"cal.get $m)))\012\012  (local.set $next (call $wax:"
	.ascii	":_mapnode_get_next (local.get $iter)))\012\012  (if"
	.ascii	" (i32.eqz (local.get $next))(then\012\012    (local"
	.ascii	".set $i (i32.add (call $wax::_map_hash_h\012      ("
	.ascii	"local.get $num_buckets)\012      (call $wax::_mapno"
	.ascii	"de_get_key_ptr  (local.get $iter))\012      (call $"
	.ascii	"wax::_mapnode_get_key_size (local.get $iter))\012  "
	.ascii	"  ) (i32.const 1)))\012\012    \012    (if (i32.eq "
	.ascii	"(local.get $i) (local.get $num_buckets)) (then\012 "
	.ascii	"     (i32.const 0)\012      return\012    ))\012   "
	.ascii	" \012    loop $loop_map_iter_next\012      (local.s"
	.ascii	"et $node (call $wax::_map_get_bucket (local.get $m)"
	.ascii	" (local.get $i)))\012      (if (i32.eqz (local.get "
	.ascii	"$node))(then)(else\012        (local.get $node)\012"
	.ascii	"        return\012      ))\012      (local.set $i ("
	.ascii	"i32.add (local.get $i) (i32.const 1)))\012      (br"
	.ascii	"_if $loop_map_iter_next (i32.lt_u (local.get $i) (l"
	.ascii	"ocal.get $num_buckets) ))\012    end\012\012    (i3"
	.ascii	"2.const 0)\012    return\012\012  )(else\012    (lo"
	.ascii	"cal.get $next)\012    return\012  ))\012  (i32.cons"
	.ascii	"t 0)\012  return\012)\012\012;; given a map iterato"
	.ascii	"r, get a pointer to the key stored\012(func $wax::m"
	.ascii	"ap_iter_key_h (param $iter i32) (result i32)\012  ("
	.ascii	"call $wax::_mapnode_get_key_ptr (local.get $iter))\012"
	.ascii	")\012;; given a map iterator, read the key stored a"
	.ascii	"s an int\012;; only works if your key is an i32\012"
	.ascii	"(func $wax::map_iter_key_i (param $iter i32) (resul"
	.ascii	"t i32)\012  (i32.load (call $wax::_mapnode_get_key_"
	.ascii	"ptr (local.get $iter)))\012)\012;; given a map iter"
	.ascii	"ator, get a pointer to the value stored\012(func"
	.ascii	" $wax::map_iter_val (param $iter i32) (result i32)\012"
	.ascii	"  (i32.load (call $wax::_mapnode_get_val_ptr (local"
	.ascii	".get $iter)))\012)\012\012;; remove all key-values "
	.ascii	"in the map\012(func $wax::map_clear (param $m i32)\012"
	.ascii	"  (local $num_buckets i32)\012  (local $hash i32)\012"
	.ascii	"  (local $it i32)\012\012  (local $next i32)\012\012"
	.ascii	"  (local.set $num_buckets (call $wax::_map_get_num_"
	.ascii	"buckets (local.get $m)))\012\012  (local.set $hash "
	.ascii	"(i32.const 0))\012\012  loop $loop_map_clear_bucket"
	.ascii	"s\012\012    (local.set $it (call $wax::_map_get_bu"
	.ascii	"cket (local.get $m) (local.get $hash)))\012\012    "
	.ascii	"loop $loop_map_clear_nodes\012      (if (i32.eqz (l"
	.ascii	"ocal.get $it))(then)(else\012        (local.set $ne"
	.ascii	"xt (call $wax::_mapnode_get_next (local.get $it)))\012"
	.ascii	"\012        (call $wax::free (local.get $it))\012\012"
	.ascii	"        (local.set $it (local.get $next))\012      "
	.ascii	"  (br $loop_map_clear_nodes)\012      ))\012    end"
	.ascii	"\012\012    (call $wax::_map_set_bucket (local.get "
	.ascii	"$m) (local.get $hash) (i32.const 0))\012\012    (lo"
	.ascii	"cal.set $hash (i32.add (local.get $hash) (i32.const"
	.ascii	" 1)))\012    (br_if $loop_map_clear_buckets (i32.lt"
	.ascii	"_u (local.get $hash) (local.get $num_buckets)))\012"
	.ascii	"\012  end  \012)\012\012;; free all allocated memor"
	.ascii	"y for a map\012(func $wax::map_free (param $m i32)\012"
	.ascii	"  (call $wax::map_clear (local.get $m))\012  (call "
	.ascii	"$wax::free (local.get $m))\012)\012\000"
	.data
	.align	2
	.type	TEXT_std_map_wat, %object
	.size	TEXT_std_map_wat, 4
TEXT_std_map_wat:
	.word	.LC13
	.global	TEXT_std_stack_wat
	.section	.rodata
	.align	2
.LC14:
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;;       "
	.ascii	"                           ;;\012;;                "
	.ascii	"                  ;;\012;;               STACK     "
	.ascii	"         ;;\012;;                                  "
	.ascii	";;\012;;                                  ;;\012;;;"
	.ascii	";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\012;; poor man'"
	.ascii	"s stack\012;; malloc a block of memory and pretend "
	.ascii	"it's the stack, because of the apparent lack(?) of "
	.ascii	"stack address in webassembly\012\012(global $wax::s"
	.ascii	"tack_indices_ptr (mut i32) (i32.const 0))\012(globa"
	.ascii	"l $wax::stack_content_ptr (mut i32) (i32.const 0))\012"
	.ascii	"(global $wax::stack_count   (mut i32) (i32.const 32"
	.ascii	"))\012(global $wax::stack_size    (mut i32) (i32.co"
	.ascii	"nst 128))\012(global $wax::stack_index   (mut i32) "
	.ascii	"(i32.const 0))\012(global $wax::stack_now     (mut "
	.ascii	"i32) (i32.const 0))\012(global $wax::stack_did_init"
	.ascii	"(mut i32) (i32.const 0))\012\012(func $wax::init_st"
	.ascii	"ack\012  (global.set $wax::stack_indices_ptr (call "
	.ascii	"$wax::calloc (i32.mul (global.get $wax::stack_count"
	.ascii	") (i32.const 4))))\012  (global.set $wax::stack_con"
	.ascii	"tent_ptr (call $wax::malloc (global.get $wax::stack"
	.ascii	"_size)))\012  (global.set $wax::stack_index (i32.co"
	.ascii	"nst 0))\012  (global.set $wax::stack_did_init (i32."
	.ascii	"const 1))\012)\012(func $wax::stack_index_offset (r"
	.ascii	"esult i32)\012  (i32.add (global.get $wax::stack_in"
	.ascii	"dices_ptr) (i32.mul (global.get $wax::stack_index) "
	.ascii	"(i32.const 4)))\012)\012(func $wax::push_stack\012\012"
	.ascii	"  (if (i32.eqz (global.get $wax::stack_did_init)) ("
	.ascii	"then (call $wax::init_stack) ))\012\012  (global.se"
	.ascii	"t $wax::stack_index (i32.add (global.get $wax::stac"
	.ascii	"k_index) (i32.const 1) ))\012\012  (if (i32.ge_u (g"
	.ascii	"lobal.get $wax::stack_index) (global.get $wax::stac"
	.ascii	"k_count)) (then\012    (global.set $wax::stack_coun"
	.ascii	"t (i32.add (global.get $wax::stack_count) (i32.cons"
	.ascii	"t 128)))\012    (global.set $wax::stack_indices_ptr"
	.ascii	" (call $wax::realloc \012      (global.get $wax::st"
	.ascii	"ack_indices_ptr) \012      (i32.mul (global.get $wa"
	.ascii	"x::stack_count) (i32.const 4))\012    ))\012  ))\012"
	.ascii	"\012  (i32.store (call $wax::stack_index_offset) (g"
	.ascii	"lobal.get $wax::stack_now) )\012\012)\012(func $wax"
	.ascii	"::pop_stack\012\012  (global.set $wax::stack_now (i"
	.ascii	"32.load (call $wax::stack_index_offset) "
	.ascii	"))\012  (global.set $wax::stack_index (i32.sub (glo"
	.ascii	"bal.get $wax::stack_index) (i32.const 1) ))\012  \012"
	.ascii	")\012(func $wax::alloca (param $n_bytes i32) (resul"
	.ascii	"t i32)\012  (local $inc i32)\012  (if (i32.ge_u (i3"
	.ascii	"2.add (global.get $wax::stack_now) (local.get $n_by"
	.ascii	"tes) ) (global.get $wax::stack_size)) (then\012    "
	.ascii	"(local.set $inc (i32.const 512))\012    (if (i32.gt"
	.ascii	"_u (local.get $n_bytes) (local.get $inc)) (then\012"
	.ascii	"      (local.set $inc (call $wax::align4 (local.get"
	.ascii	" $n_bytes)))\012    ))\012    (global.set $wax::sta"
	.ascii	"ck_size (i32.add (global.get $wax::stack_size) (loc"
	.ascii	"al.get $inc) ))\012    (global.set $wax::stack_cont"
	.ascii	"ent_ptr\012      (call $wax::realloc (global.get $w"
	.ascii	"ax::stack_content_ptr) (global.get $wax::stack_size"
	.ascii	"))\012    )\012  ))\012\012  ;; repurpose $inc for "
	.ascii	"ret val\012  (local.set $inc (i32.add (global.get $"
	.ascii	"wax::stack_content_ptr ) (global.get $wax::stack_no"
	.ascii	"w)))\012\012  (global.set $wax::stack_now (i32.add "
	.ascii	"(global.get $wax::stack_now) (local.get $n_bytes)))"
	.ascii	"\012\012  (local.get $inc)\012  return\012)\012\000"
	.data
	.align	2
	.type	TEXT_std_stack_wat, %object
	.size	TEXT_std_stack_wat, 4
TEXT_std_stack_wat:
	.word	.LC14
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
