processing of BAM files in C