#!	/bin/bash

if [ $# -ne 1 ]; then
	echo "I need the cfg log!"
	exit
fi

for bm in bzip2 cactusADM calculix gcc gobmk gromacs h264ref hmmer lbm libquantum mcf milc perlbench sjeng sphinx3 wrf; do
	lines=`cat $1 | grep $bm`
	nbranches=0
	nstructured_branches=0
	while IFS= read -r line
	do
		nb=`echo "$line" | tr -s '\t' ' ' | cut -d" " -f4`
		nsb=`echo "$line" | tr -s '\t' ' ' | cut -d" " -f19`
		nbranches=$((nbranches + nb))
		nstructured_branches=$((nstructured_branches + nsb))
	done <<< "$lines"
	echo "$bm $nbranches $nstructured_branches"
done
