Created a C implementation of bmap

For faster processing