#include "lc4_memory.h"
#include <stdio.h>
/**
* translates the hex representation of arithmetic instructions
* into their assembly equivalent in the given linked list.
*
* returns 0 upon success, and non-zero if an error occurs.
*/
int reverse_assemble(row_of_memory *memory);
// returns a ptr to the assembly string converted from memory's contents in hex
char *get_assembly(row_of_memory *memory, row_of_memory *head);
// checks if an address is in between start and end addresses in memory
int is_valid_region(unsigned short start, unsigned short end,
unsigned short address);
// sign-extend IMM with #bits and return its int representation
short sign_extend(unsigned short instr, int bits);
// Extract bits from high_bit to low_bit (inclusive) from value
unsigned short get_bits(unsigned short value, int high_bit, int low_bit);
char *parse_branch(row_of_memory *curr, row_of_memory *head);
char *parse_arithmetic(unsigned short instr);
char *parse_compare(unsigned short instr);
char *parse_jump_sub(row_of_memory *curr, row_of_memory *head);
char *parse_bitwise(unsigned short instr);
char *parse_mem_op(unsigned short instr);
char *parse_return();
char *parse_const(unsigned short instr);
char *parse_shift(unsigned short instr);
char *parse_jump(row_of_memory *curr, row_of_memory *head);
char *parse_hiconst(unsigned short instr);
char *parse_trap(unsigned short instr);