Code:

#include <stdlib.h>
#include <math.h>
int div32(long dividend, long divisor, long *quotient, long *rmdr)
{
*rmdr = dividend;
*quotient = 0;
int shifts = 0;
while ((divisor & 0x40) != 0x40)
{
divisor = divisor << 1;
shifts++;
}
int i = 0;
for (i; i <= shifts; i++)
{
if (*rmdr-divisor >= 0)
{
*rmdr -= divisor;
*quotient++;
}
divisor = divisor >> 1;
if ( i!=shifts)
*quotient = *quotient << 1;
}
printf("%l / %l = %l", dividend, divisor, *quotient);
return 0;
}
void main (int argc, char *argv[])
{
div32(50, 25, 0, 0);
}

crashes on line 6. even if line 6 is *rmdr=25

if line 6 is commented out, it crashes on line 7

WTF!??!?!