China offered Gaddafi weapons to fight rebels in final months of power