#include "game_types.h"

/* Object_IsStationary @ 0x080047FC (real 48B) -- divide/sqrt stillness metric. Mirrors src/matched/Object_IsStationary.c. */
/* Divides the (88/92) pair by the 0x02000C64 lane, then scales the sqrt of
   the summed halves by 64. Stack-guard idiom for the divide slots. */
extern int Math_Divide(int *a, int b, int *c);
extern int Math_Sqrt(int a, int b, int c);

int Object_IsStationary(int *p)
{
    int buf[2];
    int s;
    buf[0] = p[22];
    buf[1] = p[23];
    Math_Divide(buf, *(int *)0x02000C64, buf + 1);
    s = buf[0] + buf[1];
    return Math_Sqrt(s, s < 0 ? -1 : 0, *(int *)0x02000C70) << 6;
}
