/* @00417e0c file=? name=FUN_00417e0c */

undefined4 __cdecl FUN_00417e0c(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 8);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(iVar1 + 8);
    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar1 + 0x18);
    return uVar2;
  }
  return 0;
}



/* @00417e2c file=? name=FUN_00417e2c */

undefined4 __cdecl FUN_00417e2c(int param_1)

{
  if (*(int *)(param_1 + 8) != 0) {
    return *(undefined4 *)(*(int *)(param_1 + 8) + 8);
  }
  return 0;
}



/* @00417e44 file=? name=FUN_00417e44 */

int __cdecl FUN_00417e44(int param_1)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  for (iVar1 = *(int *)(*(int *)(param_1 + 4) + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x14)) {
    iVar2 = iVar2 + 1;
  }
  return iVar2;
}



/* @00417e64 file=? name=FUN_00417e64 */

undefined4 __cdecl FUN_00417e64(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  iVar1 = *(int *)(*(int *)(param_1 + 4) + 8);
  while( true ) {
    if (iVar1 == 0) {
      return 0;
    }
    if (param_2 == iVar2) break;
    iVar2 = iVar2 + 1;
    iVar1 = *(int *)(iVar1 + 0x14);
  }
  *(int *)(param_1 + 8) = iVar1;
  return *(undefined4 *)(iVar1 + 8);
}



/* @00417e98 file=? name=FUN_00417e98 */

void __cdecl FUN_00417e98(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 8);
  *(undefined4 *)(param_1 + 8) = puVar1[5];
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return;
}



/* @00417ebc file=? name=FUN_00417ebc */

void __cdecl FUN_00417ebc(int param_1,int param_2)

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417cbc(*(int *)(param_1 + 4),param_2,*(int *)(param_1 + 8));
  *(undefined4 *)(param_1 + 8) = uVar1;
  return;
}



/* @00417f0c file=? name=FUN_00417f0c */

undefined4 * __cdecl FUN_00417f0c(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417718(param_1,param_2);
  *param_1 = &PTR_FUN_004e2550;
  param_1[2] = 0;
  return param_1;
}



/* @00417f30 file=? name=FUN_00417f30 */

void __cdecl FUN_00417f30(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2550;
    FUN_0041772c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417f5c file=? name=FUN_00417f5c */

undefined4 FUN_00417f5c(void)

{
  FUN_0041774c();
  return 1;
}



/* @00417f78 file=? name=FUN_00417f78 */

void __cdecl FUN_00417f78(int param_1,undefined4 param_2,undefined4 param_3)

{
  int *piVar1;
  
  for (piVar1 = *(int **)(param_1 + 8); piVar1 != (int *)0x0; piVar1 = (int *)piVar1[2]) {
    (**(code **)(*piVar1 + 0x50))(piVar1,param_2,param_3);
  }
  return;
}



/* @00417fa8 file=? name=FUN_00417fa8 */

undefined4 * __cdecl FUN_00417fa8(undefined4 *param_1,int param_2)

{
  int iVar1;
  
  FUN_00417774(param_1,param_2);
  *param_1 = &PTR_FUN_004e24fc;
  iVar1 = *(int *)(param_2 + 8);
  param_1[2] = iVar1;
  if (iVar1 != 0) {
    *(undefined4 **)(iVar1 + 0xc) = param_1;
  }
  param_1[3] = 0;
  *(undefined4 **)(param_2 + 8) = param_1;
  return param_1;
}



/* @00417fe0 file=? name=FUN_00417fe0 */

void __cdecl FUN_00417fe0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e24fc;
    if (param_1 == *(int **)(param_1[1] + 8)) {
      *(int *)(param_1[1] + 8) = param_1[2];
    }
    if (param_1[3] != 0) {
      *(int *)(param_1[3] + 8) = param_1[2];
    }
    if (param_1[2] != 0) {
      *(int *)(param_1[2] + 0xc) = param_1[3];
    }
    FUN_00417794(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418034 file=? name=FUN_00418034 */

undefined4 FUN_00418034(void)

{
  FUN_004177c0();
  return 1;
}



/* @00418054 file=munga/sfeskt.cpp name=FUN_00418054 */

void FUN_00418054(void)

{
  FUN_0040385c(s_SafeIterator__ReceiveMemo___Shou_004e24a8,s_d__tesla_bt_munga_SFESKT_CPP_004e24dc,
               0xa7);
  return;
}



/* @00418070 file=? name=FUN_00418070 */

undefined4 * __cdecl FUN_00418070(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00417f0c(param_1,param_2);
  *param_1 = &PTR_FUN_004e2720;
  param_1[3] = param_3;
  return param_1;
}



/* @00418098 file=? name=FUN_00418098 */

void __cdecl FUN_00418098(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2720;
    FUN_00417f30(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004180c4 file=munga/srtskt.cpp name=FUN_004180c4 */

void FUN_004180c4(void)

{
  FUN_0040385c(s_SortedSocket__AddValueImplementa_004e2558,s_d__tesla_bt_munga_SRTSKT_CPP_004e2597,
               0x2b);
  return;
}



/* @004180e0 file=munga/srtskt.cpp name=FUN_004180e0 */

undefined4 FUN_004180e0(void)

{
  FUN_0040385c(s_SortedSocket__FindImplementation_004e25b4,s_d__tesla_bt_munga_SRTSKT_CPP_004e25ef,
               0x31);
  return 0;
}



/* @004180fc file=? name=FUN_004180fc */

undefined4 * __cdecl FUN_004180fc(undefined4 *param_1,int param_2)

{
  FUN_00417fa8(param_1,param_2);
  *param_1 = &PTR_FUN_004e26c4;
  return param_1;
}



/* @0041811c file=? name=FUN_0041811c */

void __cdecl FUN_0041811c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e26c4;
    FUN_00417fe0(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418148 file=munga/srtskt.cpp name=FUN_00418148 */

undefined4 FUN_00418148(void)

{
  FUN_0040385c(s_SortedIterator__FindImplementati_004e260c,s_d__tesla_bt_munga_SRTSKT_CPP_004e2649,
               0x41);
  return 0;
}



/* @00418164 file=munga/srtskt.cpp name=FUN_00418164 */

undefined4 FUN_00418164(void)

{
  FUN_0040385c(s_SortedIterator__GetValueImplemen_004e2666,s_d__tesla_bt_munga_SRTSKT_CPP_004e26a7,
               0x48);
  return 0;
}



/* @00418180 file=? name=FUN_00418180 */

undefined4 * __cdecl
FUN_00418180(undefined4 *param_1,undefined4 param_2,int param_3,int param_4,int param_5)

{
  FUN_00415ddc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e27c0;
  param_1[5] = param_4;
  if (param_4 != 0) {
    *(undefined4 **)(param_4 + 0x18) = param_1;
  }
  param_1[6] = param_5;
  if (param_5 != 0) {
    *(undefined4 **)(param_5 + 0x14) = param_1;
  }
  return param_1;
}



/* @004181c4 file=? name=FUN_004181c4 */

void __cdecl FUN_004181c4(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e27c0;
    iVar1 = param_1[1];
    FUN_00417f78(iVar1,1,param_1);
    if (param_1[6] == 0) {
      *(int *)(iVar1 + 0xc) = param_1[5];
    }
    else {
      *(int *)(param_1[6] + 0x14) = param_1[5];
    }
    if (param_1[5] == 0) {
      *(int *)(iVar1 + 0x10) = param_1[6];
    }
    else {
      *(int *)(param_1[5] + 0x18) = param_1[6];
    }
    param_1[5] = 0;
    param_1[6] = 0;
    FUN_00415e38((int)param_1);
    piVar2 = *(int **)(iVar1 + 4);
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 8))(piVar2,iVar1,param_1[2]);
    }
    FUN_00415e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00402f98(0x4e2730,param_1);
    }
  }
  return;
}



/* @0041825c file=? name=FUN_0041825c */

undefined4 FUN_0041825c(void)

{
  FUN_00415e2c();
  return 1;
}



/* @0041827c file=? name=FUN_0041827c */

undefined4 * __cdecl FUN_0041827c(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417f0c(param_1,param_2);
  *param_1 = &PTR_FUN_004e27b8;
  param_1[3] = 0;
  param_1[4] = 0;
  return param_1;
}



/* @004182a8 file=? name=FUN_004182a8 */

void __cdecl FUN_004182a8(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e27b8;
    param_1[1] = 0;
    while (puVar1 = (undefined4 *)param_1[3], puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_00417f30(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004182f0 file=? name=FUN_004182f0 */

undefined4 FUN_004182f0(void)

{
  FUN_00417f5c();
  return 1;
}



/* @0041830c file=? name=FUN_0041830c */

void __cdecl FUN_0041830c(int param_1,int param_2)

{
  undefined4 *puVar1;
  
  puVar1 = FUN_00402f74(0x4e2730);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00418180(puVar1,param_1,param_2,0,*(int *)(param_1 + 0x10));
  }
  *(undefined4 **)(param_1 + 0x10) = puVar1;
  if (*(int *)(param_1 + 0xc) == 0) {
    *(undefined4 **)(param_1 + 0xc) = puVar1;
  }
  return;
}



/* @00418354 file=? name=FUN_00418354 */

void __cdecl FUN_00418354(int param_1,int param_2,int param_3)

{
  undefined4 *puVar1;
  
  puVar1 = FUN_00402f74(0x4e2730);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00418180(puVar1,param_1,param_2,param_3,*(int *)(param_3 + 0x18));
  }
  if (param_3 == *(int *)(param_1 + 0xc)) {
    *(undefined4 **)(param_1 + 0xc) = puVar1;
  }
  return;
}



/* @00418398 file=? name=FUN_00418398 */

undefined4 * __cdecl FUN_00418398(undefined4 *param_1,int param_2)

{
  FUN_00417fa8(param_1,param_2);
  *param_1 = &PTR_FUN_004e2764;
  param_1[4] = *(undefined4 *)(param_2 + 0xc);
  return param_1;
}



/* @004183c0 file=? name=FUN_004183c0 */

undefined4 * __cdecl FUN_004183c0(undefined4 *param_1,int param_2)

{
  FUN_00417fa8(param_1,*(int *)(param_2 + 4));
  *param_1 = &PTR_FUN_004e2764;
  param_1[4] = *(undefined4 *)(param_2 + 0x10);
  return param_1;
}



/* @004183ec file=? name=FUN_004183ec */

void __cdecl FUN_004183ec(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2764;
    FUN_00417fe0(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418418 file=? name=FUN_00418418 */

undefined4 FUN_00418418(void)

{
  FUN_00418034();
  return 1;
}



/* @00418434 file=? name=FUN_00418434 */

void __cdecl FUN_00418434(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 4) + 0xc);
  return;
}



/* @00418448 file=? name=FUN_00418448 */

void __cdecl FUN_00418448(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 4) + 0x10);
  return;
}



/* @0041845c file=? name=FUN_0041845c */

void __cdecl FUN_0041845c(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 0x10) + 0x14);
  return;
}



/* @00418470 file=? name=FUN_00418470 */

void __cdecl FUN_00418470(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 0x10) + 0x18);
  return;
}



/* @00418484 file=? name=FUN_00418484 */

undefined4 __cdecl FUN_00418484(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 0x10);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(iVar1 + 8);
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 0x14);
    return uVar2;
  }
  return 0;
}



/* @004184a4 file=? name=FUN_004184a4 */

undefined4 __cdecl FUN_004184a4(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 0x10);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(iVar1 + 8);
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 0x18);
    return uVar2;
  }
  return 0;
}



/* @004184c4 file=? name=FUN_004184c4 */

undefined4 __cdecl FUN_004184c4(int param_1)

{
  if (*(int *)(param_1 + 0x10) != 0) {
    return *(undefined4 *)(*(int *)(param_1 + 0x10) + 8);
  }
  return 0;
}



/* @004184dc file=? name=FUN_004184dc */

int __cdecl FUN_004184dc(int param_1)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  for (iVar1 = *(int *)(*(int *)(param_1 + 4) + 0xc); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x14)) {
    iVar2 = iVar2 + 1;
  }
  return iVar2;
}



/* @004184fc file=? name=FUN_004184fc */

undefined4 __cdecl FUN_004184fc(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  iVar1 = *(int *)(*(int *)(param_1 + 4) + 0xc);
  while( true ) {
    if (iVar1 == 0) {
      return 0;
    }
    if (param_2 == iVar2) break;
    iVar2 = iVar2 + 1;
    iVar1 = *(int *)(iVar1 + 0x14);
  }
  *(int *)(param_1 + 0x10) = iVar1;
  return *(undefined4 *)(iVar1 + 8);
}



/* @00418530 file=? name=FUN_00418530 */

void __cdecl FUN_00418530(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 0x10);
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return;
}



/* @0041854c file=? name=FUN_0041854c */

void __cdecl FUN_0041854c(int param_1,int param_2)

{
  undefined4 uVar1;
  
  uVar1 = FUN_00418354(*(int *)(param_1 + 4),param_2,*(int *)(param_1 + 0x10));
  *(undefined4 *)(param_1 + 0x10) = uVar1;
  return;
}



/* @00418570 file=? name=FUN_00418570 */

void __cdecl FUN_00418570(int *param_1,int param_2,int param_3)

{
  if ((param_2 == 1) && (param_3 == param_1[4])) {
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  return;
}



/* @004185bc file=? name=FUN_004185bc */

undefined4 * __cdecl FUN_004185bc(undefined4 *param_1,undefined4 param_2,int param_3)

{
  FUN_00415ddc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2934;
  param_1[5] = 0;
  param_1[6] = 0;
  return param_1;
}



/* @004185ec file=? name=FUN_004185ec */

void __cdecl FUN_004185ec(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2934;
    iVar1 = param_1[1];
    FUN_00417f78(iVar1,1,param_1);
    if (param_1[6] == 0) {
      *(int *)(iVar1 + 0x10) = param_1[5];
    }
    else {
      *(int *)(param_1[6] + 0x14) = param_1[5];
    }
    if (param_1[5] == 0) {
      *(int *)(iVar1 + 0x14) = param_1[6];
    }
    else {
      *(int *)(param_1[5] + 0x18) = param_1[6];
    }
    param_1[5] = 0;
    param_1[6] = 0;
    FUN_00415e38((int)param_1);
    piVar2 = *(int **)(iVar1 + 4);
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 8))(piVar2,iVar1,param_1[2]);
    }
    FUN_00415e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418678 file=? name=FUN_00418678 */

undefined4 FUN_00418678(void)

{
  FUN_00415e2c();
  return 1;
}



/* @00418698 file=? name=FUN_00418698 */

void __cdecl FUN_00418698(int param_1,undefined4 param_2,undefined4 param_3)

{
  *(undefined4 *)(param_1 + 0x14) = param_2;
  *(undefined4 *)(param_1 + 0x18) = param_3;
  return;
}



/* @004186ac file=? name=FUN_004186ac */

undefined4 * __cdecl FUN_004186ac(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00418070(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2918;
  param_1[4] = 0;
  param_1[5] = 0;
  return param_1;
}



/* @004186dc file=? name=FUN_004186dc */

void __cdecl FUN_004186dc(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2918;
    param_1[1] = 0;
    while (puVar1 = (undefined4 *)param_1[4], puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_00418098(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418724 file=? name=FUN_00418724 */

undefined4 FUN_00418724(void)

{
  FUN_00417f5c();
  return 1;
}



/* @00418744 file=munga/vchain.cpp name=FUN_00418744 */

undefined4 FUN_00418744(void)

{
  FUN_0040385c(s_VChain__MakeVChainLink___Should_n_004e27c4,s_d__tesla_bt_munga_VCHAIN_CPP_004e27f5,
               0xcd);
  return 0;
}



/* @00418764 file=munga/vchain.cpp name=FUN_00418764 */

undefined4 FUN_00418764(void)

{
  FUN_0040385c(s_VChain__CompareVChainLinks___Sho_004e2812,s_d__tesla_bt_munga_VCHAIN_CPP_004e2847,
               0xdc);
  return 0;
}



/* @00418784 file=munga/vchain.cpp name=FUN_00418784 */

undefined4 FUN_00418784(void)

{
  FUN_0040385c(s_VChain__CompareValueToVChainLink_004e2864,s_d__tesla_bt_munga_VCHAIN_CPP_004e289f,
               0xeb);
  return 0;
}



/* @004187a4 file=? name=FUN_004187a4 */

void __cdecl FUN_004187a4(int *param_1,undefined4 param_2)

{
  (**(code **)(*param_1 + 8))(param_1,param_2,0);
  return;
}



/* @004187bc file=? name=FUN_004187bc */

void __cdecl FUN_004187bc(int *param_1,undefined4 param_2,undefined4 param_3)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  iVar2 = (**(code **)(*param_1 + 0x10))(param_1,param_2,param_3);
  if (param_1[4] == 0) {
    FUN_00418698(iVar2,0,0);
    param_1[4] = iVar2;
    param_1[5] = iVar2;
  }
  else {
    iVar1 = param_1[4];
    while ((iVar1 != 0 &&
           (iVar3 = (**(code **)(*param_1 + 0x18))(param_1,param_3,iVar1), -1 < iVar3))) {
      iVar1 = *(int *)(iVar1 + 0x14);
    }
    if (iVar1 == 0) {
      FUN_00418698(iVar2,0,param_1[5]);
      *(int *)(param_1[5] + 0x14) = iVar2;
      param_1[5] = iVar2;
    }
    else if (iVar1 == param_1[4]) {
      FUN_00418698(iVar2,param_1[4],0);
      *(int *)(param_1[4] + 0x18) = iVar2;
      param_1[4] = iVar2;
    }
    else {
      FUN_00418698(iVar2,iVar1,*(undefined4 *)(iVar1 + 0x18));
      *(int *)(*(int *)(iVar1 + 0x18) + 0x14) = iVar2;
      *(int *)(iVar1 + 0x18) = iVar2;
    }
  }
  FUN_00417f78((int)param_1,0,iVar2);
  return;
}



/* @00418878 file=? name=FUN_00418878 */

undefined4 __cdecl FUN_00418878(int *param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004188a0(param_1,param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    uVar2 = *(undefined4 *)(iVar1 + 8);
  }
  return uVar2;
}



/* @004188a0 file=? name=FUN_004188a0 */

int __cdecl FUN_004188a0(int *param_1,undefined4 param_2)

{
  int iVar1;
  int iVar2;
  
  iVar1 = param_1[4];
  while( true ) {
    if (iVar1 == 0) {
      return 0;
    }
    iVar2 = (**(code **)(*param_1 + 0x18))(param_1,param_2,iVar1);
    if (iVar2 == 0) break;
    if (iVar2 < 0) {
      return 0;
    }
    iVar1 = *(int *)(iVar1 + 0x14);
  }
  return iVar1;
}



/* @004188dc file=? name=FUN_004188dc */

undefined4 * __cdecl FUN_004188dc(undefined4 *param_1,int param_2)

{
  FUN_004180fc(param_1,param_2);
  *param_1 = &PTR_FUN_004e28bc;
  param_1[4] = *(undefined4 *)(param_2 + 0x10);
  return param_1;
}



/* @00418904 file=? name=FUN_00418904 */

undefined4 * __cdecl FUN_00418904(undefined4 *param_1,int param_2)

{
  FUN_004180fc(param_1,*(int *)(param_2 + 4));
  *param_1 = &PTR_FUN_004e28bc;
  param_1[4] = *(undefined4 *)(param_2 + 0x10);
  return param_1;
}



/* @00418930 file=? name=FUN_00418930 */

void __cdecl FUN_00418930(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e28bc;
    FUN_0041811c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041895c file=? name=FUN_0041895c */

undefined4 FUN_0041895c(void)

{
  FUN_00418034();
  return 1;
}



/* @00418978 file=? name=FUN_00418978 */

void __cdecl FUN_00418978(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 4) + 0x10);
  return;
}



/* @0041898c file=? name=FUN_0041898c */

void __cdecl FUN_0041898c(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 4) + 0x14);
  return;
}



/* @004189a0 file=? name=FUN_004189a0 */

void __cdecl FUN_004189a0(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 0x10) + 0x14);
  return;
}



/* @004189b4 file=? name=FUN_004189b4 */

void __cdecl FUN_004189b4(int param_1)

{
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 0x10) + 0x18);
  return;
}



/* @004189c8 file=? name=FUN_004189c8 */

undefined4 __cdecl FUN_004189c8(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 0x10);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(iVar1 + 8);
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 0x14);
    return uVar2;
  }
  return 0;
}



/* @004189e8 file=? name=FUN_004189e8 */

undefined4 __cdecl FUN_004189e8(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 0x10);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(iVar1 + 8);
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 0x18);
    return uVar2;
  }
  return 0;
}



/* @00418a08 file=? name=FUN_00418a08 */

undefined4 __cdecl FUN_00418a08(int param_1)

{
  if (*(int *)(param_1 + 0x10) != 0) {
    return *(undefined4 *)(*(int *)(param_1 + 0x10) + 8);
  }
  return 0;
}



/* @00418a20 file=? name=FUN_00418a20 */

int __cdecl FUN_00418a20(int param_1)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  for (iVar1 = *(int *)(*(int *)(param_1 + 4) + 0x10); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x14)) {
    iVar2 = iVar2 + 1;
  }
  return iVar2;
}



/* @00418a40 file=? name=FUN_00418a40 */

undefined4 __cdecl FUN_00418a40(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  iVar1 = *(int *)(*(int *)(param_1 + 4) + 0x10);
  while( true ) {
    if (iVar1 == 0) {
      return 0;
    }
    if (param_2 == iVar2) break;
    iVar2 = iVar2 + 1;
    iVar1 = *(int *)(iVar1 + 0x14);
  }
  *(int *)(param_1 + 0x10) = iVar1;
  return *(undefined4 *)(iVar1 + 8);
}



/* @00418a74 file=? name=FUN_00418a74 */

void __cdecl FUN_00418a74(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 0x10);
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return;
}



/* @00418a90 file=? name=FUN_00418a90 */

undefined4 __cdecl FUN_00418a90(int param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004188a0(*(int **)(param_1 + 4),param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    *(int *)(param_1 + 0x10) = iVar1;
    uVar2 = *(undefined4 *)(iVar1 + 8);
  }
  return uVar2;
}



/* @00418ac0 file=? name=FUN_00418ac0 */

void __cdecl FUN_00418ac0(int *param_1,int param_2,int param_3)

{
  if ((param_2 == 1) && (param_3 == param_1[4])) {
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  return;
}



/* @00418ae0 file=? name=FUN_00418ae0 */

undefined4 * __cdecl FUN_00418ae0(undefined4 *param_1,undefined4 param_2,int param_3)

{
  FUN_00415ddc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2a98;
  param_1[5] = 0;
  param_1[6] = 0;
  param_1[7] = 0;
  return param_1;
}



/* @00418b14 file=? name=FUN_00418b14 */

void __cdecl FUN_00418b14(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2a98;
    iVar1 = param_1[1];
    FUN_00417f78(iVar1,1,param_1);
    FUN_00418da0(iVar1,(int)param_1);
    FUN_00415e38((int)param_1);
    piVar2 = *(int **)(iVar1 + 4);
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 8))(piVar2,iVar1,param_1[2]);
    }
    FUN_00415e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418b78 file=? name=FUN_00418b78 */

undefined4 FUN_00418b78(void)

{
  FUN_00415e2c();
  return 1;
}



/* @00418b9c file=? name=FUN_00418b9c */

void __cdecl FUN_00418b9c(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  *(undefined4 *)(param_1 + 0x14) = param_2;
  *(undefined4 *)(param_1 + 0x18) = param_3;
  *(undefined4 *)(param_1 + 0x1c) = param_4;
  return;
}



/* @00418bb8 file=? name=FUN_00418bb8 */

undefined4 * __cdecl FUN_00418bb8(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00418070(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2a7c;
  param_1[4] = 0;
  return param_1;
}



/* @00418be0 file=? name=FUN_00418be0 */

void __cdecl FUN_00418be0(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2a7c;
    param_1[1] = 0;
    while (puVar1 = (undefined4 *)param_1[4], puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_00418098(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418c28 file=? name=FUN_00418c28 */

undefined4 FUN_00418c28(void)

{
  FUN_00417f5c();
  return 1;
}



/* @00418c44 file=? name=FUN_00418c44 */

void __cdecl FUN_00418c44(int *param_1,undefined4 param_2)

{
  (**(code **)(*param_1 + 8))(param_1,param_2,0);
  return;
}



/* @00418c5c file=? name=FUN_00418c5c */

void __cdecl FUN_00418c5c(int *param_1,undefined4 param_2,undefined4 param_3)

{
  int iVar1;
  
  iVar1 = (**(code **)(*param_1 + 0x10))(param_1,param_2,param_3);
  FUN_00418d1c(param_1,iVar1);
  FUN_00417f78((int)param_1,0,iVar1);
  return;
}



/* @00418c94 file=? name=FUN_00418c94 */

undefined4 __cdecl FUN_00418c94(int *param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_00418ef4(param_1,param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    uVar2 = *(undefined4 *)(iVar1 + 8);
  }
  return uVar2;
}



/* @00418cbc file=munga/tree.cpp name=FUN_00418cbc */

undefined4 FUN_00418cbc(void)

{
  FUN_0040385c(s_Tree__MakeTreeNode___Shoule_neve_004e2938,s_d__tesla_bt_munga_TREE_CPP_004e2965,
               0x107);
  return 0;
}



/* @00418cdc file=munga/tree.cpp name=FUN_00418cdc */

undefined4 FUN_00418cdc(void)

{
  FUN_0040385c(s_Tree__CompareTreeNodes___Shoule_n_004e2980,s_d__tesla_bt_munga_TREE_CPP_004e29b1,
               0x116);
  return 0;
}



/* @00418cfc file=munga/tree.cpp name=FUN_00418cfc */

undefined4 FUN_00418cfc(void)

{
  FUN_0040385c(s_Tree__CompareValueToTreeNode___S_004e29cc,s_d__tesla_bt_munga_TREE_CPP_004e2a03,
               0x125);
  return 0;
}



/* @00418d1c file=? name=FUN_00418d1c */

void __cdecl FUN_00418d1c(int *param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  if (param_1[4] == 0) {
    FUN_00418b9c(param_2,0,0,0);
    param_1[4] = param_2;
  }
  else {
    iVar1 = param_1[4];
    while (iVar1 != 0) {
      iVar2 = (**(code **)(*param_1 + 0x14))(param_1,param_2,iVar1);
      if (iVar2 < 0) {
        if (*(int *)(iVar1 + 0x14) == 0) {
          FUN_00418b9c(param_2,0,0,iVar1);
          *(int *)(iVar1 + 0x14) = param_2;
          return;
        }
        iVar1 = *(int *)(iVar1 + 0x14);
      }
      else {
        if (*(int *)(iVar1 + 0x18) == 0) {
          FUN_00418b9c(param_2,0,0,iVar1);
          *(int *)(iVar1 + 0x18) = param_2;
          return;
        }
        iVar1 = *(int *)(iVar1 + 0x18);
      }
    }
  }
  return;
}



/* @00418da0 file=? name=FUN_00418da0 */

void __cdecl FUN_00418da0(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  if (*(int *)(param_2 + 0x18) == 0) {
    if (*(int *)(param_2 + 0x14) == 0) {
      if (param_2 == *(int *)(param_1 + 0x10)) {
        *(undefined4 *)(param_1 + 0x10) = 0;
      }
      else if (param_2 == *(int *)(*(int *)(param_2 + 0x1c) + 0x14)) {
        *(undefined4 *)(*(int *)(param_2 + 0x1c) + 0x14) = 0;
      }
      else {
        *(undefined4 *)(*(int *)(param_2 + 0x1c) + 0x18) = 0;
      }
    }
    else if (param_2 == *(int *)(param_1 + 0x10)) {
      *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x14);
      *(undefined4 *)(*(int *)(param_2 + 0x14) + 0x1c) = 0;
    }
    else {
      if (param_2 == *(int *)(*(int *)(param_2 + 0x1c) + 0x14)) {
        *(undefined4 *)(*(int *)(param_2 + 0x1c) + 0x14) = *(undefined4 *)(param_2 + 0x14);
      }
      else {
        *(undefined4 *)(*(int *)(param_2 + 0x1c) + 0x18) = *(undefined4 *)(param_2 + 0x14);
      }
      *(undefined4 *)(*(int *)(param_2 + 0x14) + 0x1c) = *(undefined4 *)(param_2 + 0x1c);
    }
  }
  else if (*(int *)(param_2 + 0x14) == 0) {
    if (param_2 == *(int *)(param_1 + 0x10)) {
      *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x18);
      *(undefined4 *)(*(int *)(param_2 + 0x18) + 0x1c) = 0;
    }
    else {
      if (param_2 == *(int *)(*(int *)(param_2 + 0x1c) + 0x14)) {
        *(undefined4 *)(*(int *)(param_2 + 0x1c) + 0x14) = *(undefined4 *)(param_2 + 0x18);
      }
      else {
        *(undefined4 *)(*(int *)(param_2 + 0x1c) + 0x18) = *(undefined4 *)(param_2 + 0x18);
      }
      *(undefined4 *)(*(int *)(param_2 + 0x18) + 0x1c) = *(undefined4 *)(param_2 + 0x1c);
    }
  }
  else {
    iVar1 = *(int *)(param_2 + 0x18);
    do {
      iVar2 = iVar1;
      iVar1 = *(int *)(iVar2 + 0x14);
    } while (*(int *)(iVar2 + 0x14) != 0);
    if (iVar2 == *(int *)(*(int *)(iVar2 + 0x1c) + 0x14)) {
      *(undefined4 *)(*(int *)(iVar2 + 0x1c) + 0x14) = *(undefined4 *)(iVar2 + 0x18);
    }
    else {
      *(undefined4 *)(*(int *)(iVar2 + 0x1c) + 0x18) = *(undefined4 *)(iVar2 + 0x18);
    }
    if (*(int *)(iVar2 + 0x18) != 0) {
      *(undefined4 *)(*(int *)(iVar2 + 0x18) + 0x1c) = *(undefined4 *)(iVar2 + 0x1c);
    }
    *(undefined4 *)(iVar2 + 0x1c) = *(undefined4 *)(param_2 + 0x1c);
    *(undefined4 *)(iVar2 + 0x14) = *(undefined4 *)(param_2 + 0x14);
    *(undefined4 *)(iVar2 + 0x18) = *(undefined4 *)(param_2 + 0x18);
    if (param_2 == *(int *)(param_1 + 0x10)) {
      *(int *)(param_1 + 0x10) = iVar2;
    }
    else if (param_2 == *(int *)(*(int *)(iVar2 + 0x1c) + 0x14)) {
      *(int *)(*(int *)(iVar2 + 0x1c) + 0x14) = iVar2;
    }
    else {
      *(int *)(*(int *)(iVar2 + 0x1c) + 0x18) = iVar2;
    }
    if (*(int *)(iVar2 + 0x18) != 0) {
      *(int *)(*(int *)(iVar2 + 0x18) + 0x1c) = iVar2;
    }
    if (*(int *)(iVar2 + 0x14) != 0) {
      *(int *)(*(int *)(iVar2 + 0x14) + 0x1c) = iVar2;
    }
  }
  return;
}



/* @00418ef4 file=? name=FUN_00418ef4 */

int __cdecl FUN_00418ef4(int *param_1,undefined4 param_2)

{
  int iVar1;
  int iVar2;
  
  iVar1 = param_1[4];
  while ((iVar1 != 0 && (iVar2 = (**(code **)(*param_1 + 0x18))(param_1,param_2,iVar1), iVar2 != 0))
        ) {
    if (iVar2 < 0) {
      iVar1 = *(int *)(iVar1 + 0x14);
    }
    else {
      iVar1 = *(int *)(iVar1 + 0x18);
    }
  }
  return iVar1;
}



/* @00418f34 file=? name=FUN_00418f34 */

int * __cdecl FUN_00418f34(int *param_1,int param_2)

{
  FUN_004180fc(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e2a20;
  (**(code **)(*param_1 + 4))(param_1);
  return param_1;
}



/* @00418f5c file=? name=FUN_00418f5c */

void __cdecl FUN_00418f5c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2a20;
    FUN_0041811c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00418f88 file=? name=FUN_00418f88 */

undefined4 FUN_00418f88(void)

{
  FUN_00418034();
  return 1;
}



/* @00418fa4 file=? name=FUN_00418fa4 */

void __cdecl FUN_00418fa4(int param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  iVar1 = *(int *)(*(int *)(param_1 + 4) + 0x10);
  iVar3 = iVar1;
  while (iVar2 = iVar1, iVar2 != 0) {
    iVar3 = iVar2;
    iVar1 = *(int *)(iVar2 + 0x14);
  }
  *(int *)(param_1 + 0x10) = iVar3;
  return;
}



/* @00418fc4 file=? name=FUN_00418fc4 */

void FUN_00418fc4(void)

{
  return;
}



/* @00418fcc file=? name=FUN_00418fcc */

void __cdecl FUN_00418fcc(int param_1)

{
  int iVar1;
  int iVar2;
  
  iVar2 = *(int *)(param_1 + 0x10);
  if (iVar2 != 0) {
    iVar1 = *(int *)(iVar2 + 0x18);
    if (*(int *)(iVar2 + 0x18) != 0) {
      do {
        iVar2 = iVar1;
        iVar1 = *(int *)(iVar2 + 0x14);
      } while (iVar1 != 0);
      *(int *)(param_1 + 0x10) = iVar2;
      return;
    }
    *(undefined4 *)(param_1 + 0x10) = 0;
    for (; iVar1 = *(int *)(iVar2 + 0x1c), iVar1 != 0; iVar2 = *(int *)(iVar2 + 0x1c)) {
      if (iVar2 == *(int *)(iVar1 + 0x14)) {
        *(int *)(param_1 + 0x10) = iVar1;
        return;
      }
    }
  }
  return;
}



/* @00419010 file=? name=FUN_00419010 */

void FUN_00419010(void)

{
  return;
}



/* @00419018 file=? name=FUN_00419018 */

undefined4 __cdecl FUN_00419018(int param_1)

{
  if (*(int *)(param_1 + 0x10) != 0) {
    return *(undefined4 *)(*(int *)(param_1 + 0x10) + 8);
  }
  return 0;
}



/* @00419030 file=? name=FUN_00419030 */

int __cdecl FUN_00419030(int param_1)

{
  int iVar1;
  int iVar2;
  int local_18 [5];
  
  FUN_00418f34(local_18,*(int *)(param_1 + 4));
  iVar2 = 0;
  while( true ) {
    iVar1 = (**(code **)(local_18[0] + 0x28))(local_18);
    if (iVar1 == 0) break;
    iVar2 = iVar2 + 1;
  }
  FUN_00418f5c(local_18,2);
  return iVar2;
}



/* @00419078 file=? name=FUN_00419078 */

void __cdecl FUN_00419078(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 0x10);
  if ((puVar1 != (undefined4 *)0x0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return;
}



/* @00419098 file=? name=FUN_00419098 */

undefined4 __cdecl FUN_00419098(int param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_00418ef4(*(int **)(param_1 + 4),param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    *(int *)(param_1 + 0x10) = iVar1;
    uVar2 = *(undefined4 *)(iVar1 + 8);
  }
  return uVar2;
}



/* @004190c8 file=? name=FUN_004190c8 */

void __cdecl FUN_004190c8(int *param_1,int param_2,int param_3)

{
  if ((param_2 == 1) && (param_3 == param_1[4])) {
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  return;
}



/* @004190e8 file=? name=FUN_004190e8 */

undefined4 * __cdecl FUN_004190e8(undefined4 *param_1,undefined4 param_2,int param_3)

{
  FUN_00415ddc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2c08;
  return param_1;
}



/* @0041910c file=? name=FUN_0041910c */

void __cdecl FUN_0041910c(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  int local_8;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2c08;
    iVar1 = param_1[1];
    local_8 = FUN_0041942c(iVar1,(int)param_1);
    FUN_00419450(iVar1,local_8);
    FUN_00417f78(iVar1,1,&local_8);
    FUN_00415e38((int)param_1);
    piVar2 = *(int **)(iVar1 + 4);
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 8))(piVar2,iVar1,param_1[2]);
    }
    FUN_00415e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00419184 file=? name=FUN_00419184 */

undefined4 * __cdecl FUN_00419184(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00418070(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2bec;
  param_1[4] = 0;
  param_1[5] = 0;
  return param_1;
}



/* @004191b4 file=? name=FUN_004191b4 */

void __cdecl FUN_004191b4(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2bec;
    param_1[1] = 0;
    while (0 < param_1[5]) {
      puVar1 = *(undefined4 **)param_1[4];
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_00418098(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00419204 file=? name=FUN_00419204 */

undefined4 FUN_00419204(void)

{
  FUN_00417f5c();
  return 1;
}



/* @00419228 file=? name=FUN_00419228 */

void __cdecl FUN_00419228(int *param_1,undefined4 param_2)

{
  (**(code **)(*param_1 + 8))(param_1,param_2,0);
  return;
}



/* @00419240 file=? name=FUN_00419240 */

void __cdecl FUN_00419240(int *param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 uVar1;
  
  uVar1 = (**(code **)(*param_1 + 0x10))(param_1,param_2,param_3);
  FUN_00419308((int)param_1,uVar1);
  FUN_00419370(param_1);
  FUN_00417f78((int)param_1,0,uVar1);
  return;
}



/* @0041927c file=? name=FUN_0041927c */

undefined4 __cdecl FUN_0041927c(int *param_1,undefined4 param_2)

{
  uint uVar1;
  undefined4 uVar2;
  
  uVar1 = FUN_004193d0(param_1,param_2);
  if (uVar1 == 0xffffffff) {
    uVar2 = 0;
  }
  else {
    uVar2 = *(undefined4 *)(*(int *)(param_1[4] + uVar1 * 4) + 8);
  }
  return uVar2;
}



/* @004192a8 file=munga/table.cpp name=FUN_004192a8 */

undefined4 FUN_004192a8(void)

{
  FUN_0040385c(s_Table__MakeTableEntry___Should_n_004e2a9c,s_d__tesla_bt_munga_TABLE_CPP_004e2acc,
               0xde);
  return 0;
}



/* @004192c8 file=munga/table.cpp name=FUN_004192c8 */

undefined4 FUN_004192c8(void)

{
  FUN_0040385c(s_Table__CompareTableEntries___Sho_004e2ae8,s_d__tesla_bt_munga_TABLE_CPP_004e2b1d,
               0xed);
  return 0;
}



/* @004192e8 file=munga/table.cpp name=FUN_004192e8 */

undefined4 FUN_004192e8(void)

{
  FUN_0040385c(s_Table__CompareValueToTableEntry___004e2b39,s_d__tesla_bt_munga_TABLE_CPP_004e2b73,
               0xfc);
  return 0;
}



/* @00419308 file=? name=FUN_00419308 */

void __cdecl FUN_00419308(int param_1,undefined4 param_2)

{
  undefined4 uVar1;
  undefined4 *puVar2;
  int iVar3;
  
  iVar3 = *(int *)(param_1 + 0x14) + 1;
  if (*(int *)(param_1 + 0x10) == 0) {
    uVar1 = FUN_004022b0(iVar3 * 4);
    *(undefined4 *)(param_1 + 0x10) = uVar1;
  }
  else {
    puVar2 = (undefined4 *)FUN_004022b0(iVar3 * 4);
    FUN_004d4918(puVar2,*(undefined4 **)(param_1 + 0x10),*(int *)(param_1 + 0x14) << 2);
    FUN_004022e8(*(int **)(param_1 + 0x10));
    *(undefined4 **)(param_1 + 0x10) = puVar2;
  }
  *(int *)(param_1 + 0x14) = iVar3;
  *(undefined4 *)(*(int *)(param_1 + 0x10) + -4 + iVar3 * 4) = param_2;
  return;
}



/* @00419370 file=? name=FUN_00419370 */

void __cdecl FUN_00419370(int *param_1)

{
  undefined4 uVar1;
  int iVar2;
  uint uVar3;
  uint local_8;
  
  local_8 = 1;
  do {
    if ((uint)param_1[5] <= local_8) {
      return;
    }
    uVar1 = *(undefined4 *)(param_1[4] + local_8 * 4);
    uVar3 = local_8;
    do {
      iVar2 = (**(code **)(*param_1 + 0x14))
                        (param_1,*(undefined4 *)(param_1[4] + -4 + uVar3 * 4),uVar1);
      if (iVar2 < 1) break;
      *(undefined4 *)(param_1[4] + uVar3 * 4) = *(undefined4 *)(param_1[4] + -4 + uVar3 * 4);
      uVar3 = uVar3 - 1;
    } while (uVar3 != 0);
    *(undefined4 *)(param_1[4] + uVar3 * 4) = uVar1;
    local_8 = local_8 + 1;
  } while( true );
}



/* @004193d0 file=? name=FUN_004193d0 */

uint __cdecl FUN_004193d0(int *param_1,undefined4 param_2)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  
  uVar3 = 0;
  uVar4 = param_1[5];
  if (param_1[5] != 0) {
    do {
      uVar2 = (uVar4 + uVar3) - 1 >> 1;
      iVar1 = (**(code **)(*param_1 + 0x18))
                        (param_1,param_2,*(undefined4 *)(param_1[4] + uVar2 * 4));
      if (iVar1 == 0) {
        return uVar2;
      }
      if (-1 < iVar1) {
        uVar3 = uVar2 + 1;
        uVar2 = uVar4;
      }
      uVar4 = uVar2;
    } while (uVar3 < uVar2);
  }
  return 0xffffffff;
}



/* @0041942c file=? name=FUN_0041942c */

int __cdecl FUN_0041942c(int param_1,int param_2)

{
  int iVar1;
  int *piVar2;
  
  iVar1 = 0;
  piVar2 = *(int **)(param_1 + 0x10);
  while( true ) {
    if (*(int *)(param_1 + 0x14) <= iVar1) {
      return -1;
    }
    if (param_2 == *piVar2) break;
    iVar1 = iVar1 + 1;
    piVar2 = piVar2 + 1;
  }
  return iVar1;
}



/* @00419450 file=? name=FUN_00419450 */

void __cdecl FUN_00419450(int param_1,int param_2)

{
  undefined4 *puVar1;
  undefined4 *puVar2;
  int iVar3;
  
  puVar2 = (undefined4 *)((*(int *)(param_1 + 0x14) + -1) * 4 + *(int *)(param_1 + 0x10));
  puVar1 = (undefined4 *)(param_2 * 4 + *(int *)(param_1 + 0x10));
  if (puVar1 < puVar2) {
    FUN_004d493c(puVar1,puVar1 + 1,(int)puVar2 - (int)puVar1);
  }
  iVar3 = *(int *)(param_1 + 0x14) + -1;
  if (iVar3 == 0) {
    FUN_004022e8(*(int **)(param_1 + 0x10));
    *(undefined4 *)(param_1 + 0x10) = 0;
  }
  else {
    puVar1 = (undefined4 *)FUN_004022b0(iVar3 * 4);
    FUN_004d4918(puVar1,*(undefined4 **)(param_1 + 0x10),iVar3 * 4);
    FUN_004022e8(*(int **)(param_1 + 0x10));
    *(undefined4 **)(param_1 + 0x10) = puVar1;
  }
  *(int *)(param_1 + 0x14) = iVar3;
  return;
}



/* @004194d8 file=? name=FUN_004194d8 */

undefined4 * __cdecl FUN_004194d8(undefined4 *param_1,int param_2)

{
  FUN_004180fc(param_1,param_2);
  *param_1 = &PTR_FUN_004e2b90;
  param_1[4] = *(undefined4 *)(param_2 + 0x10);
  param_1[5] = *(undefined4 *)(param_2 + 0x14);
  if (param_1[4] == 0) {
    param_1[6] = 0xffffffff;
  }
  else {
    param_1[6] = 0;
  }
  return param_1;
}



/* @0041951c file=? name=FUN_0041951c */

void __cdecl FUN_0041951c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2b90;
    FUN_0041811c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00419548 file=? name=FUN_00419548 */

undefined4 FUN_00419548(void)

{
  FUN_00418034();
  return 1;
}



/* @00419564 file=? name=FUN_00419564 */

void __cdecl FUN_00419564(int param_1)

{
  if (*(int *)(param_1 + 0x10) != 0) {
    *(undefined4 *)(param_1 + 0x18) = 0;
  }
  return;
}



/* @00419578 file=? name=FUN_00419578 */

void __cdecl FUN_00419578(int param_1)

{
  if (*(int *)(param_1 + 0x10) != 0) {
    *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x14) + -1;
  }
  return;
}



/* @00419590 file=? name=FUN_00419590 */

void __cdecl FUN_00419590(int param_1)

{
  *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + 1;
  if (*(int *)(param_1 + 0x14) <= *(int *)(param_1 + 0x18)) {
    *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
  }
  return;
}



/* @004195ac file=? name=FUN_004195ac */

void __cdecl FUN_004195ac(int param_1)

{
  int *piVar1;
  
  piVar1 = (int *)(param_1 + 0x18);
  *piVar1 = *piVar1 + -1;
  if (*piVar1 < 0) {
    *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
  }
  return;
}



/* @004195c0 file=? name=FUN_004195c0 */

undefined4 __cdecl FUN_004195c0(int param_1)

{
  undefined4 uVar1;
  
  if (*(int *)(param_1 + 0x18) != -1) {
    uVar1 = *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x18) * 4) + 8);
    *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + 1;
    if (*(int *)(param_1 + 0x14) <= *(int *)(param_1 + 0x18)) {
      *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
    }
    return uVar1;
  }
  return 0;
}



/* @004195f4 file=? name=FUN_004195f4 */

undefined4 __cdecl FUN_004195f4(int param_1)

{
  int *piVar1;
  undefined4 uVar2;
  
  if (*(int *)(param_1 + 0x18) != -1) {
    uVar2 = *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x18) * 4) + 8);
    piVar1 = (int *)(param_1 + 0x18);
    *piVar1 = *piVar1 + -1;
    if (*piVar1 < 0) {
      *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
    }
    return uVar2;
  }
  return 0;
}



/* @00419620 file=? name=FUN_00419620 */

undefined4 __cdecl FUN_00419620(int param_1)

{
  if (*(int *)(param_1 + 0x18) != -1) {
    return *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x18) * 4) + 8);
  }
  return 0;
}



/* @00419640 file=? name=FUN_00419640 */

undefined4 __cdecl FUN_00419640(int param_1)

{
  return *(undefined4 *)(param_1 + 0x14);
}



/* @0041964c file=? name=FUN_0041964c */

undefined4 __cdecl FUN_0041964c(int param_1,int param_2)

{
  if (param_2 < *(int *)(param_1 + 0x14)) {
    *(int *)(param_1 + 0x18) = param_2;
    return *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x10) + param_2 * 4) + 8);
  }
  return 0;
}



/* @00419674 file=? name=FUN_00419674 */

void __cdecl FUN_00419674(int param_1)

{
  undefined4 *puVar1;
  
  if ((*(int *)(param_1 + 0x18) != -1) &&
     (puVar1 = *(undefined4 **)(*(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x18) * 4),
     puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return;
}



/* @00419698 file=? name=FUN_00419698 */

undefined4 __cdecl FUN_00419698(int param_1,undefined4 param_2)

{
  int *piVar1;
  uint uVar2;
  int iVar3;
  undefined4 uVar4;
  
  piVar1 = *(int **)(param_1 + 4);
  uVar2 = FUN_004193d0(piVar1,param_2);
  if (uVar2 == 0xffffffff) {
    *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
    uVar4 = 0;
  }
  else {
    if (piVar1[3] == 0) {
      while ((-1 < (int)(uVar2 - 1) &&
             (iVar3 = (**(code **)(*piVar1 + 0x14))
                                (piVar1,*(undefined4 *)(*(int *)(param_1 + 0x10) + -4 + uVar2 * 4),
                                 *(undefined4 *)(*(int *)(param_1 + 0x10) + uVar2 * 4)), iVar3 == 0)
             )) {
        uVar2 = uVar2 - 1;
      }
    }
    *(uint *)(param_1 + 0x18) = uVar2;
    uVar4 = *(undefined4 *)(*(int *)(*(int *)(param_1 + 0x10) + uVar2 * 4) + 8);
  }
  return uVar4;
}



/* @00419704 file=? name=FUN_00419704 */

void __cdecl FUN_00419704(int param_1,int param_2,int *param_3)

{
  int iVar1;
  
  if (param_2 == 0) {
    iVar1 = *(int *)(param_1 + 4);
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(iVar1 + 0x10);
    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 0x14);
    iVar1 = FUN_0041942c(iVar1,(int)param_3);
    if (iVar1 <= *(int *)(param_1 + 0x18)) {
      *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + 1;
      return;
    }
  }
  else {
    if (param_2 != 1) {
      return;
    }
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(*(int *)(param_1 + 4) + 0x10);
    *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(*(int *)(param_1 + 4) + 0x14);
    if (*param_3 < *(int *)(param_1 + 0x18)) {
      *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + -1;
    }
    else if (*(int *)(param_1 + 0x14) <= *(int *)(param_1 + 0x18)) {
      *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + -1;
    }
  }
  return;
}



/* @00419774 file=? name=FUN_00419774 */

undefined4 * __cdecl
FUN_00419774(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00418070(param_1,param_3,param_4);
  *param_1 = &PTR_FUN_004e2cf8;
  param_1[5] = param_2;
  FUN_004197a4((int)param_1);
  return param_1;
}



/* @004197a4 file=? name=FUN_004197a4 */

void __cdecl FUN_004197a4(int param_1)

{
  undefined4 uVar1;
  int iVar2;
  
  uVar1 = FUN_004022b0(*(int *)(param_1 + 0x14) << 2);
  *(undefined4 *)(param_1 + 0x10) = uVar1;
  for (iVar2 = 0; iVar2 < *(int *)(param_1 + 0x14); iVar2 = iVar2 + 1) {
    *(undefined4 *)(*(int *)(param_1 + 0x10) + iVar2 * 4) = 0;
  }
  return;
}



/* @004197d4 file=? name=FUN_004197d4 */

void __cdecl FUN_004197d4(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  int iVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2cf8;
    for (iVar2 = 0; iVar2 < param_1[5]; iVar2 = iVar2 + 1) {
      puVar1 = *(undefined4 **)(param_1[4] + iVar2 * 4);
      if ((puVar1 != (undefined4 *)0x0) && (puVar1 != (undefined4 *)0x0)) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_004022e8((int *)param_1[4]);
    param_1[4] = 0;
    param_1[5] = 0;
    FUN_00418098(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00419840 file=? name=FUN_00419840 */

undefined4 FUN_00419840(void)

{
  FUN_00417f5c();
  return 1;
}



/* @00419854 file=? name=FUN_00419854 */

void __cdecl FUN_00419854(int *param_1,undefined4 param_2)

{
  (**(code **)(*param_1 + 8))(param_1,param_2,0);
  return;
}



/* @0041986c file=? name=FUN_0041986c */

void __cdecl FUN_0041986c(int *param_1,undefined4 param_2,undefined4 param_3)

{
  int iVar1;
  int *piVar2;
  
  iVar1 = (**(code **)(*param_1 + 0x14))(param_1,param_3);
  piVar2 = *(int **)(param_1[4] + iVar1 * 4);
  if (piVar2 == (int *)0x0) {
    piVar2 = (int *)(**(code **)(*param_1 + 0x10))(param_1);
    *(int **)(param_1[4] + iVar1 * 4) = piVar2;
  }
  (**(code **)(*piVar2 + 8))(piVar2,param_2,param_3);
  return;
}



/* @004198b0 file=? name=FUN_004198b0 */

undefined4 __cdecl FUN_004198b0(int *param_1,undefined4 param_2)

{
  int *piVar1;
  int iVar2;
  undefined4 uVar3;
  
  iVar2 = (**(code **)(*param_1 + 0x14))(param_1,param_2);
  piVar1 = *(int **)(param_1[4] + iVar2 * 4);
  if (piVar1 == (int *)0x0) {
    uVar3 = 0;
  }
  else {
    uVar3 = (**(code **)(*piVar1 + 0xc))(piVar1,param_2);
  }
  return uVar3;
}



/* @004198e8 file=munga/hash.cpp name=FUN_004198e8 */

undefined4 FUN_004198e8(void)

{
  FUN_0040385c(s_Hash__MakeVChain___Should_never_r_004e2c0c,s_d__tesla_bt_munga_HASH_CPP_004e2c37,
               0xe3);
  return 0;
}



/* @00419908 file=munga/hash.cpp name=FUN_00419908 */

undefined4 FUN_00419908(void)

{
  FUN_0040385c(s_Hash__GetHashIndex___Should_neve_004e2c52,s_d__tesla_bt_munga_HASH_CPP_004e2c7f,
               0xef);
  return 0;
}



/* @00419928 file=? name=FUN_00419928 */

int * __cdecl FUN_00419928(int *param_1,int param_2)

{
  FUN_004180fc(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e2c9c;
  param_1[4] = *(int *)(param_2 + 0x10);
  param_1[5] = *(int *)(param_2 + 0x14);
  param_1[6] = -1;
  param_1[7] = 0;
  (**(code **)(*param_1 + 4))(param_1);
  return param_1;
}



/* @00419968 file=? name=FUN_00419968 */

void __cdecl FUN_00419968(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2c9c;
    param_1[4] = 0;
    param_1[5] = 0;
    param_1[6] = -1;
    FUN_00419b1c((int)param_1);
    FUN_0041811c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004199ac file=? name=FUN_004199ac */

undefined4 FUN_004199ac(void)

{
  FUN_00418034();
  return 1;
}



/* @004199c8 file=? name=FUN_004199c8 */

void __cdecl FUN_004199c8(int param_1)

{
  FUN_00419b40(param_1,0);
  return;
}



/* @004199dc file=? name=FUN_004199dc */

void FUN_004199dc(void)

{
  return;
}



/* @004199e4 file=? name=FUN_004199e4 */

void __cdecl FUN_004199e4(int param_1)

{
  int *piVar1;
  int iVar2;
  
  piVar1 = *(int **)(param_1 + 0x1c);
  if (piVar1 != (int *)0x0) {
    iVar2 = (**(code **)(*piVar1 + 0x30))(piVar1);
    if (iVar2 != 0) {
      (**(code **)(**(int **)(param_1 + 0x1c) + 0xc))(*(int **)(param_1 + 0x1c));
    }
    iVar2 = (**(code **)(**(int **)(param_1 + 0x1c) + 0x30))(*(int **)(param_1 + 0x1c));
    if (iVar2 == 0) {
      FUN_00419b40(param_1,*(int *)(param_1 + 0x18) + 1);
    }
  }
  return;
}



/* @00419a28 file=? name=FUN_00419a28 */

void FUN_00419a28(void)

{
  return;
}



/* @00419a30 file=? name=FUN_00419a30 */

undefined4 __cdecl FUN_00419a30(int param_1)

{
  int *piVar1;
  int iVar2;
  undefined4 uVar3;
  
  piVar1 = *(int **)(param_1 + 0x1c);
  if (piVar1 != (int *)0x0) {
    iVar2 = (**(code **)(*piVar1 + 0x30))(piVar1);
    if (iVar2 != 0) {
      uVar3 = (**(code **)(**(int **)(param_1 + 0x1c) + 0x30))(*(int **)(param_1 + 0x1c));
      return uVar3;
    }
    FUN_00419b40(param_1,*(int *)(param_1 + 0x18) + 1);
    piVar1 = *(int **)(param_1 + 0x1c);
    if (piVar1 != (int *)0x0) {
      uVar3 = (**(code **)(*piVar1 + 0x30))(piVar1);
      return uVar3;
    }
  }
  return 0;
}



/* @00419a7c file=? name=FUN_00419a7c */

int __cdecl FUN_00419a7c(int param_1)

{
  int iVar1;
  int iVar2;
  int local_24 [8];
  
  FUN_00419928(local_24,*(int *)(param_1 + 4));
  iVar2 = 0;
  while( true ) {
    iVar1 = (**(code **)(local_24[0] + 0x28))(local_24);
    if (iVar1 == 0) break;
    iVar2 = iVar2 + 1;
  }
  FUN_00419968(local_24,2);
  return iVar2;
}



/* @00419ac4 file=? name=FUN_00419ac4 */

void __cdecl FUN_00419ac4(int param_1)

{
  int *piVar1;
  int iVar2;
  
  piVar1 = *(int **)(param_1 + 0x1c);
  if (piVar1 != (int *)0x0) {
    iVar2 = (**(code **)(*piVar1 + 0x30))(piVar1);
    if (iVar2 != 0) {
      (**(code **)(**(int **)(param_1 + 0x1c) + 0x48))(*(int **)(param_1 + 0x1c));
      return;
    }
    FUN_00419b40(param_1,*(int *)(param_1 + 0x18) + 1);
    piVar1 = *(int **)(param_1 + 0x1c);
    if (piVar1 != (int *)0x0) {
      (**(code **)(*piVar1 + 0x48))(piVar1);
    }
  }
  return;
}



/* @00419b0c file=? name=FUN_00419b0c */

undefined4 FUN_00419b0c(void)

{
  return 0;
}



/* @00419b14 file=? name=FUN_00419b14 */

void FUN_00419b14(void)

{
  return;
}



/* @00419b1c file=? name=FUN_00419b1c */

void __cdecl FUN_00419b1c(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 0x1c);
  if (puVar1 != (undefined4 *)0x0) {
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
    *(undefined4 *)(param_1 + 0x1c) = 0;
  }
  return;
}



/* @00419b40 file=? name=FUN_00419b40 */

void __cdecl FUN_00419b40(int param_1,int param_2)

{
  undefined4 *puVar1;
  int iVar2;
  
  FUN_00419b1c(param_1);
  *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
  do {
    if (*(int *)(param_1 + 0x14) <= param_2) {
      return;
    }
    if (*(int *)(*(int *)(param_1 + 0x10) + param_2 * 4) != 0) {
      puVar1 = (undefined4 *)FUN_00402298(0x14);
      if (puVar1 == (undefined4 *)0x0) {
        puVar1 = (undefined4 *)0x0;
      }
      else {
        puVar1 = FUN_004188dc(puVar1,*(int *)(*(int *)(param_1 + 0x10) + param_2 * 4));
      }
      *(undefined4 **)(param_1 + 0x1c) = puVar1;
      iVar2 = (**(code **)(**(int **)(param_1 + 0x1c) + 0x30))(*(int **)(param_1 + 0x1c));
      if (iVar2 != 0) {
        *(int *)(param_1 + 0x18) = param_2;
        return;
      }
      FUN_00419b1c(param_1);
    }
    param_2 = param_2 + 1;
  } while( true );
}



/* @00419bbc file=? name=FUN_00419bbc */

void __cdecl FUN_00419bbc(int param_1,int param_2)

{
  int iVar1;
  undefined4 *puVar2;
  int local_14 [3];
  int *local_8;
  
  FUN_0041a434(local_14,**(int **)(param_1 + 0xc) + 0x10);
  while( true ) {
    iVar1 = (**(code **)(local_14[0] + 0x28))(local_14);
    if (iVar1 == 0) break;
    FUN_00419f28(iVar1,param_1,param_2);
  }
  local_8 = *(int **)(*(int *)(param_1 + 0xc) + 4);
  if (*local_8 < *(int *)(param_2 + 4)) {
    puVar2 = &DAT_004e2d10;
  }
  else {
    puVar2 = (undefined4 *)(local_8[1] + -0xc + *(int *)(param_2 + 4) * 0x14);
  }
  if ((((code *)*puVar2 != DAT_004e2d10) || (puVar2[1] != DAT_004e2d14)) ||
     (puVar2[2] != DAT_004e2d18)) {
    (*(code *)*puVar2)(param_1,param_2);
  }
  FUN_0041a472(local_14,2);
  return;
}



/* @00419c90 file=? name=FUN_00419c90 */

void __cdecl FUN_00419c90(int param_1,undefined4 *param_2)

{
  FUN_00419bbc(param_1,param_2[4]);
  if (param_2 != (undefined4 *)0x0) {
    (**(code **)*param_2)(param_2,3);
  }
  return;
}



/* @00419cb8 file=? name=FUN_00419cb8 */

void __cdecl FUN_00419cb8(int param_1)

{
  undefined4 *puVar1;
  int local_14 [4];
  
  FUN_0041a49e(local_14,param_1,0xffffffff);
  while( true ) {
    puVar1 = (undefined4 *)(**(code **)(local_14[0] + 0x28))(local_14);
    if (puVar1 == (undefined4 *)0x0) break;
    if ((puVar1[1] == 9) && (puVar1 != (undefined4 *)0x0)) {
      (**(code **)*puVar1)(puVar1,3);
    }
  }
  FUN_0041a503(local_14,2);
  return;
}



/* @00419d10 file=? name=FUN_00419d10 */

void __cdecl FUN_00419d10(int param_1,int param_2)

{
  undefined4 *puVar1;
  int local_14 [4];
  
  FUN_0041a49e(local_14,param_1,0xffffffff);
  while( true ) {
    puVar1 = (undefined4 *)(**(code **)(local_14[0] + 0x28))(local_14);
    if (puVar1 == (undefined4 *)0x0) break;
    if ((puVar1[1] == 9) &&
       (((param_2 == 0 || (param_2 == *(int *)(puVar1[4] + 4))) && (puVar1 != (undefined4 *)0x0))))
    {
      (**(code **)*puVar1)(puVar1,3);
    }
  }
  FUN_0041a503(local_14,2);
  return;
}



/* @00419d78 file=? name=FUN_00419d78 */

void __cdecl FUN_00419d78(int param_1)

{
  undefined4 *puVar1;
  int local_14 [4];
  
  FUN_0041a52f(local_14,param_1,0xffffffff);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_14[0] + 0x28))(local_14);
    if (puVar1 == (undefined4 *)0x0) break;
  } while (puVar1[1] != 0xd);
  if (puVar1 == (undefined4 *)0x0) {
    FUN_0041a594(local_14,2);
  }
  else {
    FUN_0041b0a8(puVar1[3],0);
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
    FUN_0041a594(local_14,2);
  }
  return;
}



/* @00419df0 file=? name=FUN_00419df0 */

void __cdecl FUN_00419df0(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4e2d24);
  return;
}



/* @00419e0c file=? name=FUN_00419e0c */

undefined4 FUN_00419e0c(void)

{
  return 1;
}



/* @00419e18 file=? name=FUN_00419e18 */

int * __cdecl FUN_00419e18(int *param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  FUN_0040328c(param_1,0);
  *param_1 = (int)&PTR_FUN_004e2f80;
  local_10 = param_3;
  local_c = param_2;
  local_8 = 1;
  (**(code **)(*param_1 + 0x20))(param_1,&local_10,param_3);
  return param_1;
}



/* @00419e60 file=? name=FUN_00419e60 */

int * __cdecl FUN_00419e60(int *param_1,undefined4 *param_2,uint param_3)

{
  FUN_004033d0(param_1,param_2,param_3);
  *(int *)param_1[1] = param_1[2] - param_1[1];
  return param_1;
}



/* @00419e8c file=? name=FUN_00419e8c */

undefined4 * __cdecl
FUN_00419e8c(undefined4 *param_1,int param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5,undefined4 param_6)

{
  FUN_00415e90(param_1,6);
  *param_1 = &PTR_FUN_004e2f7c;
  param_1[6] = param_3;
  param_1[3] = param_4;
  param_1[4] = param_5;
  param_1[5] = param_6;
  param_1[7] = 0;
  param_1[8] = 0;
  FUN_0041a144(param_2,param_1);
  return param_1;
}



/* @00419ed8 file=? name=FUN_00419ed8 */

undefined4 * __cdecl
FUN_00419ed8(undefined4 *param_1,int param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5,undefined4 param_6,undefined4 param_7,undefined4 param_8)

{
  FUN_00415e90(param_1,6);
  *param_1 = &PTR_FUN_004e2f7c;
  param_1[6] = param_3;
  param_1[3] = param_4;
  param_1[4] = param_5;
  param_1[5] = param_6;
  param_1[7] = param_8;
  param_1[8] = param_7;
  FUN_0041a144(param_2,param_1);
  return param_1;
}



/* @00419f28 file=? name=FUN_00419f28 */

void __cdecl FUN_00419f28(int param_1,int param_2,int param_3)

{
  if (((*(int *)(param_1 + 0x1c) == 0) || (param_2 == *(int *)(param_1 + 0x1c))) &&
     ((*(int *)(param_1 + 0x20) == 0 || (*(int *)(param_1 + 0x20) == *(int *)(param_3 + 4))))) {
    (**(code **)(param_1 + 0xc))(*(undefined4 *)(param_1 + 0x18),param_3,param_2);
  }
  return;
}



/* @00419f5c file=? name=FUN_00419f5c */

undefined4 FUN_00419f5c(void)

{
  return 1;
}



/* @00419f68 file=? name=FUN_00419f68 */

undefined4 FUN_00419f68(void)

{
  return 1;
}



/* @00419f74 file=? name=FUN_00419f74 */

void __cdecl FUN_00419f74(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    if ((int *)param_1[1] != (int *)0x0) {
      FUN_004022e8((int *)param_1[1]);
    }
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00419fa0 file=? name=FUN_00419fa0 */

void __cdecl FUN_00419fa0(int *param_1,int param_2,int *param_3,int *param_4)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  undefined4 *puVar4;
  undefined4 *puVar5;
  int *piVar6;
  
  *param_1 = 0;
  iVar1 = 0;
  piVar3 = param_3;
  if (0 < param_2) {
    do {
      if (*param_1 < *piVar3) {
        *param_1 = *piVar3;
      }
      iVar1 = iVar1 + 1;
      piVar3 = piVar3 + 5;
    } while (iVar1 < param_2);
  }
  if ((param_4 != (int *)0x0) && (*param_1 < *param_4)) {
    *param_1 = *param_4;
  }
  iVar1 = FUN_004022b0(*param_1 * 0x14);
  param_1[1] = iVar1;
  iVar1 = 0;
  if (param_4 != (int *)0x0) {
    for (; iVar1 < *param_4; iVar1 = iVar1 + 1) {
      puVar4 = (undefined4 *)(param_4[1] + iVar1 * 0x14);
      puVar5 = (undefined4 *)(param_1[1] + iVar1 * 0x14);
      for (iVar2 = 5; iVar2 != 0; iVar2 = iVar2 + -1) {
        *puVar5 = *puVar4;
        puVar4 = puVar4 + 1;
        puVar5 = puVar5 + 1;
      }
    }
  }
  iVar1 = 0;
  if (0 < param_2) {
    do {
      piVar3 = param_3;
      piVar6 = (int *)(param_1[1] + (*param_3 + -1) * 0x14);
      for (iVar2 = 5; iVar2 != 0; iVar2 = iVar2 + -1) {
        *piVar6 = *piVar3;
        piVar3 = piVar3 + 1;
        piVar6 = piVar6 + 1;
      }
      iVar1 = iVar1 + 1;
      param_3 = param_3 + 5;
    } while (iVar1 < param_2);
  }
  return;
}



/* @0041a058 file=? name=FUN_0041a058 */

int __cdecl FUN_0041a058(int *param_1,char *param_2)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  int iVar4;
  bool bVar5;
  
  iVar4 = 0;
  do {
    if (*param_1 <= iVar4) {
      return 0;
    }
    pcVar3 = *(char **)(param_1[1] + 4 + iVar4 * 0x14);
    pcVar2 = param_2;
    do {
      if (*pcVar2 != *pcVar3) goto LAB_0041a0a1;
      bVar5 = true;
      if (*pcVar2 == '\0') break;
      pcVar1 = pcVar2 + 1;
      if (*pcVar1 != pcVar3[1]) goto LAB_0041a0a1;
      pcVar2 = pcVar2 + 2;
      pcVar3 = pcVar3 + 2;
      bVar5 = *pcVar1 == '\0';
    } while (!bVar5);
    if (bVar5) {
      return iVar4 * 0x14 + param_1[1];
    }
LAB_0041a0a1:
    iVar4 = iVar4 + 1;
  } while( true );
}



/* @0041a0b0 file=? name=FUN_0041a0b0 */

undefined4 * __cdecl FUN_0041a0b0(undefined4 *param_1,undefined4 param_2)

{
  FUN_004178cc(param_1,7);
  *param_1 = &PTR_FUN_004e2f70;
  FUN_0041a37f(param_1 + 4,param_1);
  FUN_0041a3ca(param_1 + 8,param_1);
  param_1[3] = param_2;
  return param_1;
}



/* @0041a0f0 file=? name=FUN_0041a0f0 */

undefined4 * __cdecl FUN_0041a0f0(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_004178cc(param_1,7);
  *param_1 = &PTR_FUN_004e2f70;
  FUN_0041a37f(param_1 + 4,param_1);
  FUN_0041a3ca(param_1 + 8,param_1);
  param_1[3] = param_3;
  (**(code **)(*(int *)(param_2 + 0x20) + 4))(param_2 + 0x20,param_1);
  return param_1;
}



/* @0041a144 file=? name=FUN_0041a144 */

void __cdecl FUN_0041a144(int param_1,undefined4 param_2)

{
  int iVar1;
  int local_10 [3];
  
  (**(code **)(*(int *)(param_1 + 0x10) + 4))(param_1 + 0x10,param_2);
  FUN_0041a5df(local_10,param_1 + 0x20);
  while( true ) {
    iVar1 = (**(code **)(local_10[0] + 0x28))(local_10);
    if (iVar1 == 0) break;
    FUN_0041a144(iVar1,param_2);
  }
  FUN_0041a61d(local_10,2);
  return;
}



/* @0041a1a4 file=? name=FUN_0041a1a4 */

undefined4 __cdecl FUN_0041a1a4(int param_1,int param_2)

{
  undefined4 uVar1;
  int iVar2;
  int local_14 [4];
  
  if (param_1 == param_2) {
    uVar1 = 1;
  }
  else {
    FUN_0041a649(local_14,param_1,0xffffffff);
    do {
      iVar2 = (**(code **)(local_14[0] + 0x28))(local_14);
      if (iVar2 == 0) {
        uVar1 = 0;
        FUN_0041a6ae(local_14,2);
        return uVar1;
      }
    } while (*(int *)(iVar2 + 4) != 7);
    uVar1 = FUN_0041a1a4(iVar2,param_2);
    FUN_0041a6ae(local_14,2);
  }
  return uVar1;
}



/* @0041a21c file=? name=FUN_0041a21c */

undefined4 __cdecl FUN_0041a21c(int param_1,char *param_2)

{
  char *pcVar1;
  char *pcVar2;
  undefined4 uVar3;
  int iVar4;
  char *pcVar5;
  bool bVar6;
  int local_14 [4];
  
  pcVar2 = *(char **)(param_1 + 0xc);
  pcVar5 = param_2;
  do {
    if (*pcVar2 != *pcVar5) goto LAB_0041a254;
    bVar6 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar5[1]) goto LAB_0041a254;
    pcVar2 = pcVar2 + 2;
    pcVar5 = pcVar5 + 2;
    bVar6 = *pcVar1 == '\0';
  } while (!bVar6);
  if (bVar6) {
    uVar3 = 1;
  }
  else {
LAB_0041a254:
    FUN_0041a649(local_14,param_1,0xffffffff);
    do {
      iVar4 = (**(code **)(local_14[0] + 0x28))(local_14);
      if (iVar4 == 0) {
        uVar3 = 0;
        FUN_0041a6ae(local_14,2);
        return uVar3;
      }
    } while (*(int *)(iVar4 + 4) != 7);
    uVar3 = FUN_0041a21c(iVar4,param_2);
    FUN_0041a6ae(local_14,2);
  }
  return uVar3;
}



/* @0041a2b4 file=? name=FUN_0041a2b4 */

undefined4 FUN_0041a2b4(void)

{
  return 1;
}



/* @0041a37f file=? name=FUN_0041a37f */

undefined4 * __cdecl FUN_0041a37f(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417be0(param_1,param_2);
  *param_1 = &PTR_FUN_004e2f68;
  return param_1;
}



/* @0041a39e file=? name=FUN_0041a39e */

void __cdecl FUN_0041a39e(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2f68;
    FUN_00417c0c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a3ca file=? name=FUN_0041a3ca */

undefined4 * __cdecl FUN_0041a3ca(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417be0(param_1,param_2);
  *param_1 = &PTR_FUN_004e2f60;
  return param_1;
}



/* @0041a3e9 file=? name=FUN_0041a3e9 */

void __cdecl FUN_0041a3e9(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2f60;
    FUN_00417c0c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a415 file=? name=FUN_0041a415 */

undefined4 * __cdecl FUN_0041a415(undefined4 *param_1,int param_2)

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_004e2f10;
  return param_1;
}



/* @0041a434 file=? name=FUN_0041a434 */

undefined4 * __cdecl FUN_0041a434(undefined4 *param_1,int param_2)

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_004e2f10;
  return param_1;
}



/* @0041a453 file=? name=FUN_0041a453 */

undefined4 * __cdecl FUN_0041a453(undefined4 *param_1,int param_2)

{
  FUN_00417d28(param_1,param_2);
  *param_1 = &PTR_FUN_004e2f10;
  return param_1;
}



/* @0041a472 file=? name=FUN_0041a472 */

void __cdecl FUN_0041a472(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2f10;
    FUN_00417d54(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a49e file=? name=FUN_0041a49e */

undefined4 * __cdecl FUN_0041a49e(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2ec8;
  return param_1;
}



/* @0041a4c1 file=? name=FUN_0041a4c1 */

undefined4 * __cdecl FUN_0041a4c1(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2ec8;
  return param_1;
}



/* @0041a4e4 file=? name=FUN_0041a4e4 */

undefined4 * __cdecl FUN_0041a4e4(undefined4 *param_1,int param_2)

{
  FUN_00415f60(param_1,param_2);
  *param_1 = &PTR_FUN_004e2ec8;
  return param_1;
}



/* @0041a503 file=? name=FUN_0041a503 */

void __cdecl FUN_0041a503(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2ec8;
    FUN_00415f90(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a52f file=? name=FUN_0041a52f */

undefined4 * __cdecl FUN_0041a52f(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2e80;
  return param_1;
}



/* @0041a552 file=? name=FUN_0041a552 */

undefined4 * __cdecl FUN_0041a552(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2e80;
  return param_1;
}



/* @0041a575 file=? name=FUN_0041a575 */

undefined4 * __cdecl FUN_0041a575(undefined4 *param_1,int param_2)

{
  FUN_00415f60(param_1,param_2);
  *param_1 = &PTR_FUN_004e2e80;
  return param_1;
}



/* @0041a594 file=? name=FUN_0041a594 */

void __cdecl FUN_0041a594(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2e80;
    FUN_00415f90(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a5c0 file=? name=FUN_0041a5c0 */

undefined4 * __cdecl FUN_0041a5c0(undefined4 *param_1,int param_2)

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_004e2e30;
  return param_1;
}



/* @0041a5df file=? name=FUN_0041a5df */

undefined4 * __cdecl FUN_0041a5df(undefined4 *param_1,int param_2)

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_004e2e30;
  return param_1;
}



/* @0041a5fe file=? name=FUN_0041a5fe */

undefined4 * __cdecl FUN_0041a5fe(undefined4 *param_1,int param_2)

{
  FUN_00417d28(param_1,param_2);
  *param_1 = &PTR_FUN_004e2e30;
  return param_1;
}



/* @0041a61d file=? name=FUN_0041a61d */

void __cdecl FUN_0041a61d(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2e30;
    FUN_00417d54(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a649 file=? name=FUN_0041a649 */

undefined4 * __cdecl FUN_0041a649(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2de8;
  return param_1;
}



/* @0041a66c file=? name=FUN_0041a66c */

undefined4 * __cdecl FUN_0041a66c(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2de8;
  return param_1;
}



/* @0041a68f file=? name=FUN_0041a68f */

undefined4 * __cdecl FUN_0041a68f(undefined4 *param_1,int param_2)

{
  FUN_00415f60(param_1,param_2);
  *param_1 = &PTR_FUN_004e2de8;
  return param_1;
}



/* @0041a6ae file=? name=FUN_0041a6ae */

void __cdecl FUN_0041a6ae(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2de8;
    FUN_00415f90(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a6da file=? name=FUN_0041a6da */

void __cdecl FUN_0041a6da(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    FUN_0041a3e9(param_1 + 8,2);
    FUN_0041a39e(param_1 + 4,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a71c file=? name=FUN_0041a71c */

void __cdecl FUN_0041a71c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    FUN_00415ed8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00402f98(0x4e2d84,param_1);
    }
  }
  return;
}



/* @0041a750 file=? name=FUN_0041a750 */

undefined4 * __cdecl
FUN_0041a750(undefined4 *param_1,uint *param_2,undefined4 param_3,undefined4 param_4)

{
  undefined4 uVar1;
  
  FUN_004178cc(param_1,param_4);
  *param_1 = &PTR_FUN_004e3268;
  param_1[3] = param_3;
  uVar1 = FUN_004022b0(*param_2 + 3 & 0xfffffffc);
  param_1[4] = uVar1;
  FUN_004d4918((undefined4 *)param_1[4],param_2,*param_2);
  return param_1;
}



/* @0041a7a4 file=? name=FUN_0041a7a4 */

void __cdecl FUN_0041a7a4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3268;
    if ((int *)param_1[4] != (int *)0x0) {
      FUN_004022d0((int *)param_1[4]);
    }
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041a7e0 file=munga/event.cpp name=FUN_0041a7e0 */

void FUN_0041a7e0(void)

{
  FUN_0040385c(s_AbstractEvent__Process_should_no_004e2fcc,s_d__tesla_bt_munga_EVENT_CPP_004e2ffa,
               100);
  return;
}



/* @0041a7fc file=munga/event.cpp name=FUN_0041a7fc */

void FUN_0041a7fc(void)

{
  FUN_0040385c(s_AbstractEvent__DumpData_should_n_004e3016,s_d__tesla_bt_munga_EVENT_CPP_004e3045,
               0x6c);
  return;
}



/* @0041a818 file=? name=FUN_0041a818 */

undefined4 * __cdecl
FUN_0041a818(undefined4 *param_1,undefined4 param_2,uint *param_3,undefined4 param_4)

{
  FUN_0041a750(param_1,param_3,param_4,9);
  *param_1 = &PTR_FUN_004e3254;
  FUN_0041b688(param_1 + 5,param_1);
  (**(code **)(param_1[5] + 4))(param_1 + 5,param_2);
  return param_1;
}



/* @0041a860 file=? name=FUN_0041a860 */

void __cdecl FUN_0041a860(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3254;
    FUN_0041b6a7(param_1 + 5,2);
    FUN_0041a7a4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00402f98(0x4e2fa4,param_1);
    }
  }
  return;
}



/* @0041a8a4 file=? name=FUN_0041a8a4 */

void __cdecl FUN_0041a8a4(int param_1,int param_2,int param_3,int param_4)

{
  int iVar1;
  int local_14 [4];
  
  FUN_0041b71e(local_14,param_1,0xffffffff);
  do {
    iVar1 = (**(code **)(local_14[0] + 0x30))(local_14);
    if (iVar1 == 0) {
LAB_0041a8fa:
      if (param_4 != 0) {
        *(int *)(param_1 + 0xc) = param_4;
      }
      FUN_0041adec(param_2,param_3,param_1);
      FUN_0041b783(local_14,2);
      return;
    }
    iVar1 = *(int *)(iVar1 + 4);
    if (((iVar1 == 0xc) || (iVar1 == 0xb)) || (iVar1 == 0xd)) {
      FUN_00416190((int)local_14);
      goto LAB_0041a8fa;
    }
    (**(code **)(local_14[0] + 0xc))(local_14);
  } while( true );
}



/* @0041a92c file=? name=FUN_0041a92c */

void __cdecl FUN_0041a92c(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int local_14 [4];
  
  iVar1 = FUN_00417ab4(param_1 + 0x14);
  FUN_0041a52f(local_14,iVar1,0xffffffff);
  do {
    puVar2 = (undefined4 *)(**(code **)(local_14[0] + 0x28))(local_14);
    if (puVar2 == (undefined4 *)0x0) break;
  } while (puVar2[1] != 0xd);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)FUN_00402298(0x1c);
    if (puVar2 == (undefined4 *)0x0) {
      puVar2 = (undefined4 *)0x0;
    }
    else {
      puVar2 = FUN_0041b59c(puVar2,iVar1);
    }
  }
  FUN_0041a8a4(param_1,puVar2[3],0,DAT_004e17f4);
  FUN_0041a594(local_14,2);
  return;
}



/* @0041a9c0 file=? name=FUN_0041a9c0 */

void __cdecl FUN_0041a9c0(int param_1)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00417ab4(param_1 + 0x14);
  (**(code **)(*piVar1 + 0x10))(piVar1,param_1);
  return;
}



/* @0041a9e0 file=? name=FUN_0041a9e0 */

void __cdecl FUN_0041a9e0(int param_1)

{
  char *pcVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  int *piVar5;
  char *pcVar6;
  
  iVar4 = FUN_00417ab4(param_1 + 0x14);
  piVar5 = *(int **)(DAT_004efc94 + 0x28);
  if ((piVar5 != (int *)0x0) &&
     (piVar5 = (int *)(**(code **)(*piVar5 + 0x14))(piVar5,*(undefined4 *)(iVar4 + 4)),
     piVar5 != (int *)0x0)) {
    pcVar1 = *(char **)(*piVar5 + 0xc);
    iVar4 = *(int *)(*(int *)(param_1 + 0x10) + 4);
    if (*(int *)piVar5[1] < iVar4) {
      pcVar6 = (char *)0x0;
    }
    else {
      pcVar6 = *(char **)(((int *)piVar5[1])[1] + -0x10 + iVar4 * 0x14);
    }
    FUN_004dbb24(&DAT_00524e20,pcVar6,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s_message_for_class_004e3068,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,pcVar1,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
  uVar2 = *(uint *)(iVar4 + 4);
  uVar3 = *(uint *)(*(int *)(param_1 + 0x10) + 4);
  FUN_004dbb24(&DAT_00524e20,s_Message_004e307c,(char *)0x0);
  piVar5 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar5,s_for_object_of_classID_004e3085,(char *)0x0);
  piVar5 = FUN_004db78c(piVar5,uVar2);
  FUN_004d9c38(piVar5);
  return;
}



/* @0041aac8 file=? name=FUN_0041aac8 */

void __cdecl FUN_0041aac8(undefined4 *param_1)

{
  if (param_1 != (undefined4 *)0x0) {
    (**(code **)*param_1)(param_1,3);
  }
  return;
}



/* @0041aae0 file=? name=FUN_0041aae0 */

undefined4 * __cdecl
FUN_0041aae0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            uint *param_5,undefined4 param_6)

{
  FUN_0041a750(param_1,param_5,param_6,10);
  *param_1 = &PTR_FUN_004e3240;
  param_1[5] = param_2;
  param_1[6] = param_3;
  param_1[7] = param_4;
  return param_1;
}



/* @0041ab1c file=? name=FUN_0041ab1c */

void __cdecl FUN_0041ab1c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3240;
    FUN_0041a7a4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041ab48 file=? name=FUN_0041ab48 */

void __cdecl FUN_0041ab48(undefined4 *param_1)

{
  int iVar1;
  
  iVar1 = param_1[7];
  if (iVar1 == 0) {
    (**(code **)(**(int **)(DAT_004efc94 + 0x20) + 0x18))
              (*(int **)(DAT_004efc94 + 0x20),param_1[4],param_1[6],param_1[5]);
  }
  else if (iVar1 == 1) {
    FUN_0041d7b0(*(int **)(DAT_004efc94 + 0x20),param_1[4],param_1[6]);
  }
  else if (iVar1 == 2) {
    (**(code **)(**(int **)(DAT_004efc94 + 0x20) + 0x1c))
              (*(int **)(DAT_004efc94 + 0x20),param_1[4],param_1[6]);
  }
  if (param_1 != (undefined4 *)0x0) {
    (**(code **)*param_1)(param_1,3);
  }
  return;
}



/* @0041abc4 file=? name=FUN_0041abc4 */

undefined4 * __cdecl FUN_0041abc4(undefined4 *param_1,undefined4 param_2)

{
  FUN_004178cc(param_1,param_2);
  *param_1 = &PTR_FUN_004e3234;
  FUN_0041b6d3(param_1 + 4,param_1);
  FUN_0041b6d3(param_1 + 8,param_1);
  param_1[3] = 0xffffffff;
  param_1[0xc] = 0;
  return param_1;
}



/* @0041ac0c file=? name=FUN_0041ac0c */

undefined4 * __cdecl FUN_0041ac0c(undefined4 *param_1)

{
  FUN_004178cc(param_1,0xb);
  *param_1 = &PTR_FUN_004e3234;
  FUN_0041b6d3(param_1 + 4,param_1);
  FUN_0041b6d3(param_1 + 8,param_1);
  param_1[3] = 0xffffffff;
  param_1[0xc] = 0;
  return param_1;
}



/* @0041ac50 file=? name=FUN_0041ac50 */

void __cdecl FUN_0041ac50(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3234;
    FUN_0041b6f2(param_1 + 8,2);
    FUN_0041b6f2(param_1 + 4,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041ac98 file=? name=FUN_0041ac98 */

void __cdecl FUN_0041ac98(int param_1)

{
  int extraout_EAX;
  
  FUN_004de998((int *)0x0,0x34,param_1,0x211,FUN_0041ac0c);
  *(int *)(extraout_EAX + 0xc) = param_1;
  return;
}



/* @0041acbc file=? name=FUN_0041acbc */

void __cdecl
FUN_0041acbc(int param_1,int param_2,undefined4 param_3,uint *param_4,undefined4 param_5)

{
  undefined4 *puVar1;
  
  puVar1 = FUN_00402f74(0x4e2fa4);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041a818(puVar1,param_3,param_4,param_5);
  }
  FUN_0041adec(param_1,param_2,(int)puVar1);
  return;
}



/* @0041ad08 file=? name=FUN_0041ad08 */

void __cdecl
FUN_0041ad08(int param_1,int param_2,undefined4 param_3,undefined4 param_4,uint *param_5,
            undefined4 param_6)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041aae0(puVar1,param_3,param_4,0,param_5,param_6);
  }
  FUN_0041adec(param_1,param_2,(int)puVar1);
  return;
}



/* @0041ad54 file=? name=FUN_0041ad54 */

void __cdecl
FUN_0041ad54(int param_1,int param_2,undefined4 param_3,uint *param_4,undefined4 param_5)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041aae0(puVar1,0,param_3,1,param_4,param_5);
  }
  FUN_0041adec(param_1,param_2,(int)puVar1);
  return;
}



/* @0041ada0 file=? name=FUN_0041ada0 */

void __cdecl
FUN_0041ada0(int param_1,int param_2,undefined4 param_3,uint *param_4,undefined4 param_5)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041aae0(puVar1,0,param_3,2,param_4,param_5);
  }
  FUN_0041adec(param_1,param_2,(int)puVar1);
  return;
}



/* @0041adec file=? name=FUN_0041adec */

void __cdecl FUN_0041adec(int param_1,int param_2,int param_3)

{
  int iVar1;
  int local_10 [3];
  
  if (*(int *)(param_3 + 0xc) == 0) {
    (**(code **)(*(int *)(param_1 + 0x10 + param_2 * 0x34) + 4))
              (param_2 * 0x34 + param_1 + 0x10,param_3);
  }
  else {
    FUN_0041b7ce(local_10,param_2 * 0x34 + param_1 + 0x20);
    (**(code **)(local_10[0] + 8))(local_10);
    iVar1 = (**(code **)(local_10[0] + 0x30))(local_10);
    if ((iVar1 == 0) || (*(int *)(iVar1 + 0xc) <= *(int *)(param_3 + 0xc))) {
      (**(code **)(*(int *)(param_1 + 0x20 + param_2 * 0x34) + 4))
                (param_2 * 0x34 + param_1 + 0x20,param_3);
    }
    else {
      do {
        (**(code **)(local_10[0] + 0x10))(local_10);
        iVar1 = (**(code **)(local_10[0] + 0x30))(local_10);
        if (iVar1 == 0) {
          (**(code **)(local_10[0] + 4))(local_10);
          break;
        }
      } while (*(int *)(param_3 + 0xc) < *(int *)(iVar1 + 0xc));
      if (iVar1 != 0) {
        (**(code **)(local_10[0] + 0xc))(local_10);
      }
      (**(code **)(local_10[0] + 0x4c))(local_10,param_3);
    }
    FUN_0041b80c(local_10,2);
  }
  return;
}



/* @0041af10 file=? name=FUN_0041af10 */

int __cdecl FUN_0041af10(int param_1,int param_2)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  int local_1c [3];
  int local_10 [3];
  
  iVar3 = *(int *)(param_1 + 0xc);
  while( true ) {
    iVar3 = iVar3 + -1;
    if (iVar3 < param_2) {
      return 0;
    }
    FUN_0041b7ce(local_10,iVar3 * 0x34 + param_1 + 0x20);
    iVar1 = (**(code **)(local_10[0] + 0x30))(local_10);
    if ((iVar1 != 0) && (piVar2 = (int *)FUN_00414b60(), *(int *)(iVar1 + 0xc) <= *piVar2)) break;
    FUN_0041b7ce(local_1c,iVar3 * 0x34 + param_1 + 0x10);
    iVar1 = (**(code **)(local_1c[0] + 0x30))(local_1c);
    if (iVar1 != 0) {
      FUN_0041b80c(local_1c,2);
      FUN_0041b80c(local_10,2);
      return iVar1;
    }
    FUN_0041b80c(local_1c,2);
    FUN_0041b80c(local_10,2);
  }
  FUN_0041b80c(local_10,2);
  return iVar1;
}



/* @0041aff4 file=? name=FUN_0041aff4 */

undefined4 __cdecl FUN_0041aff4(int param_1,int param_2)

{
  undefined4 uVar1;
  int iVar2;
  int local_1c [3];
  int local_10 [3];
  
  iVar2 = param_2 * 0x34 + param_1;
  FUN_0041b7ce(local_10,iVar2 + 0x10);
  FUN_0041b7ce(local_1c,iVar2 + 0x20);
  iVar2 = (**(code **)(local_10[0] + 0x30))(local_10);
  if (iVar2 == 0) {
    iVar2 = (**(code **)(local_1c[0] + 0x30))(local_1c);
    if (iVar2 == 0) {
      uVar1 = 1;
      goto LAB_0041b057;
    }
  }
  uVar1 = 0;
LAB_0041b057:
  FUN_0041b80c(local_1c,2);
  FUN_0041b80c(local_10,2);
  return uVar1;
}



/* @0041b07c file=? name=FUN_0041b07c */

undefined4 __cdecl FUN_0041b07c(int param_1,int param_2)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_0041af10(param_1,param_2);
  if (piVar1 != (int *)0x0) {
    (**(code **)(*piVar1 + 0xc))(piVar1);
    return 1;
  }
  return 0;
}



/* @0041b0a8 file=? name=FUN_0041b0a8 */

void __cdecl FUN_0041b0a8(int param_1,int param_2)

{
  int iVar1;
  
  do {
    iVar1 = FUN_0041b07c(param_1,param_2);
  } while (iVar1 != 0);
  return;
}



/* @0041b0c8 file=? name=FUN_0041b0c8 */

void __cdecl FUN_0041b0c8(int param_1,int param_2)

{
  undefined4 *puVar1;
  int local_1c [3];
  int local_10 [3];
  
  if (param_2 < 0) {
    param_2 = *(int *)(param_1 + 0xc) + -1;
  }
  for (; -1 < param_2; param_2 = param_2 + -1) {
    FUN_0041b7ce(local_10,param_2 * 0x34 + param_1 + 0x20);
    while (puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10),
          puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_0041b7ce(local_1c,param_2 * 0x34 + param_1 + 0x10);
    while (puVar1 = (undefined4 *)(**(code **)(local_1c[0] + 0x28))(local_1c),
          puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_0041b80c(local_1c,2);
    FUN_0041b80c(local_10,2);
  }
  return;
}



/* @0041b190 file=? name=FUN_0041b190 */

void __cdecl FUN_0041b190(int param_1,int param_2,int param_3)

{
  undefined4 *puVar1;
  int local_1c [3];
  int local_10 [3];
  
  if (param_3 < 0) {
    param_3 = *(int *)(param_1 + 0xc) + -1;
  }
  for (; -1 < param_3; param_3 = param_3 + -1) {
    FUN_0041b7ce(local_10,param_3 * 0x34 + param_1 + 0x10);
    while (puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10),
          puVar1 != (undefined4 *)0x0) {
      if (((param_2 == 0) || (param_2 == *(int *)(puVar1[4] + 4))) && (puVar1 != (undefined4 *)0x0))
      {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_0041b7ce(local_1c,param_3 * 0x34 + param_1 + 0x20);
    while (puVar1 = (undefined4 *)(**(code **)(local_1c[0] + 0x28))(local_1c),
          puVar1 != (undefined4 *)0x0) {
      if (((param_2 == 0) || (param_2 == *(int *)(puVar1[4] + 4))) && (puVar1 != (undefined4 *)0x0))
      {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_0041b80c(local_1c,2);
    FUN_0041b80c(local_10,2);
  }
  return;
}



/* @0041b27c file=? name=FUN_0041b27c */

void __cdecl FUN_0041b27c(int param_1)

{
  uint uVar1;
  int *piVar2;
  uint uVar3;
  int local_28 [3];
  int local_1c [3];
  uint local_10;
  uint local_c;
  uint local_8;
  
  local_8 = 0;
  uVar1 = *(uint *)(param_1 + 0xc);
  while (uVar1 = uVar1 - 1, -1 < (int)uVar1) {
    FUN_004dbb24(&DAT_00524e20,s_EventQueue_priority_004e309d,(char *)0x0);
    piVar2 = FUN_004db78c(&DAT_00524e20,uVar1);
    FUN_004dbb24(piVar2,s__________________________________004e30b2,(char *)0x0);
    FUN_0041b7ce(local_1c,uVar1 * 0x34 + param_1 + 0x10);
    uVar3 = 0;
    while (piVar2 = (int *)(**(code **)(local_1c[0] + 0x28))(local_1c), piVar2 != (int *)0x0) {
      uVar3 = uVar3 + 1;
      (**(code **)(*piVar2 + 0x10))(piVar2);
    }
    local_c = uVar1;
    piVar2 = FUN_004db880(&DAT_00524e20,uVar3);
    FUN_004dbb24(piVar2,s_priority_004e30f3,(char *)0x0);
    piVar2 = FUN_004db78c(piVar2,local_c);
    FUN_004dbb24(piVar2,s_events_004e30fe,(char *)0x0);
    uVar3 = 0;
    FUN_0041b7ce(local_28,uVar1 * 0x34 + param_1 + 0x20);
    while (piVar2 = (int *)(**(code **)(local_28[0] + 0x28))(local_28), piVar2 != (int *)0x0) {
      uVar3 = uVar3 + 1;
      (**(code **)(*piVar2 + 0x10))(piVar2);
    }
    local_10 = uVar1;
    piVar2 = FUN_004db880(&DAT_00524e20,uVar3);
    FUN_004dbb24(piVar2,s_priority_004e3108,(char *)0x0);
    piVar2 = FUN_004db78c(piVar2,local_10);
    FUN_004dbb24(piVar2,s_timed_events_004e3113,(char *)0x0);
    local_8 = uVar3 + local_8;
    FUN_0041b80c(local_28,2);
    FUN_0041b80c(local_1c,2);
  }
  piVar2 = FUN_004db78c(&DAT_00524e20,local_8);
  FUN_004dbb24(piVar2,s_total_events_in_queues_004e3123,(char *)0x0);
  return;
}



/* @0041b424 file=? name=FUN_0041b424 */

undefined4 * __cdecl FUN_0041b424(undefined4 *param_1)

{
  FUN_0041abc4(param_1,0xc);
  *param_1 = &PTR_FUN_004e3228;
  return param_1;
}



/* @0041b444 file=? name=FUN_0041b444 */

void __cdecl FUN_0041b444(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3228;
    FUN_0041ac50(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b470 file=? name=FUN_0041b470 */

void __cdecl FUN_0041b470(int param_1)

{
  int extraout_EAX;
  
  FUN_004de998((int *)0x0,0x34,param_1,0x211,FUN_0041b424);
  *(int *)(extraout_EAX + 0xc) = param_1;
  return;
}



/* @0041b494 file=? name=FUN_0041b494 */

void __cdecl FUN_0041b494(int param_1,int param_2,int param_3)

{
  int *piVar1;
  int iVar2;
  int local_20 [3];
  int local_14 [3];
  int local_8;
  
  local_8 = *(int *)(param_1 + 0xc);
  while (local_8 = local_8 + -1, -1 < local_8) {
    FUN_0041b7ce(local_14,local_8 * 0x34 + param_1 + 0x10);
    while (piVar1 = (int *)(**(code **)(local_14[0] + 0x28))(local_14), piVar1 != (int *)0x0) {
      iVar2 = FUN_00417ab4((int)(piVar1 + 5));
      if ((param_2 == iVar2) && ((param_3 == 0 || (param_3 == *(int *)(piVar1[4] + 4))))) {
        (**(code **)(*piVar1 + 0xc))(piVar1);
      }
    }
    FUN_0041b7ce(local_20,local_8 * 0x34 + param_1 + 0x20);
    while (piVar1 = (int *)(**(code **)(local_20[0] + 0x28))(local_20), piVar1 != (int *)0x0) {
      iVar2 = FUN_00417ab4((int)(piVar1 + 5));
      if ((param_2 == iVar2) && ((param_3 == 0 || (param_3 == *(int *)(piVar1[4] + 4))))) {
        (**(code **)(*piVar1 + 0xc))(piVar1);
      }
    }
    FUN_0041b80c(local_20,2);
    FUN_0041b80c(local_14,2);
  }
  return;
}



/* @0041b59c file=? name=FUN_0041b59c */

undefined4 * __cdecl FUN_0041b59c(undefined4 *param_1,undefined4 param_2)

{
  undefined4 *puVar1;
  
  FUN_004178cc(param_1,0xd);
  *param_1 = &PTR_FUN_004e321c;
  FUN_0041b688(param_1 + 4,param_1);
  puVar1 = (undefined4 *)FUN_00402298(0x34);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041b424(puVar1);
  }
  param_1[3] = puVar1;
  (**(code **)(param_1[4] + 4))(param_1 + 4,param_2);
  return param_1;
}



/* @0041b5f8 file=? name=FUN_0041b5f8 */

void __cdecl FUN_0041b5f8(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e321c;
    puVar1 = (undefined4 *)param_1[3];
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
    FUN_0041b6a7(param_1 + 4,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b644 file=? name=FUN_0041b644 */

void __cdecl FUN_0041b644(undefined4 *param_1)

{
  if (param_1 != (undefined4 *)0x0) {
    (**(code **)*param_1)(param_1,3);
  }
  return;
}



/* @0041b688 file=? name=FUN_0041b688 */

undefined4 * __cdecl FUN_0041b688(undefined4 *param_1,undefined4 param_2)

{
  FUN_004179d4(param_1,param_2);
  *param_1 = &PTR_FUN_004e3214;
  return param_1;
}



/* @0041b6a7 file=? name=FUN_0041b6a7 */

void __cdecl FUN_0041b6a7(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3214;
    FUN_004179f8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b6d3 file=? name=FUN_0041b6d3 */

undefined4 * __cdecl FUN_0041b6d3(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417be0(param_1,param_2);
  *param_1 = &PTR_FUN_004e320c;
  return param_1;
}



/* @0041b6f2 file=? name=FUN_0041b6f2 */

void __cdecl FUN_0041b6f2(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e320c;
    FUN_00417c0c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b71e file=? name=FUN_0041b71e */

undefined4 * __cdecl FUN_0041b71e(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e31c4;
  return param_1;
}



/* @0041b741 file=? name=FUN_0041b741 */

undefined4 * __cdecl FUN_0041b741(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415f30(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e31c4;
  return param_1;
}



/* @0041b764 file=? name=FUN_0041b764 */

undefined4 * __cdecl FUN_0041b764(undefined4 *param_1,int param_2)

{
  FUN_00415f60(param_1,param_2);
  *param_1 = &PTR_FUN_004e31c4;
  return param_1;
}



/* @0041b783 file=? name=FUN_0041b783 */

void __cdecl FUN_0041b783(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e31c4;
    FUN_00415f90(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b7af file=? name=FUN_0041b7af */

undefined4 * __cdecl FUN_0041b7af(undefined4 *param_1,int param_2)

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_004e3174;
  return param_1;
}



/* @0041b7ce file=? name=FUN_0041b7ce */

undefined4 * __cdecl FUN_0041b7ce(undefined4 *param_1,int param_2)

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_004e3174;
  return param_1;
}



/* @0041b7ed file=? name=FUN_0041b7ed */

undefined4 * __cdecl FUN_0041b7ed(undefined4 *param_1,int param_2)

{
  FUN_00417d28(param_1,param_2);
  *param_1 = &PTR_FUN_004e3174;
  return param_1;
}



/* @0041b80c file=? name=FUN_0041b80c */

void __cdecl FUN_0041b80c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3174;
    FUN_00417d54(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b838 file=? name=FUN_0041b838 */

undefined4 * __cdecl FUN_0041b838(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_004178cc(param_1,param_2);
  *param_1 = &PTR_FUN_004e3320;
  param_1[3] = param_3;
  *param_1 = &PTR_FUN_004e3308;
  return param_1;
}



/* @0041b868 file=? name=FUN_0041b868 */

undefined4 * __cdecl FUN_0041b868(undefined4 *param_1,int *param_2,undefined4 param_3)

{
  FUN_004178ec(param_1,param_2);
  *param_1 = &PTR_FUN_004e3320;
  param_1[3] = param_3;
  *param_1 = &PTR_FUN_004e3308;
  return param_1;
}



/* @0041b898 file=? name=FUN_0041b898 */

void __cdecl FUN_0041b898(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3308;
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b8c4 file=munga/cmpnnt.cpp name=FUN_0041b8c4 */

void FUN_0041b8c4(void)

{
  FUN_0040385c(s_Component__Execute___Should_neve_004e32be,s_d__tesla_bt_munga_CMPNNT_CPP_004e32eb,
               0x4e);
  return;
}



/* @0041b8e0 file=? name=FUN_0041b8e0 */

void __cdecl FUN_0041b8e0(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4e327c);
  return;
}



/* @0041b956 file=? name=FUN_0041b956 */

void __cdecl FUN_0041b956(int param_1,int param_2)

{
  FUN_00419bbc(param_1,param_2);
  return;
}



/* @0041b96b file=? name=FUN_0041b96b */

void __cdecl FUN_0041b96b(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041b994 file=? name=FUN_0041b994 */

undefined4 * __cdecl FUN_0041b994(undefined4 *param_1)

{
  FUN_004178cc(param_1,2);
  *param_1 = &PTR_FUN_004e3440;
  FUN_0041c42c(param_1 + 6,0);
  FUN_0041c42c(param_1 + 0xb,0);
  FUN_0041c42c(param_1 + 0x10,0);
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  return param_1;
}



/* @0041b9ec file=? name=FUN_0041b9ec */

undefined4 * __cdecl FUN_0041b9ec(undefined4 *param_1,undefined4 param_2)

{
  FUN_004178cc(param_1,2);
  *param_1 = &PTR_FUN_004e3440;
  FUN_0041c42c(param_1 + 6,0);
  FUN_0041c42c(param_1 + 0xb,0);
  FUN_0041c42c(param_1 + 0x10,0);
  param_1[3] = param_2;
  param_1[4] = param_2;
  param_1[5] = param_2;
  return param_1;
}



/* @0041ba44 file=? name=FUN_0041ba44 */

undefined4 * __cdecl FUN_0041ba44(undefined4 *param_1,int param_2)

{
  FUN_004178cc(param_1,2);
  *param_1 = &PTR_FUN_004e3440;
  FUN_0041c42c(param_1 + 6,0);
  FUN_0041c42c(param_1 + 0xb,0);
  FUN_0041c42c(param_1 + 0x10,0);
  param_1[3] = *(undefined4 *)(param_2 + 0xc);
  param_1[4] = *(undefined4 *)(param_2 + 0x10);
  param_1[5] = *(undefined4 *)(param_2 + 0x14);
  return param_1;
}



/* @0041baa4 file=? name=FUN_0041baa4 */

void __cdecl FUN_0041baa4(int *param_1,byte param_2)

{
  void *this;
  void *this_00;
  int local_40 [5];
  int local_2c [5];
  int local_18 [5];
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3440;
    FUN_0041c477(local_18,(int)(param_1 + 6));
    FUN_00417858(local_18,local_18,1);
    FUN_0041c4d4(local_18,2);
    FUN_0041c477(local_2c,(int)(param_1 + 0xb));
    FUN_00417858(this,local_2c,1);
    FUN_0041c4d4(local_2c,2);
    FUN_0041c477(local_40,(int)(param_1 + 0x10));
    FUN_00417858(this_00,local_40,1);
    FUN_0041c4d4(local_40,2);
    FUN_0041c44b(param_1 + 0x10,2);
    FUN_0041c44b(param_1 + 0xb,2);
    FUN_0041c44b(param_1 + 6,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041bb88 file=? name=FUN_0041bb88 */

void __cdecl FUN_0041bb88(int param_1,int param_2)

{
  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);
  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_2 + 0x14);
  return;
}



/* @0041bba8 file=? name=FUN_0041bba8 */

undefined4 __cdecl FUN_0041bba8(int param_1,int param_2)

{
  undefined4 uVar1;
  
  if (((*(int *)(param_1 + 0xc) == *(int *)(param_2 + 0xc)) &&
      (*(int *)(param_1 + 0x10) == *(int *)(param_2 + 0x10))) &&
     (*(int *)(param_1 + 0x14) == *(int *)(param_2 + 0x14))) {
    uVar1 = 1;
  }
  else {
    uVar1 = 0;
  }
  return uVar1;
}



/* @0041bbd8 file=? name=FUN_0041bbd8 */

void __cdecl FUN_0041bbd8(int param_1,int param_2)

{
  int *piVar1;
  int local_40 [5];
  int local_2c [5];
  int local_18 [5];
  
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_1 + 0x14);
  if (param_2 != *(int *)(param_1 + 0x14)) {
    *(int *)(param_1 + 0x14) = param_2;
    FUN_0041c496(local_18,param_1 + 0x18);
    while( true ) {
      piVar1 = (int *)(**(code **)(local_18[0] + 0x28))(local_18);
      if (piVar1 == (int *)0x0) break;
      (**(code **)(*piVar1 + 0x14))(piVar1);
    }
    FUN_0041c4d4(local_18,2);
    FUN_0041c496(local_2c,param_1 + 0x2c);
    while( true ) {
      piVar1 = (int *)(**(code **)(local_2c[0] + 0x28))(local_2c);
      if (piVar1 == (int *)0x0) break;
      (**(code **)(*piVar1 + 0x14))(piVar1);
    }
    FUN_0041c4d4(local_2c,2);
    FUN_0041c496(local_40,param_1 + 0x40);
    while( true ) {
      piVar1 = (int *)(**(code **)(local_40[0] + 0x28))(local_40);
      if (piVar1 == (int *)0x0) break;
      (**(code **)(*piVar1 + 0x14))(piVar1);
    }
    FUN_0041c4d4(local_40,2);
  }
  return;
}



/* @0041bca8 file=? name=FUN_0041bca8 */

int * __cdecl FUN_0041bca8(int *param_1,int param_2)

{
  uint uVar1;
  int *piVar2;
  
  uVar1 = *(uint *)(param_2 + 0xc);
  FUN_004dbb24(param_1,&DAT_004e33a0,(char *)0x0);
  piVar2 = FUN_004db880(param_1,uVar1);
  FUN_004dbb24(piVar2,&DAT_004e33a2,(char *)0x0);
  piVar2 = FUN_004db880(param_1,*(uint *)(param_2 + 0x10));
  FUN_004dbb24(piVar2,&DAT_004e33a4,(char *)0x0);
  piVar2 = FUN_004db880(param_1,*(uint *)(param_2 + 0x14));
  FUN_004dbb24(piVar2,&DAT_004e33a6,(char *)0x0);
  return param_1;
}



/* @0041bd28 file=? name=FUN_0041bd28 */

undefined4 FUN_0041bd28(void)

{
  return 1;
}



/* @0041bd34 file=? name=FUN_0041bd34 */

void __cdecl FUN_0041bd34(int param_1,int param_2)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00414b60();
  *(undefined4 *)(param_1 + 0x14) = *puVar1;
  FUN_0041bbd8(param_1 + 0x2c,*(int *)(param_2 + 0xc));
  return;
}



/* @0041bd60 file=? name=FUN_0041bd60 */

void __cdecl FUN_0041bd60(int param_1,undefined4 *param_2,undefined2 param_3)

{
  param_2[2] = *(undefined4 *)(param_1 + 0x10);
  param_2[3] = *(undefined4 *)(param_1 + 0x40);
  *param_2 = 0x10;
  *(undefined2 *)((int)param_2 + 6) = param_3;
  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_1 + 0x10);
  return;
}



/* @0041bd98 file=? name=FUN_0041bd98 */

void __cdecl FUN_0041bd98(int *param_1,int *param_2)

{
  ushort uVar1;
  undefined4 *puVar2;
  uint uVar3;
  int iVar4;
  
  iVar4 = 0;
  uVar1 = *(ushort *)(param_1 + 6);
  *(undefined2 *)(param_1 + 6) = 0;
  for (uVar3 = (uint)uVar1; uVar3 != 0; uVar3 = (int)uVar3 >> 1) {
    if ((uVar3 & 1) != 0) {
      puVar2 = (undefined4 *)(**(code **)*param_2)(param_2);
      (**(code **)(*param_1 + 0x1c))(param_1,puVar2,iVar4);
      (**(code **)(*param_2 + 0x14))(param_2,*puVar2);
    }
    iVar4 = iVar4 + 1;
  }
  return;
}



/* @0041bdf0 file=? name=FUN_0041bdf0 */

undefined4 * __cdecl FUN_0041bdf0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 *puVar1;
  
  FUN_004178cc(param_1,param_2);
  *param_1 = &PTR_FUN_004e3320;
  param_1[3] = param_3;
  *param_1 = &PTR_FUN_004e3420;
  FUN_0041b9ec(param_1 + 0xb,*(undefined4 *)(param_1[3] + 0xc));
  FUN_0041c42c(param_1 + 0x20,0);
  FUN_0041c42c(param_1 + 0x25,0);
  FUN_0041c42c(param_1 + 0x2a,0);
  FUN_0041c42c(param_1 + 0x2f,0);
  FUN_0041bbd8((int)(param_1 + 0xb),0);
  puVar1 = (undefined4 *)FUN_00414b60();
  param_1[4] = *puVar1;
  param_1[5] = param_1[4];
  param_1[7] = PTR_FUN_004e3374;
  param_1[8] = DAT_004e3378;
  param_1[9] = DAT_004e337c;
  *(undefined2 *)(param_1 + 6) = 0;
  param_1[10] = 0;
  return param_1;
}



/* @0041bec4 file=? name=FUN_0041bec4 */

void __cdecl FUN_0041bec4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3420;
    FUN_0041c44b(param_1 + 0x2f,2);
    FUN_0041c44b(param_1 + 0x2a,2);
    FUN_0041c44b(param_1 + 0x25,2);
    FUN_0041c44b(param_1 + 0x20,2);
    FUN_0041baa4(param_1 + 0xb,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041bf44 file=? name=FUN_0041bf44 */

int __cdecl FUN_0041bf44(int param_1,int param_2)

{
  int *piVar1;
  int iVar2;
  int local_14;
  int local_10;
  
  piVar1 = *(int **)(*(int *)(param_1 + 0xc) + 8);
  if (*piVar1 < param_2) {
    local_14 = DAT_004e3380;
    local_10 = DAT_004e3384;
  }
  else {
    iVar2 = piVar1[1];
    local_14 = *(int *)(iVar2 + -8 + param_2 * 0x10);
    local_10 = *(int *)(iVar2 + -4 + param_2 * 0x10);
  }
  if ((local_14 == DAT_004e3380) && (local_10 == DAT_004e3384)) {
    iVar2 = 0;
  }
  else {
    iVar2 = param_1 + local_14 + -1;
  }
  return iVar2;
}



/* @0041bfc0 file=? name=FUN_0041bfc0 */

int __cdecl FUN_0041bfc0(int param_1,char *param_2)

{
  int iVar1;
  int local_14;
  int local_10;
  
  FUN_0041c288(&local_14,*(int **)(*(int *)(param_1 + 0xc) + 8),param_2);
  if ((local_14 == DAT_004e3380) && (local_10 == DAT_004e3384)) {
    iVar1 = 0;
  }
  else {
    iVar1 = param_1 + local_14 + -1;
  }
  return iVar1;
}



/* @0041c018 file=? name=FUN_0041c018 */

void __cdecl FUN_0041c018(int *param_1,int *param_2,int *param_3)

{
  float fVar1;
  
  fVar1 = (float)(*param_2 - param_1[4]) / DAT_0052140c;
  param_1[4] = *param_2;
  (*(code *)param_1[7])(param_1,fVar1);
  if ((*(byte *)(param_1 + 10) & 1) == 0) {
    FUN_0041c08c((int)param_1);
  }
  FUN_0041bd98(param_1,param_3);
  return;
}



/* @0041c078 file=? name=FUN_0041c078 */

void __cdecl FUN_0041c078(int param_1)

{
  *(uint *)(param_1 + 0x28) = *(uint *)(param_1 + 0x28) | 2;
  return;
}



/* @0041c084 file=? name=FUN_0041c084 */

void FUN_0041c084(void)

{
  return;
}



/* @0041c08c file=? name=FUN_0041c08c */

void __cdecl FUN_0041c08c(int param_1)

{
  int *piVar1;
  int local_54 [5];
  int local_40 [5];
  int local_2c [5];
  int local_18 [5];
  
  FUN_0041c496(local_18,param_1 + 0x80);
  while( true ) {
    piVar1 = (int *)(**(code **)(local_18[0] + 0x28))(local_18);
    if (piVar1 == (int *)0x0) break;
    (**(code **)(*piVar1 + 0x14))(piVar1);
  }
  FUN_0041c4d4(local_18,2);
  FUN_0041c496(local_2c,param_1 + 0x94);
  while( true ) {
    piVar1 = (int *)(**(code **)(local_2c[0] + 0x28))(local_2c);
    if (piVar1 == (int *)0x0) break;
    (**(code **)(*piVar1 + 0x14))(piVar1);
  }
  FUN_0041c4d4(local_2c,2);
  FUN_0041c496(local_40,param_1 + 0xa8);
  while( true ) {
    piVar1 = (int *)(**(code **)(local_40[0] + 0x28))(local_40);
    if (piVar1 == (int *)0x0) break;
    (**(code **)(*piVar1 + 0x14))(piVar1);
  }
  FUN_0041c4d4(local_40,2);
  FUN_0041c496(local_54,param_1 + 0xbc);
  while( true ) {
    piVar1 = (int *)(**(code **)(local_54[0] + 0x28))(local_54);
    if (piVar1 == (int *)0x0) break;
    (**(code **)(*piVar1 + 0x14))(piVar1);
  }
  FUN_0041c4d4(local_54,2);
  return;
}



/* @0041c18c file=? name=FUN_0041c18c */

void __cdecl FUN_0041c18c(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4e3334);
  return;
}



/* @0041c1a8 file=? name=FUN_0041c1a8 */

void __cdecl FUN_0041c1a8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    if ((int *)param_1[1] != (int *)0x0) {
      FUN_004022e8((int *)param_1[1]);
    }
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041c1d4 file=? name=FUN_0041c1d4 */

void __cdecl FUN_0041c1d4(int *param_1,int param_2,int *param_3,int *param_4)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  undefined4 *puVar4;
  undefined4 *puVar5;
  int *piVar6;
  
  *param_1 = 0;
  iVar1 = 0;
  piVar3 = param_3;
  if (0 < param_2) {
    do {
      if (*param_1 < *piVar3) {
        *param_1 = *piVar3;
      }
      iVar1 = iVar1 + 1;
      piVar3 = piVar3 + 4;
    } while (iVar1 < param_2);
  }
  if ((param_4 != (int *)0x0) && (*param_1 < *param_4)) {
    *param_1 = *param_4;
  }
  iVar1 = FUN_004022b0(*param_1 << 4);
  param_1[1] = iVar1;
  iVar1 = 0;
  if (param_4 != (int *)0x0) {
    for (; iVar1 < *param_4; iVar1 = iVar1 + 1) {
      puVar4 = (undefined4 *)(param_4[1] + iVar1 * 0x10);
      puVar5 = (undefined4 *)(param_1[1] + iVar1 * 0x10);
      for (iVar2 = 4; iVar2 != 0; iVar2 = iVar2 + -1) {
        *puVar5 = *puVar4;
        puVar4 = puVar4 + 1;
        puVar5 = puVar5 + 1;
      }
    }
  }
  iVar1 = 0;
  if (0 < param_2) {
    do {
      piVar3 = param_3;
      piVar6 = (int *)(param_1[1] + -0x10 + *param_3 * 0x10);
      for (iVar2 = 4; iVar2 != 0; iVar2 = iVar2 + -1) {
        *piVar6 = *piVar3;
        piVar3 = piVar3 + 1;
        piVar6 = piVar6 + 1;
      }
      iVar1 = iVar1 + 1;
      param_3 = param_3 + 4;
    } while (iVar1 < param_2);
  }
  return;
}



/* @0041c288 file=? name=FUN_0041c288 */

undefined4 * __cdecl FUN_0041c288(undefined4 *param_1,int *param_2,char *param_3)

{
  char *pcVar1;
  int iVar2;
  char *pcVar3;
  char *pcVar4;
  int iVar5;
  bool bVar6;
  
  iVar5 = 0;
  do {
    if (*param_2 <= iVar5) {
      *param_1 = DAT_004e3380;
      param_1[1] = DAT_004e3384;
      return param_1;
    }
    pcVar4 = *(char **)(param_2[1] + 4 + iVar5 * 0x10);
    pcVar3 = param_3;
    do {
      if (*pcVar3 != *pcVar4) goto LAB_0041c2dc;
      bVar6 = true;
      if (*pcVar3 == '\0') break;
      pcVar1 = pcVar3 + 1;
      if (*pcVar1 != pcVar4[1]) goto LAB_0041c2dc;
      pcVar3 = pcVar3 + 2;
      pcVar4 = pcVar4 + 2;
      bVar6 = *pcVar1 == '\0';
    } while (!bVar6);
    if (bVar6) {
      iVar2 = param_2[1];
      *param_1 = *(undefined4 *)(iVar2 + 8 + iVar5 * 0x10);
      param_1[1] = *(undefined4 *)(iVar2 + 0xc + iVar5 * 0x10);
      return param_1;
    }
LAB_0041c2dc:
    iVar5 = iVar5 + 1;
  } while( true );
}



/* @0041c2fc file=? name=FUN_0041c2fc */

int __cdecl FUN_0041c2fc(int *param_1,char *param_2)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  int iVar4;
  bool bVar5;
  
  iVar4 = 0;
  do {
    if (*param_1 <= iVar4) {
      return 0;
    }
    pcVar3 = *(char **)(param_1[1] + 4 + iVar4 * 0x10);
    pcVar2 = param_2;
    do {
      if (*pcVar2 != *pcVar3) goto LAB_0041c33f;
      bVar5 = true;
      if (*pcVar2 == '\0') break;
      pcVar1 = pcVar2 + 1;
      if (*pcVar1 != pcVar3[1]) goto LAB_0041c33f;
      pcVar2 = pcVar2 + 2;
      pcVar3 = pcVar3 + 2;
      bVar5 = *pcVar1 == '\0';
    } while (!bVar5);
    if (bVar5) {
      return iVar4 * 0x10 + param_1[1];
    }
LAB_0041c33f:
    iVar4 = iVar4 + 1;
  } while( true );
}



/* @0041c350 file=? name=FUN_0041c350 */

void __cdecl FUN_0041c350(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  *(uint *)(param_1 + 0x28) = *(uint *)(param_1 + 0x28) | 1;
  FUN_004358e8(*(int *)(DAT_004efc94 + 0x34),param_1,param_2,param_3,param_4);
  return;
}



/* @0041c42c file=? name=FUN_0041c42c */

undefined4 * __cdecl FUN_0041c42c(undefined4 *param_1,undefined4 param_2)

{
  FUN_0041827c(param_1,param_2);
  *param_1 = &PTR_FUN_004e3418;
  return param_1;
}



/* @0041c44b file=? name=FUN_0041c44b */

void __cdecl FUN_0041c44b(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3418;
    FUN_004182a8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041c477 file=? name=FUN_0041c477 */

undefined4 * __cdecl FUN_0041c477(undefined4 *param_1,int param_2)

{
  FUN_00418398(param_1,param_2);
  *param_1 = &PTR_FUN_004e33c4;
  return param_1;
}



/* @0041c496 file=? name=FUN_0041c496 */

undefined4 * __cdecl FUN_0041c496(undefined4 *param_1,int param_2)

{
  FUN_00418398(param_1,param_2);
  *param_1 = &PTR_FUN_004e33c4;
  return param_1;
}



/* @0041c4b5 file=? name=FUN_0041c4b5 */

undefined4 * __cdecl FUN_0041c4b5(undefined4 *param_1,int param_2)

{
  FUN_004183c0(param_1,param_2);
  *param_1 = &PTR_FUN_004e33c4;
  return param_1;
}



/* @0041c4d4 file=? name=FUN_0041c4d4 */

void __cdecl FUN_0041c4d4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e33c4;
    FUN_004183ec(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041c500 file=? name=FUN_0041c500 */

void __cdecl FUN_0041c500(int param_1,undefined4 *param_2,undefined2 param_3)

{
  FUN_0041bd60(param_1,param_2,param_3);
  *(short *)(param_2 + 1) = *(short *)(param_1 + 0xd8) + 1;
  return;
}



/* @0041c52c file=? name=FUN_0041c52c */

undefined4 * __cdecl
FUN_0041c52c(undefined4 *param_1,undefined4 param_2,undefined4 param_3,char *param_4,
            undefined4 param_5)

{
  char cVar1;
  int iVar2;
  undefined4 uVar3;
  uint uVar4;
  uint uVar5;
  char *pcVar6;
  char *pcVar7;
  
  FUN_0041bdf0(param_1,*(undefined4 *)(param_4 + 0x20),param_5);
  *param_1 = &PTR_FUN_004e3598;
  param_1[0x34] = param_2;
  param_1[0x36] = param_3;
  iVar2 = FUN_004d4a78(param_4);
  uVar3 = FUN_004022b0(iVar2 + 1);
  param_1[0x35] = uVar3;
  uVar4 = 0xffffffff;
  pcVar6 = param_4;
  do {
    pcVar7 = pcVar6;
    if (uVar4 == 0) break;
    uVar4 = uVar4 - 1;
    pcVar7 = pcVar6 + 1;
    cVar1 = *pcVar6;
    pcVar6 = pcVar7;
  } while (cVar1 != '\0');
  uVar4 = ~uVar4;
  pcVar6 = pcVar7 + -uVar4;
  pcVar7 = (char *)param_1[0x35];
  for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {
    *(undefined4 *)pcVar7 = *(undefined4 *)pcVar6;
    pcVar6 = pcVar6 + 4;
    pcVar7 = pcVar7 + 4;
  }
  for (uVar4 = uVar4 & 3; uVar4 != 0; uVar4 = uVar4 - 1) {
    *pcVar7 = *pcVar6;
    pcVar6 = pcVar6 + 1;
    pcVar7 = pcVar7 + 1;
  }
  param_1[0x37] = *(undefined4 *)(param_4 + 0x28);
  param_1[10] = *(undefined4 *)(param_4 + 0x2c);
  param_1[0x38] = 0;
  return param_1;
}



/* @0041c5c0 file=? name=FUN_0041c5c0 */

undefined4 * __cdecl
FUN_0041c5c0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,char *param_4,
            undefined4 param_5,undefined4 param_6)

{
  char cVar1;
  int iVar2;
  undefined4 uVar3;
  uint uVar4;
  uint uVar5;
  char *pcVar6;
  char *pcVar7;
  
  FUN_0041bdf0(param_1,param_5,param_6);
  *param_1 = &PTR_FUN_004e3598;
  param_1[0x34] = param_2;
  param_1[0x36] = param_3;
  iVar2 = FUN_004d4a78(param_4);
  uVar3 = FUN_004022b0(iVar2 + 1);
  param_1[0x35] = uVar3;
  uVar4 = 0xffffffff;
  do {
    pcVar6 = param_4;
    if (uVar4 == 0) break;
    uVar4 = uVar4 - 1;
    pcVar6 = param_4 + 1;
    cVar1 = *param_4;
    param_4 = pcVar6;
  } while (cVar1 != '\0');
  uVar4 = ~uVar4;
  pcVar6 = pcVar6 + -uVar4;
  pcVar7 = (char *)param_1[0x35];
  for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {
    *(undefined4 *)pcVar7 = *(undefined4 *)pcVar6;
    pcVar6 = pcVar6 + 4;
    pcVar7 = pcVar7 + 4;
  }
  for (uVar4 = uVar4 & 3; uVar4 != 0; uVar4 = uVar4 - 1) {
    *pcVar7 = *pcVar6;
    pcVar6 = pcVar6 + 1;
    pcVar7 = pcVar7 + 1;
  }
  param_1[0x37] = 0xffffffff;
  return param_1;
}



/* @0041c648 file=? name=FUN_0041c648 */

void __cdecl FUN_0041c648(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3598;
    FUN_004022e8((int *)param_1[0x35]);
    FUN_0041bec4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041c684 file=? name=FUN_0041c684 */

undefined4 __cdecl
FUN_0041c684(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6)

{
  char cVar1;
  char *pcVar2;
  uint uVar3;
  int *piVar4;
  undefined4 uVar5;
  uint uVar6;
  int iVar7;
  char *pcVar8;
  bool bVar9;
  char *local_c;
  char *local_8;
  
  iVar7 = 0;
  pcVar2 = param_4;
  do {
    *pcVar2 = '\0';
    iVar7 = iVar7 + 1;
    pcVar2 = pcVar2 + 1;
  } while (iVar7 < 0x20);
  param_4[0x24] = '0';
  param_4[0x25] = '\0';
  param_4[0x26] = '\0';
  param_4[0x27] = '\0';
  uVar3 = FUN_004d4a78(param_3);
  if (uVar3 < 0x20) {
    uVar3 = 0xffffffff;
    pcVar2 = param_3;
    do {
      pcVar8 = pcVar2;
      if (uVar3 == 0) break;
      uVar3 = uVar3 - 1;
      pcVar8 = pcVar2 + 1;
      cVar1 = *pcVar2;
      pcVar2 = pcVar8;
    } while (cVar1 != '\0');
    uVar3 = ~uVar3;
    pcVar2 = pcVar8 + -uVar3;
    pcVar8 = param_4;
    for (uVar6 = uVar3 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {
      *(undefined4 *)pcVar8 = *(undefined4 *)pcVar2;
      pcVar2 = pcVar2 + 4;
      pcVar8 = pcVar8 + 4;
    }
    for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
      *pcVar8 = *pcVar2;
      pcVar2 = pcVar2 + 1;
      pcVar8 = pcVar8 + 1;
    }
    param_4[0x2c] = '\0';
    param_4[0x2d] = '\0';
    param_4[0x2e] = '\0';
    param_4[0x2f] = '\0';
    iVar7 = FUN_00404088(param_5,param_3,s_SubsystemFlags_004e34c8,&local_8);
    if (iVar7 != 0) {
      pcVar2 = s_DontReplicateFlag_004e34d7;
      do {
        if (*local_8 != *pcVar2) goto LAB_0041c772;
        bVar9 = true;
        if (*local_8 == '\0') break;
        pcVar8 = local_8 + 1;
        if (*pcVar8 != pcVar2[1]) goto LAB_0041c772;
        local_8 = local_8 + 2;
        pcVar2 = pcVar2 + 2;
        bVar9 = *pcVar8 == '\0';
      } while (!bVar9);
      if (!bVar9) {
LAB_0041c772:
        FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
        FUN_004dbb24(&DAT_00524e20,s_has_an_unknown_subsystem_flag__004e34e9,(char *)0x0);
        return 0;
      }
      *(uint *)(param_4 + 0x2c) = *(uint *)(param_4 + 0x2c) | 4;
    }
    param_4[0x28] = -1;
    param_4[0x29] = -1;
    param_4[0x2a] = -1;
    param_4[0x2b] = -1;
    iVar7 = FUN_00404088(param_5,param_3,s_SegmentPageName_004e350a,&local_c);
    if (iVar7 != 0) {
      iVar7 = FUN_0041c808(param_1,param_2,param_6,local_c);
      *(int *)(param_4 + 0x28) = iVar7;
    }
    uVar5 = 1;
  }
  else {
    FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s_is_too_long__Maximum_name_size_i_004e3496,(char *)0x0);
    piVar4 = FUN_004db880(&DAT_00524e20,0x1f);
    FUN_004dbb24(piVar4,s_character__004e34bb,(char *)0x0);
    uVar5 = 0;
  }
  return uVar5;
}



/* @0041c7e4 file=? name=FUN_0041c7e4 */

void __cdecl FUN_0041c7e4(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4e345c);
  return;
}



/* @0041c800 file=? name=FUN_0041c800 */

undefined4 FUN_0041c800(void)

{
  return 0;
}



/* @0041c808 file=? name=FUN_0041c808 */

int __cdecl FUN_0041c808(int param_1,char *param_2,int param_3,char *param_4)

{
  char cVar1;
  undefined4 *puVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  char *pcVar7;
  char *pcVar8;
  uint uVar9;
  uint uVar10;
  char *pcVar11;
  char *pcVar12;
  bool bVar13;
  char local_34 [32];
  int local_14;
  int *local_10;
  int *local_c;
  char *local_8;
  
  iVar5 = FUN_00404088(param_1,s_video_004e351a,s_skeleton_004e3520,&local_8);
  if (iVar5 == 0) {
    FUN_004dbb24((int *)&DAT_00524e68,param_2,(char *)0x0);
    FUN_004dbb24((int *)&DAT_00524e68,s_is_missing__skl_file_specificati_004e3529,(char *)0x0);
  }
  else {
    local_c = (int *)FUN_004064fc(*(char **)(param_3 + 0x10),local_8);
    piVar6 = (int *)FUN_00402298(0x20);
    if (piVar6 == (int *)0x0) {
      piVar6 = (int *)0x0;
    }
    else {
      piVar6 = FUN_00403e84(piVar6,(char *)local_c,1);
    }
    if ((*(byte *)(piVar6 + 7) & 2) == 0) {
      iVar5 = piVar6[3];
    }
    else {
      iVar5 = piVar6[4];
    }
    if (iVar5 != 0) {
      local_10 = FUN_0040485c((int)piVar6,(char *)0x0);
      iVar5 = 0;
      puVar2 = (undefined4 *)local_10[1];
      local_14 = -1;
joined_r0x0041c90c:
      do {
        iVar4 = local_14;
        if (puVar2 == (undefined4 *)0x0) {
LAB_0041c9c2:
          local_14 = iVar4;
          piVar3 = local_c;
          if (local_14 == -1) {
            FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
            FUN_004dbb24(&DAT_00524e20,s_SegmentPageName_Not_in_004e357b,(char *)0x0);
            FUN_004dbb24(&DAT_00524e20,(char *)piVar3,(char *)0x0);
            FUN_004d9c38(&DAT_00524e20);
            return 0;
          }
          FUN_004022e8(local_c);
          FUN_00403ecc(piVar6,3);
          if (local_10 == (int *)0x0) {
            return local_14;
          }
          (**(code **)*local_10)(local_10,3);
          return local_14;
        }
        uVar9 = 0xffffffff;
        pcVar8 = (char *)(puVar2 + 2);
        do {
          pcVar12 = pcVar8;
          if (uVar9 == 0) break;
          uVar9 = uVar9 - 1;
          pcVar12 = pcVar8 + 1;
          cVar1 = *pcVar8;
          pcVar8 = pcVar12;
        } while (cVar1 != '\0');
        uVar9 = ~uVar9;
        pcVar8 = pcVar12 + -uVar9;
        pcVar12 = local_34;
        for (uVar10 = uVar9 >> 2; uVar10 != 0; uVar10 = uVar10 - 1) {
          *(undefined4 *)pcVar12 = *(undefined4 *)pcVar8;
          pcVar8 = pcVar8 + 4;
          pcVar12 = pcVar12 + 4;
        }
        pcVar11 = s_LAB_ONLY_004e3566;
        pcVar7 = local_34;
        for (uVar9 = uVar9 & 3; uVar9 != 0; uVar9 = uVar9 - 1) {
          *pcVar12 = *pcVar8;
          pcVar8 = pcVar8 + 1;
          pcVar12 = pcVar12 + 1;
        }
        do {
          bVar13 = *pcVar7 == *pcVar11;
          if (!bVar13) break;
          if (*pcVar7 == '\0') goto LAB_0041c987;
          pcVar8 = pcVar7 + 1;
          bVar13 = *pcVar8 == pcVar11[1];
          if (!bVar13) break;
          pcVar7 = pcVar7 + 2;
          pcVar11 = pcVar11 + 2;
          bVar13 = *pcVar8 == '\0';
        } while (!bVar13);
        if (!bVar13) {
          pcVar8 = local_34;
          pcVar12 = s_DamageZones_004e356f;
          do {
            if (*pcVar8 != *pcVar12) goto LAB_0041c98e;
            bVar13 = true;
            if (*pcVar8 == '\0') break;
            pcVar7 = pcVar8 + 1;
            if (*pcVar7 != pcVar12[1]) goto LAB_0041c98e;
            pcVar8 = pcVar8 + 2;
            pcVar12 = pcVar12 + 2;
            bVar13 = *pcVar7 == '\0';
          } while (!bVar13);
          if (!bVar13) {
LAB_0041c98e:
            pcVar8 = local_34;
            pcVar12 = param_4;
            do {
              if (*pcVar8 != *pcVar12) goto LAB_0041c9b7;
              bVar13 = true;
              if (*pcVar8 == '\0') break;
              pcVar7 = pcVar8 + 1;
              if (*pcVar7 != pcVar12[1]) goto LAB_0041c9b7;
              pcVar8 = pcVar8 + 2;
              pcVar12 = pcVar12 + 2;
              bVar13 = *pcVar7 == '\0';
            } while (!bVar13);
            iVar4 = iVar5;
            if (bVar13) goto LAB_0041c9c2;
LAB_0041c9b7:
            iVar5 = iVar5 + 1;
            puVar2 = (undefined4 *)*puVar2;
            goto joined_r0x0041c90c;
          }
        }
LAB_0041c987:
        puVar2 = (undefined4 *)*puVar2;
      } while( true );
    }
    FUN_004dbb24((int *)&DAT_00524e68,(char *)local_c,(char *)0x0);
    FUN_004dbb24((int *)&DAT_00524e68,s_is_empty_or_missing__004e354f,(char *)0x0);
    FUN_004022e8(local_c);
    FUN_00403ecc(piVar6,3);
  }
  return -1;
}



/* @0041cab2 file=? name=FUN_0041cab2 */

void __cdecl FUN_0041cab2(int param_1,undefined4 param_2)

{
  (**(code **)(**(int **)(param_1 + 0xe0) + 0x18))(*(int **)(param_1 + 0xe0),param_2);
  return;
}



/* @0041cacd file=? name=FUN_0041cacd */

void FUN_0041cacd(void)

{
  return;
}



/* @0041cad2 file=? name=FUN_0041cad2 */

void FUN_0041cad2(void)

{
  return;
}



/* @0041cad8 file=? name=FUN_0041cad8 */

undefined4 * __cdecl FUN_0041cad8(undefined4 *param_1)

{
  FUN_00408e90(param_1 + 3,&DAT_004e0f8c);
  FUN_00408440(param_1,&DAT_004e0f80);
  return param_1;
}



/* @0041cb04 file=? name=FUN_0041cb04 */

undefined4 * __cdecl FUN_0041cb04(undefined4 *param_1,undefined4 *param_2)

{
  FUN_00408e90(param_1 + 3,param_2 + 3);
  FUN_00408440(param_1,param_2);
  return param_1;
}



/* @0041cb34 file=? name=FUN_0041cb34 */

undefined4 FUN_0041cb34(void)

{
  return 1;
}



/* @0041cb40 file=? name=FUN_0041cb40 */

undefined4 * __cdecl FUN_0041cb40(undefined4 *param_1,undefined4 param_2)

{
  FUN_00415e90(param_1,1);
  *param_1 = &PTR_FUN_004e36dc;
  param_1[4] = 3;
  param_1[5] = 1;
  param_1[3] = 0;
  param_1[6] = param_2;
  return param_1;
}



/* @0041cb78 file=? name=FUN_0041cb78 */

undefined4 * __cdecl FUN_0041cb78(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 *puVar1;
  
  FUN_00415e90(param_1,1);
  *param_1 = &PTR_FUN_004e36dc;
  param_1[4] = param_3;
  param_1[5] = 1;
  param_1[6] = param_2;
  param_1[3] = 0;
  switch(param_3) {
  case 0:
    puVar1 = (undefined4 *)FUN_00402298(8);
    if (puVar1 != (undefined4 *)0x0) {
      *puVar1 = 0;
      puVar1[1] = 0;
    }
    param_1[3] = puVar1;
    break;
  case 1:
    puVar1 = (undefined4 *)FUN_00402298(8);
    if (puVar1 != (undefined4 *)0x0) {
      *puVar1 = 1;
      puVar1[1] = 0;
    }
    param_1[3] = puVar1;
    break;
  case 2:
    puVar1 = (undefined4 *)FUN_00402298(8);
    if (puVar1 != (undefined4 *)0x0) {
      *puVar1 = 2;
      puVar1[1] = 0;
    }
    param_1[3] = puVar1;
    break;
  case 4:
    puVar1 = (undefined4 *)FUN_00402298(0xc);
    if (puVar1 != (undefined4 *)0x0) {
      *puVar1 = DAT_004e0f8c;
      puVar1[1] = DAT_004e0f90;
      puVar1[2] = DAT_004e0f94;
    }
    param_1[3] = puVar1;
    break;
  case 5:
    puVar1 = (undefined4 *)FUN_00402298(0x18);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_0041cad8(puVar1);
    }
    param_1[3] = puVar1;
  }
  return param_1;
}



/* @0041ccc0 file=? name=FUN_0041ccc0 */

undefined4 * __cdecl FUN_0041ccc0(undefined4 *param_1,int param_2)

{
  uint uVar1;
  undefined4 *puVar2;
  undefined4 *puVar3;
  
  FUN_00415e90(param_1,1);
  *param_1 = &PTR_FUN_004e36dc;
  param_1[5] = 1;
  param_1[6] = *(undefined4 *)(param_2 + 0x18);
  param_1[4] = *(undefined4 *)(param_2 + 0x10);
  param_1[3] = 0;
  uVar1 = *(uint *)(param_2 + 0x10);
  if (uVar1 < 3) {
    puVar3 = (undefined4 *)FUN_00402298(8);
    if (puVar3 != (undefined4 *)0x0) {
      puVar2 = *(undefined4 **)(param_2 + 0xc);
      *puVar3 = *puVar2;
      puVar3[1] = puVar2[1];
    }
    param_1[3] = puVar3;
  }
  else if (uVar1 != 3) {
    if (uVar1 == 4) {
      puVar3 = (undefined4 *)FUN_00402298(0xc);
      if (puVar3 != (undefined4 *)0x0) {
        puVar2 = *(undefined4 **)(param_2 + 0xc);
        *puVar3 = *puVar2;
        puVar3[1] = puVar2[1];
        puVar3[2] = puVar2[2];
      }
      param_1[3] = puVar3;
    }
    else if (uVar1 == 5) {
      puVar3 = (undefined4 *)FUN_00402298(0x18);
      if (puVar3 == (undefined4 *)0x0) {
        puVar3 = (undefined4 *)0x0;
      }
      else {
        puVar3 = FUN_0041cb04(puVar3,*(undefined4 **)(param_2 + 0xc));
      }
      param_1[3] = puVar3;
    }
  }
  return param_1;
}



/* @0041cdd8 file=? name=FUN_0041cdd8 */

int __cdecl FUN_0041cdd8(int param_1,int param_2)

{
  uint uVar1;
  undefined4 *puVar2;
  undefined4 *puVar3;
  
  *(undefined4 *)(param_1 + 0x14) = 1;
  uVar1 = *(uint *)(param_1 + 0x10);
  if (uVar1 == *(uint *)(param_2 + 0x10)) {
    uVar1 = *(uint *)(param_2 + 0x10);
    if (uVar1 < 3) {
      *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);
    }
    else if (uVar1 != 3) {
      if (uVar1 == 4) {
        *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);
      }
      else if (uVar1 == 5) {
        *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);
      }
    }
  }
  else {
    if (uVar1 < 3) {
      FUN_004022d0(*(int **)(param_1 + 0xc));
    }
    else if (uVar1 != 3) {
      if (uVar1 == 4) {
        FUN_004022d0(*(int **)(param_1 + 0xc));
      }
      else if (uVar1 == 5) {
        FUN_004022d0(*(int **)(param_1 + 0xc));
      }
    }
    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);
    uVar1 = *(uint *)(param_2 + 0x10);
    if (uVar1 < 3) {
      puVar3 = (undefined4 *)FUN_00402298(8);
      if (puVar3 != (undefined4 *)0x0) {
        puVar2 = *(undefined4 **)(param_2 + 0xc);
        *puVar3 = *puVar2;
        puVar3[1] = puVar2[1];
      }
      *(undefined4 **)(param_1 + 0xc) = puVar3;
    }
    else if (uVar1 != 3) {
      if (uVar1 == 4) {
        puVar3 = (undefined4 *)FUN_00402298(0xc);
        if (puVar3 != (undefined4 *)0x0) {
          puVar2 = *(undefined4 **)(param_2 + 0xc);
          *puVar3 = *puVar2;
          puVar3[1] = puVar2[1];
          puVar3[2] = puVar2[2];
        }
        *(undefined4 **)(param_1 + 0xc) = puVar3;
      }
      else if (uVar1 == 5) {
        puVar3 = (undefined4 *)FUN_00402298(0x18);
        if (puVar3 == (undefined4 *)0x0) {
          puVar3 = (undefined4 *)0x0;
        }
        else {
          puVar3 = FUN_0041cb04(puVar3,*(undefined4 **)(param_2 + 0xc));
        }
        *(undefined4 **)(param_1 + 0xc) = puVar3;
      }
    }
  }
  return param_1;
}



/* @0041cf40 file=? name=FUN_0041cf40 */

void __cdecl FUN_0041cf40(int *param_1,byte param_2)

{
  uint uVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e36dc;
    uVar1 = param_1[4];
    if (uVar1 < 3) {
      FUN_004022d0((int *)param_1[3]);
    }
    else if (uVar1 != 3) {
      if (uVar1 == 4) {
        FUN_004022d0((int *)param_1[3]);
      }
      else if (uVar1 == 5) {
        FUN_004022d0((int *)param_1[3]);
      }
    }
    FUN_00415ed8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041cfa0 file=? name=FUN_0041cfa0 */

int __cdecl FUN_0041cfa0(int param_1)

{
  if (*(int *)(param_1 + 0x10) == 4) {
    return *(int *)(param_1 + 0xc);
  }
  if (*(int *)(param_1 + 0x10) != 5) {
    return *(int *)(param_1 + 0xc);
  }
  return *(int *)(param_1 + 0xc) + 0xc;
}



/* @0041cfc8 file=? name=FUN_0041cfc8 */

void __cdecl FUN_0041cfc8(int param_1,int *param_2)

{
  int *piVar1;
  int iVar2;
  
  iVar2 = FUN_00408d78(*(int **)(param_1 + 0xc),param_2,0.0001);
  if (iVar2 == 0) {
    *(undefined4 *)(param_1 + 0x14) = 1;
    piVar1 = *(int **)(param_1 + 0xc);
    *piVar1 = *param_2;
    piVar1[1] = param_2[1];
    *(undefined4 *)(*(int *)(param_1 + 0x18) + 0xfc) = 1;
  }
  return;
}



/* @0041d020 file=? name=FUN_0041d020 */

void __cdecl FUN_0041d020(int param_1,float *param_2)

{
  int iVar1;
  
  if (*(int *)(param_1 + 0x10) == 4) {
    iVar1 = FUN_004091f4(*(float **)(param_1 + 0xc),param_2,0.0001);
    if (iVar1 != 0) {
      return;
    }
    FUN_00408e90(*(undefined4 **)(param_1 + 0xc),param_2);
  }
  else {
    if (*(int *)(param_1 + 0x10) != 5) {
      return;
    }
    iVar1 = FUN_004091f4((float *)(*(int *)(param_1 + 0xc) + 0xc),param_2,0.0001);
    if (iVar1 != 0) {
      return;
    }
    FUN_00408e90((undefined4 *)(*(int *)(param_1 + 0xc) + 0xc),param_2);
  }
  *(undefined4 *)(param_1 + 0x14) = 1;
  *(undefined4 *)(*(int *)(param_1 + 0x18) + 0xfc) = 1;
  return;
}



/* @0041d0a8 file=? name=FUN_0041d0a8 */

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

void __cdecl FUN_0041d0a8(int param_1,float *param_2)

{
  float10 fVar1;
  
  fVar1 = FUN_004dcd00((double)(*(float *)(*(int *)(param_1 + 0xc) + 4) - *param_2));
  if ((float10)_DAT_0041d118 < fVar1) {
    *(float *)(*(int *)(param_1 + 0xc) + 4) = *param_2;
    *(undefined4 *)(param_1 + 0x14) = 1;
    *(undefined4 *)(*(int *)(param_1 + 0x18) + 0xfc) = 1;
  }
  return;
}



/* @0041d11c file=? name=FUN_0041d11c */

void __cdecl FUN_0041d11c(int param_1,float *param_2)

{
  int iVar1;
  
  *(undefined4 *)(param_1 + 0x14) = 1;
  iVar1 = FUN_004084fc(*(float **)(param_1 + 0xc),param_2,0.0001);
  if (iVar1 == 0) {
    FUN_00408440(*(undefined4 **)(param_1 + 0xc),param_2);
    *(undefined4 *)(param_1 + 0x14) = 1;
    *(undefined4 *)(*(int *)(param_1 + 0x18) + 0xfc) = 1;
  }
  return;
}



/* @0041d170 file=? name=FUN_0041d170 */

undefined4 * __cdecl
FUN_0041d170(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  undefined4 *puVar1;
  
  FUN_0041c5c0(param_1,param_2,param_3,s_Joint_Subsystem_004e3617,0x33,param_4);
  *param_1 = &PTR_FUN_004e36ac;
  FUN_0041d2ea(param_1 + 0x39,0,0);
  puVar1 = (undefined4 *)FUN_00402298(0x160);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041de1c(puVar1,param_1,0);
  }
  param_1[0x38] = puVar1;
  return param_1;
}



/* @0041d1dc file=? name=FUN_0041d1dc */

void __cdecl FUN_0041d1dc(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  void *this;
  int local_20 [7];
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e36ac;
    FUN_0041d3b3(local_20,(int)(param_1 + 0x39));
    FUN_00417858(this,local_20,1);
    puVar1 = (undefined4 *)param_1[0x38];
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
    FUN_0041d3d2(local_20,2);
    FUN_0041d30d(param_1 + 0x39,2);
    FUN_0041c648(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041d260 file=? name=FUN_0041d260 */

void __cdecl FUN_0041d260(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4e35d8);
  return;
}



/* @0041d2ea file=? name=FUN_0041d2ea */

undefined4 * __cdecl FUN_0041d2ea(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00419184(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e3690;
  return param_1;
}



/* @0041d30d file=? name=FUN_0041d30d */

void __cdecl FUN_0041d30d(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3690;
    FUN_004191b4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041d339 file=? name=FUN_0041d339 */

undefined4 __cdecl FUN_0041d339(undefined4 param_1,int param_2,int param_3)

{
  undefined4 uVar1;
  
  if (*(int *)(param_3 + 0x14) == *(int *)(param_2 + 0x14)) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
    if (*(int *)(param_2 + 0x14) <= *(int *)(param_3 + 0x14)) {
      uVar1 = 0xffffffff;
    }
  }
  return uVar1;
}



/* @0041d368 file=? name=FUN_0041d368 */

undefined4 __cdecl FUN_0041d368(undefined4 param_1,int *param_2,int param_3)

{
  undefined4 uVar1;
  
  if (*(int *)(param_3 + 0x14) == *param_2) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
    if (*param_2 <= *(int *)(param_3 + 0x14)) {
      uVar1 = 0xffffffff;
    }
  }
  return uVar1;
}



/* @0041d394 file=? name=FUN_0041d394 */

undefined4 * __cdecl FUN_0041d394(undefined4 *param_1,int param_2)

{
  FUN_004194d8(param_1,param_2);
  *param_1 = &PTR_FUN_004e3634;
  return param_1;
}



/* @0041d3b3 file=? name=FUN_0041d3b3 */

undefined4 * __cdecl FUN_0041d3b3(undefined4 *param_1,int param_2)

{
  FUN_004194d8(param_1,param_2);
  *param_1 = &PTR_FUN_004e3634;
  return param_1;
}



/* @0041d3d2 file=? name=FUN_0041d3d2 */

void __cdecl FUN_0041d3d2(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3634;
    FUN_0041951c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041d3fe file=? name=FUN_0041d3fe */

undefined4 * __cdecl FUN_0041d3fe(undefined4 param_1,int param_2,undefined4 *param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_0041d485();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041d42e(puVar1,param_1,param_2,param_3);
  }
  return puVar1;
}



/* @0041d42e file=? name=FUN_0041d42e */

undefined4 * __cdecl
FUN_0041d42e(undefined4 *param_1,undefined4 param_2,int param_3,undefined4 *param_4)

{
  FUN_004190e8(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e36e8;
  param_1[5] = *param_4;
  return param_1;
}



/* @0041d459 file=? name=FUN_0041d459 */

void __cdecl FUN_0041d459(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e36e8;
    FUN_0041910c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_0041d4d5(param_1);
    }
  }
  return;
}



/* @0041d485 file=? name=FUN_0041d485 */

void FUN_0041d485(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = DAT_004e36e4;
  DAT_004e36e4 = DAT_004e36e4 + 1;
  puVar2 = DAT_004e36e0;
  if ((iVar1 == 0) && (puVar2 = (undefined4 *)FUN_00402298(0x28), puVar2 != (undefined4 *)0x0)) {
    FUN_00402b98(puVar2,0x18,100,100,s_TableEntryOf_004e3627);
  }
  DAT_004e36e0 = puVar2;
  FUN_00402f74((int)DAT_004e36e0);
  return;
}



/* @0041d4d5 file=? name=FUN_0041d4d5 */

void __cdecl FUN_0041d4d5(undefined4 *param_1)

{
  FUN_00402f98((int)DAT_004e36e0,param_1);
  DAT_004e36e4 = DAT_004e36e4 + -1;
  if (DAT_004e36e4 == 0) {
    if (DAT_004e36e0 != (int *)0x0) {
      FUN_00402c28(DAT_004e36e0,0);
      FUN_004022d0(DAT_004e36e0);
    }
    DAT_004e36e0 = (int *)0x0;
  }
  return;
}



/* @0041d520 file=? name=FUN_0041d520 */

undefined4 * __cdecl
FUN_0041d520(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_004178cc(param_1,param_2);
  *param_1 = &PTR_FUN_004e3320;
  param_1[3] = param_3;
  *param_1 = &PTR_FUN_004e3954;
  param_1[4] = param_4;
  return param_1;
}



/* @0041d554 file=? name=FUN_0041d554 */

void __cdecl FUN_0041d554(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3954;
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041d580 file=? name=FUN_0041d580 */

void __cdecl FUN_0041d580(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4e36f8);
  return;
}



/* @0041d59c file=? name=FUN_0041d59c */

void __cdecl FUN_0041d59c(int *param_1,undefined4 param_2,undefined4 param_3)

{
  (**(code **)(*param_1 + 0xc))(param_1,param_3);
  return;
}



/* @0041d5b4 file=? name=FUN_0041d5b4 */

undefined4 * __cdecl FUN_0041d5b4(undefined4 *param_1,undefined4 param_2)

{
  FUN_0041d520(param_1,0x11,param_2,0);
  *param_1 = &PTR_FUN_004e3918;
  param_1[5] = 0;
  param_1[6] = 0;
  param_1[7] = 0;
  param_1[8] = 0;
  param_1[9] = 0;
  return param_1;
}



/* @0041d5f0 file=? name=FUN_0041d5f0 */

void FUN_0041d5f0(void)

{
  undefined4 *puVar1;
  uint local_10 [3];
  
  puVar1 = (undefined4 *)FUN_00402298(0x58);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00428a78(puVar1,1,0,1);
  }
  FUN_00428ee0(*(int *)(DAT_004efc94 + 0x2c),(int)puVar1);
  local_10[0] = 0xc;
  local_10[1] = 10;
  local_10[2] = 1;
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),2,DAT_004efc94,local_10,DAT_004e17f4);
  return;
}



/* @0041d66c file=? name=FUN_0041d66c */

undefined4 __cdecl FUN_0041d66c(int param_1)

{
  undefined4 *puVar1;
  
  if (*(int **)(param_1 + 0x20) != (int *)0x0) {
    FUN_00403ecc(*(int **)(param_1 + 0x20),3);
  }
  puVar1 = (undefined4 *)FUN_00428f34(*(int *)(DAT_004efc94 + 0x2c));
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return 1;
}



/* @0041d6a8 file=? name=FUN_0041d6a8 */

void __cdecl FUN_0041d6a8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3918;
    FUN_0041d554(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041d6d4 file=? name=FUN_0041d6d4 */

void __cdecl FUN_0041d6d4(int param_1,int param_2)

{
  undefined4 uVar1;
  int *piVar2;
  
  if (*(int *)(param_2 + 0xc) == -1) {
    FUN_0044e9c0(DAT_004efc94,*(undefined4 *)(param_1 + 0x20));
  }
  else {
    if (*(int *)(param_2 + 0xc) == 0) {
      uVar1 = FUN_004022b0(*(uint *)(param_2 + 0x10));
      *(undefined4 *)(param_1 + 0x1c) = uVar1;
      *(undefined4 *)(param_1 + 0x24) = 0;
    }
    FUN_004d4918((undefined4 *)(*(int *)(param_1 + 0x1c) + *(int *)(param_1 + 0x24)),
                 (undefined4 *)(param_2 + 0x18),*(uint *)(param_2 + 0x14));
    *(int *)(param_1 + 0x24) = *(int *)(param_1 + 0x24) + *(int *)(param_2 + 0x14);
    if (*(int *)(param_2 + 0x10) <= *(int *)(param_1 + 0x24)) {
      piVar2 = (int *)FUN_00402298(0x20);
      if (piVar2 == (int *)0x0) {
        piVar2 = (int *)0x0;
      }
      else {
        piVar2 = FUN_00403e84(piVar2,(char *)0x0,1);
      }
      *(int **)(param_1 + 0x20) = piVar2;
      FUN_00404d00((int)piVar2,*(char **)(param_1 + 0x1c),*(int *)(param_1 + 0x24));
      FUN_00404d6c(*(undefined4 **)(param_1 + 0x20),s_last_egg_004e37a8);
      FUN_0044e9c0(DAT_004efc94,*(undefined4 *)(param_1 + 0x20));
      FUN_004022d0(*(int **)(param_1 + 0x1c));
    }
  }
  return;
}



/* @0041d7a8 file=? name=FUN_0041d7a8 */

void FUN_0041d7a8(void)

{
  return;
}



/* @0041d7b0 file=? name=FUN_0041d7b0 */

void __cdecl FUN_0041d7b0(int *param_1,undefined4 param_2,uint param_3)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_0041d7f0((int)param_1,param_3);
  (**(code **)(*piVar1 + 0x14))(piVar1,0,param_2);
  (**(code **)(*param_1 + 0x1c))(param_1,param_2,param_3);
  return;
}



/* @0041d7e8 file=? name=FUN_0041d7e8 */

void FUN_0041d7e8(void)

{
  return;
}



/* @0041d7f0 file=munga/network.cpp name=FUN_0041d7f0 */

int __cdecl FUN_0041d7f0(int param_1,uint param_2)

{
  int *piVar1;
  
  switch(param_2) {
  case 0:
    goto switchD_0041d801_caseD_0;
  case 1:
    return *(int *)(DAT_004efc94 + 0x24);
  case 2:
    return *(int *)(DAT_004efc94 + 0x2c);
  case 3:
    return *(int *)(DAT_004efc94 + 0x30);
  case 4:
    return DAT_004efc94;
  default:
    FUN_004dbb24(&DAT_00524e20,s_______UNKNOWN_NETWORK_CLIENT_ID_004e37b1,(char *)0x0);
    piVar1 = FUN_004db78c(&DAT_00524e20,param_2);
    FUN_004d9c38(piVar1);
    FUN_0040385c(s_Unknown_Client_ID_004e37d2,s_d__tesla_bt_munga_NETWORK_CPP_004e37e4,0x17e);
    param_1 = 0;
switchD_0041d801_caseD_0:
    return param_1;
  case 6:
    return *(int *)(DAT_004efc94 + 0x40);
  }
}



/* @0041d8a8 file=munga/network.cpp name=FUN_0041d8a8 */

undefined4 __cdecl FUN_0041d8a8(int *param_1)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  uint local_64c;
  uint local_648;
  uint local_644;
  undefined1 local_63c [1584];
  uint local_c;
  uint local_8;
  
  iVar1 = (**(code **)(*param_1 + 0x34))(param_1,&local_64c);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    if (local_648 == param_1[5]) {
      piVar3 = (int *)FUN_0041d7f0((int)param_1,local_64c);
      (**(code **)(*piVar3 + 0x14))(piVar3,&local_64c,local_63c);
    }
    else {
      local_8 = local_644;
      local_c = local_648;
      FUN_004dbb24(&DAT_00524e20,s___________client_004e3802,(char *)0x0);
      piVar3 = FUN_004db78c(&DAT_00524e20,local_64c);
      FUN_004dbb24(piVar3,s_gameID_004e3814,(char *)0x0);
      piVar3 = FUN_004db78c(piVar3,local_c);
      FUN_004dbb24(piVar3,s_fromHost_004e381d,(char *)0x0);
      piVar3 = FUN_004db78c(piVar3,local_8);
      FUN_004d9c38(piVar3);
      FUN_0040385c(s___________NOT_A_PACKET_FOR_THIS_G_004e3828,
                   s_d__tesla_bt_munga_NETWORK_CPP_004e384e,0x1ac);
    }
    (**(code **)(*param_1 + 0x38))(param_1,&local_64c);
    uVar2 = 1;
  }
  return uVar2;
}



/* @0041d9a4 file=? name=FUN_0041d9a4 */

undefined4 FUN_0041d9a4(void)

{
  return 1;
}



/* @0041d9b0 file=munga/network.cpp name=FUN_0041d9b0 */

undefined4 FUN_0041d9b0(void)

{
  FUN_0040385c(s_NetworkManager__CheckBuffers___s_004e386c,s_d__tesla_bt_munga_NETWORK_CPP_004e38a4,
               0x1c6);
  return 0;
}



/* @0041d9d0 file=munga/network.cpp name=FUN_0041d9d0 */

void FUN_0041d9d0(void)

{
  FUN_0040385c(s_NetworkManager__RemovePacket___s_004e38c2,s_d__tesla_bt_munga_NETWORK_CPP_004e38fa,
               0x1d1);
  return;
}



/* @0041dac6 file=? name=FUN_0041dac6 */

void FUN_0041dac6(void)

{
  return;
}



/* @0041dacb file=? name=FUN_0041dacb */

void FUN_0041dacb(void)

{
  return;
}



/* @0041dad0 file=? name=FUN_0041dad0 */

undefined4 * __cdecl FUN_0041dad0(undefined4 *param_1)

{
  undefined4 *puVar1;
  
  FUN_00415e90(param_1,1);
  *param_1 = &PTR_FUN_004e3d0c;
  FUN_0041f2cb(param_1 + 4,0);
  puVar1 = (undefined4 *)FUN_00402298(0x14);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041f335(puVar1,(int)(param_1 + 4));
  }
  param_1[3] = puVar1;
  return param_1;
}



/* @0041db20 file=? name=FUN_0041db20 */

void __thiscall FUN_0041db20(void *this,int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3d0c;
    FUN_00417858(this,(int *)param_1[3],1);
    puVar1 = (undefined4 *)param_1[3];
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
    FUN_0041f2ea(param_1 + 4,2);
    FUN_00415ed8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041db7c file=? name=FUN_0041db7c */

int __cdecl FUN_0041db7c(int param_1)

{
  *(undefined4 *)(param_1 + 4) = 0;
  FUN_00408440((undefined4 *)(param_1 + 8),&DAT_004e0f74);
  *(undefined4 *)(param_1 + 0x14) = 0;
  *(undefined4 *)(param_1 + 0x18) = 0x3f800000;
  *(undefined4 *)(param_1 + 0x1c) = 0;
  FUN_00408440((undefined4 *)(param_1 + 0x20),&DAT_004e0f80);
  *(undefined4 *)(param_1 + 0x2c) = 1;
  return param_1;
}



/* @0041dbd0 file=? name=FUN_0041dbd0 */

int __cdecl FUN_0041dbd0(int param_1,undefined4 param_2)

{
  int iVar1;
  int local_68 [5];
  int local_54 [5];
  int local_40 [5];
  int local_2c [5];
  int local_18 [5];
  
  switch(param_2) {
  case 1:
    FUN_0041f4b3(local_40,param_1 + 0x100);
    iVar1 = (**(code **)(local_40[0] + 0x30))(local_40);
    if (iVar1 != 0) {
      FUN_0041f4f1(local_40,2);
      return iVar1;
    }
    FUN_0041f4f1(local_40,2);
    break;
  case 2:
    FUN_0041f4b3(local_2c,param_1 + 0xec);
    iVar1 = (**(code **)(local_2c[0] + 0x30))(local_2c);
    if (iVar1 != 0) {
      FUN_0041f4f1(local_2c,2);
      return iVar1;
    }
    FUN_0041f4f1(local_2c,2);
    break;
  case 3:
    FUN_0041f4b3(local_68,param_1 + 0x128);
    iVar1 = (**(code **)(local_68[0] + 0x30))(local_68);
    if (iVar1 != 0) {
      FUN_0041f4f1(local_68,2);
      return iVar1;
    }
    FUN_0041f4f1(local_68,2);
    break;
  case 4:
    FUN_0041f4b3(local_54,param_1 + 0x114);
    iVar1 = (**(code **)(local_54[0] + 0x30))(local_54);
    if (iVar1 != 0) {
      FUN_0041f4f1(local_54,2);
      return iVar1;
    }
    FUN_0041f4f1(local_54,2);
  }
  FUN_0041f4b3(local_18,param_1 + 0xd8);
  iVar1 = (**(code **)(local_18[0] + 0x30))(local_18);
  FUN_0041f4f1(local_18,2);
  return iVar1;
}



/* @0041dd68 file=? name=FUN_0041dd68 */

void __cdecl FUN_0041dd68(int param_1)

{
  FUN_0041bbd8(param_1 + 0x10,0);
  FUN_0041bbd8(param_1 + 100,0);
  *(undefined4 *)(param_1 + 0x158) = 0;
  return;
}



/* @0041dd98 file=? name=FUN_0041dd98 */

void __cdecl FUN_0041dd98(int param_1,undefined4 *param_2)

{
  param_2[2] = *(undefined4 *)(param_1 + 0x158);
  param_2[3] = *(undefined4 *)(param_1 + 0x24);
  param_2[4] = *(undefined4 *)(param_1 + 0x78);
  param_2[1] = *(undefined4 *)(param_1 + 0x13c);
  param_2[5] = *(undefined4 *)(param_1 + 0xb8);
  *param_2 = 0x18;
  *(undefined4 *)(param_1 + 0xb8) = 0;
  return;
}



/* @0041ddd8 file=? name=FUN_0041ddd8 */

void __cdecl FUN_0041ddd8(int param_1,int param_2)

{
  *(undefined4 *)(param_1 + 0x158) = *(undefined4 *)(param_2 + 8);
  FUN_0041bbd8(param_1 + 0x10,*(int *)(param_2 + 0xc));
  FUN_0041bbd8(param_1 + 100,*(int *)(param_2 + 0x10));
  *(undefined4 *)(param_1 + 0xb8) = *(undefined4 *)(param_2 + 0x14);
  return;
}



/* @0041de1c file=? name=FUN_0041de1c */

undefined4 * __cdecl FUN_0041de1c(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  int *piVar1;
  undefined4 *puVar2;
  int iVar3;
  int *local_8;
  
  FUN_004178cc(param_1,0x4e);
  *param_1 = &PTR_FUN_004e3cf0;
  FUN_0041b9ec(param_1 + 4,2);
  FUN_0041b9ec(param_1 + 0x19,3);
  FUN_0041f39f(param_1 + 0x2f,0,0);
  FUN_0041f449(param_1 + 0x36,0);
  FUN_0041f449(param_1 + 0x3b,0);
  FUN_0041f449(param_1 + 0x40,0);
  FUN_0041f449(param_1 + 0x45,0);
  FUN_0041f449(param_1 + 0x4a,0);
  puVar2 = (undefined4 *)FUN_00402298(0x10);
  if (puVar2 == (undefined4 *)0x0) {
    iVar3 = 0;
  }
  else {
    iVar3 = FUN_004023f4(puVar2);
  }
  param_1[0x57] = iVar3;
  piVar1 = (int *)(param_1[0x57] + 0xc);
  *piVar1 = *piVar1 + 1;
  param_1[0x4f] = param_3;
  param_1[3] = param_2;
  param_1[0x56] = 0;
  param_1[0x35] = 0;
  iVar3 = 0;
  puVar2 = param_1 + 0x51;
  do {
    *puVar2 = 0;
    iVar3 = iVar3 + 1;
    puVar2 = puVar2 + 1;
  } while (iVar3 < 5);
  FUN_00402a98((int *)&local_8,param_1 + 0x57,s_TrivialDamageZone_Name_004e396c);
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  param_1[0x2e] = 0;
  FUN_0041dd68((int)param_1);
  return param_1;
}



/* @0041df5c file=? name=FUN_0041df5c */

undefined4 * __cdecl
FUN_0041df5c(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int *param_4)

{
  int *piVar1;
  int iVar2;
  undefined4 uVar3;
  undefined4 *puVar4;
  int local_84 [7];
  undefined4 local_68;
  int *local_64;
  int local_60;
  undefined4 *local_5c;
  int local_58;
  int *local_54;
  undefined4 local_50;
  int local_4c;
  int local_48;
  int *local_44;
  undefined4 *local_40;
  undefined1 local_3c [4];
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  undefined4 local_1c;
  int local_18;
  int local_14;
  int *local_10;
  int *local_c;
  undefined4 *local_8;
  
  FUN_004178cc(param_1,0x4e);
  *param_1 = &PTR_FUN_004e3cf0;
  FUN_0041b9ec(param_1 + 4,2);
  FUN_0041b9ec(param_1 + 0x19,3);
  FUN_0041f39f(param_1 + 0x2f,0,0);
  FUN_0041f449(param_1 + 0x36,0);
  FUN_0041f449(param_1 + 0x3b,0);
  FUN_0041f449(param_1 + 0x40,0);
  FUN_0041f449(param_1 + 0x45,0);
  FUN_0041f449(param_1 + 0x4a,0);
  local_8 = (undefined4 *)FUN_00402298(0x10);
  if (local_8 == (undefined4 *)0x0) {
    iVar2 = 0;
  }
  else {
    iVar2 = FUN_004023f4(local_8);
  }
  param_1[0x57] = iVar2;
  piVar1 = (int *)(param_1[0x57] + 0xc);
  *piVar1 = *piVar1 + 1;
  param_1[3] = param_2;
  param_1[0x4f] = param_3;
  param_1[0x56] = 0;
  param_1[0x35] = 0;
  FUN_0041dd68((int)param_1);
  local_c = param_1 + 0x57;
  local_10 = param_4;
  FUN_00402aec(param_4,local_c);
  iVar2 = FUN_0041a1a4(**(int **)(param_1[3] + 0xc),0x4e4afc);
  if (iVar2 == 0) {
    iVar2 = 0;
    do {
      (**(code **)(*param_4 + 0x1c))(param_4,local_3c,4);
      iVar2 = iVar2 + 1;
    } while (iVar2 < 5);
  }
  else {
    local_14 = param_1[3];
    local_20 = 0;
    do {
      (**(code **)(*param_4 + 0x1c))(param_4,&local_18,4);
      iVar2 = 0;
      if (0 < local_18) {
        do {
          (**(code **)(*param_4 + 0x1c))(param_4,&local_1c,4);
          local_24 = local_1c;
          FUN_0041f216(local_84,local_14 + 0x300);
          uVar3 = (**(code **)(local_84[0] + 0x34))(local_84,local_24);
          FUN_0041f235(local_84,2);
          switch(local_20) {
          case 0:
            local_28 = uVar3;
            (**(code **)(param_1[0x36] + 4))(param_1 + 0x36,uVar3);
            break;
          case 1:
            local_2c = uVar3;
            (**(code **)(param_1[0x40] + 4))(param_1 + 0x40,uVar3);
            break;
          case 2:
            local_30 = uVar3;
            (**(code **)(param_1[0x3b] + 4))(param_1 + 0x3b,uVar3);
            break;
          case 3:
            local_34 = uVar3;
            (**(code **)(param_1[0x4a] + 4))(param_1 + 0x4a,uVar3);
            break;
          case 4:
            local_38 = uVar3;
            (**(code **)(param_1[0x45] + 4))(param_1 + 0x45,uVar3);
          }
          iVar2 = iVar2 + 1;
        } while (iVar2 < local_18);
      }
      local_20 = local_20 + 1;
    } while (local_20 < 5);
  }
  local_40 = param_1 + 0x50;
  local_44 = param_4;
  (**(code **)(*param_4 + 0x1c))(param_4,local_40,4);
  local_48 = 0;
  do {
    (**(code **)(*param_4 + 0x1c))(param_4,param_1 + local_48 + 0x51,4);
    local_48 = local_48 + 1;
  } while (local_48 < 5);
  local_54 = param_4;
  (**(code **)(*param_4 + 0x1c))(param_4,&local_4c,4);
  local_48 = 0;
  if (0 < local_4c) {
    do {
      (**(code **)(*param_4 + 0x1c))(param_4,&local_50,4);
      (**(code **)(*param_4 + 0x1c))(param_4,&local_58,4);
      if (local_58 != 0) {
        puVar4 = (undefined4 *)FUN_00402298(0x24);
        if (puVar4 == (undefined4 *)0x0) {
          local_5c = (undefined4 *)0x0;
        }
        else {
          local_5c = FUN_0041dad0(puVar4);
        }
        local_60 = 0;
        if (0 < local_58) {
          do {
            puVar4 = (undefined4 *)FUN_00402298(0x10);
            if (puVar4 == (undefined4 *)0x0) {
              local_64 = (int *)0x0;
            }
            else {
              local_64 = (int *)FUN_004023f4(puVar4);
            }
            local_64[3] = local_64[3] + 1;
            FUN_00402aec(param_4,(int *)&local_64);
            puVar4 = (undefined4 *)FUN_00402298(0x10);
            if (puVar4 == (undefined4 *)0x0) {
              puVar4 = (undefined4 *)0x0;
            }
            else {
              puVar4 = FUN_0041547b(puVar4,(int *)&local_64);
            }
            (**(code **)(local_5c[4] + 4))(local_5c + 4,puVar4);
            piVar1 = local_64 + 3;
            *piVar1 = *piVar1 + -1;
            if (*piVar1 == 0) {
              FUN_004024d8(local_64,3);
            }
            local_60 = local_60 + 1;
          } while (local_60 < local_58);
        }
        (**(code **)(*(int *)local_5c[3] + 4))((int *)local_5c[3]);
        local_68 = local_50;
        (**(code **)(param_1[0x2f] + 8))(param_1 + 0x2f,local_5c,&local_68);
      }
      local_48 = local_48 + 1;
    } while (local_48 < local_4c);
  }
  param_1[0x2e] = 0;
  return param_1;
}



/* @0041e394 file=? name=FUN_0041e394 */

void __cdecl FUN_0041e394(int *param_1,byte param_2)

{
  int *piVar1;
  undefined4 *puVar2;
  int *piVar3;
  void *this;
  int local_20 [7];
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3cf0;
    FUN_004012c7(local_20,(int)(param_1 + 0x2f));
    FUN_00417858(this,local_20,1);
    puVar2 = (undefined4 *)param_1[0x35];
    if ((puVar2 != (undefined4 *)0x0) && (puVar2 != (undefined4 *)0x0)) {
      (**(code **)*puVar2)(puVar2,3);
    }
    FUN_004012e6(local_20,2);
    piVar3 = (int *)param_1[0x57];
    piVar1 = piVar3 + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(piVar3,3);
    }
    FUN_0041f468(param_1 + 0x4a,2);
    FUN_0041f468(param_1 + 0x45,2);
    FUN_0041f468(param_1 + 0x40,2);
    FUN_0041f468(param_1 + 0x3b,2);
    FUN_0041f468(param_1 + 0x36,2);
    FUN_0041f3c2(param_1 + 0x2f,2);
    FUN_0041baa4(param_1 + 0x19,2);
    FUN_0041baa4(param_1 + 4,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041e4a8 file=? name=FUN_0041e4a8 */

int * __cdecl FUN_0041e4a8(int param_1,int *param_2)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00402298(0x18);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_0042a748(piVar1,param_2);
  }
  *(int **)(param_1 + 0xd4) = piVar1;
  return piVar1;
}



/* @0041e4e0 file=? name=FUN_0041e4e0 */

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

void __cdecl FUN_0041e4e0(int *param_1,int *param_2)

{
  float fVar1;
  
  param_1[0x56] = (int)((float)param_2[1] * (float)param_1[*param_2 + 0x51] + (float)param_1[0x56]);
  fVar1 = _DAT_0041e57c;
  if ((_DAT_0041e57c <= (float)param_1[0x56]) &&
     (fVar1 = _DAT_0041e580, (float)param_1[0x56] <= _DAT_0041e580)) {
    fVar1 = (float)param_1[0x56];
  }
  param_1[0x56] = (int)fVar1;
  param_1[0x2e] = param_1[0x2e] | 4;
  if (_DAT_0041e580 <= (float)param_1[0x56]) {
    FUN_0041bbd8((int)(param_1 + 4),1);
    (**(code **)(*param_1 + 0xc))(param_1,1);
    param_1[0x2e] = param_1[0x2e] | 8;
  }
  return;
}



/* @0041e590 file=? name=FUN_0041e590 */

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

undefined4 __cdecl
FUN_0041e590(int param_1,undefined4 param_2,int param_3,int *param_4,int *param_5,int param_6,
            int param_7)

{
  undefined4 *puVar1;
  int iVar2;
  undefined4 *puVar3;
  uint *puVar4;
  int *piVar5;
  char cVar6;
  undefined4 uVar7;
  int *local_d4;
  undefined4 *local_d0;
  int *local_cc;
  int *local_c8;
  int local_c4;
  int *local_c0;
  int *local_bc;
  int *local_b8;
  int *local_b4;
  uint *local_b0;
  uint *local_ac;
  uint *local_a8;
  uint *local_a4;
  uint *local_a0;
  uint *local_9c;
  uint *local_98;
  uint *local_94;
  uint *local_90;
  uint *local_8c;
  uint *local_88;
  uint *local_84;
  uint *local_80;
  uint *local_7c;
  uint *local_78;
  uint *local_74;
  undefined4 local_70;
  int *local_6c;
  int *local_68;
  int *local_64;
  int local_60;
  int *local_5c;
  int *local_58;
  undefined4 local_54;
  int *local_50;
  int *local_4c;
  int *local_48;
  int *local_44;
  int *local_40;
  int *local_3c;
  float local_38;
  float local_34;
  int *local_30;
  int *local_2c;
  int *local_28;
  char *local_24;
  int *local_20;
  float local_1c;
  undefined4 local_18;
  int *local_14;
  char *local_10;
  int *local_c;
  int *local_8;
  
  local_8 = param_5;
  FUN_004029b0(param_5,(int)param_4);
  iVar2 = FUN_00403f84(param_6,(char *)param_4[2]);
  if (iVar2 == 0) {
    local_c = param_4;
    local_10 = (char *)param_4[2];
    FUN_004dbb24((int *)&DAT_00524e68,local_10,(char *)0x0);
    FUN_004dbb24((int *)&DAT_00524e68,s_listed_in__skl__does_not_exist_i_004e3983,(char *)0x0);
    FUN_004d9c38((int *)&DAT_00524e68);
    uVar7 = 0xffffffff;
    local_14 = param_4;
    piVar5 = param_4 + 3;
    *piVar5 = *piVar5 + -1;
    if (*piVar5 == 0) {
      FUN_004024d8(param_4,3);
    }
  }
  else {
    if (param_3 == 0) {
      local_18 = 0;
      iVar2 = 0;
      do {
        (**(code **)(*param_5 + 0x20))(param_5,&local_18,4);
        iVar2 = iVar2 + 1;
      } while (iVar2 < 5);
    }
    else {
      FUN_0041f07c(param_5,(char *)param_4[2],param_6,param_3,s_DefaultEffectSiteName_004e39b0);
      FUN_0041f07c(param_5,(char *)param_4[2],param_6,param_3,s_ExternalVideoEffectSiteName_004e39c6
                  );
      FUN_0041f07c(param_5,(char *)param_4[2],param_6,param_3,s_InternalVideoEffectSiteName_004e39e2
                  );
      FUN_0041f07c(param_5,(char *)param_4[2],param_6,param_3,s_ExternalAudioEffectSiteName_004e39fe
                  );
      FUN_0041f07c(param_5,(char *)param_4[2],param_6,param_3,s_InternalAudioEffectSiteName_004e3a1a
                  );
    }
    iVar2 = FUN_00404118(param_6,(char *)param_4[2],s_WeaponDamagePoints_004e3a36,&local_1c);
    if (iVar2 == 0) {
      local_20 = param_4;
      local_24 = (char *)param_4[2];
      FUN_004dbb24((int *)&DAT_00524e68,local_24,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_Must_have_a_WeaponDamagePoints_004e3a49,(char *)0x0);
      FUN_004d9c38((int *)&DAT_00524e68);
      uVar7 = 0;
      local_28 = param_4;
      piVar5 = param_4 + 3;
      *piVar5 = *piVar5 + -1;
      if (*piVar5 == 0) {
        FUN_004024d8(param_4,3);
      }
    }
    else if (local_1c == _DAT_0041f074) {
      FUN_004dbb24((int *)&DAT_00524e68,s_DefaultDamagePoints_must_have_a_n_004e3a69,(char *)0x0);
      FUN_004d9c38((int *)&DAT_00524e68);
      uVar7 = 0;
      local_2c = param_4;
      piVar5 = param_4 + 3;
      *piVar5 = *piVar5 + -1;
      if (*piVar5 == 0) {
        FUN_004024d8(param_4,3);
      }
    }
    else {
      local_30 = param_5;
      (**(code **)(*param_5 + 0x20))(param_5,&local_1c,4);
      iVar2 = FUN_00404118(param_6,(char *)param_4[2],s_CollisionDamagePoints_004e3a9a,&local_34);
      if (iVar2 == 0) {
        local_38 = _DAT_0041f078 / local_1c;
      }
      else if (local_34 == _DAT_0041f074) {
        local_38 = _DAT_0041f078 / local_1c;
      }
      else {
        local_38 = _DAT_0041f078 / local_34;
      }
      local_3c = param_5;
      (**(code **)(*param_5 + 0x20))(param_5,&local_38,4);
      iVar2 = FUN_00404118(param_6,(char *)param_4[2],s_BallisticDamagePoints_004e3ab0,&local_34);
      local_38 = local_34;
      if (iVar2 == 0) {
        local_38 = local_1c;
      }
      local_38 = _DAT_0041f078 / local_38;
      local_40 = param_5;
      (**(code **)(*param_5 + 0x20))(param_5,&local_38,4);
      iVar2 = FUN_00404118(param_6,(char *)param_4[2],s_ExplosiveDamagePoints_004e3ac6,&local_34);
      local_38 = local_34;
      if (iVar2 == 0) {
        local_38 = local_1c;
      }
      local_38 = _DAT_0041f078 / local_38;
      local_44 = param_5;
      (**(code **)(*param_5 + 0x20))(param_5,&local_38,4);
      iVar2 = FUN_00404118(param_6,(char *)param_4[2],s_LaserDamagePoints_004e3adc,&local_34);
      local_38 = local_34;
      if (iVar2 == 0) {
        local_38 = local_1c;
      }
      local_38 = _DAT_0041f078 / local_38;
      local_48 = param_5;
      (**(code **)(*param_5 + 0x20))(param_5,&local_38,4);
      iVar2 = FUN_00404118(param_6,(char *)param_4[2],s_EnergyDamagePoints_004e3aee,&local_34);
      if (iVar2 == 0) {
        local_34 = local_1c;
      }
      local_38 = _DAT_0041f078 / local_34;
      local_4c = param_5;
      (**(code **)(*param_5 + 0x20))(param_5,&local_38,4);
      local_50 = FUN_00404720(param_1,s_video_004e3b01,&DAT_004e3b07);
      if (local_50 == (int *)0x0) {
        local_54 = 0;
        local_58 = param_5;
        (**(code **)(*param_5 + 0x20))(param_5,&local_54,4);
        uVar7 = 1;
        local_5c = param_4;
        piVar5 = param_4 + 3;
        *piVar5 = *piVar5 + -1;
        if (*piVar5 == 0) {
          FUN_004024d8(param_4,3);
        }
      }
      else {
        local_60 = FUN_00403b60((int)local_50);
        local_64 = param_5;
        (**(code **)(*param_5 + 0x20))(param_5,&local_60,4);
        if (local_60 != 0) {
          puVar1 = (undefined4 *)local_50[1];
          while (puVar1 != (undefined4 *)0x0) {
            puVar3 = (undefined4 *)FUN_00402298(0x10);
            if (puVar3 == (undefined4 *)0x0) {
              local_68 = (int *)0x0;
            }
            else {
              local_68 = (int *)FUN_004023f4(puVar3);
            }
            local_68[3] = local_68[3] + 1;
            FUN_00402a98((int *)&local_6c,(int *)&local_68,(char *)(puVar1 + 2));
            piVar5 = local_6c + 3;
            *piVar5 = *piVar5 + -1;
            if (*piVar5 == 0) {
              FUN_004024d8(local_6c,3);
            }
            puVar4 = (uint *)FUN_00402298(0x10);
            if (puVar4 == (uint *)0x0) {
              local_74 = (uint *)0x0;
            }
            else {
              local_74 = FUN_00402460(puVar4,&DAT_004e3b0b);
            }
            local_74[3] = local_74[3] + 1;
            iVar2 = FUN_004027d8((int)local_68,(int)local_74);
            cVar6 = iVar2 == 0;
            local_78 = local_74;
            puVar4 = local_74 + 3;
            *puVar4 = *puVar4 - 1;
            if (*puVar4 == 0) {
              FUN_004024d8((int *)local_74,3);
            }
            if (cVar6 == '\0') {
              puVar4 = (uint *)FUN_00402298(0x10);
              if (puVar4 == (uint *)0x0) {
                local_7c = (uint *)0x0;
              }
              else {
                local_7c = FUN_00402460(puVar4,&DAT_004e3b0f);
              }
              local_7c[3] = local_7c[3] + 1;
              iVar2 = FUN_004027d8((int)local_68,(int)local_7c);
              cVar6 = iVar2 == 0;
              local_80 = local_7c;
              puVar4 = local_7c + 3;
              *puVar4 = *puVar4 - 1;
              if (*puVar4 == 0) {
                FUN_004024d8((int *)local_7c,3);
              }
              if (cVar6 == '\0') {
                puVar4 = (uint *)FUN_00402298(0x10);
                if (puVar4 == (uint *)0x0) {
                  local_84 = (uint *)0x0;
                }
                else {
                  local_84 = FUN_00402460(puVar4,&DAT_004e3b14);
                }
                local_84[3] = local_84[3] + 1;
                iVar2 = FUN_004027d8((int)local_68,(int)local_84);
                cVar6 = iVar2 == 0;
                local_88 = local_84;
                puVar4 = local_84 + 3;
                *puVar4 = *puVar4 - 1;
                if (*puVar4 == 0) {
                  FUN_004024d8((int *)local_84,3);
                }
                if (cVar6 == '\0') {
                  puVar4 = (uint *)FUN_00402298(0x10);
                  if (puVar4 == (uint *)0x0) {
                    local_8c = (uint *)0x0;
                  }
                  else {
                    local_8c = FUN_00402460(puVar4,&DAT_004e3b19);
                  }
                  local_8c[3] = local_8c[3] + 1;
                  iVar2 = FUN_004027d8((int)local_68,(int)local_8c);
                  cVar6 = iVar2 == 0;
                  local_90 = local_8c;
                  puVar4 = local_8c + 3;
                  *puVar4 = *puVar4 - 1;
                  if (*puVar4 == 0) {
                    FUN_004024d8((int *)local_8c,3);
                  }
                  if (cVar6 == '\0') {
                    puVar4 = (uint *)FUN_00402298(0x10);
                    if (puVar4 == (uint *)0x0) {
                      local_94 = (uint *)0x0;
                    }
                    else {
                      local_94 = FUN_00402460(puVar4,&DAT_004e3b1e);
                    }
                    local_94[3] = local_94[3] + 1;
                    iVar2 = FUN_004027d8((int)local_68,(int)local_94);
                    cVar6 = iVar2 == 0;
                    local_98 = local_94;
                    puVar4 = local_94 + 3;
                    *puVar4 = *puVar4 - 1;
                    if (*puVar4 == 0) {
                      FUN_004024d8((int *)local_94,3);
                    }
                    if (cVar6 == '\0') {
                      puVar4 = (uint *)FUN_00402298(0x10);
                      if (puVar4 == (uint *)0x0) {
                        local_9c = (uint *)0x0;
                      }
                      else {
                        local_9c = FUN_00402460(puVar4,&DAT_004e3b23);
                      }
                      local_9c[3] = local_9c[3] + 1;
                      iVar2 = FUN_004027d8((int)local_68,(int)local_9c);
                      cVar6 = iVar2 == 0;
                      local_a0 = local_9c;
                      puVar4 = local_9c + 3;
                      *puVar4 = *puVar4 - 1;
                      if (*puVar4 == 0) {
                        FUN_004024d8((int *)local_9c,3);
                      }
                      if (cVar6 == '\0') {
                        puVar4 = (uint *)FUN_00402298(0x10);
                        if (puVar4 == (uint *)0x0) {
                          local_a4 = (uint *)0x0;
                        }
                        else {
                          local_a4 = FUN_00402460(puVar4,&DAT_004e3b28);
                        }
                        local_a4[3] = local_a4[3] + 1;
                        iVar2 = FUN_004027d8((int)local_68,(int)local_a4);
                        cVar6 = iVar2 == 0;
                        local_a8 = local_a4;
                        puVar4 = local_a4 + 3;
                        *puVar4 = *puVar4 - 1;
                        if (*puVar4 == 0) {
                          FUN_004024d8((int *)local_a4,3);
                        }
                        if (cVar6 == '\0') {
                          puVar4 = (uint *)FUN_00402298(0x10);
                          if (puVar4 == (uint *)0x0) {
                            local_ac = (uint *)0x0;
                          }
                          else {
                            local_ac = FUN_00402460(puVar4,&DAT_004e3b2d);
                          }
                          local_ac[3] = local_ac[3] + 1;
                          iVar2 = FUN_004027d8((int)local_68,(int)local_ac);
                          cVar6 = iVar2 == 0;
                          local_b0 = local_ac;
                          puVar4 = local_ac + 3;
                          *puVar4 = *puVar4 - 1;
                          if (*puVar4 == 0) {
                            FUN_004024d8((int *)local_ac,3);
                          }
                          if (cVar6 != '\0') {
                            local_70 = 7;
                          }
                        }
                        else {
                          local_70 = 6;
                        }
                      }
                      else {
                        local_70 = 5;
                      }
                    }
                    else {
                      local_70 = 4;
                    }
                  }
                  else {
                    local_70 = 3;
                  }
                }
                else {
                  local_70 = 2;
                }
              }
              else {
                local_70 = 1;
              }
            }
            else {
              local_70 = 0;
            }
            local_b4 = param_5;
            (**(code **)(*param_5 + 0x20))(param_5,&local_70,4);
            local_b8 = (int *)FUN_004064fc(*(char **)(param_7 + 0x10),(char *)puVar1[1]);
            piVar5 = (int *)FUN_00402298(0x20);
            if (piVar5 == (int *)0x0) {
              local_bc = (int *)0x0;
            }
            else {
              local_bc = FUN_00403e84(piVar5,(char *)local_b8,1);
            }
            local_c0 = FUN_00404720((int)local_bc,(char *)param_4[2],s_material_004e3b32);
            local_c4 = 0;
            if (local_c0 == (int *)0x0) {
              (**(code **)(*param_5 + 0x20))(param_5,&local_c4,4);
            }
            else {
              local_c4 = FUN_00403b60((int)local_c0);
              local_c8 = param_5;
              (**(code **)(*param_5 + 0x20))(param_5,&local_c4,4);
              if (local_c4 != 0) {
                puVar3 = (undefined4 *)local_c0[1];
                local_d0 = (undefined4 *)FUN_00402298(0x10);
                if (local_d0 == (undefined4 *)0x0) {
                  local_cc = (int *)0x0;
                }
                else {
                  local_cc = (int *)FUN_004023f4(local_d0);
                }
                local_cc[3] = local_cc[3] + 1;
                for (; puVar3 != (undefined4 *)0x0; puVar3 = (undefined4 *)*puVar3) {
                  FUN_00402a98((int *)&local_d4,(int *)&local_cc,(char *)puVar3[1]);
                  piVar5 = local_d4 + 3;
                  *piVar5 = *piVar5 + -1;
                  if (*piVar5 == 0) {
                    FUN_004024d8(local_d4,3);
                  }
                  FUN_004029b0(param_5,(int)local_cc);
                }
                piVar5 = local_cc + 3;
                *piVar5 = *piVar5 + -1;
                if (*piVar5 == 0) {
                  FUN_004024d8(local_cc,3);
                }
              }
              if (local_c0 != (int *)0x0) {
                (**(code **)*local_c0)(local_c0,3);
              }
            }
            puVar1 = (undefined4 *)*puVar1;
            FUN_004022d0(local_b8);
            FUN_00403ecc(local_bc,3);
            piVar5 = local_68 + 3;
            *piVar5 = *piVar5 + -1;
            if (*piVar5 == 0) {
              FUN_004024d8(local_68,3);
            }
          }
        }
        if (local_50 != (int *)0x0) {
          (**(code **)*local_50)(local_50,3);
        }
        uVar7 = 1;
        piVar5 = param_4 + 3;
        *piVar5 = *piVar5 + -1;
        if (*piVar5 == 0) {
          FUN_004024d8(param_4,3);
        }
      }
    }
  }
  return uVar7;
}



/* @0041f07c file=? name=FUN_0041f07c */

undefined4 __cdecl FUN_0041f07c(int *param_1,char *param_2,int param_3,int param_4,char *param_5)

{
  int *piVar1;
  undefined4 *puVar2;
  int *piVar3;
  undefined4 *puVar4;
  undefined4 uVar5;
  int *local_14;
  int local_10;
  int *local_c;
  int local_8;
  
  local_8 = 0;
  piVar3 = FUN_00404720(param_3,param_2,param_5);
  if (piVar3 == (int *)0x0) {
    (**(code **)(*param_1 + 0x20))(param_1,&local_8,4);
  }
  else {
    local_8 = FUN_00403b60((int)piVar3);
    (**(code **)(*param_1 + 0x20))(param_1,&local_8,4);
    puVar2 = (undefined4 *)piVar3[1];
    puVar4 = (undefined4 *)FUN_00402298(0x10);
    if (puVar4 == (undefined4 *)0x0) {
      local_c = (int *)0x0;
    }
    else {
      local_c = (int *)FUN_004023f4(puVar4);
    }
    local_c[3] = local_c[3] + 1;
    for (; puVar2 != (undefined4 *)0x0; puVar2 = (undefined4 *)*puVar2) {
      FUN_00402a98((int *)&local_14,(int *)&local_c,(char *)puVar2[1]);
      piVar1 = local_14 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_14,3);
      }
      local_c[3] = local_c[3] + 1;
      local_10 = FUN_0042760c(local_c,param_4);
      if (local_10 == -1) {
        FUN_004dbb24((int *)&DAT_00524e68,(char *)local_c[2],(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_not_found_in_skl_file___004e3b3b,(char *)0x0);
        FUN_004d9c38((int *)&DAT_00524e68);
        if (piVar3 != (int *)0x0) {
          (**(code **)*piVar3)(piVar3,3);
        }
        uVar5 = 0xffffffff;
        piVar3 = local_c + 3;
        *piVar3 = *piVar3 + -1;
        if (*piVar3 == 0) {
          FUN_004024d8(local_c,3);
          return uVar5;
        }
        return 0xffffffff;
      }
      (**(code **)(*param_1 + 0x20))(param_1,&local_10,4);
    }
    if (piVar3 != (int *)0x0) {
      (**(code **)*piVar3)(piVar3,3);
    }
    piVar3 = local_c + 3;
    *piVar3 = *piVar3 + -1;
    if (*piVar3 == 0) {
      FUN_004024d8(local_c,3);
    }
  }
  return 1;
}



/* @0041f1f7 file=? name=FUN_0041f1f7 */

undefined4 * __cdecl FUN_0041f1f7(undefined4 *param_1,int param_2)

{
  FUN_004194d8(param_1,param_2);
  *param_1 = &PTR_FUN_004e3c94;
  return param_1;
}



/* @0041f216 file=? name=FUN_0041f216 */

undefined4 * __cdecl FUN_0041f216(undefined4 *param_1,int param_2)

{
  FUN_004194d8(param_1,param_2);
  *param_1 = &PTR_FUN_004e3c94;
  return param_1;
}



/* @0041f235 file=? name=FUN_0041f235 */

void __cdecl FUN_0041f235(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3c94;
    FUN_0041951c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f261 file=? name=FUN_0041f261 */

undefined4 * __cdecl FUN_0041f261(undefined4 *param_1,int param_2)

{
  FUN_004194d8(param_1,param_2);
  *param_1 = &PTR_FUN_004e3c38;
  return param_1;
}



/* @0041f280 file=? name=FUN_0041f280 */

undefined4 * __cdecl FUN_0041f280(undefined4 *param_1,int param_2)

{
  FUN_004194d8(param_1,param_2);
  *param_1 = &PTR_FUN_004e3c38;
  return param_1;
}



/* @0041f29f file=? name=FUN_0041f29f */

void __cdecl FUN_0041f29f(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3c38;
    FUN_0041951c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f2cb file=? name=FUN_0041f2cb */

undefined4 * __cdecl FUN_0041f2cb(undefined4 *param_1,undefined4 param_2)

{
  FUN_0041827c(param_1,param_2);
  *param_1 = &PTR_FUN_004e3c30;
  return param_1;
}



/* @0041f2ea file=? name=FUN_0041f2ea */

void __cdecl FUN_0041f2ea(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3c30;
    FUN_004182a8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f316 file=? name=FUN_0041f316 */

undefined4 * __cdecl FUN_0041f316(undefined4 *param_1,int param_2)

{
  FUN_00418398(param_1,param_2);
  *param_1 = &PTR_FUN_004e3bdc;
  return param_1;
}



/* @0041f335 file=? name=FUN_0041f335 */

undefined4 * __cdecl FUN_0041f335(undefined4 *param_1,int param_2)

{
  FUN_00418398(param_1,param_2);
  *param_1 = &PTR_FUN_004e3bdc;
  return param_1;
}



/* @0041f354 file=? name=FUN_0041f354 */

undefined4 * __cdecl FUN_0041f354(undefined4 *param_1,int param_2)

{
  FUN_004183c0(param_1,param_2);
  *param_1 = &PTR_FUN_004e3bdc;
  return param_1;
}



/* @0041f373 file=? name=FUN_0041f373 */

void __cdecl FUN_0041f373(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3bdc;
    FUN_004183ec(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f39f file=? name=FUN_0041f39f */

undefined4 * __cdecl FUN_0041f39f(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00419184(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e3bc0;
  return param_1;
}



/* @0041f3c2 file=? name=FUN_0041f3c2 */

void __cdecl FUN_0041f3c2(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3bc0;
    FUN_004191b4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f3ee file=? name=FUN_0041f3ee */

undefined4 __cdecl FUN_0041f3ee(undefined4 param_1,int param_2,int param_3)

{
  undefined4 uVar1;
  
  if (*(int *)(param_3 + 0x14) == *(int *)(param_2 + 0x14)) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
    if (*(int *)(param_2 + 0x14) <= *(int *)(param_3 + 0x14)) {
      uVar1 = 0xffffffff;
    }
  }
  return uVar1;
}



/* @0041f41d file=? name=FUN_0041f41d */

undefined4 __cdecl FUN_0041f41d(undefined4 param_1,int *param_2,int param_3)

{
  undefined4 uVar1;
  
  if (*(int *)(param_3 + 0x14) == *param_2) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
    if (*param_2 <= *(int *)(param_3 + 0x14)) {
      uVar1 = 0xffffffff;
    }
  }
  return uVar1;
}



/* @0041f449 file=? name=FUN_0041f449 */

undefined4 * __cdecl FUN_0041f449(undefined4 *param_1,undefined4 param_2)

{
  FUN_0041827c(param_1,param_2);
  *param_1 = &PTR_FUN_004e3bb8;
  return param_1;
}



/* @0041f468 file=? name=FUN_0041f468 */

void __cdecl FUN_0041f468(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3bb8;
    FUN_004182a8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f494 file=? name=FUN_0041f494 */

undefined4 * __cdecl FUN_0041f494(undefined4 *param_1,int param_2)

{
  FUN_00418398(param_1,param_2);
  *param_1 = &PTR_FUN_004e3b64;
  return param_1;
}



/* @0041f4b3 file=? name=FUN_0041f4b3 */

undefined4 * __cdecl FUN_0041f4b3(undefined4 *param_1,int param_2)

{
  FUN_00418398(param_1,param_2);
  *param_1 = &PTR_FUN_004e3b64;
  return param_1;
}



/* @0041f4d2 file=? name=FUN_0041f4d2 */

undefined4 * __cdecl FUN_0041f4d2(undefined4 *param_1,int param_2)

{
  FUN_004183c0(param_1,param_2);
  *param_1 = &PTR_FUN_004e3b64;
  return param_1;
}



/* @0041f4f1 file=? name=FUN_0041f4f1 */

void __cdecl FUN_0041f4f1(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e3b64;
    FUN_004183ec(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041f51d file=? name=FUN_0041f51d */

undefined4 * __cdecl FUN_0041f51d(undefined4 param_1,int param_2,undefined4 *param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_0041d485();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0041d42e(puVar1,param_1,param_2,param_3);
  }
  return puVar1;
}



/* @0041f54d file=? name=FUN_0041f54d */

void __cdecl FUN_0041f54d(int param_1,int param_2)

{
  FUN_0041bbd8(param_1 + 100,param_2);
  *(uint *)(param_1 + 0xb8) = *(uint *)(param_1 + 0xb8) | 8;
  return;
}



/* @0041f59c file=? name=FUN_0041f59c */

void __cdecl FUN_0041f59c(int param_1,uint *param_2)

{
  if ((int)param_2[1] < 3) {
    FUN_00419bbc(param_1,(int)param_2);
  }
  FUN_00420ef4(param_2 + 3,(undefined4 *)(param_1 + 0x184));
  param_2[5] = *(uint *)(param_1 + 0x194);
  if ((*(uint *)(param_1 + 0x28) & 0xc) == 4) {
    (**(code **)(**(int **)(DAT_004efc94 + 0x20) + 0x18))
              (*(int **)(DAT_004efc94 + 0x20),param_2,1,*(undefined4 *)(param_1 + 0x18c));
  }
  else if ((*(byte *)(param_1 + 0x28) & 0x10) == 0) {
    FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),1,param_1,param_2,DAT_004e17f4);
  }
  else {
    FUN_00419bbc(param_1,(int)param_2);
  }
  return;
}



/* @0041f640 file=? name=FUN_0041f640 */

void __cdecl FUN_0041f640(int param_1,uint *param_2)

{
  FUN_00420ef4(param_2 + 3,(undefined4 *)(param_1 + 0x184));
  param_2[5] = *(uint *)(param_1 + 0x194);
  FUN_00434ea0(*(undefined4 *)(DAT_004efc94 + 0x30),param_1,param_2);
  return;
}



/* @0041f680 file=? name=FUN_0041f680 */

void __cdecl FUN_0041f680(int param_1,int *param_2,int param_3)

{
  if (param_3 == 0) {
    FUN_0041bd60(param_1,param_2,0);
    FUN_0040a938(param_2 + 4,(undefined4 *)(param_1 + 0x100));
    FUN_0040a938((undefined4 *)(param_1 + 300),(undefined4 *)(param_1 + 0x100));
    *param_2 = 0x2c;
  }
  else if (param_3 == 1) {
    param_2[2] = *(int *)(param_1 + 0x10);
    *(undefined2 *)((int)param_2 + 6) = 1;
    FUN_0041f858(param_1,param_2);
  }
  else {
    FUN_0041bd60(param_1,param_2,(short)param_3);
  }
  *(undefined2 *)(param_2 + 1) = 0;
  return;
}



/* @0041f710 file=? name=FUN_0041f710 */

void __cdecl FUN_0041f710(int param_1,undefined4 *param_2)

{
  int *piVar1;
  int *piVar2;
  undefined4 local_14;
  int local_10;
  int *local_c;
  int local_8;
  
  FUN_004030dc(&local_14,param_2,*param_2,0x1c);
  for (; piVar1 = local_c, local_8 != (int)local_c - local_10;
      local_c = (int *)((int)local_c + *piVar1)) {
    piVar2 = (int *)FUN_0041f964(param_1,*(ushort *)(local_c + 1) - 1);
    (**(code **)(*piVar2 + 0x18))(piVar2,piVar1);
  }
  return;
}



/* @0041f76c file=? name=FUN_0041f76c */

void __cdecl FUN_0041f76c(int param_1,undefined4 *param_2)

{
  if (*(short *)((int)param_2 + 6) == 0) {
    FUN_0040a938((undefined4 *)(param_1 + 300),param_2 + 4);
    if ((*(int *)(DAT_004efc94 + 0x88) < 5) || (*(int *)(DAT_004efc94 + 0x88) == 0xb)) {
      FUN_0040a938((undefined4 *)(param_1 + 0x100),(undefined4 *)(param_1 + 300));
      FUN_0040ab44((float *)(param_1 + 0xd0),(undefined4 *)(param_1 + 0x100));
    }
    FUN_0041bd34(param_1,(int)param_2);
  }
  else if (*(short *)((int)param_2 + 6) == 1) {
    FUN_0041f800(param_1,param_2);
  }
  else {
    FUN_0041bd34(param_1,(int)param_2);
  }
  return;
}



/* @0041f800 file=? name=FUN_0041f800 */

void __cdecl FUN_0041f800(int param_1,undefined4 *param_2)

{
  int *piVar1;
  int *piVar2;
  undefined4 local_14;
  int local_10;
  int *local_c;
  int local_8;
  
  FUN_004030dc(&local_14,param_2,*param_2,0x10);
  for (; piVar2 = local_c, local_8 != (int)local_c - local_10;
      local_c = (int *)((int)local_c + *piVar2)) {
    piVar1 = *(int **)(*(int *)(param_1 + 0x120) + local_c[1] * 4);
    (**(code **)(*piVar1 + 0x10))(piVar1,local_c);
  }
  return;
}



/* @0041f858 file=? name=FUN_0041f858 */

void __cdecl FUN_0041f858(int param_1,int *param_2)

{
  int *piVar1;
  int *piVar2;
  int iVar3;
  undefined4 local_18 [2];
  int *local_10;
  int *local_8;
  
  FUN_004030dc(local_18,param_2,0x578 - (int)(param_2 + -0x1487eb),0x10);
  local_8 = local_10;
  for (iVar3 = 0; piVar2 = local_10, iVar3 < *(int *)(param_1 + 0x11c); iVar3 = iVar3 + 1) {
    piVar1 = *(int **)(*(int *)(param_1 + 0x120) + iVar3 * 4);
    (**(code **)(*piVar1 + 0x14))(piVar1,local_10);
    local_10 = (int *)((int)local_10 + *piVar2);
  }
  if (local_10 != local_8) {
    *param_2 = (int)local_10 - (int)param_2;
  }
  return;
}



/* @0041f8d4 file=? name=FUN_0041f8d4 */

undefined4 * __cdecl FUN_0041f8d4(int *param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 *puVar2;
  int local_14 [2];
  int local_c;
  
  FUN_004030dc(local_14,&DAT_00521fac,0x578,0x1c);
  iVar1 = local_c;
  if (((*(int *)(DAT_004efc94 + 0x88) == 5) || (*(int *)(DAT_004efc94 + 0x88) == 6)) ||
     ((*(byte *)((int)param_1 + 0x29) & 0x10) != 0)) {
    (**(code **)(*param_1 + 0x14))(param_1,param_2,local_14);
  }
  else {
    FUN_0041bd98(param_1,local_14);
  }
  if (iVar1 == local_c) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = &DAT_00521fac;
    DAT_00521fb0 = 0xf;
    DAT_00521fac = local_c + -0x521fac;
    DAT_00521fb4 = 0;
  }
  return puVar2;
}



/* @0041f964 file=? name=FUN_0041f964 */

int __cdecl FUN_0041f964(int param_1,uint param_2)

{
  if (param_2 != 0xffffffff) {
    if (param_2 < *(uint *)(param_1 + 0x124)) {
      return *(int *)(*(int *)(param_1 + 0x128) + param_2 * 4);
    }
    param_1 = 0;
  }
  return param_1;
}



