Branching ratios for the dissociative recombination of hydrocarbon ions. I: The cases of C4H9+ and C4H5+