void do_lds(jit_function_t func) {
	jit_value_t ldw = LOAD(LDWhich, jit_type_uint);
	jit_label_t label = jit_label_undefined;
	jit_insn_branch_if(func, jit_insn_eq(func, ldw, make_ubyte(35)), &label);
	jit_value_t raw = LOAD(_ReadAbsorbWhich, jit_type_ubyte);
	WGPR_VAL(ldw, LOAD(LDValue, jit_type_uint));
	WRA(ldw, CAST(LOAD(LDAbsorb, jit_type_uint), jit_type_ubyte));
	STORE(_ReadFudge, CAST(ldw, jit_type_ubyte));
	STORE(_ReadAbsorbWhich, CAST(jit_insn_or(func, raw, jit_insn_and(func, ldw, make_uint(0x1F))), jit_type_ubyte));
	jit_insn_label(func, &label);
	STORE(LDWhich, make_uint(35));
}
static hash_table_key_t* make_hash_table_key(hash_table_bst_t* t, const char* key) {
	hash_table_key_t* composed_key = (hash_table_key_t*)malloc(sizeof(hash_table_key_t));

	composed_key->raw_key = strdup(key);
	composed_key->hashed_key = make_uint(t->hash_function(key, strlen(key)));
	return composed_key;
}
void call_write_copcreg(jit_function_t func, int cop, int reg, jit_value_t val) {
	jit_value_t args[] = {make_uint(cop), make_uint(reg), val};
	jit_insn_call_native(func, 0, (void *) write_copcreg, sig_3, args, 3, 0);
}
jit_value_t call_read_copcreg(jit_function_t func, int cop, int reg) {
	jit_value_t args[] = {make_uint(cop), make_uint(reg)};
	return jit_insn_call_native(func, 0, (void *) read_copcreg, sig_2, args, 2, 0);
}
jit_value_t call_load_memory(jit_function_t func, int size, jit_value_t ptr, uint32_t pc) {
	jit_value_t args[] = {make_uint(size), ptr, make_uint(pc)};
	return jit_insn_call_native(func, 0, (void *) load_memory, sig_3, args, 3, 0);
}
void call_store_memory(jit_function_t func, int size, jit_value_t ptr, jit_value_t val, uint32_t pc) {
	jit_value_t args[] = {make_uint(size), ptr, val, make_uint(pc)};
	jit_insn_call_native(func, 0, (void *) store_memory, sig_4, args, 4, 0);
}
void defer_set(jit_function_t func, int reg, jit_value_t val) {
    STORE(LDWhich, make_uint(reg));
	STORE(LDValue, val);
}
void call_check_irq(jit_function_t func, uint32_t pc) {
	jit_value_t args[] = {make_uint(pc)};
	jit_insn_call_native(func, 0, (void *) check_irq, sig_1, args, 1, 0);
}
void call_mul_delay(jit_function_t func, jit_value_t a, jit_value_t b, int is_signed) {
	jit_value_t args[] = {a, b, make_uint(is_signed)};
	jit_insn_call_native(func, 0, (void *) mul_delay, sig_3, args, 3, 0);
}
void call_timestamp_inc(jit_function_t func, uint32_t amount) {
	jit_value_t args[] = {make_uint(amount)};
	jit_insn_call_native(func, 0, (void *) timestamp_inc, sig_1, args, 1, 0);
}
void call_alignment(jit_function_t func, jit_value_t addr, int size, int store, uint32_t pc) {
	jit_value_t args[] = {addr, make_uint(size), make_uint(store), make_uint(pc)};
	jit_insn_call_native(func, 0, (void *) alignment, sig_4, args, 4, 0);
}
void call_overflow(jit_function_t func, jit_value_t a, jit_value_t b, int dir, uint32_t pc, uint32_t inst) {
	jit_value_t args[] = {a, b, make_uint(dir), make_uint(pc), make_uint(inst)};
	jit_insn_call_native(func, 0, (void *) overflow, sig_5, args, 5, 0);
}
void call_break(jit_function_t func, uint32_t code, uint32_t pc, uint32_t inst) {
	jit_value_t args[] = {make_uint(code), make_uint(pc), make_uint(inst)};
	jit_insn_call_native(func, 0, (void *) break_, sig_3, args, 3, 0);
}
jit_value_t call_signext(jit_function_t func, int size, jit_value_t val) {
	jit_value_t args[] = {make_uint(size), val};
	return jit_insn_call_native(func, 0, (void *) signext, sig_2, args, 2, 0);
}
void call_step(jit_function_t func, uint32_t arg) {
	jit_value_t args[] = {make_uint(arg)};
	jit_insn_call_native(func, 0, (void *) step, sig_1, args, 1, 0);
}
jit_value_t call_copfun(jit_function_t func, int cop, int cofun, uint32_t inst) {
	jit_value_t args[] = {make_uint(cop), make_uint(cofun), make_uint(inst)};
	return jit_insn_call_native(func, 0, (void *) copfun, sig_3, args, 3, 0);
}