Looks like two for loops, wrapping around.
unsigned char Dly1 = 0;
unsigned char Dly2 = 0;
void Sleep()
{
do
{
do
{
--Dly1;
} while(Dly1 != 0);
--Dly2;
} while(Dly2 != 0);
}
void main()
{
while(true)
{
SetLEDOn(true);
Sleep();
SetLEDOn(false);
Sleep();
}
}
Each loop only takes 3 instructions to execute if it does nothing but decrement, compare to zero, and branch, a total cost of 256 iterations, so 3x256. But the internal one is executed 256x by the outer loop, so the outer loop cost 3x256 instructions plus its own 3 per loop, another 256 times.
Judging by the comment in the code, 125k instructions are executed per second, assuming you haven't changed the clock speed.
So
Inner Loop: 3 instructions x 256 iterations = 768 instructions
Outer Loop: (3 instructions + 768 instructions) x 256 iterations = 197376 instructions
A total of 197376 instructions before both Dly1 and Dly2 are both 0.
If it takes one second to perform 125k instructions, 197376 / 125000 = 1.579008 seconds