/* @0048a598 file=? name=FUN_0048a598 */

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

undefined4 __cdecl FUN_0048a598(int param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetRenderProperty_005064b8);
  if (param_1 < 0x10) {
    if (param_1 == 8) {
      *param_2 = _DAT_00507930;
    }
    uVar1 = (&DAT_00523d08)[param_1 * 2];
  }
  else {
    uVar1 = 0;
  }
  return uVar1;
}



/* @0048a5d8 file=? name=FUN_0048a5d8 */

void __cdecl FUN_0048a5d8(int param_1,undefined4 *param_2)

{
  FUN_0049a300(4,s_dpl_SetDCSMatrix_005064cf);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if ((param_1 == 0) || (param_2 == (undefined4 *)0x0)) {
    FUN_00489578(s_NULL_dcs_in_setDCSmatrix_005064e1);
  }
  else {
    FUN_004d4918((undefined4 *)(param_1 + 0x18),param_2,0x40);
  }
  return;
}



/* @0048a630 file=? name=FUN_0048a630 */

int __cdecl FUN_0048a630(int param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_GetDCSMatrix_005064fb);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (param_1 != 0) {
    return param_1 + 0x18;
  }
  iVar1 = FUN_00489578(s_NULL_dcs_in_getDCSmatrix_0050650d);
  return iVar1;
}



/* @0048a674 file=? name=FUN_0048a674 */

void __cdecl FUN_0048a674(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetDCSReorientAxes_00506527);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_dcs_in_setDCSreorientaxes_0050653f);
  }
  else {
    *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xffffffc7 | param_2 << 3;
  }
  return;
}



/* @0048a6cc file=? name=FUN_0048a6cc */

uint __cdecl FUN_0048a6cc(int param_1)

{
  uint uVar1;
  
  FUN_0049a300(4,s_dpl_GetDCSReorientAxes_0050655f);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (param_1 != 0) {
    return *(int *)(param_1 + 0x58) >> 3 & 7;
  }
  uVar1 = FUN_00489578(s_NULL_dcs_in_getDCSreorientaxes_00506577);
  return uVar1;
}



/* @0048a714 file=? name=FUN_0048a714 */

void __cdecl FUN_0048a714(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetDCSZone_00506597);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,2);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_dcs_in_setDCSzone_005065a7);
  }
  else {
    *(int *)(param_1 + 0x14) = param_2;
  }
  return;
}



/* @0048a770 file=? name=FUN_0048a770 */

undefined4 __cdecl FUN_0048a770(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetDCSZone_005065bf);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (param_1 != 0) {
    if (DAT_00505b64 != 0) {
      FUN_00489594(*(int *)(param_1 + 0x14),2);
    }
    return *(undefined4 *)(param_1 + 0x14);
  }
  uVar1 = FUN_00489578(s_NULL_dcs_in_getDCSzone_005065cf);
  return uVar1;
}



/* @0048a7cc file=? name=FUN_0048a7cc */

void __cdecl FUN_0048a7cc(int param_1,undefined4 *param_2)

{
  FUN_0049a300(4,s_dpl_SetDCSBound_005065e7);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (param_1 != 0) {
    if (param_2 != (undefined4 *)0x0) {
      FUN_004d4918((undefined4 *)(param_1 + 0x6c),param_2,0x20);
      *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) | 0x800;
      return;
    }
    *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xfffff7ff;
    return;
  }
  FUN_00489578(s_NULL_dcs_in_setDCSBounds_005065f8);
  return;
}



/* @0048a834 file=? name=FUN_0048a834 */

int __cdecl FUN_0048a834(int param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_GetDCSBound_00506612);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,5);
  }
  if (param_1 != 0) {
    return param_1 + 0x6c;
  }
  iVar1 = FUN_00489578(s_NULL_dcs_in_getDCSbound_00506623);
  return iVar1;
}



/* @0048a878 file=? name=FUN_0048a878 */

void FUN_0048a878(void)

{
  return;
}



/* @0048a880 file=? name=FUN_0048a880 */

void FUN_0048a880(void)

{
  return;
}



/* @0048a888 file=? name=FUN_0048a888 */

void FUN_0048a888(void)

{
  return;
}



/* @0048a890 file=? name=FUN_0048a890 */

void __cdecl FUN_0048a890(int param_1)

{
  FUN_0049a300(4,s_dpl_SetZoneAllViewsOn_0050663c);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x10) = 0xfffffff;
    return;
  }
  FUN_00489578(s_NULL_zone_00506653);
  return;
}



/* @0048a8d8 file=? name=FUN_0048a8d8 */

void __cdecl FUN_0048a8d8(int param_1)

{
  FUN_0049a300(4,s_dpl_SetZoneAllViewsOff_0050665e);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x10) = 0;
    return;
  }
  FUN_00489578(s_NULL_zone_00506676);
  return;
}



/* @0048a91c file=? name=FUN_0048a91c */

void __cdecl FUN_0048a91c(int param_1,int param_2)

{
  uint unaff_EDI;
  
  FUN_0049a300(4,s_dpl_SetZoneViewOn_00506681);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (param_2 == 0) {
    FUN_00489578(s_NULL_view_00506694);
  }
  else {
    unaff_EDI = 1 << ((byte)*(undefined4 *)(param_2 + 0x18) & 0x1f);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_zone_0050669f);
  }
  else {
    *(uint *)(param_1 + 0x10) = *(uint *)(param_1 + 0x10) | unaff_EDI;
  }
  return;
}



/* @0048a980 file=? name=FUN_0048a980 */

void __cdecl FUN_0048a980(int param_1,int param_2)

{
  uint unaff_EDI;
  
  FUN_0049a300(4,s_dpl_SetZoneViewOff_005066aa);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,3);
  }
  if (param_2 == 0) {
    FUN_00489578(s_NULL_view_005066be);
  }
  else {
    unaff_EDI = 1 << ((byte)*(undefined4 *)(param_2 + 0x18) & 0x1f);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_zone_005066c9);
  }
  else {
    *(uint *)(param_1 + 0x10) = *(uint *)(param_1 + 0x10) & ~unaff_EDI;
  }
  return;
}



/* @0048a9fc file=? name=FUN_0048a9fc */

bool __cdecl FUN_0048a9fc(int param_1,int param_2)

{
  uint unaff_EDI;
  
  FUN_0049a300(4,s_dpl_GetZoneView_005066d4);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,3);
  }
  if (param_2 == 0) {
    FUN_00489578(s_NULL_view_005066e5);
  }
  else {
    unaff_EDI = 1 << ((byte)*(undefined4 *)(param_2 + 0x18) & 0x1f);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_zone_005066f0);
  }
  else {
    unaff_EDI = unaff_EDI & *(uint *)(param_1 + 0x10);
  }
  return unaff_EDI != 0;
}



/* @0048aa80 file=? name=FUN_0048aa80 */

void __cdecl FUN_0048aa80(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetZoneBitmask_005066fb);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x10) = param_2;
    return;
  }
  FUN_00489578(s_NULL_zone_0050670f);
  return;
}



/* @0048aac8 file=? name=FUN_0048aac8 */

undefined4 __cdecl FUN_0048aac8(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetZoneBitmask_0050671a);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,2);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x10);
  }
  uVar1 = FUN_00489578(s_NULL_zone_0050672e);
  return uVar1;
}



/* @0048ab0c file=? name=FUN_0048ab0c */

void __cdecl FUN_0048ab0c(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceObject_00506739);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,7);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_instance_00506750);
  }
  else {
    *(int *)(param_1 + 0x20) = param_2;
  }
  return;
}



/* @0048ab68 file=? name=FUN_0048ab68 */

undefined4 __cdecl FUN_0048ab68(int param_1)

{
  FUN_0049a300(4,s_dpl_GetInstanceObject_0050675f);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x20);
  }
  return 0;
}



/* @0048aba4 file=? name=FUN_0048aba4 */

void __cdecl FUN_0048aba4(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceForceLod_00506776);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x24) = param_2;
    return;
  }
  FUN_00489578(s_NULL_instance_0050678f);
  return;
}



/* @0048abec file=? name=FUN_0048abec */

undefined4 __cdecl FUN_0048abec(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetInstanceForceLod_0050679e);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x24);
  }
  uVar1 = FUN_00489578(s_NULL_instance_005067b7);
  return uVar1;
}



/* @0048ac30 file=? name=FUN_0048ac30 */

void __cdecl FUN_0048ac30(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceVisibility_005067c6);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x1c) = param_2;
    return;
  }
  FUN_00489578(s_NULL_instance_005067e1);
  return;
}



/* @0048ac78 file=? name=FUN_0048ac78 */

undefined4 __cdecl FUN_0048ac78(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetInstanceVisibility_005067f0);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x1c);
  }
  uVar1 = FUN_00489578(s_NULL_instance_0050680b);
  return uVar1;
}



/* @0048acbc file=? name=FUN_0048acbc */

void __cdecl FUN_0048acbc(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceWireframe_0050681a);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x34) = param_2;
    return;
  }
  FUN_00489578(s_NULL_instance_00506834);
  return;
}



/* @0048ad04 file=? name=FUN_0048ad04 */

undefined4 __cdecl FUN_0048ad04(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetInstanceWireframe_00506843);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x34);
  }
  uVar1 = FUN_00489578(s_NULL_instance_0050685d);
  return uVar1;
}



/* @0048ad48 file=? name=FUN_0048ad48 */

void __cdecl FUN_0048ad48(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceIntersect_0050686c);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x18) = param_2;
    return;
  }
  FUN_00489578(s_NULL_instance_00506886);
  return;
}



/* @0048ad90 file=? name=FUN_0048ad90 */

undefined4 __cdecl FUN_0048ad90(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetInstanceIntersect_00506895);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x18);
  }
  uVar1 = FUN_00489578(s_NULL_instance_005068af);
  return uVar1;
}



/* @0048add4 file=? name=FUN_0048add4 */

void __cdecl FUN_0048add4(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceSectMask_005068be);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x30) = param_2;
  }
  return;
}



/* @0048ae0c file=? name=FUN_0048ae0c */

undefined4 __cdecl FUN_0048ae0c(int param_1)

{
  FUN_0049a300(4,s_dpl_GetInstanceSectMask_005068d7);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x30);
  }
  return 0;
}



/* @0048ae48 file=? name=FUN_0048ae48 */

void __cdecl FUN_0048ae48(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceFrontMaterial_005068f0);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x28) = param_2;
    return;
  }
  FUN_00489578(s_NULL_instance_0050690e);
  return;
}



/* @0048ae90 file=? name=FUN_0048ae90 */

void __cdecl FUN_0048ae90(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetInstanceBackMaterial_0050691d);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x2c) = param_2;
    return;
  }
  FUN_00489578(s_NULL_instance_0050693a);
  return;
}



/* @0048aed8 file=? name=FUN_0048aed8 */

undefined4 __cdecl FUN_0048aed8(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetInstanceFrontMaterial_00506949);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x28);
  }
  uVar1 = FUN_00489578(s_NULL_instance_00506967);
  return uVar1;
}



/* @0048af1c file=? name=FUN_0048af1c */

undefined4 __cdecl FUN_0048af1c(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetInstanceBackMaterial_00506976);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,4);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x2c);
  }
  uVar1 = FUN_00489578(s_NULL_instance_00506993);
  return uVar1;
}



/* @0048af60 file=? name=FUN_0048af60 */

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

{
  FUN_0049a300(4,s_dpl_SetObjectLodRange_005069a2);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  if (param_2 < 0x10) {
    *(undefined4 *)(param_1 + 0x30 + param_2 * 4) = param_3;
  }
  return;
}



/* @0048afa0 file=? name=FUN_0048afa0 */

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

float10 __cdecl FUN_0048afa0(int param_1,int param_2)

{
  float fVar1;
  
  FUN_0049a300(4,s_dpl_GetObjectLodRange_005069b9);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  fVar1 = _DAT_0048afe4;
  if (param_2 < 0x10) {
    fVar1 = *(float *)(param_1 + 0x30 + param_2 * 4);
  }
  return (float10)fVar1;
}



/* @0048afe8 file=? name=FUN_0048afe8 */

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

{
  FUN_0049a300(4,s_dpl_SetObjectLodHotSpot_005069d0);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x20) = param_2;
    *(undefined4 *)(param_1 + 0x24) = param_3;
    *(undefined4 *)(param_1 + 0x28) = param_4;
  }
  return;
}



/* @0048b02c file=? name=FUN_0048b02c */

void __cdecl FUN_0048b02c(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetObjectLodHotSpot_005069e9);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x20);
    *param_3 = *(undefined4 *)(param_1 + 0x24);
    *param_4 = *(undefined4 *)(param_1 + 0x28);
  }
  return;
}



/* @0048b078 file=? name=FUN_0048b078 */

void __cdecl FUN_0048b078(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetObjectLodFadeRange_00506a02);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x70) = param_2;
  }
  return;
}



/* @0048b0b0 file=? name=FUN_0048b0b0 */

float10 __cdecl FUN_0048b0b0(int param_1)

{
  int iVar1;
  float10 fVar2;
  
  FUN_0049a300(4,s_dpl_GetObjectLodFadeRange_00506a1d);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  if (param_1 == 0) {
    iVar1 = FUN_00489578(s_NULL_Object_00506a38);
    fVar2 = (float10)iVar1;
  }
  else {
    fVar2 = (float10)*(float *)(param_1 + 0x70);
  }
  return fVar2;
}



/* @0048b0fc file=? name=FUN_0048b0fc */

void __cdecl FUN_0048b0fc(int param_1)

{
  FUN_0049a300(4,s_dpl_InvalidateLodRanges_00506a45);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,7);
  }
  if (param_1 != 0) {
    *(uint *)(param_1 + 0x74) = *(uint *)(param_1 + 0x74) | 1;
  }
  return;
}



/* @0048b134 file=? name=FUN_0048b134 */

void __cdecl FUN_0048b134(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetLightDCS_00506a5e);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_light_00506a6f);
  }
  else {
    if (*(int *)(param_1 + 0x14) != 0) {
      FUN_00489638(*(int *)(param_1 + 0x14),param_1);
    }
    if (param_2 != 0) {
      FUN_00489d90(param_2,param_1);
    }
    *(int *)(param_1 + 0x14) = param_2;
  }
  return;
}



/* @0048b19c file=? name=FUN_0048b19c */

undefined4 __cdecl FUN_0048b19c(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetLightDCS_00506a7b);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x14);
  }
  uVar1 = FUN_00489578(s_NULL_light_00506a8c);
  return uVar1;
}



/* @0048b1e0 file=? name=FUN_0048b1e0 */

void __cdecl FUN_0048b1e0(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetLightType_00506a98);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x18) = param_2;
    return;
  }
  FUN_00489578(s_NULL_light_00506aaa);
  return;
}



/* @0048b228 file=? name=FUN_0048b228 */

undefined4 __cdecl FUN_0048b228(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetLightType_00506ab6);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x18);
  }
  uVar1 = FUN_00489578(s_NULL_light_00506ac8);
  return uVar1;
}



/* @0048b26c file=? name=FUN_0048b26c */

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

{
  FUN_0049a300(4,s_dpl_SetLightColor_00506ad4);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x1c) = param_2;
    *(undefined4 *)(param_1 + 0x20) = param_3;
    *(undefined4 *)(param_1 + 0x24) = param_4;
    return;
  }
  FUN_00489578(s_NULL_light_00506ae7);
  return;
}



/* @0048b2c0 file=? name=FUN_0048b2c0 */

void __cdecl FUN_0048b2c0(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetLightColor_00506af3);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x1c);
    *param_3 = *(undefined4 *)(param_1 + 0x20);
    *param_4 = *(undefined4 *)(param_1 + 0x24);
    return;
  }
  FUN_00489578(s_NULL_light_00506b06);
  return;
}



/* @0048b318 file=? name=FUN_0048b318 */

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

{
  FUN_0049a300(4,s_dpl_SetLightRadii_00506b12);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x28) = param_2;
    *(undefined4 *)(param_1 + 0x2c) = param_3;
    return;
  }
  FUN_00489578(s_NULL_light_00506b25);
  return;
}



/* @0048b364 file=? name=FUN_0048b364 */

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

{
  FUN_0049a300(4,s_dpl_GetLightRadii_00506b31);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x28);
    *param_3 = *(undefined4 *)(param_1 + 0x2c);
    return;
  }
  FUN_00489578(s_NULL_light_00506b44);
  return;
}



/* @0048b3b4 file=? name=FUN_0048b3b4 */

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

{
  FUN_0049a300(4,s_dpl_SetLightUmbra_00506b50);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x30) = param_2;
    *(undefined4 *)(param_1 + 0x34) = param_3;
    return;
  }
  FUN_00489578(s_NULL_light_00506b63);
  return;
}



/* @0048b400 file=? name=FUN_0048b400 */

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

{
  FUN_0049a300(4,s_dpl_GetLightUmbra_00506b6f);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,6);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x30);
    *param_3 = *(undefined4 *)(param_1 + 0x34);
    return;
  }
  FUN_00489578(s_NULL_light_00506b82);
  return;
}



/* @0048b450 file=? name=FUN_0048b450 */

void __cdecl FUN_0048b450(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_ViewShare_00506b8e);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,3);
  }
  if (param_2 == 0) {
    FUN_00489578(s_NULL_view_00506b9d);
  }
  else {
    *(int *)(param_2 + 0x68) = param_1;
  }
  return;
}



/* @0048b4ac file=? name=FUN_0048b4ac */

void __cdecl FUN_0048b4ac(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetViewDCS_00506ba8);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,5);
  }
  if ((param_1 == 0) || (param_2 == 0)) {
    FUN_00489578(s_NULL_view_00506bb8);
  }
  else {
    if (*(int *)(param_1 + 0x14) != 0) {
      FUN_00489638(*(int *)(param_1 + 0x14),param_1);
    }
    FUN_00489d90(param_2,param_1);
    *(int *)(param_1 + 0x14) = param_2;
  }
  return;
}



/* @0048b528 file=? name=FUN_0048b528 */

undefined4 __cdecl FUN_0048b528(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetViewDCS_00506bc3);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x14);
  }
  uVar1 = FUN_00489578(s_NULL_view_00506bd3);
  return uVar1;
}



/* @0048b56c file=? name=FUN_0048b56c */

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

{
  FUN_0049a300(4,s_dpl_SetViewClipplanes_00506bde);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x3c) = param_2;
    *(undefined4 *)(param_1 + 0x40) = param_3;
    return;
  }
  FUN_00489578(s_NULL_view_00506bf5);
  return;
}



/* @0048b5b8 file=? name=FUN_0048b5b8 */

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

{
  FUN_0049a300(4,s_dpl_GetViewClipplanes_00506c00);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x3c);
    *param_3 = *(undefined4 *)(param_1 + 0x40);
    return;
  }
  FUN_00489578(s_NULL_view_00506c17);
  return;
}



/* @0048b608 file=? name=FUN_0048b608 */

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

{
  FUN_0049a300(4,s_dpl_SetViewBackground_00506c22);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x44) = param_2;
    *(undefined4 *)(param_1 + 0x48) = param_3;
    *(undefined4 *)(param_1 + 0x4c) = param_4;
    return;
  }
  FUN_00489578(s_NULL_view_00506c39);
  return;
}



/* @0048b65c file=? name=FUN_0048b65c */

void __cdecl FUN_0048b65c(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetViewBackground_00506c44);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x44);
    *param_3 = *(undefined4 *)(param_1 + 0x48);
    *param_4 = *(undefined4 *)(param_1 + 0x4c);
    return;
  }
  FUN_00489578(s_NULL_view_00506c5b);
  return;
}



/* @0048b6b4 file=? name=FUN_0048b6b4 */

void __cdecl
FUN_0048b6b4(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            ,undefined4 param_6,undefined4 param_7)

{
  FUN_0049a300(4,s_dpl_SetViewFog_00506c66);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x50) = param_2;
    *(undefined4 *)(param_1 + 0x5c) = param_3;
    *(undefined4 *)(param_1 + 0x60) = param_4;
    *(undefined4 *)(param_1 + 100) = param_5;
    *(undefined4 *)(param_1 + 0x54) = param_6;
    *(undefined4 *)(param_1 + 0x58) = param_7;
    return;
  }
  FUN_00489578(s_NULL_view_00506c76);
  return;
}



/* @0048b718 file=? name=FUN_0048b718 */

void __cdecl
FUN_0048b718(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4,
            undefined4 *param_5,undefined4 *param_6,undefined4 *param_7)

{
  FUN_0049a300(4,s_dpl_GetViewFog_00506c81);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x50);
    *param_3 = *(undefined4 *)(param_1 + 0x5c);
    *param_4 = *(undefined4 *)(param_1 + 0x60);
    *param_5 = *(undefined4 *)(param_1 + 100);
    *param_6 = *(undefined4 *)(param_1 + 0x54);
    *param_7 = *(undefined4 *)(param_1 + 0x58);
    return;
  }
  FUN_00489578(s_NULL_view_00506c91);
  return;
}



/* @0048b788 file=? name=FUN_0048b788 */

void __cdecl FUN_0048b788(int param_1,int param_2)

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_SetViewPipe_00506c9c);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_view_00506cad);
  }
  else {
    *(int *)(param_1 + 0x1c) = param_2;
    iVar1 = param_2 * 0x10;
    *(float *)(param_1 + 0x34) =
         (float)*(int *)(&DAT_00523b40 + iVar1) - (float)*(int *)(&DAT_00523b38 + iVar1);
    *(float *)(param_1 + 0x38) =
         (float)*(int *)(&DAT_00523b44 + iVar1) - (float)*(int *)(&DAT_00523b3c + iVar1);
  }
  return;
}



/* @0048b7f8 file=? name=FUN_0048b7f8 */

undefined4 __cdecl FUN_0048b7f8(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetViewPipe_00506cb8);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x1c);
  }
  uVar1 = FUN_00489578(s_NULL_view_00506cc9);
  return uVar1;
}



/* @0048b83c file=? name=FUN_0048b83c */

void __cdecl
FUN_0048b83c(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            )

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_SetPipeWindow_00506cd4);
  if ((param_1 < 9) && (-1 < param_1)) {
    iVar1 = param_1 * 0x10;
    *(undefined4 *)(&DAT_00523b38 + iVar1) = param_2;
    *(undefined4 *)(&DAT_00523b40 + iVar1) = param_4;
    *(undefined4 *)(&DAT_00523b3c + iVar1) = param_3;
    *(undefined4 *)(&DAT_00523b44 + iVar1) = param_5;
    return;
  }
  FUN_00489578(s_invalid_pipe_identifier_00506ce7);
  return;
}



/* @0048b898 file=? name=FUN_0048b898 */

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

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_GetPipeWindow_00506d00);
  if ((param_1 < 9) && (-1 < param_1)) {
    iVar1 = param_1 * 0x10;
    *param_2 = *(undefined4 *)(&DAT_00523b38 + iVar1);
    *param_4 = *(undefined4 *)(&DAT_00523b40 + iVar1);
    *param_3 = *(undefined4 *)(&DAT_00523b3c + iVar1);
    *param_5 = *(undefined4 *)(&DAT_00523b44 + iVar1);
    return;
  }
  FUN_00489578(s_invalid_pipe_identifier_00506d13);
  return;
}



/* @0048b8fc file=? name=FUN_0048b8fc */

void __cdecl FUN_0048b8fc(int param_1)

{
  FUN_0049a300(4,s_dpl_SetViewPort_00506d2c);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    FUN_0049a300(4,s_dpl_SetViewPort__f__f__f__f_00506d3d);
    return;
  }
  FUN_00489578(s_NULL_view_00506d5a);
  return;
}



/* @0048b970 file=? name=FUN_0048b970 */

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

{
  FUN_0049a300(4,s_dpl_GetViewPort_00506d65);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *param_2 = 0;
    *param_3 = 0;
    *param_4 = 0x3f800000;
    *param_5 = 0x3f800000;
    return;
  }
  FUN_00489578(s_NULL_view_00506d76);
  return;
}



/* @0048b9d0 file=? name=FUN_0048b9d0 */

void __cdecl
FUN_0048b9d0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            ,undefined4 param_6)

{
  FUN_0049a300(4,s_dpl_SetViewProjection_00506d81);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x20) = param_2;
    *(undefined4 *)(param_1 + 0x24) = param_3;
    *(undefined4 *)(param_1 + 0x28) = param_4;
    *(undefined4 *)(param_1 + 0x2c) = param_5;
    *(undefined4 *)(param_1 + 0x30) = param_6;
    return;
  }
  FUN_00489578(s_NULL_view_00506d98);
  return;
}



/* @0048ba30 file=? name=FUN_0048ba30 */

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

{
  FUN_0049a300(4,s_dpl_GetViewProjection_00506da3);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x20);
    *param_3 = *(undefined4 *)(param_1 + 0x24);
    *param_4 = *(undefined4 *)(param_1 + 0x28);
    *param_5 = *(undefined4 *)(param_1 + 0x2c);
    *param_6 = *(undefined4 *)(param_1 + 0x30);
    return;
  }
  FUN_00489578(s_NULL_view_00506dba);
  return;
}



/* @0048ba98 file=? name=FUN_0048ba98 */

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

{
  FUN_0049a300(4,s_dpl_SetMaterialAmbient_00506dc5);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x2c) = param_2;
    *(undefined4 *)(param_1 + 0x30) = param_3;
    *(undefined4 *)(param_1 + 0x34) = param_4;
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506ddd);
  return;
}



/* @0048baf4 file=? name=FUN_0048baf4 */

void __cdecl FUN_0048baf4(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetMaterialAmbient_00506e02);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x2c);
    *param_3 = *(undefined4 *)(param_1 + 0x30);
    *param_4 = *(undefined4 *)(param_1 + 0x34);
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506e1a);
  return;
}



/* @0048bb54 file=? name=FUN_0048bb54 */

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

{
  FUN_0049a300(4,s_dpl_SetMaterialEmissive_00506e3f);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x20) = param_2;
    *(undefined4 *)(param_1 + 0x24) = param_3;
    *(undefined4 *)(param_1 + 0x28) = param_4;
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506e58);
  return;
}



/* @0048bbb0 file=? name=FUN_0048bbb0 */

void __cdecl FUN_0048bbb0(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetMaterialEmissive_00506e7d);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x20);
    *param_3 = *(undefined4 *)(param_1 + 0x24);
    *param_4 = *(undefined4 *)(param_1 + 0x28);
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506e96);
  return;
}



/* @0048bc10 file=? name=FUN_0048bc10 */

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

{
  FUN_0049a300(4,s_dpl_SetMaterialDiffuse_00506ebb);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x38) = param_2;
    *(undefined4 *)(param_1 + 0x3c) = param_3;
    *(undefined4 *)(param_1 + 0x40) = param_4;
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506ed3);
  return;
}



/* @0048bc6c file=? name=FUN_0048bc6c */

void __cdecl FUN_0048bc6c(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetMaterialDiffuse_00506ef8);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x38);
    *param_3 = *(undefined4 *)(param_1 + 0x3c);
    *param_4 = *(undefined4 *)(param_1 + 0x40);
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506f10);
  return;
}



/* @0048bccc file=? name=FUN_0048bccc */

void __cdecl
FUN_0048bccc(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            )

{
  FUN_0049a300(4,s_dpl_SetMaterialSpecular_00506f35);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x50) = param_2;
    *(undefined4 *)(param_1 + 0x54) = param_3;
    *(undefined4 *)(param_1 + 0x58) = param_4;
    *(undefined4 *)(param_1 + 0x5c) = param_5;
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506f4e);
  return;
}



/* @0048bd2c file=? name=FUN_0048bd2c */

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

{
  FUN_0049a300(4,s_dpl_GetMaterialSpecular_00506f73);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x50);
    *param_3 = *(undefined4 *)(param_1 + 0x54);
    *param_4 = *(undefined4 *)(param_1 + 0x58);
    *param_5 = *(undefined4 *)(param_1 + 0x5c);
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506f8c);
  return;
}



/* @0048bd94 file=? name=FUN_0048bd94 */

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

{
  FUN_0049a300(4,s_dpl_SetMaterialOpacity_00506fb1);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x44) = param_2;
    *(undefined4 *)(param_1 + 0x48) = param_3;
    *(undefined4 *)(param_1 + 0x4c) = param_4;
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00506fc9);
  return;
}



/* @0048bdf0 file=? name=FUN_0048bdf0 */

void __cdecl FUN_0048bdf0(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4)

{
  FUN_0049a300(4,s_dpl_GetMaterialOpacity_00506fee);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x44);
    *param_3 = *(undefined4 *)(param_1 + 0x48);
    *param_4 = *(undefined4 *)(param_1 + 0x4c);
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00507006);
  return;
}



/* @0048be50 file=? name=FUN_0048be50 */

void __cdecl FUN_0048be50(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetMaterialTexture_0050702b);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,0xc);
  }
  if (param_1 == 0) {
    FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00507043);
  }
  else {
    *(int *)(param_1 + 0x10) = param_2;
  }
  return;
}



/* @0048beb4 file=? name=FUN_0048beb4 */

undefined4 __cdecl FUN_0048beb4(int param_1)

{
  FUN_0049a300(4,s_dpl_GetMaterialTexture_00507068);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x10);
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00507080);
  return 0;
}



/* @0048bf00 file=? name=FUN_0048bf00 */

void __cdecl FUN_0048bf00(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetMaterialEnvironment_005070a5);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,0xc);
  }
  if (param_1 == 0) {
    FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_005070c1);
  }
  else {
    *(int *)(param_1 + 0x14) = param_2;
  }
  return;
}



/* @0048bf64 file=? name=FUN_0048bf64 */

undefined4 __cdecl FUN_0048bf64(int param_1)

{
  FUN_0049a300(4,s_dpl_GetMaterialEnvironment_005070e6);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x14);
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00507102);
  return 0;
}



/* @0048bfb0 file=? name=FUN_0048bfb0 */

void __cdecl FUN_0048bfb0(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetMaterialRamp_00507127);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,0xe);
  }
  if (param_1 == 0) {
    FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_0050713c);
  }
  else {
    *(int *)(param_1 + 0x1c) = param_2;
  }
  return;
}



/* @0048c014 file=? name=FUN_0048c014 */

undefined4 __cdecl FUN_0048c014(int param_1)

{
  FUN_0049a300(4,s_dpl_GetMaterialRamp_00507161);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xb);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x1c);
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_mater_00507176);
  return 0;
}



/* @0048c060 file=? name=FUN_0048c060 */

void __cdecl
FUN_0048c060(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            ,undefined4 param_6,undefined4 param_7)

{
  FUN_0049a300(4,s_dpl_SetRampComponents_0050719b);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xe);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x10) = param_2;
    *(undefined4 *)(param_1 + 0x14) = param_3;
    *(undefined4 *)(param_1 + 0x18) = param_4;
    *(undefined4 *)(param_1 + 0x1c) = param_5;
    *(undefined4 *)(param_1 + 0x20) = param_6;
    *(undefined4 *)(param_1 + 0x24) = param_7;
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_ramp_005071b2);
  return;
}



/* @0048c0cc file=? name=FUN_0048c0cc */

void __cdecl
FUN_0048c0cc(int param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4,
            undefined4 *param_5,undefined4 *param_6,undefined4 *param_7)

{
  FUN_0049a300(4,s_dpl_GetRampComponents_005071d3);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xe);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x10);
    *param_3 = *(undefined4 *)(param_1 + 0x14);
    *param_4 = *(undefined4 *)(param_1 + 0x18);
    *param_5 = *(undefined4 *)(param_1 + 0x1c);
    *param_6 = *(undefined4 *)(param_1 + 0x20);
    *param_7 = *(undefined4 *)(param_1 + 0x24);
    return;
  }
  FUN_0049a300(1,s_attempt_to_manipulate_NULL_ramp_005071ea);
  return;
}



/* @0048c144 file=? name=FUN_0048c144 */

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

{
  FUN_0049a300(4,s_dpl_SetTextureProperty_0x_x_0050720b);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xc);
  }
  switch(param_2) {
  default:
    FUN_0049a300(1,s_Illegal_property_0x_x_in_dpl_Set_00507228);
    break;
  case 1:
  case 2:
  case 3:
  case 4:
  case 7:
  case 8:
    break;
  case 5:
    *(undefined4 *)(param_1 + 0x14) = param_3;
    break;
  case 6:
    *(undefined4 *)(param_1 + 0x18) = param_3;
    break;
  case 10:
    *(undefined4 *)(param_1 + 0x40) = param_3;
  }
  if (*(int *)(param_1 + 0x18) == 10) {
    DAT_005081d8 = 1;
  }
  return;
}



/* @0048c1f0 file=? name=FUN_0048c1f0 */

undefined4 __cdecl FUN_0048c1f0(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_GetTextureProperty_0x_x_00507259);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xc);
  }
  switch(param_2) {
  default:
    FUN_0049a300(1,s_Illegal_property_0x_x_in_dpl_Get_00507276);
    return 0;
  case 1:
    return 0;
  case 2:
    return 0;
  case 3:
    return 0;
  case 4:
    return 0;
  case 5:
    return 0;
  case 6:
    return 0;
  case 7:
    return 0;
  case 8:
    return 0;
  case 10:
    return 0;
  }
}



/* @0048c2a0 file=? name=FUN_0048c2a0 */

void __cdecl FUN_0048c2a0(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetTextureTexmap_005072a7);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xc);
  }
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,0xd);
  }
  if (param_1 != 0) {
    *(int *)(param_1 + 0x10) = param_2;
  }
  return;
}



/* @0048c2f0 file=? name=FUN_0048c2f0 */

undefined4 __cdecl FUN_0048c2f0(int param_1)

{
  FUN_0049a300(4,s_dpl_GetTextureTexmap_005072bd);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xc);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x10);
  }
  return 0;
}



/* @0048c32c file=? name=FUN_0048c32c */

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

{
  FUN_0049a300(4,s_dpl_SetTexmapEdgeSize_005072d3);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x14) = param_2;
    *(undefined4 *)(param_1 + 0x18) = param_3;
    return;
  }
  FUN_00489578(s_NULL_texmap_in_settexmapsedgsize_005072ea);
  return;
}



/* @0048c378 file=? name=FUN_0048c378 */

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

{
  FUN_0049a300(4,s_dpl_GetTexmapEdgeSize_0050730b);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  if (param_1 != 0) {
    *param_2 = *(undefined4 *)(param_1 + 0x14);
    *param_3 = *(undefined4 *)(param_1 + 0x18);
    return;
  }
  FUN_00489578(s_NULL_texmap_in_gettexmapedgesize_00507322);
  return;
}



/* @0048c3c8 file=? name=FUN_0048c3c8 */

void __cdecl FUN_0048c3c8(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetTexmapTexelSize_00507343);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  if (param_1 == 0) {
    FUN_00489578(s_NULL_texmap_in_settexmaptexelsiz_0050735b);
  }
  else {
    *(int *)(param_1 + 0x1c) = param_2;
    if (param_2 == 1) {
      DAT_005081d8 = 1;
    }
  }
  return;
}



/* @0048c41c file=? name=FUN_0048c41c */

undefined4 __cdecl FUN_0048c41c(int param_1)

{
  undefined4 uVar1;
  
  FUN_0049a300(4,s_dpl_GetTexmapTexelSize_0050737d);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  if (param_1 != 0) {
    return *(undefined4 *)(param_1 + 0x1c);
  }
  uVar1 = FUN_00489578(s_NULL_texmap_in_gettexmaptexelsiz_00507395);
  return uVar1;
}



/* @0048c460 file=? name=FUN_0048c460 */

void __cdecl FUN_0048c460(int param_1,byte *param_2,int param_3,int param_4)

{
  FUN_0049a300(4,s_dpl_TexmapTexels2D_bpt__d_005073b7);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  FUN_0048da1c(param_1,param_2,param_3,param_4,DAT_005081d8,1);
  return;
}



/* @0048c4b0 file=? name=FUN_0048c4b0 */

void __cdecl FUN_0048c4b0(int param_1)

{
  FUN_0049a300(4,s_dpl_InvalidateTexels_005073d2);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  FUN_004d771c(s_INVALIDATE_texels_tm_0x_x_005073e8);
  return;
}



/* @0048c4e8 file=? name=FUN_0048c4e8 */

undefined4 __cdecl FUN_0048c4e8(int param_1,int param_2)

{
  if ((param_1 == 0x40) && (param_2 == 0x40)) {
    return 1;
  }
  if ((param_1 == 0x80) && (param_2 == 0x40)) {
    return 1;
  }
  if ((param_1 == 0x80) && (param_2 == 0x80)) {
    return 1;
  }
  if ((param_1 == 0x100) && (param_2 == 0x100)) {
    return 1;
  }
  return 0;
}



/* @0048c548 file=? name=FUN_0048c548 */

void __cdecl FUN_0048c548(int param_1,byte *param_2,int param_3,int param_4)

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_UpdateTexmapTexels2D_00507403);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  if (DAT_005081dc == (byte *)0x0) {
    DAT_005081dc = (byte *)FUN_00452c38(0x40000);
  }
  if (param_4 + param_3 <= *(int *)(param_1 + 0x14) * *(int *)(param_1 + 0x18)) {
    FUN_0048ee5c(param_1,(uint *)(DAT_005081dc + param_3 * 4),param_2,param_4,(uint)(param_3 == 0),
                 DAT_005081d8);
    iVar1 = FUN_0048c4e8(*(int *)(param_1 + 0x14),*(int *)(param_1 + 0x18));
    if (iVar1 == 0) {
      FUN_0049a300(4,s_Invalid_texture_size_for_VPX___d_0050741d);
    }
    else {
      FUN_0048da1c(param_1,DAT_005081dc,*(int *)(param_1 + 0x14),*(int *)(param_1 + 0x18),
                   DAT_005081d8,0);
    }
  }
  return;
}



/* @0048c61c file=? name=FUN_0048c61c */

void __cdecl FUN_0048c61c(int param_1)

{
  FUN_0049a300(4,s_dpl_GetTexmapTexels2D_texels_0x__00507445);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,0xd);
  }
  return;
}



/* @0048c654 file=? name=FUN_0048c654 */

void __cdecl FUN_0048c654(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetGeogroupFrontMaterial_00507472);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  *(undefined4 *)(param_1 + 0x48) = param_2;
  return;
}



/* @0048c688 file=? name=FUN_0048c688 */

void __cdecl FUN_0048c688(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetGeogroupBackMaterial_00507490);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  *(undefined4 *)(param_1 + 0x4c) = param_2;
  return;
}



/* @0048c6bc file=? name=FUN_0048c6bc */

undefined4 __cdecl FUN_0048c6bc(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeogroupFrontMaterial_005074ad);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  return *(undefined4 *)(param_1 + 0x48);
}



/* @0048c6ec file=? name=FUN_0048c6ec */

undefined4 __cdecl FUN_0048c6ec(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeogroupBackMaterial_005074cb);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  return *(undefined4 *)(param_1 + 0x4c);
}



/* @0048c71c file=? name=FUN_0048c71c */

void __cdecl FUN_0048c71c(int param_1)

{
  FUN_0049a300(4,s_dpl_SetGeogroupMaterialLockOn_005074e8);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  *(undefined4 *)(param_1 + 0x54) = 1;
  return;
}



/* @0048c750 file=? name=FUN_0048c750 */

void __cdecl FUN_0048c750(int param_1)

{
  FUN_0049a300(4,s_dpl_SetGeogroupMaterialLockOff_00507507);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  *(undefined4 *)(param_1 + 0x54) = 0;
  return;
}



/* @0048c784 file=? name=FUN_0048c784 */

undefined4 __cdecl FUN_0048c784(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeogroupMaterialLock_00507527);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  return *(undefined4 *)(param_1 + 0x54);
}



/* @0048c7b4 file=? name=FUN_0048c7b4 */

void __cdecl FUN_0048c7b4(int param_1,int param_2)

{
  FUN_0049a300(4,s_dpl_SetGeogroupDecalDisplace_00507544);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  *(float *)(param_1 + 0x50) = (float)param_2;
  return;
}



/* @0048c7e8 file=? name=FUN_0048c7e8 */

void __cdecl FUN_0048c7e8(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeogroupDecalDisplace_00507562);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  FUN_004dcd94();
  return;
}



/* @0048c820 file=? name=FUN_0048c820 */

void __cdecl FUN_0048c820(int param_1,int param_2)

{
  uint uVar1;
  
  uVar1 = *(uint *)(param_1 + 0x34) & 0xffffefff;
  FUN_0049a300(4,s_dpl_SetGeogroupWireFrame_00507580);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  if (param_2 == 0) {
    *(uint *)(param_1 + 0x34) = uVar1;
  }
  else {
    *(uint *)(param_1 + 0x34) = uVar1 | 0x1000;
  }
  return;
}



/* @0048c86c file=? name=FUN_0048c86c */

undefined4 __cdecl FUN_0048c86c(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeogroupWireFrame_0050759a);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,9);
  }
  if ((*(byte *)(param_1 + 0x35) & 0x10) != 0) {
    return 1;
  }
  return 0;
}



/* @0048c8ac file=? name=FUN_0048c8ac */

void __cdecl FUN_0048c8ac(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetGeometryGeoType_005075b4);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *(undefined4 *)(param_1 + 0x10) = param_2;
  return;
}



/* @0048c8e0 file=? name=FUN_0048c8e0 */

undefined4 __cdecl FUN_0048c8e0(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeometryGeoType_005075cc);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return *(undefined4 *)(param_1 + 0x10);
}



/* @0048c910 file=? name=FUN_0048c910 */

void __cdecl FUN_0048c910(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetGeometryVertexType_005075e4);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *(undefined4 *)(param_1 + 0x14) = param_2;
  return;
}



/* @0048c944 file=? name=FUN_0048c944 */

undefined4 __cdecl FUN_0048c944(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeometryVertexType_005075ff);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return *(undefined4 *)(param_1 + 0x14);
}



/* @0048c974 file=? name=FUN_0048c974 */

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

void __cdecl
FUN_0048c974(undefined4 *param_1,float *param_2,undefined4 *param_3,undefined4 *param_4)

{
  *param_1 = *param_4;
  param_1[1] = param_4[1];
  param_1[2] = param_4[2];
  *param_2 = _DAT_0048c9c4 * (float)param_4[3];
  param_2[1] = 0.0;
  param_2[2] = 0.0;
  *param_3 = 0;
  param_3[1] = _DAT_0048c9c4 * (float)param_4[4];
  param_3[2] = 0;
  return;
}



/* @0048c9c8 file=? name=FUN_0048c9c8 */

void __cdecl FUN_0048c9c8(int param_1,char *param_2)

{
  undefined4 *puVar1;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  float local_1c [6];
  
  FUN_0049a300(4,s_dpl_SetGeometryText_0050761a);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *(undefined4 *)(param_1 + 0x10) = 6;
  if (*(int *)(param_1 + 0x24) == 0) {
    puVar1 = (undefined4 *)FUN_00452c38(0x24);
    *puVar1 = 0;
    puVar1[1] = 0;
    puVar1[2] = 0;
    puVar1[3] = 0x3f800000;
    puVar1[4] = 0x3f800000;
    puVar1[5] = 0x3f800000;
    puVar1[6] = 0;
    puVar1[7] = 0;
    puVar1[8] = 0;
    *(undefined4 **)(param_1 + 0x24) = puVar1;
  }
  *(char **)(param_1 + 0x20) = param_2;
  if (param_2 != (char *)0x0) {
    local_1c[3] = 0.0;
    local_1c[4] = 0.0;
    local_1c[5] = 0.0;
    local_1c[0] = 1.0;
    local_1c[1] = 0.0;
    local_1c[2] = 0.0;
    local_28 = 0;
    local_24 = 0xbf800000;
    local_20 = 0;
    FUN_0048c974(local_1c + 3,local_1c,&local_28,*(undefined4 **)(param_1 + 0x24));
    FUN_0048daa0(param_1,param_2,local_1c + 3,local_1c,&local_28);
  }
  return;
}



/* @0048cab0 file=? name=FUN_0048cab0 */

undefined4 __cdecl FUN_0048cab0(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeometryText_0050762f);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return *(undefined4 *)(param_1 + 0x20);
}



/* @0048cae0 file=? name=FUN_0048cae0 */

void __cdecl FUN_0048cae0(int param_1,undefined4 param_2)

{
  FUN_0049a300(4,s_dpl_SetGeometryNumVertices_00507644);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *(undefined4 *)(param_1 + 0x18) = param_2;
  return;
}



/* @0048cb14 file=? name=FUN_0048cb14 */

undefined4 __cdecl FUN_0048cb14(int param_1)

{
  FUN_0049a300(4,s_dpl_GetGeometryNumVertices_00507660);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return *(undefined4 *)(param_1 + 0x18);
}



/* @0048cb44 file=? name=FUN_0048cb44 */

void __cdecl FUN_0048cb44(int param_1)

{
  FUN_0049a300(4,s_dpl_SetGeometryDice__d__d_0050767c);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return;
}



/* @0048cb7c file=? name=FUN_0048cb7c */

void __cdecl FUN_0048cb7c(int param_1,undefined2 *param_2,undefined2 *param_3)

{
  FUN_0049a300(4,s_dpl_GetGeometryDice_00507697);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *param_2 = 8;
  *param_3 = 8;
  return;
}



/* @0048cbb8 file=? name=FUN_0048cbb8 */

void __cdecl FUN_0048cbb8(int param_1,undefined4 param_2)

{
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *(undefined4 *)(param_1 + 0x28) = param_2;
  return;
}



/* @0048cbdc file=? name=FUN_0048cbdc */

void __cdecl FUN_0048cbdc(int param_1,undefined4 param_2)

{
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  *(undefined4 *)(param_1 + 0x2c) = param_2;
  return;
}



/* @0048cc00 file=? name=FUN_0048cc00 */

float10 __cdecl FUN_0048cc00(int param_1)

{
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return (float10)*(float *)(param_1 + 0x28);
}



/* @0048cc24 file=? name=FUN_0048cc24 */

float10 __cdecl FUN_0048cc24(int param_1)

{
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return (float10)*(float *)(param_1 + 0x2c);
}



/* @0048cc48 file=? name=FUN_0048cc48 */

void __cdecl FUN_0048cc48(int param_1,byte *param_2,undefined4 param_3,int param_4)

{
  uint uVar1;
  undefined4 uVar2;
  int iVar3;
  
  iVar3 = 0;
  FUN_0049a300(4,s_dpl_UpdateGeometryVertices_005076ac);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  if (*(int *)(param_1 + 0x10) == 6) {
    if (*(int *)(param_1 + 0x24) == 0) {
      uVar2 = FUN_00452c38(0x24);
      *(undefined4 *)(param_1 + 0x24) = uVar2;
    }
    FUN_004d4918(*(undefined4 **)(param_1 + 0x24),(undefined4 *)param_2,0x24);
  }
  else {
    uVar1 = *(uint *)(param_1 + 0x14);
    if ((uVar1 & 1) != 0) {
      iVar3 = 3;
    }
    if ((uVar1 & 2) != 0) {
      iVar3 = iVar3 + 3;
    }
    if ((uVar1 & 4) != 0) {
      iVar3 = iVar3 + 4;
    }
    if ((uVar1 & 8) != 0) {
      iVar3 = iVar3 + 2;
    }
    if ((uVar1 & 0x10) != 0) {
      iVar3 = iVar3 + 2;
    }
    if ((uVar1 & 0x20) != 0) {
      iVar3 = iVar3 + 3;
    }
    if ((uVar1 & 0x40) != 0) {
      iVar3 = iVar3 + 1;
    }
    FUN_0048dba8(param_1,param_2,param_3,param_4,iVar3);
  }
  return;
}



/* @0048ccec file=? name=FUN_0048ccec */

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

{
  uint uVar1;
  int iVar2;
  
  iVar2 = 0;
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  FUN_0049a300(4,s_dpl_GetGeometryVertices_005076c8);
  uVar1 = *(uint *)(param_1 + 0x14);
  if ((uVar1 & 1) != 0) {
    iVar2 = 3;
  }
  if ((uVar1 & 2) != 0) {
    iVar2 = iVar2 + 3;
  }
  if ((uVar1 & 4) != 0) {
    iVar2 = iVar2 + 4;
  }
  if ((uVar1 & 8) != 0) {
    iVar2 = iVar2 + 2;
  }
  if ((uVar1 & 0x10) != 0) {
    iVar2 = iVar2 + 2;
  }
  if ((uVar1 & 0x20) != 0) {
    iVar2 = iVar2 + 3;
  }
  if ((uVar1 & 0x40) != 0) {
    iVar2 = iVar2 + 1;
  }
  FUN_0048dcb0(param_1,param_2,param_3,param_4,iVar2);
  return;
}



/* @0048cd68 file=? name=FUN_0048cd68 */

void __cdecl FUN_0048cd68(int param_1,byte *param_2,int param_3,int param_4)

{
  FUN_0049a300(4,s_dpl_AddGeometryConnections_005076e1);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  FUN_0048de14(param_1,param_2,param_3,param_4,0);
  return;
}



/* @0048cdac file=? name=FUN_0048cdac */

void __cdecl FUN_0048cdac(int param_1,byte *param_2,int param_3,int param_4)

{
  FUN_0049a300(4,s_dpl_AddGeometryStrip_005076fd);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  FUN_0048de14(param_1,param_2,param_3,param_4,1);
  return;
}



/* @0048cdf0 file=? name=FUN_0048cdf0 */

void __cdecl FUN_0048cdf0(int param_1)

{
  FUN_0049a300(4,s_dpl_OptimizeGeometry_00507713);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,10);
  }
  return;
}



/* @0048ce1c file=? name=FUN_0048ce1c */

void FUN_0048ce1c(void)

{
  FUN_0049a300(4,s_dpl_SetWindowName_pipe__d_name___00507729);
  return;
}



/* @0048ce38 file=? name=FUN_0048ce38 */

char * FUN_0048ce38(void)

{
  FUN_0049a300(4,s_dpl_GetWindowName_pipe__d_0050774c);
  return s_no_windows_on_VPX_00507767;
}



/* @0048ce58 file=? name=FUN_0048ce58 */

void FUN_0048ce58(void)

{
  FUN_0049a300(4,s_dpl_SetDesktopStereo_pipe__d_mod_00507779);
  return;
}



/* @0048ce74 file=? name=FUN_0048ce74 */

undefined4 FUN_0048ce74(void)

{
  FUN_0049a300(4,s_dpl_GetDesktopStereo_pipe__d_0050779f);
  return 0;
}



/* @0048ce90 file=? name=FUN_0048ce90 */

void __cdecl FUN_0048ce90(undefined4 param_1)

{
  FUN_0049a300(4,s_dpl_SetWarningLevel_005077bd);
  DAT_00505b54 = param_1;
  return;
}



/* @0048ceb4 file=? name=FUN_0048ceb4 */

char * FUN_0048ceb4(void)

{
  FUN_0049a300(4,s_dpl_Version_005077d2);
  return s_dpl_v_0_3a_005077df;
}



/* @0048ced0 file=? name=FUN_0048ced0 */

undefined * FUN_0048ced0(void)

{
  FUN_0049a300(4,s_dpl_Statistics_005077ea);
  FUN_0048e380(&DAT_00523b34);
  return &DAT_00523b34;
}



/* @0048cef4 file=? name=FUN_0048cef4 */

undefined * FUN_0048cef4(void)

{
  FUN_0049a300(4,s_dpl_Status_005077fa);
  return &DAT_00523d88;
}



/* @0048cf10 file=? name=FUN_0048cf10 */

undefined * FUN_0048cf10(void)

{
  FUN_0049a300(4,s_dpl_GetFrameStore_view_0x_x_xptr_00507806);
  return &DAT_00523d8c;
}



/* @0048cf38 file=? name=FUN_0048cf38 */

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

{
  int iVar1;
  
  FUN_0049a300(4,s_dpl_ReadFrameStore_view_0x_x_00507837);
  iVar1 = 0;
  if (0 < param_6) {
    do {
      FUN_0048e388(param_2,param_3,param_4 + iVar1,param_5);
      iVar1 = iVar1 + 1;
    } while (iVar1 < param_6);
  }
  return;
}



/* @0048cf80 file=? name=FUN_0048cf80 */

void __cdecl
FUN_0048cf80(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,uint param_5,
            uint param_6,uint param_7,undefined4 *param_8,undefined4 *param_9,undefined4 *param_10,
            undefined4 *param_11,undefined4 *param_12,undefined4 *param_13)

{
  FUN_0049a300(4,s_dpl_SectVector_00507856);
  FUN_0048e700(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9,param_10,
               param_11,param_12,param_13);
  return;
}



/* @0048cfcc file=? name=FUN_0048cfcc */

void __cdecl
FUN_0048cfcc(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 *param_5,undefined4 *param_6,undefined4 *param_7,undefined4 *param_8,
            undefined4 *param_9,undefined4 *param_10)

{
  FUN_0049a300(4,s_dpl_SectPixel_00507866);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_1,3);
  }
  FUN_0048e7f4(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9,param_10);
  return;
}



/* @0048d024 file=? name=FUN_0048d024 */

void FUN_0048d024(void)

{
  DAT_0050792c = FUN_004dcd94();
  return;
}



/* @0048d050 file=? name=FUN_0048d050 */

undefined4 FUN_0048d050(void)

{
  return DAT_00505b78;
}



/* @0048d060 file=? name=FUN_0048d060 */

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

{
  undefined4 local_44 [16];
  
  FUN_0049a300(4,s_dpl_Effect_00507875);
  if (DAT_00505b64 != 0) {
    FUN_00489594(param_2,5);
  }
  if (param_1 == 0) {
    FUN_00491830(local_44);
    FUN_00491890(local_44,*param_3,param_3[1],param_3[2]);
    FUN_0048e168(param_3[3],param_2,local_44);
  }
  else if (param_1 == 1) {
    FUN_0048e1e8(param_3,param_2);
  }
  else if (param_1 == 2) {
    FUN_0048e25c(*param_3);
  }
  else {
    FUN_004d771c(s_Cannot_do_an_effect_of_this_type_00507881);
  }
  return 0;
}



/* @0048d108 file=? name=FUN_0048d108 */

undefined4 __cdecl FUN_0048d108(int param_1,undefined4 *param_2)

{
  undefined4 *puVar1;
  int iVar2;
  
  FUN_0049a300(4,s_dpl_Init_005078a6);
  if (DAT_00505b58 != 0) {
    return 0;
  }
  DAT_00505b58 = 1;
  FUN_0048df70(param_1,param_2);
  FUN_00487cd4();
  FUN_00489130(0x523bb8);
  FUN_00498d38(&DAT_005078b0,FUN_0048f0bc);
  iVar2 = 0;
  puVar1 = &DAT_00523d08;
  do {
    *puVar1 = 0;
    puVar1[1] = 0;
    iVar2 = iVar2 + 1;
    puVar1 = puVar1 + 2;
  } while (iVar2 < 0x10);
  return 1;
}



/* @0048d184 file=? name=FUN_0048d184 */

void FUN_0048d184(void)

{
  FUN_00491cfc();
  FUN_00491454();
  FUN_00492a90();
  FUN_0048ed20();
  FUN_00487f18();
  FUN_0048fdd8();
  FUN_00490660();
  FUN_00492adc();
  FUN_00452ca0();
  DAT_00505b58 = 0;
  PTR_s_nothing_00505b5c = s_nothing_005078b5;
  DAT_00505b54 = 0;
  DAT_00505b64 = 0;
  DAT_00505b68 = 0;
  DAT_00505b60 = 0;
  DAT_00505b78 = 0;
  return;
}



/* @0048d1ec file=? name=FUN_0048d1ec */

void FUN_0048d1ec(void)

{
  FUN_0049a300(4,s_dpl_Exit_code__d_005078bd);
  return;
}



/* @0048d20c file=? name=FUN_0048d20c */

void FUN_0048d20c(void)

{
  FUN_0049a300(4,s_dpl_Config_005078cf);
  return;
}



/* @0048d220 file=? name=FUN_0048d220 */

void __cdecl FUN_0048d220(int param_1)

{
  int iVar1;
  void *this;
  int local_2c [8];
  int local_c;
  uint local_8;
  
  local_2c[0] = param_1;
  local_2c[1] = 0;
  FUN_00492580(0x2d,(byte *)local_2c,8,0);
  iVar1 = FUN_004922e0(this,&local_c,local_2c,&local_8,0x20);
  if (iVar1 == 0) {
    FUN_004d771c(s_____ERROR___velocirender_receive_00507933 + 1);
    FUN_004dee24(9);
  }
  if (param_1 != local_2c[0]) {
    FUN_004d771c(s____ERROR___unexpected_action__d_r_00507967);
    FUN_004dee24(9);
  }
  return;
}



/* @0048d294 file=? name=FUN_0048d294 */

void __cdecl FUN_0048d294(int param_1)

{
  undefined4 local_c;
  int local_8;
  
  local_8 = DAT_005078dc;
  DAT_005078dc = DAT_005078dc + 1;
  *(int *)(param_1 + 8) = local_8;
  local_c = *(undefined4 *)(param_1 + 0xc);
  FUN_0048900c(local_c);
  FUN_0049a300(4,s_remote_VelociRender_create_node_0_005079a6);
  FUN_00492580(1,(byte *)&local_c,8,0);
  FUN_00487d98(param_1,*(undefined4 *)(param_1 + 0xc));
  if (DAT_005078e8 != 0) {
    FUN_0048d220(1);
  }
  return;
}



/* @0048d30c file=? name=FUN_0048d30c */

void __cdecl FUN_0048d30c(int param_1)

{
  undefined4 local_c;
  undefined4 local_8;
  
  FUN_0049a300(4,s_remote_VelociRender_delete_node_0_005079e5);
  local_c = *(undefined4 *)(param_1 + 8);
  local_8 = *(undefined4 *)(param_1 + 0xc);
  FUN_00492580(2,(byte *)&local_c,8,0);
  return;
}



/* @0048d350 file=? name=FUN_0048d350 */

void __cdecl FUN_0048d350(undefined4 *param_1,int param_2)

{
  FUN_0048900c(param_1[3]);
  FUN_0049a300(4,s_VelociRender_flush_on_node_0x_x_r_00507a17);
  *param_1 = 1;
  FUN_00492580(3,(byte *)(param_1 + 2),param_2 - 8,0);
  return;
}



/* @0048d3a0 file=? name=FUN_0048d3a0 */

void __cdecl FUN_0048d3a0(int param_1)

{
  DAT_005078ec = DAT_005078ec + 1;
  *(int *)(param_1 + 8) = DAT_005078ec;
  FUN_0049a300(4,s_warning___issuing_create_on_loca_00507a52);
  return;
}



/* @0048d3cc file=? name=FUN_0048d3cc */

void FUN_0048d3cc(void)

{
  FUN_0049a300(4,s_warning___issuing_delete_on_loca_00507a84);
  return;
}



/* @0048d3e8 file=? name=FUN_0048d3e8 */

void __cdecl FUN_0048d3e8(undefined4 *param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_flush_dcs_nodes_0x_x_zone_0x_x_00507ab6);
  iVar1 = param_1[5];
  if (iVar1 != 0) {
    param_1[5] = *(undefined4 *)(iVar1 + 8);
  }
  FUN_0048d350(param_1,0x8c);
  param_1[5] = iVar1;
  return;
}



/* @0048d42c file=? name=FUN_0048d42c */

void __cdecl FUN_0048d42c(undefined4 *param_1)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_0049a300(4,s_flush_view_00507ad6);
  iVar1 = param_1[5];
  if (iVar1 != 0) {
    param_1[5] = *(undefined4 *)(iVar1 + 8);
  }
  puVar2 = (undefined4 *)param_1[0x1b];
  if (puVar2 != (undefined4 *)0x0) {
    param_1[0x1b] = *puVar2;
  }
  FUN_0048d350(param_1,0x70);
  param_1[5] = iVar1;
  param_1[0x1b] = puVar2;
  return;
}



/* @0048d478 file=? name=FUN_0048d478 */

void __cdecl FUN_0048d478(undefined4 *param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_flush_light_00507ae2);
  iVar1 = param_1[5];
  if (iVar1 != 0) {
    param_1[5] = *(undefined4 *)(iVar1 + 8);
  }
  FUN_0048d350(param_1,0x3c);
  param_1[5] = iVar1;
  return;
}



/* @0048d4b0 file=? name=FUN_0048d4b0 */

void __cdecl FUN_0048d4b0(undefined4 *param_1)

{
  FUN_0049a300(4,s_flush_zone_00507aef);
  FUN_0048d350(param_1,0x14);
  return;
}



/* @0048d4d4 file=? name=FUN_0048d4d4 */

void __cdecl FUN_0048d4d4(undefined4 *param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  FUN_0049a300(4,s_flush_material_00507afb);
  iVar1 = param_1[4];
  if (iVar1 != 0) {
    param_1[4] = *(undefined4 *)(iVar1 + 8);
  }
  iVar2 = param_1[5];
  if (iVar2 != 0) {
    param_1[5] = *(undefined4 *)(iVar2 + 8);
  }
  iVar3 = param_1[7];
  if (iVar3 != 0) {
    param_1[7] = *(undefined4 *)(iVar3 + 8);
  }
  FUN_0048d350(param_1,100);
  param_1[5] = iVar2;
  param_1[4] = iVar1;
  param_1[7] = iVar3;
  return;
}



/* @0048d538 file=? name=FUN_0048d538 */

void __cdecl FUN_0048d538(undefined4 *param_1)

{
  FUN_0049a300(4,s_flush_ramp_00507b0b);
  FUN_0048d350(param_1,0x2c);
  return;
}



/* @0048d55c file=? name=FUN_0048d55c */

void __cdecl FUN_0048d55c(undefined4 *param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_flush_texture_00507b17);
  iVar1 = param_1[4];
  if (iVar1 != 0) {
    param_1[4] = *(undefined4 *)(iVar1 + 8);
  }
  FUN_0048d350(param_1,0x4c);
  param_1[4] = iVar1;
  DAT_005081d8 = (uint)(param_1[6] == 10);
  return;
}



/* @0048d5b0 file=? name=FUN_0048d5b0 */

void __cdecl FUN_0048d5b0(undefined4 *param_1)

{
  FUN_0049a300(4,s_flush_texmap_00507b26);
  FUN_0048d350(param_1,0x24);
  return;
}



/* @0048d5d4 file=? name=FUN_0048d5d4 */

void __cdecl FUN_0048d5d4(undefined4 *param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  FUN_0049a300(4,s_flush_instance_00507b34);
  iVar1 = param_1[5];
  if (iVar1 != 0) {
    param_1[5] = *(undefined4 *)(iVar1 + 8);
  }
  iVar2 = param_1[8];
  if (iVar2 != 0) {
    param_1[8] = *(undefined4 *)(iVar2 + 8);
  }
  iVar3 = param_1[9];
  if (iVar3 != 0) {
    param_1[9] = *(undefined4 *)(iVar3 + 8);
  }
  iVar4 = param_1[10];
  if (iVar4 != 0) {
    param_1[10] = *(undefined4 *)(iVar4 + 8);
  }
  iVar5 = param_1[0xb];
  if (iVar5 != 0) {
    param_1[0xb] = *(undefined4 *)(iVar5 + 8);
  }
  FUN_0048d350(param_1,0x38);
  param_1[5] = iVar1;
  param_1[8] = iVar2;
  param_1[9] = iVar3;
  param_1[10] = iVar4;
  param_1[0xb] = iVar5;
  return;
}



/* @0048d668 file=? name=FUN_0048d668 */

void __cdecl FUN_0048d668(undefined4 *param_1)

{
  FUN_0049a300(4,s_flush_object_00507b44);
  FUN_0048d350(param_1,0x7c);
  return;
}



/* @0048d68c file=? name=FUN_0048d68c */

void __cdecl FUN_0048d68c(undefined4 *param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_flush_lod_00507b52);
  iVar1 = param_1[0xc];
  if (iVar1 != 0) {
    param_1[0xc] = *(undefined4 *)(iVar1 + 8);
  }
  FUN_0048d350(param_1,0x50);
  param_1[0xc] = iVar1;
  return;
}



/* @0048d6c4 file=? name=FUN_0048d6c4 */

void __cdecl FUN_0048d6c4(undefined4 *param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  FUN_0049a300(4,s_flush_geogroup_00507b5d);
  iVar1 = param_1[0x12];
  if (iVar1 != 0) {
    param_1[0x12] = *(undefined4 *)(iVar1 + 8);
  }
  iVar2 = param_1[0x13];
  if (iVar2 != 0) {
    param_1[0x13] = *(undefined4 *)(iVar2 + 8);
  }
  iVar3 = param_1[0xc];
  if (iVar3 != 0) {
    param_1[0xc] = *(undefined4 *)(iVar3 + 8);
  }
  FUN_0048d350(param_1,0x58);
  param_1[0x12] = iVar1;
  param_1[0x13] = iVar2;
  param_1[0xc] = iVar3;
  return;
}



/* @0048d728 file=? name=FUN_0048d728 */

void __cdecl FUN_0048d728(undefined4 *param_1)

{
  int iVar1;
  
  FUN_0049a300(4,s_flush_geometry_00507b6d);
  iVar1 = param_1[7];
  if (iVar1 != 0) {
    param_1[7] = *(undefined4 *)(iVar1 + 8);
  }
  FUN_0048d350(param_1,0x30);
  param_1[7] = iVar1;
  return;
}



/* @0048d760 file=? name=FUN_0048d760 */

void __cdecl FUN_0048d760(int param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = *(undefined4 *)(param_1 + 8);
  local_8 = *(undefined4 *)(param_2 + 8);
  FUN_00492580(0xb,(byte *)&local_c,8,0);
  return;
}



/* @0048d7a0 file=? name=FUN_0048d7a0 */

void __cdecl FUN_0048d7a0(int param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = *(undefined4 *)(param_1 + 8);
  local_8 = *(undefined4 *)(param_2 + 8);
  FUN_00492580(0xc,(byte *)&local_c,8,0);
  return;
}



/* @0048d7e0 file=? name=FUN_0048d7e0 */

void __cdecl FUN_0048d7e0(int *param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = DAT_00507900;
  local_8 = DAT_00507904;
  if (*param_1 == 0) {
    FUN_0049a300(1,s_internal_error__badly_formed_sup_00507b7d);
  }
  else {
    local_c = *(undefined4 *)(*param_1 + 8);
    local_8 = *(undefined4 *)(param_2 + 8);
    FUN_00492580(0xb,(byte *)&local_c,8,0);
  }
  return;
}



/* @0048d838 file=? name=FUN_0048d838 */

void __cdecl FUN_0048d838(int *param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = DAT_00507908;
  local_8 = DAT_0050790c;
  if (*param_1 == 0) {
    FUN_0049a300(1,s_attempt_to_remove_item_from_list_00507ba5);
  }
  else {
    local_c = *(undefined4 *)(*param_1 + 8);
    local_8 = *(undefined4 *)(param_2 + 8);
    FUN_00492580(0xc,(byte *)&local_c,8,0);
  }
  return;
}



/* @0048d890 file=? name=FUN_0048d890 */

void __cdecl FUN_0048d890(int param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = DAT_00507910;
  local_8 = DAT_00507914;
  if (param_1 != 0) {
    local_c = *(undefined4 *)(param_1 + 8);
  }
  if (param_2 != 0) {
    local_8 = *(undefined4 *)(param_2 + 8);
  }
  FUN_00492580(6,(byte *)&local_c,8,0);
  return;
}



/* @0048d8d8 file=? name=FUN_0048d8d8 */

void __cdecl FUN_0048d8d8(int param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = DAT_00507918;
  local_8 = DAT_0050791c;
  if (param_1 != 0) {
    local_c = *(undefined4 *)(param_1 + 8);
  }
  if (param_2 != 0) {
    local_8 = *(undefined4 *)(param_2 + 8);
  }
  FUN_00492580(7,(byte *)&local_c,8,0);
  return;
}



/* @0048d920 file=? name=FUN_0048d920 */

void __cdecl FUN_0048d920(int param_1,int param_2)

{
  undefined4 local_c;
  undefined4 local_8;
  
  local_c = DAT_00507920;
  local_8 = DAT_00507924;
  if (param_1 != 0) {
    local_c = *(undefined4 *)(param_1 + 8);
  }
  if (param_2 != 0) {
    local_8 = *(undefined4 *)(param_2 + 8);
  }
  FUN_00492580(8,(byte *)&local_c,8,0);
  return;
}



/* @0048d968 file=? name=FUN_0048d968 */

void __cdecl FUN_0048d968(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5)

{
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  
  local_24 = *(undefined4 *)(param_1 + 8);
  local_20 = *(undefined4 *)(param_2 + 8);
  local_1c = *(undefined4 *)(param_3 + 8);
  local_18 = 0;
  local_14 = param_4;
  local_10 = param_5;
  FUN_00492580(0xd,(byte *)&local_24,0x18,0);
  return;
}



/* @0048d9b4 file=? name=FUN_0048d9b4 */

void __cdecl
FUN_0048d9b4(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5,
            undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9)

{
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_2c = *(undefined4 *)(param_1 + 8);
  local_28 = *(undefined4 *)(param_2 + 8);
  local_24 = *(undefined4 *)(param_3 + 8);
  local_20 = 1;
  local_1c = param_4;
  local_18 = param_5;
  local_14 = param_6;
  local_10 = param_7;
  local_c = param_8;
  local_8 = param_9;
  FUN_00492580(0xd,(byte *)&local_2c,0x28,0);
  return;
}



/* @0048da1c file=? name=FUN_0048da1c */

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

{
  int iVar1;
  undefined4 local_24;
  int local_20;
  int local_1c;
  int local_18;
  undefined4 local_14;
  
  iVar1 = param_3 * param_4;
  local_24 = *(undefined4 *)(param_1 + 8);
  local_1c = param_3;
  local_18 = param_4;
  local_14 = param_5;
  local_20 = iVar1;
  FUN_00492580(0x1a,(byte *)&local_24,0x20,0);
  for (; iVar1 != 0; iVar1 = iVar1 + -0x40) {
    FUN_00492580(0x1a,param_2,0x100,param_6);
    param_2 = param_2 + 0x100;
  }
  if (DAT_005078e8 != 0) {
    FUN_0048d220(0x1a);
  }
  return 1;
}



/* @0048daa0 file=? name=FUN_0048daa0 */

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

{
  char cVar1;
  bool bVar2;
  int iVar3;
  int iVar4;
  int *piVar5;
  int *local_c;
  char *local_8;
  
  local_c = &DAT_0052420c;
  DAT_00524210 = FUN_004d4a78(param_2);
  iVar3 = DAT_00524210 + 0x1f >> 5;
  DAT_0052420c = *(undefined4 *)(param_1 + 8);
  DAT_00524218 = *param_3;
  DAT_0052421c = param_3[1];
  DAT_00524220 = param_3[2];
  DAT_00524224 = *param_4;
  DAT_00524228 = param_4[1];
  DAT_0052422c = param_4[2];
  DAT_00524230 = *param_5;
  DAT_00524234 = param_5[1];
  DAT_00524238 = param_5[2];
  DAT_00524214 = iVar3;
  FUN_00492580(0x16,(byte *)&DAT_0052420c,0x30,0);
  local_8 = param_2;
  for (; iVar3 != 0; iVar3 = iVar3 + -1) {
    bVar2 = true;
    iVar4 = 0;
    piVar5 = local_c;
    do {
      if (iVar4 == 0x20) {
        bVar2 = false;
      }
      else {
        cVar1 = *local_8;
        iVar4 = iVar4 + 1;
        local_8 = local_8 + 1;
        *piVar5 = (int)cVar1;
        piVar5 = piVar5 + 1;
        if (cVar1 == 0) {
          bVar2 = false;
        }
      }
    } while (bVar2);
    FUN_00492580(0x16,(byte *)&DAT_0052420c,iVar4 << 2,0);
  }
  if (DAT_005078e8 != 0) {
    FUN_0048d220(0x16);
  }
  return 1;
}



/* @0048dba8 file=? name=FUN_0048dba8 */

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

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

{
  int iVar1;
  int iVar2;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  int local_20;
  int local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  
  iVar2 = param_4 * param_5;
  iVar1 = param_5 * (int)(0xfe / (ulonglong)(uint)(param_5 << 2));
  local_1c = (iVar1 + -1 + iVar2) / iVar1;
  local_2c = *(undefined4 *)(param_1 + 8);
  local_28 = param_3;
  local_24 = param_4;
  local_20 = param_5;
  local_18 = *(undefined4 *)(param_1 + 0x14);
  local_14 = *(undefined4 *)(param_1 + 0x10);
  local_10 = *(undefined4 *)(param_1 + 0x18);
  local_c = DAT_005078e0;
  FUN_0049a300(4,s_ghost_update_geom_verts_vertex0__00507bda);
  if (param_4 == 0x144) {
    _DAT_00507928 = _DAT_00507928 + 1;
  }
  FUN_00492580(0x17,(byte *)&local_2c,0x24,0);
  if (iVar1 - iVar2 == 0 || iVar1 < iVar2) {
    do {
      FUN_00492580(0x17,param_2,iVar1 * 4,0);
      iVar2 = iVar2 - iVar1;
      param_2 = param_2 + iVar1 * 4;
    } while (iVar1 - iVar2 == 0 || iVar1 < iVar2);
  }
  if (iVar2 != 0) {
    FUN_00492580(0x17,param_2,iVar2 << 2,0);
  }
  if (DAT_005078e8 != 0) {
    FUN_0048d220(0x17);
  }
  return 1;
}



/* @0048dcb0 file=? name=FUN_0048dcb0 */

undefined4 FUN_0048dcb0(int param_1,int param_2,undefined4 param_3,int param_4,int param_5)

{
  int iVar1;
  void *extraout_ECX;
  void *extraout_ECX_00;
  int iVar2;
  int iVar3;
  void *this;
  undefined4 uStack_38;
  undefined4 uStack_34;
  int iStack_30;
  int iStack_2c;
  int iStack_28;
  undefined4 uStack_24;
  int iStack_20;
  undefined4 uStack_1c;
  undefined4 uStack_18;
  uint uStack_10;
  int iStack_c;
  int iStack_8;
  
  iVar3 = param_4 * param_5;
  iStack_20 = (int)(0xfa / (ulonglong)(uint)(param_5 << 2));
  iVar2 = iStack_20 * param_5;
  uStack_38 = *(undefined4 *)(param_1 + 8);
  uStack_34 = param_3;
  iStack_30 = param_4;
  iStack_2c = param_5;
  iStack_28 = (iVar2 + -1 + iVar3) / iVar2;
  uStack_24 = *(undefined4 *)(param_1 + 0x14);
  uStack_1c = *(undefined4 *)(param_1 + 0x18);
  uStack_18 = DAT_005078e0;
  iStack_c = iStack_20;
  FUN_0049a300(4,s_ghost_get_geom_verts_vertex0__d_v_00507c1a);
  FUN_00492580(0x18,(byte *)&uStack_38,0x28,0);
  this = extraout_ECX;
  if (iVar2 - iVar3 == 0 || iVar2 < iVar3) {
    do {
      iVar1 = FUN_004922e0(this,&iStack_8,(undefined4 *)param_2,&uStack_10,0x100);
      this = extraout_ECX_00;
      if (iVar1 == 0) {
        FUN_004d771c(s____ERROR___velocirender_receive_f_00507c57);
        this = (void *)0x9;
        FUN_004dee24(9);
      }
      if (iStack_8 != 0x18) {
        FUN_004d771c(s_Protocol_error__action__d_in_get_00507c94);
        FUN_004dee24(9);
        return 0;
      }
      iVar3 = iVar3 - iVar2;
      param_2 = param_2 + iVar2 * 4;
    } while (iVar2 - iVar3 == 0 || iVar2 < iVar3);
  }
  if (iVar3 != 0) {
    iVar2 = FUN_004922e0(this,&iStack_8,(undefined4 *)param_2,&uStack_10,0x100);
    if (iVar2 == 0) {
      FUN_004d771c(s____ERROR___velocirender_receive_f_00507cc4);
      FUN_004dee24(9);
    }
    if (iStack_8 != 0x18) {
      FUN_004d771c(s_Protocol_error__action__d_in_get_00507d01);
      FUN_004dee24(9);
      return 0;
    }
  }
  return 1;
}



/* @0048dcb6 file=? name=FUN_0048dcb6 */

undefined4 FUN_0048dcb6(void)

{
  int iVar1;
  void *extraout_ECX;
  void *extraout_ECX_00;
  int iVar2;
  int unaff_EBP;
  int iVar3;
  undefined4 *puVar4;
  void *this;
  
  iVar1 = *(int *)(unaff_EBP + 0x18);
  puVar4 = *(undefined4 **)(unaff_EBP + 0xc);
  iVar3 = *(int *)(unaff_EBP + 0x14) * iVar1;
  *(int *)(unaff_EBP + -8) = (int)(0xfa / (ulonglong)(uint)(iVar1 << 2));
  iVar2 = *(int *)(unaff_EBP + -8) * iVar1;
  *(undefined4 *)(unaff_EBP + -0x34) = *(undefined4 *)(*(int *)(unaff_EBP + 8) + 8);
  *(undefined4 *)(unaff_EBP + -0x30) = *(undefined4 *)(unaff_EBP + 0x10);
  *(undefined4 *)(unaff_EBP + -0x2c) = *(undefined4 *)(unaff_EBP + 0x14);
  *(int *)(unaff_EBP + -0x28) = iVar1;
  *(int *)(unaff_EBP + -0x24) = (iVar2 + -1 + iVar3) / iVar2;
  *(undefined4 *)(unaff_EBP + -0x20) = *(undefined4 *)(*(int *)(unaff_EBP + 8) + 0x14);
  *(undefined4 *)(unaff_EBP + -0x1c) = *(undefined4 *)(unaff_EBP + -8);
  *(undefined4 *)(unaff_EBP + -0x18) = *(undefined4 *)(*(int *)(unaff_EBP + 8) + 0x18);
  *(undefined4 *)(unaff_EBP + -0x14) = DAT_005078e0;
  FUN_0049a300(4,s_ghost_get_geom_verts_vertex0__d_v_00507c1a);
  FUN_00492580(0x18,(byte *)(unaff_EBP + -0x34),0x28,0);
  this = extraout_ECX;
  if (iVar2 - iVar3 == 0 || iVar2 < iVar3) {
    do {
      iVar1 = FUN_004922e0(this,(int *)(unaff_EBP + -4),puVar4,(uint *)(unaff_EBP + -0xc),0x100);
      this = extraout_ECX_00;
      if (iVar1 == 0) {
        FUN_004d771c(s____ERROR___velocirender_receive_f_00507c57);
        this = (void *)0x9;
        FUN_004dee24(9);
      }
      if (*(int *)(unaff_EBP + -4) != 0x18) {
        FUN_004d771c(s_Protocol_error__action__d_in_get_00507c94);
        FUN_004dee24(9);
        return 0;
      }
      iVar3 = iVar3 - iVar2;
      puVar4 = puVar4 + iVar2;
    } while (iVar2 - iVar3 == 0 || iVar2 < iVar3);
  }
  if (iVar3 != 0) {
    iVar1 = FUN_004922e0(this,(int *)(unaff_EBP + -4),puVar4,(uint *)(unaff_EBP + -0xc),0x100);
    if (iVar1 == 0) {
      FUN_004d771c(s____ERROR___velocirender_receive_f_00507cc4);
      FUN_004dee24(9);
    }
    if (*(int *)(unaff_EBP + -4) != 0x18) {
      FUN_004d771c(s_Protocol_error__action__d_in_get_00507d01);
      FUN_004dee24(9);
      return 0;
    }
  }
  return 1;
}



/* @0048de14 file=? name=FUN_0048de14 */

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

{
  int iVar1;
  undefined4 local_28;
  int local_24;
  int local_20;
  int local_1c;
  uint local_8;
  
  if (param_5 != 0) {
    if (param_4 == 3) {
      param_3 = param_3 + 2;
    }
    else if (param_4 == 4) {
      param_3 = param_3 * 2 + 2;
    }
    else {
      FUN_0049a300(0,s_polysize____3_____4_in_Strip_00507d31);
      FUN_004dee24(9);
    }
    param_4 = 1;
  }
  local_28 = *(undefined4 *)(param_1 + 8);
  local_20 = param_4;
  local_1c = param_5;
  local_24 = param_3;
  FUN_00492580(0x19,(byte *)&local_28,0x10,0);
  iVar1 = (int)(0x1fc / (longlong)(param_4 * 4));
  local_8 = param_4 * 4 * iVar1;
  for (; iVar1 < param_3; param_3 = param_3 - iVar1) {
    FUN_00492580(0x19,param_2,local_8,0);
    param_2 = param_2 + local_8;
  }
  if (param_3 != 0) {
    FUN_00492580(0x19,param_2,param_3 * 4 * param_4,0);
  }
  if (DAT_005078e8 != 0) {
    FUN_0048d220(0x19);
  }
  return 1;
}



/* @0048def4 file=? name=FUN_0048def4 */

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

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  int iVar4;
  bool bVar5;
  undefined4 *local_8;
  
  iVar4 = 0;
  local_8 = param_4;
  if (0 < param_1) {
    do {
      pcVar2 = (char *)*param_2;
      if ((pcVar2 != (char *)0x0) && (*pcVar2 == '/')) {
        pcVar2 = pcVar2 + 1;
        pcVar3 = param_3;
        do {
          if (*pcVar2 != *pcVar3) goto LAB_0048df5a;
          bVar5 = true;
          if (*pcVar2 == '\0') break;
          pcVar1 = pcVar2 + 1;
          if (*pcVar1 != pcVar3[1]) goto LAB_0048df5a;
          pcVar2 = pcVar2 + 2;
          pcVar3 = pcVar3 + 2;
          bVar5 = *pcVar1 == '\0';
        } while (!bVar5);
        if ((bVar5) && (iVar4 != param_1 + -1)) {
          *local_8 = param_5;
          local_8[1] = param_5;
          return param_2[1];
        }
      }
LAB_0048df5a:
      iVar4 = iVar4 + 1;
      local_8 = local_8 + 1;
      param_2 = param_2 + 1;
    } while (iVar4 < param_1);
  }
  return 0;
}



/* @0048df70 file=? name=FUN_0048df70 */

void __cdecl FUN_0048df70(int param_1,undefined4 *param_2)

{
  char cVar1;
  byte *pbVar2;
  int *piVar3;
  LPCSTR pCVar4;
  uint uVar5;
  uint uVar6;
  void *this;
  int iVar7;
  char *pcVar8;
  LPCSTR pCVar9;
  char *pcVar10;
  int iVar11;
  undefined4 *local_20;
  uint local_1c;
  int *local_18;
  int local_14;
  undefined4 local_10;
  int local_c;
  LPCSTR local_8;
  
  pbVar2 = (byte *)FUN_00452c38(0x100);
  local_18 = (int *)FUN_00452c38(0x100);
  DAT_005078e0 = 0x3f800000;
  iVar7 = 0;
  piVar3 = local_18;
  do {
    *piVar3 = 0;
    iVar7 = iVar7 + 1;
    piVar3 = piVar3 + 1;
  } while (iVar7 < 0x40);
  local_10 = FUN_0048def4(param_1,param_2,s_device_00507d4f,local_18,0);
  pCVar4 = (LPCSTR)FUN_0048def4(param_1,param_2,s_tranny_00507d56,local_18,1);
  local_8 = (LPCSTR)FUN_0048def4(param_1,param_2,&DAT_00507d5d,local_18,1);
  local_c = FUN_0048def4(param_1,param_2,&DAT_00507d62,local_18,1);
  if (pCVar4 == (LPCSTR)0x0) {
    DAT_0052438c = DAT_00507d66;
    DAT_00524390 = DAT_00507d6a;
  }
  else {
    uVar5 = 0xffffffff;
    pCVar9 = pCVar4;
    do {
      pcVar8 = pCVar9;
      if (uVar5 == 0) break;
      uVar5 = uVar5 - 1;
      pcVar8 = pCVar9 + 1;
      cVar1 = *pCVar9;
      pCVar9 = pcVar8;
    } while (cVar1 != '\0');
    uVar5 = ~uVar5;
    pcVar8 = pcVar8 + -uVar5;
    pcVar10 = (char *)&DAT_0052438c;
    for (uVar6 = uVar5 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {
      *(undefined4 *)pcVar10 = *(undefined4 *)pcVar8;
      pcVar8 = pcVar8 + 4;
      pcVar10 = pcVar10 + 4;
    }
    for (uVar5 = uVar5 & 3; uVar5 != 0; uVar5 = uVar5 - 1) {
      *pcVar10 = *pcVar8;
      pcVar8 = pcVar8 + 1;
      pcVar10 = pcVar10 + 1;
    }
  }
  if (local_8 == (LPCSTR)0x0) {
    DAT_0052440c = DAT_00507d6b;
    DAT_00524410 = DAT_00507d6f;
  }
  else {
    uVar5 = 0xffffffff;
    pCVar9 = local_8;
    do {
      pcVar8 = pCVar9;
      if (uVar5 == 0) break;
      uVar5 = uVar5 - 1;
      pcVar8 = pCVar9 + 1;
      cVar1 = *pCVar9;
      pCVar9 = pcVar8;
    } while (cVar1 != '\0');
    uVar5 = ~uVar5;
    pcVar8 = pcVar8 + -uVar5;
    pcVar10 = (char *)&DAT_0052440c;
    for (uVar6 = uVar5 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {
      *(undefined4 *)pcVar10 = *(undefined4 *)pcVar8;
      pcVar8 = pcVar8 + 4;
      pcVar10 = pcVar10 + 4;
    }
    for (uVar5 = uVar5 & 3; uVar5 != 0; uVar5 = uVar5 - 1) {
      *pcVar10 = *pcVar8;
      pcVar8 = pcVar8 + 1;
      pcVar10 = pcVar10 + 1;
    }
  }
  FUN_004929a8(pCVar4,local_c,local_8,local_10);
  *pbVar2 = 0;
  iVar7 = 0;
  local_20 = param_2;
  piVar3 = local_18;
  if (0 < param_1) {
    do {
      if (*piVar3 == 0) {
        FUN_004d49b8((char *)pbVar2,(char *)*local_20);
        FUN_004d49b8((char *)pbVar2,&DAT_00507d70);
      }
      iVar7 = iVar7 + 1;
      local_20 = local_20 + 1;
      piVar3 = piVar3 + 1;
    } while (iVar7 < param_1);
  }
  FUN_004d49b8((char *)pbVar2,&DAT_00507d72);
  iVar11 = 1;
  iVar7 = FUN_004d4a78((char *)pbVar2);
  FUN_00492580(0,pbVar2,iVar7 + 1,iVar11);
  iVar7 = FUN_004922e0(this,&local_14,local_18,&local_1c,0x100);
  if (iVar7 == 0) {
    FUN_004d771c(s____ERROR___velocirender_receive_f_00507d74);
    FUN_004dee24(9);
  }
  FUN_00452c88(local_18);
  FUN_00452c88((int *)pbVar2);
  return;
}



/* @0048e168 file=? name=FUN_0048e168 */

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

{
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44 [16];
  
  local_4c = param_1;
  if (param_2 == 0) {
    local_48 = 0;
  }
  else {
    local_48 = *(undefined4 *)(param_2 + 8);
  }
  FUN_004d4918(local_44,param_3,0x40);
  FUN_00492580(0x1b,(byte *)&local_4c,0x48,0);
  return;
}



/* @0048e1b0 file=? name=FUN_0048e1b0 */

void __cdecl FUN_0048e1b0(int param_1)

{
  byte local_14 [4];
  undefined4 local_10;
  
  local_14[0] = 0;
  local_14[1] = 0;
  local_14[2] = 0;
  local_14[3] = 0;
  if (param_1 == 0) {
    local_10 = 0;
  }
  else {
    local_10 = *(undefined4 *)(param_1 + 8);
  }
  FUN_00492580(0x23,local_14,8,0);
  return;
}



/* @0048e1e8 file=? name=FUN_0048e1e8 */

void __cdecl FUN_0048e1e8(undefined4 *param_1,int param_2)

{
  int iVar1;
  
  iVar1 = param_1[0x40];
  if (param_2 == 0) {
    DAT_0052420c = 0;
  }
  else {
    DAT_0052420c = *(undefined4 *)(param_2 + 8);
  }
  if (iVar1 != 0) {
    param_1[0x40] = *(undefined4 *)(param_1[0x40] + 8);
  }
  FUN_004d4918(&DAT_00524210,param_1,0x104);
  param_1[0x40] = iVar1;
  FUN_00492580(0x1d,(byte *)&DAT_0052420c,0x108,0);
  return;
}



/* @0048e25c file=? name=FUN_0048e25c */

void __cdecl FUN_0048e25c(undefined4 param_1)

{
  DAT_0052420c = 1;
  DAT_00524210 = param_1;
  DAT_00524214 = 0;
  FUN_00492580(0x23,(byte *)&DAT_0052420c,0xc,0);
  return;
}



/* @0048e288 file=? name=FUN_0048e288 */

void __cdecl FUN_0048e288(undefined4 param_1,undefined4 param_2)

{
  DAT_0052420c = 1;
  DAT_00524210 = 0;
  DAT_00524214 = 1;
  DAT_00524218 = param_1;
  DAT_0052421c = param_2;
  FUN_00492580(0x23,(byte *)&DAT_0052420c,0x14,0);
  return;
}



/* @0048e2c0 file=? name=FUN_0048e2c0 */

void __cdecl FUN_0048e2c0(byte *param_1,uint param_2)

{
  FUN_00492580(0x1c,param_1,param_2,0);
  return;
}



/* @0048e2dc file=? name=FUN_0048e2dc */

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

void __cdecl FUN_0048e2dc(undefined4 param_1)

{
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  
  local_1c = param_1;
  local_18 = DAT_0050847c;
  local_14 = DAT_00524ae0;
  local_10 = DAT_0050792c;
  local_c = _DAT_00507930;
  _DAT_0052448c = DAT_00524ae0;
  FUN_00492580(9,(byte *)&local_1c,0x14,0);
  return;
}



/* @0048e330 file=? name=FUN_0048e330 */

void FUN_0048e330(void)

{
  FUN_004923cc(0);
  return;
}



/* @0048e340 file=? name=FUN_0048e340 */

void FUN_0048e340(void)

{
  FUN_004923cc(1);
  return;
}



/* @0048e350 file=? name=FUN_0048e350 */

void __cdecl FUN_0048e350(int param_1)

{
  *(undefined4 *)(param_1 + 0xc) = 3;
  *(undefined4 *)(param_1 + 0x10) = 0;
  FUN_004d7f10((undefined1 *)(param_1 + 0x14),s__transp__s__i860__s_00507da7);
  return;
}



/* @0048e380 file=? name=FUN_0048e380 */

undefined4 __cdecl FUN_0048e380(undefined4 param_1)

{
  return param_1;
}



/* @0048e388 file=? name=FUN_0048e388 */

void __cdecl FUN_0048e388(undefined4 *param_1,int param_2,undefined4 param_3,int param_4)

{
  int iVar1;
  void *this;
  int local_8c;
  undefined4 local_88;
  undefined4 local_84;
  uint local_c;
  int local_8;
  
  for (; 0 < param_4; param_4 = param_4 + -0x20) {
    local_88 = param_3;
    local_84 = 0x20;
    local_8c = param_2;
    FUN_00492580(0x10,(byte *)&local_8c,0xc,0);
    iVar1 = FUN_004922e0(this,&local_8,&local_8c,&local_c,0x80);
    if (iVar1 == 0) {
      FUN_004d771c(s____ERROR___velocirender_receive_f_00507dbb);
      FUN_004dee24(9);
    }
    iVar1 = param_4;
    if (0x20 < param_4) {
      iVar1 = 0x20;
    }
    FUN_004d4918(param_1,&local_8c,iVar1 << 2);
    param_1 = param_1 + 0x20;
    param_2 = param_2 + 0x20;
  }
  return;
}



/* @0048e440 file=? name=FUN_0048e440 */

void __cdecl FUN_0048e440(int *param_1,int param_2)

{
  uint uVar1;
  uint uVar2;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  
  DAT_00524490 = param_2;
  puVar3 = &DAT_00524494;
  iVar5 = 0;
  if (0 < param_2) {
    do {
      iVar4 = *param_1;
      if (iVar4 == 0) {
        FUN_004d771c(s_Error___NULL_dcs_in_articulation_00507df5);
        iVar4 = 0;
        if (iVar5 < 0) {
          return;
        }
        do {
          FUN_004d771c(s__>_dcs___d__is_0x_x_00507e22);
          iVar4 = iVar4 + 1;
        } while (iVar4 <= iVar5);
        return;
      }
      uVar1 = *(int *)(iVar4 + 0x58) >> 0x18 & 0xf;
      uVar2 = uVar1 - 1;
      if (uVar1 == 0) {
        *puVar3 = *(undefined4 *)(iVar4 + 8);
        puVar3[1] = *(undefined4 *)(iVar4 + 0x18);
        puVar3[2] = *(undefined4 *)(iVar4 + 0x1c);
        puVar3[3] = *(undefined4 *)(iVar4 + 0x20);
        puVar3[4] = *(undefined4 *)(iVar4 + 0x28);
        puVar3[5] = *(undefined4 *)(iVar4 + 0x2c);
        puVar3[6] = *(undefined4 *)(iVar4 + 0x30);
        puVar3[7] = *(undefined4 *)(iVar4 + 0x38);
        puVar3[8] = *(undefined4 *)(iVar4 + 0x3c);
        puVar3[9] = *(undefined4 *)(iVar4 + 0x40);
        puVar3[10] = *(undefined4 *)(iVar4 + 0x48);
        puVar3[0xb] = *(undefined4 *)(iVar4 + 0x4c);
        puVar3[0xc] = *(undefined4 *)(iVar4 + 0x50);
        puVar3 = puVar3 + 0xd;
      }
      else if (uVar2 < 3) {
        *puVar3 = *(undefined4 *)(iVar4 + 8);
        puVar3[1] = *(undefined4 *)(iVar4 + 0x18);
        puVar3[2] = *(undefined4 *)(iVar4 + 0x1c);
        puVar3 = puVar3 + 3;
      }
      else if (uVar2 != 3) {
        FUN_004d771c(s_Unknown_dcs_type_0x_x_in_ghost_f_00507e39);
        FUN_004dee24(9);
      }
      iVar5 = iVar5 + 1;
      param_1 = param_1 + 1;
    } while (iVar5 < param_2);
  }
  FUN_00492580(0x1f,(byte *)&DAT_00524490,(uint)(puVar3 + -0x149124),0);
  return;
}



/* @0048e5b0 file=? name=FUN_0048e5b0 */

void __cdecl
FUN_0048e5b0(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  
  local_24 = param_1;
  local_20 = param_2;
  local_1c = param_3;
  local_18 = param_4;
  local_14 = param_5;
  FUN_00492580(0x20,(byte *)&local_24,0x18,0);
  return;
}



/* @0048e5ec file=? name=FUN_0048e5ec */

void __cdecl FUN_0048e5ec(undefined4 param_1,undefined4 param_2)

{
  undefined4 local_24;
  undefined4 local_20;
  
  local_24 = param_1;
  local_20 = param_2;
  FUN_00492580(0x24,(byte *)&local_24,8,0);
  return;
}



/* @0048e614 file=? name=FUN_0048e614 */

void __cdecl FUN_0048e614(undefined4 *param_1)

{
  int iVar1;
  int local_84 [32];
  
  if (param_1 == (undefined4 *)0x0) {
    local_84[0] = -1;
    local_84[1] = 0xffffffff;
    FUN_00492580(0x21,(byte *)local_84,8,0);
  }
  else {
    iVar1 = 0;
    do {
      local_84[0] = iVar1 << 6;
      local_84[1] = 0x40;
      FUN_004d4918(local_84 + 2,param_1,0x40);
      param_1 = param_1 + 0x10;
      FUN_00492580(0x21,(byte *)local_84,0x50,0);
      iVar1 = iVar1 + 1;
    } while (iVar1 < 0x40);
  }
  return;
}



/* @0048e688 file=? name=FUN_0048e688 */

void __cdecl FUN_0048e688(undefined4 param_1,undefined4 param_2)

{
  undefined4 local_24;
  undefined4 local_20;
  
  local_24 = param_1;
  local_20 = param_2;
  FUN_00492580(0x28,(byte *)&local_24,8,0);
  return;
}



/* @0048e6b0 file=? name=FUN_0048e6b0 */

void __cdecl FUN_0048e6b0(undefined4 *param_1)

{
  int iVar1;
  int local_44 [16];
  
  iVar1 = 0;
  do {
    local_44[0] = iVar1 << 5;
    local_44[1] = 0x20;
    FUN_004d4918(local_44 + 2,param_1,0x20);
    param_1 = param_1 + 8;
    FUN_00492580(0x22,(byte *)local_44,0x28,0);
    iVar1 = iVar1 + 1;
  } while (iVar1 < 8);
  return;
}



/* @0048e700 file=? name=FUN_0048e700 */

void __cdecl
FUN_0048e700(uint param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,uint param_5,
            uint param_6,uint param_7,undefined4 *param_8,undefined4 *param_9,undefined4 *param_10,
            undefined4 *param_11,undefined4 *param_12,undefined4 *param_13)

{
  int iVar1;
  undefined4 uVar2;
  void *this;
  uint local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  uint local_3c;
  uint local_38;
  uint local_34;
  undefined4 local_30;
  uint local_c;
  int local_8;
  
  local_4c = param_1;
  local_48 = param_2;
  local_44 = param_3;
  local_40 = param_4;
  local_3c = param_5;
  local_38 = param_6;
  local_34 = param_7;
  FUN_00492580(5,(byte *)&local_4c,0x20,0);
  iVar1 = FUN_004922e0(this,&local_8,&local_4c,&local_c,0x40);
  if (iVar1 == 0) {
    FUN_004d771c(s____ERROR___velocirender_receive_f_00507e76);
    FUN_004dee24(9);
  }
  *param_8 = local_48;
  *param_9 = local_44;
  *param_10 = local_40;
  uVar2 = FUN_00487e7c(&DAT_00507eb0,local_3c,5);
  *param_11 = uVar2;
  uVar2 = FUN_00487e7c(&DAT_00507eb5,local_38,9);
  *param_12 = uVar2;
  uVar2 = FUN_00487e7c(&DAT_00507eba,local_34,10);
  *param_13 = uVar2;
  DAT_00524690 = local_30;
  FUN_00487e7c(&DAT_00507ebf,local_4c,4);
  return;
}



/* @0048e7f4 file=? name=FUN_0048e7f4 */

void __cdecl
FUN_0048e7f4(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 *param_5,undefined4 *param_6,undefined4 *param_7,undefined4 *param_8,
            undefined4 *param_9,undefined4 *param_10)

{
  int iVar1;
  undefined4 uVar2;
  void *this;
  uint local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  uint local_3c;
  uint local_38;
  uint local_34;
  undefined4 local_30;
  uint local_c;
  int local_8;
  
  local_4c = *(uint *)(param_1 + 8);
  local_48 = param_2;
  local_44 = param_3;
  local_40 = param_4;
  FUN_00492580(4,(byte *)&local_4c,0x10,0);
  iVar1 = FUN_004922e0(this,&local_8,&local_4c,&local_c,0x40);
  if (iVar1 == 0) {
    FUN_004d771c(s____ERROR___velocirender_receive_f_00507ec4);
    FUN_004dee24(9);
  }
  *param_5 = local_48;
  *param_6 = local_44;
  *param_7 = local_40;
  uVar2 = FUN_00487e7c(&DAT_00507efd,local_3c,5);
  *param_8 = uVar2;
  uVar2 = FUN_00487e7c(&DAT_00507f02,local_38,9);
  *param_9 = uVar2;
  uVar2 = FUN_00487e7c(&DAT_00507f07,local_34,10);
  *param_10 = uVar2;
  DAT_00524690 = local_30;
  FUN_00487e7c(&DAT_00507f0c,local_4c,4);
  return;
}



/* @0048e8d8 file=? name=FUN_0048e8d8 */

void __cdecl
FUN_0048e8d8(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_14 = param_1;
  local_10 = param_2;
  local_c = param_3;
  local_8 = param_4;
  FUN_00492580(0x26,(byte *)&local_14,0x10,0);
  return;
}



/* @0048e910 file=? name=FUN_0048e910 */

void __cdecl FUN_0048e910(int *param_1)

{
  int iVar1;
  int local_c [2];
  
  iVar1 = DAT_005078dc;
  DAT_005078dc = DAT_005078dc + 1;
  FUN_0049a300(4,s_remote_VelociRender_create_2d_0x_00507f11);
  *param_1 = iVar1;
  local_c[0] = iVar1;
  local_c[1] = 0;
  FUN_00492580(0x29,(byte *)local_c,8,0);
  if (DAT_005078e8 != 0) {
    FUN_0048d220(0x29);
  }
  return;
}



/* @0048e96c file=? name=FUN_0048e96c */

void __cdecl FUN_0048e96c(undefined4 *param_1)

{
  undefined4 local_c;
  undefined4 local_8;
  
  FUN_0049a300(4,s_remote_VelociRender_delete_2d_no_00507f35);
  local_c = *param_1;
  local_8 = 0;
  FUN_00492580(0x2a,(byte *)&local_c,8,0);
  return;
}



/* @0048e9ac file=? name=FUN_0048e9ac */

void __cdecl FUN_0048e9ac(byte *param_1,int param_2)

{
  undefined4 uVar1;
  undefined4 uVar2;
  byte *pbVar3;
  int iVar4;
  
  uVar1 = *(undefined4 *)(param_1 + 4);
  uVar2 = *(undefined4 *)(param_1 + 8);
  FUN_0049a300(4,s_VelociRender_flush_on_2d_display_00507f6a);
  if (param_2 == 0) {
    param_1[4] = 0;
    param_1[5] = 0;
    param_1[6] = 0;
    param_1[7] = 0;
    param_1[8] = 0;
    param_1[9] = 0;
    param_1[10] = 0;
    param_1[0xb] = 0;
  }
  else {
    iVar4 = 1;
    pbVar3 = param_1;
    while (pbVar3 = *(byte **)(pbVar3 + 4), pbVar3 != (byte *)0x0) {
      iVar4 = iVar4 + 1;
    }
    param_1[4] = 1;
    param_1[5] = 0;
    param_1[6] = 0;
    param_1[7] = 0;
    *(int *)(param_1 + 8) = iVar4;
  }
  FUN_00492580(0x2b,param_1,0x8c,0);
  *(undefined4 *)(param_1 + 4) = uVar1;
  *(undefined4 *)(param_1 + 8) = uVar2;
  return;
}



/* @0048ea24 file=? name=FUN_0048ea24 */

undefined4 FUN_0048ea24(void)

{
  int iVar1;
  void *this;
  undefined4 local_2c;
  undefined4 local_28;
  uint local_c;
  int local_8;
  
  FUN_0049a300(4,s_remote_VelociRender_FreeMem_00507fa3);
  local_2c = 0x29a;
  local_28 = 0x309;
  FUN_00492580(0x2c,(byte *)&local_2c,8,0);
  iVar1 = FUN_004922e0(this,&local_8,&local_2c,&local_c,0x20);
  if (iVar1 == 0) {
    FUN_004d771c(s____ERROR___velocirender_receive_f_00507fc0);
    FUN_004dee24(9);
  }
  if (local_8 != 0x2c) {
    FUN_004d771c(s____ERROR___unexpected_action__d_r_00507ff6);
    FUN_004dee24(9);
  }
  return local_2c;
}



/* @0048eaac file=? name=FUN_0048eaac */

void __cdecl FUN_0048eaac(int param_1,undefined4 *param_2)

{
  int iVar1;
  void *this;
  undefined4 local_1c [4];
  uint local_c;
  int local_8;
  
  local_1c[0] = *(undefined4 *)(param_1 + 8);
  FUN_0049a300(4,s_ghost_get_geom_verts_obj_0x_x_0050802e);
  FUN_00492580(0x2e,(byte *)local_1c,8,0);
  iVar1 = FUN_004922e0(this,&local_8,param_2,&local_c,0x100);
  if (iVar1 == 0) {
    FUN_004d771c(s____ERROR___velocirender_receive_f_0050804d);
    FUN_004dee24(9);
  }
  return;
}



/* @0048eb14 file=? name=FUN_0048eb14 */

void __cdecl FUN_0048eb14(int param_1,undefined4 *param_2,undefined4 param_3,int param_4)

{
  int iVar1;
  void *extraout_ECX;
  void *extraout_ECX_00;
  int iVar2;
  void *this;
  undefined4 local_34;
  undefined4 local_30;
  int local_2c;
  undefined4 local_28;
  int local_24;
  uint local_c;
  int local_8;
  
  iVar2 = param_4 * 6;
  local_34 = *(undefined4 *)(param_1 + 8);
  local_30 = param_3;
  local_2c = param_4;
  local_28 = 10;
  local_24 = (iVar2 + 0x3b) / 0x3c;
  FUN_0049a300(4,s_ghost_get_geom_conns_vertex0__d_v_00508086);
  FUN_00492580(0x2f,(byte *)&local_34,0x20,0);
  this = extraout_ECX;
  for (; 0x3b < iVar2; iVar2 = iVar2 + -0x3c) {
    iVar1 = FUN_004922e0(this,&local_8,param_2,&local_c,0x100);
    this = extraout_ECX_00;
    if (iVar1 == 0) {
      FUN_004d771c(s____ERROR___velocirender_receive_f_005080bc);
      this = (void *)0x9;
      FUN_004dee24(9);
    }
    if (local_8 != 0x2f) {
      FUN_004d771c(s_Protocol_error__action__d_in_get_005080f9);
      this = (void *)0x9;
      FUN_004dee24(9);
    }
    param_2 = param_2 + 0x3c;
  }
  if (iVar2 != 0) {
    iVar2 = FUN_004922e0(this,&local_8,param_2,&local_c,0x100);
    if (iVar2 == 0) {
      FUN_004d771c(s____ERROR___velocirender_receive_f_00508126);
      FUN_004dee24(9);
    }
    if (local_8 != 0x2f) {
      FUN_004d771c(s_Protocol_error__action__d_in_get_00508163);
      FUN_004dee24(9);
    }
  }
  return;
}



/* @0048ec34 file=? name=FUN_0048ec34 */

undefined4 __cdecl FUN_0048ec34(int param_1)

{
  int iVar1;
  void *this;
  undefined4 local_1c [4];
  int local_c;
  uint local_8;
  
  local_1c[0] = *(undefined4 *)(param_1 + 8);
  FUN_00492580(0x30,(byte *)local_1c,0x10,0);
  iVar1 = FUN_004922e0(this,&local_c,local_1c,&local_8,0x10);
  if (iVar1 == 0) {
    FUN_004d771c(s____ERROR___velocirender_receive_f_00508196);
    FUN_004dee24(9);
  }
  return local_1c[0];
}



/* @0048ec8c file=? name=FUN_0048ec8c */

void __cdecl FUN_0048ec8c(int param_1,undefined4 param_2)

{
  undefined4 local_14;
  undefined4 local_10;
  
  local_14 = *(undefined4 *)(param_1 + 8);
  local_10 = param_2;
  FUN_00492580(0x31,(byte *)&local_14,8,0);
  return;
}



/* @0048ecb8 file=? name=FUN_0048ecb8 */

void FUN_0048ecb8(void)

{
  byte local_14 [16];
  
  local_14[0] = 0;
  local_14[1] = 0;
  local_14[2] = 0;
  local_14[3] = 0;
  FUN_00492580(0x32,local_14,4,0);
  return;
}



/* @0048ecdc file=? name=FUN_0048ecdc */

void __cdecl FUN_0048ecdc(int *param_1,int param_2)

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  
  puVar2 = &DAT_00524490;
  iVar3 = 0;
  while( true ) {
    iVar1 = *param_1;
    param_1 = param_1 + 1;
    if (iVar1 == 0) break;
    *puVar2 = *(undefined4 *)(iVar1 + 8);
    puVar2 = puVar2 + 1;
    iVar3 = iVar3 + 1;
  }
  *puVar2 = 0;
  FUN_00492580(param_2,(byte *)&DAT_00524490,(iVar3 + 1) * 4,0);
  return;
}



/* @0048ed20 file=? name=FUN_0048ed20 */

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

void FUN_0048ed20(void)

{
  PTR_DAT_005078e4 = &DAT_00523e0c;
  DAT_005078e8 = 1;
  DAT_005078dc = 1;
  _DAT_00507928 = 0;
  DAT_0050792c = 1;
  _DAT_00507930 = 0x3f800000;
  return;
}



/* @0048ed5c file=? name=FUN_0048ed5c */

undefined4 __cdecl FUN_0048ed5c(undefined4 *param_1)

{
  return *param_1;
}



/* @0048eda0 file=? name=FUN_0048eda0 */

uint __cdecl FUN_0048eda0(int param_1,int param_2,int param_3,int param_4)

{
  uint uVar1;
  
  uVar1 = param_1 >> 4 & 0xfU | (param_2 >> 4 & 0xfU) << 4;
  return ((int)(uVar1 | (param_3 >> 4 & 0xfU) << 8 | (param_4 >> 4 & 0xfU) << 0xc) >> 8) << 0x10 |
         uVar1 << 0x18;
}



/* @0048ee14 file=? name=FUN_0048ee14 */

uint __cdecl FUN_0048ee14(int param_1,int param_2,int param_3)

{
  int iVar1;
  
  iVar1 = param_1 * 0x33 + param_2 * 0xb3 + param_3 * 0x19 >> 8;
  return iVar1 << 8 | iVar1 << 0x10 | iVar1 << 0x18;
}



/* @0048ee5c file=? name=FUN_0048ee5c */

void __cdecl
FUN_0048ee5c(int param_1,uint *param_2,byte *param_3,int param_4,int param_5,int param_6)

{
  byte bVar1;
  byte *pbVar2;
  byte *pbVar3;
  byte *pbVar4;
  uint uVar5;
  uint local_18;
  int local_8;
  
  DAT_0050847c = 1;
  if (param_5 == 0) {
    local_18 = *(uint *)(param_1 + 0x20);
  }
  else {
    local_18 = 0;
  }
  if (*(int *)(param_1 + 0x1c) == 1) {
    local_8 = 0;
    if (0 < param_4) {
      do {
        uVar5 = (uint)*param_3;
        param_3 = param_3 + 1;
        if (param_6 == 0) {
          uVar5 = FUN_0048eda0(uVar5,uVar5,uVar5,0xff);
          *param_2 = uVar5;
        }
        else {
          uVar5 = FUN_0048ee14(uVar5,uVar5,uVar5);
          *param_2 = uVar5;
        }
        param_2 = param_2 + 1;
        local_8 = local_8 + 1;
      } while (local_8 < param_4);
    }
  }
  else if (*(int *)(param_1 + 0x1c) == 2) {
    local_8 = 0;
    if (0 < param_4) {
      do {
        uVar5 = (uint)*param_3;
        pbVar2 = param_3 + 1;
        param_3 = param_3 + 2;
        local_18 = local_18 | *pbVar2 != 0xff;
        if (param_6 == 0) {
          uVar5 = FUN_0048eda0(uVar5,uVar5,uVar5,(uint)*pbVar2);
          *param_2 = uVar5;
        }
        else {
          uVar5 = FUN_0048ee14(uVar5,uVar5,uVar5);
          *param_2 = uVar5;
        }
        param_2 = param_2 + 1;
        local_8 = local_8 + 1;
      } while (local_8 < param_4);
    }
  }
  else if (*(int *)(param_1 + 0x1c) == 3) {
    local_8 = 0;
    if (0 < param_4) {
      do {
        bVar1 = *param_3;
        pbVar2 = param_3 + 1;
        pbVar3 = param_3 + 2;
        param_3 = param_3 + 3;
        if (param_6 == 0) {
          uVar5 = FUN_0048eda0((uint)*pbVar3,(uint)*pbVar2,(uint)bVar1,0xff);
          *param_2 = uVar5;
        }
        else {
          uVar5 = FUN_0048ee14((uint)*pbVar3,(uint)*pbVar2,(uint)bVar1);
          *param_2 = uVar5;
        }
        param_2 = param_2 + 1;
        local_8 = local_8 + 1;
      } while (local_8 < param_4);
    }
  }
  else if ((*(int *)(param_1 + 0x1c) == 4) && (local_8 = 0, 0 < param_4)) {
    do {
      bVar1 = *param_3;
      pbVar2 = param_3 + 1;
      pbVar3 = param_3 + 2;
      pbVar4 = param_3 + 3;
      param_3 = param_3 + 4;
      local_18 = local_18 | bVar1 != 0xff;
      if (param_6 == 0) {
        uVar5 = FUN_0048eda0((uint)*pbVar4,(uint)*pbVar3,(uint)*pbVar2,(uint)bVar1);
        *param_2 = uVar5;
      }
      else {
        uVar5 = FUN_0048ee14((uint)*pbVar4,(uint)*pbVar3,(uint)*pbVar2);
        *param_2 = uVar5;
      }
      param_2 = param_2 + 1;
      local_8 = local_8 + 1;
    } while (local_8 < param_4);
  }
  if (param_6 == 0) {
    *(uint *)(param_1 + 0x20) = local_18 | 2;
  }
  else {
    *(undefined4 *)(param_1 + 0x20) = 0;
  }
  return;
}



/* @0048f0bc file=? name=FUN_0048f0bc */

undefined4 * __cdecl FUN_0048f0bc(LPCSTR param_1)

{
  undefined *puVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  char local_30 [4];
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24 [5];
  int local_10;
  int local_c;
  undefined4 *local_8;
  
  piVar2 = FUN_004d6f54(param_1,&DAT_005081ed);
  if (DAT_005081dc == (byte *)0x0) {
    DAT_005081dc = (byte *)FUN_00452c38(0x40000);
  }
  if (DAT_005081dc == (byte *)0x0) {
    FUN_004d771c(s_Failed_to_malloc_temporary_textu_005081f0);
    local_8 = (undefined4 *)0x0;
  }
  else {
    DAT_0050847c = 1;
    if (piVar2 == (int *)0x0) {
      FUN_004d771c(s_failed_to_open_file__s_00508229);
      local_8 = (undefined4 *)0x0;
    }
    else {
      FUN_004d71e0(local_30,1,8,piVar2);
      puVar1 = PTR_s_DIV_BSL2_005081d4;
      iVar3 = FUN_004d4a78(PTR_s_DIV_BSL2_005081d4);
      iVar3 = FUN_004d4ae0(local_30,puVar1,iVar3);
      if (iVar3 == 0) {
        local_c = 0;
        DAT_005081d8 = 0;
        FUN_004d71e0(local_30,1,0x10,piVar2);
        iVar3 = FUN_0048ed5c((undefined4 *)local_30);
        iVar4 = FUN_0048ed5c(&local_2c);
        local_10 = FUN_0048ed5c(&local_28);
        iVar5 = FUN_0048ed5c(local_24);
        if (local_10 == 4) {
          if ((iVar3 == 0x100) && (iVar4 == 0x100)) {
            local_c = 1;
          }
          if ((iVar3 == 0x80) && (iVar4 == 0x80)) {
            local_c = 1;
          }
          if ((iVar3 == 0x80) && (iVar4 == 0x40)) {
            local_c = 1;
          }
          if ((iVar3 == 0x40) && (iVar4 == 0x40)) {
            local_c = 1;
          }
          if (local_c == 0) {
            FUN_004d771c(s_Cannot_load_bsl_file_with_x_size_0050826d);
            FUN_004d6b08(piVar2);
            local_8 = (undefined4 *)0x0;
          }
          else {
            FUN_004d71e0((char *)DAT_005081dc,1,iVar5,piVar2);
            local_8 = (undefined4 *)FUN_00489788();
            FUN_0048c32c((int)local_8,iVar3,iVar4);
            FUN_0048c3c8((int)local_8,4);
            FUN_004d71e0((char *)DAT_005081dc,4,iVar3 * iVar4,piVar2);
            FUN_004d6b08(piVar2);
            FUN_0048d5b0(local_8);
            FUN_0048c460((int)local_8,DAT_005081dc,iVar3,iVar4);
          }
        }
        else {
          FUN_004d771c(s_Cannot_load_bsl_file_with_z_size_00508241);
          FUN_004d6b08(piVar2);
          local_8 = (undefined4 *)0x0;
        }
      }
      else {
        local_8 = (undefined4 *)0x0;
      }
    }
  }
  return local_8;
}



/* @0048f2c8 file=? name=FUN_0048f2c8 */

undefined4 FUN_0048f2c8(LPCSTR param_1,int param_2)

{
  undefined *puVar1;
  int *piVar2;
  undefined4 uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  char acStack_38 [4];
  undefined4 uStack_34;
  undefined4 uStack_30;
  undefined4 auStack_2c [5];
  int iStack_18;
  int iStack_14;
  int iStack_10;
  int iStack_c;
  undefined4 *puStack_8;
  
  piVar2 = FUN_004d6f54(param_1,&DAT_005082a0);
  puStack_8 = (undefined4 *)FUN_0048c2f0(param_2);
  if (puStack_8 == (undefined4 *)0x0) {
    uVar3 = 0;
  }
  else {
    if (DAT_005081dc == (byte *)0x0) {
      DAT_005081dc = (byte *)FUN_00452c38(0x40000);
    }
    if (DAT_005081dc == (byte *)0x0) {
      FUN_004d771c(s_Failed_to_malloc_temporary_textu_005082a3);
      uVar3 = 0;
    }
    else {
      DAT_0050847c = 1;
      if (piVar2 == (int *)0x0) {
        FUN_004d771c(s_failed_to_open_file__s_005082dc);
        uVar3 = 0;
      }
      else {
        FUN_004d71e0(acStack_38,1,8,piVar2);
        puVar1 = PTR_s_DIV_BSL2_005081d4;
        iVar4 = FUN_004d4a78(PTR_s_DIV_BSL2_005081d4);
        iVar4 = FUN_004d4ae0(acStack_38,puVar1,iVar4);
        if (iVar4 == 0) {
          iStack_c = 0;
          DAT_005081d8 = 0;
          FUN_004d71e0(acStack_38,1,0x10,piVar2);
          iVar4 = FUN_0048ed5c((undefined4 *)acStack_38);
          iVar5 = FUN_0048ed5c(&uStack_34);
          iStack_18 = FUN_0048ed5c(&uStack_30);
          iVar6 = FUN_0048ed5c(auStack_2c);
          if (iStack_18 == 4) {
            if ((iVar4 == 0x100) && (iVar5 == 0x100)) {
              iStack_c = 1;
            }
            if ((iVar4 == 0x80) && (iVar5 == 0x80)) {
              iStack_c = 1;
            }
            if ((iVar4 == 0x80) && (iVar5 == 0x40)) {
              iStack_c = 1;
            }
            if ((iVar4 == 0x40) && (iVar5 == 0x40)) {
              iStack_c = 1;
            }
            if (iStack_c == 0) {
              FUN_004d771c(s_Cannot_load_bsl_file_with_x_size_00508320);
              FUN_004d6b08(piVar2);
              uVar3 = 0;
            }
            else {
              FUN_004d71e0((char *)DAT_005081dc,1,iVar6,piVar2);
              FUN_0048c378((int)puStack_8,&iStack_10,&iStack_14);
              if ((iVar4 == iStack_10) && (iVar5 == iStack_14)) {
                FUN_0048c32c((int)puStack_8,iVar4,iVar5);
                FUN_0048c3c8((int)puStack_8,4);
                FUN_004d71e0((char *)DAT_005081dc,4,iVar4 * iVar5,piVar2);
                FUN_004d6b08(piVar2);
                FUN_0048d5b0(puStack_8);
                FUN_0048c460((int)puStack_8,DAT_005081dc,iVar4,iVar5);
                uVar3 = 1;
              }
              else {
                FUN_004d771c(s_Cannot_replace_bsl_file__>_size_m_00508353);
                FUN_004d6b08(piVar2);
                uVar3 = 0;
              }
            }
          }
          else {
            FUN_004d771c(s_Cannot_load_bsl_file_with_z_size_005082f4);
            FUN_004d6b08(piVar2);
            uVar3 = 0;
          }
        }
        else {
          uVar3 = 0;
        }
      }
    }
  }
  return uVar3;
}



/* @0048f2ce file=? name=FUN_0048f2ce */

undefined4 FUN_0048f2ce(void)

{
  undefined *puVar1;
  int *piVar2;
  undefined4 uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int unaff_EBP;
  
  piVar2 = FUN_004d6f54(*(LPCSTR *)(unaff_EBP + 8),&DAT_005082a0);
  uVar3 = FUN_0048c2f0(*(int *)(unaff_EBP + 0xc));
  *(undefined4 *)(unaff_EBP + -4) = uVar3;
  if (*(int *)(unaff_EBP + -4) == 0) {
    uVar3 = 0;
  }
  else {
    if (DAT_005081dc == (byte *)0x0) {
      DAT_005081dc = (byte *)FUN_00452c38(0x40000);
    }
    if (DAT_005081dc == (byte *)0x0) {
      FUN_004d771c(s_Failed_to_malloc_temporary_textu_005082a3);
      uVar3 = 0;
    }
    else {
      DAT_0050847c = 1;
      if (piVar2 == (int *)0x0) {
        FUN_004d771c(s_failed_to_open_file__s_005082dc);
        uVar3 = 0;
      }
      else {
        FUN_004d71e0((char *)(unaff_EBP + -0x34),1,8,piVar2);
        puVar1 = PTR_s_DIV_BSL2_005081d4;
        iVar4 = FUN_004d4a78(PTR_s_DIV_BSL2_005081d4);
        iVar4 = FUN_004d4ae0((char *)(unaff_EBP + -0x34),puVar1,iVar4);
        if (iVar4 == 0) {
          *(undefined4 *)(unaff_EBP + -8) = 0;
          DAT_005081d8 = 0;
          FUN_004d71e0((char *)(unaff_EBP + -0x34),1,0x10,piVar2);
          iVar4 = FUN_0048ed5c((undefined4 *)(unaff_EBP + -0x34));
          iVar5 = FUN_0048ed5c((undefined4 *)(unaff_EBP + -0x30));
          uVar3 = FUN_0048ed5c((undefined4 *)(unaff_EBP + -0x2c));
          *(undefined4 *)(unaff_EBP + -0x14) = uVar3;
          iVar6 = FUN_0048ed5c((undefined4 *)(unaff_EBP + -0x28));
          if (*(int *)(unaff_EBP + -0x14) == 4) {
            if ((iVar4 == 0x100) && (iVar5 == 0x100)) {
              *(undefined4 *)(unaff_EBP + -8) = 1;
            }
            if ((iVar4 == 0x80) && (iVar5 == 0x80)) {
              *(undefined4 *)(unaff_EBP + -8) = 1;
            }
            if ((iVar4 == 0x80) && (iVar5 == 0x40)) {
              *(undefined4 *)(unaff_EBP + -8) = 1;
            }
            if ((iVar4 == 0x40) && (iVar5 == 0x40)) {
              *(undefined4 *)(unaff_EBP + -8) = 1;
            }
            if (*(int *)(unaff_EBP + -8) == 0) {
              FUN_004d771c(s_Cannot_load_bsl_file_with_x_size_00508320);
              FUN_004d6b08(piVar2);
              uVar3 = 0;
            }
            else {
              FUN_004d71e0((char *)DAT_005081dc,1,iVar6,piVar2);
              FUN_0048c378(*(int *)(unaff_EBP + -4),(undefined4 *)(unaff_EBP + -0xc),
                           (undefined4 *)(unaff_EBP + -0x10));
              if ((iVar4 == *(int *)(unaff_EBP + -0xc)) && (iVar5 == *(int *)(unaff_EBP + -0x10))) {
                FUN_0048c32c(*(int *)(unaff_EBP + -4),iVar4,iVar5);
                FUN_0048c3c8(*(int *)(unaff_EBP + -4),4);
                FUN_004d71e0((char *)DAT_005081dc,4,iVar4 * iVar5,piVar2);
                FUN_004d6b08(piVar2);
                FUN_0048d5b0(*(undefined4 **)(unaff_EBP + -4));
                FUN_0048c460(*(int *)(unaff_EBP + -4),DAT_005081dc,iVar4,iVar5);
                uVar3 = 1;
              }
              else {
                FUN_004d771c(s_Cannot_replace_bsl_file__>_size_m_00508353);
                FUN_004d6b08(piVar2);
                uVar3 = 0;
              }
            }
          }
          else {
            FUN_004d771c(s_Cannot_load_bsl_file_with_z_size_005082f4);
            FUN_004d6b08(piVar2);
            uVar3 = 0;
          }
        }
        else {
          uVar3 = 0;
        }
      }
    }
  }
  return uVar3;
}



/* @0048f52c file=? name=FUN_0048f52c */

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

{
  byte bVar1;
  uint uVar2;
  undefined4 uVar3;
  byte *pbVar4;
  int unaff_ESI;
  int iVar5;
  int local_24;
  char local_20;
  char local_1f [3];
  byte local_1c;
  byte local_1b;
  undefined1 local_1a;
  byte local_19;
  byte *local_18;
  int local_14;
  int local_10;
  int local_c;
  int local_8;
  
  if (*(char *)(param_2 + 0x12) == '\x01') {
    local_8 = 1;
  }
  else if ((*(char *)(param_2 + 0x12) == '\b') && (*(char *)(param_2 + 1) == '\0')) {
    local_8 = 1;
  }
  else if (*(char *)(param_2 + 0x12) == ' ') {
    local_8 = 4;
  }
  else {
    local_8 = 3;
  }
  local_18 = (byte *)FUN_00452c38((uint)*(ushort *)(param_2 + 0xe) *
                                  (uint)*(ushort *)(param_2 + 0x10) * local_8);
  if (local_18 == (byte *)0x0) {
    FUN_0049a300(0,s_dpl_tgaRead_failed_to_allocate_m_0050838b);
  }
  else {
    bVar1 = *(byte *)(param_2 + 0x13);
    if ((bVar1 & 0x20) == 0) {
      if ((bVar1 & 0x10) == 0) {
        local_c = local_8;
        local_10 = 0;
        pbVar4 = local_18;
      }
      else {
        local_c = -local_8;
        local_10 = (uint)*(ushort *)(param_2 + 0xe) * 2 * local_8;
        pbVar4 = local_18 + (*(ushort *)(param_2 + 0xe) - 1) * local_8;
      }
    }
    else if ((bVar1 & 0x10) == 0) {
      local_c = local_8;
      local_10 = -((uint)*(ushort *)(param_2 + 0xe) * 2 * local_8);
      pbVar4 = local_18 +
               (uint)*(ushort *)(param_2 + 0xe) * (*(ushort *)(param_2 + 0x10) - 1) * local_8;
    }
    else {
      local_c = -local_8;
      local_10 = 0;
      pbVar4 = local_18 +
               ((uint)*(ushort *)(param_2 + 0xe) * (uint)*(ushort *)(param_2 + 0x10) + -1) * local_8
      ;
    }
    if (*(byte *)(param_2 + 2) < 4) {
      for (local_14 = 0; local_14 < (int)(uint)*(ushort *)(param_2 + 0x10); local_14 = local_14 + 1)
      {
        bVar1 = *(byte *)(param_2 + 0x12);
        if (bVar1 < 0x11) {
          if (bVar1 == 0x10) {
            for (iVar5 = 0; iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe); iVar5 = iVar5 + 1) {
              uVar2 = FUN_00492cb4(param_1);
              *pbVar4 = (byte)((int)(uVar2 & 0xffff) >> 7) & 0xf8;
              pbVar4[1] = (byte)((int)(uVar2 & 0xffff) >> 2) & 0xf8;
              pbVar4[2] = (byte)(uVar2 << 3);
              pbVar4 = pbVar4 + local_c;
            }
          }
          else if (bVar1 == 1) {
            iVar5 = 0;
            while (iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe)) {
              uVar3 = FUN_00492c84(param_1);
              bVar1 = 0x80;
              for (; (bVar1 != 0 && (iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe)));
                  iVar5 = iVar5 + 1) {
                if ((bVar1 & (byte)uVar3) == 0) {
                  *pbVar4 = 0xff;
                }
                else {
                  *pbVar4 = 0;
                }
                pbVar4 = pbVar4 + local_c;
                bVar1 = bVar1 >> 1;
              }
            }
          }
          else if (bVar1 == 8) {
            if (local_8 == 1) {
              for (iVar5 = 0; iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe); iVar5 = iVar5 + 1) {
                uVar3 = FUN_00492c84(param_1);
                *pbVar4 = (byte)uVar3;
                pbVar4 = pbVar4 + local_c;
              }
            }
            else {
              for (iVar5 = 0; iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe); iVar5 = iVar5 + 1) {
                uVar2 = FUN_00492c84(param_1);
                FUN_004d4918((undefined4 *)pbVar4,
                             (undefined4 *)((uVar2 & 0xff) * 3 + param_2 + 0x14),3);
                pbVar4 = pbVar4 + local_c;
              }
            }
          }
        }
        else if (bVar1 == 0x18) {
          for (iVar5 = 0; iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe); iVar5 = iVar5 + 1) {
            FUN_00492f10(param_1,(char *)pbVar4,3);
            pbVar4 = pbVar4 + local_c;
          }
        }
        else if (bVar1 == 0x20) {
          for (iVar5 = 0; iVar5 < (int)(uint)*(ushort *)(param_2 + 0xe); iVar5 = iVar5 + 1) {
            FUN_00492f10(param_1,(char *)(pbVar4 + 1),3);
            uVar2 = FUN_00492c84(param_1);
            if ((uVar2 & 0x80) == 0) {
              *pbVar4 = 0xff;
            }
            else {
              *pbVar4 = (char)uVar2 * '\x02';
            }
            pbVar4 = pbVar4 + local_c;
          }
        }
        pbVar4 = pbVar4 + local_10;
      }
    }
    else {
      for (local_14 = 0; local_14 < (int)(uint)*(ushort *)(param_2 + 0x10); local_14 = local_14 + 1)
      {
        while (unaff_ESI < (int)(uint)*(ushort *)(param_2 + 0xe)) {
          uVar2 = FUN_00492c84(param_1);
          local_24 = (uVar2 & 0x7f) + 1;
          if ((uVar2 & 0x80) == 0) {
            bVar1 = *(byte *)(param_2 + 0x12);
            if (bVar1 < 0x11) {
              if (bVar1 == 0x10) {
                while (local_24 != 0) {
                  uVar2 = FUN_00492cb4(param_1);
                  *pbVar4 = (byte)((int)(uVar2 & 0xffff) >> 7) & 0xf8;
                  pbVar4[1] = (byte)((int)(uVar2 & 0xffff) >> 2) & 0xf8;
                  pbVar4[2] = (byte)(uVar2 << 3);
                  pbVar4 = pbVar4 + local_c;
                  unaff_ESI = unaff_ESI + 1;
                  local_24 = local_24 + -1;
                }
              }
              else if (bVar1 == 1) {
                while (iVar5 = local_24 + -1, local_24 != 0) {
                  uVar3 = FUN_00492c84(param_1);
                  local_19 = (byte)uVar3;
                  bVar1 = 0x80;
                  for (; (local_24 = iVar5, bVar1 != 0 &&
                         (unaff_ESI < (int)(uint)*(ushort *)(param_2 + 0xe)));
                      unaff_ESI = unaff_ESI + 1) {
                    if ((local_19 & bVar1) == 0) {
                      *pbVar4 = 0xff;
                    }
                    else {
                      *pbVar4 = 0;
                    }
                    pbVar4 = pbVar4 + local_c;
                    bVar1 = bVar1 >> 1;
                  }
                }
              }
              else if (bVar1 == 8) {
                if (local_8 == 1) {
                  while (local_24 != 0) {
                    uVar3 = FUN_00492c84(param_1);
                    *pbVar4 = (byte)uVar3;
                    pbVar4 = pbVar4 + local_c;
                    unaff_ESI = unaff_ESI + 1;
                    local_24 = local_24 + -1;
                  }
                }
                else {
                  while (local_24 != 0) {
                    uVar2 = FUN_00492c84(param_1);
                    local_19 = (byte)uVar2;
                    FUN_004d4918((undefined4 *)pbVar4,
                                 (undefined4 *)((uVar2 & 0xff) * 3 + param_2 + 0x14),3);
                    pbVar4 = pbVar4 + local_c;
                    unaff_ESI = unaff_ESI + 1;
                    local_24 = local_24 + -1;
                  }
                }
              }
            }
            else if (bVar1 == 0x18) {
              while (local_24 != 0) {
                FUN_00492f10(param_1,(char *)pbVar4,3);
                pbVar4 = pbVar4 + local_c;
                unaff_ESI = unaff_ESI + 1;
                local_24 = local_24 + -1;
              }
            }
            else if (bVar1 == 0x20) {
              while (local_24 != 0) {
                FUN_00492f10(param_1,(char *)(pbVar4 + 1),3);
                uVar2 = FUN_00492c84(param_1);
                if ((uVar2 & 0x80) == 0) {
                  *pbVar4 = 0xff;
                }
                else {
                  *pbVar4 = (char)uVar2 * '\x02';
                }
                pbVar4 = pbVar4 + local_c;
                unaff_ESI = unaff_ESI + 1;
                local_24 = local_24 + -1;
              }
            }
          }
          else {
            bVar1 = *(byte *)(param_2 + 0x12);
            if (bVar1 < 0x11) {
              if (bVar1 == 0x10) {
                uVar2 = FUN_00492cb4(param_1);
                local_1c = (byte)((int)(uVar2 & 0xffff) >> 7) & 0xf8;
                local_1b = (byte)((int)(uVar2 & 0xffff) >> 2) & 0xf8;
                local_1a = (undefined1)(uVar2 << 3);
                while (local_24 != 0) {
                  FUN_004d4918((undefined4 *)pbVar4,(undefined4 *)&local_1c,3);
                  pbVar4 = pbVar4 + local_c;
                  unaff_ESI = unaff_ESI + 1;
                  local_24 = local_24 + -1;
                }
              }
              else if (bVar1 == 1) {
                uVar3 = FUN_00492c84(param_1);
                local_19 = (byte)uVar3;
                while (iVar5 = local_24 + -1, local_24 != 0) {
                  bVar1 = 0x80;
                  for (; (local_24 = iVar5, bVar1 != 0 &&
                         (unaff_ESI < (int)(uint)*(ushort *)(param_2 + 0xe)));
                      unaff_ESI = unaff_ESI + 1) {
                    if ((local_19 & bVar1) == 0) {
                      *pbVar4 = 0xff;
                    }
                    else {
                      *pbVar4 = 0;
                    }
                    pbVar4 = pbVar4 + local_c;
                    bVar1 = bVar1 >> 1;
                  }
                }
              }
              else if (bVar1 == 8) {
                uVar3 = FUN_00492c84(param_1);
                local_19 = (byte)uVar3;
                if (local_8 == 1) {
                  while (local_24 != 0) {
                    *pbVar4 = local_19;
                    pbVar4 = pbVar4 + local_c;
                    unaff_ESI = unaff_ESI + 1;
                    local_24 = local_24 + -1;
                  }
                }
                else {
                  while (local_24 != 0) {
                    FUN_004d4918((undefined4 *)pbVar4,
                                 (undefined4 *)((uint)local_19 * 3 + param_2 + 0x14),3);
                    pbVar4 = pbVar4 + local_c;
                    unaff_ESI = unaff_ESI + 1;
                    local_24 = local_24 + -1;
                  }
                }
              }
            }
            else if (bVar1 == 0x18) {
              FUN_00492f10(param_1,(char *)&local_1c,3);
              while (local_24 != 0) {
                FUN_004d4918((undefined4 *)pbVar4,(undefined4 *)&local_1c,3);
                pbVar4 = pbVar4 + local_c;
                unaff_ESI = unaff_ESI + 1;
                local_24 = local_24 + -1;
              }
            }
            else if (bVar1 == 0x20) {
              FUN_00492f10(param_1,local_1f,3);
              uVar2 = FUN_00492c84(param_1);
              if ((uVar2 & 0x80) == 0) {
                local_20 = -1;
              }
              else {
                local_20 = (char)uVar2 * '\x02';
              }
              while (local_24 != 0) {
                FUN_004d4918((undefined4 *)pbVar4,(undefined4 *)&local_20,4);
                pbVar4 = pbVar4 + local_c;
                unaff_ESI = unaff_ESI + 1;
                local_24 = local_24 + -1;
              }
            }
          }
        }
        pbVar4 = pbVar4 + local_10;
      }
    }
    FUN_0048c32c((int)param_3,(uint)*(ushort *)(param_2 + 0xe),(uint)*(ushort *)(param_2 + 0x10));
    FUN_0048c3c8((int)param_3,local_8);
    FUN_0048c548((int)param_3,local_18,0,
                 (uint)*(ushort *)(param_2 + 0xe) * (uint)*(ushort *)(param_2 + 0x10));
    FUN_00452c88((int *)local_18);
    FUN_0048d5b0(param_3);
  }
  return;
}



/* @0048fb6c file=? name=FUN_0048fb6c */

void __cdecl FUN_0048fb6c(undefined4 *param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  int iVar2;
  byte *pbVar3;
  uint uVar4;
  byte local_318;
  char local_317;
  char local_316;
  ushort local_314;
  ushort local_312;
  char local_310;
  undefined2 local_30e;
  undefined2 local_30c;
  undefined2 local_30a;
  undefined2 local_308;
  undefined1 local_306;
  undefined1 local_305;
  byte local_304 [768];
  
  uVar1 = FUN_00492c84(param_1);
  local_318 = (byte)uVar1;
  uVar1 = FUN_00492c84(param_1);
  local_317 = (char)uVar1;
  uVar1 = FUN_00492c84(param_1);
  local_316 = (char)uVar1;
  uVar1 = FUN_00492cb4(param_1);
  local_314 = (ushort)uVar1;
  uVar1 = FUN_00492cb4(param_1);
  local_312 = (ushort)uVar1;
  uVar1 = FUN_00492c84(param_1);
  local_310 = (char)uVar1;
  uVar1 = FUN_00492cb4(param_1);
  local_30e = (undefined2)uVar1;
  uVar1 = FUN_00492cb4(param_1);
  local_30c = (undefined2)uVar1;
  uVar1 = FUN_00492cb4(param_1);
  local_30a = (undefined2)uVar1;
  uVar1 = FUN_00492cb4(param_1);
  local_308 = (undefined2)uVar1;
  uVar1 = FUN_00492c84(param_1);
  local_306 = (undefined1)uVar1;
  uVar1 = FUN_00492c84(param_1);
  local_305 = (undefined1)uVar1;
  if ((((local_316 == '\x01') || (local_316 == '\x02')) || (local_316 == '\x03')) ||
     (((local_316 == '\t' || (local_316 == '\n')) || (local_316 == '\v')))) {
    FUN_00492ba0(param_1,(uint)local_318);
    if (local_317 != '\0') {
      if (local_310 == '\x10') {
        uVar4 = (uint)local_314;
        pbVar3 = local_304 + uVar4 * 3;
        for (; (int)uVar4 < (int)(uint)local_312; uVar4 = uVar4 + 1) {
          iVar2 = FUN_00492cb4(param_1);
          *pbVar3 = (byte)((short)iVar2 >> 7) & 0xf8;
          pbVar3[1] = (byte)((short)iVar2 >> 2) & 0xf8;
          pbVar3[2] = (byte)(iVar2 << 3);
          pbVar3 = pbVar3 + 3;
        }
      }
      else if (local_310 == '\x18') {
        FUN_00492f10(param_1,(char *)(local_304 + (uint)local_314 * 3),(uint)local_312 * 3);
      }
    }
    FUN_0048f52c(param_1,(int)&local_318,param_2);
  }
  else {
    FUN_0049a300(0,s_dpl_tgaRead___not_a_recognised_i_005083b2);
  }
  return;
}



/* @0048fd04 file=? name=FUN_0048fd04 */

void __cdecl FUN_0048fd04(LPCSTR param_1,undefined4 *param_2)

{
  undefined4 *puVar1;
  int *piVar2;
  
  puVar1 = (undefined4 *)FUN_0048c2f0((int)param_2);
  DAT_005081d8 = (uint)(param_2[6] == 10);
  if (param_1 == (LPCSTR)0x0) {
    FUN_0049a300(0,s_dpl_tgaReplace_got_no_file_to_op_005083dd);
  }
  else if (puVar1 == (undefined4 *)0x0) {
    FUN_0049a300(0,s_dpl_tgaReplace_got_NULL_texmap_00508400);
  }
  else {
    if ((DAT_005081e0 == (int *)0x0) &&
       (DAT_005081e0 = (int *)FUN_00452c38(0x4000), DAT_005081e0 == (int *)0x0)) {
      FUN_0049a300(0,s_dpl_tgaRead_failed_to_allocate_r_0050841f);
      return;
    }
    piVar2 = FUN_004930c0(param_1,0x4000,DAT_005081e0,1);
    if (piVar2 == (int *)0x0) {
      FUN_0049a300(0,s_dpl_tgaRead_failed_to_open_file___0050844a);
    }
    else {
      FUN_0048fb6c(piVar2,puVar1);
      FUN_0048d55c(param_2);
      FUN_00493188(piVar2);
    }
  }
  return;
}



/* @0048fdd8 file=? name=FUN_0048fdd8 */

void FUN_0048fdd8(void)

{
  PTR_s_DIV_BSL2_005081d4 = s_DIV_BSL2_00508470;
  DAT_005081d8 = 0;
  DAT_005081dc = 0;
  DAT_005081e0 = 0;
  return;
}



/* @0048fdf8 file=? name=FUN_0048fdf8 */

void __cdecl
FUN_0048fdf8(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            )

{
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x2c) = param_2;
    *(undefined4 *)(param_1 + 0x30) = param_3;
    *(undefined4 *)(param_1 + 0x34) = param_4;
    *(undefined4 *)(param_1 + 0x38) = param_5;
    return;
  }
  FUN_004d771c(s_NULL_texture_in_dpl_SetTextureSc_00508488);
  FUN_004dee24(9);
  return;
}



/* @0048fe34 file=? name=FUN_0048fe34 */

void __cdecl FUN_0048fe34(undefined4 param_1)

{
  DAT_005078e0 = param_1;
  return;
}



/* @0048fe44 file=? name=FUN_0048fe44 */

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

void __cdecl FUN_0048fe44(undefined4 param_1)

{
  _DAT_00507930 = param_1;
  return;
}



/* @0048fe54 file=? name=FUN_0048fe54 */

void __cdecl FUN_0048fe54(int param_1,undefined4 param_2)

{
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x58) = param_2;
  }
  return;
}



/* @0048fe68 file=? name=FUN_0048fe68 */

void __cdecl FUN_0048fe68(int param_1,int param_2)

{
  if (param_1 != 0) {
    if (param_2 != 0) {
      *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) | 0x400;
      return;
    }
    *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xfffffbff;
  }
  return;
}



/* @0048fe94 file=? name=FUN_0048fe94 */

void __cdecl FUN_0048fe94(int param_1,undefined4 param_2)

{
  if (param_1 != 0) {
    *(undefined4 *)(param_1 + 0x60) = param_2;
  }
  return;
}



/* @0048fea8 file=? name=FUN_0048fea8 */

void __cdecl FUN_0048fea8(int param_1,uint param_2)

{
  *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xf0ffffff | (param_2 & 0xf) << 0x18;
  return;
}



/* @0048fec8 file=? name=FUN_0048fec8 */

uint __cdecl FUN_0048fec8(int param_1)

{
  return *(int *)(param_1 + 0x58) >> 0x18 & 0xf;
}



/* @0048fedc file=? name=FUN_0048fedc */

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

{
  *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xf0ffffff | 0x1000000;
  *(undefined4 *)(param_1 + 0x18) = param_2;
  *(undefined4 *)(param_1 + 0x1c) = param_3;
  return;
}



/* @0048ff04 file=? name=FUN_0048ff04 */

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

{
  *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xf0ffffff | 0x2000000;
  *(undefined4 *)(param_1 + 0x18) = param_2;
  *(undefined4 *)(param_1 + 0x1c) = param_3;
  return;
}



/* @0048ff2c file=? name=FUN_0048ff2c */

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

{
  *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xf0ffffff | 0x3000000;
  *(undefined4 *)(param_1 + 0x18) = param_2;
  *(undefined4 *)(param_1 + 0x1c) = param_3;
  return;
}



/* @0048ff54 file=? name=FUN_0048ff54 */

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

{
  *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & 0xf0ffffff | 0x4000000;
  *(undefined4 *)(param_1 + 0x18) = *param_2;
  *(undefined4 *)(param_1 + 0x1c) = param_2[1];
  *(undefined4 *)(param_1 + 0x20) = param_2[2];
  *(undefined4 *)(param_1 + 0x24) = param_2[3];
  *(undefined4 *)(param_1 + 0x28) = *param_3;
  *(undefined4 *)(param_1 + 0x2c) = param_3[1];
  *(undefined4 *)(param_1 + 0x30) = param_3[2];
  return;
}



/* @0048ffa4 file=? name=FUN_0048ffa4 */

void __cdecl FUN_0048ffa4(int *param_1)

{
  uint uVar1;
  uint uVar2;
  int *piVar3;
  int unaff_ESI;
  int iVar4;
  int local_c;
  
  local_c = 0;
  iVar4 = 0x78;
  piVar3 = param_1;
  while (*piVar3 != 0) {
    uVar1 = *(int *)(*piVar3 + 0x58) >> 0x18 & 0xf;
    uVar2 = uVar1 - 1;
    if (uVar1 == 0) {
      unaff_ESI = 0xd;
    }
    else if (uVar2 < 3) {
      unaff_ESI = 3;
    }
    else if (uVar2 == 3) {
      unaff_ESI = 9;
    }
    else {
      FUN_004d771c(s_Unknown_dcs_type_0x_x_in_flush_a_005084ae);
      FUN_004dee24(9);
    }
    if (iVar4 - unaff_ESI < 0) {
      FUN_0048e440(param_1,local_c);
      local_c = 0;
      iVar4 = 0x78;
      param_1 = piVar3;
    }
    else {
      iVar4 = iVar4 - unaff_ESI;
      local_c = local_c + 1;
      piVar3 = piVar3 + 1;
    }
  }
  if (local_c != 0) {
    FUN_0048e440(param_1,local_c);
  }
  return;
}



/* @0049005c file=? name=FUN_0049005c */

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

{
  *param_2 = 0;
  *param_1 = param_2;
  return param_1 + 1;
}



/* @00490070 file=? name=FUN_00490070 */

int __cdecl FUN_00490070(undefined4 *param_1)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  
  iVar3 = 0;
  piVar1 = (int *)*param_1;
  while (piVar1 != (int *)0x0) {
    param_1 = param_1 + 1;
    if (*piVar1 == 0) {
      switch(piVar1[3]) {
      case 3:
        iVar2 = 0x70;
        break;
      case 4:
        iVar2 = 0x38;
        break;
      case 5:
        iVar2 = 0x8c;
        break;
      case 6:
        iVar2 = 0x3c;
        break;
      case 7:
        iVar2 = 0x7c;
        break;
      case 8:
        iVar2 = 0x50;
        break;
      case 9:
        iVar2 = 0x58;
        break;
      case 10:
        iVar2 = 0x30;
        break;
      case 0xb:
        iVar2 = 100;
        break;
      case 0xc:
        iVar2 = 0x4c;
        break;
      case 0xd:
        iVar2 = 0x24;
        break;
      case 0xe:
        iVar2 = 0x2c;
        break;
      default:
        FUN_004d771c(s_Unknown_type_0x_x_in_flush_nodes_005084ec);
        return iVar3;
      }
      FUN_0048d350(piVar1,iVar2);
      *piVar1 = 1;
      iVar3 = iVar3 + 1;
    }
    piVar1 = (int *)*param_1;
  }
  return iVar3;
}



/* @0049016c file=? name=FUN_0049016c */

void __cdecl FUN_0049016c(int param_1,int param_2,uint param_3)

{
  if (param_2 != 0) {
    *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) | param_3;
    return;
  }
  *(uint *)(param_1 + 0x58) = *(uint *)(param_1 + 0x58) & ~param_3;
  return;
}



/* @00490188 file=? name=FUN_00490188 */

void __cdecl FUN_00490188(int param_1,int param_2)

{
  FUN_0049016c(param_1,param_2,0x40);
  return;
}



/* @004901a0 file=? name=FUN_004901a0 */

void __cdecl FUN_004901a0(int param_1,int param_2)

{
  FUN_0049016c(param_1,param_2,0x80);
  return;
}



/* @004901bc file=? name=FUN_004901bc */

void __cdecl FUN_004901bc(int param_1,int param_2)

{
  FUN_0049016c(param_1,param_2,0x100);
  return;
}



/* @004901d8 file=? name=FUN_004901d8 */

void __cdecl FUN_004901d8(int param_1,int param_2)

{
  FUN_0049016c(param_1,param_2,0x200);
  return;
}



/* @004901f4 file=? name=FUN_004901f4 */

void __cdecl FUN_004901f4(int param_1,int param_2)

{
  FUN_0049016c(param_1,param_2,0x1000);
  return;
}



/* @00490210 file=? name=FUN_00490210 */

void __cdecl
FUN_00490210(undefined4 param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5
            ,undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,
            undefined4 param_10,undefined4 param_11,undefined4 param_12,undefined4 param_13,
            undefined4 param_14,undefined4 param_15,undefined4 param_16,undefined4 param_17)

{
  undefined4 local_84;
  undefined4 local_80;
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  
  local_84 = param_1;
  if (param_2 == 0) {
    local_80 = 0;
  }
  else {
    local_80 = *(undefined4 *)(param_2 + 8);
  }
  local_7c = param_3;
  local_78 = param_4;
  local_74 = param_5;
  local_70 = param_6;
  local_6c = param_7;
  local_68 = param_8;
  local_64 = param_9;
  local_60 = param_10;
  local_5c = param_11;
  local_58 = param_12;
  local_54 = param_13;
  local_50 = param_14;
  local_4c = param_15;
  local_48 = param_16;
  local_44 = param_17;
  FUN_0048e2c0((byte *)&local_84,0x44);
  return;
}



/* @004902a0 file=? name=FUN_004902a0 */

void __cdecl FUN_004902a0(int param_1,undefined4 param_2)

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



/* @004902b0 file=? name=FUN_004902b0 */

void __cdecl FUN_004902b0(int param_1,int param_2)

{
  FUN_0048e5b0(*(undefined4 *)(param_1 + 8),0x80000092,0x80000005,0x80000004,
               *(undefined4 *)(param_2 + 8));
  return;
}



/* @004902e0 file=? name=FUN_004902e0 */

void __cdecl FUN_004902e0(undefined4 param_1)

{
  FUN_0048e5b0(param_1,5,0x40000000,0x40000000,0);
  return;
}



/* @00490308 file=? name=FUN_00490308 */

void __cdecl FUN_00490308(int param_1)

{
  FUN_0048e5b0(*(undefined4 *)(param_1 + 8),0x80000003,0x80000017,0x80000004,0);
  return;
}



/* @00490330 file=? name=FUN_00490330 */

void __cdecl FUN_00490330(int param_1,undefined4 param_2)

{
  FUN_0048e5ec(*(undefined4 *)(param_1 + 8),param_2);
  return;
}



/* @00490348 file=? name=FUN_00490348 */

void __cdecl FUN_00490348(undefined4 *param_1)

{
  FUN_0048e614(param_1);
  return;
}



/* @00490358 file=? name=FUN_00490358 */

void __cdecl FUN_00490358(int param_1)

{
  FUN_0048e1b0(param_1);
  return;
}



/* @00490368 file=? name=FUN_00490368 */

void __cdecl FUN_00490368(undefined4 param_1,undefined4 param_2)

{
  FUN_0048e288(param_1,param_2);
  return;
}



/* @00490380 file=? name=FUN_00490380 */

void FUN_00490380(void)

{
  FUN_0048ea24();
  return;
}



/* @0049038c file=? name=FUN_0049038c */

void __cdecl FUN_0049038c(undefined4 param_1)

{
  DAT_0050792c = param_1;
  return;
}



/* @0049039c file=? name=FUN_0049039c */

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

void __cdecl
FUN_0049039c(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  _DAT_00508480 = param_1;
  _DAT_00508484 = param_2;
  FUN_0048e8d8(param_1,param_2,param_3,param_4);
  return;
}



/* @004903c8 file=? name=FUN_004903c8 */

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

undefined4 __cdecl
FUN_004903c8(float param_1,float param_2,undefined4 param_3,undefined4 param_4,undefined4 *param_5,
            undefined4 *param_6,undefined4 *param_7,undefined4 *param_8,undefined4 *param_9,
            undefined4 *param_10)

{
  *param_5 = DAT_00524afc;
  *param_6 = DAT_00524b00;
  *param_7 = DAT_00524b04;
  *param_8 = DAT_00524af0;
  *param_9 = DAT_00524af8;
  *param_10 = DAT_00524af4;
  if ((_DAT_00508480 != param_1) || (_DAT_00508484 != param_2)) {
    FUN_0049039c(param_1,param_2,param_3,param_4);
  }
  return DAT_00524aec;
}



/* @00490444 file=? name=FUN_00490444 */

void FUN_00490444(void)

{
  FUN_004d771c(s_cull__d_draw__d_frame__d_pxpl__d_0050850e);
  return;
}



/* @00490474 file=? name=FUN_00490474 */

void FUN_00490474(void)

{
  FUN_0048a1a0();
  DAT_00524ae0 = 0;
  FUN_0048e2dc(1);
  return;
}



/* @00490490 file=? name=FUN_00490490 */

void __cdecl FUN_00490490(int param_1,undefined4 param_2)

{
  *(undefined4 *)(param_1 + 4) = param_2;
  return;
}



/* @004904a0 file=? name=FUN_004904a0 */

undefined4 __cdecl FUN_004904a0(int param_1)

{
  return *(undefined4 *)(param_1 + 4);
}



/* @004904ac file=? name=FUN_004904ac */

void __cdecl FUN_004904ac(int param_1)

{
  if (param_1 != 0) {
    *(uint *)(param_1 + 0x74) = *(uint *)(param_1 + 0x74) | 2;
  }
  return;
}



/* @004904bc file=? name=FUN_004904bc */

void __cdecl FUN_004904bc(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5)

{
  FUN_0048d968(param_1,param_2,param_3,param_4,param_5);
  return;
}



/* @004904dc file=? name=FUN_004904dc */

void __cdecl FUN_004904dc(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5)

{
  FUN_0048d968(param_1,param_2,param_3,param_4,param_5);
  return;
}



/* @004904fc file=? name=FUN_004904fc */

void __cdecl FUN_004904fc(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5)

{
  FUN_0048d968(param_1,param_2,param_3,param_4,param_5);
  return;
}



/* @0049051c file=? name=FUN_0049051c */

void __cdecl
FUN_0049051c(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5,
            undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9)

{
  FUN_0048d9b4(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9);
  return;
}



/* @00490548 file=? name=FUN_00490548 */

void __cdecl
FUN_00490548(int param_1,int param_2,int param_3,undefined4 param_4,undefined4 param_5,
            undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9)

{
  FUN_0048d9b4(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9);
  return;
}



/* @00490574 file=? name=FUN_00490574 */

void __cdecl FUN_00490574(int param_1,byte *param_2)

{
  FUN_004d771c(s_sfx_texels_2D_00508539);
  FUN_0048da1c(param_1,param_2,0x100,0x100,2,1);
  FUN_004d771c(s_returning_from_sfx_texels_2D_00508548);
  return;
}



/* @004905b0 file=? name=FUN_004905b0 */

void __cdecl FUN_004905b0(undefined4 *param_1)

{
  FUN_0048e6b0(param_1);
  return;
}



/* @004905c0 file=? name=FUN_004905c0 */

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

{
  *(undefined4 *)(param_1 + 0x44) = param_2;
  *(undefined4 *)(param_1 + 0x48) = param_3;
  return;
}



/* @004905d4 file=? name=FUN_004905d4 */

void __cdecl FUN_004905d4(int param_1,undefined4 param_2)

{
  *(undefined4 *)(param_1 + 0x68) = param_2;
  return;
}



/* @004905e4 file=? name=FUN_004905e4 */

undefined4 __cdecl FUN_004905e4(int param_1)

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



/* @004905f0 file=? name=FUN_004905f0 */

void __cdecl FUN_004905f0(int param_1,undefined4 param_2)

{
  *(undefined4 *)(param_1 + 0x38) = param_2;
  return;
}



/* @00490600 file=? name=FUN_00490600 */

undefined4 __cdecl FUN_00490600(int param_1)

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



/* @0049060c file=? name=FUN_0049060c */

void FUN_0049060c(void)

{
  DAT_005078e8 = 1;
  return;
}



/* @00490618 file=? name=FUN_00490618 */

void FUN_00490618(void)

{
  DAT_005078e8 = 0;
  return;
}



/* @00490620 file=? name=FUN_00490620 */

void __cdecl FUN_00490620(int param_1,int param_2)

{
  uint uVar1;
  
  uVar1 = *(uint *)(param_1 + 0x34) & 0xffffdfff;
  if (param_2 != 0) {
    *(uint *)(param_1 + 0x34) = uVar1 | 0x2000;
    return;
  }
  *(uint *)(param_1 + 0x34) = uVar1;
  return;
}



/* @00490648 file=? name=FUN_00490648 */

undefined4 __cdecl FUN_00490648(int param_1)

{
  if ((*(byte *)(param_1 + 0x35) & 0x20) != 0) {
    return 1;
  }
  return 0;
}



/* @00490660 file=? name=FUN_00490660 */

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

void FUN_00490660(void)

{
  DAT_0050847c = 0;
  _DAT_00508480 = 0xbf800000;
  _DAT_00508484 = 0xbf800000;
  return;
}



/* @0049067c file=? name=FUN_0049067c */

void __cdecl FUN_0049067c(int param_1,undefined4 *param_2)

{
  FUN_0048eaac(param_1,param_2);
  return;
}



/* @00490694 file=? name=FUN_00490694 */

void __cdecl FUN_00490694(int param_1)

{
  FUN_0048ec34(param_1);
  return;
}



/* @004906a4 file=? name=FUN_004906a4 */

void __cdecl FUN_004906a4(int param_1,undefined4 *param_2,undefined4 param_3,int param_4)

{
  FUN_0048eb14(param_1,param_2,param_3,param_4);
  return;
}



/* @004906c4 file=? name=FUN_004906c4 */

void __cdecl FUN_004906c4(int param_1)

{
  FUN_0048c8ac(param_1,0x666);
  return;
}



/* @004906dc file=? name=FUN_004906dc */

void __cdecl FUN_004906dc(int param_1,int param_2)

{
  if (param_2 != 0) {
    FUN_0048c8ac(param_1,0x668);
    return;
  }
  FUN_0048c8ac(param_1,0x667);
  return;
}



/* @00490708 file=? name=FUN_00490708 */

void __cdecl FUN_00490708(int param_1,undefined4 param_2)

{
  FUN_0048ec8c(param_1,param_2);
  return;
}



/* @00490720 file=? name=FUN_00490720 */

void FUN_00490720(void)

{
  FUN_0048ecb8();
  return;
}



/* @0049072c file=? name=FUN_0049072c */

void __cdecl FUN_0049072c(int *param_1)

{
  FUN_0048ecdc(param_1,0x34);
  return;
}



/* @00490740 file=? name=FUN_00490740 */

void __cdecl FUN_00490740(int *param_1)

{
  FUN_0048ecdc(param_1,0x33);
  return;
}



/* @00490754 file=? name=FUN_00490754 */

undefined1 * __cdecl FUN_00490754(undefined1 *param_1,undefined1 param_2)

{
  *param_1 = param_2;
  return param_1 + 1;
}



/* @00490764 file=? name=FUN_00490764 */

undefined1 * __cdecl FUN_00490764(undefined1 *param_1,undefined1 param_2)

{
  *param_1 = param_2;
  return param_1 + 1;
}



/* @00490774 file=? name=FUN_00490774 */

undefined1 * __cdecl FUN_00490774(undefined1 *param_1,undefined4 param_2)

{
  if (DAT_00508568 != 0) {
    *param_1 = (undefined1)param_2;
    param_1[1] = param_2._1_1_;
    return param_1 + 2;
  }
  *param_1 = param_2._1_1_;
  param_1[1] = (undefined1)param_2;
  return param_1 + 2;
}



/* @004907a4 file=? name=FUN_004907a4 */

undefined1 * __cdecl FUN_004907a4(undefined1 *param_1,undefined4 param_2)

{
  if (DAT_00508568 != 0) {
    *param_1 = (undefined1)param_2;
    param_1[1] = param_2._1_1_;
    param_1[2] = param_2._2_1_;
    param_1[3] = param_2._3_1_;
    return param_1 + 4;
  }
  *param_1 = param_2._3_1_;
  param_1[1] = param_2._2_1_;
  param_1[2] = param_2._1_1_;
  param_1[3] = (undefined1)param_2;
  return param_1 + 4;
}



/* @004907ec file=? name=FUN_004907ec */

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

{
  if (DAT_00508568 != 0) {
    *param_1 = param_2;
    return param_1 + 1;
  }
  *(undefined1 *)param_1 = param_2._3_1_;
  *(undefined1 *)((int)param_1 + 1) = param_2._2_1_;
  *(undefined1 *)((int)param_1 + 2) = param_2._1_1_;
  *(undefined1 *)((int)param_1 + 3) = (undefined1)param_2;
  return param_1 + 1;
}



/* @00490824 file=? name=FUN_00490824 */

undefined1 * __cdecl FUN_00490824(undefined1 *param_1,undefined4 param_2)

{
  if (DAT_00508568 != 0) {
    *param_1 = (undefined1)param_2;
    param_1[1] = param_2._1_1_;
    param_1[2] = param_2._2_1_;
    param_1[3] = param_2._3_1_;
    return param_1 + 4;
  }
  *param_1 = param_2._3_1_;
  param_1[1] = param_2._2_1_;
  param_1[2] = param_2._1_1_;
  param_1[3] = (undefined1)param_2;
  return param_1 + 4;
}



/* @0049086c file=? name=FUN_0049086c */

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

{
  FUN_004d4918(param_1,param_2,param_3);
  return param_3 + (int)param_1;
}



/* @0049088c file=? name=FUN_0049088c */

undefined4 * __cdecl FUN_0049088c(undefined4 *param_1,undefined4 *param_2,uint param_3)

{
  undefined1 uVar1;
  undefined2 uVar2;
  int iVar3;
  undefined1 local_6;
  undefined1 local_5;
  
  if (DAT_00508568 == 0) {
    for (iVar3 = 0; iVar3 < (int)param_3 >> 2; iVar3 = iVar3 + 1) {
      uVar1 = *(undefined1 *)((int)param_2 + 2);
      uVar2 = *(undefined2 *)param_2;
      *(undefined1 *)param_1 = *(undefined1 *)((int)param_2 + 3);
      *(undefined1 *)((int)param_1 + 1) = uVar1;
      local_5 = (undefined1)((ushort)uVar2 >> 8);
      *(undefined1 *)((int)param_1 + 2) = local_5;
      local_6 = (undefined1)uVar2;
      *(undefined1 *)((int)param_1 + 3) = local_6;
      param_1 = param_1 + 1;
      param_2 = param_2 + 1;
    }
  }
  else {
    FUN_004d4918(param_1,param_2,param_3);
    param_1 = (undefined4 *)(param_3 + (int)param_1);
  }
  return param_1;
}



/* @004908f8 file=? name=FUN_004908f8 */

int __cdecl FUN_004908f8(undefined4 *param_1,char *param_2)

{
  int iVar1;
  
  iVar1 = FUN_004d4a78(param_2);
  FUN_004d4918(param_1,(undefined4 *)param_2,iVar1 + 1U);
  return iVar1 + 1U + (int)param_1;
}



/* @00490924 file=? name=FUN_00490924 */

undefined1 * __cdecl FUN_00490924(undefined1 *param_1,undefined1 *param_2)

{
  *param_2 = *param_1;
  return param_1 + 1;
}



/* @00490934 file=? name=FUN_00490934 */

int __cdecl FUN_00490934(int param_1)

{
  return param_1 + 1;
}



/* @00490944 file=? name=FUN_00490944 */

undefined1 * __cdecl FUN_00490944(undefined1 *param_1,undefined1 *param_2)

{
  if (DAT_00508568 != 0) {
    *param_2 = *param_1;
    param_2[1] = param_1[1];
    return param_1 + 2;
  }
  *param_2 = param_1[1];
  param_2[1] = *param_1;
  return param_1 + 2;
}



/* @00490974 file=? name=FUN_00490974 */

undefined1 * __cdecl FUN_00490974(undefined1 *param_1,undefined1 *param_2)

{
  if (DAT_00508568 != 0) {
    *param_2 = *param_1;
    param_2[1] = param_1[1];
    param_2[2] = param_1[2];
    param_2[3] = param_1[3];
    return param_1 + 4;
  }
  param_2[3] = *param_1;
  param_2[2] = param_1[1];
  param_2[1] = param_1[2];
  *param_2 = param_1[3];
  return param_1 + 4;
}



/* @004909bc file=? name=FUN_004909bc */

undefined1 * __cdecl FUN_004909bc(undefined1 *param_1,undefined1 *param_2)

{
  if (DAT_00508568 != 0) {
    *param_2 = *param_1;
    param_2[1] = param_1[1];
    param_2[2] = param_1[2];
    param_2[3] = param_1[3];
    return param_1 + 4;
  }
  param_2[3] = *param_1;
  param_2[2] = param_1[1];
  param_2[1] = param_1[2];
  *param_2 = param_1[3];
  return param_1 + 4;
}



/* @00490a04 file=? name=FUN_00490a04 */

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

{
  FUN_004d4918(param_2,param_1,param_3);
  return param_3 + (int)param_1;
}



/* @00490a24 file=? name=FUN_00490a24 */

undefined4 * __cdecl FUN_00490a24(undefined4 *param_1,undefined4 *param_2,uint param_3)

{
  undefined1 uVar1;
  undefined2 uVar2;
  int iVar3;
  undefined1 local_6;
  undefined1 local_5;
  
  if (DAT_00508568 == 0) {
    for (iVar3 = 0; iVar3 < (int)param_3 >> 2; iVar3 = iVar3 + 1) {
      uVar1 = *(undefined1 *)((int)param_1 + 2);
      uVar2 = *(undefined2 *)param_1;
      *(undefined1 *)param_2 = *(undefined1 *)((int)param_1 + 3);
      *(undefined1 *)((int)param_2 + 1) = uVar1;
      local_5 = (undefined1)((ushort)uVar2 >> 8);
      *(undefined1 *)((int)param_2 + 2) = local_5;
      local_6 = (undefined1)uVar2;
      *(undefined1 *)((int)param_2 + 3) = local_6;
      param_1 = param_1 + 1;
      param_2 = param_2 + 1;
    }
  }
  else {
    FUN_004d4918(param_2,param_1,param_3);
    param_1 = (undefined4 *)(param_3 + (int)param_1);
  }
  return param_1;
}



/* @00490a90 file=? name=FUN_00490a90 */

char * __cdecl FUN_00490a90(char *param_1,undefined4 *param_2)

{
  int iVar1;
  
  iVar1 = FUN_004d4a78(param_1);
  FUN_004d4918(param_2,(undefined4 *)param_1,iVar1 + 1U);
  return param_1 + iVar1 + 1U;
}



/* @00490ab8 file=? name=FUN_00490ab8 */

void FUN_00490ab8(void)

{
  DAT_00508568 = 1;
  return;
}



/* @00490adc file=? name=FUN_00490adc */

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

void __cdecl FUN_00490adc(char *param_1)

{
  FUN_004d771c(param_1);
  _DAT_0050856c = 1;
  return;
}



/* @00490af8 file=? name=FUN_00490af8 */

int * __thiscall FUN_00490af8(void *this,undefined4 param_1)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00452c38(0x1c);
  if (piVar1 == (int *)0x0) {
    FUN_004d771c(s_Failed_to_init_dbi_interface_dev_00508580);
    piVar1 = (int *)0x0;
  }
  else {
    FUN_004d7f84(param_1,&DAT_005085a8);
    *piVar1 = (int)this;
    piVar1[1] = (int)this;
    piVar1[2] = (int)this + 1;
    piVar1[3] = (int)this + 2;
    piVar1[4] = (int)this + 3;
    piVar1[5] = (int)this + 0x10;
    piVar1[6] = (int)this + 0x11;
  }
  return piVar1;
}



/* @00490b64 file=? name=FUN_00490b64 */

void FUN_00490b64(void)

{
  int iVar1;
  int iVar2;
  
  iVar1 = FUN_004dfd90();
  do {
    iVar2 = FUN_004dfd90();
  } while (iVar1 == iVar2);
  do {
    iVar2 = FUN_004dfd90();
  } while (iVar1 == iVar2);
  return;
}



/* @00490b84 file=? name=FUN_00490b84 */

undefined6 __cdecl FUN_00490b84(int param_1)

{
  undefined6 uVar1;
  
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 0x18),0);
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 0x14),0);
  FUN_00490b64();
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 0x14),1);
  FUN_00490b64();
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 0x10),0);
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 0xc),0);
  uVar1 = FUN_004d46ed((short)*(undefined4 *)(param_1 + 0x14),0);
  return uVar1;
}



/* @00490bec file=? name=FUN_00490bec */

byte __cdecl FUN_00490bec(int param_1)

{
  byte bVar1;
  
  bVar1 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0x10));
  return bVar1 & 1;
}



/* @00490c04 file=? name=FUN_00490c04 */

undefined4 __cdecl FUN_00490c04(int param_1,byte *param_2,int param_3)

{
  bool bVar1;
  byte bVar2;
  int iVar3;
  int iVar4;
  int local_c;
  int local_8;
  
  bVar1 = true;
  local_8 = 0;
  if (0 < param_3) {
    do {
      iVar4 = 0;
      while (bVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0x10)), (bVar2 & 1) == 0) {
        if (39999 < iVar4) {
          iVar4 = 0;
          if (bVar1) {
            bVar1 = false;
            local_c = FUN_004dfd90();
          }
          iVar3 = FUN_004dfd90();
          if (5000 < iVar3 - local_c) {
            FUN_00490adc(s_timeout_in_outRecord_005085ac);
            return 0;
          }
        }
        iVar4 = iVar4 + 1;
      }
      FUN_004d46ed((short)*(undefined4 *)(param_1 + 8),*param_2);
      local_8 = local_8 + 1;
      param_2 = param_2 + 1;
    } while (local_8 < param_3);
  }
  return 1;
}



/* @00490c9c file=? name=FUN_00490c9c */

/* WARNING: Removing unreachable block (ram,0x00490e78) */
/* WARNING: Removing unreachable block (ram,0x00490e85) */
/* WARNING: Removing unreachable block (ram,0x00490e93) */
/* WARNING: Removing unreachable block (ram,0x00490eaa) */
/* WARNING: Removing unreachable block (ram,0x00490eb2) */
/* WARNING: Removing unreachable block (ram,0x00490eb8) */
/* WARNING: Removing unreachable block (ram,0x00490ec2) */
/* WARNING: Removing unreachable block (ram,0x00490ed1) */
/* WARNING: Removing unreachable block (ram,0x00490ee0) */

undefined4 __cdecl FUN_00490c9c(int param_1,undefined4 param_2)

{
  bool bVar1;
  byte bVar2;
  int iVar3;
  int iVar4;
  int local_10;
  
  bVar1 = true;
  iVar4 = 0;
  while (bVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0x10)), (bVar2 & 1) == 0) {
    if (39999 < iVar4) {
      iVar4 = 0;
      if (bVar1) {
        bVar1 = false;
        local_10 = FUN_004dfd90();
      }
      iVar3 = FUN_004dfd90();
      if (5000 < iVar3 - local_10) {
        FUN_00490adc(s_timeout_in_outRecord_005085c2);
        return 0;
      }
    }
    iVar4 = iVar4 + 1;
  }
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 8),(byte)param_2);
  bVar1 = true;
  iVar4 = 0;
  while (bVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0x10)), (bVar2 & 1) == 0) {
    if (39999 < iVar4) {
      iVar4 = 0;
      if (bVar1) {
        bVar1 = false;
        local_10 = FUN_004dfd90();
      }
      iVar3 = FUN_004dfd90();
      if (5000 < iVar3 - local_10) {
        FUN_00490adc(s_timeout_in_outRecord_005085d8);
        return 0;
      }
    }
    iVar4 = iVar4 + 1;
  }
  FUN_004d46ed((short)*(undefined4 *)(param_1 + 8),(byte)((uint)param_2 >> 8));
  bVar1 = true;
  iVar4 = 0;
  do {
    bVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0x10));
    if ((bVar2 & 1) != 0) {
      FUN_004d46ed((short)*(undefined4 *)(param_1 + 8),(byte)((uint)param_2 >> 0x10));
      bVar1 = true;
      iVar4 = 0;
      do {
        bVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0x10));
        if ((bVar2 & 1) != 0) {
          FUN_004d46ed((short)*(undefined4 *)(param_1 + 8),(byte)((uint)param_2 >> 0x18));
          return 1;
        }
        if (39999 < iVar4) {
          iVar4 = 0;
          if (bVar1) {
            bVar1 = false;
            local_10 = FUN_004dfd90();
          }
          iVar3 = FUN_004dfd90();
          if (5000 < iVar3 - local_10) {
            FUN_00490adc(s_timeout_in_outRecord_00508604);
            return 0;
          }
        }
        iVar4 = iVar4 + 1;
      } while( true );
    }
    if (39999 < iVar4) {
      iVar4 = 0;
      if (bVar1) {
        bVar1 = false;
        local_10 = FUN_004dfd90();
      }
      iVar3 = FUN_004dfd90();
      if (5000 < iVar3 - local_10) {
        FUN_00490adc(s_timeout_in_outRecord_005085ee);
        return 0;
      }
    }
    iVar4 = iVar4 + 1;
  } while( true );
}



/* @00490ef0 file=? name=FUN_00490ef0 */

byte __cdecl FUN_00490ef0(int param_1)

{
  byte bVar1;
  
  bVar1 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 0xc));
  return bVar1 & 1;
}



/* @00490f08 file=? name=FUN_00490f08 */

undefined4 __cdecl FUN_00490f08(int param_1,undefined1 *param_2,int param_3)

{
  byte bVar1;
  undefined1 uVar2;
  int iVar3;
  undefined3 extraout_var;
  int iVar4;
  int iVar5;
  int local_8;
  
  iVar3 = FUN_004dfd90();
  local_8 = 0;
  if (0 < param_3) {
    do {
      iVar5 = 0;
      while (bVar1 = FUN_00490ef0(param_1), CONCAT31(extraout_var,bVar1) == 0) {
        if (39999 < iVar5) {
          iVar5 = 0;
          iVar4 = FUN_004dfd90();
          if (5000 < iVar4 - iVar3) {
            FUN_00490adc(s_timeout_in_inRecord_00508630);
            return 0;
          }
        }
        iVar5 = iVar5 + 1;
      }
      uVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 4));
      *param_2 = uVar2;
      param_2 = param_2 + 1;
      local_8 = local_8 + 1;
    } while (local_8 < param_3);
  }
  return 1;
}



/* @00490f8c file=? name=FUN_00490f8c */

undefined4 __cdecl FUN_00490f8c(int param_1,undefined1 *param_2,int param_3)

{
  byte bVar1;
  undefined1 uVar2;
  undefined3 extraout_var;
  int iVar3;
  
  iVar3 = 0;
  if (0 < param_3) {
    do {
      do {
        bVar1 = FUN_00490ef0(param_1);
      } while (CONCAT31(extraout_var,bVar1) == 0);
      uVar2 = FUN_004d45ec((short)*(undefined4 *)(param_1 + 4));
      *param_2 = uVar2;
      param_2 = param_2 + 1;
      iVar3 = iVar3 + 1;
    } while (iVar3 < param_3);
  }
  return 1;
}



/* @00490fc8 file=? name=FUN_00490fc8 */

void __cdecl FUN_00490fc8(undefined4 *param_1,undefined2 *param_2,uint param_3)

{
  uint uVar1;
  
  uVar1 = param_3 >> 1;
  while (uVar1 != 0) {
    uVar1 = uVar1 - 1;
    out(*param_2,(ushort)*param_1 ^ 4);
    param_2 = param_2 + 1;
  }
  return;
}



/* @00490fec file=? name=FUN_00490fec */

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

{
  undefined4 *puVar1;
  uint local_14;
  undefined4 local_c;
  undefined4 local_8;
  
  local_8 = 0;
  if (0x400 < (int)param_5) {
    FUN_004d771c(s_Attempt_to_send__d_bytes_in_pack_00508645);
    FUN_004dee24(9);
  }
  if (param_6 == 0) {
    FUN_004907a4((undefined1 *)&local_c,param_5 + 4 | 0x40ff0000);
  }
  else {
    if ((param_5 & 1) != 0) {
      param_5 = param_5 + 1;
    }
    FUN_004907a4((undefined1 *)&local_c,param_2 << 0x10 | param_5 | 0xc0000000);
  }
  DAT_00508570 = local_c;
  if (param_7 == 0) {
    puVar1 = (undefined4 *)&DAT_00524694;
    local_14 = param_5;
    if (param_6 == 0) {
      puVar1 = (undefined4 *)FUN_004907a4(&DAT_00524694,param_4);
      local_14 = param_5 + 4;
    }
    FUN_0049088c(puVar1,param_3,param_5);
    FUN_00490fc8(param_1,(undefined2 *)&DAT_00524694,local_14 + 3 & 0xfffffffc);
    FUN_00490c9c((int)param_1,local_c);
  }
  else {
    if (param_6 == 0) {
      FUN_004907a4((undefined1 *)&local_8,param_4);
      FUN_00490fc8(param_1,(undefined2 *)&local_8,4);
    }
    FUN_00490fc8(param_1,(undefined2 *)param_3,param_5 + 3 & 0xfffffffc);
    FUN_00490c9c((int)param_1,local_c);
  }
  return;
}



/* @00491118 file=? name=FUN_00491118 */

undefined4 __cdecl
FUN_00491118(int *param_1,int param_2,byte *param_3,undefined4 param_4,uint param_5,int param_6,
            int param_7)

{
  undefined4 uVar1;
  int iVar2;
  byte local_8 [4];
  
  if (param_1[1] == 0) {
    uVar1 = FUN_00490c04(param_1[2],param_3,param_5);
  }
  else if (*param_1 == 0) {
    if (0x400 < (int)param_5) {
      FUN_004d771c(s_Attempt_to_send__d_bytes_in_pack_00508672);
      FUN_004dee24(9);
    }
    if (param_6 == 0) {
      FUN_004907a4(local_8,param_5 + 4 | 0xff0000);
    }
    else {
      if ((param_5 & 1) != 0) {
        param_5 = param_5 + 1;
      }
      FUN_004907a4(local_8,param_2 << 0x10 | param_5 | 0x80000000);
    }
    iVar2 = FUN_00490c04(param_1[2],local_8,4);
    if (iVar2 == 0) {
      FUN_004d771c(s_send_protocol_failed_to_squirt_l_0050869f);
      uVar1 = 0;
    }
    else {
      if (param_6 == 0) {
        FUN_004907a4(local_8,param_4);
        iVar2 = FUN_00490c04(param_1[2],local_8,4);
        if (iVar2 == 0) {
          FUN_004d771c(s_send_protocol_failed_to_squirt_a_005086da);
          return 0;
        }
      }
      if (param_7 == 0) {
        FUN_0049088c((undefined4 *)&DAT_00524694,(undefined4 *)param_3,param_5);
        param_3 = &DAT_00524694;
      }
      iVar2 = FUN_00490c04(param_1[2],param_3,param_5);
      if (iVar2 == 0) {
        FUN_004d771c(s_send_protocol_failed_to_squirt_d_00508714);
        uVar1 = 0;
      }
      else {
        if (param_6 == 0) {
          DAT_00508574 = DAT_00508574 + 1;
        }
        uVar1 = 1;
      }
    }
  }
  else {
    uVar1 = FUN_00490fec((undefined4 *)param_1[2],param_2,(undefined4 *)param_3,param_4,param_5,
                         param_6,param_7);
  }
  return uVar1;
}



/* @00491294 file=? name=FUN_00491294 */

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

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

{
  int iVar1;
  undefined4 uVar2;
  uint uVar3;
  uint local_c;
  undefined1 local_8 [4];
  
  _DAT_00508578 = _DAT_00508578 + 1;
  iVar1 = FUN_00490f08(*(int *)(param_1 + 8),local_8,4);
  if (iVar1 == 0) {
    FUN_004d771c(s_Protocol_error___length_word_not_005087af);
    uVar2 = 0;
  }
  else {
    FUN_00490974(local_8,(undefined1 *)&local_c);
    _DAT_0050857c = local_c;
    *param_2 = (int)local_c >> 0x10 & 0xff;
    if ((local_c & 0x80000000) == 0) {
      *param_5 = 0;
    }
    else {
      *param_5 = 1;
    }
    uVar3 = local_c & 0xffff;
    if (uVar3 < 0x411) {
      iVar1 = FUN_00490f8c(*(int *)(param_1 + 8),(undefined1 *)param_3,uVar3);
      if (iVar1 == 0) {
        FUN_004d771c(s_Protocol_error____d_bytes_not_co_0050877e);
        uVar2 = 0;
      }
      else {
        if (*param_5 == 0) {
          FUN_0049088c(param_3,param_3,uVar3);
        }
        *param_4 = uVar3;
        uVar2 = 1;
      }
    }
    else {
      FUN_004d771c(s_Protocol_error___length__d_too_b_00508748);
      uVar2 = 0;
    }
  }
  return uVar2;
}



/* @00491380 file=? name=FUN_00491380 */

undefined8 __cdecl FUN_00491380(undefined4 *param_1,undefined4 param_2)

{
  byte bVar1;
  undefined3 extraout_var;
  undefined4 extraout_EDX;
  undefined2 extraout_var_00;
  undefined6 uVar2;
  
  switch(param_2) {
  case 0:
    uVar2 = FUN_00490b84(param_1[2]);
    param_2 = CONCAT22(extraout_var_00,(short)((uint6)uVar2 >> 0x20));
    break;
  case 1:
    param_2 = 0;
    *param_1 = 0;
    param_1[1] = 1;
    break;
  case 2:
    *param_1 = 1;
    param_1[1] = 1;
    break;
  case 3:
    *param_1 = 0;
    param_2 = 0;
    param_1[1] = 0;
    break;
  case 4:
    bVar1 = FUN_00490ef0(param_1[2]);
    return CONCAT44(extraout_EDX,CONCAT31(extraout_var,bVar1));
  }
  return CONCAT44(param_2,1);
}



/* @004913f0 file=? name=FUN_004913f0 */

undefined4 * __thiscall FUN_004913f0(void *this,undefined4 param_1)

{
  int *piVar1;
  undefined4 *puVar2;
  
  piVar1 = FUN_00490af8(this,param_1);
  if (piVar1 == (int *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = (undefined4 *)FUN_00452c38(0xc);
    if (puVar2 == (undefined4 *)0x0) {
      puVar2 = (undefined4 *)0x0;
    }
    else {
      puVar2[2] = piVar1;
      *puVar2 = 0;
      puVar2[1] = 0;
      DAT_00508568 = 1;
    }
  }
  return puVar2;
}



/* @00491454 file=? name=FUN_00491454 */

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

void FUN_00491454(void)

{
  _DAT_0050856c = 1;
  DAT_00508570 = 1;
  return;
}



/* @0049146c file=? name=FUN_0049146c */

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

void __cdecl FUN_0049146c(float *param_1,float *param_2,float param_3)

{
  float10 fVar1;
  undefined4 local_8;
  
  if (DAT_005087dc == 0) {
    local_8 = param_3;
  }
  else {
    local_8 = param_3 * _DAT_004914bc;
  }
  fVar1 = (float10)FUN_004dd0f4(SUB84((double)local_8,0),(int)((ulonglong)(double)local_8 >> 0x20));
  *param_1 = (float)fVar1;
  fVar1 = (float10)FUN_004dc9b4(SUB84((double)local_8,0),(int)((ulonglong)(double)local_8 >> 0x20));
  *param_2 = (float)fVar1;
  return;
}



/* @004914c0 file=? name=FUN_004914c0 */

void __cdecl FUN_004914c0(undefined4 *param_1,float *param_2,float *param_3)

{
  float *pfVar1;
  int iVar2;
  float local_54 [16];
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  pfVar1 = local_54;
  iVar2 = 0;
  do {
    local_8 = *param_2;
    local_c = param_2[1];
    local_10 = param_2[2];
    local_14 = param_2[3];
    *pfVar1 = local_14 * param_3[0xc] +
              local_10 * param_3[8] + local_c * param_3[4] + local_8 * *param_3;
    pfVar1[1] = local_14 * param_3[0xd] +
                local_10 * param_3[9] + local_c * param_3[5] + local_8 * param_3[1];
    pfVar1[2] = local_14 * param_3[0xe] +
                local_10 * param_3[10] + local_c * param_3[6] + local_8 * param_3[2];
    pfVar1[3] = local_14 * param_3[0xf] +
                local_10 * param_3[0xb] + local_c * param_3[7] + local_8 * param_3[3];
    param_2 = param_2 + 4;
    pfVar1 = pfVar1 + 4;
    iVar2 = iVar2 + 1;
  } while (iVar2 < 4);
  FUN_004d4918(param_1,local_54,0x40);
  return;
}



/* @00491594 file=? name=FUN_00491594 */

void __cdecl FUN_00491594(int param_1,float param_2)

{
  float fVar1;
  float local_c;
  float local_8;
  
  FUN_0049146c(&local_c,&local_8,param_2);
  fVar1 = *(float *)(param_1 + 4);
  *(float *)(param_1 + 4) = fVar1 * local_8 - *(float *)(param_1 + 8) * local_c;
  *(float *)(param_1 + 8) = *(float *)(param_1 + 8) * local_8 + fVar1 * local_c;
  fVar1 = *(float *)(param_1 + 0x14);
  *(float *)(param_1 + 0x14) = fVar1 * local_8 - *(float *)(param_1 + 0x18) * local_c;
  *(float *)(param_1 + 0x18) = *(float *)(param_1 + 0x18) * local_8 + fVar1 * local_c;
  fVar1 = *(float *)(param_1 + 0x24);
  *(float *)(param_1 + 0x24) = fVar1 * local_8 - *(float *)(param_1 + 0x28) * local_c;
  *(float *)(param_1 + 0x28) = *(float *)(param_1 + 0x28) * local_8 + fVar1 * local_c;
  fVar1 = *(float *)(param_1 + 0x34);
  *(float *)(param_1 + 0x34) = fVar1 * local_8 - *(float *)(param_1 + 0x38) * local_c;
  *(float *)(param_1 + 0x38) = *(float *)(param_1 + 0x38) * local_8 + fVar1 * local_c;
  return;
}



/* @00491670 file=? name=FUN_00491670 */

void __cdecl FUN_00491670(float *param_1,float param_2)

{
  float fVar1;
  float local_c;
  float local_8;
  
  FUN_0049146c(&local_c,&local_8,param_2);
  fVar1 = *param_1;
  *param_1 = param_1[2] * local_c + fVar1 * local_8;
  param_1[2] = param_1[2] * local_8 - fVar1 * local_c;
  fVar1 = param_1[4];
  param_1[4] = param_1[6] * local_c + fVar1 * local_8;
  param_1[6] = param_1[6] * local_8 - fVar1 * local_c;
  fVar1 = param_1[8];
  param_1[8] = param_1[10] * local_c + fVar1 * local_8;
  param_1[10] = param_1[10] * local_8 - fVar1 * local_c;
  fVar1 = param_1[0xc];
  param_1[0xc] = param_1[0xe] * local_c + fVar1 * local_8;
  param_1[0xe] = param_1[0xe] * local_8 - fVar1 * local_c;
  return;
}



/* @00491748 file=? name=FUN_00491748 */

void __cdecl FUN_00491748(float *param_1,float param_2)

{
  float fVar1;
  float local_c;
  float local_8;
  
  FUN_0049146c(&local_c,&local_8,param_2);
  fVar1 = *param_1;
  *param_1 = fVar1 * local_8 - param_1[1] * local_c;
  param_1[1] = param_1[1] * local_8 + fVar1 * local_c;
  fVar1 = param_1[4];
  param_1[4] = fVar1 * local_8 - param_1[5] * local_c;
  param_1[5] = param_1[5] * local_8 + fVar1 * local_c;
  fVar1 = param_1[8];
  param_1[8] = fVar1 * local_8 - param_1[9] * local_c;
  param_1[9] = param_1[9] * local_8 + fVar1 * local_c;
  fVar1 = param_1[0xc];
  param_1[0xc] = fVar1 * local_8 - param_1[0xd] * local_c;
  param_1[0xd] = param_1[0xd] * local_8 + fVar1 * local_c;
  return;
}



/* @00491820 file=? name=FUN_00491820 */

void __cdecl FUN_00491820(undefined4 param_1)

{
  DAT_005087dc = param_1;
  return;
}



/* @00491830 file=? name=FUN_00491830 */

void __cdecl FUN_00491830(undefined4 *param_1)

{
  *param_1 = 0x3f800000;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0x3f800000;
  param_1[6] = 0;
  param_1[7] = 0;
  param_1[8] = 0;
  param_1[9] = 0;
  param_1[10] = 0x3f800000;
  param_1[0xb] = 0;
  param_1[0xc] = 0;
  param_1[0xd] = 0;
  param_1[0xe] = 0;
  param_1[0xf] = 0x3f800000;
  return;
}



/* @00491890 file=? name=FUN_00491890 */

void __cdecl
FUN_00491890(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  float local_44 [13];
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_44[0] = 1.0;
  local_44[1] = 0.0;
  local_44[2] = 0.0;
  local_44[3] = 0.0;
  local_44[4] = 0.0;
  local_44[5] = 1.0;
  local_44[6] = 0.0;
  local_44[7] = 0.0;
  local_44[8] = 0.0;
  local_44[9] = 0.0;
  local_44[10] = 1.0;
  local_44[0xb] = 0.0;
  local_8 = 0x3f800000;
  local_44[0xc] = (float)param_2;
  local_10 = param_3;
  local_c = param_4;
  FUN_004914c0(param_1,(float *)param_1,local_44);
  return;
}



/* @00491914 file=? name=FUN_00491914 */

void __cdecl FUN_00491914(float *param_1,float param_2,int param_3)

{
  if (param_3 == 0) {
    FUN_00491594((int)param_1,param_2);
    return;
  }
  if (param_3 == 1) {
    FUN_00491670(param_1,param_2);
    return;
  }
  FUN_00491748(param_1,param_2);
  return;
}



/* @00491950 file=? name=FUN_00491950 */

void __cdecl FUN_00491950(undefined4 *param_1,float param_2,undefined4 param_3,undefined4 param_4)

{
  float local_44 [6];
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_44[1] = 0.0;
  local_44[2] = 0.0;
  local_44[3] = 0.0;
  local_44[4] = 0.0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = 0;
  local_18 = 0;
  local_14 = 0;
  local_10 = 0;
  local_c = 0;
  local_8 = 0x3f800000;
  local_44[0] = param_2;
  local_44[5] = (float)param_3;
  local_1c = param_4;
  FUN_004914c0(param_1,(float *)param_1,local_44);
  return;
}



/* @004919d4 file=? name=FUN_004919d4 */

void __cdecl FUN_004919d4(undefined4 *param_1,float *param_2,float *param_3)

{
  FUN_004914c0(param_1,param_2,param_3);
  return;
}



/* @004919f0 file=? name=FUN_004919f0 */

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

void __cdecl FUN_004919f0(float *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  
  param_1[3] = 0.0;
  param_1[7] = 0.0;
  param_1[0xb] = 0.0;
  param_1[0xf] = 1.0;
  fVar1 = *param_2;
  fVar2 = param_2[1];
  fVar3 = param_2[2];
  fVar4 = param_2[4];
  fVar5 = param_2[5];
  fVar6 = param_2[6];
  fVar7 = param_2[8];
  fVar8 = param_2[9];
  fVar9 = param_2[10];
  fVar10 = param_2[0xc];
  fVar11 = param_2[0xd];
  fVar12 = param_2[0xe];
  fVar13 = fVar5 * fVar9 - fVar8 * fVar6;
  fVar14 = -(fVar4 * fVar9 - fVar7 * fVar6);
  fVar15 = fVar4 * fVar8 - fVar7 * fVar5;
  fVar16 = _DAT_00491bd8 / (fVar3 * fVar15 + fVar2 * fVar14 + fVar1 * fVar13);
  fVar13 = fVar16 * fVar13;
  fVar14 = fVar16 * fVar14;
  fVar15 = fVar16 * fVar15;
  *param_1 = fVar13;
  param_1[4] = fVar14;
  param_1[8] = fVar15;
  param_1[0xc] = -(fVar12 * fVar15 + fVar11 * fVar14 + fVar10 * fVar13);
  fVar13 = -fVar16 * (fVar2 * fVar9 - fVar8 * fVar3);
  fVar9 = (fVar1 * fVar9 - fVar7 * fVar3) * fVar16;
  fVar7 = -fVar16 * (fVar1 * fVar8 - fVar7 * fVar2);
  param_1[1] = fVar13;
  param_1[5] = fVar9;
  param_1[9] = fVar7;
  param_1[0xd] = -(fVar12 * fVar7 + fVar11 * fVar9 + fVar10 * fVar13);
  fVar7 = (fVar2 * fVar6 - fVar5 * fVar3) * fVar16;
  fVar3 = -fVar16 * (fVar1 * fVar6 - fVar4 * fVar3);
  fVar16 = (fVar1 * fVar5 - fVar4 * fVar2) * fVar16;
  param_1[2] = fVar7;
  param_1[6] = fVar3;
  param_1[10] = fVar16;
  param_1[0xe] = -(fVar12 * fVar16 + fVar11 * fVar3 + fVar10 * fVar7);
  return;
}



/* @00491c2c file=? name=FUN_00491c2c */

void __cdecl FUN_00491c2c(int param_1)

{
  if (param_1 != 0) {
    FUN_00491830((undefined4 *)(param_1 + 0x18));
    return;
  }
  FUN_004d771c(s_dpl_error___NULL_dcs_in_dpl_IdMa_005087e0);
  FUN_004dee24(9);
  return;
}



/* @00491c58 file=? name=FUN_00491c58 */

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

{
  if (param_1 != 0) {
    FUN_00491890((undefined4 *)(param_1 + 0x18),param_2,param_3,param_4);
    return;
  }
  FUN_004d771c(s_dpl_error___NULL_dcs_in_dpl_Tran_00508809);
  FUN_004dee24(9);
  return;
}



/* @00491c90 file=? name=FUN_00491c90 */

void __cdecl FUN_00491c90(int param_1,float param_2,int param_3)

{
  if (param_1 != 0) {
    FUN_00491914((float *)(param_1 + 0x18),param_2,param_3);
    return;
  }
  FUN_004d771c(s_dpl_error___NULL_dcs_in_dpl_Rota_00508833);
  FUN_004dee24(9);
  return;
}



/* @00491cc4 file=? name=FUN_00491cc4 */

void __cdecl FUN_00491cc4(int param_1,float param_2,undefined4 param_3,undefined4 param_4)

{
  if (param_1 != 0) {
    FUN_00491950((undefined4 *)(param_1 + 0x18),param_2,param_3,param_4);
    return;
  }
  FUN_004d771c(s_dpl_error___NULL_dcs_in_dpl_Scal_0050885a);
  FUN_004dee24(9);
  return;
}



/* @00491cfc file=? name=FUN_00491cfc */

void FUN_00491cfc(void)

{
  DAT_005087dc = 1;
  return;
}



/* @00491d08 file=? name=FUN_00491d08 */

void __cdecl FUN_00491d08(uint *param_1)

{
  DAT_00524ad8 = (*param_1 & 0xffff) << 4;
  DAT_00524adc = ((int)*param_1 >> 0x10 & 0xffffU) << 4;
  DAT_00524ae0 = (param_1[1] & 0xffff) << 4;
  DAT_00524ae4 = ((int)param_1[1] >> 0x10 & 0xffffU) << 4;
  DAT_00524ae8 = param_1[2];
  DAT_00524aec = FUN_00487e7c(&DAT_005088a8,param_1[3],4);
  if (DAT_00524aec == 0) {
    DAT_00524af0 = 0;
    DAT_00524af4 = 0;
    DAT_00524af8 = 0;
  }
  else {
    DAT_00524af0 = FUN_00487e7c(&DAT_005088ad,param_1[7],5);
    DAT_00524af8 = FUN_00487e7c(&DAT_005088b2,param_1[8],9);
    DAT_00524af4 = FUN_00487e7c(&DAT_005088b7,param_1[9],10);
    FUN_004d4918(&DAT_00524afc,param_1 + 4,0xc);
  }
  return;
}



/* @00491df4 file=? name=FUN_00491df4 */

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

undefined4 __cdecl FUN_00491df4(int param_1,byte *param_2)

{
  int iVar1;
  undefined4 *puVar2;
  undefined1 *puVar3;
  char *pcVar4;
  undefined4 uVar5;
  int local_10;
  int local_c;
  short local_6;
  
  local_6 = 0;
  _DAT_0050889c = _DAT_0050889c + 1;
  DAT_00508898 = (int)(char)*param_2;
  switch(DAT_00508898) {
  case 0xd:
    puVar3 = FUN_00490974(param_2 + 1,(undefined1 *)&local_10);
    puVar3 = FUN_00490944(puVar3,(undefined1 *)&local_6);
    puVar3[local_6] = 0;
    if ((local_10 == 1) || (local_10 == 2)) {
      FUN_004d771c(s__d___s_00508901);
      puVar3 = FUN_00490764(param_2,0);
      FUN_00490774(puVar3,CONCAT22((short)((uint)puVar3 >> 0x10),local_6));
      uVar5 = FUN_00491118(DAT_00508894,param_1,param_2,0,3,1,1);
    }
    else {
      FUN_004d771c(s____ERROR___i860_attempting_to_fw_00508908);
      uVar5 = 0;
    }
    break;
  default:
    FUN_004d771c(s_iserver_transaction__unexpected_t_0050894c);
    uVar5 = 0;
    break;
  case 0x10:
    puVar3 = FUN_00490764(param_2,0);
    puVar3 = FUN_00490764(puVar3,1);
    FUN_00490764(puVar3,0);
    uVar5 = FUN_00491118(DAT_00508894,param_1,param_2,0,3,1,1);
    break;
  case 0x18:
    puVar3 = FUN_00490974(param_2 + 1,(undefined1 *)&local_c);
    puVar3 = FUN_00490944(puVar3,(undefined1 *)&local_6);
    puVar3[local_6] = 0;
    if ((local_c == 1) || (local_c == 2)) {
      FUN_004d771c(s__d___s_005088c9);
      puVar3 = FUN_00490764(param_2,0);
      FUN_00490774(puVar3,CONCAT22((short)((uint)puVar3 >> 0x10),local_6));
      uVar5 = FUN_00491118(DAT_00508894,param_1,param_2,0,3,1,1);
    }
    else {
      FUN_004d771c(s_i860_error___attempt_to_fputbloc_005088d0);
      uVar5 = 0;
    }
    break;
  case 0x20:
    pcVar4 = FUN_00490944(param_2 + 1,(undefined1 *)&local_6);
    pcVar4[local_6] = '\0';
    pcVar4 = (char *)FUN_004dee74(pcVar4);
    iVar1 = FUN_004d4a78(pcVar4);
    local_6 = (short)iVar1;
    puVar3 = FUN_00490764(param_2,0);
    puVar2 = (undefined4 *)FUN_00490774(puVar3,CONCAT22((short)((uint)puVar3 >> 0x10),local_6));
    FUN_0049086c(puVar2,(undefined4 *)pcVar4,(int)local_6);
    uVar5 = FUN_00491118(DAT_00508894,param_1,param_2,0,(int)local_6 + 3,1,1);
    break;
  case 0x23:
    FUN_004d771c(s_i860_has_unexpectedly_exited_0050892e);
    FUN_004dee24(9);
    uVar5 = 0;
    break;
  case 0x28:
    iVar1 = FUN_004d4a78(s_VelociRender_005088bc);
    local_6 = (short)iVar1;
    puVar3 = FUN_00490754(param_2,0);
    puVar2 = (undefined4 *)FUN_00490774(puVar3,CONCAT22((short)((uint)puVar3 >> 0x10),local_6));
    FUN_0049086c(puVar2,(undefined4 *)s_VelociRender_005088bc,(int)local_6);
    uVar5 = FUN_00491118(DAT_00508894,param_1,param_2,0,(int)local_6 + 3,1,1);
    break;
  case 0x2a:
    puVar3 = FUN_00490754(param_2,0);
    puVar3 = FUN_00490754(puVar3,0xf);
    puVar3 = FUN_00490754(puVar3,1);
    puVar3 = FUN_00490754(puVar3,1);
    FUN_00490754(puVar3,1);
    uVar5 = FUN_00491118(DAT_00508894,param_1,param_2,0,5,1,1);
  }
  return uVar5;
}



/* @00492150 file=? name=FUN_00492150 */

void FUN_00492150(void)

{
  byte *pbVar1;
  int iVar2;
  undefined8 uVar3;
  uint local_c;
  int local_8;
  
  while( true ) {
    pbVar1 = DAT_00524ad4;
    if (DAT_00508884 != 0) {
      return;
    }
    uVar3 = FUN_00491380(DAT_00508894,4);
    if ((int)uVar3 == 0) break;
    iVar2 = FUN_00491294((int)DAT_00508894,&local_c,(undefined4 *)pbVar1,(uint *)&DAT_00508884,
                         &local_8);
    if (iVar2 == 0) {
      FUN_004d771c(s____ERROR___rcv_protocol_fail_dur_0050897c);
      FUN_004dee24(9);
    }
    if (local_8 != 0) {
      DAT_00508884 = 0;
      iVar2 = FUN_00491df4(local_c,pbVar1);
      if (iVar2 == 0) {
        FUN_004d771c(s____ERROR___iserver_transaction_f_005089bc);
        FUN_004dee24(9);
      }
    }
  }
  return;
}



/* @004921ec file=? name=FUN_004921ec */

undefined4 __cdecl FUN_004921ec(undefined4 *param_1,uint *param_2)

{
  byte *pbVar1;
  int iVar2;
  uint uVar3;
  int local_c;
  uint local_8;
  
  pbVar1 = DAT_00524ad4;
  local_c = 1;
  FUN_00492150();
  if (DAT_00508884 == 0) {
    do {
      iVar2 = FUN_00491294(DAT_00508894,&local_8,(undefined4 *)pbVar1,&DAT_00508884,&local_c);
      if (iVar2 == 0) {
        FUN_004d771c(s____ERROR___velocirender_receive_t_005089f8);
        return 0;
      }
      if ((local_c != 0) && (iVar2 = FUN_00491df4(local_8,pbVar1), iVar2 == 0)) {
        FUN_004d771c(s____ERROR___velocirender_receive_f_00508a35);
        return 0;
      }
    } while (local_c != 0);
    uVar3 = DAT_00508884 & 0xff;
    *param_2 = uVar3;
    DAT_00508884 = 0;
    if (uVar3 < 8) {
      FUN_004d771c(s____ERROR___velocirender_received_00508a77);
      FUN_004dee24(9);
    }
    *param_1 = *(undefined4 *)pbVar1;
  }
  else {
    *param_1 = *(undefined4 *)pbVar1;
    *param_2 = DAT_00508884 & 0xff;
    DAT_00508884 = 0;
  }
  return 1;
}



/* @004922e0 file=? name=FUN_004922e0 */

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

undefined4 __thiscall
FUN_004922e0(void *this,int *param_1,undefined4 *param_2,uint *param_3,uint param_4)

{
  int iVar1;
  int iVar2;
  void *local_8;
  
  iVar1 = DAT_00524ad4;
  _DAT_00508890 = _DAT_00508890 + 1;
  local_8 = this;
  do {
    iVar2 = FUN_004921ec(param_1,(uint *)&local_8);
    if (iVar2 == 0) {
      return 0;
    }
    if (*param_1 == 9) {
      if (DAT_00508880 == 0) {
        FUN_004d4918((undefined4 *)&DAT_00524a94,(undefined4 *)(iVar1 + 4),(uint)local_8);
        FUN_00491d08((uint *)&DAT_00524a94);
        DAT_00508880 = 1;
      }
      else {
        FUN_004d771c(s_dpl_internal_error___2_frame_ack_00508aa7);
        FUN_004dee24(9);
      }
    }
  } while (*param_1 == 9);
  DAT_005088a4 = 0;
  local_8 = (void *)((int)local_8 - 4);
  if ((int)param_4 < (int)local_8) {
    FUN_004d771c(s____ERROR___Message_too_long___d__00508ad4);
    FUN_004d4918(param_2,(undefined4 *)(iVar1 + 4),param_4);
    *param_3 = param_4;
  }
  else {
    FUN_004d4918(param_2,(undefined4 *)(iVar1 + 4),(uint)local_8);
    *param_3 = (uint)local_8;
  }
  return 1;
}



/* @004923cc file=? name=FUN_004923cc */

undefined4 __cdecl FUN_004923cc(int param_1)

{
  int *piVar1;
  int iVar2;
  uint local_c;
  int local_8;
  
  piVar1 = DAT_00524ad4;
  if (DAT_00508880 != 0) {
    return 1;
  }
  FUN_00492150();
  if (DAT_00508884 == 0) {
    if (param_1 == 0) {
      return 0;
    }
    iVar2 = FUN_004921ec(&local_8,&local_c);
    if (iVar2 == 0) {
      FUN_004d771c(s_velocirender_input_failed_in_vr__00508b6c);
      FUN_004dee24(9);
    }
    if (local_8 == 9) {
      FUN_004d4918((undefined4 *)&DAT_00524a94,piVar1 + 1,local_c);
      FUN_00491d08((uint *)&DAT_00524a94);
      DAT_00508880 = 1;
      DAT_00508884 = 0;
      return 1;
    }
    if (local_8 == 0x1f) {
      FUN_004d771c(s_flush_artic___00508b96);
    }
    FUN_004d771c(s_dpl_error___unsolicited_input_du_00508ba5);
    iVar2 = 0;
    if (0 < (int)local_c) {
      do {
        FUN_004d771c(s_0x_x_00508be0);
        iVar2 = iVar2 + 1;
      } while (iVar2 < (int)local_c);
    }
    FUN_004dee24(9);
  }
  else {
    local_8 = *piVar1;
    if (local_8 == 9) {
      FUN_004d4918((undefined4 *)&DAT_00524a94,piVar1 + 1,DAT_00508884);
      FUN_00491d08((uint *)&DAT_00524a94);
      DAT_00508880 = 1;
      DAT_00508884 = 0;
      return 1;
    }
    FUN_004d771c(s_dpl_error___unsolicited_input_du_00508b1c);
    if (local_8 == 0x1f) {
      FUN_004d771c(s_flush_artic___00508b56);
    }
    for (iVar2 = 0; iVar2 < (int)DAT_00508884; iVar2 = iVar2 + 1) {
      FUN_004d771c(s_0x_x_00508b65);
    }
    FUN_004dee24(9);
  }
  return 0;
}



/* @00492580 file=? name=FUN_00492580 */

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

undefined4 __cdecl FUN_00492580(int param_1,byte *param_2,uint param_3,int param_4)

{
  int iVar1;
  
  FUN_00492150();
  DAT_005088a4 = DAT_005088a4 + 1;
  if (param_1 == 9) {
    if (DAT_00508880 == 0) {
      FUN_004923cc(1);
    }
    DAT_00508880 = 0;
    DAT_005088a0 = -1;
  }
  DAT_005088a0 = DAT_005088a0 + 1;
  _DAT_0050888c = _DAT_0050888c + 1;
  if ((param_4 == 0) && (DAT_00508568 == 0)) {
    iVar1 = 0;
  }
  else {
    iVar1 = 1;
  }
  iVar1 = FUN_00491118(DAT_00508894,0xff,param_2,param_1,param_3,0,iVar1);
  if (iVar1 == 0) {
    FUN_004d771c(s____ERROR___send_protocol_failed_d_00508be7);
    FUN_004dee24(9);
  }
  return 1;
}



/* @00492624 file=? name=FUN_00492624 */

undefined4 __cdecl FUN_00492624(int param_1,byte *param_2,uint param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  while( true ) {
    if ((int)param_3 < 0x1fd) {
      if ((param_3 == 0) || (iVar1 = FUN_00492580(param_1,param_2,param_3,1), iVar1 != 0)) {
        uVar2 = 1;
      }
      else {
        uVar2 = 0;
      }
      return uVar2;
    }
    iVar1 = FUN_00492580(param_1,param_2,0x1fc,1);
    if (iVar1 == 0) break;
    param_3 = param_3 - 0x1fc;
    param_2 = param_2 + 0x1fc;
  }
  return 0;
}



/* @00492680 file=? name=FUN_00492680 */

undefined4 __cdecl FUN_00492680(LPCSTR param_1)

{
  int *piVar1;
  undefined4 uVar2;
  uint uVar3;
  int iVar4;
  
  FUN_00491380(DAT_00508894,0);
  piVar1 = FUN_004d6f54(param_1,&DAT_00508c2d);
  if (piVar1 == (int *)0x0) {
    FUN_004d771c(s_Couldnt_open__s_00508c30);
    uVar2 = 0;
  }
  else {
    uVar3 = FUN_004d71e0((char *)DAT_00524b0c,1,0x800,piVar1);
    while (uVar3 == 0x800) {
      iVar4 = FUN_00491118(DAT_00508894,0xff,DAT_00524b0c,0,0x800,0,1);
      if (iVar4 == 0) {
        FUN_004d6b08(piVar1);
        return 0;
      }
      uVar3 = FUN_004d71e0((char *)DAT_00524b0c,1,0x800,piVar1);
    }
    FUN_004d6b08(piVar1);
    if ((uVar3 == 0) ||
       (iVar4 = FUN_00491118(DAT_00508894,0xff,DAT_00524b0c,0,uVar3,0,1), iVar4 != 0)) {
      uVar2 = 1;
    }
    else {
      uVar2 = 0;
    }
  }
  return uVar2;
}



/* @0049276c file=? name=FUN_0049276c */

void __cdecl FUN_0049276c(int param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  iVar1 = FUN_004dfd90();
  iVar3 = 0;
  if (0 < param_1) {
    do {
      do {
        iVar2 = FUN_004dfd90();
      } while (iVar1 == iVar2);
      iVar1 = FUN_004dfd90();
      iVar3 = iVar3 + 1;
    } while (iVar3 < param_1);
  }
  return;
}



/* @0049279c file=? name=FUN_0049279c */

void __cdecl FUN_0049279c(byte *param_1)

{
  int iVar1;
  
  iVar1 = FUN_004d4a78((char *)param_1);
  FUN_00492580(0x15,param_1,iVar1 + 1,1);
  return;
}



/* @004927bc file=? name=FUN_004927bc */

void __cdecl FUN_004927bc(int *param_1,uint param_2,int param_3)

{
  byte *pbVar1;
  uint uVar2;
  
  pbVar1 = DAT_00524b0c;
  while( true ) {
    if ((int)param_2 < 0x801) {
      if (param_2 != 0) {
        uVar2 = FUN_004d71e0((char *)pbVar1,1,param_2,param_1);
        if (param_2 == uVar2) {
          FUN_00492624(param_3,pbVar1,uVar2);
        }
        else {
          FUN_004d771c(s_i860_MNG_file_error__file_corrup_00508c72);
        }
      }
      return;
    }
    uVar2 = FUN_004d71e0((char *)pbVar1,1,0x800,param_1);
    if (uVar2 != 0x800) break;
    FUN_00492624(param_3,pbVar1,0x800);
    param_2 = param_2 - 0x800;
  }
  FUN_004d771c(s_i860_MNG_file_error__file_corrup_00508c41);
  return;
}



/* @00492844 file=? name=FUN_00492844 */

undefined4 __cdecl FUN_00492844(LPCSTR param_1,byte *param_2)

{
  byte *pbVar1;
  int *piVar2;
  undefined1 *puVar3;
  undefined4 uVar4;
  undefined8 uVar5;
  undefined1 local_20 [4];
  undefined1 local_1c [4];
  undefined1 local_18 [4];
  undefined1 local_14 [4];
  uint local_10;
  uint local_c;
  uint local_8;
  
  pbVar1 = DAT_00524b0c;
  FUN_0049279c(param_2);
  piVar2 = FUN_004d6f54(param_1,&DAT_00508ca3);
  if (piVar2 == (int *)0x0) {
    uVar4 = FUN_004d771c(s_Couldnt_open_i860_file__s_00508ca6);
  }
  else {
    FUN_004d71e0((char *)pbVar1,7,4,piVar2);
    FUN_00492580(0x12,pbVar1,0x28,1);
    puVar3 = FUN_00490974(pbVar1,(undefined1 *)&local_8);
    puVar3 = FUN_00490974(puVar3,(undefined1 *)&local_c);
    puVar3 = FUN_00490974(puVar3,(undefined1 *)&local_10);
    puVar3 = FUN_00490974(puVar3,local_14);
    puVar3 = FUN_00490974(puVar3,local_18);
    puVar3 = FUN_00490974(puVar3,local_1c);
    FUN_00490974(puVar3,local_20);
    FUN_004927bc(piVar2,local_8,0x12);
    FUN_004927bc(piVar2,local_c,0x13);
    FUN_004927bc(piVar2,local_10,0x14);
    FUN_004d6b08(piVar2);
    uVar5 = FUN_00491380(DAT_00508894,2);
    uVar4 = (undefined4)uVar5;
  }
  return uVar4;
}



/* @0049295c file=? name=FUN_0049295c */

undefined4 __fastcall FUN_0049295c(undefined4 param_1)

{
  int iVar1;
  byte *pbVar2;
  
  iVar1 = FUN_004dee74(s_TRANSPUTER_00508cc1);
  if (iVar1 == 0) {
    return 0x150;
  }
  pbVar2 = &DAT_00508cd7;
  iVar1 = FUN_004dee74(s_TRANSPUTER_00508ccc);
  iVar1 = FUN_004d7f84(iVar1,pbVar2);
  if (iVar1 == 1) {
    return param_1;
  }
  return 0x150;
}



/* @004929a8 file=? name=FUN_004929a8 */

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

undefined8 __cdecl FUN_004929a8(LPCSTR param_1,int param_2,LPCSTR param_3,undefined4 param_4)

{
  int iVar1;
  undefined8 uVar2;
  void *this;
  undefined4 local_c;
  uint local_8;
  
  FUN_00490ab8();
  DAT_00524ad4 = FUN_00452c38(0x800);
  _DAT_00524b10 = FUN_00452c38(0x800);
  this = (void *)0x800;
  DAT_00524b0c = FUN_00452c38(0x800);
  DAT_00508894 = FUN_004913f0(this,param_4);
  FUN_00491380(DAT_00508894,3);
  FUN_00492680(param_1);
  FUN_00491380(DAT_00508894,1);
  iVar1 = FUN_004921ec(&local_c,&local_8);
  if (iVar1 == 0) {
    FUN_004d771c(s_velocirender_input_failed_in_sta_00508cda);
    FUN_004dee24(9);
  }
  if (param_2 != 0) {
    FUN_004d771c(s_HSP_____get_outta_here__s_00508d0b);
    FUN_004d6b9c((int *)&DAT_0051f818);
  }
  if (param_3 != (LPCSTR)0x0) {
    FUN_00492844(param_3,(byte *)s_i860_50MHz_and_kicking_00508d27);
  }
  uVar2 = FUN_00491380(DAT_00508894,2);
  return uVar2;
}



/* @00492a90 file=? name=FUN_00492a90 */

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

void FUN_00492a90(void)

{
  DAT_00508880 = 1;
  DAT_00508884 = 0;
  _DAT_00508888 = 0;
  _DAT_0050888c = 0;
  _DAT_00508890 = 0;
  DAT_00508894 = 0;
  DAT_005088a4 = 0;
  DAT_00508898 = 0;
  _DAT_0050889c = 0;
  DAT_005088a0 = 0;
  return;
}



/* @00492adc file=? name=FUN_00492adc */

void FUN_00492adc(void)

{
  FUN_0049517c();
  FUN_00496558();
  FUN_00496600();
  FUN_00498c68();
  FUN_00499b48();
  FUN_0049a2d4();
  FUN_004987a4();
  FUN_004991f8();
  FUN_00497924();
  FUN_00496d10();
  FUN_00496664();
  FUN_0049a3a8();
  return;
}



/* @00492b20 file=? name=FUN_00492b20 */

void __cdecl FUN_00492b20(undefined4 *param_1)

{
  uint uVar1;
  uint uVar2;
  
  uVar1 = param_1[9];
  if (uVar1 != param_1[3]) {
    if (((undefined4 *)param_1[7] != (undefined4 *)param_1[6]) && (uVar1 != 0)) {
      FUN_004d493c((undefined4 *)param_1[6],(undefined4 *)param_1[7],uVar1);
    }
    param_1[5] = param_1[5] + (param_1[8] - uVar1);
    uVar2 = FUN_004d71e0((char *)(param_1[6] + uVar1),1,param_1[3] - uVar1,(int *)*param_1);
    if (uVar2 == 0) {
      param_1[2] = 1;
      FUN_0049a300(1,s_failed_to_read_from_file_descrip_00508d85);
    }
    param_1[9] = param_1[9] + uVar2;
    param_1[8] = uVar1 + uVar2;
    param_1[7] = param_1[6];
  }
  return;
}



/* @00492ba0 file=? name=FUN_00492ba0 */

uint __cdecl FUN_00492ba0(undefined4 *param_1,uint param_2)

{
  int iVar1;
  int iVar2;
  
  if ((uint)param_1[9] < param_2) {
    iVar1 = param_1[9];
    iVar2 = FUN_004d7270((int *)*param_1,param_2 - iVar1,1);
    if (iVar2 == 0) {
      param_1[5] = param_1[5] + (param_2 - iVar1) + param_1[8];
      param_1[8] = 0;
      param_1[9] = 0;
    }
    else {
      param_1[2] = 1;
      FUN_0049a300(1,s_failed_to_move_file_position_for_00508daf);
      param_2 = 0;
    }
  }
  else {
    param_1[9] = param_1[9] - param_2;
    param_1[7] = param_1[7] + param_2;
  }
  return param_2;
}



/* @00492c0c file=? name=FUN_00492c0c */

uint __cdecl FUN_00492c0c(undefined4 *param_1,uint param_2)

{
  uint uVar1;
  int iVar2;
  
  uVar1 = param_1[5];
  if ((param_2 < uVar1) || ((uint)param_1[8] < param_2 - uVar1)) {
    iVar2 = FUN_004d7270((int *)*param_1,param_2,0);
    if (iVar2 == 0) {
      param_1[5] = param_2;
      param_1[9] = 0;
    }
    else {
      param_1[2] = 1;
      FUN_0049a300(1,s_failed_to_move_file_position_for_00508de6);
      param_2 = 0;
    }
  }
  else {
    param_1[7] = param_1[6] + (param_2 - uVar1);
    param_1[9] = param_1[8] - (param_2 - uVar1);
  }
  return param_2;
}



/* @00492c84 file=? name=FUN_00492c84 */

undefined4 __cdecl FUN_00492c84(undefined4 *param_1)

{
  undefined1 *puVar1;
  
  if ((int)param_1[9] < 1) {
    FUN_00492b20(param_1);
    if (param_1[2] != 0) {
      return 0;
    }
  }
  param_1[9] = param_1[9] + -1;
  puVar1 = (undefined1 *)param_1[7];
  param_1[7] = param_1[7] + 1;
  return CONCAT31((int3)((uint)puVar1 >> 8),*puVar1);
}



/* @00492cb4 file=? name=FUN_00492cb4 */

undefined4 __cdecl FUN_00492cb4(undefined4 *param_1)

{
  undefined1 uVar1;
  undefined1 *puVar2;
  undefined2 uVar3;
  undefined2 local_6;
  
  if (((int)param_1[9] < 2) && (FUN_00492b20(param_1), param_1[2] != 0)) {
    return 0;
  }
  if (param_1[1] == 0) {
    local_6 = *(undefined2 *)param_1[7];
    uVar3 = (undefined2)((uint)param_1[7] >> 0x10);
    param_1[7] = param_1[7] + 2;
  }
  else {
    uVar3 = (undefined2)((uint)&local_6 >> 0x10);
    puVar2 = (undefined1 *)param_1[7];
    param_1[7] = param_1[7] + 1;
    uVar1 = *puVar2;
    puVar2 = (undefined1 *)param_1[7];
    param_1[7] = param_1[7] + 1;
    local_6 = CONCAT11(uVar1,*puVar2);
  }
  param_1[9] = param_1[9] + -2;
  return CONCAT22(uVar3,local_6);
}



/* @00492d10 file=? name=FUN_00492d10 */

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

float10 __cdecl FUN_00492d10(undefined4 *param_1)

{
  undefined1 uVar1;
  undefined1 uVar2;
  undefined1 uVar3;
  undefined1 *puVar4;
  float local_8;
  
  if ((3 < (int)param_1[9]) || (FUN_00492b20(param_1), local_8 = _DAT_00492d80, param_1[2] == 0)) {
    if (param_1[1] == 0) {
      local_8 = *(float *)param_1[7];
      param_1[7] = param_1[7] + 4;
    }
    else {
      puVar4 = (undefined1 *)param_1[7];
      param_1[7] = param_1[7] + 1;
      uVar1 = *puVar4;
      puVar4 = (undefined1 *)param_1[7];
      param_1[7] = param_1[7] + 1;
      uVar2 = *puVar4;
      puVar4 = (undefined1 *)param_1[7];
      param_1[7] = param_1[7] + 1;
      uVar3 = *puVar4;
      puVar4 = (undefined1 *)param_1[7];
      param_1[7] = param_1[7] + 1;
      local_8 = (float)CONCAT31(CONCAT21(CONCAT11(uVar1,uVar2),uVar3),*puVar4);
    }
    param_1[9] = param_1[9] + -4;
  }
  return (float10)local_8;
}



/* @00492d84 file=? name=FUN_00492d84 */

undefined4 __cdecl FUN_00492d84(undefined4 *param_1)

{
  undefined1 uVar1;
  undefined1 uVar2;
  undefined1 uVar3;
  undefined1 *puVar4;
  undefined4 local_8;
  
  if (((int)param_1[9] < 4) && (FUN_00492b20(param_1), param_1[2] != 0)) {
    return 0;
  }
  if (param_1[1] == 0) {
    local_8 = *(undefined4 *)param_1[7];
    param_1[7] = param_1[7] + 4;
  }
  else {
    puVar4 = (undefined1 *)param_1[7];
    param_1[7] = param_1[7] + 1;
    uVar1 = *puVar4;
    puVar4 = (undefined1 *)param_1[7];
    param_1[7] = param_1[7] + 1;
    uVar2 = *puVar4;
    puVar4 = (undefined1 *)param_1[7];
    param_1[7] = param_1[7] + 1;
    uVar3 = *puVar4;
    puVar4 = (undefined1 *)param_1[7];
    param_1[7] = param_1[7] + 1;
    local_8 = CONCAT31(CONCAT21(CONCAT11(uVar1,uVar2),uVar3),*puVar4);
  }
  param_1[9] = param_1[9] + -4;
  return local_8;
}



/* @00492df0 file=? name=FUN_00492df0 */

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

{
  char *pcVar1;
  uint uVar2;
  uint uVar3;
  
  uVar3 = param_3 * 4;
  if (param_1[1] == 0) {
    uVar2 = param_1[9];
    if (uVar2 < uVar3) {
      if (uVar2 != 0) {
        FUN_004d4918((undefined4 *)param_2,(undefined4 *)param_1[7],uVar2);
        param_2 = param_2 + uVar2;
        uVar3 = uVar3 - uVar2;
        param_1[9] = 0;
      }
      if ((uint)param_1[3] < uVar3) {
        uVar2 = FUN_004d71e0(param_2,1,uVar3,(int *)*param_1);
        if (uVar3 != uVar2) {
          return 0;
        }
        param_1[5] = param_1[5] + uVar3 + param_1[8];
        param_1[8] = 0;
      }
      else {
        FUN_00492b20(param_1);
        if (param_1[2] != 0) {
          return 0;
        }
        FUN_004d4918((undefined4 *)param_2,(undefined4 *)param_1[7],uVar3);
        param_1[7] = param_1[7] + uVar3;
        param_1[9] = param_1[9] - uVar3;
      }
    }
    else {
      FUN_004d4918((undefined4 *)param_2,(undefined4 *)param_1[7],uVar3);
      param_1[7] = param_1[7] + uVar3;
      param_1[9] = param_1[9] + param_3 * -4;
    }
  }
  else {
    while (param_3 != 0) {
      if (((int)param_1[9] < 4) && (FUN_00492b20(param_1), param_1[2] != 0)) {
        return 0;
      }
      pcVar1 = (char *)param_1[7];
      param_1[7] = param_1[7] + 1;
      param_2[3] = *pcVar1;
      pcVar1 = (char *)param_1[7];
      param_1[7] = param_1[7] + 1;
      param_2[2] = *pcVar1;
      pcVar1 = (char *)param_1[7];
      param_1[7] = param_1[7] + 1;
      param_2[1] = *pcVar1;
      pcVar1 = (char *)param_1[7];
      param_1[7] = param_1[7] + 1;
      *param_2 = *pcVar1;
      param_1[9] = param_1[9] + -4;
      param_2 = param_2 + 4;
      param_3 = param_3 + -1;
    }
  }
  return 1;
}



/* @00492f10 file=? name=FUN_00492f10 */

undefined4 __cdecl FUN_00492f10(undefined4 *param_1,char *param_2,uint param_3)

{
  uint uVar1;
  
  uVar1 = param_1[9];
  if (uVar1 < param_3) {
    if (uVar1 != 0) {
      FUN_004d4918((undefined4 *)param_2,(undefined4 *)param_1[7],uVar1);
      param_2 = param_2 + uVar1;
      param_3 = param_3 - uVar1;
      param_1[9] = 0;
    }
    if ((uint)param_1[3] < param_3) {
      uVar1 = FUN_004d71e0(param_2,1,param_3,(int *)*param_1);
      if (param_3 != uVar1) {
        return 0;
      }
      param_1[5] = param_1[5] + param_3 + param_1[8];
      param_1[8] = 0;
    }
    else {
      FUN_00492b20(param_1);
      if (param_1[2] != 0) {
        return 0;
      }
      FUN_004d4918((undefined4 *)param_2,(undefined4 *)param_1[7],param_3);
      param_1[7] = param_1[7] + param_3;
      param_1[9] = param_1[9] - param_3;
    }
  }
  else {
    FUN_004d4918((undefined4 *)param_2,(undefined4 *)param_1[7],param_3);
    param_1[7] = param_1[7] + param_3;
    param_1[9] = param_1[9] - param_3;
  }
  return 1;
}



/* @00492fc4 file=? name=FUN_00492fc4 */

undefined4 __cdecl FUN_00492fc4(undefined4 *param_1,int *param_2,uint *param_3,uint param_4)

{
  uint local_c;
  int *local_8;
  
  if ((int)param_4 < (int)*param_3) {
    FUN_00492f10(param_1,(char *)*param_2,param_4);
    *(undefined1 *)(*param_2 + param_4) = 0;
  }
  else {
    if ((int)param_4 < 0x100) {
      local_c = 0x100;
    }
    else {
      local_c = param_4 + 1;
    }
    if (*param_3 == 0) {
      local_8 = FUN_004de55c(local_c);
    }
    else {
      local_8 = FUN_004de760((int *)*param_2,local_c);
    }
    if (local_8 == (int *)0x0) {
      if ((char *)*param_2 == (char *)0x0) {
        return 0;
      }
      FUN_00492f10(param_1,(char *)*param_2,*param_3);
      FUN_00492ba0(param_1,param_4 - *param_3);
      *(undefined1 *)(*param_2 + -1 + *param_3) = 0;
    }
    else {
      *param_2 = (int)local_8;
      *param_3 = local_c;
      FUN_00492f10(param_1,(char *)local_8,param_4);
      *(undefined1 *)((int)local_8 + param_4) = 0;
    }
  }
  return 1;
}



/* @0049309c file=? name=FUN_0049309c */

void __cdecl FUN_0049309c(undefined4 *param_1,undefined4 *param_2)

{
  *param_2 = 0;
  if ((int *)*param_1 != (int *)0x0) {
    FUN_004de420((int *)*param_1);
    *param_1 = 0;
  }
  return;
}



/* @004930c0 file=? name=FUN_004930c0 */

int * __cdecl FUN_004930c0(LPCSTR param_1,uint param_2,int *param_3,int param_4)

{
  int *piVar1;
  int *piVar2;
  
  while (piVar1 = FUN_004d6f54(param_1,&DAT_00508e1d), piVar1 == (int *)0x0) {
    if (DAT_00520bcc != 0x27) {
      return (int *)0x0;
    }
  }
  piVar2 = FUN_004de2bc(1,0x34);
  if (piVar2 == (int *)0x0) {
    FUN_004d6b08(piVar1);
    return (int *)0x0;
  }
  if ((param_3 == (int *)0x0) || (param_2 < 0x400)) {
    if (param_2 < 0x400) {
      param_2 = 0x400;
    }
    param_3 = FUN_004de55c(param_2);
    if (param_3 == (int *)0x0) {
      FUN_004d6b08(piVar1);
      FUN_004de420(piVar2);
      return (int *)0x0;
    }
    piVar2[4] = 1;
  }
  *piVar2 = (int)piVar1;
  piVar2[6] = (int)param_3;
  piVar2[3] = param_2;
  *(undefined1 *)(piVar2 + 1) = 1;
  piVar2[1] = piVar2[1] & 1;
  piVar2[1] = piVar2[1] ^ (uint)(param_4 != 0);
  return piVar2;
}



/* @00493188 file=? name=FUN_00493188 */

void __cdecl FUN_00493188(int *param_1)

{
  int iVar1;
  
  iVar1 = FUN_004d6b08((int *)*param_1);
  if (iVar1 != 0) {
    FUN_0049a300(1,s_failed_to_close_file_descriptor_0_00508e20);
  }
  if (param_1[4] != 0) {
    FUN_004de420((int *)param_1[6]);
  }
  FUN_004de420(param_1);
  return;
}



/* @004931c8 file=? name=FUN_004931c8 */

void __cdecl FUN_004931c8(undefined1 *param_1,uint param_2)

{
  undefined1 uVar1;
  uint uVar2;
  
  uVar2 = 0;
  if (param_2 != 0) {
    do {
      uVar1 = *param_1;
      *param_1 = param_1[3];
      param_1[3] = uVar1;
      uVar1 = param_1[1];
      param_1[1] = param_1[2];
      param_1[2] = uVar1;
      param_1 = param_1 + 4;
      uVar2 = uVar2 + 1;
    } while (uVar2 < param_2);
  }
  return;
}



/* @004931fc file=? name=FUN_004931fc */

void * __thiscall FUN_004931fc(void *this,undefined4 *param_1,uint *param_2,uint *param_3)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  void *local_8;
  
  uVar3 = 0;
  uVar1 = FUN_00492cb4(param_1);
  uVar2 = (int)(uVar1 & 0xffff) >> 0xc & 0xc;
  if (uVar2 == 0) {
    uVar3 = FUN_00492c84(param_1);
    uVar3 = uVar3 & 0xff;
    local_8 = (void *)0x3;
  }
  else if (uVar2 == 4) {
    uVar3 = FUN_00492cb4(param_1);
    uVar3 = uVar3 & 0xffff;
    local_8 = (void *)0x4;
  }
  else if (uVar2 == 8) {
    uVar3 = FUN_00492d84(param_1);
    local_8 = (void *)0x6;
  }
  else {
    FUN_0049a300(1,s_dpl_bgfRead_got_unrecognised_blo_00508ee8);
    param_1[2] = 1;
    local_8 = this;
  }
  *param_2 = uVar1 & 0x3fff;
  *param_3 = uVar3;
  return local_8;
}



/* @004932a4 file=? name=FUN_004932a4 */

undefined4 __thiscall FUN_004932a4(void *this,undefined4 *param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  int iVar3;
  float10 fVar4;
  float local_10;
  uint local_c;
  uint local_8;
  
  iVar3 = 0;
  local_10 = 0.0254;
  do {
    if ((param_1[2] != 0) || (param_2 <= iVar3)) {
      param_1[10] = local_10 * (float)param_1[10];
      return 1;
    }
    iVar1 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    this = param_1;
    if ((int)local_8 < 0x2006) {
      if (local_8 == 0x2005) {
        fVar4 = FUN_00492d10(param_1);
        param_1[10] = (float)fVar4;
      }
      else if ((int)local_8 < 0x2003) {
        if (local_8 == 0x2002) {
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX;
        }
        else if ((local_8 == 0) || (local_8 == 0x2000)) {
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_03;
        }
        else {
LAB_00493446:
          FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_00508fa5);
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_04;
        }
      }
      else if (local_8 == 0x2003) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_00;
      }
      else {
        if (local_8 != 0x2004) goto LAB_00493446;
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
    }
    else if (local_8 == 0x2006) {
      uVar2 = FUN_00492c84(param_1);
      *(char *)(param_1 + 0xb) = (char)uVar2;
      if (*(char *)(param_1 + 0xb) != '\0') {
        FUN_0049a300(1,s_dpl_bgfRead_cannot_process_doubl_00508f18);
        param_1[2] = 1;
        return 0;
      }
    }
    else if (local_8 == 0x2007) {
      uVar2 = FUN_00492c84(param_1);
      if ((char)uVar2 != '\0') {
        FUN_0049a300(1,s_dpl_bgfRead___file_is_not_a_geom_00508f4b);
        param_1[2] = 1;
        return 0;
      }
    }
    else if (local_8 == 0x2009) {
      uVar2 = FUN_00492c84(param_1);
      if ((char)uVar2 == '\0') {
        local_10 = 0.0254;
      }
      else {
        if ((char)uVar2 != '\x01') {
          FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_uni_00508f76);
          param_1[2] = 1;
          return 0;
        }
        local_10 = 1.0;
      }
    }
    else {
      if (local_8 != 0x2037) goto LAB_00493446;
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_02;
    }
    iVar3 = iVar3 + iVar1 + local_c;
  } while( true );
}



/* @0049348c file=? name=FUN_0049348c */

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

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

{
  float fVar1;
  bool bVar2;
  int iVar3;
  int iVar4;
  float *pfVar5;
  float *pfVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  int local_14;
  int local_8;
  
  local_8 = 3;
  bVar2 = false;
  uVar7 = 1;
  if (param_4 == 0x49) {
    uVar7 = 0x41;
    local_8 = 4;
    bVar2 = true;
  }
  else {
    if ((param_4 & 0x1f) != (int)*(char *)(param_3 + 0xc)) {
      FUN_0049a300(1,s_dpl_bgfRead_got_vertices_of_inco_00508fdb);
      FUN_00492ba0(param_1,param_5);
      return 0;
    }
    if ((param_4 & 1) != 0) {
      uVar7 = 3;
      local_8 = 6;
    }
    if ((param_4 & 2) != 0) {
      uVar7 = uVar7 | 4;
      local_8 = local_8 + 4;
    }
    if ((param_4 & 4) != 0) {
      uVar7 = uVar7 | 8;
      local_8 = local_8 + 2;
    }
    if ((param_4 & 8) != 0) {
      uVar7 = uVar7 | 0x10;
      local_8 = local_8 + 2;
    }
    if ((param_4 & 0x10) != 0) {
      uVar7 = uVar7 | 0x20;
      local_8 = local_8 + 3;
    }
  }
  iVar3 = local_8 * 4;
  iVar4 = (int)param_5 / iVar3;
  FUN_0048c910(param_2,uVar7);
  FUN_0048cae0(param_2,iVar4);
  if ((int)param_1[9] < (int)param_5) {
    if ((*(byte *)(param_1 + 7) & 3) != 0) {
      FUN_004d493c((undefined4 *)param_1[6],(undefined4 *)param_1[7],param_1[9]);
      param_1[7] = param_1[6];
    }
    local_14 = 0;
    for (; (param_1[2] == 0 && (0 < iVar4)); iVar4 = iVar4 - iVar9) {
      if ((int)param_1[9] < iVar3) {
        FUN_00492b20(param_1);
      }
      iVar9 = (int)param_1[9] / iVar3;
      if (iVar4 < (int)param_1[9] / iVar3) {
        iVar9 = iVar4;
      }
      if (param_1[1] != 0) {
        FUN_004931c8((undefined1 *)param_1[7],iVar9 * local_8);
      }
      if ((float)param_1[10] != _DAT_0049371c) {
        pfVar6 = (float *)param_1[7];
        fVar1 = (float)param_1[10];
        iVar8 = 0;
        if (0 < iVar9) {
          do {
            *pfVar6 = fVar1 * *pfVar6;
            pfVar6[1] = fVar1 * pfVar6[1];
            pfVar6[2] = fVar1 * pfVar6[2];
            if (bVar2) {
              pfVar6[3] = fVar1 * pfVar6[3];
            }
            pfVar6 = pfVar6 + local_8;
            iVar8 = iVar8 + 1;
          } while (iVar8 < iVar9);
        }
      }
      FUN_0048cc48(param_2,(byte *)param_1[7],local_14,iVar9);
      FUN_00492ba0(param_1,iVar9 * iVar3);
      local_14 = local_14 + iVar9;
    }
    if (0 < iVar4) {
      FUN_0049a300(1,s_dpl_bgfRead_failed_to_read_in_al_00509022);
    }
  }
  else {
    if ((*(byte *)(param_1 + 7) & 3) == 0) {
      pfVar6 = (float *)param_1[7];
    }
    else {
      FUN_004d493c((undefined4 *)param_1[6],(undefined4 *)param_1[7],param_5);
      pfVar6 = (float *)param_1[6];
    }
    if (param_1[1] != 0) {
      FUN_004931c8((undefined1 *)pfVar6,iVar4 * local_8);
    }
    if ((float)param_1[10] != _DAT_0049371c) {
      fVar1 = (float)param_1[10];
      iVar3 = 0;
      pfVar5 = pfVar6;
      if (0 < iVar4) {
        do {
          *pfVar5 = fVar1 * *pfVar5;
          pfVar5[1] = fVar1 * pfVar5[1];
          pfVar5[2] = fVar1 * pfVar5[2];
          if (bVar2) {
            pfVar5[3] = fVar1 * pfVar5[3];
          }
          pfVar5 = pfVar5 + local_8;
          iVar3 = iVar3 + 1;
        } while (iVar3 < iVar4);
      }
    }
    FUN_0048cc48(param_2,(byte *)pfVar6,0,iVar4);
    FUN_00492ba0(param_1,param_5);
  }
  return 1;
}



/* @00493720 file=? name=FUN_00493720 */

undefined4 __cdecl FUN_00493720(undefined4 *param_1,int param_2,int param_3,uint param_4)

{
  int iVar1;
  int iVar2;
  int iVar3;
  byte *local_10;
  
  iVar1 = param_3 * 4;
  iVar2 = (int)param_4 / iVar1;
  if ((int)param_1[9] < (int)param_4) {
    if ((*(byte *)(param_1 + 7) & 3) != 0) {
      FUN_004d493c((undefined4 *)param_1[6],(undefined4 *)param_1[7],param_1[9]);
      param_1[7] = param_1[6];
    }
    for (; (param_1[2] == 0 && (0 < iVar2)); iVar2 = iVar2 - iVar3) {
      if ((int)param_1[9] < iVar1) {
        FUN_00492b20(param_1);
      }
      iVar3 = (int)param_1[9] / iVar1;
      if (iVar2 < (int)param_1[9] / iVar1) {
        iVar3 = iVar2;
      }
      if (param_1[1] != 0) {
        FUN_004931c8((undefined1 *)param_1[7],iVar3 * param_3);
      }
      FUN_0048cd68(param_2,(byte *)param_1[7],iVar3,param_3);
      FUN_00492ba0(param_1,iVar3 * iVar1);
    }
    if (0 < iVar2) {
      FUN_0049a300(1,s_dpl_bgfRead_failed_to_read_in_al_00509052);
    }
  }
  else {
    if ((*(byte *)(param_1 + 7) & 3) == 0) {
      local_10 = (byte *)param_1[7];
    }
    else {
      FUN_004d493c((undefined4 *)param_1[6],(undefined4 *)param_1[7],param_4);
      local_10 = (byte *)param_1[6];
    }
    if (param_1[1] != 0) {
      FUN_004931c8(local_10,iVar2 * param_3);
    }
    FUN_0048cd68(param_2,local_10,iVar2,param_3);
    FUN_00492ba0(param_1,param_4);
  }
  return 1;
}



/* @00493854 file=? name=FUN_00493854 */

undefined4 __cdecl FUN_00493854(undefined4 *param_1,int param_2,int param_3,uint param_4)

{
  uint uVar1;
  uint uVar2;
  undefined4 uVar3;
  byte *pbVar4;
  int local_c;
  
  uVar1 = param_4;
  if ((int)param_4 < 0) {
    uVar1 = param_4 + 3;
  }
  uVar2 = (int)uVar1 >> 2;
  if (param_3 == 3) {
    local_c = uVar2 - 2;
  }
  else {
    if (param_3 != 4) {
      FUN_0049a300(1,s_dpl_bgfRead_got_unrecognised_typ_00509085);
      FUN_00492ba0(param_1,param_4);
      return 0;
    }
    local_c = (int)uVar1 >> 3;
    if (local_c < 0) {
      local_c = local_c + (uint)((uVar2 & 1) != 0);
    }
    local_c = local_c + -1;
  }
  if (local_c < 1) {
    FUN_0049a300(1,s_dpl_bgfRead_got_an_invalid_numbe_005090bb);
    FUN_00492ba0(param_1,param_4);
    uVar3 = 0;
  }
  else {
    if ((uint)param_1[3] < param_4) {
      pbVar4 = (byte *)FUN_004de55c(param_4);
      if (pbVar4 == (byte *)0x0) {
        FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_m_005090f8);
        FUN_00492ba0(param_1,param_4);
        return 0;
      }
      FUN_00492df0(param_1,(char *)pbVar4,uVar2);
      FUN_0048cdac(param_2,pbVar4,local_c,param_3);
      FUN_004de420((int *)pbVar4);
    }
    else {
      pbVar4 = (byte *)param_1[6];
      if ((int)param_1[9] < (int)param_4) {
        FUN_00492b20(param_1);
      }
      else if ((*(byte *)(param_1 + 7) & 3) == 0) {
        pbVar4 = (byte *)param_1[7];
      }
      else {
        FUN_004d493c((undefined4 *)param_1[6],(undefined4 *)param_1[7],param_4);
      }
      if (param_1[1] != 0) {
        FUN_004931c8(pbVar4,uVar2);
      }
      FUN_0048cdac(param_2,pbVar4,local_c,param_3);
      FUN_00492ba0(param_1,param_4);
    }
    if (param_1[2] == 0) {
      uVar3 = 1;
    }
    else {
      uVar3 = 0;
    }
  }
  return uVar3;
}



/* @004939b8 file=? name=FUN_004939b8 */

undefined4 __thiscall
FUN_004939b8(void *this,undefined4 *param_1,int param_2,int param_3,int param_4)

{
  bool bVar1;
  int iVar2;
  void *extraout_ECX;
  void *extraout_ECX_00;
  void *extraout_ECX_01;
  void *extraout_ECX_02;
  int iVar3;
  uint local_c;
  uint local_8;
  
  bVar1 = false;
  for (iVar3 = 0; (param_1[2] == 0 && (iVar3 < param_4)); iVar3 = iVar3 + iVar2 + local_c) {
    iVar2 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    if ((local_8 & 0x80) == 0) {
      if ((local_8 == 0) || (local_8 == 0x2000)) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
      else {
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_00509167);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_02;
      }
    }
    else if (bVar1) {
      FUN_0049a300(1,s_dpl_bgfRead_vertices_already_def_0050912e);
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_00;
    }
    else {
      FUN_0049348c(param_1,param_2,param_3,local_8,local_c);
      bVar1 = true;
      this = extraout_ECX;
    }
  }
  return 1;
}



/* @00493a90 file=? name=FUN_00493a90 */

undefined4 __thiscall
FUN_00493a90(void *this,undefined4 *param_1,int param_2,int param_3,int param_4)

{
  bool bVar1;
  int iVar2;
  undefined4 uVar3;
  void *extraout_ECX;
  void *extraout_ECX_00;
  void *extraout_ECX_01;
  void *extraout_ECX_02;
  void *extraout_ECX_03;
  void *extraout_ECX_04;
  void *extraout_ECX_05;
  int iVar4;
  uint local_c;
  uint local_8;
  
  bVar1 = false;
  for (iVar4 = 0; (param_1[2] == 0 && (iVar4 < param_4)); iVar4 = iVar4 + iVar2 + local_c) {
    iVar2 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    if ((local_8 & 0x80) == 0) {
      if (local_8 == 0x47) {
        FUN_00493720(param_1,param_2,3,local_c);
        this = extraout_ECX_01;
      }
      else if (local_8 == 0x4d) {
        uVar3 = FUN_00492c84(param_1);
        FUN_00493720(param_1,param_2,(int)(char)uVar3,local_c - 1);
        this = extraout_ECX_02;
      }
      else if (local_8 == 0x4e) {
        uVar3 = FUN_00492c84(param_1);
        FUN_00493854(param_1,param_2,(int)(char)uVar3,local_c - 1);
        this = extraout_ECX_03;
      }
      else if ((local_8 == 0) || (local_8 == 0x2000)) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_04;
      }
      else {
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_005091dd);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_05;
      }
    }
    else if (bVar1) {
      FUN_0049a300(1,s_dpl_bgfRead_vertices_already_def_005091a4);
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_00;
    }
    else {
      FUN_0049348c(param_1,param_2,param_3,local_8,local_c);
      bVar1 = true;
      this = extraout_ECX;
    }
  }
  return 1;
}



/* @00493bd4 file=? name=FUN_00493bd4 */

undefined4 __thiscall
FUN_00493bd4(void *this,undefined4 *param_1,int param_2,int param_3,int param_4)

{
  bool bVar1;
  int iVar2;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  int iVar3;
  uint local_c;
  uint local_8;
  
  bVar1 = false;
  for (iVar3 = 0; (param_1[2] == 0 && (iVar3 < param_4)); iVar3 = iVar3 + iVar2 + local_c) {
    iVar2 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    if ((local_8 & 0x80) == 0) {
      if (local_8 == 0x2042) {
        this = param_1;
        FUN_00492c84(param_1);
      }
      else if ((local_8 == 0) || (local_8 == 0x2000)) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
      else {
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_00509254);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_02;
      }
    }
    else if (bVar1) {
      FUN_0049a300(1,s_dpl_bgfRead_vertices_already_def_0050921b);
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_00;
    }
    else {
      FUN_0049348c(param_1,param_2,param_3,local_8,local_c);
      bVar1 = true;
      this = extraout_ECX;
    }
  }
  return 1;
}



/* @00493cbc file=? name=FUN_00493cbc */

undefined4 __thiscall
FUN_00493cbc(void *this,undefined4 *param_1,int param_2,int param_3,int param_4)

{
  bool bVar1;
  int iVar2;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  int iVar3;
  uint local_c;
  uint local_8;
  
  bVar1 = false;
  for (iVar3 = 0; (param_1[2] == 0 && (iVar3 < param_4)); iVar3 = iVar3 + iVar2 + local_c) {
    iVar2 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    if ((local_8 & 0x80) == 0) {
      if (local_8 == 0x2049) {
        this = param_1;
        FUN_00492d10(param_1);
      }
      else if ((local_8 == 0) || (local_8 == 0x2000)) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
      else {
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_005092cf);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_02;
      }
    }
    else if (bVar1) {
      FUN_0049a300(1,s_dpl_bgfRead_vertices_already_def_00509296);
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_00;
    }
    else {
      FUN_0049348c(param_1,param_2,param_3,local_8,local_c);
      bVar1 = true;
      this = extraout_ECX;
    }
  }
  return 1;
}



/* @00493da8 file=? name=FUN_00493da8 */

undefined4 __thiscall
FUN_00493da8(void *this,undefined4 *param_1,int param_2,int param_3,int param_4)

{
  bool bVar1;
  int iVar2;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  int iVar3;
  uint local_c;
  uint local_8;
  
  bVar1 = false;
  for (iVar3 = 0; (param_1[2] == 0 && (iVar3 < param_4)); iVar3 = iVar3 + iVar2 + local_c) {
    iVar2 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    if (local_8 == 0x49) {
      if (bVar1) {
        FUN_0049a300(1,s_dpl_bgfRead_vertices_already_def_00509312);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_00;
      }
      else {
        FUN_0049348c(param_1,param_2,param_3,0x49,local_c);
        bVar1 = true;
        this = extraout_ECX;
      }
    }
    else {
      this = param_1;
      if (local_8 == 0x2041) {
        FUN_00492cb4(param_1);
      }
      else if (local_8 == 0x2040) {
        FUN_00492cb4(param_1);
      }
      else if ((local_8 == 0) || (local_8 == 0x2000)) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
      else {
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_0050934b);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_02;
      }
    }
  }
  FUN_0048cb44(param_2);
  return 1;
}



/* @00493ed0 file=? name=FUN_00493ed0 */

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

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

{
  int iVar1;
  float *pfVar2;
  int iVar3;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  undefined4 *extraout_ECX_05;
  undefined4 *this;
  float *pfVar4;
  int *piVar5;
  float local_34 [3];
  char local_28 [12];
  char local_1c [12];
  float local_10;
  uint local_c;
  uint local_8;
  
  pfVar2 = (float *)&DAT_00508eb0;
  pfVar4 = local_34;
  for (iVar3 = 9; iVar3 != 0; iVar3 = iVar3 + -1) {
    *pfVar4 = *pfVar2;
    pfVar2 = pfVar2 + 1;
    pfVar4 = pfVar4 + 1;
  }
  iVar3 = 0;
  piVar5 = (int *)0x0;
  this = (undefined4 *)0x0;
  do {
    if ((param_1[2] != 0) || (param_3 <= iVar3)) {
      if (piVar5 != (int *)0x0) {
        if ((float)param_1[10] != _DAT_004940c4) {
          local_10 = (float)param_1[10];
          iVar3 = 0;
          pfVar2 = local_34;
          do {
            *pfVar2 = local_10 * *pfVar2;
            iVar3 = iVar3 + 1;
            pfVar2 = pfVar2 + 1;
          } while (iVar3 < 6);
        }
        FUN_0048c910(param_2,1);
        FUN_0048cae0(param_2,3);
        FUN_0048cc48(param_2,(byte *)local_34,0,3);
        FUN_0048c9c8(param_2,(char *)piVar5);
        FUN_004de420(piVar5);
      }
      return 1;
    }
    iVar1 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      if (piVar5 != (int *)0x0) {
        FUN_004de420(piVar5);
      }
      return 0;
    }
    if ((int)local_8 < 0x2044) {
      if (local_8 == 0x2043) {
        this = param_1;
        FUN_00492c84(param_1);
      }
      else {
        if (local_8 != 0) {
          if (local_8 == 0x4c) {
            if (piVar5 == (int *)0x0) {
              FUN_00492df0(param_1,(char *)local_34,3);
              piVar5 = FUN_004de55c(local_c - 0xb);
              if (piVar5 == (int *)0x0) {
                FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_m_0050938f);
                FUN_00492ba0(param_1,local_c - 0xc);
                this = extraout_ECX_01;
              }
              else {
                FUN_00492f10(param_1,(char *)piVar5,local_c - 0xc);
                this = extraout_ECX_02;
              }
            }
            else {
              FUN_0049a300(1,s_dpl_bgfRead_already_defined_stri_005093cb);
              FUN_00492ba0(param_1,local_c);
              this = extraout_ECX_03;
            }
            goto LAB_00494035;
          }
          if (local_8 != 0x2000) goto LAB_00494015;
        }
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_04;
      }
    }
    else if (local_8 == 0x2044) {
      FUN_00492df0(param_1,local_28,3);
      this = extraout_ECX;
    }
    else if (local_8 == 0x2045) {
      FUN_00492df0(param_1,local_1c,3);
      this = extraout_ECX_00;
    }
    else {
LAB_00494015:
      FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_005093f9);
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_05;
    }
LAB_00494035:
    iVar3 = iVar3 + iVar1 + local_c;
  } while( true );
}



/* @004940c8 file=? name=FUN_004940c8 */

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

{
  undefined4 *puVar1;
  undefined4 uVar2;
  void *this;
  
  puVar1 = (undefined4 *)FUN_00489818();
  if (puVar1 == (undefined4 *)0x0) {
    FUN_0049a300(1,s_dpl_bgfRead_failed_to_create_dpl_00509436);
    FUN_00492ba0(param_1,param_4);
    uVar2 = 0;
  }
  else {
    FUN_0048c8ac((int)puVar1,param_5);
    switch(param_5) {
    case 2:
    case 3:
    case 4:
      FUN_004939b8(this,param_1,(int)puVar1,param_3,param_4);
      break;
    case 5:
      FUN_00493a90(this,param_1,(int)puVar1,param_3,param_4);
      break;
    case 6:
      FUN_00493ed0(param_1,(int)puVar1,param_4);
      break;
    case 8:
      FUN_00493bd4(this,param_1,(int)puVar1,param_3,param_4);
      break;
    case 9:
      FUN_00493cbc(this,param_1,(int)puVar1,param_3,param_4);
      break;
    case 10:
      FUN_00493da8(this,param_1,(int)puVar1,param_3,param_4);
    }
    FUN_0048d728(puVar1);
    FUN_00489ca4(param_2,(int)puVar1);
    if (param_1[2] == 0) {
      uVar2 = 1;
    }
    else {
      uVar2 = 0;
    }
  }
  return uVar2;
}



/* @004941e4 file=? name=FUN_004941e4 */

undefined4 __cdecl FUN_004941e4(undefined4 *param_1,int param_2,undefined4 *param_3,uint param_4)

{
  char cVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  code *pcVar4;
  int iVar5;
  int iVar6;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  undefined4 *extraout_ECX_05;
  undefined4 *extraout_ECX_06;
  undefined4 *extraout_ECX_07;
  undefined4 *extraout_ECX_08;
  undefined4 *extraout_ECX_09;
  undefined4 *puVar7;
  undefined4 *extraout_ECX_10;
  undefined4 local_2c [2];
  undefined1 local_24;
  byte local_23;
  undefined1 local_22;
  undefined1 local_21;
  undefined1 local_20;
  char local_1f;
  int local_1c;
  int *local_18;
  int local_14;
  uint local_10;
  uint local_c;
  uint local_8;
  
  puVar2 = local_2c;
  for (iVar6 = 5; iVar6 != 0; iVar6 = iVar6 + -1) {
    *puVar2 = *param_3;
    param_3 = param_3 + 1;
    puVar2 = puVar2 + 1;
  }
  iVar6 = 0;
  local_18 = (int *)0x0;
  if (DAT_00508ea0 != (char *)0x0) {
    *DAT_00508ea0 = '\0';
  }
  puVar2 = (undefined4 *)FUN_00489800();
  if (puVar2 == (undefined4 *)0x0) {
    FUN_0049a300(1,s_dpl_bgfRead_failed_to_create_dpl_00509461);
    FUN_00492ba0(param_1,param_4);
    uVar3 = 0;
  }
  else {
    pcVar4 = (code *)FUN_00496614();
    puVar7 = extraout_ECX;
    if (pcVar4 != (code *)0x0) {
      (*pcVar4)(9,puVar2);
      puVar7 = extraout_ECX_00;
    }
    for (; (param_1[2] == 0 && (iVar6 < (int)param_4)); iVar6 = iVar6 + iVar5 + local_c) {
      iVar5 = FUN_004931fc(puVar7,param_1,&local_8,&local_c);
      if (param_1[2] != 0) break;
      local_14 = 0;
      if ((int)local_8 < 0x2009) {
        if (local_8 == 0x2008) {
          FUN_00492fc4(param_1,(int *)&DAT_00508ea0,(uint *)&DAT_00508ea4,local_c);
          puVar7 = extraout_ECX_02;
        }
        else {
          puVar7 = extraout_ECX_01;
          if ((int)local_8 < 0x49) {
            if (local_8 == 0x48) {
              local_14 = 10;
            }
            else if ((int)local_8 < 0x45) {
              if (local_8 == 0x44) {
                local_14 = 2;
              }
              else if (local_8 == 0) {
LAB_0049453e:
                FUN_00492ba0(param_1,local_c);
                puVar7 = extraout_ECX_08;
              }
              else {
                if (local_8 != 0x43) goto switchD_00494307_caseD_2038;
                local_14 = 4;
              }
            }
            else if (local_8 == 0x45) {
              local_14 = 3;
            }
            else if (local_8 == 0x46) {
              local_14 = 5;
            }
            else {
switchD_00494307_caseD_2038:
              FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_005094cf);
              FUN_00492ba0(param_1,local_c);
              puVar7 = extraout_ECX_09;
            }
          }
          else if (local_8 == 0x4a) {
            local_14 = 8;
          }
          else if (local_8 == 0x4b) {
            local_14 = 6;
          }
          else {
            if (local_8 != 0x50) {
              if (local_8 == 0x2000) goto LAB_0049453e;
              goto switchD_00494307_caseD_2038;
            }
            local_14 = 9;
          }
        }
      }
      else {
        puVar7 = param_1;
        switch(local_8) {
        case 0x2030:
          uVar3 = FUN_00492c84(param_1);
          cVar1 = (char)uVar3;
          if ((cVar1 < '\x01') || ('\x02' < cVar1)) {
            local_2c[0] = 0;
          }
          else if (cVar1 == '\x01') {
            FUN_00492fc4(param_1,(int *)&DAT_00508e8c,(uint *)&DAT_00508e98,local_c - 1);
            local_2c[0] = FUN_00497678(DAT_00508e8c,0,(int *)0x0);
            puVar7 = extraout_ECX_03;
          }
          else {
            local_2c[0] = FUN_00497678(s_DEFAULT_0050948c,0,(int *)0x0);
            puVar7 = extraout_ECX_04;
          }
          break;
        case 0x2031:
          uVar3 = FUN_00492c84(param_1);
          cVar1 = (char)uVar3;
          if ((cVar1 < '\x01') || ('\x03' < cVar1)) {
            local_2c[1] = 0;
          }
          else if (cVar1 == '\x01') {
            FUN_00492fc4(param_1,(int *)&DAT_00508e90,(uint *)&DAT_00508e9c,local_c - 1);
            local_2c[1] = FUN_00497678(DAT_00508e90,0,(int *)0x0);
            puVar7 = extraout_ECX_05;
          }
          else if (cVar1 == '\x02') {
            local_2c[1] = FUN_00497678(s_DEFAULT_00509494,0,(int *)0x0);
            puVar7 = extraout_ECX_06;
          }
          else {
            local_2c[1] = local_2c[0];
          }
          break;
        case 0x2032:
          uVar3 = FUN_00492c84(param_1);
          local_24 = (undefined1)uVar3;
          break;
        case 0x2033:
          uVar3 = FUN_00492c84(param_1);
          local_23 = (byte)uVar3;
          if (local_23 == 0) {
            FUN_00492c84(param_1);
          }
          else {
            uVar3 = FUN_00492c84(param_1);
            local_22 = (undefined1)uVar3;
          }
          break;
        case 0x2034:
          local_1c = FUN_00492d84(param_1);
          break;
        case 0x2035:
          uVar3 = FUN_00492c84(param_1);
          local_21 = (undefined1)uVar3;
          break;
        case 0x2036:
          uVar3 = FUN_00492c84(param_1);
          local_20 = (undefined1)uVar3;
          break;
        case 0x2037:
          local_18 = FUN_004de55c(local_c);
          if (local_18 == (int *)0x0) {
            FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_m_0050949c);
            FUN_00492ba0(param_1,local_c);
            return 0;
          }
          FUN_00492f10(param_1,(char *)local_18,local_c);
          local_10 = local_c;
          puVar7 = extraout_ECX_07;
          break;
        default:
          goto switchD_00494307_caseD_2038;
        case 0x2039:
          uVar3 = FUN_00492c84(param_1);
          local_1f = (char)uVar3;
        }
      }
      if (local_14 != 0) {
        FUN_004940c8(param_1,(int)puVar2,(int)local_2c,local_c,local_14);
        puVar7 = extraout_ECX_10;
      }
    }
    FUN_0048c654((int)puVar2,local_2c[0]);
    FUN_0048c688((int)puVar2,local_2c[1]);
    if (local_1f == '\x01') {
      FUN_0048c71c((int)puVar2);
    }
    else {
      FUN_0048c750((int)puVar2);
    }
    if (local_1c != 0) {
      FUN_0048c7b4((int)puVar2,local_1c);
    }
    if ((local_23 & 1) != 0) {
      FUN_0048c820((int)puVar2,1);
    }
    FUN_0048d6c4(puVar2);
    FUN_00489c5c(param_2,(int)puVar2);
    if ((DAT_00508ea0 != (char *)0x0) && (*DAT_00508ea0 != '\0')) {
      FUN_00497c7c(1,DAT_00508ea0,local_18,local_10,param_2,(int)puVar2);
    }
    if (local_18 != (int *)0x0) {
      pcVar4 = (code *)FUN_00496644();
      if (pcVar4 != (code *)0x0) {
        (*pcVar4)(9,puVar2,local_18,local_10);
      }
      FUN_004de420(local_18);
    }
    if (param_1[2] == 0) {
      uVar3 = 1;
    }
    else {
      uVar3 = 0;
    }
  }
  return uVar3;
}



/* @00494668 file=? name=FUN_00494668 */

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

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

{
  undefined4 *puVar1;
  undefined4 uVar2;
  code *pcVar3;
  int iVar4;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  undefined4 *extraout_ECX_05;
  undefined4 *extraout_ECX_06;
  undefined4 *extraout_ECX_07;
  undefined4 *this;
  int iVar5;
  float local_30;
  float local_2c;
  float local_28;
  int *local_24;
  undefined4 *local_20;
  float local_1c;
  float local_18;
  char local_11;
  uint local_10;
  uint local_c;
  uint local_8;
  
  iVar5 = 0;
  local_11 = '\0';
  local_20 = (undefined4 *)param_1[0xc];
  local_24 = (int *)0x0;
  if (DAT_00508ea8 != (char *)0x0) {
    *DAT_00508ea8 = '\0';
  }
  puVar1 = (undefined4 *)FUN_004897e8();
  if (puVar1 == (undefined4 *)0x0) {
    FUN_0049a300(1,s_dpl_bgfRead_failed_to_create_dpl_00509504);
    FUN_00492ba0(param_1,param_5);
    uVar2 = 0;
  }
  else {
    pcVar3 = (code *)FUN_00496614();
    if (pcVar3 != (code *)0x0) {
      (*pcVar3)(8,puVar1);
    }
    FUN_004d4918(&local_30,local_20,0xc);
    this = extraout_ECX;
    for (; (param_1[2] == 0 && (iVar5 < (int)param_5)); iVar5 = iVar5 + iVar4 + local_c) {
      iVar4 = FUN_004931fc(this,param_1,&local_8,&local_c);
      if (param_1[2] != 0) break;
      if ((int)local_8 < 0x2038) {
        if (local_8 == 0x2037) {
          local_24 = FUN_004de55c(local_c);
          if (local_24 == (int *)0x0) {
            FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_m_0050952a);
            FUN_00492ba0(param_1,local_c);
            return 0;
          }
          FUN_00492f10(param_1,(char *)local_24,local_c);
          local_10 = local_c;
          pcVar3 = (code *)FUN_00496644();
          this = extraout_ECX_03;
          if (pcVar3 != (code *)0x0) {
            (*pcVar3)(8,puVar1,local_24,local_c);
            this = extraout_ECX_04;
          }
        }
        else if (local_8 == 0) {
LAB_0049481d:
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_06;
        }
        else if (local_8 == 0x42) {
          FUN_004941e4(param_1,(int)puVar1,param_3,local_c);
          this = extraout_ECX_05;
        }
        else {
          if (local_8 == 0x2000) goto LAB_0049481d;
          if (local_8 != 0x2008) goto LAB_0049482c;
          FUN_00492fc4(param_1,(int *)&DAT_00508ea8,(uint *)&DAT_00508eac,local_c);
          this = extraout_ECX_00;
        }
      }
      else if (local_8 == 0x2046) {
        FUN_00492df0(param_1,(char *)&local_1c,2);
        local_11 = '\x01';
        this = extraout_ECX_01;
      }
      else if (local_8 == 0x2047) {
        FUN_00492df0(param_1,(char *)&local_30,3);
        this = extraout_ECX_02;
      }
      else if (local_8 == 0x2048) {
        this = param_1;
        FUN_00492c84(param_1);
      }
      else {
LAB_0049482c:
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_0050955d);
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_07;
      }
    }
    if (local_11 != '\0') {
      if ((float)param_1[10] != _DAT_00494980) {
        local_1c = (float)param_1[10] * local_1c;
        local_18 = (float)param_1[10] * local_18;
      }
      if (local_1c < _DAT_00494984) {
        local_1c = DAT_005209d0;
      }
      if (local_18 < _DAT_00494984) {
        local_18 = DAT_005209d0;
      }
      FUN_0048af60(param_2,*param_4,local_1c);
      FUN_0048af60(param_2,*param_4 + 1,local_18);
    }
    if ((float)param_1[10] != _DAT_00494980) {
      local_30 = (float)param_1[10] * local_30;
      local_2c = (float)param_1[10] * local_2c;
      local_28 = (float)param_1[10] * local_28;
    }
    FUN_0048afe8(param_2,local_30,local_2c,local_28);
    FUN_00489c00(param_2,(int)puVar1);
    FUN_0048d68c(puVar1);
    *param_4 = *param_4 + 1;
    if ((DAT_00508ea8 != (char *)0x0) && (*DAT_00508ea8 != '\0')) {
      FUN_00497c7c(0,DAT_00508ea8,local_24,local_10,param_2,(int)puVar1);
    }
    if (local_24 != (int *)0x0) {
      FUN_004de420(local_24);
    }
    if (param_1[2] == 0) {
      uVar2 = 1;
    }
    else {
      uVar2 = 0;
    }
  }
  return uVar2;
}



/* @00494988 file=? name=FUN_00494988 */

undefined4 * __cdecl FUN_00494988(undefined4 *param_1,uint param_2)

{
  char cVar1;
  undefined4 *puVar2;
  code *pcVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  undefined4 *extraout_ECX_05;
  undefined4 *extraout_ECX_06;
  undefined4 *extraout_ECX_07;
  undefined4 *extraout_ECX_08;
  undefined4 *extraout_ECX_09;
  undefined4 *extraout_ECX_10;
  undefined4 *extraout_ECX_11;
  undefined4 *extraout_ECX_12;
  undefined4 *extraout_ECX_13;
  undefined4 *extraout_ECX_14;
  undefined4 *puVar7;
  undefined4 local_34 [2];
  undefined1 local_2c;
  char local_2b;
  undefined1 local_2a;
  undefined1 local_29;
  undefined1 local_28;
  undefined1 local_27;
  undefined4 local_24;
  float *local_20;
  int *local_1c;
  int local_18;
  undefined4 *local_14;
  uint local_10;
  uint local_c;
  uint local_8;
  
  local_14 = (undefined4 *)0x0;
  local_18 = 0;
  puVar2 = &DAT_00508ed4;
  puVar7 = local_34;
  for (iVar6 = 5; iVar6 != 0; iVar6 = iVar6 + -1) {
    *puVar7 = *puVar2;
    puVar2 = puVar2 + 1;
    puVar7 = puVar7 + 1;
  }
  iVar6 = 0;
  local_1c = (int *)0x0;
  if (DAT_00508e88 != (char *)0x0) {
    *DAT_00508e88 = '\0';
  }
  puVar2 = (undefined4 *)FUN_004897d0();
  if (puVar2 == (undefined4 *)0x0) {
    FUN_0049a300(1,s_dpl_bgfRead_failed_to_create_dpl_00509590);
    FUN_00492ba0(param_1,param_2);
    puVar2 = (undefined4 *)0x0;
  }
  else {
    pcVar3 = (code *)FUN_00496614();
    puVar7 = extraout_ECX;
    if (pcVar3 != (code *)0x0) {
      (*pcVar3)(7,puVar2);
      puVar7 = extraout_ECX_00;
    }
    for (; (param_1[2] == 0 && (iVar6 < (int)param_2)); iVar6 = iVar6 + iVar4 + local_c) {
      iVar4 = FUN_004931fc(puVar7,param_1,&local_8,&local_c);
      if (param_1[2] != 0) break;
      puVar7 = param_1;
      if ((int)local_8 < 0x2033) {
        if (local_8 == 0x2032) {
          uVar5 = FUN_00492c84(param_1);
          local_2c = (undefined1)uVar5;
        }
        else if ((int)local_8 < 0x2001) {
          if ((local_8 == 0x2000) || (local_8 == 0)) {
            FUN_00492ba0(param_1,local_c);
            puVar7 = extraout_ECX_13;
          }
          else if (local_8 == 0x41) {
            FUN_00494668(param_1,(int)puVar2,local_34,&local_18,local_c);
            puVar7 = extraout_ECX_12;
          }
          else {
            if (local_8 != 0x42) goto switchD_00494a88_caseD_2038;
            puVar7 = extraout_ECX_01;
            if (local_14 == (undefined4 *)0x0) {
              local_14 = (undefined4 *)FUN_004897e8();
              if (local_14 == (undefined4 *)0x0) {
                FUN_0049a300(1,s_dpl_bgfRead_failed_to_create_dpl_005095fc);
                FUN_00492ba0(param_1,local_c);
                puVar7 = extraout_ECX_09;
              }
              else {
                local_20 = (float *)param_1[0xc];
                pcVar3 = (code *)FUN_00496614();
                if (pcVar3 != (code *)0x0) {
                  (*pcVar3)(8,local_14);
                }
                FUN_00489c00((int)puVar2,(int)local_14);
                FUN_0048b0fc((int)puVar2);
                FUN_0048afe8((int)puVar2,*local_20 * (float)param_1[10],
                             local_20[1] * (float)param_1[10],local_20[2] * (float)param_1[10]);
                local_18 = local_18 + 1;
                puVar7 = extraout_ECX_10;
              }
            }
            if (local_14 != (undefined4 *)0x0) {
              FUN_004941e4(param_1,(int)local_14,local_34,local_c);
              puVar7 = extraout_ECX_11;
            }
          }
        }
        else if (local_8 == 0x2008) {
          FUN_00492fc4(param_1,(int *)&DAT_00508e88,(uint *)&DAT_00508e94,local_c);
          puVar7 = extraout_ECX_02;
        }
        else if (local_8 == 0x2030) {
          uVar5 = FUN_00492c84(param_1);
          cVar1 = (char)uVar5;
          if ((cVar1 < '\x01') || ('\x02' < cVar1)) {
            local_34[0] = 0;
          }
          else if (cVar1 == '\x01') {
            FUN_00492fc4(param_1,(int *)&DAT_00508e8c,(uint *)&DAT_00508e98,local_c - 1);
            local_34[0] = FUN_00497678(DAT_00508e8c,0,(int *)0x0);
            puVar7 = extraout_ECX_03;
          }
          else {
            local_34[0] = FUN_00497678(s_DEFAULT_005095b9,0,(int *)0x0);
            puVar7 = extraout_ECX_04;
          }
        }
        else {
          if (local_8 != 0x2031) goto switchD_00494a88_caseD_2038;
          uVar5 = FUN_00492c84(param_1);
          cVar1 = (char)uVar5;
          if ((cVar1 < '\x01') || ('\x03' < cVar1)) {
            local_34[1] = 0;
          }
          else if (cVar1 == '\x01') {
            FUN_00492fc4(param_1,(int *)&DAT_00508e90,(uint *)&DAT_00508e9c,local_c - 1);
            local_34[1] = FUN_00497678(DAT_00508e90,0,(int *)0x0);
            puVar7 = extraout_ECX_05;
          }
          else if (cVar1 == '\x02') {
            local_34[1] = FUN_00497678(s_DEFAULT_005095c1,0,(int *)0x0);
            puVar7 = extraout_ECX_06;
          }
          else {
            local_34[1] = local_34[0];
          }
        }
      }
      else {
        switch(local_8) {
        case 0x2033:
          uVar5 = FUN_00492c84(param_1);
          local_2b = (char)uVar5;
          if (local_2b == '\0') {
            FUN_00492c84(param_1);
          }
          else {
            uVar5 = FUN_00492c84(param_1);
            local_2a = (undefined1)uVar5;
          }
          break;
        case 0x2034:
          local_24 = FUN_00492d84(param_1);
          break;
        case 0x2035:
          uVar5 = FUN_00492c84(param_1);
          local_29 = (undefined1)uVar5;
          break;
        case 0x2036:
          uVar5 = FUN_00492c84(param_1);
          local_28 = (undefined1)uVar5;
          break;
        case 0x2037:
          local_1c = FUN_004de55c(local_c);
          if (local_1c == (int *)0x0) {
            FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_m_005095c9);
            FUN_00492ba0(param_1,local_c);
            return (undefined4 *)0x0;
          }
          FUN_00492f10(param_1,(char *)local_1c,local_c);
          local_10 = local_c;
          pcVar3 = (code *)FUN_00496644();
          puVar7 = extraout_ECX_07;
          if (pcVar3 != (code *)0x0) {
            (*pcVar3)(7,puVar2,local_1c,local_c);
            puVar7 = extraout_ECX_08;
          }
          break;
        default:
switchD_00494a88_caseD_2038:
          FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_00509622);
          FUN_00492ba0(param_1,local_c);
          puVar7 = extraout_ECX_14;
          break;
        case 0x2039:
          uVar5 = FUN_00492c84(param_1);
          local_27 = (undefined1)uVar5;
        }
      }
    }
    if ((DAT_00508e88 != (char *)0x0) && (*DAT_00508e88 != '\0')) {
      FUN_00497bf8(DAT_00508e88);
    }
    if (local_1c != (int *)0x0) {
      FUN_00497c30(local_1c,local_10);
      FUN_004de420(local_1c);
    }
    if (local_14 != (undefined4 *)0x0) {
      FUN_0048d68c(local_14);
    }
    FUN_0048b078((int)puVar2,0);
    FUN_0048d668(puVar2);
  }
  return puVar2;
}



/* @00494e00 file=? name=FUN_00494e00 */

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

bool __thiscall FUN_00494e00(void *this,undefined4 *param_1,int param_2)

{
  int iVar1;
  void *extraout_ECX;
  void *extraout_ECX_00;
  void *extraout_ECX_01;
  void *extraout_ECX_02;
  void *extraout_ECX_03;
  void *extraout_ECX_04;
  int iVar2;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  float *local_10;
  uint local_c;
  uint local_8;
  
  iVar2 = 0;
  local_10 = (float *)param_1[0xc];
  do {
    if ((param_1[2] != 0) || (param_2 <= iVar2)) {
      return param_1[2] == 0;
    }
    iVar1 = FUN_004931fc(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return false;
    }
    if ((int)local_8 < 0x2071) {
      if (local_8 == 0x2070) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
      else if (local_8 == 0x71) {
        FUN_00492df0(param_1,(char *)&local_34,9);
        *local_10 = (local_34 + local_28) * _DAT_00494f30;
        local_10[1] = (local_30 + local_24) * _DAT_00494f30;
        local_10[2] = (local_2c + local_20) * _DAT_00494f30;
        this = extraout_ECX;
      }
      else {
        if (local_8 != 0x72) goto LAB_00494ee6;
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_00;
      }
    }
    else if (local_8 == 0x2071) {
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_02;
    }
    else if (local_8 == 0x2072) {
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_03;
    }
    else {
LAB_00494ee6:
      FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_00509658);
      FUN_00492ba0(param_1,local_c);
      this = extraout_ECX_04;
    }
    iVar2 = iVar2 + iVar1 + local_c;
  } while( true );
}



/* @00494f34 file=? name=FUN_00494f34 */

undefined4 * __thiscall FUN_00494f34(void *this,undefined4 *param_1)

{
  bool bVar1;
  void *this_00;
  void *this_01;
  void *extraout_ECX;
  void *extraout_ECX_00;
  void *extraout_ECX_01;
  void *extraout_ECX_02;
  void *extraout_ECX_03;
  void *extraout_ECX_04;
  void *this_02;
  undefined4 *puVar2;
  uint local_c;
  uint local_8;
  
  bVar1 = true;
  puVar2 = (undefined4 *)0x0;
  param_1[2] = 0;
  param_1[10] = 0x3f800000;
  *(undefined1 *)(param_1 + 0xb) = 0;
  FUN_004931fc(this,param_1,&local_8,&local_c);
  if (param_1[2] == 0) {
    this_02 = this_00;
    if (local_8 == 3) {
      FUN_004932a4(this_00,param_1,local_c);
      FUN_004931fc(this_01,param_1,&local_8,&local_c);
      this_02 = extraout_ECX;
    }
    while ((param_1[2] == 0 && (bVar1))) {
      if ((int)local_8 < 0x41) {
        if (local_8 == 0x40) {
          puVar2 = FUN_00494988(param_1,local_c);
          this_02 = extraout_ECX_00;
        }
        else if (local_8 == 0) {
LAB_00494fe6:
          FUN_00492ba0(param_1,local_c);
          this_02 = extraout_ECX_02;
        }
        else {
          if (local_8 != 5) goto LAB_00494ff9;
          bVar1 = false;
        }
      }
      else if (local_8 == 0x70) {
        FUN_00494e00(this_02,param_1,local_c);
        this_02 = extraout_ECX_01;
      }
      else {
        if (local_8 == 0x2000) goto LAB_00494fe6;
LAB_00494ff9:
        FUN_0049a300(1,s_dpl_bgfRead_got_unrecognized_blo_00509690);
        FUN_00492ba0(param_1,local_c);
        this_02 = extraout_ECX_03;
      }
      if (bVar1) {
        FUN_004931fc(this_02,param_1,&local_8,&local_c);
        this_02 = extraout_ECX_04;
      }
    }
  }
  else {
    puVar2 = (undefined4 *)0x0;
  }
  return puVar2;
}



/* @00495048 file=? name=FUN_00495048 */

undefined4 * __cdecl FUN_00495048(LPCSTR param_1)

{
  char *pcVar1;
  undefined4 *puVar2;
  int *piVar3;
  char *pcVar4;
  int *piVar5;
  void *this;
  char *pcVar6;
  bool bVar7;
  char local_10 [8];
  undefined1 local_8;
  
  if (param_1 == (LPCSTR)0x0) {
    FUN_0049a300(1,s_dpl_bgfRead_got_no_file_to_open__005096cc);
    puVar2 = (undefined4 *)0x0;
  }
  else {
    if ((DAT_00508e84 == (int *)0x0) &&
       (DAT_00508e84 = FUN_004de55c(0x4000), DAT_00508e84 == (int *)0x0)) {
      FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_r_005096ed);
      return (undefined4 *)0x0;
    }
    piVar3 = FUN_004930c0(param_1,0x4000,DAT_00508e84,1);
    if (piVar3 == (int *)0x0) {
      FUN_0049a300(1,s_dpl_bgfRead_failed_to_open_file___00509718);
      puVar2 = (undefined4 *)0x0;
    }
    else {
      FUN_00492f10(piVar3,local_10,8);
      local_8 = 0;
      pcVar4 = local_10;
      pcVar6 = &DAT_0050973e;
      do {
        bVar7 = *pcVar4 == *pcVar6;
        if (!bVar7) break;
        if (*pcVar4 == '\0') goto LAB_0049512a;
        pcVar1 = pcVar4 + 1;
        bVar7 = *pcVar1 == pcVar6[1];
        if (!bVar7) break;
        pcVar4 = pcVar4 + 2;
        pcVar6 = pcVar6 + 2;
        bVar7 = *pcVar1 == '\0';
      } while (!bVar7);
      if (bVar7) {
LAB_0049512a:
        piVar5 = FUN_004de2bc(1,0xc);
        piVar3[0xc] = (int)piVar5;
        if (piVar5 == (int *)0x0) {
          FUN_0049a300(1,s_dpl_bgfRead_failed_to_allocate_m_00509771);
          FUN_00493188(piVar3);
          puVar2 = (undefined4 *)0x0;
        }
        else {
          puVar2 = FUN_00494f34(this,piVar3);
          FUN_004de420((int *)piVar3[0xc]);
          FUN_00493188(piVar3);
        }
      }
      else {
        FUN_0049a300(1,s_dpl_bgfRead___s__is_not_a_valid_b_00509747);
        FUN_00493188(piVar3);
        puVar2 = (undefined4 *)0x0;
      }
    }
  }
  return puVar2;
}



/* @0049517c file=? name=FUN_0049517c */

void FUN_0049517c(void)

{
  if (DAT_00508e84 != (int *)0x0) {
    FUN_004de420(DAT_00508e84);
    DAT_00508e84 = (int *)0x0;
  }
  FUN_0049309c(&DAT_00508e88,(undefined4 *)&DAT_00508e94);
  FUN_0049309c(&DAT_00508e8c,(undefined4 *)&DAT_00508e98);
  FUN_0049309c(&DAT_00508e90,(undefined4 *)&DAT_00508e9c);
  FUN_0049309c(&DAT_00508ea0,(undefined4 *)&DAT_00508ea4);
  FUN_0049309c(&DAT_00508ea8,(undefined4 *)&DAT_00508eac);
  return;
}



/* @004951f4 file=? name=FUN_004951f4 */

void * __thiscall FUN_004951f4(void *this,undefined4 *param_1,uint *param_2,uint *param_3)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  void *local_8;
  
  uVar3 = 0;
  uVar1 = FUN_00492cb4(param_1);
  uVar2 = (int)(uVar1 & 0xffff) >> 0xc & 0xc;
  if (uVar2 == 0) {
    uVar3 = FUN_00492c84(param_1);
    uVar3 = uVar3 & 0xff;
    local_8 = (void *)0x3;
  }
  else if (uVar2 == 4) {
    uVar3 = FUN_00492cb4(param_1);
    uVar3 = uVar3 & 0xffff;
    local_8 = (void *)0x4;
  }
  else if (uVar2 == 8) {
    uVar3 = FUN_00492d84(param_1);
    local_8 = (void *)0x6;
  }
  else {
    FUN_0049a300(1,s__dpl_bmfRead_got_unrecognised_bl_00509867 + 1);
    param_1[2] = 1;
    local_8 = this;
  }
  *param_2 = uVar1 & 0x3fff;
  *param_3 = uVar3;
  return local_8;
}



/* @0049529c file=? name=FUN_0049529c */

undefined4 __thiscall FUN_0049529c(void *this,undefined4 *param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  undefined4 *extraout_ECX_05;
  undefined4 *extraout_ECX_06;
  int iVar3;
  uint local_c;
  uint local_8;
  
  iVar3 = 0;
  do {
    if ((param_1[2] != 0) || (param_2 <= iVar3)) {
      return 1;
    }
    iVar1 = FUN_004951f4(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) {
      return 0;
    }
    if ((int)local_8 < 0x2006) {
      if (local_8 == 0x2005) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_02;
      }
      else if ((int)local_8 < 0x2003) {
        if (local_8 == 0x2002) {
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX;
        }
        else if ((local_8 == 0) || (local_8 == 0x2000)) {
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_05;
        }
        else {
LAB_00495403:
          FUN_0049a300(1,s_dpl_bmfRead_got_unrecognized_blo_005098f6);
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_06;
        }
      }
      else if (local_8 == 0x2003) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_00;
      }
      else {
        if (local_8 != 0x2004) goto LAB_00495403;
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_01;
      }
    }
    else {
      this = param_1;
      if (local_8 == 0x2006) {
        uVar2 = FUN_00492c84(param_1);
        *(char *)(param_1 + 0xb) = (char)uVar2;
        if (*(char *)(param_1 + 0xb) != '\0') {
          FUN_0049a300(1,s_dpl_bmfRead_cannot_process_doubl_00509898);
          param_1[2] = 1;
          return 0;
        }
      }
      else if (local_8 == 0x2007) {
        uVar2 = FUN_00492c84(param_1);
        if ((char)uVar2 != '\x01') {
          FUN_0049a300(1,s_dpl_bmfRead___file_is_not_a_mate_005098cb);
          param_1[2] = 1;
          return 0;
        }
      }
      else if (local_8 == 0x2009) {
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_03;
      }
      else {
        if (local_8 != 0x2037) goto LAB_00495403;
        FUN_00492ba0(param_1,local_c);
        this = extraout_ECX_04;
      }
    }
    iVar3 = iVar3 + iVar1 + local_c;
  } while( true );
}



/* @00495440 file=? name=FUN_00495440 */

undefined4 __cdecl FUN_00495440(undefined4 *param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  int extraout_EAX;
  int extraout_EAX_00;
  int extraout_EAX_01;
  int extraout_EAX_02;
  int extraout_EAX_03;
  code *pcVar3;
  int iVar4;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  undefined4 *extraout_ECX_05;
  undefined4 *extraout_ECX_06;
  undefined4 *extraout_ECX_07;
  undefined4 *extraout_ECX_08;
  undefined4 *extraout_ECX_09;
  undefined4 *extraout_ECX_10;
  undefined4 *puVar5;
  int *piVar6;
  undefined4 *puVar7;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60 [4];
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  int local_2c;
  int local_28;
  int local_24;
  int local_20;
  int local_1c;
  uint local_18;
  int *local_14;
  char local_e;
  char local_d;
  uint local_c;
  uint local_8;
  
  local_d = '\0';
  local_e = '\0';
  local_38 = DAT_00509810;
  local_34 = DAT_00509814;
  local_30 = DAT_00509818;
  local_44 = DAT_0050981c;
  local_40 = DAT_00509820;
  local_3c = DAT_00509824;
  local_50 = DAT_00509828;
  local_4c = DAT_0050982c;
  local_48 = DAT_00509830;
  puVar5 = &DAT_00509834;
  puVar7 = local_60;
  for (iVar4 = 4; iVar4 != 0; iVar4 = iVar4 + -1) {
    *puVar7 = *puVar5;
    puVar5 = puVar5 + 1;
    puVar7 = puVar7 + 1;
  }
  iVar4 = 0;
  local_6c = DAT_00509844;
  local_68 = DAT_00509848;
  local_64 = DAT_0050984c;
  local_14 = (int *)0x0;
  if (DAT_005097e0 != (char *)0x0) {
    *DAT_005097e0 = '\0';
  }
  puVar5 = (undefined4 *)0x0;
  if (DAT_005097e8 != (char *)0x0) {
    *DAT_005097e8 = '\0';
  }
  for (; (param_1[2] == 0 && (iVar4 < param_2)); iVar4 = iVar4 + iVar1 + local_c) {
    iVar1 = FUN_004951f4(puVar5,param_1,&local_8,&local_c);
    if (param_1[2] != 0) break;
    puVar5 = param_1;
    if ((int)local_8 < 0x27) {
      if (local_8 == 0x26) {
        FUN_00492df0(param_1,(char *)&local_50,3);
        puVar5 = extraout_ECX_05;
      }
      else if ((int)local_8 < 0x24) {
        if (local_8 == 0x23) {
          FUN_00492df0(param_1,(char *)&local_38,3);
          puVar5 = extraout_ECX_02;
        }
        else if (local_8 == 0) {
LAB_004956f8:
          FUN_00492ba0(param_1,local_c);
          puVar5 = extraout_ECX_09;
        }
        else if (local_8 == 0x21) {
          uVar2 = FUN_00492c84(param_1);
          local_d = (char)uVar2;
          if (local_d == '\x02') {
            FUN_00492fc4(param_1,(int *)&DAT_005097e4,(uint *)&DAT_005097f4,local_c - 1);
            puVar5 = extraout_ECX_00;
          }
        }
        else {
          if (local_8 != 0x22) goto LAB_00495707;
          uVar2 = FUN_00492c84(param_1);
          local_e = (char)uVar2;
          if (local_e == '\x01') {
            FUN_00492fc4(param_1,(int *)&DAT_005097ec,(uint *)&DAT_005097fc,local_c - 1);
            puVar5 = extraout_ECX_01;
          }
        }
      }
      else if (local_8 == 0x24) {
        FUN_00492df0(param_1,(char *)&local_44,3);
        puVar5 = extraout_ECX_03;
      }
      else {
        if (local_8 != 0x25) goto LAB_00495707;
        FUN_00492df0(param_1,(char *)local_60,4);
        puVar5 = extraout_ECX_04;
      }
    }
    else if ((int)local_8 < 0x2009) {
      if (local_8 == 0x2008) {
        FUN_00492fc4(param_1,(int *)&DAT_005097e0,(uint *)&DAT_005097f0,local_c);
        puVar5 = extraout_ECX;
      }
      else if (local_8 == 0x27) {
        FUN_00492df0(param_1,(char *)&local_6c,3);
        puVar5 = extraout_ECX_06;
      }
      else {
        if (local_8 != 0x28) {
          if (local_8 == 0x2000) goto LAB_004956f8;
          goto LAB_00495707;
        }
        FUN_00492fc4(param_1,(int *)&DAT_005097e8,(uint *)&DAT_005097f8,local_c);
        puVar5 = extraout_ECX_07;
      }
    }
    else if (local_8 == 0x200a) {
      FUN_00492c84(param_1);
    }
    else if (local_8 == 0x2037) {
      local_14 = FUN_004de55c(local_c);
      if (local_14 == (int *)0x0) {
        FUN_0049a300(1,s_dpl_bmfRead_failed_to_allocate_m_0050992c);
        FUN_00492ba0(param_1,local_c);
        return 0;
      }
      FUN_00492f10(param_1,(char *)local_14,local_c);
      local_18 = local_c;
      puVar5 = extraout_ECX_08;
    }
    else {
LAB_00495707:
      FUN_0049a300(1,s_dpl_bmfRead_got_unrecognized_blo_0050995f);
      FUN_00492ba0(param_1,local_c);
      puVar5 = extraout_ECX_10;
    }
  }
  if ((DAT_005097e0 != (char *)0x0) && (*DAT_005097e0 != '\0')) {
    FUN_00497194(0,DAT_005097e0,2,(int *)param_1[0xc],&local_1c,FUN_004897a0,FUN_00489a28);
    if ((local_1c == 0) && (extraout_EAX != 0)) {
      local_20 = 0;
      puVar5 = *(undefined4 **)(extraout_EAX + 0x18);
      FUN_0048ba98((int)puVar5,local_38,local_34,local_30);
      FUN_0048bc10((int)puVar5,local_44,local_40,local_3c);
      FUN_0048bb54((int)puVar5,local_50,local_4c,local_48);
      FUN_0048bccc((int)puVar5,local_60[0],local_60[1],local_60[2],local_60[3]);
      FUN_0048bd94((int)puVar5,local_6c,local_68,local_64);
      if ((local_d != '\0') && (DAT_005097d4 != 0)) {
        iVar4 = 0;
        if (local_d == '\x01') {
          FUN_00497194(1,s_DEFAULT_00509997,0,(int *)param_1[0xc],(int *)0x0,FUN_00489768,
                       FUN_00489998);
          iVar4 = extraout_EAX_00;
          if (extraout_EAX_00 == 0) {
            FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_tex_0050999f);
          }
        }
        else if (((local_d == '\x02') && (DAT_005097e4 != (char *)0x0)) && (*DAT_005097e4 != '\0'))
        {
          FUN_00497194(1,DAT_005097e4,0,(int *)param_1[0xc],&local_24,FUN_00489768,FUN_00489998);
          iVar4 = extraout_EAX_01;
          if (extraout_EAX_01 == 0) {
            FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_tex_005099cf);
          }
          else if (local_24 == 0) {
            FUN_0049a300(1,s_texture___s__is_undefined__005099fa);
          }
        }
        if (iVar4 != 0) {
          local_20 = *(int *)(iVar4 + 0x18);
        }
      }
      if (local_20 != 0) {
        FUN_0048be50((int)puVar5,local_20);
      }
      if ((DAT_005097e8 != (char *)0x0) && (*DAT_005097e8 != '\0')) {
        piVar6 = FUN_00497194(2,DAT_005097e8,0,(int *)param_1[0xc],&local_28,FUN_0049763c,
                              FUN_00489a68);
        if (extraout_EAX_02 == 0) {
          FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_ram_00509a2d);
        }
        else {
          piVar6 = *(int **)(extraout_EAX_02 + 0x18);
          if (local_28 == 0) {
            FUN_0049a300(1,s_ramp___s__is_undefined__00509a15);
          }
        }
        FUN_0048bfb0((int)puVar5,(int)piVar6);
      }
      if (((local_e == '\x01') && (DAT_005097d4 != 0)) && (*DAT_005097ec != '\0')) {
        FUN_00497194(1,DAT_005097ec,0,(int *)param_1[0xc],&local_2c,FUN_00489768,FUN_00489998);
        if (extraout_EAX_03 == 0) {
          FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_env_00509a55);
        }
        else if (local_2c == 0) {
          FUN_0049a300(1,s_environment_texture___s__is_unde_00509a8c);
        }
        if (extraout_EAX_03 != 0) {
          FUN_0048bf00((int)puVar5,*(int *)(extraout_EAX_03 + 0x18));
        }
      }
      FUN_0048d4d4(puVar5);
      if ((local_14 != (int *)0x0) && (pcVar3 = (code *)FUN_00496644(), pcVar3 != (code *)0x0)) {
        (*pcVar3)(0xb,puVar5,local_14,local_18);
      }
    }
    else if (extraout_EAX == 0) {
      FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_mat_00509ab3);
    }
    else {
      FUN_0049a300(1,s_dpl_bmfRead___material___s__alre_00509adf);
    }
  }
  if (local_14 != (int *)0x0) {
    FUN_004de420(local_14);
  }
  return 1;
}



/* @00495a44 file=? name=FUN_00495a44 */

undefined4 __thiscall FUN_00495a44(void *this,undefined4 *param_1,int param_2)

{
  undefined4 *puVar1;
  int iVar2;
  undefined4 uVar3;
  int extraout_EAX;
  int extraout_EAX_00;
  code *pcVar4;
  undefined4 *extraout_ECX;
  undefined4 *extraout_ECX_00;
  undefined4 *extraout_ECX_01;
  undefined4 *extraout_ECX_02;
  undefined4 *extraout_ECX_03;
  undefined4 *extraout_ECX_04;
  int *piVar5;
  int iVar6;
  undefined4 unaff_EDI;
  int local_24;
  int local_20;
  uint local_1c;
  int *local_18;
  char local_13;
  char local_12;
  char local_11;
  char local_10;
  char local_f;
  char local_e;
  char local_d;
  uint local_c;
  uint local_8;
  
  iVar6 = 0;
  local_d = '\0';
  local_e = '\0';
  local_f = -1;
  local_10 = -1;
  local_11 = -1;
  local_12 = '\0';
  local_13 = -1;
  local_18 = (int *)0x0;
  if (DAT_005097e4 != (char *)0x0) {
    *DAT_005097e4 = '\0';
  }
  if (DAT_00509804 != (char *)0x0) {
    *DAT_00509804 = '\0';
  }
  for (; (param_1[2] == 0 && (iVar6 < param_2)); iVar6 = iVar6 + iVar2 + local_c) {
    iVar2 = FUN_004951f4(this,param_1,&local_8,&local_c);
    if (param_1[2] != 0) break;
    this = param_1;
    if ((int)local_8 < 0x17) {
      if (local_8 == 0x16) {
        uVar3 = FUN_00492c84(param_1);
        local_10 = (char)uVar3;
      }
      else {
        switch(local_8) {
        case 0:
switchD_00495ac8_caseD_0:
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_03;
          break;
        default:
switchD_00495ac8_caseD_1:
          FUN_0049a300(1,s_dpl_bmfRead_got_unrecognized_blo_00509b3f);
          FUN_00492ba0(param_1,local_c);
          this = extraout_ECX_04;
          break;
        case 0x11:
          FUN_00492fc4(param_1,(int *)&DAT_00509804,(uint *)&DAT_0050980c,local_c);
          this = extraout_ECX_00;
          break;
        case 0x12:
          uVar3 = FUN_00492c84(param_1);
          local_d = (char)uVar3;
          break;
        case 0x13:
          uVar3 = FUN_00492c84(param_1);
          local_e = (char)uVar3;
          break;
        case 0x14:
          uVar3 = FUN_00492c84(param_1);
          local_11 = (char)uVar3;
          break;
        case 0x15:
          uVar3 = FUN_00492c84(param_1);
          local_f = (char)uVar3;
        }
      }
    }
    else if ((int)local_8 < 0x2009) {
      if (local_8 == 0x2008) {
        FUN_00492fc4(param_1,(int *)&DAT_005097e4,(uint *)&DAT_005097f4,local_c);
        this = extraout_ECX;
      }
      else if (local_8 == 0x17) {
        uVar3 = FUN_00492c84(param_1);
        local_12 = (char)uVar3;
        if (0 < (int)(local_c - 1)) {
          FUN_00492fc4(param_1,(int *)&DAT_00509800,(uint *)&DAT_00509808,local_c - 1);
          this = extraout_ECX_01;
        }
      }
      else {
        if (local_8 != 0x18) {
          if (local_8 == 0x2000) goto switchD_00495ac8_caseD_0;
          goto switchD_00495ac8_caseD_1;
        }
        uVar3 = FUN_00492c84(param_1);
        local_13 = (char)uVar3;
      }
    }
    else if (local_8 == 0x200a) {
      FUN_00492c84(param_1);
    }
    else {
      if (local_8 != 0x2037) goto switchD_00495ac8_caseD_1;
      local_18 = FUN_004de55c(local_c);
      if (local_18 == (int *)0x0) {
        FUN_0049a300(1,s_dpl_bmfRead_failed_to_allocate_m_00509b0c);
        FUN_00492ba0(param_1,local_c);
        return 0;
      }
      FUN_00492f10(param_1,(char *)local_18,local_c);
      local_1c = local_c;
      this = extraout_ECX_02;
    }
  }
  if ((DAT_005097e4 != (char *)0x0) && (*DAT_005097e4 != '\0')) {
    piVar5 = FUN_00497194(1,DAT_005097e4,2,(int *)param_1[0xc],&local_20,FUN_00489768,FUN_00489998);
    if ((local_20 == 0) && (extraout_EAX != 0)) {
      puVar1 = *(undefined4 **)(extraout_EAX + 0x18);
      if (('\0' < local_d) && (local_d < '\t')) {
        switch(local_d) {
        case '\x01':
          unaff_EDI = 9;
          break;
        case '\x02':
          unaff_EDI = 10;
          break;
        case '\x03':
          unaff_EDI = 0xb;
          break;
        case '\x04':
          unaff_EDI = 0xf;
          break;
        case '\x05':
          unaff_EDI = 0x10;
          break;
        case '\x06':
          unaff_EDI = 0x11;
          break;
        case '\a':
          unaff_EDI = 0x12;
          break;
        case '\b':
          unaff_EDI = 0xe;
        }
        FUN_0048c144((int)puVar1,5,unaff_EDI);
      }
      if (('\0' < local_e) && (local_e < '\x06')) {
        switch(local_e) {
        case '\x01':
          unaff_EDI = 9;
          break;
        case '\x02':
          unaff_EDI = 10;
          break;
        case '\x03':
          unaff_EDI = 0xb;
          break;
        case '\x04':
          unaff_EDI = 0xc;
          break;
        case '\x05':
          unaff_EDI = 0xd;
        }
        FUN_0048c144((int)puVar1,6,unaff_EDI);
      }
      if ((-1 < local_f) && (local_f < '\x03')) {
        if (local_f == '\0') {
          unaff_EDI = 3;
        }
        else if (local_f == '\x01') {
          unaff_EDI = 4;
        }
        else if (local_f == '\x02') {
          unaff_EDI = 5;
        }
        FUN_0048c144((int)puVar1,3,unaff_EDI);
      }
      if ((-1 < local_10) && (local_10 < '\x03')) {
        if (local_10 == '\0') {
          unaff_EDI = 3;
        }
        else if (local_10 == '\x01') {
          unaff_EDI = 4;
        }
        else if (local_10 == '\x02') {
          unaff_EDI = 5;
        }
        FUN_0048c144((int)puVar1,4,unaff_EDI);
      }
      if ((-1 < local_11) && (local_11 < '\x03')) {
        if (local_11 == '\0') {
          unaff_EDI = 6;
        }
        else if (local_11 == '\x01') {
          unaff_EDI = 7;
        }
        else if (local_11 == '\x02') {
          unaff_EDI = 8;
        }
        FUN_0048c144((int)puVar1,7,unaff_EDI);
      }
      if ((-1 < local_13) && (local_13 < '\t')) {
        switch(local_13) {
        case '\0':
          unaff_EDI = 0x13;
          break;
        case '\x01':
          unaff_EDI = 0x14;
          break;
        case '\x02':
          unaff_EDI = 0x15;
          break;
        case '\x03':
          unaff_EDI = 0x16;
          break;
        case '\x04':
          unaff_EDI = 0x17;
          break;
        case '\x05':
          unaff_EDI = 0x18;
          break;
        case '\x06':
          unaff_EDI = 0x19;
          break;
        case '\a':
          unaff_EDI = 0x1a;
          break;
        case '\b':
          unaff_EDI = 0x1b;
        }
        FUN_0048c144((int)puVar1,10,unaff_EDI);
      }
      if ((((DAT_005097d8 != 0) && (local_12 != '\0')) && (DAT_00509800 != (char *)0x0)) &&
         (*DAT_00509800 != '\0')) {
        FUN_00497194(1,DAT_00509800,0,(int *)piVar5[0xc],&local_24,FUN_00489768,FUN_00489998);
        if (extraout_EAX_00 == 0) {
          FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_det_00509b91);
        }
        else {
          FUN_0048c144((int)puVar1,8,1);
          if (local_24 == 0) {
            FUN_0049a300(1,s_texture___s__is_undefined__00509b76);
          }
        }
      }
      if ((DAT_00509804 != (char *)0x0) && (*DAT_00509804 != '\0')) {
        iVar6 = FUN_00498eb4(DAT_00509804,0);
        if (iVar6 == 0) {
          FUN_0049a300(1,s_dpl_bmfRead_failed_to_load_texma_00509bc3);
        }
        else {
          FUN_0048c2a0((int)puVar1,iVar6);
        }
      }
      FUN_0048d55c(puVar1);
      if ((local_18 != (int *)0x0) && (pcVar4 = (code *)FUN_00496644(), pcVar4 != (code *)0x0)) {
        (*pcVar4)(0xc,puVar1,local_18,local_1c);
      }
    }
    else if (extraout_EAX == 0) {
      FUN_0049a300(1,s_dpl_bmfRead_failed_to_lookup_tex_00509bf0);
    }
    else {
      FUN_0049a300(1,s_dpl_bmfRead___texture___s__alrea_00509c1b);
    }
  }
  if (local_18 != (int *)0x0) {
    FUN_004de420(local_18);
  }
  return 1;
}



