#include "game_types.h"

/* Sub_0800648C @ 0x0800648C (real 110B) -- bulk zero-init plus 120-stride setup calls. Mirrors src/matched/Sub_0800648C.c. */
/* Writes the (0,-1,0,-1,0) head, zeroes the pointer/flag words, clears 16
   16-byte blocks at +72, runs Sub_08006150 120 times (stride 132 from +348),
   issues the gap call at +0x473C, and returns p. */
extern int Float_IsZero(int *p);
extern void Sub_08006150(int *p);
extern int Sub_0800648C_GapCall(int *p);

int *Sub_0800648C(int *p)
{
    int *q;
    int i;
    p[0] = 0;
    p[1] = -1;
    p[2] = 0;
    p[3] = -1;
    p[4] = 0;
    Float_IsZero(p + 5);
    p[11] = 0;
    p[13] = 0;
    p[14] = 0;
    p[15] = 0;
    p[16] = 0;
    p[17] = 0;
    q = (int *)((char *)p + 72);
    for (i = 0; i < 16; i++, q = (int *)((char *)q + 16)) {
        q[0] = 0;
        q[1] = 0;
        q[2] = 0;
        q[3] = 0;
    }
    q = (int *)((char *)p + 348);
    for (i = 0; i < 120; i++, q = (int *)((char *)q + 132))
        Sub_08006150(q);
    Sub_0800648C_GapCall((int *)((char *)p + 0x473C));
    return p;
}
