bin-packing in C