#include "game_types.h"

/* Sub_08004920 @ 0x08004920 (real 34B) -- ladder table lookup (table 0x08027A28, halved). Mirrors src/matched/Sub_08004920.c. */
/* Ladder-table leaf: indexes table 0x08027A28 by the halfword at +136 and the
   level word at +60. (Leading .hword islands in the ROM span are jumped-over
   data, not code.) */
int Sub_08004920(int *p)
{
    int idx = *(short *)((char *)p + 136);
    int lv = p[15];
    int v = *(int *)((char *)(int *)0x08027A28 + (idx << 2) + ((lv + lv * 2) << 4));
    return v >> 1;
}
