=== func_80166F58 ALREADY LEVER-FREE in src/ov_SC01_000/ov_SC01_000_jr_8015C32C.c:5111 — same name, shares symbols and size: PROBABLY a variant; diff it before porting (R71) ===
s32 func_80166F58(s32 param_1, s32 param_2, s32 param_3, s32 param_4)
{
    /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every
       LATER function in this TU, which blocks a byte-true decl of a different type.
       Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */
    extern s32 D_8011D030;
    extern unsigned char D_801A4740[];

    int t2;
    int t3;
    int p2;
    int p3;

    unsigned short *puVar1;
    short iVar2;
    int eq;

    iVar2 = 0;
    puVar1 = ((unsigned short *)&D_8011D030);
    t2 = (short)param_2;
    p2 = (short)t2;
    t3 = (short)param_3;
    p3 = (short)t3;
    eq = (t2 == t3);
    do {
        if ((puVar1 != ((unsigned short *)param_1)) &&
            ((unsigned int)*puVar1 == p2 || (unsigned int)*puVar1 == p3) &&
            (!eq ||
             *(int *)(puVar1 + 0x16) == *(int *)(((unsigned short *)param_1) + 0x16))) {
            ((void(*)(unsigned short *))func_80146C3C)(puVar1);
        }
        iVar2 = iVar2 + 1;
        puVar1 = puVar1 + 0x2c;
    } while (iVar2 < 0x1e);
    ((void(*)(void *, int))func_80016714)(&D_801A4740[((short)param_4) * 0xc4], 0xc4);
}

=== func_80166F58 ALREADY LEVER-FREE in src/ov_SC01_001/ov_SC01_001_jr_8015C32C.c:5103 — same name, shares symbols and size: PROBABLY a variant; diff it before porting (R71) ===
s32 func_80166F58(s32 param_1, s32 param_2, s32 param_3, s32 param_4)
{
    /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every
       LATER function in this TU, which blocks a byte-true decl of a different type.
       Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */
    extern s32 D_8011D030;
    extern unsigned char D_801EC9D0[];

    int t2;
    int t3;
    int p2;
    int p3;

    unsigned short *puVar1;
    short iVar2;
    int eq;

    iVar2 = 0;
    puVar1 = ((unsigned short *)&D_8011D030);
    t2 = (short)param_2;
    p2 = (short)t2;
    t3 = (short)param_3;
    p3 = (short)t3;
    eq = (t2 == t3);
    do {
        if ((puVar1 != ((unsigned short *)param_1)) &&
            ((unsigned int)*puVar1 == p2 || (unsigned int)*puVar1 == p3) &&
            (!eq ||
             *(int *)(puVar1 + 0x16) == *(int *)(((unsigned short *)param_1) + 0x16))) {
            ((void(*)(unsigned short *))func_80146C3C)(puVar1);
        }
        iVar2 = iVar2 + 1;
        puVar1 = puVar1 + 0x2c;
    } while (iVar2 < 0x1e);
    ((void(*)(void *, int))func_80016714)(&D_801EC9D0[((short)param_4) * 0xc4], 0xc4);
}

=== lever-free bodies in ov_MAIN_012 sharing a callee or global with func_80166F58 (83 found; top 6 by shared symbols) — read them for the SHAPE ===
--- func_80165C78 (src/shared/ov/func_80165C78.h:5) shares 2: D_8011D030 func_80016714 ---
void func_80165C78(void) {
    func_80016714(&D_8011D030, 0xA50);
}

--- func_8016B984 (src/shared/ov/func_8016B984.h:5) shares 2: func_80016714 func_80146C3C ---
void func_8016B984(void *a0) {
    if (*(s32*)((s32)a0 + 0x10) != 0) {
        func_80016714(*(void**)((s32)a0 + 0x10), 0x38);
    }
    if (*(s32*)((s32)a0 + 0x14) != 0) {
        func_80016714(*(void**)((s32)a0 + 0x14), 0x38);
    }
    if (*(s32*)((s32)a0 + 0x18) != 0) {
        func_80016714(*(void**)((s32)a0 + 0x18), 0x38);
    }
    ((void (*)(void *))func_80146C3C)(a0);
}

--- func_8016706C (src/ov_MAIN_012/ov_MAIN_012_jr_8015A3C8.c:7476) shares 2: D_8011D030 func_80146C3C ---
void func_8016706C(s32 param_1)
{

    extern s32 D_8011D030;
    unsigned short *puVar1;
    short iVar2;

    iVar2 = 0;
    puVar1 = ((unsigned short *)&D_8011D030);
    do {
        if ((unsigned int)*puVar1 == ((short)param_1)) {
            ((void(*)(unsigned short *))func_80146C3C)(puVar1);
        }
        iVar2 = iVar2 + 1;
        puVar1 = puVar1 + 0x2c;
    } while (iVar2 < 0x1e);
}

--- func_8014AC10 (src/shared/ov/func_8014AC10.h:5) shares 2: D_8011D030 func_80016714 ---
void func_8014AC10(s32 arg0) {
    u8 *p;
    u8 *end;
    u8 *t;
    s32 one;
    void *a0;
    s32 a1;
    p = (u8 *)&D_8011D030;
    t = p + 0xA50;
    if (p < t) {
        one = 1;
        end = t;
        do {
            if (*(u16 *)p == arg0) {
                a0 = *(void **)(p + 0x20);
                if (a0 != 0) {
                    a1 = 0x38;
                    if (*(u16 *)a0 == one) {
                        a1 = 0x84;
                    }
                    func_80016714(a0, a1);
                }
                func_80016714(p, 0x58);
            }
            p += 0x58;
        } while (p < end);
    }
}

--- func_8016AA50 (src/shared/ov/func_8016AA50.h:9) shares 2: D_8011D030 func_80146C3C ---
void func_8016AA50(s32 param_1, s32 param_2) {
    short *psVar3;
    s32 iVar4;
    s32 sVar2;
    s32 t;
    if (param_2 >= 0) {
        ((s32 (*)(s32, void *, s32, s32, s32, s32, s32))func_80146A6C)(
            0x1d, (void *)param_1,
            *(s16 *)(param_1 + 0x7c), *(s16 *)(param_1 + 0x7e),
            *(s16 *)(param_1 + 0x80), 0, param_2);
        return;
    }
    iVar4 = 0;
    psVar3 = (short *)&D_8011D030;
    do {
        sVar2 = (u16)*psVar3;
        if (sVar2 == 0 || sVar2 == 3 || sVar2 == 9) {
            ((void (*)(void))func_80146C3C)();
            ((s32 (*)(s32, void *, s32, s32, s32, s32, s32))func_80146A6C)(
                0x1d, (void *)param_1,
                (s16)D_80126B5E, (s16)((u16)D_80126B62 - 0x20),
                (s16)D_80126B66, 7, 0);
            return;
        }
        t = iVar4 + 1;
        do { iVar4 = t; } while (0);
        psVar3 = psVar3 + 0x2c;
    } while ((s16)t < 0x1e);
}

--- func_8016DC20 (src/ov_MAIN_012/ov_MAIN_012_jr_8016AE5C.c:4199) shares 2: D_8011D030 func_80146C3C ---
s32 func_8016DC20(s32 param_1) {

    extern s32  D_8011D030;
    extern s16  D_80184EF0;
    extern s16  D_80184EF4;
    extern s32  D_80181684;
    extern s32  D_80181690;
    u16 *p;
    short i;
    s32 obj;
    s32 r;
    s32 node;
    s32 e;
    Work8016 w;

    i = 0;
    p = (u16 *)&D_8011D030;
    obj = *(s32 *)(param_1 + 0x34);
    do {
        if ((p != (u16 *)param_1) && (*p == 0x34)) goto done;
        i = i + 1;
        p += 0x2c;
    } while (i < 0x1e);

    func_80149374(obj, param_1 + 4);
    r = func_801619D0((void *)obj);
    i = 0;
    if (r != 0) {
        p = (u16 *)&D_8011D030;
        do {
            if (*p == 0x11) goto ddb0;
            i = i + 1;
            p += 0x2c;
        } while (i < 0x1e);

        func_80146A6C(0x11, (void *)param_1, *(s16 *)(param_1 + 6),
                      (s16)(*(u16 *)(param_1 + 0xA) - 8),
                      *(s16 *)(param_1 + 0xE), 0, 0);
        w.x = *(u16 *)(param_1 + 6);
        w.y = *(u16 *)(param_1 + 0xA);
        w.z = *(u16 *)(param_1 + 0xE);
        func_800D20C0(&w.x, &w.vx, 0);
        w.vy = 0;
        func_800D23D0(&w.vx);
        i = 0;
        do {
            e = func_80146A6C(0x12, (void *)param_1, *(s16 *)(obj + 6),
                              *(s16 *)(obj + 0xA), *(s16 *)(obj + 0xE),
                              i, 0);
            if (e != 0) {
                *(s16 *)(e + 0x12) = w.vx;
                *(s16 *)(e + 0x16) = w.vy;
                *(s16 *)(e + 0x1A) = 0;
            }
            i = i + 2;
        } while (i < 3);
        goto done;
    }
ddb0:
    if (((D_80184EF0 != *(s16 *)(obj + 6)) || (D_80184EF4 != *(s16 *)(obj + 0xE)))
        && (node = func_800D21C4(param_1, &D_80181684, 0x18), node != 0)) {
        D_80184EF0 = *(u16 *)(obj + 6);
        D_80184EF4 = *(u16 *)(obj + 0xE);
        func_800D1FC8(param_1, 7);
        *(s32 *)(param_1 + 0x20) = node;
        *(u16 *)(node + 0x1A) = 0x3000;
        *(u16 *)(node + 0x18) = 0x3000;
        *(u8 *)(node + 0x26) = 0xFF;
        *(u32 *)(node + 4) = *(u32 *)(node + 4) | 0x50000000;
        func_80128EA8(node, param_1 + 0x24, (s32)&D_80181690);
        ((s32 (*)(void *, void *))func_80128ED8)(node, param_1 + 0x24);
        *(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1;
        return;
    }
done:
    ((void (*)(s32))func_80146C3C)(param_1);
}

