Processor Expert will generate the code for you for this task.
Create a PE project, then in the Add Bean dialog, look under "CPU External Devices"/"COmmunication"/ SW_IC2. This bean is a software I2C driver, that just uses GPIO bits.
You will have to select the bits for Data Pin and Clock Pin.
Here is a link to a project that does this. There is also some other handy code in it.
You can add a CPU bean for your processor.