Decoding a Two-Wire SPI-esque Serial Protocol
As Chris Stratton indicated in his comments to the other answer you need to change the way your software works.

There are two options:

Option 1:
Run in a tight loop polling the pins and recording a timestamp into a buffer when they change state. If the value hasn't changed don't do anything.
Once the buffer is full output the times recorded over the serial link.

Option 2:
Use the serial and clock line inputs as interrupts. When the pins change record to a buffer a timestamp for the transition and the new state of the pin.
Have a background loop send the logged data out on the serial port keeping up with the data as best it can while indicating if the buffer has overflowed.

Both of them solve the big issue that you have that you are trying to output serial data from within a time critical piece of code, printf is slow and serial ports run at a glacial pace, never do them in a section of code that you need to run quickly. Option 1 is simpler and will probably cope with slightly higher frequencies but will only record for as long as you have space to buffer and could possibly report two edges very close together as being in the wrong order. Option 2 outputs while it's running and so should be able to run for longer (whether it's 1 edge more or keeps up and runs indefinably depends on the speeds of the edges and the serial port) but due to the interrupt overhead will have a lower top speed and is more complex to code.

The other obvious solution is to borrow / rent an oscilloscope or logic analyser from someone.