#!/usr/bin/bash

# The purpose of the script is to track down the value of a variable accessed
# in an assembly listing. for example, for the call in the line below:
#    61de:	4b25      	ldr	r3, [pc, #148]	; (6274 <float_to_linear+0xa8>)
# the user would have to run `asm_find_val.sh listing_file.lss 6274`
# to learn the value loaded to r3.

num=$(grep $2: "$1" | cut -f2)
printf '%08x\n' 0x$num
