Actually the optimizers probably remove the mydelay () nested loops, as they don't serve a purpose. The body of the nested loop is empty. Why looping ?
An 'int' variable on an Arduino UNO will always be "<= 32767" so both of your loops are infinite. Once you enter the 'mydelay()' function you never get out again.
hmm? this is a simple delay function, why would not exit the loop, the first counts from 1 to 32767 and second loop counts similarly and exits. what do you mean loops are infinite? take any number for c and d the code will not function.
integers are signed numbers (here 16 bit wide). Therefore, they are never going to exceed 32767. They rather overflow to -32768. Therefore you only turn the LED on once and never toggle again.
You need to exit earlier at 32766 or something less than that.
Assume d = 32766, then it (d) will be incremented to 32767 which the max +ve count limit.
You have tested for d = 32767 which is satisficed; now, d will be incremented to (0x7FFF + 1 = 0x8000 in hex's 2's complement code = - 32768 in decimal. d will be again incremented and incremented, ..., infinite looping!!