/* @0046fcb0 file=? name=FUN_0046fcb0 */

void __cdecl FUN_0046fcb0(int param_1)

{
  FUN_00447e6c(param_1);
  return;
}



/* @0046fcc0 file=? name=FUN_0046fcc0 */

void __cdecl FUN_0046fcc0(int param_1)

{
  FUN_00447ef8(param_1);
  return;
}



/* @0046fcd0 file=? name=FUN_0046fcd0 */

void __cdecl FUN_0046fcd0(int param_1)

{
  FUN_00447f0c(param_1);
  return;
}



/* @0046fce0 file=? name=FUN_0046fce0 */

void __cdecl FUN_0046fce0(int param_1)

{
  FUN_00448188(param_1);
  if (*(int *)(param_1 + 0x1c52c) != 0) {
    FUN_0047003c(param_1);
    FUN_0046d694(*(int *)(param_1 + 0x1c52c));
  }
  return;
}



/* @0046fd10 file=? name=FUN_0046fd10 */

undefined4 __cdecl FUN_0046fd10(int param_1)

{
  int *piVar1;
  int iVar2;
  undefined4 uVar3;
  
  uVar3 = 0;
  piVar1 = *(int **)(param_1 + 0x1c530);
  if (piVar1 != (int *)0x0) {
    uVar3 = (**(code **)(*piVar1 + 8))(piVar1,0);
  }
  if ((*(int *)(param_1 + 0x1c0d0) == 2) &&
     (piVar1 = *(int **)(param_1 + 0x1c52c), piVar1 != (int *)0x0)) {
    iVar2 = (**(code **)(*piVar1 + 8))(piVar1,0);
    if (iVar2 == 0) {
      *(undefined4 *)(param_1 + 0x1c0d0) = 0;
    }
    else {
      uVar3 = 1;
    }
  }
  return uVar3;
}



/* @0046fd6c file=? name=FUN_0046fd6c */

void __cdecl FUN_0046fd6c(int param_1,int param_2)

{
  FUN_004688ce(*(int *)(param_1 + 0x4c) + 0x58,*(int *)(param_2 + 0x1bc),0);
  FUN_00447c58(param_1,param_2);
  return;
}



/* @0046fda0 file=? name=FUN_0046fda0 */

void __cdecl FUN_0046fda0(int param_1,int param_2)

{
  FUN_004689bc(*(int *)(param_1 + 0x4c) + 0x58,*(int *)(param_2 + 0x1bc));
  FUN_00447d38(param_1,param_2);
  return;
}



/* @0046fdd0 file=? name=FUN_0046fdd0 */

void __cdecl
FUN_0046fdd0(int param_1,int param_2,char *param_3,undefined4 param_4,int param_5,undefined4 param_6
            ,undefined4 param_7,int param_8)

{
  int iVar1;
  undefined4 *puVar2;
  
  if (*(int *)(param_1 + 0x1c52c) != 0) {
    puVar2 = *(undefined4 **)(param_1 + 0x54 + param_2 * 4);
    if ((puVar2 != (undefined4 *)0x0) && (puVar2 != (undefined4 *)0x0)) {
      (**(code **)*puVar2)(puVar2,3);
    }
    puVar2 = (undefined4 *)FUN_00402298(0x544);
    if (puVar2 == (undefined4 *)0x0) {
      puVar2 = (undefined4 *)0x0;
    }
    else {
      puVar2 = FUN_0046d850(puVar2,*(undefined4 **)(param_1 + 0x1c52c),param_3,param_4,param_5,
                            param_6,param_7);
    }
    *(undefined4 **)(param_1 + 0x54 + param_2 * 4) = puVar2;
    iVar1 = *(int *)(param_1 + 0x54 + param_2 * 4);
    if (iVar1 != 0) {
      if ((param_5 < 1) || (0xff < param_5)) {
        FUN_0046dbdc(iVar1);
      }
      else {
        FUN_0046db84(iVar1,param_8);
      }
    }
  }
  return;
}



/* @0046fe70 file=? name=FUN_0046fe70 */

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

{
  int iVar1;
  
  if ((*(int *)(param_1 + 0x1c52c) != 0) &&
     (iVar1 = *(int *)(param_1 + 0x54 + param_2 * 4), iVar1 != 0)) {
    *(undefined4 *)(iVar1 + 0x53c) = param_3;
    *(undefined4 *)(iVar1 + 0x540) = param_4;
    if ((char)*(undefined4 *)(iVar1 + 0x52c) != '\0') {
      FUN_0046db84(iVar1,param_5);
      return;
    }
    FUN_0046dbdc(iVar1);
  }
  return;
}



/* @0046fec0 file=? name=FUN_0046fec0 */

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

{
  undefined4 *puVar1;
  undefined4 uVar2;
  
  uVar2 = 0;
  if (*(int *)(param_1 + 0x1c530) != 0) {
    puVar1 = *(undefined4 **)(param_1 + 0x54 + param_2 * 4);
    if ((puVar1 != (undefined4 *)0x0) && (puVar1 != (undefined4 *)0x0)) {
      (**(code **)*puVar1)(puVar1,3);
    }
    puVar1 = (undefined4 *)FUN_00402298(0x34);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_0046a3a8(puVar1,*(undefined4 **)(param_1 + 0x1c530),param_3,0);
    }
    *(undefined4 **)(param_1 + 0x54 + param_2 * 4) = puVar1;
    uVar2 = *(undefined4 *)(param_1 + 0x54 + param_2 * 4);
  }
  return uVar2;
}



/* @0046ff24 file=? name=FUN_0046ff24 */

void __cdecl FUN_0046ff24(int param_1,float param_2)

{
  if (*(int *)(param_1 + 0x1c52c) != 0) {
    FUN_0046d4a0(*(int *)(param_1 + 0x1c52c),param_2);
  }
  return;
}



/* @0046ff44 file=? name=FUN_0046ff44 */

void __cdecl FUN_0046ff44(int param_1,float param_2)

{
  if (*(int *)(param_1 + 0x1c52c) != 0) {
    FUN_0046d430(*(int *)(param_1 + 0x1c52c),param_2);
  }
  return;
}



/* @0046ff64 file=? name=FUN_0046ff64 */

void __cdecl FUN_0046ff64(int *param_1,char *param_2,undefined4 param_3)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  char local_44 [64];
  
  uVar2 = 0xffffffff;
  pcVar4 = *(char **)(*(int *)(DAT_004efc94 + 200) + 0x2c);
  do {
    pcVar5 = pcVar4;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar5 = pcVar4 + 1;
    cVar1 = *pcVar4;
    pcVar4 = pcVar5;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar5 + -uVar2;
  pcVar5 = local_44;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_44,param_2);
  (**(code **)(*param_1 + 0x50))(param_1,local_44,param_3);
  return;
}



/* @0046ffcc file=? name=FUN_0046ffcc */

undefined8 __fastcall FUN_0046ffcc(undefined4 param_1,undefined4 param_2,int param_3,int param_4)

{
  int iVar1;
  undefined4 uVar2;
  undefined2 extraout_var;
  undefined6 uVar3;
  
  iVar1 = param_4 + -1;
  if ((param_4 == 0) && (param_2 = 0, *(int *)(param_3 + 0x1c52c) != 0)) {
    *(undefined4 *)(param_3 + 0x1c534) = 1;
    FUN_00414b60();
    uVar2 = FUN_004dcd94();
    *(undefined4 *)(param_3 + 0x1c538) = uVar2;
    uVar3 = FUN_0046d840(*(undefined4 *)(param_3 + 0x1c52c),1);
    param_2 = CONCAT22(extraout_var,(short)((uint6)uVar3 >> 0x20));
    iVar1 = (int)uVar3;
  }
  return CONCAT44(param_2,iVar1);
}



/* @0047003c file=? name=FUN_0047003c */

undefined8 __cdecl FUN_0047003c(int param_1)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  undefined6 uVar4;
  undefined2 extraout_var;
  
  piVar1 = (int *)FUN_00414b60();
  iVar3 = *(int *)(param_1 + 0x1c534);
  iVar2 = *piVar1;
  if ((iVar3 != 0) && (iVar2 = *(int *)(param_1 + 0x1c538), iVar2 <= *piVar1)) {
    *(undefined4 *)(param_1 + 0x1c534) = 0;
    uVar4 = FUN_0046d840(*(undefined4 *)(param_1 + 0x1c52c),0);
    iVar3 = CONCAT22(extraout_var,(short)((uint6)uVar4 >> 0x20));
    iVar2 = (int)uVar4;
  }
  return CONCAT44(iVar3,iVar2);
}



/* @00470084 file=? name=FUN_00470084 */

void FUN_00470084(void)

{
  FUN_00401b1c();
  return;
}



/* @004700ac file=? name=FUN_004700ac */

void __cdecl FUN_004700ac(char *param_1)

{
  FUN_00402300(param_1);
  return;
}



/* @004700bc file=? name=FUN_004700bc */

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

int * __cdecl
FUN_004700bc(int *param_1,int param_2,int param_3,int param_4,char *param_5,uint param_6,int param_7
            ,int param_8,int param_9)

{
  int iVar1;
  undefined4 *puVar2;
  float10 fVar3;
  
  iVar1 = FUN_004700ac(param_5);
  param_1[1] = iVar1;
  *param_1 = param_2;
  puVar2 = FUN_00442aec(param_2 + 4,(char *)param_1[1],0);
  if (puVar2 == (undefined4 *)0x0) {
    param_1[2] = 0;
    param_1[3] = 0;
  }
  else {
    param_1[2] = (puVar2[3] + 1) / 0xe;
    param_1[3] = puVar2[4];
  }
  if ((int)param_6 < 1) {
    param_6 = 1;
  }
  if (param_1[9] == 4) {
    if (8 < (int)param_6) {
      param_6 = 8;
    }
    param_1[10] = 0x48ae0600;
  }
  else {
    if (0x10 < (int)param_6) {
      param_6 = 0x10;
    }
    fVar3 = (float10)FUN_004dd4b0(param_6);
    param_1[10] = (int)(float)(fVar3 - (float10)_DAT_00470188);
  }
  param_1[4] = param_6;
  param_1[9] = param_7;
  param_1[5] = param_8;
  param_1[6] = param_9;
  param_1[7] = param_3;
  param_1[8] = param_4;
  param_1[0xc] = 1;
  FUN_004703f4((int)param_1);
  return param_1;
}



/* @0047018c file=? name=FUN_0047018c */

void __cdecl FUN_0047018c(int *param_1,byte param_2)

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



/* @004701c8 file=? name=FUN_004701c8 */

undefined4 FUN_004701c8(void)

{
  return 1;
}



/* @004701d4 file=? name=FUN_004701d4 */

void __cdecl FUN_004701d4(int param_1,char *param_2)

{
  char cVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  char *pcVar5;
  char *pcVar6;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_NumericDisplay__004fafc9,(char *)0x0);
  uVar3 = 0xffffffff;
  do {
    pcVar5 = param_2;
    if (uVar3 == 0) break;
    uVar3 = uVar3 - 1;
    pcVar5 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar5;
  } while (cVar1 != '\0');
  uVar3 = ~uVar3;
  pcVar5 = pcVar5 + -uVar3;
  pcVar6 = local_54;
  for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
    *pcVar6 = *pcVar5;
    pcVar5 = pcVar5 + 1;
    pcVar6 = pcVar6 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fafda);
  uVar3 = *(uint *)(param_1 + 0x14);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_backgroundColor__004fafde,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fafef,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0x18);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_foregroundColor__004faff1,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fb002,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_numberOfDigits___004fb004,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fb015,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_format___004fb017,(char *)0x0);
  switch(*(undefined4 *)(param_1 + 0x24)) {
  case 0:
    FUN_004dbb24(&DAT_00524e20,s_unsignedFormat_004fb028,(char *)0x0);
    break;
  case 1:
    FUN_004dbb24(&DAT_00524e20,s_signedFormat_004fb038,(char *)0x0);
    break;
  case 2:
    FUN_004dbb24(&DAT_00524e20,s_signedBlankedZerosFormat_004fb046,(char *)0x0);
    break;
  case 3:
    FUN_004dbb24(&DAT_00524e20,s_absoluteFormat_004fb060,(char *)0x0);
    break;
  case 4:
    FUN_004dbb24(&DAT_00524e20,s_timeFormat_004fb070,(char *)0x0);
    break;
  default:
    FUN_004dbb24(&DAT_00524e20,s___OUT_OF_RANGE___004fb07c,(char *)0x0);
  }
  return;
}



/* @004703f4 file=? name=FUN_004703f4 */

void __cdecl FUN_004703f4(int param_1)

{
  undefined1 *puVar1;
  int iVar2;
  
  *(undefined4 *)(param_1 + 0x2c) = 0xbf9e0419;
  iVar2 = 0;
  puVar1 = (undefined1 *)(param_1 + 0x34);
  do {
    *puVar1 = 0xff;
    iVar2 = iVar2 + 1;
    puVar1 = puVar1 + 1;
  } while (iVar2 < 0x10);
  return;
}



/* @00470414 file=? name=FUN_00470414 */

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

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



/* @00470430 file=? name=FUN_00470430 */

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

void FUN_00470430(int *param_1,int *param_2,float param_3)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  undefined1 uVar4;
  char cVar5;
  char acStack_38 [20];
  int *piStack_24;
  int iStack_20;
  uint uStack_1c;
  int iStack_18;
  char *pcStack_14;
  int iStack_10;
  undefined4 uStack_c;
  undefined4 *puStack_8;
  
  if (param_1[0xc] != 0) {
    param_1[0xc] = 0;
    FUN_004703f4((int)param_1);
  }
  puStack_8 = FUN_00442aec(*param_1 + 4,(char *)param_1[1],0);
  if (puStack_8 == (undefined4 *)0x0) goto LAB_00470737;
  if ((param_1[9] == 3) && (param_3 < _DAT_00470750)) {
    param_3 = -param_3;
  }
  if ((float)param_1[0xb] == param_3) goto LAB_00470737;
  param_1[0xb] = (int)param_3;
  iVar2 = FUN_004dcd94();
  uStack_c = puStack_8[4];
  if (iVar2 < 0) {
    iVar2 = -iVar2;
  }
  iVar3 = FUN_004dcd94();
  if (iVar3 < iVar2) {
    iVar2 = iVar3;
  }
  pcStack_14 = &stack0xffffffc7 + param_1[4];
  iVar3 = param_1[9];
  if (iVar3 == 0) {
LAB_004704f9:
    iVar3 = param_1[4];
    while (iVar3 = iVar3 + -1, -1 < iVar3) {
      *pcStack_14 = (char)(iVar2 % 10);
      iVar2 = iVar2 / 10;
      pcStack_14 = pcStack_14 + -1;
    }
  }
  else if (iVar3 == 1) {
    for (iVar3 = param_1[4] + -2; -1 < iVar3; iVar3 = iVar3 + -1) {
      *pcStack_14 = (char)(iVar2 % 10);
      iVar2 = iVar2 / 10;
      pcStack_14 = pcStack_14 + -1;
    }
    uVar4 = 10;
    if (param_3 < _DAT_00470750) {
      uVar4 = 0xb;
    }
    *pcStack_14 = uVar4;
  }
  else {
    if (iVar3 - 2U < 2) goto LAB_004704f9;
    if (iVar3 - 2U == 2) {
      uStack_1c = 0;
      iVar3 = param_1[4];
      uVar1 = uStack_1c;
      while (uStack_1c = uVar1, 0 < iVar3) {
        uStack_1c = uVar1 + 1;
        if (uVar1 < 2) {
          iStack_18 = iVar2 % 0x3c;
          iVar2 = iVar2 / 0x3c;
        }
        else if (uVar1 == 2) {
          iStack_18 = iVar2 % 0x18;
          iVar2 = iVar2 / 0x18;
        }
        else if (uVar1 == 3) {
          iStack_18 = iVar2 % 100;
        }
        else {
          iStack_18 = 0;
        }
        if (-1 < iVar3 + -1) {
          *pcStack_14 = (char)(iStack_18 % 10);
          pcStack_14 = pcStack_14 + -1;
        }
        if (-1 < iVar3 + -2) {
          *pcStack_14 = (char)(iStack_18 / 10);
          pcStack_14 = pcStack_14 + -1;
        }
        iVar3 = iVar3 + -3;
        uVar1 = uStack_1c;
        if (-1 < iVar3) {
          *pcStack_14 = 0xd;
          pcStack_14 = pcStack_14 + -1;
          uVar1 = uStack_1c;
        }
      }
    }
  }
  iStack_20 = 1;
  iStack_10 = param_1[7];
  pcStack_14 = acStack_38;
  piStack_24 = param_1 + 0xd;
  for (iVar2 = 0; iVar2 < param_1[4]; iVar2 = iVar2 + 1) {
    cVar5 = *pcStack_14;
    if ((param_1[9] == 2) && (iStack_20 != 0)) {
      if ((_DAT_00470750 <= param_3) || (pcStack_14[1] == '\0')) {
        if (cVar5 == '\0') {
          if (iVar2 == param_1[4] + -1) {
            iStack_20 = 0;
          }
          else {
            cVar5 = '\x7f';
          }
        }
        else {
          iStack_20 = 0;
        }
      }
      else {
        cVar5 = '\v';
        iStack_20 = 0;
      }
    }
    if (cVar5 != (char)*piStack_24) {
      *(char *)piStack_24 = cVar5;
      (**(code **)(*param_2 + 0x24))(param_2,iStack_10,param_1[8]);
      if (cVar5 == 0x7f) {
        (**(code **)(*param_2 + 0x18))(param_2,param_1[5]);
        (**(code **)(*param_2 + 0x4c))(param_2,param_1[2],uStack_c);
      }
      else {
        iVar3 = (int)cVar5 * param_1[2];
        (**(code **)(*param_2 + 0x18))(param_2,param_1[6]);
        (**(code **)(*param_2 + 0x58))
                  (param_2,param_1[5],0,puStack_8,iVar3,0,param_1[2] + iVar3 + -1,uStack_c);
      }
    }
    piStack_24 = (int *)((int)piStack_24 + 1);
    iStack_10 = iStack_10 + param_1[2];
    pcStack_14 = pcStack_14 + 1;
  }
LAB_00470737:
  FUN_00442c12(*param_1 + 4,(char *)param_1[1]);
  return;
}



/* @00470436 file=? name=FUN_00470436 */

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

void FUN_00470436(void)

{
  int *piVar1;
  uint uVar2;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  undefined1 uVar6;
  char cVar7;
  int unaff_EBP;
  
  piVar1 = *(int **)(unaff_EBP + 8);
  if (piVar1[0xc] != 0) {
    piVar1[0xc] = 0;
    FUN_004703f4((int)piVar1);
  }
  puVar3 = FUN_00442aec(*piVar1 + 4,(char *)piVar1[1],0);
  *(undefined4 **)(unaff_EBP + -4) = puVar3;
  if (*(int *)(unaff_EBP + -4) == 0) goto LAB_00470737;
  if ((piVar1[9] == 3) && (*(float *)(unaff_EBP + 0x10) < _DAT_00470750)) {
    *(float *)(unaff_EBP + 0x10) = -*(float *)(unaff_EBP + 0x10);
  }
  if ((float)piVar1[0xb] == *(float *)(unaff_EBP + 0x10)) goto LAB_00470737;
  piVar1[0xb] = *(int *)(unaff_EBP + 0x10);
  iVar4 = FUN_004dcd94();
  *(undefined4 *)(unaff_EBP + -8) = *(undefined4 *)(*(int *)(unaff_EBP + -4) + 0x10);
  if (iVar4 < 0) {
    iVar4 = -iVar4;
  }
  iVar5 = FUN_004dcd94();
  if (iVar5 < iVar4) {
    iVar4 = iVar5;
  }
  *(int *)(unaff_EBP + -0x10) = unaff_EBP + -0x35 + piVar1[4];
  iVar5 = piVar1[9];
  if (iVar5 == 0) {
LAB_004704f9:
    iVar5 = piVar1[4];
    while (iVar5 = iVar5 + -1, -1 < iVar5) {
      **(undefined1 **)(unaff_EBP + -0x10) = (char)(iVar4 % 10);
      iVar4 = iVar4 / 10;
      *(int *)(unaff_EBP + -0x10) = *(int *)(unaff_EBP + -0x10) + -1;
    }
  }
  else if (iVar5 == 1) {
    for (iVar5 = piVar1[4] + -2; -1 < iVar5; iVar5 = iVar5 + -1) {
      **(undefined1 **)(unaff_EBP + -0x10) = (char)(iVar4 % 10);
      iVar4 = iVar4 / 10;
      *(int *)(unaff_EBP + -0x10) = *(int *)(unaff_EBP + -0x10) + -1;
    }
    uVar6 = 10;
    if (*(float *)(unaff_EBP + 0x10) < _DAT_00470750) {
      uVar6 = 0xb;
    }
    **(undefined1 **)(unaff_EBP + -0x10) = uVar6;
  }
  else {
    if (iVar5 - 2U < 2) goto LAB_004704f9;
    if (iVar5 - 2U == 2) {
      *(undefined4 *)(unaff_EBP + -0x18) = 0;
      iVar5 = piVar1[4];
      while (0 < iVar5) {
        uVar2 = *(uint *)(unaff_EBP + -0x18);
        *(int *)(unaff_EBP + -0x18) = *(int *)(unaff_EBP + -0x18) + 1;
        if (uVar2 < 2) {
          *(int *)(unaff_EBP + -0x14) = iVar4 % 0x3c;
          iVar4 = iVar4 / 0x3c;
        }
        else if (uVar2 == 2) {
          *(int *)(unaff_EBP + -0x14) = iVar4 % 0x18;
          iVar4 = iVar4 / 0x18;
        }
        else if (uVar2 == 3) {
          *(int *)(unaff_EBP + -0x14) = iVar4 % 100;
        }
        else {
          *(undefined4 *)(unaff_EBP + -0x14) = 0;
        }
        if (-1 < iVar5 + -1) {
          **(undefined1 **)(unaff_EBP + -0x10) = (char)(*(int *)(unaff_EBP + -0x14) % 10);
          *(int *)(unaff_EBP + -0x10) = *(int *)(unaff_EBP + -0x10) + -1;
        }
        if (-1 < iVar5 + -2) {
          **(undefined1 **)(unaff_EBP + -0x10) = (char)(*(int *)(unaff_EBP + -0x14) / 10);
          *(int *)(unaff_EBP + -0x10) = *(int *)(unaff_EBP + -0x10) + -1;
        }
        iVar5 = iVar5 + -3;
        if (-1 < iVar5) {
          **(undefined1 **)(unaff_EBP + -0x10) = 0xd;
          *(int *)(unaff_EBP + -0x10) = *(int *)(unaff_EBP + -0x10) + -1;
        }
      }
    }
  }
  *(undefined4 *)(unaff_EBP + -0x1c) = 1;
  *(int *)(unaff_EBP + -0xc) = piVar1[7];
  *(int *)(unaff_EBP + -0x10) = unaff_EBP + -0x34;
  *(int **)(unaff_EBP + -0x20) = piVar1 + 0xd;
  for (iVar4 = 0; iVar4 < piVar1[4]; iVar4 = iVar4 + 1) {
    cVar7 = **(char **)(unaff_EBP + -0x10);
    if ((piVar1[9] == 2) && (*(int *)(unaff_EBP + -0x1c) != 0)) {
      if ((_DAT_00470750 <= *(float *)(unaff_EBP + 0x10)) ||
         (*(char *)(*(int *)(unaff_EBP + -0x10) + 1) == '\0')) {
        if (cVar7 == '\0') {
          if (iVar4 == piVar1[4] + -1) {
            *(undefined4 *)(unaff_EBP + -0x1c) = 0;
          }
          else {
            cVar7 = '\x7f';
          }
        }
        else {
          *(undefined4 *)(unaff_EBP + -0x1c) = 0;
        }
      }
      else {
        cVar7 = '\v';
        *(undefined4 *)(unaff_EBP + -0x1c) = 0;
      }
    }
    if (cVar7 != **(char **)(unaff_EBP + -0x20)) {
      **(char **)(unaff_EBP + -0x20) = cVar7;
      (**(code **)(**(int **)(unaff_EBP + 0xc) + 0x24))
                (*(int **)(unaff_EBP + 0xc),*(undefined4 *)(unaff_EBP + -0xc),piVar1[8]);
      if (cVar7 == 0x7f) {
        (**(code **)(**(int **)(unaff_EBP + 0xc) + 0x18))(*(int **)(unaff_EBP + 0xc),piVar1[5]);
        (**(code **)(**(int **)(unaff_EBP + 0xc) + 0x4c))
                  (*(int **)(unaff_EBP + 0xc),piVar1[2],*(undefined4 *)(unaff_EBP + -8));
      }
      else {
        iVar5 = (int)cVar7 * piVar1[2];
        (**(code **)(**(int **)(unaff_EBP + 0xc) + 0x18))(*(int **)(unaff_EBP + 0xc),piVar1[6]);
        (**(code **)(**(int **)(unaff_EBP + 0xc) + 0x58))
                  (*(int **)(unaff_EBP + 0xc),piVar1[5],0,*(undefined4 *)(unaff_EBP + -4),iVar5,0,
                   piVar1[2] + iVar5 + -1,*(undefined4 *)(unaff_EBP + -8));
      }
    }
    *(int *)(unaff_EBP + -0x20) = *(int *)(unaff_EBP + -0x20) + 1;
    *(int *)(unaff_EBP + -0xc) = *(int *)(unaff_EBP + -0xc) + piVar1[2];
    *(int *)(unaff_EBP + -0x10) = *(int *)(unaff_EBP + -0x10) + 1;
  }
LAB_00470737:
  FUN_00442c12(*piVar1 + 4,(char *)piVar1[1]);
  return;
}



/* @00470758 file=? name=FUN_00470758 */

void __cdecl FUN_00470758(int param_1,int *param_2)

{
  if (*(int *)(param_1 + 0x30) == 0) {
    *(undefined4 *)(param_1 + 0x30) = 1;
    (**(code **)(*param_2 + 0x18))(param_2,*(undefined4 *)(param_1 + 0x14));
    (**(code **)(*param_2 + 0x24))
              (param_2,*(undefined4 *)(param_1 + 0x1c),*(undefined4 *)(param_1 + 0x20));
    (**(code **)(*param_2 + 0x4c))
              (param_2,*(int *)(param_1 + 8) * *(int *)(param_1 + 0x10),
               *(undefined4 *)(param_1 + 0xc));
  }
  return;
}



/* @004707a8 file=? name=FUN_004707a8 */

undefined4 __cdecl FUN_004707a8(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  undefined4 *puVar4;
  
  iVar1 = FUN_00445034(&PTR_s_unsigned_004f5784,&DAT_004f593c);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    piVar3 = (int *)FUN_00402298(0x98);
    if (piVar3 != (int *)0x0) {
      FUN_00470888(piVar3,DAT_004f57e8,DAT_004f582c,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004f5870,param_3 + DAT_004f5874,&DAT_004f58b4,DAT_004f58f8,iVar1,
                   DAT_004f5980,DAT_004f59c4,DAT_004f5a08,s_NumericDisplayScalar_004fadbd);
    }
    iVar1 = *(int *)(param_5 + 0x4c) + 4;
    puVar4 = FUN_00442aec(iVar1,&DAT_004f58b4,0);
    if (puVar4 == (undefined4 *)0x0) {
      uVar2 = 0;
    }
    else {
      FUN_00442c12(iVar1,&DAT_004f58b4);
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00470888 file=? name=FUN_00470888 */

int * __cdecl
FUN_00470888(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,undefined4 param_10
            ,char *param_11,uint param_12,int param_13,int param_14,int param_15,undefined4 param_16
            ,undefined4 param_17)

{
  int *piVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_17);
  *param_1 = (int)&PTR_FUN_004fbb40;
  piVar1 = (int *)FUN_00402298(0x44);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004700bc(piVar1,*(int *)(param_4 + 0x4c),0,0,param_11,param_12,param_13,param_14,
                          param_15);
  }
  param_1[0x24] = (int)piVar1;
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x25,param_16);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @0047094c file=? name=FUN_0047094c */

void __cdecl FUN_0047094c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fbb40;
    if ((int *)param_1[0x24] != (int *)0x0) {
      FUN_0047018c((int *)param_1[0x24],3);
      param_1[0x24] = 0;
    }
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00470998 file=? name=FUN_00470998 */

void FUN_00470998(void)

{
  FUN_004448ac();
  return;
}



/* @004709a8 file=? name=FUN_004709a8 */

void __cdecl FUN_004709a8(int param_1,char *param_2)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_NumericDisplayScalar__004fb096,(char *)0x0);
  uVar2 = 0xffffffff;
  do {
    pcVar4 = param_2;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar4 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar4;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar4 + -uVar2;
  pcVar5 = local_54;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb0ad);
  FUN_004448bc(param_1,local_54);
  FUN_004701d4(*(int *)(param_1 + 0x90),local_54);
  return;
}



/* @00470a3c file=? name=FUN_00470a3c */

void __cdecl FUN_00470a3c(int param_1)

{
  FUN_004703f4(*(int *)(param_1 + 0x90));
  return;
}



/* @00470a54 file=? name=FUN_00470a54 */

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

{
  FUN_00470414(*(int *)(param_1 + 0x90),param_2,param_3);
  return;
}



/* @00470a74 file=? name=FUN_00470a74 */

void __cdecl FUN_00470a74(int param_1)

{
  FUN_00470430(*(int **)(param_1 + 0x90),(int *)(param_1 + 0x48),*(float *)(param_1 + 0x94));
  return;
}



/* @00470a98 file=? name=FUN_00470a98 */

undefined4 __cdecl FUN_00470a98(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  undefined4 *puVar4;
  
  iVar1 = FUN_00445034(&PTR_s_unsigned_004f5784,&DAT_004f5d84);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    piVar3 = (int *)FUN_00402298(0x98);
    if (piVar3 != (int *)0x0) {
      FUN_00470b74(piVar3,DAT_004f5c30,DAT_004f5c74,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004f5cb8,param_3 + DAT_004f5cbc,&DAT_004f5cfc,DAT_004f5d40,iVar1,
                   DAT_004f5dc8,DAT_004f5e0c,DAT_004f5e50);
    }
    iVar1 = *(int *)(param_5 + 0x4c) + 4;
    puVar4 = FUN_00442aec(iVar1,&DAT_004f5cfc,0);
    if (puVar4 == (undefined4 *)0x0) {
      uVar2 = 0;
    }
    else {
      FUN_00442c12(iVar1,&DAT_004f5cfc);
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00470b74 file=? name=FUN_00470b74 */

int * __cdecl
FUN_00470b74(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,undefined4 param_10
            ,char *param_11,uint param_12,int param_13,int param_14,int param_15,undefined4 param_16
            )

{
  FUN_00470888(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,param_14,param_15,param_16,s_NumericDisplayScalar_004fadbd
              );
  *param_1 = (int)&PTR_FUN_004fbafc;
  return param_1;
}



/* @00470bd0 file=? name=FUN_00470bd0 */

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

void __cdecl FUN_00470bd0(int param_1)

{
  float10 fVar1;
  
  fVar1 = FUN_004dcd00((double)(*(float *)(param_1 + 0x94) * _DAT_00470c18));
  FUN_00470430(*(int **)(param_1 + 0x90),(int *)(param_1 + 0x48),(float)fVar1);
  return;
}



/* @00470cfc file=? name=FUN_00470cfc */

int * __cdecl
FUN_00470cfc(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,undefined4 param_10
            ,char *param_11,uint param_12,int param_13,int param_14,int param_15,undefined4 param_16
            ,undefined4 param_17)

{
  int *piVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_17);
  *param_1 = (int)&PTR_FUN_004fbab8;
  piVar1 = (int *)FUN_00402298(0x44);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004700bc(piVar1,*(int *)(param_4 + 0x4c),0,0,param_11,param_12,param_13,param_14,
                          param_15);
  }
  param_1[0x24] = (int)piVar1;
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_004749de(puVar2,0,param_1 + 0x25,param_16);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @00470dc0 file=? name=FUN_00470dc0 */

void __cdecl FUN_00470dc0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fbab8;
    if ((int *)param_1[0x24] != (int *)0x0) {
      FUN_0047018c((int *)param_1[0x24],3);
      param_1[0x24] = 0;
    }
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00470e0c file=? name=FUN_00470e0c */

void FUN_00470e0c(void)

{
  FUN_004448ac();
  return;
}



/* @00470e1c file=? name=FUN_00470e1c */

void __cdecl FUN_00470e1c(int param_1,char *param_2)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_NumericDisplayInteger__004fb0cd,(char *)0x0);
  uVar2 = 0xffffffff;
  do {
    pcVar4 = param_2;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar4 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar4;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar4 + -uVar2;
  pcVar5 = local_54;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb0e5);
  FUN_004448bc(param_1,local_54);
  FUN_004701d4(*(int *)(param_1 + 0x90),local_54);
  return;
}



/* @00470eb0 file=? name=FUN_00470eb0 */

void __cdecl FUN_00470eb0(int param_1)

{
  FUN_004703f4(*(int *)(param_1 + 0x90));
  return;
}



/* @00470ec8 file=? name=FUN_00470ec8 */

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

{
  FUN_00470414(*(int *)(param_1 + 0x90),param_2,param_3);
  return;
}



/* @00470ee8 file=? name=FUN_00470ee8 */

void __cdecl FUN_00470ee8(int param_1)

{
  FUN_00470430(*(int **)(param_1 + 0x90),(int *)(param_1 + 0x48),(float)*(int *)(param_1 + 0x94));
  return;
}



/* @00470f10 file=? name=FUN_00470f10 */

undefined4 __cdecl FUN_00470f10(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 *puVar3;
  
  iVar1 = FUN_00445034(&PTR_s_unsigned_004f5784,&DAT_004f6614);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    puVar3 = (undefined4 *)FUN_00402298(0x94);
    if (puVar3 != (undefined4 *)0x0) {
      FUN_00470fe8(puVar3,DAT_004f64c0,DAT_004f6504,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004f6548,param_3 + DAT_004f654c,&DAT_004f658c,DAT_004f65d0,iVar1,
                   DAT_004f6658,DAT_004f669c,s_DigitalClock_004fade8);
    }
    iVar1 = *(int *)(param_5 + 0x4c) + 4;
    puVar3 = FUN_00442aec(iVar1,&DAT_004f658c,0);
    if (puVar3 == (undefined4 *)0x0) {
      uVar2 = 0;
    }
    else {
      FUN_00442c12(iVar1,&DAT_004f658c);
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00470fe8 file=? name=FUN_00470fe8 */

undefined4 * __cdecl
FUN_00470fe8(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,
            undefined4 param_10,char *param_11,uint param_12,int param_13,int param_14,int param_15,
            undefined4 param_16)

{
  int *piVar1;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_16);
  *param_1 = &PTR_FUN_004fba74;
  piVar1 = (int *)FUN_00402298(0x44);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004700bc(piVar1,*(int *)(param_4 + 0x4c),0,0,param_11,param_12,param_13,param_14,
                          param_15);
  }
  param_1[0x24] = piVar1;
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  return param_1;
}



/* @0047107c file=? name=FUN_0047107c */

void __cdecl FUN_0047107c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fba74;
    if ((int *)param_1[0x24] != (int *)0x0) {
      FUN_0047018c((int *)param_1[0x24],3);
      param_1[0x24] = 0;
    }
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004710c8 file=? name=FUN_004710c8 */

void FUN_004710c8(void)

{
  FUN_004448ac();
  return;
}



/* @004710d8 file=? name=FUN_004710d8 */

void __cdecl FUN_004710d8(int param_1,char *param_2)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  undefined8 uVar6;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_DigitalClock__004fb0f6,(char *)0x0);
  uVar2 = 0xffffffff;
  do {
    pcVar4 = param_2;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar4 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar4;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar4 + -uVar2;
  pcVar5 = local_54;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb105);
  uVar2 = *(uint *)(param_1 + 0x90);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_numericDisplay__004fb109,(char *)0x0);
  uVar6 = FUN_004dbd4c(&DAT_00524e20,uVar2);
  FUN_004dbb24((int *)uVar6,&DAT_004fb119,(char *)0x0);
  FUN_004443b4(param_1,local_54);
  FUN_004701d4(*(int *)(param_1 + 0x90),local_54);
  return;
}



/* @004711b8 file=? name=FUN_004711b8 */

void __cdecl FUN_004711b8(int param_1)

{
  FUN_004703f4(*(int *)(param_1 + 0x90));
  return;
}



/* @004711d0 file=? name=FUN_004711d0 */

void __cdecl FUN_004711d0(int param_1)

{
  FUN_00470430(*(int **)(param_1 + 0x90),(int *)(param_1 + 0x48),*(float *)(DAT_004efc94 + 0x58));
  return;
}



/* @004711fc file=? name=FUN_004711fc */

undefined4 FUN_004711fc(void)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  int iVar7;
  int *piVar8;
  int in_stack_00000014;
  
  iVar4 = FUN_00445034(&PTR_s_native_004f575c,&DAT_004f6a18);
  if (iVar4 < 0) {
    FUN_004dbb24(&DAT_00524e20,s_configure_palette_ID___004fb11b,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004f6a18,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___NOT_FOUND_004fb132,(char *)0x0);
    uVar5 = 0;
  }
  else {
    iVar6 = FUN_00445034(&PTR_DAT_004f5704,&DAT_004f6a5c);
    iVar3 = DAT_004f69d4;
    uVar5 = DAT_004f6990;
    iVar2 = DAT_004f6908;
    if (iVar6 < 0) {
      FUN_004dbb24(&DAT_00524e20,s_configure_enable_ID___004fb13f,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,&DAT_004f6a5c,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s___NOT_FOUND_004fb155,(char *)0x0);
      uVar5 = 0;
    }
    else {
      iVar7 = FUN_004d4b58(&DAT_004f6aa0,&DAT_004fb162);
      iVar1 = *(int *)(in_stack_00000014 + 0x4c);
      if (iVar7 != 0) {
        piVar8 = FUN_00442f6a(iVar1 + 0x3c,&DAT_004f6aa0,0);
        if (piVar8 == (int *)0x0) {
          FUN_004dbb24(&DAT_00524e20,s_MakeConfig_missing_palette___004fb167,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,&DAT_004f6aa0,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,&DAT_004fb184,(char *)0x0);
          return 0;
        }
      }
      else {
        piVar8 = (int *)0x0;
      }
      FUN_0046fdd0(in_stack_00000014,iVar2,&DAT_004f694c,uVar5,iVar3,iVar4,iVar6,(int)piVar8);
      if (iVar7 != 0) {
        FUN_00443090(iVar1 + 0x3c,&DAT_004f6aa0);
      }
      uVar5 = 1;
    }
  }
  return uVar5;
}



/* @004713e0 file=? name=FUN_004713e0 */

undefined4 FUN_004713e0(void)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  undefined4 *puVar4;
  int in_stack_00000014;
  
  iVar1 = FUN_00445034(&PTR_s_native_004f575c,&DAT_004f7220);
  if (iVar1 < 0) {
    FUN_004dbb24(&DAT_00524e20,s_reconfigure_palette_ID___004fb1af,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004f7220,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___NOT_FOUND_004fb1c8,(char *)0x0);
    uVar2 = 0;
  }
  else {
    iVar3 = FUN_00445034(&PTR_DAT_004f5704,&DAT_004f7264);
    if (iVar3 < 0) {
      FUN_004dbb24(&DAT_00524e20,s_reconfigure_enable_ID___004fb1d5,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,&DAT_004f7264,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s___NOT_FOUND_004fb1ed,(char *)0x0);
      uVar2 = 0;
    }
    else {
      puVar4 = (undefined4 *)FUN_00402298(0x38);
      if (puVar4 == (undefined4 *)0x0) {
        puVar4 = (undefined4 *)0x0;
      }
      else {
        puVar4 = FUN_00471568(puVar4,DAT_004f7198,in_stack_00000014,DAT_004f71dc,iVar1,iVar3,
                              &DAT_004f72a8,s_BackgroundReconfig_004fae02);
      }
      if (puVar4[9] == 0) {
        iVar1 = *(int *)(in_stack_00000014 + 0x4c) + 4;
        puVar4 = FUN_00442aec(iVar1,&DAT_004f72a8,0);
        if (puVar4 == (undefined4 *)0x0) {
          FUN_004dbb24(&DAT_00524e20,s_BackgroundReconfig_missing_palet_004fb1fa,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,&DAT_004f72a8,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,&DAT_004fb21f,(char *)0x0);
          return 0;
        }
        FUN_00442c12(iVar1,&DAT_004f72a8);
      }
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00471568 file=? name=FUN_00471568 */

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

{
  char *pcVar1;
  int iVar2;
  
  FUN_004440a8(param_1,param_2,param_3,0,param_8);
  *param_1 = &PTR_FUN_004fba40;
  param_1[10] = param_4;
  param_1[0xb] = param_5;
  param_1[0xc] = param_6;
  pcVar1 = (char *)FUN_004700ac(param_7);
  param_1[0xd] = pcVar1;
  iVar2 = FUN_004d4b58(pcVar1,&DAT_004fb222);
  param_1[9] = (uint)(iVar2 == 0);
  if ((iVar2 == 0) == 0) {
    FUN_00442f6a(*(int *)(param_3 + 0x4c) + 0x3c,(char *)param_1[0xd],0);
  }
  return param_1;
}



/* @004715f0 file=? name=FUN_004715f0 */

void __cdecl FUN_004715f0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fba40;
    if (param_1[9] == 0) {
      FUN_00443090(*(int *)(param_1[7] + 0x4c) + 0x3c,(char *)param_1[0xd]);
    }
    FUN_004022e8((int *)param_1[0xd]);
    param_1[0xd] = 0;
    FUN_00443f7c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00471648 file=? name=FUN_00471648 */

void __cdecl FUN_00471648(int param_1)

{
  int iVar1;
  int *piVar2;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  if (*(int *)(param_1 + 0x24) == 0) {
    piVar2 = FUN_00442f6a(iVar1 + 0x3c,*(char **)(param_1 + 0x34),0);
  }
  else {
    piVar2 = (int *)0x0;
  }
  FUN_0046fe70(*(int *)(param_1 + 0x1c),*(int *)(param_1 + 0x28),*(undefined4 *)(param_1 + 0x2c),
               *(undefined4 *)(param_1 + 0x30),(int)piVar2);
  if (*(int *)(param_1 + 0x24) == 0) {
    FUN_00443090(iVar1 + 0x3c,*(char **)(param_1 + 0x34));
  }
  return;
}



/* @004716a8 file=? name=FUN_004716a8 */

undefined4 __cdecl FUN_004716a8(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x80);
  if (puVar1 != (undefined4 *)0x0) {
    FUN_00471710(puVar1,DAT_004f75e0,param_5,0,param_1,DAT_004f7624,param_2,param_3,
                 param_2 + DAT_004f7668,param_3 + DAT_004f766c,DAT_004f76ac,
                 s_BackgroundLine_004fae15);
  }
  return 1;
}



/* @00471710 file=? name=FUN_00471710 */

undefined4 * __cdecl
FUN_00471710(undefined4 *param_1,undefined4 param_2,int param_3,undefined4 param_4,int param_5,
            undefined4 param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,
            undefined4 param_10,undefined4 param_11,undefined4 param_12)

{
  FUN_004440d4(param_1,param_2,param_3,param_4,param_5,param_12);
  *param_1 = &PTR_FUN_004fba0c;
  FUN_00407b9c(param_1 + 0x1c);
  param_1[0x1c] = param_7;
  param_1[0x1d] = param_8;
  param_1[0x1e] = param_9;
  param_1[0x1f] = param_10;
  param_1[0x1b] = param_6;
  (**(code **)(param_1[9] + 0x18))(param_1 + 9,param_11);
  return param_1;
}



/* @00471778 file=? name=FUN_00471778 */

void __cdecl FUN_00471778(int param_1)

{
  int iVar1;
  
  iVar1 = param_1 + 0x24;
  (**(code **)(*(int *)(param_1 + 0x24) + 0x24))
            (iVar1,*(undefined4 *)(param_1 + 0x70),*(undefined4 *)(param_1 + 0x74));
  if (*(int *)(param_1 + 0x6c) == 0) {
    (**(code **)(*(int *)(param_1 + 0x24) + 0x30))
              (iVar1,*(undefined4 *)(param_1 + 0x78),*(undefined4 *)(param_1 + 0x7c));
  }
  else {
    (**(code **)(*(int *)(param_1 + 0x24) + 0x38))
              (iVar1,*(undefined4 *)(param_1 + 0x78),*(undefined4 *)(param_1 + 0x7c));
  }
  return;
}



/* @004717c8 file=? name=FUN_004717c8 */

undefined4 __cdecl FUN_004717c8(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x7c);
  if (puVar1 != (undefined4 *)0x0) {
    FUN_00471820(puVar1,DAT_004f7a28,param_5,0,param_1,param_2,param_3,param_2 + DAT_004f7a6c,
                 param_3 + DAT_004f7a70,DAT_004f7ab0,s_BackgroundRect_004fae24);
  }
  return 1;
}



/* @00471820 file=? name=FUN_00471820 */

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

{
  FUN_004440d4(param_1,param_2,param_3,param_4,param_5,param_11);
  *param_1 = &PTR_FUN_004fb9d8;
  FUN_00407b9c(param_1 + 0x1b);
  param_1[0x1b] = param_6;
  param_1[0x1c] = param_7;
  param_1[0x1d] = param_9;
  param_1[0x1e] = param_8;
  (**(code **)(param_1[9] + 0x18))(param_1 + 9,param_10);
  return param_1;
}



/* @00471884 file=? name=FUN_00471884 */

void __cdecl FUN_00471884(int param_1)

{
  (**(code **)(*(int *)(param_1 + 0x24) + 0x24))
            (param_1 + 0x24,*(undefined4 *)(param_1 + 0x6c),*(undefined4 *)(param_1 + 0x70));
  (**(code **)(*(int *)(param_1 + 0x24) + 0x40))
            (param_1 + 0x24,*(undefined4 *)(param_1 + 0x74),*(undefined4 *)(param_1 + 0x78));
  return;
}



/* @004718b8 file=? name=FUN_004718b8 */

undefined4 __cdecl FUN_004718b8(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  undefined4 *puVar1;
  int *piVar2;
  
  puVar1 = (undefined4 *)FUN_00402298(0x7c);
  if (puVar1 == (undefined4 *)0x0) {
    piVar2 = (int *)0x0;
  }
  else {
    piVar2 = FUN_0047193c(puVar1,DAT_004f7e70,param_5,0,param_1,param_2,param_3,
                          param_2 + DAT_004f7eb4,param_3 + DAT_004f7eb8,DAT_004f7ef8,
                          s_BackgroundFilledRect_004fae33);
  }
  if (DAT_004f7e70 == -1) {
    (**(code **)(*piVar2 + 0xc))(piVar2);
    if (piVar2 != (int *)0x0) {
      (**(code **)*piVar2)(piVar2,3);
    }
  }
  return 1;
}



/* @0047193c file=? name=FUN_0047193c */

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

{
  FUN_004440d4(param_1,param_2,param_3,param_4,param_5,param_11);
  *param_1 = &PTR_FUN_004fb9a4;
  FUN_00407b9c(param_1 + 0x1b);
  param_1[0x1b] = param_6;
  param_1[0x1c] = param_7;
  param_1[0x1d] = param_9;
  param_1[0x1e] = param_8;
  (**(code **)(param_1[9] + 0x18))(param_1 + 9,param_10);
  return param_1;
}



/* @004719a0 file=? name=FUN_004719a0 */

void __cdecl FUN_004719a0(int param_1)

{
  (**(code **)(*(int *)(param_1 + 0x24) + 0x24))
            (param_1 + 0x24,*(undefined4 *)(param_1 + 0x6c),*(undefined4 *)(param_1 + 0x70));
  (**(code **)(*(int *)(param_1 + 0x24) + 0x48))
            (param_1 + 0x24,*(undefined4 *)(param_1 + 0x74),*(undefined4 *)(param_1 + 0x78));
  return;
}



/* @004719d4 file=? name=FUN_004719d4 */

undefined4 __cdecl
FUN_004719d4(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar3;
  int *piVar4;
  undefined4 uVar5;
  
  puVar2 = (undefined4 *)FUN_00402298(0x74);
  if (puVar2 == (undefined4 *)0x0) {
    piVar3 = (int *)0x0;
  }
  else {
    piVar3 = FUN_00471abc(puVar2,DAT_004f82b8,param_5,0,param_1,param_2,param_3,&DAT_004f82fc,
                          DAT_004f8340,s_BackgroundPixelmap_004fae48);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  piVar4 = FUN_00442d2b(iVar1 + 0x20,&DAT_004f82fc,0);
  if (piVar4 == (int *)0x0) {
    FUN_004dbb24(&DAT_00524e20,s_BackgroundPixelmap__Missing_imag_004fb24d,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004f82fc,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004fb271,(char *)0x0);
    uVar5 = 0;
  }
  else {
    FUN_00442e51(iVar1 + 0x20,&DAT_004f82fc);
    if (DAT_004f82b8 == -1) {
      (**(code **)(*piVar3 + 0xc))(piVar3);
      if (piVar3 != (int *)0x0) {
        (**(code **)*piVar3)(piVar3,3);
      }
    }
    uVar5 = 1;
  }
  return uVar5;
}



/* @00471abc file=? name=FUN_00471abc */

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

{
  undefined4 uVar1;
  
  FUN_004440d4(param_1,param_2,param_3,param_4,param_5,param_10);
  *param_1 = &PTR_FUN_004fb970;
  uVar1 = FUN_004700ac(param_8);
  param_1[0x1b] = uVar1;
  param_1[0x1c] = param_9;
  (**(code **)(param_1[9] + 0x10))(param_1 + 9,param_6,param_7);
  FUN_00442d2b(*(int *)(param_3 + 0x4c) + 0x20,(char *)param_1[0x1b],0);
  return param_1;
}



/* @00471b2c file=? name=FUN_00471b2c */

void __cdecl FUN_00471b2c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb970;
    FUN_00442e51(*(int *)(param_1[7] + 0x4c) + 0x20,(char *)param_1[0x1b]);
    FUN_004022e8((int *)param_1[0x1b]);
    param_1[0x1b] = 0;
    FUN_0044ae0c(param_1 + 9,2);
    FUN_00443f7c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00471b8c file=? name=FUN_00471b8c */

void FUN_00471b8c(void)

{
  FUN_00443fa8();
  return;
}



/* @00471b9c file=? name=FUN_00471b9c */

void __cdecl FUN_00471b9c(int param_1)

{
  int iVar1;
  int *piVar2;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  piVar2 = FUN_00442d2b(iVar1 + 0x20,*(char **)(param_1 + 0x6c),0);
  if (piVar2 != (int *)0x0) {
    (**(code **)(*(int *)(param_1 + 0x24) + 0x24))(param_1 + 0x24,0,0);
    (**(code **)(*(int *)(param_1 + 0x24) + 0x5c))
              (param_1 + 0x24,*(undefined4 *)(param_1 + 0x70),0,piVar2,0,0,*piVar2 + -1,
               piVar2[1] + -1);
  }
  FUN_00442e51(iVar1 + 0x20,*(char **)(param_1 + 0x6c));
  return;
}



/* @00471c0c file=? name=FUN_00471c0c */

undefined4 __cdecl
FUN_00471c0c(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar3;
  undefined4 uVar4;
  
  puVar2 = (undefined4 *)FUN_00402298(0x7c);
  if (puVar2 == (undefined4 *)0x0) {
    piVar3 = (int *)0x0;
  }
  else {
    piVar3 = FUN_00471d00(puVar2,DAT_004f8700,param_5,0,param_1,param_2,param_3,&DAT_004f8744,
                          DAT_004f8788,DAT_004f87cc,DAT_004f8810,s_BackgroundBitmap_004fae5b);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  puVar2 = FUN_00442aec(iVar1 + 4,&DAT_004f8744,0);
  if (puVar2 == (undefined4 *)0x0) {
    FUN_004dbb24(&DAT_00524e20,s_BackgroundBitmap__Missing_image___004fb27c,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004f8744,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004fb29e,(char *)0x0);
    uVar4 = 0;
  }
  else {
    FUN_00442c12(iVar1 + 4,&DAT_004f8744);
    if (DAT_004f8700 == -1) {
      (**(code **)(*piVar3 + 0xc))(piVar3);
      if (piVar3 != (int *)0x0) {
        (**(code **)*piVar3)(piVar3,3);
      }
    }
    uVar4 = 1;
  }
  return uVar4;
}



/* @00471d00 file=? name=FUN_00471d00 */

undefined4 * __cdecl
FUN_00471d00(undefined4 *param_1,undefined4 param_2,int param_3,undefined4 param_4,int param_5,
            undefined4 param_6,undefined4 param_7,char *param_8,undefined4 param_9,
            undefined4 param_10,undefined4 param_11,undefined4 param_12)

{
  undefined4 uVar1;
  
  FUN_004440d4(param_1,param_2,param_3,param_4,param_5,param_12);
  *param_1 = &PTR_FUN_004fb93c;
  uVar1 = FUN_004700ac(param_8);
  param_1[0x1b] = uVar1;
  param_1[0x1e] = param_9;
  param_1[0x1c] = param_10;
  param_1[0x1d] = param_11;
  (**(code **)(param_1[9] + 0x10))(param_1 + 9,param_6,param_7);
  FUN_00442aec(*(int *)(param_3 + 0x4c) + 4,(char *)param_1[0x1b],0);
  return param_1;
}



/* @00471d7c file=? name=FUN_00471d7c */

void __cdecl FUN_00471d7c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb93c;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x1b]);
    FUN_004022e8((int *)param_1[0x1b]);
    param_1[0x1b] = 0;
    FUN_0044ae0c(param_1 + 9,2);
    FUN_00443f7c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00471ddc file=? name=FUN_00471ddc */

void FUN_00471ddc(void)

{
  FUN_00443fa8();
  return;
}



/* @00471dec file=? name=FUN_00471dec */

void __cdecl FUN_00471dec(int param_1)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  
  iVar2 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  puVar3 = FUN_00442aec(iVar2 + 4,*(char **)(param_1 + 0x6c),0);
  if (puVar3 != (undefined4 *)0x0) {
    iVar1 = param_1 + 0x24;
    (**(code **)(*(int *)(param_1 + 0x24) + 0x24))(iVar1,0,0);
    (**(code **)(*(int *)(param_1 + 0x24) + 0x18))(iVar1,*(undefined4 *)(param_1 + 0x70));
    if (*(int *)(param_1 + 0x78) == 0) {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x54))
                (iVar1,0,puVar3,0,0,puVar3[3] + -1,puVar3[4] + -1);
    }
    else {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x58))
                (iVar1,*(undefined4 *)(param_1 + 0x74),0,puVar3,0,0,puVar3[3] + -1,puVar3[4] + -1);
    }
  }
  FUN_00442e51(iVar2 + 0x20,*(char **)(param_1 + 0x6c));
  return;
}



/* @00471e9c file=? name=FUN_00471e9c */

bool __cdecl FUN_00471e9c(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 *puVar2;
  
  puVar2 = (undefined4 *)FUN_00402298(0xa8);
  if (puVar2 != (undefined4 *)0x0) {
    FUN_00471f30(puVar2,DAT_004f8b48,DAT_004f8b8c,param_5,0,param_1,param_2,param_3,&DAT_004f8bd0,
                 DAT_004f8c14,DAT_004f8c58,s_RankAndScore_004fadf5);
  }
  iVar1 = *(int *)(param_5 + 0x4c) + 4;
  puVar2 = FUN_00442aec(iVar1,&DAT_004f8bd0,0);
  if (puVar2 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1,&DAT_004f8bd0);
  }
  return puVar2 != (undefined4 *)0x0;
}



/* @00471f30 file=? name=FUN_00471f30 */

undefined4 * __cdecl
FUN_00471f30(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,int param_7,int param_8,char *param_9,int param_10,
            int param_11,undefined4 param_12)

{
  int *piVar1;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_12);
  *param_1 = &PTR_FUN_004fb8f8;
  piVar1 = (int *)FUN_00402298(0x44);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004700bc(piVar1,*(int *)(param_4 + 0x4c),2,2,param_9,1,0,param_11,param_10);
  }
  param_1[0x24] = piVar1;
  piVar1 = (int *)FUN_00402298(0x44);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004700bc(piVar1,*(int *)(param_4 + 0x4c),0xc,2,param_9,8,2,param_11,param_10);
  }
  param_1[0x25] = piVar1;
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_7 + 0x40,param_8 + 0xd);
  param_1[0x26] = 0;
  param_1[0x28] = param_10;
  param_1[0x29] = param_11;
  return param_1;
}



/* @00472020 file=? name=FUN_00472020 */

void __cdecl FUN_00472020(int *param_1,byte param_2)

{
  uint uVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb8f8;
    if (param_1[0x26] != 0) {
      uVar1 = FUN_004dcd94();
      FUN_004dbb24(&DAT_00524e20,s__RankAndScore__I_think_my_score_i_004fb2ad,(char *)0x0);
      piVar2 = FUN_004db78c(&DAT_00524e20,uVar1);
      FUN_004dbb24(piVar2,&DAT_004fb2d1,(char *)0x0);
    }
    if ((int *)param_1[0x24] != (int *)0x0) {
      FUN_0047018c((int *)param_1[0x24],3);
      param_1[0x24] = 0;
    }
    if ((int *)param_1[0x25] != (int *)0x0) {
      FUN_0047018c((int *)param_1[0x25],3);
      param_1[0x25] = 0;
    }
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004720e0 file=? name=FUN_004720e0 */

void FUN_004720e0(void)

{
  FUN_004448ac();
  return;
}



/* @004720f0 file=? name=FUN_004720f0 */

void FUN_004720f0(void)

{
  return;
}



/* @004720f8 file=? name=FUN_004720f8 */

void __cdecl FUN_004720f8(int param_1)

{
  *(undefined4 *)(param_1 + 0x9c) = 0;
  FUN_004703f4(*(int *)(param_1 + 0x90));
  FUN_004703f4(*(int *)(param_1 + 0x94));
  return;
}



/* @00472124 file=? name=FUN_00472124 */

void __cdecl FUN_00472124(int param_1)

{
  FUN_00470758(*(int *)(param_1 + 0x90),(int *)(param_1 + 0x48));
  FUN_00470758(*(int *)(param_1 + 0x94),(int *)(param_1 + 0x48));
  FUN_004dbb24(&DAT_00524e20,s_Erasing_rank_and_score_004fb2d3,(char *)0x0);
  FUN_004d9c38(&DAT_00524e20);
  FUN_00444004();
  return;
}



/* @0047217c file=? name=FUN_0047217c */

void __cdecl FUN_0047217c(int param_1,undefined4 param_2)

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



/* @00472190 file=? name=FUN_00472190 */

void __cdecl FUN_00472190(int param_1)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  
  uVar3 = (uint)(*(int *)(DAT_004efc94 + 0x88) == 5);
  if ((uVar3 != *(uint *)(param_1 + 0x9c)) && (*(uint *)(param_1 + 0x9c) = uVar3, uVar3 == 1)) {
    iVar1 = param_1 + 0x48;
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar1,*(undefined4 *)(param_1 + 0xa4));
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,1,1);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x48))(iVar1,0x3e,0xb);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar1,*(undefined4 *)(param_1 + 0xa0));
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,0,0);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x40))(iVar1,0x3f,0xc);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,10,0);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x30))(iVar1,10,0xc);
  }
  if ((uVar3 == 1) && (*(int *)(param_1 + 0x98) != 0)) {
    iVar1 = *(int *)(*(int *)(param_1 + 0x98) + 400);
    iVar2 = FUN_004dcd94();
    FUN_00470430(*(int **)(param_1 + 0x90),(int *)(param_1 + 0x48),
                 (float)(*(int *)(iVar1 + 0x1cc) + 1));
    FUN_00470430(*(int **)(param_1 + 0x94),(int *)(param_1 + 0x48),(float)iVar2);
  }
  return;
}



/* @004722b0 file=? name=FUN_004722b0 */

undefined4 * __cdecl
FUN_004722b0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,int param_7,int param_8,int param_9,int param_10,
            undefined4 param_11,float param_12,float param_13,undefined4 param_14)

{
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_14);
  *param_1 = &PTR_FUN_004fb8ac;
  FUN_00407b9c(param_1 + 0x28);
  param_1[0x25] = (param_9 - param_7) + -1;
  param_1[0x26] = (param_10 - param_8) + -1;
  param_1[0x27] = 0xfffffb2e;
  param_1[0x28] = 1;
  param_1[0x2a] = 0;
  param_1[0x24] = param_11;
  param_1[0x2c] = param_12;
  param_1[0x2e] = param_13 - param_12;
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  return param_1;
}



/* @00472364 file=? name=FUN_00472364 */

void __cdecl FUN_00472364(int *param_1,byte param_2)

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



/* @00472390 file=? name=FUN_00472390 */

void FUN_00472390(void)

{
  FUN_004448ac();
  return;
}



/* @004723a0 file=? name=FUN_004723a0 */

void __cdecl FUN_004723a0(int param_1,char *param_2)

{
  char cVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  char *pcVar5;
  char *pcVar6;
  uint *puVar7;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_WipeGaugeScalar__004fb2eb,(char *)0x0);
  uVar3 = 0xffffffff;
  do {
    pcVar5 = param_2;
    if (uVar3 == 0) break;
    uVar3 = uVar3 - 1;
    pcVar5 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar5;
  } while (cVar1 != '\0');
  uVar3 = ~uVar3;
  pcVar5 = pcVar5 + -uVar3;
  pcVar6 = local_54;
  for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
    *pcVar6 = *pcVar5;
    pcVar5 = pcVar5 + 1;
    pcVar6 = pcVar6 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb2fd);
  puVar7 = (uint *)(param_1 + 0xa0);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_previousSize___004fb301,(char *)0x0);
  piVar2 = (int *)FUN_00407d78(&DAT_00524e20,puVar7);
  FUN_004dbb24(piVar2,&DAT_004fb315,(char *)0x0);
  FUN_004448bc(param_1,local_54);
  return;
}



/* @0047246c file=? name=FUN_0047246c */

void __cdecl FUN_0047246c(int param_1)

{
  *(undefined4 *)(param_1 + 0xbc) = 1;
  return;
}



/* @00472480 file=? name=FUN_00472480 */

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

void __cdecl FUN_00472480(int *param_1)

{
  bool bVar1;
  int iVar2;
  int iVar3;
  int local_18;
  int local_14;
  int local_10;
  int local_c;
  float local_8;
  
  FUN_00407b9c(&local_18);
  if ((float)param_1[0x2d] < (float)param_1[0x2c]) {
    param_1[0x2d] = param_1[0x2c];
  }
  param_1[0x2d] = (int)((float)param_1[0x2d] - (float)param_1[0x2c]);
  if ((float)param_1[0x2e] < (float)param_1[0x2d]) {
    param_1[0x2d] = param_1[0x2e];
  }
  local_8 = (float)param_1[0x2d] / (float)param_1[0x2e];
  if (local_8 <= _DAT_00472a9c) {
    if (local_8 < _DAT_00472aa0) {
      local_8 = -1.0;
    }
  }
  else {
    local_8 = 1.0;
  }
  iVar3 = param_1[0x24];
  if (iVar3 == 0) {
    iVar3 = param_1[0x25];
    iVar2 = FUN_004dcd94();
    iVar3 = iVar3 - iVar2;
    if (param_1[0x2f] == 0) {
      local_18 = param_1[0x27];
      if (local_18 < iVar3) {
        local_10 = iVar3 + -1;
        local_c = param_1[0x26];
        local_14 = 0;
        bVar1 = true;
        if ((local_18 <= local_10) && (-1 < local_c)) {
          bVar1 = false;
        }
        if (!bVar1) {
          (**(code **)(*param_1 + 0x48))(param_1,&local_18);
        }
        param_1[0x27] = iVar3;
      }
      else if (iVar3 < param_1[0x27]) {
        local_10 = param_1[0x27] + -1;
        bVar1 = true;
        local_c = param_1[0x26];
        local_14 = 0;
        if ((iVar3 <= local_10) && (-1 < local_c)) {
          bVar1 = false;
        }
        if (!bVar1) {
          local_18 = iVar3;
          (**(code **)(*param_1 + 0x44))(param_1,&local_18);
        }
        param_1[0x27] = iVar3;
      }
    }
    else {
      param_1[0x2f] = 0;
      local_10 = param_1[0x25];
      bVar1 = true;
      local_c = param_1[0x26];
      local_14 = 0;
      if ((iVar3 <= local_10) && (-1 < local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        local_18 = iVar3;
        (**(code **)(*param_1 + 0x44))(param_1,&local_18);
      }
      local_10 = iVar3 + -1;
      local_18 = 0;
      bVar1 = true;
      if ((-1 < local_10) && (local_14 <= local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        (**(code **)(*param_1 + 0x48))(param_1,&local_18);
      }
      param_1[0x27] = iVar3;
    }
  }
  else if (iVar3 == 1) {
    iVar3 = param_1[0x26];
    iVar2 = FUN_004dcd94();
    iVar3 = iVar3 - iVar2;
    if (param_1[0x2f] == 0) {
      local_14 = param_1[0x27];
      if (local_14 < iVar3) {
        local_10 = param_1[0x25];
        local_c = iVar3 + 1;
        local_18 = 0;
        bVar1 = true;
        if ((-1 < local_10) && (local_14 <= local_c)) {
          bVar1 = false;
        }
        if (!bVar1) {
          (**(code **)(*param_1 + 0x48))(param_1,&local_18);
        }
        param_1[0x27] = iVar3;
      }
      else if (iVar3 < param_1[0x27]) {
        local_10 = param_1[0x25];
        local_c = param_1[0x27] + 1;
        bVar1 = true;
        local_18 = 0;
        if ((-1 < local_10) && (iVar3 <= local_c)) {
          bVar1 = false;
        }
        if (!bVar1) {
          local_14 = iVar3;
          (**(code **)(*param_1 + 0x44))(param_1,&local_18);
        }
        param_1[0x27] = iVar3;
      }
    }
    else {
      param_1[0x2f] = 0;
      local_10 = param_1[0x25];
      bVar1 = true;
      local_c = param_1[0x26];
      local_18 = 0;
      if ((-1 < local_10) && (iVar3 <= local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        local_14 = iVar3;
        (**(code **)(*param_1 + 0x44))(param_1,&local_18);
      }
      local_c = iVar3 + -1;
      local_14 = 0;
      bVar1 = true;
      if ((local_18 <= local_10) && (-1 < local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        (**(code **)(*param_1 + 0x48))(param_1,&local_18);
      }
      param_1[0x27] = iVar3;
    }
  }
  else if (iVar3 == 2) {
    iVar3 = FUN_004dcd94();
    local_10 = iVar3;
    if (param_1[0x2f] == 0) {
      if (param_1[0x27] < iVar3) {
        local_18 = param_1[0x27] + 1;
        local_c = param_1[0x26];
        local_14 = 0;
        bVar1 = true;
        if ((local_18 <= iVar3) && (-1 < local_c)) {
          bVar1 = false;
        }
        if (!bVar1) {
          (**(code **)(*param_1 + 0x44))(param_1,&local_18);
        }
        param_1[0x27] = iVar3;
      }
      else {
        local_10 = param_1[0x27];
        if (iVar3 < local_10) {
          local_18 = iVar3 + 1;
          local_c = param_1[0x26];
          local_14 = 0;
          bVar1 = true;
          if ((local_18 <= local_10) && (-1 < local_c)) {
            bVar1 = false;
          }
          if (!bVar1) {
            (**(code **)(*param_1 + 0x48))(param_1,&local_18);
          }
          param_1[0x27] = iVar3;
        }
      }
    }
    else {
      param_1[0x2f] = 0;
      local_c = param_1[0x26];
      local_18 = 0;
      local_14 = 0;
      bVar1 = true;
      if ((-1 < iVar3) && (-1 < local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        (**(code **)(*param_1 + 0x44))(param_1,&local_18);
      }
      local_10 = param_1[0x25];
      local_18 = iVar3 + 1;
      bVar1 = true;
      if ((local_18 <= local_10) && (local_14 <= local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        (**(code **)(*param_1 + 0x48))(param_1,&local_18);
      }
      param_1[0x27] = iVar3;
    }
  }
  else if (iVar3 == 3) {
    iVar3 = FUN_004dcd94();
    local_c = iVar3;
    if (param_1[0x2f] == 0) {
      local_14 = param_1[0x27];
      if (local_14 < iVar3) {
        local_10 = param_1[0x25];
        local_18 = 0;
        bVar1 = true;
        if ((-1 < local_10) && (local_14 <= iVar3)) {
          bVar1 = false;
        }
        if (!bVar1) {
          (**(code **)(*param_1 + 0x44))(param_1,&local_18);
        }
        param_1[0x27] = iVar3;
      }
      else {
        local_c = param_1[0x27];
        if (iVar3 < local_c) {
          local_10 = param_1[0x25];
          local_18 = 0;
          bVar1 = true;
          if ((-1 < local_10) && (iVar3 <= local_c)) {
            bVar1 = false;
          }
          if (!bVar1) {
            local_14 = iVar3;
            (**(code **)(*param_1 + 0x48))(param_1,&local_18);
          }
          param_1[0x27] = iVar3;
        }
      }
    }
    else {
      param_1[0x2f] = 0;
      local_10 = param_1[0x25];
      local_18 = 0;
      local_14 = 0;
      bVar1 = true;
      if ((-1 < local_10) && (-1 < iVar3)) {
        bVar1 = false;
      }
      if (!bVar1) {
        (**(code **)(*param_1 + 0x44))(param_1,&local_18);
      }
      local_c = param_1[0x26];
      local_14 = iVar3 + 1;
      bVar1 = true;
      if ((local_18 <= local_10) && (local_14 <= local_c)) {
        bVar1 = false;
      }
      if (!bVar1) {
        (**(code **)(*param_1 + 0x48))(param_1,&local_18);
      }
      param_1[0x27] = iVar3;
    }
  }
  return;
}



/* @00472ac4 file=munga_l4/l4gauge.cpp name=FUN_00472ac4 */

void FUN_00472ac4(void)

{
  FUN_0040385c(s_WipeGaugeScalar__DrawInactive_is_004fb366,
               s_d__tesla_bt_munga_l4_L4GAUGE_CPP_004fb396,0xcb6);
  return;
}



/* @00472ae0 file=? name=FUN_00472ae0 */

undefined4 __cdecl FUN_00472ae0(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  
  iVar1 = FUN_00445034(&PTR_DAT_004f57b4,&DAT_004f90e4);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    piVar3 = (int *)FUN_00402298(200);
    if (piVar3 != (int *)0x0) {
      FUN_00472b88(piVar3,DAT_004f8f90,DAT_004f8fd4,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004f9018,param_3 + DAT_004f901c,DAT_004f905c,DAT_004f90a0,iVar1,
                   DAT_004f9128,DAT_004f916c,DAT_004f91b0,s_BarGraphSolidScalar_004fae7c);
    }
    uVar2 = 1;
  }
  return uVar2;
}



/* @00472b88 file=? name=FUN_00472b88 */

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

{
  undefined4 *puVar1;
  
  FUN_004722b0(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9,param_10,
               param_13,param_14,param_15,param_17);
  *param_1 = (int)&PTR_FUN_004fb860;
  param_1[0x30] = param_12;
  param_1[0x31] = param_11;
  if (param_16 != 0) {
    puVar1 = (undefined4 *)FUN_00402298(0x18);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00474855(puVar1,0,param_1 + 0x2d,param_16);
    }
    (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  }
  return param_1;
}



/* @00472c24 file=? name=FUN_00472c24 */

void __cdecl FUN_00472c24(int *param_1,byte param_2)

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



/* @00472c50 file=? name=FUN_00472c50 */

void FUN_00472c50(void)

{
  FUN_00472390();
  return;
}



/* @00472c60 file=? name=FUN_00472c60 */

void __cdecl FUN_00472c60(int param_1,char *param_2)

{
  char cVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  char *pcVar5;
  char *pcVar6;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_BarGraphSolidScalar__004fb3c0,(char *)0x0);
  uVar3 = 0xffffffff;
  do {
    pcVar5 = param_2;
    if (uVar3 == 0) break;
    uVar3 = uVar3 - 1;
    pcVar5 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar5;
  } while (cVar1 != '\0');
  uVar3 = ~uVar3;
  pcVar5 = pcVar5 + -uVar3;
  pcVar6 = local_54;
  for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
    *pcVar6 = *pcVar5;
    pcVar5 = pcVar5 + 1;
    pcVar6 = pcVar6 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb3d6);
  uVar3 = *(uint *)(param_1 + 0xc4);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_foregroundColor__004fb3da,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fb3eb,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0xc0);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_backgroundColor__004fb3ed,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fb3fe,(char *)0x0);
  FUN_004723a0(param_1,local_54);
  return;
}



/* @00472d78 file=? name=FUN_00472d78 */

void __cdecl FUN_00472d78(int param_1,undefined4 *param_2)

{
  int iVar1;
  
  iVar1 = param_1 + 0x48;
  (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar1,*(undefined4 *)(param_1 + 0xc4));
  (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,*param_2,param_2[1]);
  (**(code **)(*(int *)(param_1 + 0x48) + 0x48))(iVar1,param_2[2],param_2[3]);
  return;
}



/* @00472dc0 file=? name=FUN_00472dc0 */

void __cdecl FUN_00472dc0(int param_1,undefined4 *param_2)

{
  int iVar1;
  
  iVar1 = param_1 + 0x48;
  (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar1,*(undefined4 *)(param_1 + 0xc0));
  (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,*param_2,param_2[1]);
  (**(code **)(*(int *)(param_1 + 0x48) + 0x48))(iVar1,param_2[2],param_2[3]);
  return;
}



/* @00472e08 file=? name=FUN_00472e08 */

undefined4 __cdecl FUN_00472e08(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  undefined4 *puVar4;
  
  iVar1 = FUN_00445034(&PTR_DAT_004f57b4,&DAT_004f9570);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    piVar3 = (int *)FUN_00402298(0xcc);
    if (piVar3 != (int *)0x0) {
      FUN_00472ef0(piVar3,DAT_004f93d8,DAT_004f941c,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004f9460,param_3 + DAT_004f9464,&DAT_004f94a4,DAT_004f94e8,
                   DAT_004f952c,iVar1,DAT_004f95b4,DAT_004f95f8,DAT_004f963c,
                   s_BarGraphBitMapScalar_004fae90);
    }
    iVar1 = *(int *)(param_5 + 0x4c) + 4;
    puVar4 = FUN_00442aec(iVar1,&DAT_004f94a4,0);
    if (puVar4 == (undefined4 *)0x0) {
      uVar2 = 0;
    }
    else {
      FUN_00442c12(iVar1,&DAT_004f94a4);
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00472ef0 file=? name=FUN_00472ef0 */

int * __cdecl
FUN_00472ef0(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,int param_8,int param_9,int param_10,char *param_11,int param_12
            ,int param_13,undefined4 param_14,float param_15,float param_16,int param_17,
            undefined4 param_18)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_004722b0(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9,param_10,
               param_14,param_15,param_16,param_18);
  *param_1 = (int)&PTR_FUN_004fb814;
  iVar1 = FUN_004700ac(param_11);
  param_1[0x30] = iVar1;
  param_1[0x32] = param_13;
  param_1[0x31] = param_12;
  FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,(char *)param_1[0x30],0);
  if (param_17 != 0) {
    puVar2 = (undefined4 *)FUN_00402298(0x18);
    if (puVar2 == (undefined4 *)0x0) {
      puVar2 = (undefined4 *)0x0;
    }
    else {
      puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2d,param_17);
    }
    (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  }
  return param_1;
}



/* @00472fb4 file=? name=FUN_00472fb4 */

void __cdecl FUN_00472fb4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb814;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x30]);
    FUN_004022e8((int *)param_1[0x30]);
    param_1[0x30] = 0;
    FUN_00472364(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00473010 file=? name=FUN_00473010 */

void FUN_00473010(void)

{
  FUN_00472390();
  return;
}



/* @00473020 file=? name=FUN_00473020 */

void __cdecl FUN_00473020(int param_1,char *param_2)

{
  char cVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  char *pcVar5;
  char *pcVar6;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_BarGraphBitMapScalar__004fb40a,(char *)0x0);
  uVar3 = 0xffffffff;
  do {
    pcVar5 = param_2;
    if (uVar3 == 0) break;
    uVar3 = uVar3 - 1;
    pcVar5 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar5;
  } while (cVar1 != '\0');
  uVar3 = ~uVar3;
  pcVar5 = pcVar5 + -uVar3;
  pcVar6 = local_54;
  for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
    *pcVar6 = *pcVar5;
    pcVar5 = pcVar5 + 1;
    pcVar6 = pcVar6 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb421);
  pcVar5 = *(char **)(param_1 + 0xc0);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_bitMapName__004fb425,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,pcVar5,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,&DAT_004fb436,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 200);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_backgroundColor__004fb438,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fb449,(char *)0x0);
  FUN_004723a0(param_1,local_54);
  return;
}



/* @0047313c file=? name=FUN_0047313c */

void __cdecl FUN_0047313c(int param_1,undefined4 *param_2)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0xc0),0);
  if (puVar2 != (undefined4 *)0x0) {
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(param_1 + 0x48,*(undefined4 *)(param_1 + 0xc4));
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(param_1 + 0x48,*param_2,param_2[1]);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x58))
              (param_1 + 0x48,*(undefined4 *)(param_1 + 200),0,puVar2,*param_2,param_2[1],param_2[2]
               ,param_2[3]);
  }
  FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0xc0));
  return;
}



/* @004731d8 file=? name=FUN_004731d8 */

void __cdecl FUN_004731d8(int param_1,undefined4 *param_2)

{
  int iVar1;
  
  iVar1 = param_1 + 0x48;
  (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar1,*(undefined4 *)(param_1 + 200));
  (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,*param_2,param_2[1]);
  (**(code **)(*(int *)(param_1 + 0x48) + 0x48))(iVar1,param_2[2],param_2[3]);
  return;
}



/* @00473220 file=? name=FUN_00473220 */

undefined4 __cdecl FUN_00473220(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  undefined4 *puVar4;
  
  iVar1 = FUN_00445034(&PTR_DAT_004f57b4,&DAT_004f9974);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    piVar3 = (int *)FUN_00402298(200);
    if (piVar3 != (int *)0x0) {
      FUN_00473300(piVar3,DAT_004f9820,DAT_004f9864,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004f98a8,param_3 + DAT_004f98ac,&DAT_004f98ec,DAT_004f9930,iVar1,
                   DAT_004f99b8,DAT_004f99fc,DAT_004f9a40,s_BarGraphPixelMapScalar_004faea5);
    }
    iVar1 = *(int *)(param_5 + 0x4c) + 4;
    puVar4 = FUN_00442aec(iVar1,&DAT_004f98ec,0);
    if (puVar4 == (undefined4 *)0x0) {
      uVar2 = 0;
    }
    else {
      FUN_00442c12(iVar1,&DAT_004f98ec);
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00473300 file=? name=FUN_00473300 */

int * __cdecl
FUN_00473300(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,int param_8,int param_9,int param_10,char *param_11,int param_12
            ,undefined4 param_13,float param_14,float param_15,int param_16,undefined4 param_17)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_004722b0(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,param_9,param_10,
               param_13,param_14,param_15,param_17);
  *param_1 = (int)&PTR_FUN_004fb7c8;
  iVar1 = FUN_004700ac(param_11);
  param_1[0x30] = iVar1;
  param_1[0x31] = param_12;
  FUN_00442d2b(*(int *)(param_4 + 0x4c) + 0x20,(char *)param_1[0x30],0);
  if (param_16 != 0) {
    puVar2 = (undefined4 *)FUN_00402298(0x18);
    if (puVar2 == (undefined4 *)0x0) {
      puVar2 = (undefined4 *)0x0;
    }
    else {
      puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2d,param_16);
    }
    (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  }
  return param_1;
}



/* @004733b8 file=? name=FUN_004733b8 */

void __cdecl FUN_004733b8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb7c8;
    FUN_00442d2b(*(int *)(param_1[7] + 0x4c) + 0x20,(char *)param_1[0x30],0);
    FUN_004022e8((int *)param_1[0x30]);
    param_1[0x30] = 0;
    FUN_00472364(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00473414 file=? name=FUN_00473414 */

void FUN_00473414(void)

{
  FUN_00472390();
  return;
}



/* @00473424 file=? name=FUN_00473424 */

void __cdecl FUN_00473424(int param_1,char *param_2)

{
  char cVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  char *pcVar5;
  char *pcVar6;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_BarGraphPixelMapScalar__004fb454,(char *)0x0);
  uVar3 = 0xffffffff;
  do {
    pcVar5 = param_2;
    if (uVar3 == 0) break;
    uVar3 = uVar3 - 1;
    pcVar5 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar5;
  } while (cVar1 != '\0');
  uVar3 = ~uVar3;
  pcVar5 = pcVar5 + -uVar3;
  pcVar6 = local_54;
  for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
    *pcVar6 = *pcVar5;
    pcVar5 = pcVar5 + 1;
    pcVar6 = pcVar6 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb46d);
  pcVar5 = *(char **)(param_1 + 0xc0);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_pixelMapName__004fb471,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,pcVar5,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,&DAT_004fb482,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0xc4);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_backgroundColor__004fb484,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_004fb495,(char *)0x0);
  FUN_004723a0(param_1,local_54);
  return;
}



/* @00473540 file=? name=FUN_00473540 */

void __cdecl FUN_00473540(int param_1,undefined4 *param_2)

{
  int iVar1;
  int *piVar2;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  piVar2 = FUN_00442d2b(iVar1 + 0x20,*(char **)(param_1 + 0xc0),0);
  if (piVar2 != (int *)0x0) {
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(param_1 + 0x48,*param_2,param_2[1]);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x5c))
              (param_1 + 0x48,0,0,piVar2,*param_2,param_2[1],param_2[2],param_2[3]);
  }
  FUN_00442e51(iVar1 + 0x20,*(char **)(param_1 + 0xc0));
  return;
}



/* @004735c4 file=? name=FUN_004735c4 */

void __cdecl FUN_004735c4(int param_1,undefined4 *param_2)

{
  int iVar1;
  int *piVar2;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  piVar2 = FUN_00442d2b(iVar1 + 0x20,*(char **)(param_1 + 0xc0),0);
  if (piVar2 != (int *)0x0) {
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(param_1 + 0x48,*(undefined4 *)(param_1 + 0xc4));
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(param_1 + 0x48,*param_2,param_2[1]);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x60))
              (param_1 + 0x48,0,piVar2,*param_2,param_2[1],param_2[2],param_2[3]);
  }
  FUN_00442e51(iVar1 + 0x20,*(char **)(param_1 + 0xc0));
  return;
}



/* @00473658 file=? name=FUN_00473658 */

bool __cdecl
FUN_00473658(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 *puVar2;
  
  puVar2 = (undefined4 *)FUN_00402298(0xc0);
  if (puVar2 != (undefined4 *)0x0) {
    FUN_00473728(puVar2,DAT_004f9c68,DAT_004f9cac,param_5,0,param_1,param_2,param_3,&DAT_004f9cf0,
                 DAT_004f9d34,DAT_004f9d78,DAT_004f9dbc,DAT_004f9e00,DAT_004f9e44,DAT_004f9e88,
                 DAT_004f9ecc,DAT_004f9f10,DAT_004f9f54,DAT_004f9f98,DAT_004f9fdc,
                 s_ColorState_004faebc);
  }
  iVar1 = *(int *)(param_5 + 0x4c) + 4;
  puVar2 = FUN_00442aec(iVar1,&DAT_004f9cf0,0);
  if (puVar2 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1,&DAT_004f9cf0);
  }
  return puVar2 != (undefined4 *)0x0;
}



/* @00473728 file=? name=FUN_00473728 */

undefined4 * __cdecl
FUN_00473728(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,undefined4 param_8,char *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 param_18,int param_19,int *param_20,undefined4 param_21)

{
  char *pcVar1;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_21);
  *param_1 = &PTR_FUN_004fb784;
  pcVar1 = (char *)FUN_004700ac(param_9);
  param_1[0x2a] = pcVar1;
  FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,pcVar1,0);
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  param_1[0x25] = param_10;
  param_1[0x26] = param_12;
  param_1[0x27] = param_14;
  param_1[0x28] = param_16;
  param_1[0x29] = param_18;
  param_1[0x2c] = param_11;
  param_1[0x2d] = param_13;
  param_1[0x2e] = param_15;
  param_1[0x2f] = param_17;
  param_1[0x2b] = *(undefined4 *)(*param_20 + param_19 * 4);
  return param_1;
}



/* @004737fc file=? name=FUN_004737fc */

void __cdecl FUN_004737fc(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb784;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x2a]);
    FUN_004022e8((int *)param_1[0x2a]);
    param_1[0x2a] = 0;
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00473858 file=? name=FUN_00473858 */

undefined4 FUN_00473858(void)

{
  return 1;
}



/* @00473864 file=? name=FUN_00473864 */

void FUN_00473864(void)

{
  return;
}



/* @0047386c file=? name=FUN_0047386c */

void __cdecl FUN_0047386c(int param_1)

{
  *(undefined4 *)(param_1 + 0x90) = 0xffffffff;
  return;
}



/* @00473880 file=? name=FUN_00473880 */

void __cdecl FUN_00473880(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  float *pfVar3;
  int iVar4;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0xa8),0);
  if (puVar2 != (undefined4 *)0x0) {
    pfVar3 = (float *)(param_1 + 0xb0);
    iVar4 = 0;
    do {
      if (*(float *)(*(int *)(param_1 + 0xac) + 0x158) < *pfVar3) break;
      iVar4 = iVar4 + 1;
      pfVar3 = pfVar3 + 1;
    } while (iVar4 < 4);
    if (iVar4 != *(int *)(param_1 + 0x90)) {
      *(int *)(param_1 + 0x90) = iVar4;
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))
                (param_1 + 0x48,*(undefined4 *)(param_1 + 0x94 + iVar4 * 4));
      (**(code **)(*(int *)(param_1 + 0x48) + 0x54))
                (param_1 + 0x48,0,puVar2,0,0,puVar2[3] + -1,puVar2[4] + -1);
    }
  }
  FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0xa8));
  return;
}



/* @0047393c file=? name=FUN_0047393c */

bool __cdecl
FUN_0047393c(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  int *piVar2;
  undefined4 *puVar3;
  
  piVar2 = (int *)FUN_00402298(0xa4);
  if (piVar2 != (int *)0x0) {
    FUN_004739d8(piVar2,DAT_004fa0b0,DAT_004fa0f4,param_5,0,param_1,param_2,param_3,&DAT_004fa138,
                 DAT_004fa17c,DAT_004fa1c0,DAT_004fa204,s_TwoState_004faec7);
  }
  iVar1 = *(int *)(param_5 + 0x4c) + 4;
  puVar3 = FUN_00442aec(iVar1,&DAT_004fa138,0);
  if (puVar3 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1,&DAT_004fa138);
  }
  return puVar3 != (undefined4 *)0x0;
}



/* @004739d8 file=? name=FUN_004739d8 */

int * __cdecl
FUN_004739d8(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,char *param_9,int param_10,
            int param_11,undefined4 param_12,undefined4 param_13)

{
  char *pcVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_13);
  *param_1 = (int)&PTR_FUN_004fb740;
  pcVar1 = (char *)FUN_004700ac(param_9);
  param_1[0x28] = (int)pcVar1;
  FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,pcVar1,0);
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  param_1[0x25] = param_10;
  param_1[0x26] = param_11;
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_004749de(puVar2,0,param_1 + 0x27,param_12);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @00473a8c file=? name=FUN_00473a8c */

void __cdecl FUN_00473a8c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb740;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x28]);
    FUN_004022e8((int *)param_1[0x28]);
    param_1[0x28] = 0;
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00473ae8 file=? name=FUN_00473ae8 */

undefined4 FUN_00473ae8(void)

{
  return 1;
}



/* @00473af4 file=? name=FUN_00473af4 */

void FUN_00473af4(void)

{
  return;
}



/* @00473afc file=? name=FUN_00473afc */

void __cdecl FUN_00473afc(int param_1)

{
  *(undefined4 *)(param_1 + 0x90) = 0xffffffff;
  return;
}



/* @00473b10 file=? name=FUN_00473b10 */

void __cdecl FUN_00473b10(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  uint uVar3;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0xa0),0);
  if ((puVar2 != (undefined4 *)0x0) &&
     (uVar3 = (uint)(0 < *(int *)(param_1 + 0x9c)), uVar3 != *(uint *)(param_1 + 0x90))) {
    *(uint *)(param_1 + 0x90) = uVar3;
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))
              (param_1 + 0x48,*(undefined4 *)(param_1 + 0x94 + uVar3 * 4));
    (**(code **)(*(int *)(param_1 + 0x48) + 0x54))
              (param_1 + 0x48,0,puVar2,0,0,puVar2[3] + -1,puVar2[4] + -1);
  }
  FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0xa0));
  return;
}



/* @00473bac file=? name=FUN_00473bac */

undefined4 __cdecl FUN_00473bac(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 uVar2;
  int *piVar3;
  undefined4 *puVar4;
  
  iVar1 = FUN_00445034(&PTR_s_unsigned_004f5784,&DAT_004fa64c);
  if (iVar1 < 0) {
    uVar2 = 0;
  }
  else {
    piVar3 = (int *)FUN_00402298(0xac);
    if (piVar3 != (int *)0x0) {
      FUN_00473c94(piVar3,DAT_004fa4f8,DAT_004fa53c,param_5,0,param_1,param_2,param_3,
                   param_2 + DAT_004fa580,param_3 + DAT_004fa584,&DAT_004fa5c4,DAT_004fa608,iVar1,
                   DAT_004fa690,DAT_004fa6d4,DAT_004fa718,DAT_004fa75c,
                   s_NumericDisplayScalarTwoState_004faed0);
    }
    iVar1 = *(int *)(param_5 + 0x4c) + 4;
    puVar4 = FUN_00442aec(iVar1,&DAT_004fa5c4,0);
    if (puVar4 == (undefined4 *)0x0) {
      uVar2 = 0;
    }
    else {
      FUN_00442c12(iVar1,&DAT_004fa5c4);
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00473c94 file=? name=FUN_00473c94 */

int * __cdecl
FUN_00473c94(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,undefined4 param_10
            ,char *param_11,uint param_12,int param_13,int param_14,int param_15,undefined4 param_16
            ,undefined4 param_17,undefined4 param_18)

{
  int *piVar1;
  undefined4 *puVar2;
  int iVar3;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_18);
  *param_1 = (int)&PTR_FUN_004fb6fc;
  piVar1 = (int *)FUN_00402298(0x44);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004700bc(piVar1,*(int *)(param_4 + 0x4c),0,0,param_11,param_12,param_13,param_14,
                          param_15);
  }
  param_1[0x24] = (int)piVar1;
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  param_1[0x27] = param_14;
  param_1[0x28] = param_15;
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x29,param_16);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_004749de(puVar2,0,param_1 + 0x2a,param_17);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  iVar3 = FUN_004dcd94();
  param_1[0x26] = iVar3;
  return param_1;
}



/* @00473dac file=? name=FUN_00473dac */

void __cdecl FUN_00473dac(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fb6fc;
    if ((int *)param_1[0x24] != (int *)0x0) {
      FUN_0047018c((int *)param_1[0x24],3);
      param_1[0x24] = 0;
    }
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00473df8 file=? name=FUN_00473df8 */

void FUN_00473df8(void)

{
  FUN_004448ac();
  return;
}



/* @00473e08 file=? name=FUN_00473e08 */

void __cdecl FUN_00473e08(int param_1,char *param_2)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_NumericDisplayScalarTwoState__004fb4c2,(char *)0x0);
  uVar2 = 0xffffffff;
  do {
    pcVar4 = param_2;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar4 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar4;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar4 + -uVar2;
  pcVar5 = local_54;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fb4e1);
  FUN_004448bc(param_1,local_54);
  FUN_004701d4(*(int *)(param_1 + 0x90),local_54);
  return;
}



/* @00473e9c file=? name=FUN_00473e9c */

void __cdecl FUN_00473e9c(int param_1)

{
  *(undefined4 *)(param_1 + 0x94) = 0xffffffff;
  FUN_004703f4(*(int *)(param_1 + 0x90));
  return;
}



/* @00473ebc file=? name=FUN_00473ebc */

void __cdecl FUN_00473ebc(int param_1)

{
  undefined4 uVar1;
  uint uVar2;
  
  uVar2 = (uint)(0 < *(int *)(param_1 + 0xa8));
  if ((uVar2 != *(uint *)(param_1 + 0x94)) ||
     ((float)*(int *)(param_1 + 0x98) != *(float *)(param_1 + 0xa4))) {
    *(uint *)(param_1 + 0x94) = uVar2;
    uVar1 = FUN_004dcd94();
    *(undefined4 *)(param_1 + 0x98) = uVar1;
    if (0 < *(int *)(param_1 + 0xa8)) {
      FUN_00470430(*(int **)(param_1 + 0x90),(int *)(param_1 + 0x48),*(float *)(param_1 + 0xa4));
      return;
    }
    FUN_00470758(*(int *)(param_1 + 0x90),(int *)(param_1 + 0x48));
  }
  return;
}



/* @00473f44 file=? name=FUN_00473f44 */

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

undefined4 * __cdecl
FUN_00473f44(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,undefined4 param_8,float param_9,
            float param_10,float param_11,float param_12,float param_13,float param_14,int param_15,
            undefined4 param_16,undefined4 param_17,undefined4 param_18,undefined4 param_19)

{
  float local_8;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_19);
  *param_1 = &PTR_FUN_004fb6b8;
  param_1[0x24] = param_16;
  param_1[0x25] = param_17;
  param_1[0x26] = param_15;
  param_1[0x2a] = (float)(_DAT_00474084 * (float10)param_13 * (float10)_DAT_0047407c);
  param_1[0x2c] = param_9;
  param_1[0x2d] = param_10;
  param_1[0x28] = param_18;
  if ((int)param_1[0x26] < 0) {
    param_1[0x26] = -param_1[0x26];
  }
  local_8 = (float)(_DAT_00474084 * (float10)param_14 * (float10)_DAT_0047407c -
                   (float10)(float)param_1[0x2a]);
  if (param_15 < 1) {
    if (_DAT_00474090 < local_8) {
      local_8 = local_8 - (float)_DAT_0047407c;
    }
  }
  else if (local_8 < _DAT_00474090) {
    local_8 = local_8 + (float)_DAT_0047407c;
  }
  param_1[0x2b] = local_8 / (float)(int)param_1[0x26];
  param_1[0x2e] = (param_11 - param_9) / (float)(int)param_1[0x26];
  param_1[0x2f] = (param_12 - param_10) / (float)(int)param_1[0x26];
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  return param_1;
}



/* @00474094 file=? name=FUN_00474094 */

void __cdecl FUN_00474094(int *param_1,byte param_2)

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



/* @004740c0 file=? name=FUN_004740c0 */

undefined4 FUN_004740c0(void)

{
  return 1;
}



/* @004740cc file=? name=FUN_004740cc */

void __cdecl FUN_004740cc(int param_1)

{
  uint uVar1;
  float fVar2;
  int *piVar3;
  
  FUN_004dbb24(&DAT_00524e20,s_SegmentArc_004fb4e5,(char *)0x0);
  uVar1 = *(uint *)(param_1 + 0x90);
  FUN_004dbb24(&DAT_00524e20,s_backgroundColor___004fb4f1,(char *)0x0);
  piVar3 = FUN_004db78c(&DAT_00524e20,uVar1);
  FUN_004dbb24(piVar3,&DAT_004fb508,(char *)0x0);
  uVar1 = *(uint *)(param_1 + 0x94);
  FUN_004dbb24(&DAT_00524e20,s_foregroundColor___004fb50a,(char *)0x0);
  piVar3 = FUN_004db78c(&DAT_00524e20,uVar1);
  FUN_004dbb24(piVar3,&DAT_004fb521,(char *)0x0);
  uVar1 = *(uint *)(param_1 + 0x98);
  FUN_004dbb24(&DAT_00524e20,s_numberOfSegments___004fb523,(char *)0x0);
  piVar3 = FUN_004db78c(&DAT_00524e20,uVar1);
  FUN_004dbb24(piVar3,&DAT_004fb53a,(char *)0x0);
  fVar2 = *(float *)(param_1 + 0xa8);
  FUN_004dbb24(&DAT_00524e20,s_startAngle___004fb53c,(char *)0x0);
  piVar3 = FUN_004db634(&DAT_00524e20,(float10)fVar2);
  FUN_004dbb24(piVar3,&DAT_004fb553,(char *)0x0);
  fVar2 = *(float *)(param_1 + 0xac);
  FUN_004dbb24(&DAT_00524e20,s_deltaAngle___004fb555,(char *)0x0);
  piVar3 = FUN_004db634(&DAT_00524e20,(float10)fVar2);
  FUN_004dbb24(piVar3,&DAT_004fb56c,(char *)0x0);
  fVar2 = *(float *)(param_1 + 0xb8);
  FUN_004dbb24(&DAT_00524e20,s_deltaInnerRadius___004fb56e,(char *)0x0);
  piVar3 = FUN_004db634(&DAT_00524e20,(float10)fVar2);
  FUN_004dbb24(piVar3,&DAT_004fb585,(char *)0x0);
  fVar2 = *(float *)(param_1 + 0xbc);
  FUN_004dbb24(&DAT_00524e20,s_deltaOuterRadius___004fb587,(char *)0x0);
  piVar3 = FUN_004db634(&DAT_00524e20,(float10)fVar2);
  FUN_004dbb24(piVar3,&DAT_004fb59e,(char *)0x0);
  uVar1 = *(uint *)(param_1 + 0x9c);
  FUN_004dbb24(&DAT_00524e20,s_previousSegment___004fb5a0,(char *)0x0);
  piVar3 = FUN_004db78c(&DAT_00524e20,uVar1);
  FUN_004dbb24(piVar3,&DAT_004fb5b7,(char *)0x0);
  return;
}



/* @004742f0 file=? name=FUN_004742f0 */

void __cdecl FUN_004742f0(int param_1)

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



/* @00474300 file=? name=FUN_00474300 */

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

void __cdecl FUN_00474300(int param_1)

{
  float fVar1;
  int iVar2;
  undefined4 uVar3;
  int iVar4;
  undefined4 local_18;
  
  if (_DAT_00474544 <= *(float *)(param_1 + 0xa4)) {
    if (_DAT_00474548 < *(float *)(param_1 + 0xa4)) {
      *(undefined4 *)(param_1 + 0xa4) = 0x3f800000;
    }
  }
  else {
    *(undefined4 *)(param_1 + 0xa4) = 0;
  }
  iVar2 = FUN_004dcd94();
  if (iVar2 != *(int *)(param_1 + 0x9c)) {
    if (*(int *)(param_1 + 0x9c) < iVar2) {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(param_1 + 0x48,*(undefined4 *)(param_1 + 0x94))
      ;
      iVar4 = iVar2 - *(int *)(param_1 + 0x9c);
      local_18 = (float)*(int *)(param_1 + 0x9c) * *(float *)(param_1 + 0xac) +
                 *(float *)(param_1 + 0xa8);
    }
    else {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(param_1 + 0x48,*(undefined4 *)(param_1 + 0x90))
      ;
      iVar4 = *(int *)(param_1 + 0x9c) - iVar2;
      local_18 = (float)iVar2 * *(float *)(param_1 + 0xac) + *(float *)(param_1 + 0xa8);
    }
    fVar1 = *(float *)(param_1 + 0xac);
    for (; -1 < iVar4; iVar4 = iVar4 + -1) {
      FUN_004dd0f4(SUB84((double)local_18,0),(int)((ulonglong)(double)local_18 >> 0x20));
      FUN_004dc9b4(SUB84((double)local_18,0),(int)((ulonglong)(double)local_18 >> 0x20));
      FUN_004dcd94();
      uVar3 = FUN_004dcd94();
      (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(param_1 + 0x48,uVar3);
      if (*(int *)(param_1 + 0xa0) == 0) {
        FUN_004dcd94();
        uVar3 = FUN_004dcd94();
        (**(code **)(*(int *)(param_1 + 0x48) + 0x30))(param_1 + 0x48,uVar3);
      }
      else {
        FUN_004dcd94();
        uVar3 = FUN_004dcd94();
        (**(code **)(*(int *)(param_1 + 0x48) + 0x38))(param_1 + 0x48,uVar3);
      }
      local_18 = fVar1 + local_18;
    }
    *(int *)(param_1 + 0x9c) = iVar2;
  }
  return;
}



/* @004745e0 file=? name=FUN_004745e0 */

int * __cdecl
FUN_004745e0(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,float param_9,float param_10,
            float param_11,float param_12,float param_13,float param_14,int param_15,
            undefined4 param_16,undefined4 param_17,undefined4 param_18,undefined4 param_19,
            undefined4 param_20)

{
  undefined4 *puVar1;
  
  FUN_00473f44(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,param_14,param_15,param_16,param_17,param_19,param_20);
  *param_1 = (int)&PTR_FUN_004fb674;
  puVar1 = (undefined4 *)FUN_00402298(0x18);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00474855(puVar1,0,param_1 + 0x29,param_18);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  return param_1;
}



/* @00474855 file=? name=FUN_00474855 */

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

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_004fb668;
  param_1[4] = param_4;
  param_1[5] = param_3;
  *param_3 = *(undefined4 *)param_1[4];
  return param_1;
}



/* @00474887 file=? name=FUN_00474887 */

void __cdecl FUN_00474887(int *param_1,byte param_2)

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



/* @004748b3 file=? name=FUN_004748b3 */

void __cdecl FUN_004748b3(int param_1)

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



/* @004748c5 file=? name=FUN_004748c5 */

void __cdecl FUN_004748c5(int param_1,char *param_2)

{
  float fVar1;
  int *piVar2;
  undefined8 uVar3;
  undefined2 uVar4;
  undefined2 uVar5;
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_GaugeConnectionDirectOf__004fb5c4,(char *)0x0);
  fVar1 = **(float **)(param_1 + 0x10);
  uVar4 = (undefined2)*(undefined4 *)(param_1 + 0x10);
  uVar5 = (undefined2)((uint)*(undefined4 *)(param_1 + 0x10) >> 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataSource_at_004fb5de,(char *)0x0);
  uVar3 = FUN_004dbd4c(&DAT_00524e20,CONCAT22(uVar5,uVar4));
  FUN_004dbb24((int *)uVar3,&DAT_004fb5f4,(char *)0x0);
  piVar2 = FUN_004db634((int *)uVar3,(float10)fVar1);
  FUN_004dbb24(piVar2,&DAT_004fb5f6,(char *)0x0);
  uVar4 = (undefined2)*(undefined4 *)(param_1 + 0x10);
  uVar5 = (undefined2)((uint)*(undefined4 *)(param_1 + 0x10) >> 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataDestination_at_004fb5f8,(char *)0x0);
  uVar3 = FUN_004dbd4c(&DAT_00524e20,CONCAT22(uVar5,uVar4));
  FUN_004dbb24((int *)uVar3,&DAT_004fb60e,(char *)0x0);
  FUN_004d9c70((int *)uVar3);
  FUN_0044419c(param_1,param_2);
  return;
}



/* @004749cf file=? name=FUN_004749cf */

void FUN_004749cf(void)

{
  FUN_00415f1c();
  return;
}



/* @004749de file=? name=FUN_004749de */

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

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_004fb65c;
  param_1[4] = param_4;
  param_1[5] = param_3;
  *param_3 = *(undefined4 *)param_1[4];
  return param_1;
}



/* @00474a10 file=? name=FUN_00474a10 */

void __cdecl FUN_00474a10(int *param_1,byte param_2)

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



/* @00474a3c file=? name=FUN_00474a3c */

void __cdecl FUN_00474a3c(int param_1)

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



/* @00474a4e file=? name=FUN_00474a4e */

void __cdecl FUN_00474a4e(int param_1,char *param_2)

{
  int *piVar1;
  undefined8 uVar2;
  uint uVar3;
  uint uVar4;
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_GaugeConnectionDirectOf__004fb610,(char *)0x0);
  uVar4 = **(uint **)(param_1 + 0x10);
  uVar3 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataSource_at_004fb62a,(char *)0x0);
  uVar2 = FUN_004dbd4c(&DAT_00524e20,uVar3);
  FUN_004dbb24((int *)uVar2,&DAT_004fb640,(char *)0x0);
  piVar1 = FUN_004db78c((int *)uVar2,uVar4);
  FUN_004dbb24(piVar1,&DAT_004fb642,(char *)0x0);
  uVar4 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataDestination_at_004fb644,(char *)0x0);
  uVar2 = FUN_004dbd4c(&DAT_00524e20,uVar4);
  FUN_004dbb24((int *)uVar2,&DAT_004fb65a,(char *)0x0);
  FUN_004d9c70((int *)uVar2);
  FUN_0044419c(param_1,param_2);
  return;
}



/* @00474b53 file=? name=FUN_00474b53 */

void FUN_00474b53(void)

{
  FUN_00415f1c();
  return;
}



/* @00474b62 file=? name=FUN_00474b62 */

void __cdecl FUN_00474b62(int *param_1,byte param_2)

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



/* @00474b88 file=? name=FUN_00474b88 */

void __cdecl FUN_00474b88(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    FUN_0044ae0c(param_1 + 9,2);
    FUN_00443f7c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00474bbc file=? name=FUN_00474bbc */

void __cdecl FUN_00474bbc(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    FUN_0044ae0c(param_1 + 9,2);
    FUN_00443f7c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00474bf0 file=? name=FUN_00474bf0 */

void __cdecl FUN_00474bf0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    FUN_0044ae0c(param_1 + 9,2);
    FUN_00443f7c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00474c24 file=? name=FUN_00474c24 */

void __cdecl FUN_00474c24(int *param_1,byte param_2)

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



/* @00474c4c file=? name=FUN_00474c4c */

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

{
  undefined4 uVar1;
  int iVar2;
  
  FUN_00444a7c(param_1);
  *param_1 = &PTR_FUN_004fbbf8;
  param_1[0xe] = param_2;
  uVar1 = FUN_004022b0(0x100);
  param_1[0xf] = uVar1;
  uVar1 = FUN_004022b0(0x100);
  param_1[0x10] = uVar1;
  iVar2 = 0;
  do {
    *(undefined4 *)(param_1[0xf] + iVar2 * 4) = 0;
    iVar2 = iVar2 + 1;
  } while (iVar2 < 0x40);
  return param_1;
}



/* @00474c98 file=? name=FUN_00474c98 */

void __cdecl FUN_00474c98(int *param_1,byte param_2)

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



/* @00474ce4 file=? name=FUN_00474ce4 */

void FUN_00474ce4(void)

{
  FUN_00444b14();
  return;
}



/* @00474cf4 file=? name=FUN_00474cf4 */

int __cdecl FUN_00474cf4(int param_1,uint param_2)

{
  int iVar1;
  int iVar2;
  bool bVar3;
  undefined8 uVar4;
  
  bVar3 = param_2 != *(uint *)(param_1 + 4);
  if (bVar3) {
    iVar1 = 0;
    do {
      *(undefined4 *)(*(int *)(param_1 + 0x40) + iVar1 * 4) = 0;
      iVar1 = iVar1 + 1;
    } while (iVar1 < 0x40);
  }
  iVar1 = FUN_00444b20(param_1,param_2);
  if (bVar3) {
    iVar2 = 0;
    do {
      iVar1 = *(int *)(param_1 + 0x40);
      if (*(int *)(iVar1 + iVar2 * 4) == 0) {
        uVar4 = FUN_00474d54(param_1,iVar2,0);
        iVar1 = (int)uVar4;
      }
      iVar2 = iVar2 + 1;
    } while (iVar2 < 0x40);
  }
  return iVar1;
}



/* @00474d54 file=? name=FUN_00474d54 */

undefined8 __cdecl FUN_00474d54(int param_1,int param_2,int param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_1);
  if (param_3 != *(int *)(*(int *)(param_1 + 0x3c) + param_2 * 4)) {
    *(int *)(*(int *)(param_1 + 0x3c) + param_2 * 4) = param_3;
    uVar1 = FUN_00476568(*(int *)(param_1 + 0x38),param_2,(char)param_3);
  }
  return uVar1;
}



/* @00474d80 file=? name=FUN_00474d80 */

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

{
  FUN_00444dbc(param_1,param_2,param_3,param_4);
  *param_1 = (int)&PTR_FUN_004fbbe0;
  param_1[10] = 1;
  param_1[8] = 0;
  param_1[9] = 0;
  (**(code **)(*param_1 + 0xc))(param_1,2);
  return param_1;
}



/* @00474dc4 file=? name=FUN_00474dc4 */

void __cdecl FUN_00474dc4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fbbe0;
    (**(code **)(*param_1 + 0xc))(param_1,0);
    FUN_00444e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00474dfc file=? name=FUN_00474dfc */

void FUN_00474dfc(void)

{
  FUN_00444e30();
  return;
}



/* @00474e0c file=? name=FUN_00474e0c */

void __cdecl FUN_00474e0c(int param_1,undefined4 param_2)

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



/* @00474e1c file=? name=FUN_00474e1c */

void __cdecl FUN_00474e1c(int *param_1,int param_2)

{
  int iVar1;
  
  iVar1 = param_1[3];
  if ((-1 < iVar1) && (iVar1 < 0x40)) {
    *(undefined4 *)(*(int *)(param_1[6] + 0x40) + iVar1 * 4) = 1;
  }
  if (param_1[10] == 0) {
    if (param_2 != 0) {
      (**(code **)(*param_1 + 0x14))(param_1);
    }
  }
  else {
    iVar1 = param_1[8];
    if (iVar1 != param_1[9]) {
      param_1[9] = iVar1;
      if (0 < iVar1) {
        (**(code **)(*param_1 + 0xc))(param_1,1);
        return;
      }
      (**(code **)(*param_1 + 0xc))(param_1,2);
      return;
    }
    if (param_2 != 0) {
      (**(code **)(*param_1 + 0x14))(param_1);
      return;
    }
  }
  return;
}



/* @00474e94 file=? name=FUN_00474e94 */

undefined8 __cdecl FUN_00474e94(int param_1)

{
  int iVar1;
  undefined8 uVar2;
  
  if (*(int *)(param_1 + 0x1c) == 0) {
    if (*(int *)(param_1 + 0x14) == 1) {
      iVar1 = 0x3c;
    }
    else if (*(int *)(param_1 + 0x14) == 2) {
      iVar1 = 0x14;
    }
    else {
      iVar1 = 0;
    }
  }
  else if (*(int *)(param_1 + 0x14) - 1U < 2) {
    iVar1 = 0x37;
  }
  else {
    iVar1 = 0x13;
  }
  uVar2 = FUN_00474d54(*(int *)(param_1 + 0x18),*(int *)(param_1 + 0xc),iVar1);
  return uVar2;
}



/* @00474ee4 file=? name=FUN_00474ee4 */

undefined4 * __cdecl
FUN_00474ee4(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5,
            undefined4 param_6,undefined4 param_7,char *param_8,undefined4 param_9,
            undefined4 param_10,undefined4 param_11)

{
  char cVar1;
  int iVar2;
  char *pcVar3;
  uint uVar4;
  uint uVar5;
  char *pcVar6;
  
  FUN_00444ec0(param_1,param_2,param_3,*(undefined4 *)(param_4 + 0x1c0c8),param_4,param_5);
  *param_1 = &PTR_FUN_004fbbc8;
  iVar2 = FUN_004d4a78(param_8);
  pcVar3 = (char *)FUN_004022b0(iVar2 + 1);
  param_1[0x1c] = pcVar3;
  uVar4 = 0xffffffff;
  do {
    pcVar6 = param_8;
    if (uVar4 == 0) break;
    uVar4 = uVar4 - 1;
    pcVar6 = param_8 + 1;
    cVar1 = *param_8;
    param_8 = pcVar6;
  } while (cVar1 != '\0');
  uVar4 = ~uVar4;
  pcVar6 = pcVar6 + -uVar4;
  for (uVar5 = uVar4 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) {
    *(undefined4 *)pcVar3 = *(undefined4 *)pcVar6;
    pcVar6 = pcVar6 + 4;
    pcVar3 = pcVar3 + 4;
  }
  for (uVar4 = uVar4 & 3; uVar4 != 0; uVar4 = uVar4 - 1) {
    *pcVar3 = *pcVar6;
    pcVar6 = pcVar6 + 1;
    pcVar3 = pcVar3 + 1;
  }
  FUN_00442aec(*(int *)(param_1[8] + 0x4c) + 4,(char *)param_1[0x1c],0);
  param_1[0x1b] = param_11;
  param_1[0x1d] = param_9;
  param_1[0x1e] = param_10;
  (**(code **)(param_1[9] + 0x10))(param_1 + 9,param_6,param_7);
  return param_1;
}



/* @00474f98 file=? name=FUN_00474f98 */

void __cdecl FUN_00474f98(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fbbc8;
    FUN_00442c12(*(int *)(param_1[8] + 0x4c) + 4,(char *)param_1[0x1c]);
    FUN_004022e8((int *)param_1[0x1c]);
    param_1[0x1c] = 0;
    FUN_00444f14(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00474fec file=? name=FUN_00474fec */

void FUN_00474fec(void)

{
  FUN_00444f50();
  return;
}



/* @00474ffc file=? name=FUN_00474ffc */

void __cdecl FUN_00474ffc(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = *(int *)(*(int *)(param_1 + 0x20) + 0x4c);
  puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0x70),0);
  if (puVar2 != (undefined4 *)0x0) {
    if (*(int *)(param_1 + 0x14) < 1) {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x18))(param_1 + 0x24,*(undefined4 *)(param_1 + 0x74))
      ;
    }
    else {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x18))(param_1 + 0x24,*(undefined4 *)(param_1 + 0x78))
      ;
    }
    if (*(int *)(param_1 + 0x6c) == 0) {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x54))
                (param_1 + 0x24,0,puVar2,0,0,puVar2[3] + -1,puVar2[4] + -1);
    }
    else {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x58))
                (param_1 + 0x24,*(undefined4 *)(param_1 + 0x74),0,puVar2,0,0,puVar2[3] + -1,
                 puVar2[4] + -1);
    }
    FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0x70));
  }
  return;
}



/* @004750b4 file=? name=FUN_004750b4 */

undefined4 * __cdecl FUN_004750b4(undefined4 *param_1,short param_2,short param_3)

{
  short *psVar1;
  undefined4 *puVar2;
  undefined4 extraout_ECX;
  undefined4 extraout_ECX_00;
  undefined4 extraout_ECX_01;
  int iVar3;
  undefined8 uVar4;
  undefined4 uVar5;
  
  FUN_00468ae4(param_1,0x80,0x20);
  *param_1 = &PTR_FUN_004fbc3c;
  uVar5 = 0x81c;
  uVar4 = FUN_00402298(0x81c);
  psVar1 = (short *)uVar4;
  if (psVar1 != (short *)0x0) {
    uVar4 = FUN_0047d184(psVar1,0xc,3,param_2,param_3);
    uVar5 = extraout_ECX;
  }
  param_1[0xf] = psVar1;
  if (psVar1 != (short *)0x0) {
    uVar4 = FUN_0047d3fd(uVar5,(int)((ulonglong)uVar4 >> 0x20),(int)psVar1,0);
    FUN_0047d428(extraout_ECX_00,(int)((ulonglong)uVar4 >> 0x20),(short *)param_1[0xf],&DAT_004fbc00
                 ,2);
    FUN_0047d428(extraout_ECX_01,param_1[0xf],(short *)param_1[0xf],&DAT_004fbc02,3);
  }
  param_1[0x10] = 0;
  param_1[0xe] = 0;
  iVar3 = 0;
  puVar2 = param_1 + 0x11;
  do {
    *(undefined1 *)puVar2 = 0;
    iVar3 = iVar3 + 1;
    puVar2 = (undefined4 *)((int)puVar2 + 1);
  } while (iVar3 < 0x20);
  return param_1;
}



/* @0047516c file=? name=FUN_0047516c */

void __cdecl FUN_0047516c(int *param_1,byte param_2)

{
  int iVar1;
  undefined2 uVar2;
  int *piVar3;
  int iVar4;
  short extraout_var;
  int extraout_ECX;
  int iVar5;
  undefined4 extraout_EDX;
  int iVar6;
  undefined8 uVar7;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fbc3c;
    if (param_1[0xf] != 0) {
      (**(code **)(*param_1 + 0xc))(param_1);
      piVar3 = (int *)FUN_00414b60();
      iVar1 = *piVar3;
      iVar4 = FUN_004dcd94();
      do {
        do {
          piVar3 = (int *)FUN_00414b60();
          iVar5 = extraout_ECX;
          iVar6 = iVar1 + iVar4;
          if (iVar1 + iVar4 <= *piVar3) goto LAB_004751e7;
          uVar2 = FUN_0047d517(param_1[0xf]);
        } while (CONCAT22(extraout_var,uVar2) != 0 && -1 < extraout_var);
        iVar5 = param_1[0xf];
        uVar7 = FUN_0047d4a3(iVar5,extraout_EDX,(short *)iVar5);
        iVar6 = (int)((ulonglong)uVar7 >> 0x20);
      } while ((int)uVar7 != 0);
LAB_004751e7:
      piVar3 = (int *)param_1[0xf];
      if (piVar3 != (int *)0x0) {
        if (piVar3 == (int *)0x0) {
          FUN_004dbb24(&DAT_00524e20,s__PCSerial_has_been_passed_a_NULL_004fbc05,(char *)0x0);
        }
        else {
          FUN_0047d324(iVar5,iVar6,(short *)piVar3);
        }
        FUN_004022d0(piVar3);
      }
    }
    FUN_00468c04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0047524c file=? name=FUN_0047524c */

void __cdecl FUN_0047524c(int param_1,char *param_2)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_Plasma__004fbc2f,(char *)0x0);
  uVar2 = 0xffffffff;
  do {
    pcVar4 = param_2;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar4 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar4;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar4 + -uVar2;
  pcVar5 = local_54;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_54,&DAT_004fbc38);
  FUN_00468c74(param_1,local_54);
  return;
}



/* @004752cc file=? name=FUN_004752cc */

undefined8 __cdecl FUN_004752cc(short *param_1,undefined1 param_2,char *param_3,int param_4)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  int iVar4;
  byte *pbVar5;
  undefined8 uVar6;
  byte local_28 [4];
  undefined1 local_24;
  undefined1 local_23;
  undefined1 local_22;
  int local_8;
  
  local_28[0] = 0x1b;
  local_28[1] = 0x50;
  local_28[2] = 0;
  local_28[3] = param_2;
  local_24 = 0;
  iVar4 = param_4 + 7 >> 3;
  local_23 = (undefined1)iVar4;
  local_22 = 1;
  FUN_0047d428(local_28,iVar4,param_1,local_28,7);
  bVar3 = 0;
  bVar2 = 0x80;
  local_8 = 0;
  iVar4 = 0;
  pbVar5 = local_28;
  bVar1 = bVar2;
  if (0 < param_4) {
    do {
      if (*param_3 != '\0') {
        bVar3 = bVar3 | bVar1;
      }
      bVar2 = bVar1 >> 1;
      if (bVar1 >> 1 == 0) {
        *pbVar5 = bVar3;
        pbVar5 = pbVar5 + 1;
        local_8 = local_8 + 1;
        bVar3 = 0;
        bVar2 = 0x80;
      }
      iVar4 = iVar4 + 1;
      bVar1 = bVar2;
      param_3 = param_3 + 1;
    } while (iVar4 < param_4);
  }
  if (bVar2 != 0x80) {
    local_28[local_8] = bVar3;
    local_8 = local_8 + 1;
  }
  uVar6 = FUN_0047d428(param_1,local_28,param_1,local_28,local_8);
  return uVar6;
}



/* @00475370 file=? name=FUN_00475370 */

void __cdecl FUN_00475370(int param_1,short param_2)

{
  short *psVar1;
  int iVar2;
  undefined1 *puVar3;
  
  iVar2 = 0;
  psVar1 = *(short **)(param_1 + 0x30);
  puVar3 = (undefined1 *)(param_1 + 0x44);
  do {
    param_2 = param_2 + *psVar1;
    *psVar1 = 0;
    psVar1 = psVar1 + 1;
    if (param_2 != 0) {
      *puVar3 = 1;
      *(undefined4 *)(param_1 + 0x38) = 1;
    }
    iVar2 = iVar2 + 1;
    puVar3 = puVar3 + 1;
  } while (iVar2 < 0x20);
  return;
}



/* @004753ac file=? name=FUN_004753ac */

undefined4 __cdecl FUN_004753ac(int param_1,uint param_2)

{
  undefined2 uVar1;
  undefined2 extraout_var;
  int iVar2;
  int iVar3;
  
  if (*(int *)(param_1 + 0x3c) != 0) {
    *(uint *)(param_1 + 0x34) = *(uint *)(param_1 + 0x34) | param_2;
    if (*(int *)(param_1 + 0x40) == 0) {
      FUN_00475370(param_1,(short)*(undefined4 *)(param_1 + 0x34));
      *(undefined4 *)(param_1 + 0x34) = 0;
    }
    uVar1 = FUN_0047d517(*(int *)(param_1 + 0x3c));
    if (CONCAT22(extraout_var,uVar1) == 0) {
      iVar3 = 0x20;
      iVar2 = 4;
      do {
        if (*(char *)(param_1 + 0x44 + *(int *)(param_1 + 0x40)) != '\0') {
          *(undefined1 *)(param_1 + 0x44 + *(int *)(param_1 + 0x40)) = 0;
          iVar2 = iVar2 + -1;
          FUN_004752cc(*(short **)(param_1 + 0x3c),(char)*(undefined4 *)(param_1 + 0x40),
                       (char *)((*(int **)(param_1 + 0x2c))[2] +
                               **(int **)(param_1 + 0x2c) * *(int *)(param_1 + 0x40)),
                       **(int **)(param_1 + 0x2c));
        }
        *(int *)(param_1 + 0x40) = *(int *)(param_1 + 0x40) + 1;
        if (0x1f < *(int *)(param_1 + 0x40)) {
          *(undefined4 *)(param_1 + 0x40) = 0;
        }
        iVar3 = iVar3 + -1;
        if (iVar3 < 0) {
          *(undefined4 *)(param_1 + 0x40) = 0;
          *(undefined4 *)(param_1 + 0x38) = 0;
          return 0;
        }
      } while (0 < iVar2);
    }
  }
  return 1;
}



/* @00475468 file=? name=FUN_00475468 */

void __cdecl FUN_00475468(int *param_1)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  
  piVar2 = (int *)FUN_00414b60();
  iVar1 = *piVar2;
  iVar3 = FUN_004dcd94();
  do {
    if (param_1[0xe] == 0) {
      return;
    }
    (**(code **)(*param_1 + 8))(param_1,0);
    piVar2 = (int *)FUN_00414b60();
  } while (*piVar2 < iVar1 + iVar3);
  return;
}



/* @004754c8 file=? name=FUN_004754c8 */

undefined4 * __cdecl FUN_004754c8(undefined4 *param_1)

{
  undefined4 *puVar1;
  int local_24 [8];
  
  *param_1 = &PTR_FUN_004fcf0c;
  FUN_00403e84(local_24,PTR_s_JOYSTICK_INI_004fbc70,1);
  puVar1 = (undefined4 *)FUN_00402298(0x44);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00479228(puVar1,(int)local_24,PTR_s_JoystickX_004fcf58,10,0x14,0x1e);
  }
  param_1[7] = puVar1;
  puVar1 = (undefined4 *)FUN_00402298(0x44);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00479228(puVar1,(int)local_24,PTR_s_JoystickY_004fcf5c,10,0x14,0x1e);
  }
  param_1[8] = puVar1;
  param_1[5] = 0;
  param_1[6] = 0;
  FUN_00403ecc(local_24,2);
  return param_1;
}



/* @0047556c file=? name=FUN_0047556c */

void __cdecl FUN_0047556c(int *param_1,byte param_2)

{
  char *pcVar1;
  int *piVar2;
  int iVar3;
  int local_28 [8];
  int local_8;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fcf0c;
    FUN_00403e84(local_28,PTR_s_JOYSTICK_INI_004fbc70,1);
    FUN_004dfda8(&local_8);
    pcVar1 = (char *)FUN_004df7b4(&local_8);
    FUN_00404204((int)local_28,s_operator_004fc16a,&DAT_004fc173,pcVar1);
    iVar3 = 0;
    piVar2 = param_1 + 7;
    do {
      FUN_0047932c((int *)*piVar2,3);
      *piVar2 = 0;
      iVar3 = iVar3 + 1;
      piVar2 = piVar2 + 1;
    } while (iVar3 < 2);
    FUN_00403ecc(local_28,2);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00475604 file=? name=FUN_00475604 */

void __cdecl FUN_00475604(int param_1)

{
  undefined4 *puVar1;
  int iVar2;
  
  iVar2 = 0;
  puVar1 = (undefined4 *)(param_1 + 0x1c);
  do {
    (*(code *)**(undefined4 **)*puVar1)((undefined4 *)*puVar1);
    iVar2 = iVar2 + 1;
    puVar1 = puVar1 + 1;
  } while (iVar2 < 2);
  return;
}



/* @00475628 file=? name=FUN_00475628 */

void __cdecl FUN_00475628(int *param_1)

{
  int local_24 [8];
  
  FUN_00403e84(local_24,PTR_s_JOYSTICK_INI_004fbc70,1);
  (**(code **)(*param_1 + 0x10))(param_1,local_24);
  FUN_00403ecc(local_24,2);
  return;
}



/* @00475668 file=? name=FUN_00475668 */

void __cdecl FUN_00475668(int param_1,undefined4 param_2)

{
  undefined4 *puVar1;
  int iVar2;
  
  iVar2 = 0;
  puVar1 = (undefined4 *)(param_1 + 0x1c);
  do {
    (**(code **)(*(int *)*puVar1 + 4))((int *)*puVar1,param_2);
    iVar2 = iVar2 + 1;
    puVar1 = puVar1 + 1;
  } while (iVar2 < 2);
  return;
}



/* @00475694 file=munga_l4/l4ctrl.cpp name=FUN_00475694 */

void FUN_00475694(void)

{
  FUN_0040385c(s_Joystick__Update_should_not_be_c_004fc178,
               s_d__tesla_bt_munga_l4_L4CTRL_CPP_004fc1a0,0xe1);
  return;
}



/* @004756b0 file=? name=FUN_004756b0 */

void __cdecl FUN_004756b0(int param_1,float param_2)

{
  int *piVar1;
  int iVar2;
  
  iVar2 = 0;
  piVar1 = (int *)(param_1 + 0x1c);
  do {
    FUN_0047936c(*piVar1,param_2);
    iVar2 = iVar2 + 1;
    piVar1 = piVar1 + 1;
  } while (iVar2 < 2);
  return;
}



/* @004756d8 file=? name=FUN_004756d8 */

undefined4 * __cdecl FUN_004756d8(undefined4 *param_1)

{
  FUN_004754c8(param_1);
  *param_1 = &PTR_FUN_004fcef8;
  DAT_004fe108 = 3;
  param_1[3] = 0;
  param_1[4] = 0;
  return param_1;
}



/* @00475704 file=? name=FUN_00475704 */

void __cdecl FUN_00475704(int *param_1,byte param_2)

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



/* @00475730 file=? name=FUN_00475730 */

void __thiscall FUN_00475730(void *this,int param_1)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  float10 fVar4;
  
  FUN_0047d97c(this);
  fVar4 = (float10)(**(code **)(**(int **)(param_1 + 0x1c) + 8))
                             (*(int **)(param_1 + 0x1c),DAT_004fe100);
  *(float *)(param_1 + 4) = (float)fVar4;
  fVar4 = (float10)(**(code **)(**(int **)(param_1 + 0x20) + 8))
                             (*(int **)(param_1 + 0x20),DAT_004fe102);
  *(float *)(param_1 + 8) = (float)fVar4;
  bVar1 = DAT_004fe109;
  uVar2 = (uint)DAT_004fe109;
  *(undefined4 *)(param_1 + 0x18) = 0;
  uVar3 = *(uint *)(param_1 + 0x24) ^ uVar2;
  *(undefined4 *)(param_1 + 0x14) = 0;
  if (uVar3 != 0) {
    if ((uVar3 & 0x10) != 0) {
      if ((bVar1 & 0x10) == 0) {
        *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | 1;
      }
      else {
        *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 1;
      }
    }
    if ((uVar3 & 0x20) != 0) {
      if ((bVar1 & 0x20) == 0) {
        *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | 8;
      }
      else {
        *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 8;
      }
    }
  }
  *(uint *)(param_1 + 0x24) = uVar2;
  return;
}



/* @004757b0 file=? name=FUN_004757b0 */

undefined4 FUN_004757b0(void)

{
  return 1;
}



/* @004757bc file=? name=FUN_004757bc */

undefined4 * __cdecl FUN_004757bc(undefined4 *param_1)

{
  undefined4 *puVar1;
  int local_24 [8];
  
  FUN_004754c8(param_1);
  *param_1 = &PTR_FUN_004fcee4;
  FUN_00403e84(local_24,PTR_s_JOYSTICK_INI_004fbc70,1);
  puVar1 = (undefined4 *)FUN_00402298(0x44);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00479158(puVar1,(int)local_24,PTR_s_Throttle_004fcf60,10,0x1e);
  }
  param_1[10] = puVar1;
  DAT_004fe108 = 0xb;
  param_1[3] = 0;
  FUN_00403ecc(local_24,2);
  return param_1;
}



/* @00475838 file=? name=FUN_00475838 */

void __cdecl FUN_00475838(int *param_1,byte param_2)

{
  char *pcVar1;
  int local_28 [8];
  int local_8;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fcee4;
    FUN_00403e84(local_28,PTR_s_JOYSTICK_INI_004fbc70,1);
    FUN_004dfda8(&local_8);
    pcVar1 = (char *)FUN_004df7b4(&local_8);
    FUN_00404204((int)local_28,s_operator_004fc1c0,&DAT_004fc1c9,pcVar1);
    FUN_0047932c((int *)param_1[10],3);
    param_1[10] = 0;
    FUN_00403ecc(local_28,2);
    FUN_0047556c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004758cc file=? name=FUN_004758cc */

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

void __thiscall FUN_004758cc(void *this,int param_1)

{
  uint uVar1;
  byte bVar2;
  uint uVar3;
  float10 fVar4;
  
  FUN_0047d97c(this);
  fVar4 = (float10)(**(code **)(**(int **)(param_1 + 0x1c) + 8))
                             (*(int **)(param_1 + 0x1c),DAT_004fe100);
  *(float *)(param_1 + 4) = (float)fVar4;
  fVar4 = (float10)(**(code **)(**(int **)(param_1 + 0x20) + 8))
                             (*(int **)(param_1 + 0x20),DAT_004fe102);
  *(float *)(param_1 + 8) = (float)fVar4;
  fVar4 = (float10)(**(code **)(**(int **)(param_1 + 0x28) + 8))
                             (*(int **)(param_1 + 0x28),DAT_004fe106);
  *(float *)(param_1 + 0x10) = (float)((float10)_DAT_00475a34 - fVar4);
  bVar2 = DAT_004fe109;
  uVar3 = (uint)DAT_004fe109;
  *(undefined4 *)(param_1 + 0x18) = 0;
  *(undefined4 *)(param_1 + 0x14) = 0;
  uVar1 = *(uint *)(param_1 + 0x24);
  if (uVar3 != uVar1) {
    if ((int)uVar1 < 0x71) {
      if (uVar1 == 0x70) {
        *(undefined4 *)(param_1 + 0x14) = 0x20;
      }
      else if (uVar1 == 0x10) {
        *(undefined4 *)(param_1 + 0x14) = 1;
      }
      else if (uVar1 == 0x20) {
        *(undefined4 *)(param_1 + 0x14) = 8;
      }
      else if (uVar1 == 0x30) {
        *(undefined4 *)(param_1 + 0x14) = 0x40;
      }
      else if (uVar1 == 0x40) {
        *(undefined4 *)(param_1 + 0x14) = 2;
      }
    }
    else if (uVar1 == 0x80) {
      *(undefined4 *)(param_1 + 0x14) = 4;
    }
    else if (uVar1 == 0xb0) {
      *(undefined4 *)(param_1 + 0x14) = 0x80;
    }
    else if (uVar1 == 0xf0) {
      *(undefined4 *)(param_1 + 0x14) = 0x10;
    }
    if (uVar3 == 0x70 || bVar2 < 0x70) {
      if (uVar3 == 0x70) {
        *(undefined4 *)(param_1 + 0x18) = 0x20;
      }
      else if (uVar3 == 0x10) {
        *(undefined4 *)(param_1 + 0x18) = 1;
      }
      else if (uVar3 == 0x20) {
        *(undefined4 *)(param_1 + 0x18) = 8;
      }
      else if (uVar3 == 0x30) {
        *(undefined4 *)(param_1 + 0x18) = 0x40;
      }
      else if (uVar3 == 0x40) {
        *(undefined4 *)(param_1 + 0x18) = 2;
      }
    }
    else if (uVar3 == 0x80) {
      *(undefined4 *)(param_1 + 0x18) = 4;
    }
    else if (uVar3 == 0xb0) {
      *(undefined4 *)(param_1 + 0x18) = 0x80;
    }
    else if (uVar3 == 0xf0) {
      *(undefined4 *)(param_1 + 0x18) = 0x10;
    }
    *(uint *)(param_1 + 0x24) = uVar3;
  }
  return;
}



/* @00475a54 file=? name=FUN_00475a54 */

void __cdecl FUN_00475a54(int param_1)

{
  int local_24 [8];
  
  FUN_00403e84(local_24,PTR_s_JOYSTICK_INI_004fbc70,1);
  (**(code **)(**(int **)(param_1 + 0x28) + 4))(*(int **)(param_1 + 0x28),local_24);
  FUN_00475668(param_1,local_24);
  FUN_00403ecc(local_24,2);
  return;
}



/* @00475aa4 file=? name=FUN_00475aa4 */

undefined4 * __cdecl FUN_00475aa4(undefined4 *param_1)

{
  FUN_004754c8(param_1);
  *param_1 = &PTR_FUN_004fced0;
  DAT_004fe108 = 0xb;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[10] = 0;
  param_1[0xb] = 0;
  return param_1;
}



/* @00475ad8 file=? name=FUN_00475ad8 */

void __cdecl FUN_00475ad8(int *param_1,byte param_2)

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



/* @00475b04 file=? name=FUN_00475b04 */

void __thiscall FUN_00475b04(void *this,int param_1)

{
  int iVar1;
  byte bVar2;
  uint uVar3;
  uint uVar4;
  float10 fVar5;
  
  FUN_0047d97c(this);
  fVar5 = (float10)(**(code **)(**(int **)(param_1 + 0x1c) + 8))
                             (*(int **)(param_1 + 0x1c),DAT_004fe100);
  *(float *)(param_1 + 4) = (float)fVar5;
  fVar5 = (float10)(**(code **)(**(int **)(param_1 + 0x20) + 8))
                             (*(int **)(param_1 + 0x20),DAT_004fe102);
  *(float *)(param_1 + 8) = (float)fVar5;
  *(undefined4 *)(param_1 + 0x18) = 0;
  *(undefined4 *)(param_1 + 0x14) = 0;
  bVar2 = DAT_004fe109;
  uVar3 = (uint)DAT_004fe109;
  uVar4 = *(uint *)(param_1 + 0x24) ^ uVar3;
  if (uVar4 != 0) {
    if ((uVar4 & 0x10) != 0) {
      if ((DAT_004fe109 & 0x10) == 0) {
        *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | 1;
      }
      else {
        *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 1;
      }
    }
    if ((uVar4 & 0x20) != 0) {
      if ((bVar2 & 0x20) == 0) {
        *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | 8;
      }
      else {
        *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 8;
      }
    }
    if ((uVar4 & 0x40) != 0) {
      if ((bVar2 & 0x40) == 0) {
        *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | 4;
      }
      else {
        *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 4;
      }
    }
    if ((uVar4 & 0x80) != 0) {
      if ((bVar2 & 0x80) == 0) {
        *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | 2;
      }
      else {
        *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 2;
      }
    }
    *(uint *)(param_1 + 0x24) = uVar3;
  }
  uVar3 = (uint)DAT_004fe106;
  if (*(int *)(param_1 + 0x28) < (int)uVar3) {
    *(uint *)(param_1 + 0x28) = uVar3;
  }
  iVar1 = *(int *)(param_1 + 0x28);
  if (iVar1 * 7 >> 3 < (int)uVar3) {
    uVar3 = 0;
  }
  else if (iVar1 * 5 >> 3 < (int)uVar3) {
    uVar3 = 0x40;
  }
  else if (iVar1 * 3 >> 3 < (int)uVar3) {
    uVar3 = 0x20;
  }
  else if (iVar1 >> 3 < (int)uVar3) {
    uVar3 = 0x80;
  }
  else {
    uVar3 = 0x10;
  }
  if (uVar3 != *(uint *)(param_1 + 0x2c)) {
    *(uint *)(param_1 + 0x14) = *(uint *)(param_1 + 0x14) | *(uint *)(param_1 + 0x2c);
    *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | uVar3;
    *(uint *)(param_1 + 0x2c) = uVar3;
  }
  return;
}



/* @00475c18 file=? name=FUN_00475c18 */

undefined4 * __cdecl FUN_00475c18(undefined4 *param_1)

{
  int *piVar1;
  uint uVar2;
  bool bVar3;
  char cVar4;
  char *pcVar5;
  int iVar6;
  short *psVar7;
  uint *puVar8;
  undefined4 *puVar9;
  undefined4 extraout_EAX;
  undefined4 uVar10;
  undefined4 extraout_EDX;
  undefined4 extraout_EDX_00;
  undefined4 extraout_EDX_01;
  undefined4 extraout_EDX_02;
  undefined4 extraout_EDX_03;
  undefined4 extraout_EDX_04;
  undefined4 extraout_EDX_05;
  undefined4 extraout_EDX_06;
  undefined4 extraout_EDX_07;
  undefined4 extraout_EDX_08;
  undefined8 uVar11;
  char local_c8 [128];
  undefined4 local_48;
  int *local_44;
  int *local_40;
  undefined4 local_3c;
  int local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 *local_24;
  undefined4 *local_20;
  undefined4 *local_1c;
  int *local_18;
  int local_14;
  short *local_10;
  short *local_c;
  char *local_8;
  
  FUN_0044c594(param_1,0x3f0,&DAT_004fbcf0);
  *param_1 = &PTR_FUN_004fcea4;
  FUN_004de998(param_1 + 9,0x20,7,1,FUN_00477aa0);
  FUN_004de998(param_1 + 0x41,0x24,2,1,FUN_00477e0c);
  FUN_004de998(param_1 + 0x58,0x20,3,1,FUN_00478192);
  FUN_004de998(param_1 + 0x70,0x20,0x4b,1,FUN_00478192);
  FUN_004de998(param_1 + 0x313,0x24,1,1,FUN_004784fb);
  FUN_0044c8a0(param_1 + 0x31d);
  *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) & 0xfe;
  *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) & 0xfd;
  *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) & 0xfb;
  *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) & 0xf7;
  param_1[0x55] = 0;
  param_1[0x56] = 0;
  param_1[0x57] = 0;
  param_1[0x53] = 0;
  param_1[0x31c] = 0;
  param_1[0x54] = 0;
  param_1[0x324] = 0;
  param_1[0x325] = 0;
  param_1[0x326] = 0;
  pcVar5 = (char *)FUN_004dee74(s_L4CONTROLS_004fc1e0);
  uVar10 = extraout_EDX;
  if (pcVar5 != (char *)0x0) {
    bVar3 = false;
    do {
      local_8 = local_c8;
      if (bVar3) {
        local_c8[0] = '\0';
      }
      else {
        do {
          cVar4 = *pcVar5;
          pcVar5 = pcVar5 + 1;
          if ((cVar4 == '\0') || (cVar4 == '\n')) {
            bVar3 = true;
LAB_00475d7e:
            cVar4 = '\0';
          }
          else if ((cVar4 == ',') || (cVar4 == ';')) goto LAB_00475d7e;
          *local_8 = cVar4;
          local_8 = local_8 + 1;
        } while (cVar4 != '\0');
      }
      iVar6 = FUN_004d4b58(local_c8,&DAT_004fc1eb);
      if ((iVar6 == 0) || (iVar6 = FUN_004d4b58(local_c8,s_RIO_COM1_004fc1ef), iVar6 == 0)) {
        uVar11 = FUN_00402298(0x498);
        local_c = (short *)uVar11;
        if (local_c == (short *)0x0) {
          psVar7 = (short *)0x0;
        }
        else {
          psVar7 = FUN_00479b78(local_c,0x3f8,0xc,1);
          uVar11 = CONCAT44(extraout_EDX_00,local_c);
        }
        param_1[0x324] = psVar7;
        *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 8;
        param_1[0x326] = 4;
      }
      else {
        iVar6 = FUN_004d4b58(local_c8,s_RIO_COM2_004fc1f8);
        if (iVar6 == 0) {
          uVar11 = FUN_00402298(0x498);
          local_10 = (short *)uVar11;
          if (local_10 == (short *)0x0) {
            psVar7 = (short *)0x0;
          }
          else {
            psVar7 = FUN_00479b78(local_10,0x2f8,0xb,1);
            uVar11 = CONCAT44(extraout_EDX_01,local_10);
          }
          local_10 = (short *)uVar11;
          uVar11 = CONCAT44((int)((ulonglong)uVar11 >> 0x20),local_c);
          param_1[0x324] = psVar7;
          *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 8;
          param_1[0x326] = 4;
        }
        else {
          iVar6 = FUN_004d4b58(local_c8,s_KEYBOARD_004fc201);
          uVar11 = CONCAT44(extraout_EDX_02,local_c);
          if (iVar6 == 0) {
            *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 2;
          }
          else {
            iVar6 = FUN_004d4b58(local_c8,s_MOUSE_004fc20a);
            uVar11 = CONCAT44(extraout_EDX_03,local_c);
            if (iVar6 == 0) {
              if ((*(byte *)(param_1 + 0x327) & 1) == 0) {
                *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 1;
                local_14 = FUN_00402298(8);
                if (local_14 == 0) {
                  puVar8 = (uint *)0x0;
                }
                else {
                  puVar8 = FUN_00478fd8();
                }
                param_1[0x31c] = puVar8;
                uVar11 = CONCAT44(param_1[0x31c],local_c);
                if (*(int *)(param_1[0x31c] + 4) != 0) {
                  local_18 = (int *)param_1[0x31c];
                  uVar10 = 0;
                  if (local_18 != (int *)0x0) {
                    FUN_004022d0(local_18);
                    uVar10 = extraout_EDX_04;
                  }
                  uVar11 = CONCAT44(uVar10,local_c);
                  param_1[0x31c] = 0;
                  *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) & 0xfe;
                }
              }
            }
            else {
              iVar6 = FUN_004d4b58(local_c8,s_JOYSTICK_004fc210);
              if (iVar6 == 0) {
                *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 4;
                param_1[0x53] = 1;
                uVar11 = FUN_00402298(0x28);
                local_1c = (undefined4 *)uVar11;
                if (local_1c == (undefined4 *)0x0) {
                  puVar9 = (undefined4 *)0x0;
                }
                else {
                  puVar9 = FUN_004756d8(local_1c);
                  uVar11 = CONCAT44(extraout_EDX_05,local_1c);
                }
                local_1c = (undefined4 *)uVar11;
                uVar11 = CONCAT44((int)((ulonglong)uVar11 >> 0x20),local_c);
                param_1[0x54] = puVar9;
                param_1[0x326] = 1;
              }
              else {
                iVar6 = FUN_004d4b58(local_c8,s_FLIGHTSTICKPRO_004fc219);
                if (iVar6 == 0) {
                  *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 4;
                  param_1[0x53] = 2;
                  uVar11 = FUN_00402298(0x2c);
                  local_20 = (undefined4 *)uVar11;
                  if (local_20 == (undefined4 *)0x0) {
                    puVar9 = (undefined4 *)0x0;
                  }
                  else {
                    puVar9 = FUN_004757bc(local_20);
                    uVar11 = CONCAT44(extraout_EDX_06,local_20);
                  }
                  local_20 = (undefined4 *)uVar11;
                  uVar11 = CONCAT44((int)((ulonglong)uVar11 >> 0x20),local_c);
                  param_1[0x54] = puVar9;
                  param_1[0x326] = 3;
                }
                else {
                  iVar6 = FUN_004d4b58(local_c8,s_THRUSTMASTER_004fc228);
                  uVar11 = CONCAT44(extraout_EDX_07,local_c);
                  if (iVar6 == 0) {
                    *(byte *)(param_1 + 0x327) = *(byte *)(param_1 + 0x327) | 4;
                    param_1[0x53] = 3;
                    uVar11 = FUN_00402298(0x30);
                    local_24 = (undefined4 *)uVar11;
                    if (local_24 == (undefined4 *)0x0) {
                      puVar9 = (undefined4 *)0x0;
                    }
                    else {
                      puVar9 = FUN_00475aa4(local_24);
                      uVar11 = CONCAT44(extraout_EDX_08,local_24);
                    }
                    local_24 = (undefined4 *)uVar11;
                    uVar11 = CONCAT44((int)((ulonglong)uVar11 >> 0x20),local_c);
                    param_1[0x54] = puVar9;
                    param_1[0x326] = 2;
                  }
                }
              }
            }
          }
        }
      }
      local_c = (short *)uVar11;
      uVar10 = CONCAT31((int3)((ulonglong)uVar11 >> 0x28),local_c8[0]);
    } while (local_c8[0] != '\0');
  }
  if (param_1[0x324] != 0) {
    FUN_0047a5e4(param_1[0x324],uVar10,(short *)param_1[0x324]);
  }
  uVar2 = *(uint *)(*(int *)(DAT_004efc94 + 0x50) + 4);
  iVar6 = 0;
  local_28 = 0;
  do {
    FUN_00477b08((int)(param_1 + iVar6 * 8 + 9),&local_28,uVar2);
    iVar6 = iVar6 + 1;
  } while (iVar6 < 7);
  local_30 = 0;
  local_2c = 0;
  iVar6 = 0;
  do {
    FUN_00477e88((int)(param_1 + iVar6 * 9 + 0x41),&local_30,uVar2);
    iVar6 = iVar6 + 1;
  } while (iVar6 < 2);
  iVar6 = 0;
  local_34 = 0;
  do {
    FUN_004781f7((int)(param_1 + iVar6 * 8 + 0x58),&local_34,uVar2);
    iVar6 = iVar6 + 1;
  } while (iVar6 < 3);
  local_3c = 0;
  local_38 = 0;
  puVar8 = param_1 + 0x2c8;
  do {
    FUN_004781f7((int)(param_1 + local_38 * 8 + 0x70),&local_3c,uVar2);
    *puVar8 = uVar2;
    local_38 = local_38 + 1;
    puVar8 = puVar8 + 1;
  } while (local_38 < 0x4b);
  param_1[0x328] = 0;
  iVar6 = 0;
  puVar9 = param_1 + 0x32b;
  do {
    iVar6 = iVar6 + 1;
    *puVar9 = 0;
    puVar9 = puVar9 + 1;
  } while (iVar6 < 0x10);
  param_1[0x33b] = 0;
  puVar9 = (undefined4 *)FUN_00414b60();
  param_1[0x33c] = *puVar9;
  param_1[0x33d] = 0;
  param_1[0x33e] = 0;
  param_1[0x33f] = 0;
  param_1[0x340] = 0;
  param_1[0x341] = 0;
  param_1[0x342] = 0;
  param_1[0x343] = 0;
  piVar1 = DAT_00523314;
  local_40 = DAT_00523314;
  DAT_00523314[3] = DAT_00523314[3] + 1;
  if (((char *)piVar1[2] != (char *)0x0) && (iVar6 = FUN_004d4a78((char *)piVar1[2]), iVar6 != 0)) {
    if ((*(byte *)(param_1 + 0x327) & 8) == 0) {
      FUN_004dbb24(&DAT_00524e20,s_RIO_must_be_enabled_by_setenv__004fc235,(char *)0x0);
      FUN_004036a0(1);
    }
    FUN_00477990(param_1,(LPCSTR)local_40[2]);
    param_1[0x33d] = 1;
  }
  piVar1 = DAT_00523318;
  local_44 = DAT_00523318;
  DAT_00523318[3] = DAT_00523318[3] + 1;
  if (((char *)piVar1[2] != (char *)0x0) && (iVar6 = FUN_004d4a78((char *)piVar1[2]), iVar6 != 0)) {
    if ((*(byte *)(param_1 + 0x327) & 8) == 0) {
      FUN_004dbb24(&DAT_00524e20,s_RIO_must_be_enabled_by_setenv__004fc255,(char *)0x0);
      FUN_004036a0(1);
    }
    FUN_004de998((int *)0x0,0x1c,12000,1,FUN_00477a8e);
    local_48 = extraout_EAX;
    puVar9 = (undefined4 *)FUN_00402298(0x10);
    if (puVar9 == (undefined4 *)0x0) {
      uVar10 = 0;
    }
    else {
      uVar10 = FUN_004030dc(puVar9,local_48,0x52080,0);
    }
    param_1[0x33b] = uVar10;
  }
  piVar1 = local_44 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_44,3);
  }
  piVar1 = local_40 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_40,3);
  }
  return param_1;
}



/* @00476298 file=? name=FUN_00476298 */

void __cdecl FUN_00476298(int *param_1,byte param_2)

{
  int *piVar1;
  undefined4 *puVar2;
  bool bVar3;
  int *piVar4;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fcea4;
    piVar4 = DAT_00523318;
    if ((param_1[0x33b] == 0) || (param_1[0x33d] != 0)) {
      bVar3 = false;
    }
    else {
      bVar3 = true;
    }
    if (bVar3) {
      DAT_00523318[3] = DAT_00523318[3] + 1;
      FUN_0047790c((int)param_1,(LPCSTR)piVar4[2]);
      piVar1 = piVar4 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(piVar4,3);
      }
    }
    piVar4 = (int *)param_1[0x33b];
    if (piVar4 != (int *)0x0) {
      (**(code **)(*piVar4 + 0xc))(piVar4,0);
      piVar4 = (int *)(*(code *)**(undefined4 **)param_1[0x33b])((undefined4 *)param_1[0x33b]);
      FUN_004022d0((int *)param_1[0x33b]);
      FUN_004022e8(piVar4);
      param_1[0x33b] = 0;
      param_1[0x33e] = 0;
    }
    piVar4 = (int *)param_1[0x31c];
    if (piVar4 != (int *)0x0) {
      if (piVar4 != (int *)0x0) {
        FUN_004022d0(piVar4);
      }
      param_1[0x31c] = 0;
    }
    puVar2 = (undefined4 *)param_1[0x54];
    if (puVar2 != (undefined4 *)0x0) {
      if (puVar2 != (undefined4 *)0x0) {
        (**(code **)*puVar2)(puVar2,3);
      }
      param_1[0x54] = 0;
    }
    FUN_004772e8((int)param_1);
    if ((int *)param_1[0x324] != (int *)0x0) {
      FUN_00479fd0((int *)param_1[0x324],3);
      param_1[0x324] = 0;
    }
    FUN_0044c8cc(param_1 + 0x31d,2);
    FUN_004de8d4(param_1 + 0x313,0x24,1,1,FUN_00478514);
    FUN_004de8d4(param_1 + 0x70,0x20,0x4b,1,FUN_004781ab);
    FUN_004de8d4(param_1 + 0x58,0x20,3,1,FUN_004781ab);
    FUN_004de8d4(param_1 + 0x41,0x24,2,1,FUN_00477e25);
    FUN_004de8d4(param_1 + 9,0x20,7,1,FUN_00477ab9);
    FUN_0044c5e4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00476454 file=? name=FUN_00476454 */

void __cdecl FUN_00476454(int param_1)

{
  if (*(int **)(param_1 + 0xc90) != (int *)0x0) {
    FUN_00479fd0(*(int **)(param_1 + 0xc90),3);
    *(undefined4 *)(param_1 + 0xc90) = 0;
  }
  FUN_0044c73c();
  return;
}



/* @00476484 file=? name=FUN_00476484 */

void __cdecl FUN_00476484(int param_1,undefined4 param_2)

{
  int iVar1;
  int *local_14;
  int *local_10;
  int *local_c;
  int *local_8;
  
  iVar1 = 0;
  local_8 = (int *)(param_1 + 0x24);
  do {
    (**(code **)(*local_8 + 0xc))(iVar1 * 0x20 + param_1 + 0x24,param_2);
    iVar1 = iVar1 + 1;
    local_8 = local_8 + 8;
  } while (iVar1 < 7);
  iVar1 = 0;
  local_c = (int *)(param_1 + 0x104);
  do {
    (**(code **)(*local_c + 0xc))(iVar1 * 0x24 + param_1 + 0x104,param_2);
    iVar1 = iVar1 + 1;
    local_c = local_c + 9;
  } while (iVar1 < 2);
  iVar1 = 0;
  local_10 = (int *)(param_1 + 0x160);
  do {
    (**(code **)(*local_10 + 0xc))(iVar1 * 0x20 + param_1 + 0x160,param_2);
    iVar1 = iVar1 + 1;
    local_10 = local_10 + 8;
  } while (iVar1 < 3);
  iVar1 = 0;
  local_14 = (int *)(param_1 + 0x1c0);
  do {
    (**(code **)(*local_14 + 0xc))(iVar1 * 0x20 + param_1 + 0x1c0,param_2);
    iVar1 = iVar1 + 1;
    local_14 = local_14 + 8;
  } while (iVar1 < 0x4b);
  (**(code **)(*(int *)(param_1 + 0xc4c) + 0xc))(param_1 + 0xc4c,param_2);
  return;
}



/* @00476568 file=? name=FUN_00476568 */

undefined8 __cdecl FUN_00476568(int param_1,undefined4 param_2,undefined1 param_3)

{
  int iVar1;
  undefined8 uVar2;
  
  iVar1 = *(int *)(param_1 + 0xc90);
  uVar2 = CONCAT44(iVar1,param_1);
  if (iVar1 != 0) {
    uVar2 = FUN_0047a6d4(param_2,iVar1,(short *)iVar1,(char)param_2,param_3);
  }
  return uVar2;
}



/* @0047658c file=? name=FUN_0047658c */

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

void __cdecl FUN_0047658c(int param_1)

{
  uint uVar1;
  uint uVar2;
  undefined2 uVar3;
  int iVar4;
  int *piVar5;
  undefined4 *puVar6;
  undefined2 extraout_var;
  undefined2 extraout_var_00;
  void *this;
  undefined4 extraout_ECX;
  undefined4 extraout_ECX_00;
  void *extraout_ECX_01;
  void *extraout_ECX_02;
  undefined4 extraout_EDX;
  undefined4 uVar7;
  undefined4 extraout_EDX_00;
  ulonglong uVar8;
  undefined1 uVar9;
  uint local_60 [3];
  int *local_54;
  int local_50;
  int local_4c;
  int local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  float local_38;
  float local_34;
  uint local_30;
  uint local_2c;
  undefined4 local_28;
  int *local_24;
  float local_20;
  int local_1c;
  uint local_18;
  uint local_14;
  uint local_10;
  float local_c;
  float local_8;
  
  local_1c = 0;
  this = *(void **)(DAT_004efc94 + 0x50);
  uVar1 = *(uint *)((int)this + 4);
  if ((*(byte *)(param_1 + 0xc9c) & 8) != 0) {
    if (*(int *)(param_1 + 0xcf4) == 0) {
      local_24 = (int *)FUN_00414b60();
      this = *(void **)(param_1 + 0xc94);
      local_20 = (float)(*local_24 - (int)this) / DAT_0052140c;
      local_28 = 0x41700000;
      if (DAT_004fbcf8 == 0) {
        if (local_20 < 15.0) {
          if (local_20 < _DAT_00476e24) {
            local_34 = local_20;
            FUN_004dbb24(&DAT_00524e20,s_LBE4ControlsManager__Execute__de_004fc2e3,(char *)0x0);
            piVar5 = FUN_004db634(&DAT_00524e20,(float10)local_34);
            FUN_004dbb24(piVar5,&DAT_004fc319,(char *)0x0);
            FUN_0047a5bc(extraout_ECX_00,extraout_EDX_00,*(short **)(param_1 + 0xc90));
            puVar6 = (undefined4 *)FUN_00414b60();
            *(undefined4 *)(param_1 + 0xc94) = *puVar6;
            this = extraout_ECX_01;
          }
        }
        else {
          uVar7 = 0;
          if (*(int *)(param_1 + 0xc94) != 0) {
            FUN_004dbb24(&DAT_00524e20,s_LBE4ControlsManager__Execute__lo_004fc275,(char *)0x0);
            local_2c = DAT_004fe168;
            uVar8 = FUN_0047df47(extraout_ECX,DAT_004fe168);
            uVar2 = DAT_004fe164;
            local_30 = (uint)uVar8;
            FUN_004dbb24(&DAT_00524e20,s_iThinkIRQIsOn___004fc2ac,(char *)0x0);
            piVar5 = FUN_004db78c(&DAT_00524e20,uVar2);
            FUN_004dbb24(piVar5,s___actual_state___004fc2bc,(char *)0x0);
            piVar5 = FUN_004db78c(piVar5,local_30);
            FUN_004dbb24(piVar5,s___characters_sent___004fc2cd,(char *)0x0);
            piVar5 = FUN_004db78c(piVar5,local_2c);
            FUN_004dbb24(piVar5,&DAT_004fc2e1,(char *)0x0);
            uVar7 = extraout_EDX;
          }
          FUN_0047a5bc(*(undefined4 *)(param_1 + 0xc90),uVar7,
                       (short *)*(undefined4 *)(param_1 + 0xc90));
          puVar6 = (undefined4 *)FUN_00414b60();
          this = (void *)*puVar6;
          *(void **)(param_1 + 0xc94) = this;
        }
      }
      else {
        this = (void *)0x0;
        DAT_004fbcf8 = 0;
      }
    }
    while (iVar4 = FUN_00477484(this,param_1,local_60), iVar4 != 0) {
      FUN_00477800(param_1,(int *)local_60,&local_1c);
      this = extraout_ECX_02;
    }
  }
  if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
    piVar5 = (int *)FUN_00414b60();
    local_38 = (float)(*piVar5 - *(int *)(param_1 + 0x15c));
    if ((float)_DAT_00476e28 < local_38) {
      (**(code **)(**(int **)(param_1 + 0x150) + 0xc))((char)*(int **)(param_1 + 0x150));
      *(float *)(*(int *)(param_1 + 0x150) + 4) = -*(float *)(*(int *)(param_1 + 0x150) + 4);
      puVar6 = (undefined4 *)FUN_00414b60();
      *(undefined4 *)(param_1 + 0x15c) = *puVar6;
    }
  }
  if ((*(byte *)(param_1 + 0xc9c) & 1) != 0) {
    FUN_00479014(*(int *)(param_1 + 0xc70),&local_18,&local_14);
    *(int *)(param_1 + 0x154) = *(int *)(param_1 + 0x154) + local_18;
    *(int *)(param_1 + 0x158) = *(int *)(param_1 + 0x158) + local_14;
    if (0x800 < *(int *)(param_1 + 0x154)) {
      *(undefined4 *)(param_1 + 0x154) = 0x800;
    }
    if (*(int *)(param_1 + 0x154) < -0x800) {
      *(undefined4 *)(param_1 + 0x154) = 0xfffff800;
    }
    local_c = (float)*(int *)(param_1 + 0x154) * _DAT_00476e30;
    if (0x800 < *(int *)(param_1 + 0x158)) {
      *(undefined4 *)(param_1 + 0x158) = 0x800;
    }
    if (*(int *)(param_1 + 0x158) < -0x800) {
      *(undefined4 *)(param_1 + 0x158) = 0xfffff800;
    }
    local_8 = (float)*(int *)(param_1 + 0x158) * _DAT_00476e30;
  }
  uVar9 = (undefined1)uVar1;
  if (((*(byte *)(param_1 + 0xc9c) & 8) == 0) || (local_1c == 0)) {
    if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
      (**(code **)(*(int *)(param_1 + 0x24) + 0x10))
                (param_1 + 0x24,*(int *)(param_1 + 0x150) + 0x10,uVar9);
      (**(code **)(*(int *)(param_1 + 0x84) + 0x10))
                (param_1 + 0x84,*(int *)(param_1 + 0x150) + 4,uVar9);
      (**(code **)(*(int *)(param_1 + 0xa4) + 0x10))
                (param_1 + 0xa4,*(int *)(param_1 + 0x150) + 8,uVar9);
    }
  }
  else {
    (**(code **)(*(int *)(param_1 + 0x24) + 0x10))
              (param_1 + 0x24,*(int *)(param_1 + 0xc90) + 0x440,uVar9);
    (**(code **)(*(int *)(param_1 + 0x44) + 0x10))
              (param_1 + 0x44,*(int *)(param_1 + 0xc90) + 0x444,uVar9);
    (**(code **)(*(int *)(param_1 + 100) + 0x10))
              (param_1 + 100,*(int *)(param_1 + 0xc90) + 0x448,uVar9);
    (**(code **)(*(int *)(param_1 + 0x84) + 0x10))
              (param_1 + 0x84,*(int *)(param_1 + 0xc90) + 0x44c,uVar9);
    (**(code **)(*(int *)(param_1 + 0xa4) + 0x10))
              (param_1 + 0xa4,*(int *)(param_1 + 0xc90) + 0x450,uVar9);
  }
  if ((*(byte *)(param_1 + 0xc9c) & 1) != 0) {
    (**(code **)(*(int *)(param_1 + 0xc4) + 0x10))(param_1 + 0xc4,&local_c,uVar9);
    (**(code **)(*(int *)(param_1 + 0xe4) + 0x10))(param_1 + 0xe4,&local_8,uVar9);
  }
  if (((*(byte *)(param_1 + 0xc9c) & 8) == 0) || (local_1c == 0)) {
    if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
      (**(code **)(*(int *)(param_1 + 0x104) + 0x10))
                (param_1 + 0x104,*(int *)(param_1 + 0x150) + 4,uVar9);
    }
  }
  else {
    local_40 = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x44c);
    local_3c = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x450);
    (**(code **)(*(int *)(param_1 + 0x104) + 0x10))(param_1 + 0x104,&local_40,uVar9);
  }
  if ((*(byte *)(param_1 + 0xc9c) & 1) != 0) {
    (**(code **)(*(int *)(param_1 + 0x128) + 0x10))(param_1 + 0x128,&local_c,uVar9);
  }
  if (((*(byte *)(param_1 + 0xc9c) & 2) != 0) && (local_10 = FUN_00478fb8(), local_10 != 0)) {
    FUN_004781f7(param_1 + 0x1a0,&local_10,uVar1);
    FUN_0044c9d4(param_1 + 0xc74,2,(char)local_10);
  }
  if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
    uVar1 = *(uint *)(*(int *)(param_1 + 0x150) + 0x14);
    if (uVar1 != 0) {
      if ((uVar1 & 1) != 0) {
        local_44 = 0xffffffbf;
        (**(code **)(*(int *)(param_1 + 0x9c0) + 0x10))(param_1 + 0x9c0,&local_44,uVar9);
      }
      if ((uVar1 & 2) != 0) {
        local_44 = 0xffffffba;
        (**(code **)(*(int *)(param_1 + 0xa60) + 0x10))(param_1 + 0xa60,&local_44,uVar9);
      }
      if ((uVar1 & 4) != 0) {
        local_44 = 0xffffffb9;
        (**(code **)(*(int *)(param_1 + 0xa80) + 0x10))(param_1 + 0xa80,&local_44,uVar9);
      }
      if ((uVar1 & 8) != 0) {
        local_44 = 0xffffffb8;
        (**(code **)(*(int *)(param_1 + 0xaa0) + 0x10))(param_1 + 0xaa0,&local_44,uVar9);
      }
      if ((uVar1 & 0x10) != 0) {
        local_44 = 0xffffffbd;
        (**(code **)(*(int *)(param_1 + 0xa00) + 0x10))(param_1 + 0xa00,&local_44,uVar9);
      }
      if ((uVar1 & 0x20) != 0) {
        local_44 = 0xffffffbe;
        (**(code **)(*(int *)(param_1 + 0x9e0) + 0x10))(param_1 + 0x9e0,&local_44,uVar9);
      }
      if ((uVar1 & 0x40) != 0) {
        local_44 = 0xffffffbb;
        (**(code **)(*(int *)(param_1 + 0xa40) + 0x10))(param_1 + 0xa40,&local_44,uVar9);
      }
      if ((uVar1 & 0x80) != 0) {
        local_44 = 0xffffffbc;
        (**(code **)(*(int *)(param_1 + 0xa20) + 0x10))(param_1 + 0xa20,&local_44,uVar9);
      }
    }
    uVar1 = *(uint *)(*(int *)(param_1 + 0x150) + 0x18);
    if (uVar1 != 0) {
      if ((uVar1 & 1) != 0) {
        local_44 = 0x41;
        (**(code **)(*(int *)(param_1 + 0x9c0) + 0x10))(param_1 + 0x9c0,&local_44,uVar9);
      }
      if ((uVar1 & 2) != 0) {
        local_44 = 0x46;
        (**(code **)(*(int *)(param_1 + 0xa60) + 0x10))(param_1 + 0xa60,&local_44,uVar9);
      }
      if ((uVar1 & 4) != 0) {
        local_44 = 0x47;
        (**(code **)(*(int *)(param_1 + 0xa80) + 0x10))(param_1 + 0xa80,&local_44,uVar9);
      }
      if ((uVar1 & 8) != 0) {
        local_44 = 0x48;
        (**(code **)(*(int *)(param_1 + 0xaa0) + 0x10))(param_1 + 0xaa0,&local_44,uVar9);
      }
      if ((uVar1 & 0x10) != 0) {
        local_44 = 0x43;
        (**(code **)(*(int *)(param_1 + 0xa00) + 0x10))(param_1 + 0xa00,&local_44,uVar9);
      }
      if ((uVar1 & 0x20) != 0) {
        local_44 = 0x42;
        (**(code **)(*(int *)(param_1 + 0x9e0) + 0x10))(param_1 + 0x9e0,&local_44,uVar9);
      }
      if ((uVar1 & 0x40) != 0) {
        local_44 = 0x45;
        (**(code **)(*(int *)(param_1 + 0xa40) + 0x10))(param_1 + 0xa40,&local_44,uVar9);
      }
      if ((uVar1 & 0x80) != 0) {
        local_44 = 0x44;
        (**(code **)(*(int *)(param_1 + 0xa20) + 0x10))(param_1 + 0xa20,&local_44,uVar9);
      }
    }
  }
  if ((*(byte *)(param_1 + 0xc9c) & 1) != 0) {
    iVar4 = 0;
    local_4c = **(int **)(param_1 + 0xc70);
    local_54 = (int *)(param_1 + 0xac0);
    local_48 = 0x48;
    if (0 < local_4c) {
      do {
        uVar3 = FUN_0047905c(*(int *)(param_1 + 0xc70),(short)iVar4);
        if (CONCAT22(extraout_var,uVar3) != 0) {
          local_50 = local_48 + 1;
          (**(code **)(*local_54 + 0x10))(local_48 * 0x20 + param_1 + 0x1c0,&local_50,uVar9);
        }
        uVar3 = FUN_00479080(*(int *)(param_1 + 0xc70),(short)iVar4);
        if (CONCAT22(extraout_var_00,uVar3) != 0) {
          local_50 = -1 - local_48;
          (**(code **)(*local_54 + 0x10))(local_48 * 0x20 + param_1 + 0x1c0,&local_50,uVar9);
        }
        local_54 = local_54 + 8;
        local_48 = local_48 + 1;
        iVar4 = iVar4 + 1;
      } while (iVar4 < local_4c);
    }
    (**(code **)(*(int *)(param_1 + 0xc4c) + 0x10))(param_1 + 0xc4c,&local_18,uVar9);
  }
  return;
}



/* @00476e34 file=? name=FUN_00476e34 */

void __cdecl FUN_00476e34(int param_1)

{
  if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
    (**(code **)(**(int **)(param_1 + 0x150) + 4))(*(int **)(param_1 + 0x150));
  }
  return;
}



/* @00476e54 file=? name=FUN_00476e54 */

void __cdecl FUN_00476e54(int param_1)

{
  if ((*(byte *)(param_1 + 0xc9c) & 8) != 0) {
    FUN_0047a4cc(*(int *)(param_1 + 0xc90));
  }
  if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
    (**(code **)(**(int **)(param_1 + 0x150) + 8))(*(int **)(param_1 + 0x150));
  }
  return;
}



/* @00476e8c file=? name=FUN_00476e8c */

void __cdecl FUN_00476e8c(int param_1)

{
  if ((*(byte *)(param_1 + 0xc9c) & 8) != 0) {
    FUN_0047a4cc(*(int *)(param_1 + 0xc90));
  }
  return;
}



/* @00476eac file=? name=FUN_00476eac */

void __cdecl FUN_00476eac(int param_1,float param_2)

{
  if ((*(byte *)(param_1 + 0xc9c) & 8) != 0) {
    FUN_0047a4f0(*(int *)(param_1 + 0xc90),param_2);
  }
  if ((*(byte *)(param_1 + 0xc9c) & 4) != 0) {
    FUN_004756b0(*(int *)(param_1 + 0x150),param_2);
  }
  return;
}



/* @00476eec file=? name=FUN_00476eec */

void __cdecl FUN_00476eec(int param_1,float param_2)

{
  if ((*(byte *)(param_1 + 0xc9c) & 8) != 0) {
    FUN_0047a520(*(int *)(param_1 + 0xc90),param_2);
  }
  return;
}



/* @00476f10 file=? name=FUN_00476f10 */

void __cdecl FUN_00476f10(int param_1,float param_2)

{
  if ((*(byte *)(param_1 + 0xc9c) & 8) != 0) {
    FUN_0047a53c(*(int *)(param_1 + 0xc90),param_2);
  }
  return;
}



/* @00476f34 file=? name=FUN_00476f34 */

char * __cdecl FUN_00476f34(int param_1)

{
  char *pcVar1;
  int iVar2;
  undefined **ppuVar3;
  undefined4 *puVar4;
  undefined4 local_100 [63];
  
  ppuVar3 = &PTR_s_AuxLowerRight8_004fbcfc;
  puVar4 = local_100;
  for (iVar2 = 0x3f; iVar2 != 0; iVar2 = iVar2 + -1) {
    *puVar4 = *ppuVar3;
    ppuVar3 = ppuVar3 + 1;
    puVar4 = puVar4 + 1;
  }
  if (param_1 < 0x40) {
    if (param_1 < 0) {
      pcVar1 = s_underrange_004fc690;
    }
    else {
      pcVar1 = (char *)local_100[param_1];
    }
  }
  else {
    pcVar1 = s_overrange_004fc686;
  }
  return pcVar1;
}



/* @00476f78 file=? name=FUN_00476f78 */

bool __cdecl FUN_00476f78(char *param_1,undefined4 *param_2)

{
  int iVar1;
  undefined **ppuVar2;
  int iVar3;
  
  iVar3 = 0;
  ppuVar2 = &PTR_s_ScalarThrottle_004fbdf8;
  do {
    iVar1 = FUN_004d4b58(param_1,*ppuVar2);
    if (iVar1 == 0) {
      *param_2 = ppuVar2[1];
      param_2[1] = ppuVar2[2];
      break;
    }
    iVar3 = iVar3 + 1;
    ppuVar2 = ppuVar2 + 3;
  } while (iVar3 < 0x43);
  return iVar3 < 0x43;
}



/* @00476fc0 file=? name=FUN_00476fc0 */

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

{
  undefined4 uVar1;
  int *piVar2;
  
  if (*(int *)(DAT_004efc94 + 0x4c) == 0) {
    piVar2 = (int *)0x0;
  }
  else {
    uVar1 = *(undefined4 *)(*(int *)(DAT_004efc94 + 0x4c) + 0x1c0c8);
    piVar2 = (int *)FUN_00402298(0x30);
    if (piVar2 == (int *)0x0) {
      piVar2 = (int *)0x0;
    }
    else {
      piVar2 = FUN_00474d80(piVar2,param_2,param_3,uVar1);
    }
    (**(code **)(*(int *)(param_1 + 0x1c0 + param_2 * 0x20) + 0x18))
              (param_2 * 0x20 + param_1 + 0x1c0,param_3,piVar2 + 8,piVar2);
  }
  return piVar2;
}



/* @0047703c file=munga_l4/l4ctrl.cpp name=FUN_0047703c */

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

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int *piVar7;
  int local_c;
  
  iVar1 = *param_3;
  piVar7 = param_3 + 1;
  local_c = 0;
  if (0 < iVar1) {
    do {
      iVar5 = FUN_0041f964(param_2,piVar7[3]);
      iVar2 = piVar7[1];
      iVar3 = piVar7[4];
      if (piVar7[2] == 0) {
        iVar6 = FUN_0041bf44(iVar5,piVar7[5]);
        iVar4 = *piVar7;
        if (iVar4 == 0) {
          (**(code **)(*(int *)(param_1 + 0x24 + iVar2 * 0x20) + 0x18))
                    (iVar2 * 0x20 + param_1 + 0x24,iVar3,iVar6,iVar5);
        }
        else if (iVar4 == 1) {
          (**(code **)(*(int *)(param_1 + 0x104 + iVar2 * 0x24) + 0x18))
                    (iVar2 * 0x24 + param_1 + 0x104,iVar3,iVar6,iVar5);
        }
        else if (iVar4 == 3) {
          (**(code **)(*(int *)(param_1 + 0x1c0 + iVar2 * 0x20) + 0x18))
                    (iVar2 * 0x20 + param_1 + 0x1c0,iVar3,iVar6,iVar5);
          if ((&DAT_004fbc74)[iVar2] == '\x01') {
            FUN_00476fc0(param_1,iVar2,iVar3);
          }
        }
        else {
          FUN_0040385c(s_Unknown_mapping_group__004fcbc2,s_d__tesla_bt_munga_l4_L4CTRL_CPP_004fcbda,
                       0x7bf);
        }
      }
      else if (piVar7[2] == 1) {
        iVar4 = piVar7[5];
        iVar6 = *piVar7;
        if (iVar6 == 0) {
          (**(code **)(*(int *)(param_1 + 0x24 + iVar2 * 0x20) + 0x14))
                    (iVar2 * 0x20 + param_1 + 0x24,iVar3,iVar5,iVar4,iVar5);
        }
        else if (iVar6 == 1) {
          (**(code **)(*(int *)(param_1 + 0x104 + iVar2 * 0x24) + 0x14))
                    (iVar2 * 0x24 + param_1 + 0x104,iVar3,iVar5,iVar4,iVar5);
        }
        else if (iVar6 == 3) {
          (**(code **)(*(int *)(param_1 + 0x1c0 + iVar2 * 0x20) + 0x14))
                    (iVar2 * 0x20 + param_1 + 0x1c0,iVar3,iVar5,iVar4,iVar5);
          if ((&DAT_004fbc74)[iVar2] == '\x01') {
            FUN_00476fc0(param_1,iVar2,iVar3);
          }
        }
        else {
          FUN_0040385c(s_Unknown_mapping_group__004fcbfa,s_d__tesla_bt_munga_l4_L4CTRL_CPP_004fcc12,
                       0x7f4);
        }
      }
      else {
        FUN_0040385c(s_Unknown_mapping_type__004fcc32,s_d__tesla_bt_munga_l4_L4CTRL_CPP_004fcc49,
                     0x7fa);
      }
      piVar7 = piVar7 + 6;
      local_c = local_c + 1;
    } while (local_c < iVar1);
  }
  return;
}



/* @00477284 file=? name=FUN_00477284 */

undefined8 __cdecl
FUN_00477284(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  undefined4 uVar1;
  undefined8 uVar2;
  
  *(undefined4 *)(param_1 + 0xca0) = param_2;
  FUN_00414b60();
  uVar1 = FUN_004dcd94();
  *(undefined4 *)(param_1 + 0xca4) = uVar1;
  *(undefined4 *)(param_1 + 0xca8) = param_4;
  uVar2 = FUN_00476568(param_1,0x3d,0x33);
  return uVar2;
}



/* @004772e8 file=? name=FUN_004772e8 */

undefined8 __cdecl FUN_004772e8(int param_1)

{
  int *piVar1;
  int iVar2;
  undefined8 uVar3;
  
  iVar2 = 0;
  *(undefined4 *)(param_1 + 0xca0) = 0;
  piVar1 = (int *)(param_1 + 0xcac);
  do {
    if (*piVar1 != 0) {
      FUN_0044c970(param_1 + 0xc74,*piVar1);
    }
    iVar2 = iVar2 + 1;
    piVar1 = piVar1 + 1;
  } while (iVar2 < 0x10);
  uVar3 = FUN_00476568(param_1,0x3d,0);
  return uVar3;
}



/* @00477334 file=? name=FUN_00477334 */

void __cdecl FUN_00477334(int *param_1)

{
  int *piVar1;
  undefined4 local_10;
  int local_c;
  undefined4 local_8;
  
  if (param_1[0x328] != 0) {
    piVar1 = (int *)FUN_00414b60();
    if (param_1[0x329] <= *piVar1) {
      local_c = param_1[0x32a];
      local_10 = 0xc;
      local_8 = 1;
      (**(code **)(*param_1 + 0xc))(param_1,&local_10);
    }
  }
  return;
}



/* @00477388 file=? name=FUN_00477388 */

void __cdecl FUN_00477388(int param_1)

{
  FUN_0044c704(param_1);
  return;
}



/* @00477398 file=? name=FUN_00477398 */

bool __cdecl FUN_00477398(int param_1)

{
  int iVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  bool bVar5;
  bool bVar6;
  bool bVar7;
  
  bVar7 = false;
  iVar1 = *(int *)(param_1 + 0xc90);
  if ((iVar1 != 0) &&
     (bVar2 = *(float *)(iVar1 + 0x440) != *(float *)(param_1 + 0xd04),
     bVar3 = *(float *)(iVar1 + 0x444) != *(float *)(param_1 + 0xd08),
     bVar4 = *(float *)(iVar1 + 0x448) != *(float *)(param_1 + 0xd0c),
     bVar5 = *(float *)(iVar1 + 0x44c) != *(float *)(param_1 + 0xcfc),
     bVar6 = *(float *)(iVar1 + 0x450) != *(float *)(param_1 + 0xd00),
     bVar7 = (((bVar2 || bVar3) || bVar4) || bVar5) || bVar6,
     (((bVar2 || bVar3) || bVar4) || bVar5) || bVar6)) {
    *(undefined4 *)(param_1 + 0xd04) = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x440);
    *(undefined4 *)(param_1 + 0xd08) = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x444);
    *(undefined4 *)(param_1 + 0xd0c) = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x448);
    *(undefined4 *)(param_1 + 0xcfc) = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x44c);
    *(undefined4 *)(param_1 + 0xd00) = *(undefined4 *)(*(int *)(param_1 + 0xc90) + 0x450);
  }
  return bVar7;
}



/* @00477484 file=? name=FUN_00477484 */

int __thiscall FUN_00477484(void *this,int param_1,uint *param_2)

{
  bool bVar1;
  int iVar2;
  uint uVar3;
  uint *puVar4;
  int *piVar5;
  undefined3 extraout_var;
  undefined8 uVar6;
  undefined *puVar7;
  uint *puVar8;
  undefined *puVar9;
  
  if (*(int *)(param_1 + 0xcf4) == 0) {
    iVar2 = FUN_0047a0e8(this,*(undefined4 *)(param_1 + 0xc90),*(undefined4 *)(param_1 + 0xc90),
                         param_2);
    if (((iVar2 != 0) && (*(int *)(param_1 + 0xcf8) != 0)) &&
       (uVar3 = (**(code **)(**(int **)(param_1 + 0xcec) + 4))(*(int **)(param_1 + 0xcec)),
       0x1b < uVar3)) {
      puVar4 = (uint *)(**(code **)**(undefined4 **)(param_1 + 0xcec))
                                 (*(undefined4 **)(param_1 + 0xcec));
      piVar5 = (int *)FUN_00414b60();
      *puVar4 = *piVar5 - *(int *)(param_1 + 0xcf0);
      if (*param_2 == 3) {
        bVar1 = FUN_00477398(param_1);
        if (CONCAT31(extraout_var,bVar1) != 0) {
          uVar3 = *puVar4;
          FUN_004dbb24(&DAT_00524e20,s_AnalogEvent_at_004fcc69,(char *)0x0);
          piVar5 = FUN_004db78c(&DAT_00524e20,uVar3);
          FUN_004dbb24(piVar5,&DAT_004fcc78,(char *)0x0);
          puVar9 = &LAB_004d9c84;
          puVar7 = &LAB_004d9ca4;
          puVar8 = puVar4;
          FUN_004dbb24(&DAT_00524e20,s_Pointer__004fcc7a,(char *)0x0);
          piVar5 = FUN_004dbaa8(&DAT_00524e20,puVar7);
          uVar6 = FUN_004dbd4c(piVar5,(uint)puVar8);
          piVar5 = FUN_004dbaa8((undefined4 *)uVar6,puVar9);
          FUN_004dbb24(piVar5,&DAT_004fcc83,(char *)0x0);
          puVar4[1] = 0;
          puVar4[4] = *(uint *)(*(int *)(param_1 + 0xc90) + 0x440);
          puVar4[5] = *(uint *)(*(int *)(param_1 + 0xc90) + 0x444);
          puVar4[6] = *(uint *)(*(int *)(param_1 + 0xc90) + 0x448);
          puVar4[2] = *(uint *)(*(int *)(param_1 + 0xc90) + 0x44c);
          puVar4[3] = *(uint *)(*(int *)(param_1 + 0xc90) + 0x450);
          (**(code **)(**(int **)(param_1 + 0xcec) + 0x14))(*(int **)(param_1 + 0xcec),0x1c);
        }
      }
      else {
        uVar3 = *puVar4;
        FUN_004dbb24(&DAT_00524e20,s_DigitalEvent_at_004fcc85,(char *)0x0);
        piVar5 = FUN_004db78c(&DAT_00524e20,uVar3);
        FUN_004dbb24(piVar5,&DAT_004fcc95,(char *)0x0);
        puVar9 = &LAB_004d9c84;
        puVar7 = &LAB_004d9ca4;
        puVar8 = puVar4;
        FUN_004dbb24(&DAT_00524e20,s_Pointer__004fcc97,(char *)0x0);
        piVar5 = FUN_004dbaa8(&DAT_00524e20,puVar7);
        uVar6 = FUN_004dbd4c(piVar5,(uint)puVar8);
        piVar5 = FUN_004dbaa8((undefined4 *)uVar6,puVar9);
        FUN_004dbb24(piVar5,&DAT_004fcca0,(char *)0x0);
        puVar4[1] = 1;
        puVar4[2] = *param_2;
        puVar4[3] = param_2[1];
        puVar4[4] = param_2[2];
        (**(code **)(**(int **)(param_1 + 0xcec) + 0x14))(*(int **)(param_1 + 0xcec),0x1c);
      }
    }
  }
  else {
    if ((*(int *)(param_1 + 0xcf8) != 0) &&
       (uVar3 = (**(code **)(**(int **)(param_1 + 0xcec) + 4))(*(int **)(param_1 + 0xcec)),
       0x1b < uVar3)) {
      puVar4 = (uint *)(**(code **)**(undefined4 **)(param_1 + 0xcec))
                                 (*(undefined4 **)(param_1 + 0xcec));
      piVar5 = (int *)FUN_00414b60();
      if ((int)*puVar4 <= *piVar5 - *(int *)(param_1 + 0xcf0)) {
        uVar3 = *puVar4;
        FUN_004dbb24(&DAT_00524e20,s_Event_timestamp__004fcca2,(char *)0x0);
        piVar5 = FUN_004db78c(&DAT_00524e20,uVar3);
        FUN_004dbb24(piVar5,&DAT_004fccb3,(char *)0x0);
        if (puVar4[1] == 0) {
          FUN_004dbb24(&DAT_00524e20,s_AnalogEvent_004fccb5,(char *)0x0);
          *param_2 = 3;
          iVar2 = *(int *)(param_1 + 0xc90);
          *(uint *)(iVar2 + 0x440) = puVar4[4];
          *(uint *)(iVar2 + 0x444) = puVar4[5];
          *(uint *)(iVar2 + 0x448) = puVar4[6];
          *(uint *)(iVar2 + 0x44c) = puVar4[2];
          *(uint *)(iVar2 + 0x450) = puVar4[3];
        }
        else if (puVar4[1] == 1) {
          FUN_004dbb24(&DAT_00524e20,s_DigitalEvent_004fccc2,(char *)0x0);
          *param_2 = puVar4[2];
          param_2[1] = puVar4[3];
          param_2[2] = puVar4[4];
        }
        (**(code **)(**(int **)(param_1 + 0xcec) + 0x14))(*(int **)(param_1 + 0xcec),0x1c);
        return 1;
      }
    }
    iVar2 = 0;
  }
  return iVar2;
}



/* @00477800 file=? name=FUN_00477800 */

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

{
  int iVar1;
  uint uVar2;
  int local_c;
  int local_8;
  
  iVar1 = *param_2;
  uVar2 = *(uint *)(*(int *)(DAT_004efc94 + 0x50) + 4);
  if (iVar1 == 0) {
    local_8 = param_2[1] + 1;
    (**(code **)(*(int *)(param_1 + 0x1c0 + param_2[1] * 0x20) + 0x10))
              (param_2[1] * 0x20 + param_1 + 0x1c0,&local_8,uVar2);
    *(uint *)(param_1 + 0xb20 + param_2[1] * 4) = uVar2;
  }
  else if (iVar1 == 1) {
    local_8 = -1 - param_2[1];
    (**(code **)(*(int *)(param_1 + 0x1c0 + param_2[1] * 0x20) + 0x10))
              (param_2[1] * 0x20 + param_1 + 0x1c0,&local_8,
               *(undefined4 *)(param_1 + 0xb20 + param_2[1] * 4));
  }
  else if (iVar1 == 2) {
    local_c = param_2[2];
    if (local_c < 10) {
      local_c = local_c + 0x30;
    }
    else {
      local_c = local_c + 0x37;
    }
    FUN_004781f7(param_2[1] * 0x20 + param_1 + 0x160,&local_c,uVar2);
    FUN_0044c9d4(param_1 + 0xc74,param_2[1],(char)local_c);
  }
  else if (iVar1 == 3) {
    *(undefined4 *)(param_1 + 0xc94) = 0;
    *param_3 = 1;
  }
  return;
}



/* @0047790c file=? name=FUN_0047790c */

void __cdecl FUN_0047790c(int param_1,LPCSTR param_2)

{
  undefined **local_20 [6];
  int local_8;
  
  FUN_004034b0(local_20,param_2,1);
  local_8 = *(int *)(*(int *)(param_1 + 0xcec) + 8) - *(int *)(*(int *)(param_1 + 0xcec) + 4);
  if (local_8 != 0) {
    (**(code **)(**(int **)(param_1 + 0xcec) + 0xc))(*(int **)(param_1 + 0xcec),0);
    (*(code *)local_20[0][8])(local_20,&local_8,4);
    FUN_00403248((int *)local_20,*(int **)(param_1 + 0xcec));
  }
  local_20[0] = &PTR_FUN_004e09e0;
  FUN_00403564((int)local_20);
  return;
}



/* @00477990 file=? name=FUN_00477990 */

void __cdecl FUN_00477990(undefined4 param_1,LPCSTR param_2)

{
  char *extraout_EAX;
  undefined4 *puVar1;
  int iVar2;
  int *piVar3;
  undefined **local_20 [6];
  char *local_8;
  
  FUN_004034b0(local_20,param_2,0);
  local_8 = (char *)0x0;
  (*(code *)local_20[0][7])(local_20,&local_8,4);
  piVar3 = FUN_004de998((int *)0x0,0x1c,12000,1,FUN_00477a8e);
  puVar1 = (undefined4 *)FUN_00402298(0x10);
  if (puVar1 == (undefined4 *)0x0) {
    iVar2 = 0;
  }
  else {
    iVar2 = FUN_004030dc(puVar1,extraout_EAX,local_8,0);
  }
  piVar3[0x33b] = iVar2;
  FUN_004035f0((int)local_20,extraout_EAX,local_8);
  local_20[0] = &PTR_FUN_004e09e0;
  FUN_00403564((int)local_20);
  return;
}



/* @00477a8e file=? name=FUN_00477a8e */

undefined4 __cdecl FUN_00477a8e(undefined4 param_1)

{
  return param_1;
}



/* @00477a96 file=? name=FUN_00477a96 */

undefined4 FUN_00477a96(void)

{
  return 1;
}



/* @00477aa0 file=? name=FUN_00477aa0 */

undefined4 * __cdecl FUN_00477aa0(undefined4 *param_1)

{
  FUN_0044c3f8(param_1);
  *param_1 = &PTR_FUN_004fce7c;
  return param_1;
}



/* @00477ab9 file=? name=FUN_00477ab9 */

void __cdecl FUN_00477ab9(int *param_1,byte param_2)

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



/* @00477ae5 file=? name=FUN_00477ae5 */

void __cdecl FUN_00477ae5(int param_1,float *param_2,uint param_3)

{
  if (*(float *)(param_1 + 0x1c) != *param_2) {
    FUN_00477b08(param_1,param_2,param_3);
  }
  return;
}



/* @00477b08 file=? name=FUN_00477b08 */

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

{
  *(undefined4 *)(param_1 + 0x1c) = *param_2;
  FUN_0044c4d0(param_1,param_2,param_3);
  return;
}



/* @00477b26 file=? name=FUN_00477b26 */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x24);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478877(puVar1,param_2,param_3,param_4,param_5);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @00477b71 file=? name=FUN_00477b71 */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478970(puVar1,param_2,param_3,param_4);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @00477bb8 file=? name=FUN_00477bb8 */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_00477c2b;
  } while ((((puVar1[1] != 0x39) || (puVar1[7] != param_3)) || (puVar1[8] != param_4)) ||
          ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_00477c2b:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x24);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478877(puVar1,param_2,param_3,param_4,param_5);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @00477c9c file=? name=FUN_00477c9c */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_00477d05;
  } while (((puVar1[1] != 0x38) || (puVar1[7] != param_3)) || ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_00477d05:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x20);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478970(puVar1,param_2,param_3,param_4);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @00477d72 file=? name=FUN_00477d72 */

uint __cdecl FUN_00477d72(int param_1,int param_2,int param_3,int param_4,uint param_5)

{
  int iVar1;
  uint uVar2;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  uVar2 = 0;
  while( true ) {
    iVar1 = (**(code **)(local_10[0] + 0x28))(local_10);
    if (iVar1 == 0) break;
    if ((*(uint *)(iVar1 + 0xc) & param_5) != 0) {
      if (*(int *)(iVar1 + 4) == 0x38) {
        if (param_2 == *(int *)(iVar1 + 0x1c)) {
          uVar2 = uVar2 | 2;
        }
        else {
          uVar2 = uVar2 | 1;
        }
      }
      else if ((*(int *)(iVar1 + 0x1c) == param_3) && (*(int *)(iVar1 + 0x20) == param_4)) {
        uVar2 = uVar2 | 2;
      }
      else {
        uVar2 = uVar2 | 1;
      }
    }
  }
  FUN_0044cbb0(local_10,2);
  return uVar2;
}



/* @00477e02 file=? name=FUN_00477e02 */

undefined4 FUN_00477e02(void)

{
  return 1;
}



/* @00477e0c file=? name=FUN_00477e0c */

undefined4 * __cdecl FUN_00477e0c(undefined4 *param_1)

{
  FUN_0044c3f8(param_1);
  *param_1 = &PTR_FUN_004fce54;
  return param_1;
}



/* @00477e25 file=? name=FUN_00477e25 */

void __cdecl FUN_00477e25(int *param_1,byte param_2)

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



/* @00477e51 file=? name=FUN_00477e51 */

void __cdecl FUN_00477e51(int param_1,float *param_2,uint param_3)

{
  int iVar1;
  
  iVar1 = FUN_0045961f((float *)(param_1 + 0x1c),param_2,0.0001);
  if (iVar1 == 0) {
    FUN_00477e88(param_1,param_2,param_3);
  }
  return;
}



/* @00477e88 file=? name=FUN_00477e88 */

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

{
  *(undefined4 *)(param_1 + 0x1c) = *param_2;
  *(undefined4 *)(param_1 + 0x20) = param_2[1];
  FUN_0044c4d0(param_1,param_2,param_3);
  return;
}



/* @00477eac file=? name=FUN_00477eac */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x24);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478a1f(puVar1,param_2,param_3,param_4,param_5);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @00477ef7 file=? name=FUN_00477ef7 */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478b1e(puVar1,param_2,param_3,param_4);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @00477f3e file=? name=FUN_00477f3e */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_00477fb1;
  } while ((((puVar1[1] != 0x39) || (puVar1[7] != param_3)) || (puVar1[8] != param_4)) ||
          ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_00477fb1:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x24);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478a1f(puVar1,param_2,param_3,param_4,param_5);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @00478022 file=? name=FUN_00478022 */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_0047808b;
  } while (((puVar1[1] != 0x38) || (puVar1[7] != param_3)) || ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_0047808b:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x20);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478b1e(puVar1,param_2,param_3,param_4);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @004780f8 file=? name=FUN_004780f8 */

uint __cdecl FUN_004780f8(int param_1,int param_2,int param_3,int param_4,uint param_5)

{
  int iVar1;
  uint uVar2;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  uVar2 = 0;
  while( true ) {
    iVar1 = (**(code **)(local_10[0] + 0x28))(local_10);
    if (iVar1 == 0) break;
    if ((*(uint *)(iVar1 + 0xc) & param_5) != 0) {
      if (*(int *)(iVar1 + 4) == 0x38) {
        if (param_2 == *(int *)(iVar1 + 0x1c)) {
          uVar2 = uVar2 | 2;
        }
        else {
          uVar2 = uVar2 | 1;
        }
      }
      else if ((*(int *)(iVar1 + 0x1c) == param_3) && (*(int *)(iVar1 + 0x20) == param_4)) {
        uVar2 = uVar2 | 2;
      }
      else {
        uVar2 = uVar2 | 1;
      }
    }
  }
  FUN_0044cbb0(local_10,2);
  return uVar2;
}



/* @00478188 file=? name=FUN_00478188 */

undefined4 FUN_00478188(void)

{
  return 1;
}



/* @00478192 file=? name=FUN_00478192 */

undefined4 * __cdecl FUN_00478192(undefined4 *param_1)

{
  FUN_0044c3f8(param_1);
  *param_1 = &PTR_FUN_004fce2c;
  return param_1;
}



/* @004781ab file=? name=FUN_004781ab */

void __cdecl FUN_004781ab(int *param_1,byte param_2)

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



/* @004781d7 file=? name=FUN_004781d7 */

void __cdecl FUN_004781d7(int param_1,int *param_2,uint param_3)

{
  if (*(int *)(param_1 + 0x1c) != *param_2) {
    FUN_004781f7(param_1,param_2,param_3);
  }
  return;
}



/* @004781f7 file=? name=FUN_004781f7 */

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

{
  *(undefined4 *)(param_1 + 0x1c) = *param_2;
  FUN_0044c4d0(param_1,param_2,param_3);
  return;
}



/* @00478215 file=? name=FUN_00478215 */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x24);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478bd3(puVar1,param_2,param_3,param_4,param_5);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @00478260 file=? name=FUN_00478260 */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478ccc(puVar1,param_2,param_3,param_4);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @004782a7 file=? name=FUN_004782a7 */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_0047831a;
  } while ((((puVar1[1] != 0x39) || (puVar1[7] != param_3)) || (puVar1[8] != param_4)) ||
          ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_0047831a:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x24);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478bd3(puVar1,param_2,param_3,param_4,param_5);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @0047838b file=? name=FUN_0047838b */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_004783f4;
  } while (((puVar1[1] != 0x38) || (puVar1[7] != param_3)) || ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_004783f4:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x20);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478ccc(puVar1,param_2,param_3,param_4);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @00478461 file=? name=FUN_00478461 */

uint __cdecl FUN_00478461(int param_1,int param_2,int param_3,int param_4,uint param_5)

{
  int iVar1;
  uint uVar2;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  uVar2 = 0;
  while( true ) {
    iVar1 = (**(code **)(local_10[0] + 0x28))(local_10);
    if (iVar1 == 0) break;
    if ((*(uint *)(iVar1 + 0xc) & param_5) != 0) {
      if (*(int *)(iVar1 + 4) == 0x38) {
        if (param_2 == *(int *)(iVar1 + 0x1c)) {
          uVar2 = uVar2 | 2;
        }
        else {
          uVar2 = uVar2 | 1;
        }
      }
      else if ((*(int *)(iVar1 + 0x1c) == param_3) && (*(int *)(iVar1 + 0x20) == param_4)) {
        uVar2 = uVar2 | 2;
      }
      else {
        uVar2 = uVar2 | 1;
      }
    }
  }
  FUN_0044cbb0(local_10,2);
  return uVar2;
}



/* @004784f1 file=? name=FUN_004784f1 */

undefined4 FUN_004784f1(void)

{
  return 1;
}



/* @004784fb file=? name=FUN_004784fb */

undefined4 * __cdecl FUN_004784fb(undefined4 *param_1)

{
  FUN_0044c3f8(param_1);
  *param_1 = &PTR_FUN_004fce04;
  return param_1;
}



/* @00478514 file=? name=FUN_00478514 */

void __cdecl FUN_00478514(int *param_1,byte param_2)

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



/* @00478540 file=? name=FUN_00478540 */

void __cdecl FUN_00478540(int param_1,int *param_2,uint param_3)

{
  int iVar1;
  
  iVar1 = FUN_00478f2f((int *)(param_1 + 0x1c),param_2,0.0001);
  if (iVar1 == 0) {
    FUN_00478577(param_1,param_2,param_3);
  }
  return;
}



/* @00478577 file=? name=FUN_00478577 */

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

{
  *(undefined4 *)(param_1 + 0x1c) = *param_2;
  *(undefined4 *)(param_1 + 0x20) = param_2[1];
  FUN_0044c4d0(param_1,param_2,param_3);
  return;
}



/* @0047859b file=? name=FUN_0047859b */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x24);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478d7b(puVar1,param_2,param_3,param_4,param_5);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @004785e6 file=? name=FUN_004785e6 */

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

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00478e7a(puVar1,param_2,param_3,param_4);
  }
  (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
  return puVar1;
}



/* @0047862d file=? name=FUN_0047862d */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_004786a0;
  } while ((((puVar1[1] != 0x39) || (puVar1[7] != param_3)) || (puVar1[8] != param_4)) ||
          ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_004786a0:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x24);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478d7b(puVar1,param_2,param_3,param_4,param_5);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @00478711 file=? name=FUN_00478711 */

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

{
  undefined4 *puVar1;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  do {
    puVar1 = (undefined4 *)(**(code **)(local_10[0] + 0x28))(local_10);
    if (puVar1 == (undefined4 *)0x0) goto LAB_0047877a;
  } while (((puVar1[1] != 0x38) || (puVar1[7] != param_3)) || ((puVar1[3] & param_2) == 0));
  puVar1[3] = puVar1[3] & ~param_2;
  if ((puVar1[3] == 0) && (puVar1 != (undefined4 *)0x0)) {
    (**(code **)*puVar1)(puVar1,3);
  }
LAB_0047877a:
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)FUN_00402298(0x20);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_00478e7a(puVar1,param_2,param_3,param_4);
    }
    (**(code **)(*(int *)(param_1 + 0xc) + 4))(param_1 + 0xc,puVar1);
    FUN_0044cbb0(local_10,2);
  }
  else {
    puVar1 = (undefined4 *)0x0;
    FUN_0044cbb0(local_10,2);
  }
  return puVar1;
}



/* @004787e7 file=? name=FUN_004787e7 */

uint __cdecl FUN_004787e7(int param_1,int param_2,int param_3,int param_4,uint param_5)

{
  int iVar1;
  uint uVar2;
  int local_10 [3];
  
  FUN_0044cb72(local_10,param_1 + 0xc);
  uVar2 = 0;
  while( true ) {
    iVar1 = (**(code **)(local_10[0] + 0x28))(local_10);
    if (iVar1 == 0) break;
    if ((*(uint *)(iVar1 + 0xc) & param_5) != 0) {
      if (*(int *)(iVar1 + 4) == 0x38) {
        if (param_2 == *(int *)(iVar1 + 0x1c)) {
          uVar2 = uVar2 | 2;
        }
        else {
          uVar2 = uVar2 | 1;
        }
      }
      else if ((*(int *)(iVar1 + 0x1c) == param_3) && (*(int *)(iVar1 + 0x20) == param_4)) {
        uVar2 = uVar2 | 2;
      }
      else {
        uVar2 = uVar2 | 1;
      }
    }
  }
  FUN_0044cbb0(local_10,2);
  return uVar2;
}



/* @00478877 file=? name=FUN_00478877 */

undefined4 * __cdecl
FUN_00478877(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0044c344(param_1,0x39,param_2,param_5);
  *param_1 = &PTR_FUN_004fcdf4;
  param_1[7] = param_3;
  param_1[8] = param_4;
  return param_1;
}



/* @004788a8 file=? name=FUN_004788a8 */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x39,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcdf4;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  param_1[8] = *(undefined4 *)(param_2 + 0x20);
  return param_1;
}



/* @004788e5 file=? name=FUN_004788e5 */

void __cdecl FUN_004788e5(int *param_1,byte param_2)

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



/* @00478911 file=? name=FUN_00478911 */

void __cdecl FUN_00478911(int param_1,undefined4 *param_2)

{
  uint local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_10 = *(undefined4 *)(param_1 + 0x20);
  local_14 = 0x10;
  local_c = 1;
  local_8 = *param_2;
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),3,*(undefined4 *)(param_1 + 0x1c),&local_14,
               DAT_004e17f4);
  return;
}



/* @00478961 file=? name=FUN_00478961 */

void FUN_00478961(void)

{
  FUN_00415f1c();
  return;
}



/* @00478970 file=? name=FUN_00478970 */

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

{
  FUN_0044c344(param_1,0x38,param_2,param_4);
  *param_1 = &PTR_FUN_004fcde4;
  param_1[7] = param_3;
  return param_1;
}



/* @0047899b file=? name=FUN_0047899b */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x38,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcde4;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  return param_1;
}



/* @004789d2 file=? name=FUN_004789d2 */

void __cdecl FUN_004789d2(int *param_1,byte param_2)

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



/* @004789fe file=? name=FUN_004789fe */

void __cdecl FUN_004789fe(int param_1,undefined4 *param_2)

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



/* @00478a10 file=? name=FUN_00478a10 */

void FUN_00478a10(void)

{
  FUN_00415f1c();
  return;
}



/* @00478a1f file=? name=FUN_00478a1f */

undefined4 * __cdecl
FUN_00478a1f(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0044c344(param_1,0x39,param_2,param_5);
  *param_1 = &PTR_FUN_004fcdd4;
  param_1[7] = param_3;
  param_1[8] = param_4;
  return param_1;
}



/* @00478a50 file=? name=FUN_00478a50 */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x39,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcdd4;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  param_1[8] = *(undefined4 *)(param_2 + 0x20);
  return param_1;
}



/* @00478a8d file=? name=FUN_00478a8d */

void __cdecl FUN_00478a8d(int *param_1,byte param_2)

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



/* @00478ab9 file=? name=FUN_00478ab9 */

void __cdecl FUN_00478ab9(int param_1,undefined4 *param_2)

{
  uint local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_14 = *(undefined4 *)(param_1 + 0x20);
  local_18 = 0x14;
  local_10 = 1;
  local_c = *param_2;
  local_8 = param_2[1];
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),3,*(undefined4 *)(param_1 + 0x1c),&local_18,
               DAT_004e17f4);
  return;
}



/* @00478b0f file=? name=FUN_00478b0f */

void FUN_00478b0f(void)

{
  FUN_00415f1c();
  return;
}



/* @00478b1e file=? name=FUN_00478b1e */

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

{
  FUN_0044c344(param_1,0x38,param_2,param_4);
  *param_1 = &PTR_FUN_004fcdc4;
  param_1[7] = param_3;
  return param_1;
}



/* @00478b49 file=? name=FUN_00478b49 */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x38,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcdc4;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  return param_1;
}



/* @00478b80 file=? name=FUN_00478b80 */

void __cdecl FUN_00478b80(int *param_1,byte param_2)

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



/* @00478bac file=? name=FUN_00478bac */

void __cdecl FUN_00478bac(int param_1,undefined4 *param_2)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 0x1c);
  *puVar1 = *param_2;
  puVar1[1] = param_2[1];
  return;
}



/* @00478bc4 file=? name=FUN_00478bc4 */

void FUN_00478bc4(void)

{
  FUN_00415f1c();
  return;
}



/* @00478bd3 file=? name=FUN_00478bd3 */

undefined4 * __cdecl
FUN_00478bd3(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0044c344(param_1,0x39,param_2,param_5);
  *param_1 = &PTR_FUN_004fcdb4;
  param_1[7] = param_3;
  param_1[8] = param_4;
  return param_1;
}



/* @00478c04 file=? name=FUN_00478c04 */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x39,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcdb4;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  param_1[8] = *(undefined4 *)(param_2 + 0x20);
  return param_1;
}



/* @00478c41 file=? name=FUN_00478c41 */

void __cdecl FUN_00478c41(int *param_1,byte param_2)

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



/* @00478c6d file=? name=FUN_00478c6d */

void __cdecl FUN_00478c6d(int param_1,undefined4 *param_2)

{
  uint local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_10 = *(undefined4 *)(param_1 + 0x20);
  local_14 = 0x10;
  local_c = 1;
  local_8 = *param_2;
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),3,*(undefined4 *)(param_1 + 0x1c),&local_14,
               DAT_004e17f4);
  return;
}



/* @00478cbd file=? name=FUN_00478cbd */

void FUN_00478cbd(void)

{
  FUN_00415f1c();
  return;
}



/* @00478ccc file=? name=FUN_00478ccc */

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

{
  FUN_0044c344(param_1,0x38,param_2,param_4);
  *param_1 = &PTR_FUN_004fcda4;
  param_1[7] = param_3;
  return param_1;
}



/* @00478cf7 file=? name=FUN_00478cf7 */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x38,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcda4;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  return param_1;
}



/* @00478d2e file=? name=FUN_00478d2e */

void __cdecl FUN_00478d2e(int *param_1,byte param_2)

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



/* @00478d5a file=? name=FUN_00478d5a */

void __cdecl FUN_00478d5a(int param_1,undefined4 *param_2)

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



/* @00478d6c file=? name=FUN_00478d6c */

void FUN_00478d6c(void)

{
  FUN_00415f1c();
  return;
}



/* @00478d7b file=? name=FUN_00478d7b */

undefined4 * __cdecl
FUN_00478d7b(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0044c344(param_1,0x39,param_2,param_5);
  *param_1 = &PTR_FUN_004fcd94;
  param_1[7] = param_3;
  param_1[8] = param_4;
  return param_1;
}



/* @00478dac file=? name=FUN_00478dac */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x39,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcd94;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  param_1[8] = *(undefined4 *)(param_2 + 0x20);
  return param_1;
}



/* @00478de9 file=? name=FUN_00478de9 */

void __cdecl FUN_00478de9(int *param_1,byte param_2)

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



/* @00478e15 file=? name=FUN_00478e15 */

void __cdecl FUN_00478e15(int param_1,undefined4 *param_2)

{
  uint local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_14 = *(undefined4 *)(param_1 + 0x20);
  local_18 = 0x14;
  local_10 = 1;
  local_c = *param_2;
  local_8 = param_2[1];
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),3,*(undefined4 *)(param_1 + 0x1c),&local_18,
               DAT_004e17f4);
  return;
}



/* @00478e6b file=? name=FUN_00478e6b */

void FUN_00478e6b(void)

{
  FUN_00415f1c();
  return;
}



/* @00478e7a file=? name=FUN_00478e7a */

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

{
  FUN_0044c344(param_1,0x38,param_2,param_4);
  *param_1 = &PTR_FUN_004fcd84;
  param_1[7] = param_3;
  return param_1;
}



/* @00478ea5 file=? name=FUN_00478ea5 */

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

{
  undefined4 uVar1;
  
  uVar1 = FUN_00417ab4(param_2 + 0x10);
  FUN_0044c344(param_1,0x38,*(undefined4 *)(param_2 + 0xc),uVar1);
  *param_1 = &PTR_FUN_004fcd84;
  param_1[7] = *(undefined4 *)(param_2 + 0x1c);
  return param_1;
}



/* @00478edc file=? name=FUN_00478edc */

void __cdecl FUN_00478edc(int *param_1,byte param_2)

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



/* @00478f08 file=? name=FUN_00478f08 */

void __cdecl FUN_00478f08(int param_1,undefined4 *param_2)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 0x1c);
  *puVar1 = *param_2;
  puVar1[1] = param_2[1];
  return;
}



/* @00478f20 file=? name=FUN_00478f20 */

void FUN_00478f20(void)

{
  FUN_00415f1c();
  return;
}



/* @00478f2f file=? name=FUN_00478f2f */

undefined4 __cdecl FUN_00478f2f(int *param_1,int *param_2,float param_3)

{
  float10 fVar1;
  
  fVar1 = FUN_004dcd00((double)((float)*param_1 - (float)*param_2));
  if ((fVar1 <= (float10)param_3) &&
     (fVar1 = FUN_004dcd00((double)((float)param_1[1] - (float)param_2[1])),
     fVar1 <= (float10)param_3)) {
    return 1;
  }
  return 0;
}



/* @00478fb8 file=? name=FUN_00478fb8 */

uint FUN_00478fb8(void)

{
  int iVar1;
  uint uVar2;
  
  iVar1 = FUN_004d4888();
  if (iVar1 == 0) {
    return 0;
  }
  uVar2 = FUN_004d4718();
  if (uVar2 == 0) {
    uVar2 = FUN_004d4718();
    uVar2 = uVar2 | 0x100;
  }
  return uVar2;
}



/* @00478fd8 file=? name=FUN_00478fd8 */

uint * FUN_00478fd8(void)

{
  code *pcVar1;
  short sVar2;
  uint *extraout_EDX;
  uint unaff_EBX;
  
  pcVar1 = (code *)swi(0x33);
  sVar2 = (*pcVar1)();
  if (sVar2 == -1) {
    *extraout_EDX = unaff_EBX & 0xffff;
    extraout_EDX[1] = 0;
  }
  else {
    extraout_EDX[1] = 1;
    *extraout_EDX = 0;
  }
  return extraout_EDX;
}



/* @00479008 file=? name=FUN_00479008 */

undefined4 FUN_00479008(void)

{
  return 1;
}



/* @00479014 file=? name=FUN_00479014 */

void __cdecl FUN_00479014(int param_1,uint *param_2,uint *param_3)

{
  code *pcVar1;
  uint uVar2;
  uint extraout_ECX;
  uint extraout_EDX;
  uint uVar3;
  
  if (*(int *)(param_1 + 4) == 0) {
    pcVar1 = (code *)swi(0x33);
    (*pcVar1)();
    uVar2 = extraout_ECX & 0xffff;
    uVar3 = extraout_EDX & 0xffff;
    if ((extraout_ECX & 0x8000) != 0) {
      uVar2 = uVar2 | 0xffff0000;
    }
    if ((extraout_EDX & 0x8000) != 0) {
      uVar3 = uVar3 | 0xffff0000;
    }
    *param_2 = uVar2;
    *param_3 = uVar3;
  }
  else {
    *param_2 = 0;
    *param_3 = 0;
  }
  return;
}



/* @0047905c file=? name=FUN_0047905c */

undefined2 __cdecl FUN_0047905c(int param_1,undefined2 param_2)

{
  code *pcVar1;
  
  if (*(int *)(param_1 + 4) != 0) {
    return 0;
  }
  pcVar1 = (code *)swi(0x33);
  (*pcVar1)();
  return param_2;
}



/* @00479080 file=? name=FUN_00479080 */

undefined2 __cdecl FUN_00479080(int param_1,undefined2 param_2)

{
  code *pcVar1;
  
  if (*(int *)(param_1 + 4) != 0) {
    return 0;
  }
  pcVar1 = (code *)swi(0x33);
  (*pcVar1)();
  return param_2;
}



/* @004790a4 file=? name=FUN_004790a4 */

uint __cdecl FUN_004790a4(byte param_1,byte param_2)

{
  uint uVar1;
  
  uVar1 = param_1 & 0x7f | (uint)param_2 << 7;
  if ((param_2 & 0x40) != 0) {
    uVar1 = uVar1 | 0xffffc000;
  }
  return uVar1;
}



/* @004790c8 file=? name=FUN_004790c8 */

void __cdecl FUN_004790c8(int param_1)

{
  char local_2c [40];
  
  FUN_004d7f10(local_2c,s__s_Slot__d_Address__d_004fcfbf);
  FUN_00404490(param_1,s_RIOBoardErrors_004fcfd5,s_error_004fcfe4,local_2c);
  return;
}



/* @00479110 file=? name=FUN_00479110 */

undefined4 * __cdecl FUN_00479110(undefined4 *param_1)

{
  *param_1 = &PTR_FUN_004fd2a4;
  FUN_0047a78d(param_1 + 0xe,5,0);
  param_1[0xd] = 0;
  param_1[4] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[0xc] = 0x3cf5c28f;
  param_1[9] = 0;
  param_1[0xb] = 0;
  return param_1;
}



/* @00479158 file=? name=FUN_00479158 */

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

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  int iVar2;
  
  *param_1 = &PTR_FUN_004fd2a4;
  FUN_0047a78d(param_1 + 0xe,5,0);
  param_1[0xd] = 1;
  param_1[4] = 0;
  param_1[2] = 0;
  param_1[3] = 1;
  param_1[0xc] = 0x3cf5c28f;
  param_1[1] = param_3;
  param_1[5] = param_4;
  param_1[6] = param_5;
  bVar1 = FUN_004040d8(param_2,(char *)param_1[1],PTR_DAT_004fcf4c,param_1 + 6);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    FUN_00404298(param_2,(char *)param_1[1],PTR_DAT_004fcf4c,param_5);
  }
  bVar1 = FUN_004040d8(param_2,(char *)param_1[1],PTR_DAT_004fcf54,param_1 + 5);
  if (CONCAT31(extraout_var_00,bVar1) == 0) {
    FUN_00404298(param_2,(char *)param_1[1],PTR_DAT_004fcf54,param_4);
  }
  iVar2 = (int)(param_1[6] - param_1[5]) >> 1;
  if (iVar2 < 0) {
    iVar2 = iVar2 + (uint)((param_1[6] - param_1[5] & 1) != 0);
  }
  param_1[7] = iVar2;
  return param_1;
}



/* @00479228 file=? name=FUN_00479228 */

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

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  
  *param_1 = &PTR_FUN_004fd2a4;
  FUN_0047a78d(param_1 + 0xe,5,0);
  param_1[0xd] = 1;
  param_1[4] = 0;
  param_1[2] = 1;
  param_1[3] = 1;
  param_1[0xc] = 0x3cf5c28f;
  param_1[1] = param_3;
  param_1[5] = param_4;
  param_1[7] = param_5;
  param_1[6] = param_6;
  bVar1 = FUN_004040d8(param_2,(char *)param_1[1],PTR_DAT_004fcf4c,param_1 + 6);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    FUN_00404298(param_2,(char *)param_1[1],PTR_DAT_004fcf4c,param_6);
  }
  bVar1 = FUN_004040d8(param_2,(char *)param_1[1],PTR_s_center_004fcf50,param_1 + 7);
  if (CONCAT31(extraout_var_00,bVar1) == 0) {
    FUN_00404298(param_2,(char *)param_1[1],PTR_s_center_004fcf50,param_5);
  }
  bVar1 = FUN_004040d8(param_2,(char *)param_1[1],PTR_DAT_004fcf54,param_1 + 5);
  if (CONCAT31(extraout_var_01,bVar1) == 0) {
    FUN_00404298(param_2,(char *)param_1[1],PTR_DAT_004fcf54,param_4);
  }
  FUN_004795bc((int)param_1);
  return param_1;
}



/* @0047932c file=? name=FUN_0047932c */

void __cdecl FUN_0047932c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004fd2a4;
    FUN_0047a7f6(param_1 + 0xe,2);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0047935c file=? name=FUN_0047935c */

void __cdecl FUN_0047935c(int param_1,undefined4 param_2)

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



/* @0047936c file=? name=FUN_0047936c */

void __cdecl FUN_0047936c(int param_1,float param_2)

{
  float10 fVar1;
  
  fVar1 = FUN_004dcd00((double)param_2);
  *(float *)(param_1 + 0x30) = (float)fVar1;
  if (*(int *)(param_1 + 0xc) == 1) {
    FUN_004795bc(param_1);
  }
  return;
}



/* @00479398 file=? name=FUN_00479398 */

void __cdecl FUN_00479398(int param_1)

{
  *(undefined4 *)(param_1 + 0xc) = 0;
  *(undefined4 *)(param_1 + 0x14) = 10000;
  *(undefined4 *)(param_1 + 0x18) = 0xffffd8f0;
  return;
}



/* @004793b4 file=? name=FUN_004793b4 */

void __cdecl FUN_004793b4(int param_1,int param_2)

{
  int iVar1;
  
  *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x10);
  iVar1 = *(int *)(param_1 + 0x18) - *(int *)(param_1 + 0x14);
  if (iVar1 < 0) {
    iVar1 = -iVar1;
  }
  if (iVar1 < 10) {
    if (*(int *)(param_1 + 8) == 1) {
      *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x10) + -100;
      *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x1c) + 100;
    }
    else {
      *(undefined4 *)(param_1 + 0x14) = 0;
      *(undefined4 *)(param_1 + 0x18) = 100;
    }
  }
  else {
    *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) - iVar1 / 0x21;
    *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) + iVar1 / 0x21;
  }
  if ((*(int *)(param_1 + 0x34) != 0) && (param_2 != 0)) {
    FUN_00404298(param_2,*(char **)(param_1 + 4),PTR_DAT_004fcf4c,*(uint *)(param_1 + 0x18));
    FUN_00404298(param_2,*(char **)(param_1 + 4),PTR_DAT_004fcf54,*(uint *)(param_1 + 0x14));
    if (*(int *)(param_1 + 8) == 1) {
      FUN_00404298(param_2,*(char **)(param_1 + 4),PTR_s_center_004fcf50,*(uint *)(param_1 + 0x1c));
    }
  }
  FUN_004795bc(param_1);
  *(undefined4 *)(param_1 + 0xc) = 1;
  return;
}



/* @00479478 file=? name=FUN_00479478 */

float10 __cdecl FUN_00479478(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  float local_8;
  
  local_8 = 0.0;
  *(int *)(param_1 + 0x10) = param_2;
  FUN_0047a825((uint *)(param_1 + 0x38),param_2);
  iVar1 = FUN_0047a86e((uint *)(param_1 + 0x38));
  if (iVar1 < *(int *)(param_1 + 0x14)) {
    *(int *)(param_1 + 0x14) = iVar1;
  }
  if (*(int *)(param_1 + 0x18) < iVar1) {
    *(int *)(param_1 + 0x18) = iVar1;
  }
  if (*(int *)(param_1 + 8) == 0) {
    iVar1 = *(int *)(param_1 + 0x14);
    iVar2 = FUN_004dcd94();
    iVar1 = (param_2 - iVar1) - iVar2;
    if ((0 < iVar1) && (iVar2 = *(int *)(param_1 + 0x18) - iVar2, 0 < iVar2)) {
      local_8 = (float)iVar1 / (float)iVar2;
    }
  }
  else if (*(int *)(param_1 + 8) == 1) {
    if (*(int *)(param_1 + 0xc) == 0) {
      *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x18) - *(int *)(param_1 + 0x14) >> 1;
      uVar3 = FUN_004dcd94();
      *(undefined4 *)(param_1 + 0x2c) = uVar3;
      *(undefined4 *)(param_1 + 0x24) = uVar3;
    }
    iVar1 = param_2 - *(int *)(param_1 + 0x1c);
    if (iVar1 < 0) {
      iVar1 = iVar1 + *(int *)(param_1 + 0x24);
      if ((iVar1 < 0) && (iVar2 = *(int *)(param_1 + 0x20), 0 < iVar2)) {
        if (-iVar2 < iVar1) {
          local_8 = (float)iVar1 / (float)iVar2;
        }
        else {
          local_8 = -1.0;
        }
      }
    }
    else {
      iVar1 = iVar1 - *(int *)(param_1 + 0x2c);
      if ((0 < iVar1) && (iVar2 = *(int *)(param_1 + 0x28), 0 < iVar2)) {
        if (iVar1 < iVar2) {
          local_8 = (float)iVar1 / (float)iVar2;
        }
        else {
          local_8 = 1.0;
        }
      }
    }
  }
  return (float10)local_8;
}



/* @004795b0 file=? name=FUN_004795b0 */

undefined4 FUN_004795b0(void)

{
  return 1;
}



/* @004795bc file=? name=FUN_004795bc */

void __cdecl FUN_004795bc(int param_1)

{
  int iVar1;
  
  iVar1 = FUN_004dcd94();
  *(int *)(param_1 + 0x24) = iVar1;
  *(int *)(param_1 + 0x20) = *(int *)(param_1 + 0x1c) - (*(int *)(param_1 + 0x14) + iVar1);
  iVar1 = FUN_004dcd94();
  *(int *)(param_1 + 0x2c) = iVar1;
  *(int *)(param_1 + 0x28) = (*(int *)(param_1 + 0x18) - iVar1) - *(int *)(param_1 + 0x1c);
  return;
}



/* @0047962c file=? name=FUN_0047962c */

undefined4 * __cdecl
FUN_0047962c(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            float param_5)

{
  *param_1 = param_2;
  param_1[3] = param_3;
  param_1[4] = param_4;
  FUN_00479684((int)param_1,param_5);
  FUN_004796b8((int)param_1);
  return param_1;
}



/* @0047965c file=? name=FUN_0047965c */

void __cdecl FUN_0047965c(int *param_1,byte param_2)

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



/* @00479678 file=? name=FUN_00479678 */

undefined4 FUN_00479678(void)

{
  return 1;
}



/* @00479684 file=? name=FUN_00479684 */

void __cdecl FUN_00479684(int param_1,float param_2)

{
  undefined4 uVar1;
  
  FUN_004dcd00((double)param_2);
  uVar1 = FUN_004dcd94();
  *(undefined4 *)(param_1 + 0x18) = uVar1;
  return;
}



/* @004796b8 file=? name=FUN_004796b8 */

void __cdecl FUN_004796b8(int param_1)

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



/* @004796c8 file=? name=FUN_004796c8 */

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

float10 __fastcall FUN_004796c8(undefined4 param_1,uint param_2,undefined4 *param_3,int param_4)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  int iVar5;
  int *piVar6;
  uint uVar7;
  uint uVar8;
  float local_8;
  
  local_8 = 0.0;
  if ((int)param_3[3] < 0) {
    if (param_3[1] == 0) {
      param_3[1] = 1;
      param_3[2] = -param_4;
      iVar5 = param_3[4] * 3;
      if (iVar5 < 0) {
        iVar5 = iVar5 + 3;
      }
      param_3[7] = (iVar5 >> 2) + param_3[2];
      iVar5 = param_3[3] * 3;
      if (iVar5 < 0) {
        iVar5 = iVar5 + 3;
      }
      param_3[8] = (iVar5 >> 2) + param_3[2];
    }
    uVar8 = param_4 + param_3[2];
    if ((int)param_3[7] < (int)uVar8) {
      param_3[7] = uVar8;
    }
    if ((int)uVar8 < (int)param_3[8]) {
      param_3[8] = uVar8;
    }
    if ((int)uVar8 < (int)-param_3[6]) {
      uVar7 = (int)param_3[8] >> 0x1f;
      param_2 = ((param_3[8] ^ uVar7) - uVar7) - param_3[6];
      if (0 < (int)param_2) {
        local_8 = (float)(int)(param_3[6] + uVar8) / (float)(int)param_2;
      }
    }
    else if (((int)param_3[6] < (int)uVar8) &&
            (uVar7 = (int)param_3[7] >> 0x1f, param_2 = ((param_3[7] ^ uVar7) - uVar7) - param_3[6],
            0 < (int)param_2)) {
      local_8 = (float)(int)(uVar8 - param_3[6]) / (float)(int)param_2;
    }
  }
  else {
    if (param_3[1] == 0) {
      param_3[1] = 1;
      param_3[2] = -param_4;
      iVar5 = param_3[4] * 3;
      if (iVar5 < 0) {
        iVar5 = iVar5 + 3;
      }
      param_3[7] = iVar5 >> 2;
      param_3[8] = param_3[3];
    }
    iVar5 = param_4 + param_3[2];
    if ((int)param_3[4] < iVar5) {
      param_3[2] = param_3[2] - (iVar5 - param_3[4]);
      iVar5 = param_3[4];
    }
    else if (iVar5 < (int)param_3[3]) {
      param_3[2] = param_3[2] - (iVar5 - param_3[3]);
      iVar5 = param_3[3];
    }
    if ((int)param_3[7] < iVar5) {
      param_3[7] = iVar5;
    }
    uVar8 = iVar5 - param_3[3];
    iVar5 = param_3[6];
    if ((iVar5 < (int)uVar8) && (param_2 = (param_3[7] - param_3[8]) - iVar5, 0 < (int)param_2)) {
      local_8 = (float)(int)(uVar8 - iVar5) / (float)(int)param_2;
    }
  }
  if (local_8 <= _DAT_00479af0) {
    if (local_8 < _DAT_00479af4) {
      uVar7 = param_3[6];
      uVar1 = param_3[7];
      uVar2 = param_3[8];
      pcVar4 = (char *)*param_3;
      FUN_004dbb24(&DAT_00524e20,s_Too_low__004fd08b,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_input__004fd094,(char *)0x0);
      piVar6 = FUN_004db78c(&DAT_00524e20,uVar8);
      FUN_004dbb24(piVar6,s_result__004fd09c,(char *)0x0);
      piVar6 = FUN_004db634(piVar6,(float10)local_8);
      FUN_004dbb24(piVar6,&DAT_004fd0a5,(char *)0x0);
      FUN_004dbb24(piVar6,pcVar4,(char *)0x0);
      FUN_004dbb24(piVar6,s_lowestInput__004fd0a7,(char *)0x0);
      piVar6 = FUN_004db78c(piVar6,uVar2);
      FUN_004dbb24(piVar6,s_highestInput__004fd0b5,(char *)0x0);
      piVar6 = FUN_004db78c(piVar6,uVar1);
      FUN_004dbb24(piVar6,s_deadbandInteger__004fd0c4,(char *)0x0);
      piVar6 = FUN_004db78c(piVar6,uVar7);
      FUN_004dbb24(piVar6,s_range__004fd0d6,(char *)0x0);
      piVar6 = FUN_004db78c(piVar6,param_2);
      FUN_004dbb24(piVar6,&DAT_004fd0de,(char *)0x0);
      local_8 = -1.0;
    }
  }
  else {
    uVar7 = param_3[6];
    uVar1 = param_3[7];
    uVar2 = param_3[8];
    uVar3 = param_3[2];
    pcVar4 = (char *)*param_3;
    FUN_004dbb24(&DAT_00524e20,s_Too_high__004fd02c,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s_input__004fd036,(char *)0x0);
    piVar6 = FUN_004db78c(&DAT_00524e20,uVar8);
    FUN_004dbb24(piVar6,s_result__004fd03e,(char *)0x0);
    piVar6 = FUN_004db634(piVar6,(float10)local_8);
    FUN_004dbb24(piVar6,&DAT_004fd047,(char *)0x0);
    FUN_004dbb24(piVar6,pcVar4,(char *)0x0);
    FUN_004dbb24(piVar6,s_offset__004fd049,(char *)0x0);
    piVar6 = FUN_004db78c(piVar6,uVar3);
    FUN_004dbb24(piVar6,s_lowestInput__004fd052,(char *)0x0);
    piVar6 = FUN_004db78c(piVar6,uVar2);
    FUN_004dbb24(piVar6,s_highestInput__004fd060,(char *)0x0);
    piVar6 = FUN_004db78c(piVar6,uVar1);
    FUN_004dbb24(piVar6,s_deadbandInteger__004fd06f,(char *)0x0);
    piVar6 = FUN_004db78c(piVar6,uVar7);
    FUN_004dbb24(piVar6,s_range__004fd081,(char *)0x0);
    piVar6 = FUN_004db78c(piVar6,param_2);
    FUN_004dbb24(piVar6,&DAT_004fd089,(char *)0x0);
    local_8 = 1.0;
  }
  return (float10)local_8;
}



/* @00479b78 file=? name=FUN_00479b78 */

short * __cdecl FUN_00479b78(short *param_1,short param_2,short param_3,int param_4)

{
  bool bVar1;
  undefined4 *puVar2;
  uint uVar3;
  int *piVar4;
  int iVar5;
  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 uVar6;
  short extraout_DX;
  short extraout_DX_00;
  short extraout_DX_01;
  short sVar7;
  int extraout_EDX;
  int extraout_EDX_00;
  undefined8 uVar8;
  undefined4 local_14 [3];
  int local_8;
  
  param_1[0x21e] = 0;
  param_1[0x21f] = 0;
  param_1[0x220] = 0;
  param_1[0x221] = 0;
  param_1[0x222] = 0;
  param_1[0x223] = 0;
  param_1[0x224] = 0;
  param_1[0x225] = 0;
  param_1[0x226] = 0;
  param_1[0x227] = 0;
  param_1[0x228] = 0;
  param_1[0x229] = 0;
  param_1[0x22e] = 0;
  param_1[0x22f] = 0;
  param_1[0x230] = 0;
  param_1[0x231] = 0;
  param_1[0x232] = 0;
  param_1[0x233] = 0;
  param_1[0x234] = 0;
  param_1[0x235] = 0;
  param_1[0x238] = 0;
  param_1[0x239] = 0;
  param_1[0x236] = 0;
  param_1[0x237] = 0;
  param_1[0x23c] = 1;
  param_1[0x23d] = 0;
  param_1[0x248] = 0;
  param_1[0x249] = 0;
  param_1[0x24a] = 0;
  param_1[0x24b] = 0;
  FUN_0047a70c((int)param_1);
  FUN_00404bc0(*(int *)(param_1 + 0x248),s_RIOBoardErrors_004fd0f5);
  FUN_00404bc0(*(int *)(param_1 + 0x248),s_RIODeadLamps_004fd104);
  FUN_00404bc0(*(int *)(param_1 + 0x248),s_RIOErrors_004fd111);
  FUN_0047a750((int)param_1);
  puVar2 = (undefined4 *)FUN_00402298(0x24);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_0047962c(puVar2,s_LeftPedal_004fd11b,0,0x1d6,0.0);
  }
  *(undefined4 **)(param_1 + 0x23e) = puVar2;
  puVar2 = (undefined4 *)FUN_00402298(0x24);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_0047962c(puVar2,s_RightPedal_004fd125,0,0x1d6,0.0);
  }
  *(undefined4 **)(param_1 + 0x240) = puVar2;
  puVar2 = (undefined4 *)FUN_00402298(0x24);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_0047962c(puVar2,s_Throttle_004fd130,0,800,0.05);
  }
  *(undefined4 **)(param_1 + 0x242) = puVar2;
  puVar2 = (undefined4 *)FUN_00402298(0x24);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_0047962c(puVar2,s_JoystickX_004fd139,0xffffffa0,0x60,0.05);
  }
  *(undefined4 **)(param_1 + 0x244) = puVar2;
  puVar2 = (undefined4 *)FUN_00402298(0x24);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_0047962c(puVar2,s_JoystickY_004fd143,0xffffff9f,0x6c,0.05);
  }
  *(undefined4 **)(param_1 + 0x246) = puVar2;
  uVar8 = FUN_0047d9f4(param_1,0xc,param_2,param_3,&DAT_004fcf20,0xd,&DAT_004fcf20,0xd);
  uVar3 = (uint)uVar8;
  if (uVar3 == 0xfffffffe) {
    FUN_004dbb24(&DAT_00524e20,s_RIO__RIO_DPMI_error__004fd14d,(char *)0x0);
    uVar6 = extraout_ECX_00;
    sVar7 = extraout_DX;
  }
  else if (uVar3 == 0xffffffff) {
    FUN_004dbb24(&DAT_00524e20,s_RIO__RIO_buffer_allocation_error_004fd163,(char *)0x0);
    uVar6 = extraout_ECX_01;
    sVar7 = extraout_DX_00;
  }
  else if (uVar3 == 0) {
    sVar7 = 0;
    uVar6 = extraout_ECX;
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_RIO__RIO_unexpected_init_result__004fd186,(char *)0x0);
    piVar4 = FUN_004db78c(&DAT_00524e20,uVar3);
    FUN_004dbb24(piVar4,&DAT_004fd1a7,(char *)0x0);
    uVar6 = extraout_ECX_02;
    sVar7 = extraout_DX_01;
  }
  param_1[0x22a] = 0xff;
  param_1[0x22b] = 0;
  param_1[0x22c] = 0xff;
  param_1[0x22d] = 0;
  if (param_4 != 0) {
    bVar1 = false;
    FUN_0047df93(uVar6,sVar7,param_1,1);
    piVar4 = (int *)FUN_00414b60();
    local_8 = *piVar4;
    iVar5 = FUN_004dcd94();
    local_8 = local_8 + iVar5;
    do {
      piVar4 = (int *)FUN_00414b60();
    } while (*piVar4 < local_8);
    FUN_0047df93(local_8,(short)*piVar4,param_1,0);
    piVar4 = (int *)FUN_00414b60();
    local_8 = *piVar4;
    iVar5 = FUN_004dcd94();
    local_8 = local_8 + iVar5;
    do {
      piVar4 = (int *)FUN_00414b60();
    } while (*piVar4 < local_8);
    FUN_0047a56c(local_8,*piVar4,param_1);
    piVar4 = (int *)FUN_00414b60();
    local_8 = *piVar4;
    iVar5 = FUN_004dcd94();
    local_8 = local_8 + iVar5;
    uVar6 = extraout_ECX_03;
    while (iVar5 = *(int *)(param_1 + 0x21e), iVar5 == 0) {
      piVar4 = (int *)FUN_00414b60();
      if (local_8 < *piVar4) {
        bVar1 = true;
        FUN_004dbb24(&DAT_00524e20,s_RIO_never_came_back_from_check_r_004fd1aa,(char *)0x0);
        uVar6 = extraout_ECX_04;
        iVar5 = extraout_EDX;
        break;
      }
      FUN_0047a0e8(local_8,*piVar4,(int)param_1,local_14);
      uVar6 = extraout_ECX_05;
    }
    if (!bVar1) {
      piVar4 = (int *)FUN_00414b60();
      local_8 = *piVar4;
      iVar5 = FUN_004dcd94();
      local_8 = local_8 + iVar5;
      uVar6 = extraout_ECX_06;
      while (iVar5 = 0, *(int *)(param_1 + 0x21e) != 0) {
        piVar4 = (int *)FUN_00414b60();
        if (local_8 < *piVar4) {
          bVar1 = true;
          FUN_004dbb24(&DAT_00524e20,s_RIO_never_came_back_from_test_mo_004fd1d3,(char *)0x0);
          uVar6 = extraout_ECX_07;
          iVar5 = extraout_EDX_00;
          break;
        }
        FUN_0047a0e8(local_8,*piVar4,(int)param_1,local_14);
        uVar6 = extraout_ECX_08;
      }
    }
    if (!bVar1) {
      FUN_0047a594(uVar6,iVar5,param_1);
      piVar4 = (int *)FUN_00414b60();
      local_8 = *piVar4;
      iVar5 = FUN_004dcd94();
      local_8 = local_8 + iVar5;
      while (*(int *)(param_1 + 0x22a) == 0xff) {
        piVar4 = (int *)FUN_00414b60();
        if (local_8 < *piVar4) {
          FUN_004dbb24(&DAT_00524e20,s_RIO_never_came_back_from_version_004fd1f8,(char *)0x0);
          return param_1;
        }
        FUN_0047a0e8(local_8,*piVar4,(int)param_1,local_14);
      }
    }
  }
  return param_1;
}



/* @00479fd0 file=? name=FUN_00479fd0 */

void __cdecl FUN_00479fd0(int *param_1,byte param_2)

{
  int *piVar1;
  undefined2 uVar2;
  int *piVar3;
  int iVar4;
  short extraout_var;
  undefined4 extraout_ECX;
  undefined4 extraout_EDX;
  undefined8 uVar5;
  undefined1 local_14 [12];
  int local_8;
  
  if (param_1 != (int *)0x0) {
    piVar3 = (int *)FUN_00414b60();
    local_8 = *piVar3;
    iVar4 = FUN_004dcd94();
    local_8 = local_8 + iVar4;
    while( true ) {
      piVar3 = (int *)FUN_00414b60();
      if (local_8 <= *piVar3) break;
      piVar3 = param_1;
      uVar2 = FUN_0047df82((int)param_1);
      if (CONCAT22(extraout_var,uVar2) == 0 || extraout_var < 0) {
        piVar1 = param_1;
        uVar5 = FUN_0047def5(piVar3,extraout_EDX,(short *)param_1);
        piVar3 = piVar1;
        if ((int)uVar5 == 0) break;
      }
      FUN_0047a0e8(piVar3,local_14,(int)param_1,(undefined4 *)local_14);
    }
    FUN_0047965c((int *)param_1[0x11f],3);
    param_1[0x11f] = 0;
    FUN_0047965c((int *)param_1[0x120],3);
    param_1[0x120] = 0;
    FUN_0047965c((int *)param_1[0x121],3);
    param_1[0x121] = 0;
    FUN_0047965c((int *)param_1[0x122],3);
    param_1[0x122] = 0;
    FUN_0047965c((int *)param_1[0x123],3);
    param_1[0x123] = 0;
    FUN_0047dc71(extraout_ECX,0,(short *)param_1);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0047a0e8 file=? name=FUN_0047a0e8 */

int __fastcall FUN_0047a0e8(undefined4 param_1,undefined4 param_2,int param_3,undefined4 *param_4)

{
  bool bVar1;
  int iVar2;
  char *pcVar3;
  uint uVar4;
  undefined4 extraout_ECX;
  undefined4 extraout_ECX_00;
  undefined4 extraout_ECX_01;
  undefined4 extraout_ECX_02;
  undefined4 extraout_ECX_03;
  uint extraout_EDX;
  uint extraout_EDX_00;
  uint extraout_EDX_01;
  uint extraout_EDX_02;
  uint extraout_EDX_03;
  float10 fVar5;
  ulonglong uVar6;
  undefined8 uVar7;
  int local_124 [8];
  byte local_104;
  byte local_103;
  byte local_102;
  byte local_101;
  byte local_100;
  byte local_ff;
  byte local_fe;
  byte local_fd;
  byte local_fc;
  byte local_fb;
  byte local_fa;
  
  if (*(int *)(param_3 + 0x478) == 0) {
    iVar2 = 0;
  }
  else {
    uVar6 = FUN_0047df1a(param_1,param_2,param_3);
    if ((short)uVar6 != 0) {
      if ((uVar6 & 0x100) == 0) {
        if ((uVar6 & 0x400) != 0) {
          *(int *)(param_3 + 0x46c) = *(int *)(param_3 + 0x46c) + 1;
        }
        if ((uVar6 & 2) != 0) {
          *(int *)(param_3 + 0x470) = *(int *)(param_3 + 0x470) + 1;
        }
        if ((uVar6 & 0xe) != 0) {
          *(int *)(param_3 + 0x468) = *(int *)(param_3 + 0x468) + 1;
        }
      }
      else {
        FUN_00403e84(local_124,s_FAILURE_LOG_004fd223,1);
        FUN_00404204((int)local_124,s_RIOErrors_004fd22f,s_error_004fd239,s_initialization_004fd23f)
        ;
        *(undefined4 *)(param_3 + 0x478) = 0;
        FUN_00403ecc(local_124,2);
      }
    }
    do {
      bVar1 = false;
      uVar7 = FUN_0047dce3(param_3,&local_104);
      iVar2 = (int)uVar7;
      if (iVar2 != 0) {
        switch(local_104) {
        case 0x85:
          switch(local_103) {
          case 1:
            FUN_0047a70c(param_3);
            FUN_004790c8(*(int *)(param_3 + 0x490));
            FUN_0047a750(param_3);
            break;
          case 2:
            FUN_0047a70c(param_3);
            FUN_004790c8(*(int *)(param_3 + 0x490));
            FUN_0047a750(param_3);
            break;
          case 3:
            FUN_0047a70c(param_3);
            pcVar3 = FUN_00476f34((uint)local_102);
            FUN_00404490(*(int *)(param_3 + 0x490),s_RIODeadLamps_004fd267,&DAT_004fd274,pcVar3);
            FUN_0047a750(param_3);
            break;
          case 4:
            *(int *)(param_3 + 0x45c) = *(int *)(param_3 + 0x45c) + (uint)local_102;
            break;
          case 5:
            *(int *)(param_3 + 0x460) = *(int *)(param_3 + 0x460) + (uint)local_102;
            break;
          case 6:
            *(int *)(param_3 + 0x464) = *(int *)(param_3 + 0x464) + (uint)local_102;
          }
          bVar1 = true;
          break;
        case 0x86:
          *param_4 = 4;
          *(uint *)(param_3 + 0x454) = (uint)local_103;
          *(uint *)(param_3 + 0x458) = (uint)local_102;
          break;
        case 0x87:
          *param_4 = 3;
          uVar4 = FUN_004790a4(local_103,local_102);
          fVar5 = FUN_004796c8(extraout_ECX,extraout_EDX,*(undefined4 **)(param_3 + 0x484),-uVar4);
          *(float *)(param_3 + 0x440) = (float)fVar5;
          uVar4 = FUN_004790a4(local_101,local_100);
          fVar5 = FUN_004796c8(extraout_ECX_00,extraout_EDX_00,*(undefined4 **)(param_3 + 0x47c),
                               uVar4);
          *(float *)(param_3 + 0x444) = (float)fVar5;
          uVar4 = FUN_004790a4(local_ff,local_fe);
          fVar5 = FUN_004796c8(extraout_ECX_01,extraout_EDX_01,*(undefined4 **)(param_3 + 0x480),
                               uVar4);
          *(float *)(param_3 + 0x448) = (float)fVar5;
          uVar4 = FUN_004790a4(local_fd,local_fc);
          fVar5 = FUN_004796c8(extraout_ECX_02,extraout_EDX_02,*(undefined4 **)(param_3 + 0x48c),
                               uVar4);
          *(float *)(param_3 + 0x450) = (float)fVar5;
          uVar4 = FUN_004790a4(local_fb,local_fa);
          fVar5 = FUN_004796c8(extraout_ECX_03,extraout_EDX_03,*(undefined4 **)(param_3 + 0x488),
                               uVar4);
          *(float *)(param_3 + 0x44c) = (float)fVar5;
          break;
        case 0x88:
          *param_4 = 0;
          param_4[1] = (uint)local_103;
          break;
        case 0x89:
          *param_4 = 1;
          param_4[1] = (uint)local_103;
          break;
        case 0x8a:
          *param_4 = 2;
          param_4[1] = (uint)local_103;
          param_4[2] = (uint)local_102;
          break;
        default:
          bVar1 = true;
          break;
        case 0x8c:
          if (local_103 == 0) {
            *(undefined4 *)(param_3 + 0x43c) = 0;
            FUN_0047a750(param_3);
          }
          else {
            *(undefined4 *)(param_3 + 0x43c) = 1;
            FUN_0047a70c(param_3);
            FUN_00404bc0(*(int *)(param_3 + 0x490),s_RIOBoardErrors_004fd279);
            FUN_00404bc0(*(int *)(param_3 + 0x490),s_RIODeadLamps_004fd288);
          }
          bVar1 = true;
        }
      }
    } while (bVar1);
  }
  return iVar2;
}



/* @0047a4cc file=? name=FUN_0047a4cc */

void __cdecl FUN_0047a4cc(int param_1)

{
  FUN_004796b8(*(int *)(param_1 + 0x488));
  FUN_004796b8(*(int *)(param_1 + 0x48c));
  return;
}



/* @0047a4f0 file=? name=FUN_0047a4f0 */

void __cdecl FUN_0047a4f0(int param_1,float param_2)

{
  FUN_00479684(*(int *)(param_1 + 0x488),param_2);
  FUN_00479684(*(int *)(param_1 + 0x48c),param_2);
  return;
}



/* @0047a520 file=? name=FUN_0047a520 */

void __cdecl FUN_0047a520(int param_1,float param_2)

{
  FUN_00479684(*(int *)(param_1 + 0x484),param_2);
  return;
}



/* @0047a53c file=? name=FUN_0047a53c */

void __cdecl FUN_0047a53c(int param_1,float param_2)

{
  FUN_00479684(*(int *)(param_1 + 0x47c),param_2);
  FUN_00479684(*(int *)(param_1 + 0x480),param_2);
  return;
}



/* @0047a56c file=? name=FUN_0047a56c */

undefined8 __fastcall FUN_0047a56c(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf6c);
  }
  return uVar1;
}



/* @0047a594 file=? name=FUN_0047a594 */

undefined8 __fastcall FUN_0047a594(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf6d);
  }
  return uVar1;
}



/* @0047a5bc file=? name=FUN_0047a5bc */

undefined8 __fastcall FUN_0047a5bc(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf6e);
  }
  return uVar1;
}



/* @0047a5e4 file=? name=FUN_0047a5e4 */

undefined8 __fastcall FUN_0047a5e4(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf6f);
  }
  return uVar1;
}



/* @0047a60c file=? name=FUN_0047a60c */

undefined8 __fastcall FUN_0047a60c(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf71);
  }
  return uVar1;
}



/* @0047a634 file=? name=FUN_0047a634 */

undefined8 __fastcall FUN_0047a634(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf73);
  }
  return uVar1;
}



/* @0047a65c file=? name=FUN_0047a65c */

undefined8 __fastcall FUN_0047a65c(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf75);
  }
  return uVar1;
}



/* @0047a684 file=? name=FUN_0047a684 */

undefined8 __fastcall FUN_0047a684(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf77);
  }
  return uVar1;
}



/* @0047a6ac file=? name=FUN_0047a6ac */

undefined8 __fastcall FUN_0047a6ac(undefined4 param_1,undefined4 param_2,short *param_3)

{
  undefined8 uVar1;
  
  uVar1 = CONCAT44(param_2,param_3);
  if ((*(int *)(param_3 + 0x23c) != 0) &&
     (uVar1 = CONCAT44(param_2,param_3), *(int *)(param_3 + 0x21e) == 0)) {
    uVar1 = FUN_0047ddda(param_1,param_2,param_3,&DAT_004fcf79);
  }
  return uVar1;
}



/* @0047a6d4 file=? name=FUN_0047a6d4 */

undefined8 __fastcall
FUN_0047a6d4(undefined4 param_1,undefined4 param_2,short *param_3,undefined1 param_4,
            undefined1 param_5)

{
  uint uVar1;
  uint uVar2;
  undefined8 uVar3;
  
  uVar3 = CONCAT44(param_2,param_3);
  if (*(int *)(param_3 + 0x23c) != 0) {
    uVar2 = CONCAT31((int3)((uint)param_2 >> 8),param_4) & 0xffffff7f;
    uVar1 = CONCAT31((int3)((uint)param_1 >> 8),param_5) & 0xffffff7f;
    DAT_004fcf7c = (undefined1)uVar2;
    DAT_004fcf7d = (undefined1)uVar1;
    uVar3 = FUN_0047ddda(uVar1,uVar2,param_3,&DAT_004fcf7b);
  }
  return uVar3;
}



/* @0047a70c file=? name=FUN_0047a70c */

void __cdecl FUN_0047a70c(int param_1)

{
  int *piVar1;
  
  if (*(int *)(param_1 + 0x494) == 0) {
    piVar1 = (int *)FUN_00402298(0x20);
    if (piVar1 == (int *)0x0) {
      piVar1 = (int *)0x0;
    }
    else {
      piVar1 = FUN_00403e84(piVar1,s_FAILURE_LOG_004fd295,1);
    }
    *(int **)(param_1 + 0x490) = piVar1;
  }
  *(int *)(param_1 + 0x494) = *(int *)(param_1 + 0x494) + 1;
  return;
}



/* @0047a750 file=? name=FUN_0047a750 */

void __cdecl FUN_0047a750(int param_1)

{
  *(int *)(param_1 + 0x494) = *(int *)(param_1 + 0x494) + -1;
  if (*(int *)(param_1 + 0x494) < 1) {
    *(undefined4 *)(param_1 + 0x494) = 0;
    FUN_00403ecc(*(int **)(param_1 + 0x490),3);
  }
  return;
}



/* @0047a780 file=? name=FUN_0047a780 */

void __cdecl FUN_0047a780(int param_1)

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



/* @0047a78d file=? name=FUN_0047a78d */

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

{
  param_1[2] = 0;
  FUN_0047a7af(param_1,param_2,param_3);
  return param_1;
}



/* @0047a7af file=? name=FUN_0047a7af */

void __cdecl FUN_0047a7af(uint *param_1,uint param_2,undefined4 param_3)

{
  uint uVar1;
  
  if ((int *)param_1[2] != (int *)0x0) {
    FUN_004022e8((int *)param_1[2]);
  }
  *param_1 = param_2;
  uVar1 = FUN_004022b0(param_2 << 2);
  param_1[2] = uVar1;
  param_1[1] = 0;
  for (uVar1 = 0; uVar1 < *param_1; uVar1 = uVar1 + 1) {
    *(undefined4 *)(param_1[2] + uVar1 * 4) = param_3;
  }
  return;
}



/* @0047a7f6 file=? name=FUN_0047a7f6 */

void __cdecl FUN_0047a7f6(int *param_1,byte param_2)

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



/* @0047a81b file=? name=FUN_0047a81b */

undefined4 FUN_0047a81b(void)

{
  return 1;
}



/* @0047a825 file=? name=FUN_0047a825 */

void __cdecl FUN_0047a825(uint *param_1,undefined4 param_2)

{
  *(undefined4 *)(param_1[2] + param_1[1] * 4) = param_2;
  param_1[1] = param_1[1] + 1;
  if (*param_1 <= param_1[1]) {
    param_1[1] = 0;
  }
  return;
}



/* @0047a84c file=? name=FUN_0047a84c */

int __cdecl FUN_0047a84c(uint *param_1)

{
  int *piVar1;
  uint uVar2;
  int iVar3;
  
  iVar3 = 0;
  piVar1 = (int *)param_1[2];
  for (uVar2 = 0; uVar2 < *param_1; uVar2 = uVar2 + 1) {
    iVar3 = iVar3 + *piVar1;
    piVar1 = piVar1 + 1;
  }
  return iVar3 / (int)*param_1;
}



/* @0047a86e file=? name=FUN_0047a86e */

int __cdecl FUN_0047a86e(uint *param_1)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  int local_8;
  
  iVar2 = *(int *)param_1[2];
  local_8 = 0;
  piVar1 = (int *)param_1[2];
  iVar3 = iVar2;
  for (uVar4 = 0; uVar4 < *param_1; uVar4 = uVar4 + 1) {
    local_8 = local_8 + *piVar1;
    if (*piVar1 < iVar3) {
      iVar3 = *piVar1;
    }
    if (iVar2 < *piVar1) {
      iVar2 = *piVar1;
    }
    piVar1 = piVar1 + 1;
  }
  return ((local_8 - iVar3) - iVar2) / (int)(*param_1 - 2);
}



/* @0047a8d3 file=? name=FUN_0047a8d3 */

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

float10 __cdecl FUN_0047a8d3(uint *param_1)

{
  uint uVar1;
  float fVar2;
  float fVar3;
  uint uVar4;
  float local_1c;
  float local_c;
  float local_8;
  
  local_8 = 0.0;
  local_c = 0.0;
  uVar1 = *param_1;
  fVar2 = (float)uVar1;
  fVar3 = fVar2 * fVar2 * _DAT_0047a99b;
  fVar2 = fVar2 * _DAT_0047a99b + fVar3;
  uVar4 = param_1[1];
  local_1c = 1.0;
  do {
    local_8 = (float)*(int *)(param_1[2] + uVar4 * 4) + local_8;
    local_c = (float)*(int *)(param_1[2] + uVar4 * 4) * local_1c + local_c;
    local_1c = _DAT_0047a9b7 + local_1c;
    uVar4 = uVar4 + 1;
    if (uVar4 == *param_1) {
      uVar4 = 0;
    }
  } while (uVar4 != param_1[1]);
  return ((float10)uVar1 * (float10)local_c - (float10)fVar2 * (float10)local_8) /
         ((float10)uVar1 *
          (float10)(float)(_DAT_0047a9ab * (float10)uVar1 +
                          _DAT_0047a99f * (float10)uVar1 * (float10)uVar1 * (float10)uVar1 +
                          (float10)fVar3) - (float10)fVar2 * (float10)fVar2);
}



/* @0047aa48 file=? name=FUN_0047aa48 */

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

void __cdecl FUN_0047aa48(int param_1)

{
  *(float *)(param_1 + 0xf0) = *(float *)(param_1 + 0x104) - *(float *)(param_1 + 0x100);
  *(float *)(param_1 + 0xf0) = _DAT_0047aa74 * *(float *)(param_1 + 0xf0);
  return;
}



/* @0047aa78 file=? name=FUN_0047aa78 */

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

{
  int iVar1;
  
  FUN_0042d494(param_1,param_2,param_3,param_4,param_5);
  *param_1 = &PTR_FUN_004fd488;
  param_1[7] = PTR_FUN_004fd30c;
  param_1[8] = DAT_004fd310;
  param_1[9] = DAT_004fd314;
  param_1[0x40] = 0;
  param_1[0x41] = 0;
  iVar1 = *(int *)(DAT_004efc94 + 0x3c);
  (**(code **)(*(int *)(iVar1 + 0x104) + 0x18))(iVar1 + 0x104,0xffffffff,param_1 + 0x39,param_1);
  (**(code **)(*(int *)(iVar1 + 0x9c0) + 0x18))(iVar1 + 0x9c0,0xffffffff,param_1 + 0x3e,param_1);
  (**(code **)(*(int *)(iVar1 + 0xaa0) + 0x18))(iVar1 + 0xaa0,0xffffffff,param_1 + 0x3f,param_1);
  (**(code **)(*(int *)(iVar1 + 0xa40) + 0x14))(iVar1 + 0xa40,0xffffffff,param_1,6,param_1);
  (**(code **)(*(int *)(iVar1 + 0xa20) + 0x14))(iVar1 + 0xa20,0xffffffff,param_1,5,param_1);
  (**(code **)(*(int *)(iVar1 + 0xa60) + 0x14))(iVar1 + 0xa60,0xffffffff,param_1,8,param_1);
  (**(code **)(*(int *)(iVar1 + 0xa80) + 0x14))(iVar1 + 0xa80,0xffffffff,param_1,7,param_1);
  (**(code **)(*(int *)(iVar1 + 0x1a0) + 0x14))(iVar1 + 0x1a0,0xffffffff,param_1,3,param_1);
  return param_1;
}



/* @0047abb0 file=? name=FUN_0047abb0 */

void __cdecl FUN_0047abb0(int *param_1,byte param_2)

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



/* @0047abdc file=? name=FUN_0047abdc */

void __cdecl FUN_0047abdc(int param_1)

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



/* @0047abf8 file=? name=FUN_0047abf8 */

void __cdecl FUN_0047abf8(int param_1)

{
  if (*(int *)(param_1 + 0x108) < 1) {
    if (*(int *)(param_1 + 0x10c) < 1) {
      *(undefined4 *)(param_1 + 0xec) = 0;
      *(undefined4 *)(param_1 + 0xf4) = 0;
    }
    else {
      *(undefined4 *)(param_1 + 0xec) = 0x3f800000;
      *(undefined4 *)(param_1 + 0xf4) = 1;
    }
  }
  else {
    *(undefined4 *)(param_1 + 0xec) = 0x3f800000;
    *(undefined4 *)(param_1 + 0xf4) = 0;
  }
  FUN_0047aa48(param_1);
  return;
}



/* @0047ac5c file=? name=FUN_0047ac5c */

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

{
  int iVar1;
  
  FUN_0047aa78(param_1,param_2,param_3,param_4,param_5);
  *param_1 = &PTR_FUN_004fd458;
  param_1[7] = PTR_FUN_004fd358;
  param_1[8] = DAT_004fd35c;
  param_1[9] = DAT_004fd360;
  param_1[0x43] = 0;
  param_1[0x42] = 0;
  iVar1 = *(int *)(DAT_004efc94 + 0x3c);
  (**(code **)(*(int *)(iVar1 + 0xa00) + 0x18))(iVar1 + 0xa00,0xffffffff,param_1 + 0x42,param_1);
  (**(code **)(*(int *)(iVar1 + 0x9e0) + 0x18))(iVar1 + 0x9e0,0xffffffff,param_1 + 0x43,param_1);
  return param_1;
}



/* @0047acf4 file=? name=FUN_0047acf4 */

void __cdecl FUN_0047acf4(int *param_1,byte param_2)

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



/* @0047ad20 file=? name=FUN_0047ad20 */

void __cdecl FUN_0047ad20(int param_1)

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



/* @0047ad3c file=? name=FUN_0047ad3c */

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

{
  int iVar1;
  
  FUN_0047aa78(param_1,param_2,param_3,param_4,param_5);
  *param_1 = &PTR_FUN_004fd428;
  iVar1 = *(int *)(DAT_004efc94 + 0x3c);
  (**(code **)(*(int *)(iVar1 + 0x24) + 0x18))(iVar1 + 0x24,0xffffffff,param_1 + 0x3b,param_1);
  (**(code **)(*(int *)(iVar1 + 0x9a0) + 0x18))(iVar1 + 0x9a0,0xffffffff,param_1 + 0x3d,param_1);
  (**(code **)(*(int *)(iVar1 + 0x44) + 0x18))(iVar1 + 0x44,0xffffffff,param_1 + 0x40,param_1);
  (**(code **)(*(int *)(iVar1 + 100) + 0x18))(iVar1 + 100,0xffffffff,param_1 + 0x41,param_1);
  return param_1;
}



/* @0047add4 file=? name=FUN_0047add4 */

void __cdecl FUN_0047add4(int *param_1,byte param_2)

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



/* @0047ae00 file=? name=FUN_0047ae00 */

void __cdecl FUN_0047ae00(int param_1)

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



/* @0047b2ec file=? name=FUN_0047b2ec */

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

undefined4 __cdecl FUN_0047b2ec(int param_1,undefined4 param_2,undefined *param_3)

{
  int *piVar1;
  char *pcVar2;
  char *pcVar3;
  char *pcVar4;
  int iVar5;
  char *pcVar6;
  bool bVar7;
  int local_c;
  int *local_8;
  
  _DAT_004fd54c = 0;
  FUN_00402a98((int *)&local_8,&DAT_0052330c,&DAT_004fd700);
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  DAT_00523310 = 0;
  pcVar3 = (char *)FUN_004dee74(s_REVIEW_004fd701);
  DAT_004fd550 = 0;
  if (pcVar3 != (char *)0x0) {
    pcVar6 = &DAT_004fd708;
    pcVar4 = pcVar3;
    do {
      if (*pcVar4 != *pcVar6) goto LAB_0047b37c;
      bVar7 = true;
      if (*pcVar4 == '\0') break;
      pcVar2 = pcVar4 + 1;
      if (*pcVar2 != pcVar6[1]) goto LAB_0047b37c;
      pcVar4 = pcVar4 + 2;
      pcVar6 = pcVar6 + 2;
      bVar7 = *pcVar2 == '\0';
    } while (!bVar7);
    if (bVar7) {
      DAT_004fd550 = 1;
    }
    else {
LAB_0047b37c:
      pcVar4 = &DAT_004fd70a;
      do {
        if (*pcVar3 != *pcVar4) goto LAB_0047b3ab;
        bVar7 = true;
        if (*pcVar3 == '\0') break;
        pcVar6 = pcVar3 + 1;
        if (*pcVar6 != pcVar4[1]) goto LAB_0047b3ab;
        pcVar3 = pcVar3 + 2;
        pcVar4 = pcVar4 + 2;
        bVar7 = *pcVar6 == '\0';
      } while (!bVar7);
      if (bVar7) {
        DAT_004fd550 = 2;
      }
    }
  }
LAB_0047b3ab:
  if ((1 < param_1) && (local_c = 1, 1 < param_1)) {
    do {
      iVar5 = (*(code *)param_3)(&local_c,param_1,param_2);
      if (iVar5 == 0) {
        return 0;
      }
      local_c = local_c + 1;
    } while (local_c < param_1);
  }
  return 1;
}



/* @0047b3e8 file=? name=FUN_0047b3e8 */

undefined4 __cdecl FUN_0047b3e8(int param_1)

{
  int iVar1;
  
  iVar1 = FUN_0041a1a4(**(int **)(param_1 + 0xc),0x4fd514);
  if (iVar1 == 0) {
    return 0;
  }
  return 1;
}



/* @0047b410 file=? name=FUN_0047b410 */

undefined4 * __cdecl
FUN_0047b410(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  int iVar1;
  
  FUN_0044dfe0(param_1,param_2,param_3,param_4,param_5);
  *param_1 = &PTR_FUN_004fd8bc;
  iVar1 = FUN_004dee74(s_DPLARG_004fd70c);
  param_1[0x34] = iVar1;
  return param_1;
}



/* @0047b44c file=? name=FUN_0047b44c */

void __cdecl FUN_0047b44c(int *param_1)

{
  FUN_0047b468(param_1);
  FUN_0045046c(param_1[8]);
  return;
}



/* @0047b468 file=? name=FUN_0047b468 */

void __cdecl FUN_0047b468(int *param_1)

{
  FUN_0044e1b0(param_1);
  return;
}



/* @0047b478 file=? name=FUN_0047b478 */

undefined4 FUN_0047b478(void)

{
  undefined4 *puVar1;
  undefined4 uVar2;
  
  puVar1 = (undefined4 *)FUN_00402298(0xc);
  if (puVar1 == (undefined4 *)0x0) {
    uVar2 = 0;
  }
  else {
    uVar2 = FUN_0044c2d0(puVar1,0xffffffff);
  }
  return uVar2;
}



/* @0047b49c file=? name=FUN_0047b49c */

int * FUN_0047b49c(void)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00402298(0x80);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004501d4(piVar1);
  }
  return piVar1;
}



/* @0047b4c0 file=? name=FUN_0047b4c0 */

undefined4 * __cdecl FUN_0047b4c0(undefined4 param_1)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0xd10);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00475c18(puVar1);
  }
  (**(code **)(puVar1[0x68] + 0x14))(puVar1 + 0x68,0xffffffff,param_1,7,param_1);
  return puVar1;
}



/* @0047b508 file=? name=FUN_0047b508 */

undefined4 * FUN_0047b508(void)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x38);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_0047ce3c(puVar1,&DAT_004fdc6c);
  }
  return puVar1;
}



/* @0047b530 file=? name=FUN_0047b530 */

undefined4 * __cdecl FUN_0047b530(int param_1)

{
  undefined4 *puVar1;
  
  if (*(int *)(param_1 + 0xd0) == 0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = (undefined4 *)FUN_00402298(0x3e0);
    if (puVar1 == (undefined4 *)0x0) {
      return (undefined4 *)0x0;
    }
    puVar1 = FUN_0045a180(puVar1,DAT_004e8238,DAT_004e823c,1,0,1);
  }
  return puVar1;
}



/* @0047b57c file=? name=FUN_0047b57c */

undefined4 * FUN_0047b57c(void)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  
  iVar1 = FUN_004dee74(s_AWE_FRONT_004fd713);
  iVar2 = FUN_004dee74(s_AWE_REAR_004fd71d);
  if ((iVar1 == 0) || (iVar2 == 0)) {
    puVar3 = (undefined4 *)0x0;
  }
  else {
    puVar3 = (undefined4 *)FUN_00402298(0x1b0);
    if (puVar3 == (undefined4 *)0x0) {
      return (undefined4 *)0x0;
    }
    puVar3 = FUN_0046739c(puVar3,DAT_004e8238,0);
  }
  return puVar3;
}



/* @0047b5d0 file=? name=FUN_0047b5d0 */

undefined4 * FUN_0047b5d0(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = FUN_004dee74(s_L4GAUGE_004fd726);
  if (iVar1 == 0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = (undefined4 *)FUN_00402298(0x1c53c);
    if (puVar2 == (undefined4 *)0x0) {
      return (undefined4 *)0x0;
    }
    puVar2 = FUN_0046f97c(puVar2);
  }
  return puVar2;
}



/* @0047b608 file=? name=FUN_0047b608 */

void __cdecl FUN_0047b608(int param_1)

{
  FUN_0047bba8(param_1,0);
  FUN_0044e7ac(param_1);
  return;
}



/* @0047b624 file=? name=FUN_0047b624 */

void __cdecl FUN_0047b624(int *param_1,byte param_2)

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



/* @0047b650 file=? name=FUN_0047b650 */

int __cdecl FUN_0047b650(int *param_1,undefined4 param_2)

{
  FUN_0044ea8c(param_1,param_2);
  FUN_0047bba8((int)param_1,1);
  return param_1[0x1b];
}



/* @0047b678 file=munga_l4/l4app.cpp name=FUN_0047b678 */

int * __cdecl FUN_0047b678(int param_1,int param_2)

{
  undefined4 *puVar1;
  int iVar2;
  int *piVar3;
  char *pcVar4;
  char *pcVar5;
  char local_3c [2];
  char acStack_3a [30];
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 *local_c;
  undefined4 *local_8;
  
  piVar3 = (int *)0x0;
  if (*(int *)(param_2 + 0x1c) == 0x45) {
    piVar3 = FUN_0042d16c(param_2);
    pcVar4 = s_ControlsMapper_004fd72e;
    pcVar5 = local_3c;
    for (iVar2 = 3; iVar2 != 0; iVar2 = iVar2 + -1) {
      *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
      pcVar4 = pcVar4 + 4;
      pcVar5 = pcVar5 + 4;
    }
    *(undefined2 *)pcVar5 = *(undefined2 *)pcVar4;
    pcVar5[2] = pcVar4[2];
    local_1c = 0xf;
    local_18 = 0x30;
    iVar2 = *(int *)(*(int *)(param_1 + 0x3c) + 0xc98);
    if (iVar2 == 2) {
      local_8 = (undefined4 *)FUN_00402298(0x110);
      if (local_8 == (undefined4 *)0x0) {
        puVar1 = (undefined4 *)0x0;
      }
      else {
        puVar1 = FUN_0047ac5c(local_8,piVar3,0,local_3c,&DAT_004fd318);
      }
      FUN_0042c630((int)piVar3,puVar1);
    }
    else if (iVar2 == 4) {
      local_c = (undefined4 *)FUN_00402298(0x108);
      if (local_c == (undefined4 *)0x0) {
        puVar1 = (undefined4 *)0x0;
      }
      else {
        puVar1 = FUN_0047ad3c(local_c,piVar3,0,local_3c,&DAT_004fd364);
      }
      FUN_0042c630((int)piVar3,puVar1);
    }
    else {
      FUN_0040385c(s_L4Application__MakeViewpointEnti_004fd73d,
                   s_d__tesla_bt_munga_l4_L4APP_CPP_004fd775,0x231);
    }
    if (*(int **)(param_1 + 0x4c) != (int *)0x0) {
      FUN_0046ff64(*(int **)(param_1 + 0x4c),&DAT_004fd794,piVar3);
    }
  }
  return piVar3;
}



/* @0047b788 file=munga_l4/l4app.cpp name=FUN_0047b788 */

void __cdecl FUN_0047b788(int param_1)

{
  int iVar1;
  bool bVar2;
  undefined4 *puVar3;
  
  iVar1 = *(int *)(param_1 + 0x88);
  if (iVar1 == 3) {
    FUN_0047bba8(param_1,0);
  }
  else if (iVar1 == 4) {
    iVar1 = *(int *)(param_1 + 0x3c);
    if ((*(int *)(iVar1 + 0xcec) == 0) || (*(int *)(iVar1 + 0xcf4) != 0)) {
      bVar2 = false;
    }
    else {
      bVar2 = true;
    }
    if (bVar2) {
      puVar3 = (undefined4 *)FUN_00414b60();
      *(undefined4 *)(iVar1 + 0xcf0) = *puVar3;
      *(undefined4 *)(iVar1 + 0xcf8) = 1;
    }
    else {
      if ((*(int *)(iVar1 + 0xcec) == 0) || (*(int *)(iVar1 + 0xcf4) == 0)) {
        bVar2 = false;
      }
      else {
        bVar2 = true;
      }
      if (bVar2) {
        puVar3 = (undefined4 *)FUN_00414b60();
        *(undefined4 *)(iVar1 + 0xcf0) = *puVar3;
        *(undefined4 *)(iVar1 + 0xcf8) = 1;
      }
    }
  }
  else if (iVar1 != 5) {
    FUN_0040385c(s_Application__RunMissionMessageHa_004fd799,
                 s_d__tesla_bt_munga_l4_L4APP_CPP_004fd7d4,0x277);
  }
  FUN_0044ecdc(param_1);
  return;
}



/* @0047b864 file=? name=FUN_0047b864 */

void __cdecl FUN_0047b864(int param_1)

{
  int *piVar1;
  int iVar2;
  uint local_14 [4];
  
  FUN_0044eeb4(param_1);
  FUN_0047bba8(param_1,1);
  local_14[0] = 0xc;
  local_14[1] = 0xc;
  local_14[2] = 1;
  piVar1 = (int *)FUN_00414b60();
  local_14[3] = *piVar1;
  iVar2 = FUN_004dcd94();
  local_14[3] = local_14[3] + iVar2;
  FUN_0041acbc(*(int *)(param_1 + 0x60),1,param_1,local_14,local_14[3]);
  return;
}



/* @0047bb20 file=? name=FUN_0047bb20 */

void __cdecl FUN_0047bb20(int param_1)

{
  FUN_0047bba8(param_1,0);
  return;
}



/* @0047bb34 file=? name=FUN_0047bb34 */

undefined8 __cdecl FUN_0047bb34(int param_1,int param_2)

{
  undefined8 uVar1;
  
  if (param_2 != 0) {
    FUN_00476568(*(int *)(param_1 + 0x3c),0x16,0x3c);
    FUN_00476568(*(int *)(param_1 + 0x3c),0x17,0x3c);
    uVar1 = FUN_00476568(*(int *)(param_1 + 0x3c),0x1e,0x3c);
    return uVar1;
  }
  FUN_00476568(*(int *)(param_1 + 0x3c),0x16,0);
  FUN_00476568(*(int *)(param_1 + 0x3c),0x17,0);
  uVar1 = FUN_00476568(*(int *)(param_1 + 0x3c),0x1e,0);
  return uVar1;
}



/* @0047bba8 file=? name=FUN_0047bba8 */

void __cdecl FUN_0047bba8(int param_1,int param_2)

{
  FUN_0047bb34(param_1,param_2);
  if (param_2 == 0) {
    FUN_00476568(*(int *)(param_1 + 0x3c),0x3e,0);
    if (*(int *)(param_1 + 0x4c) != 0) {
      FUN_0046ff44(*(int *)(param_1 + 0x4c),1.5);
    }
  }
  else {
    FUN_00476568(*(int *)(param_1 + 0x3c),0x3e,0x3c);
    if (*(int *)(param_1 + 0x4c) != 0) {
      FUN_0046ff24(*(int *)(param_1 + 0x4c),1.5);
    }
  }
  return;
}



/* @0047bd48 file=? name=FUN_0047bd48 */

undefined4 * __cdecl FUN_0047bd48(undefined4 *param_1)

{
  FUN_0043457c(param_1);
  *param_1 = &PTR_FUN_004fdbfc;
  return param_1;
}



/* @0047bd64 file=? name=FUN_0047bd64 */

void __cdecl FUN_0047bd64(int *param_1,byte param_2)

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



/* @0047bd90 file=? name=FUN_0047bd90 */

void FUN_0047bd90(void)

{
  return;
}



/* @0047bd98 file=? name=FUN_0047bd98 */

void FUN_0047bd98(void)

{
  return;
}



/* @0047bda0 file=? name=FUN_0047bda0 */

void __cdecl FUN_0047bda0(undefined4 param_1,undefined4 *param_2)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00414b60();
  param_2[3] = *puVar1;
  FUN_0044f7f4(*(int **)(*(int *)PTR_DAT_004fd91c + 0x18),param_2);
  return;
}



/* @0047bdcc file=? name=FUN_0047bdcc */

void FUN_0047bdcc(void)

{
  return;
}



/* @0047bdd4 file=? name=FUN_0047bdd4 */

int * __cdecl FUN_0047bdd4(int *param_1)

{
  FUN_004501d4(param_1);
  *param_1 = (int)&PTR_FUN_004fdbc0;
  return param_1;
}



/* @0047bdf0 file=? name=FUN_0047bdf0 */

void __cdecl FUN_0047bdf0(int *param_1,int param_2)

{
  int *piVar1;
  byte bVar2;
  int *piVar3;
  int iVar4;
  undefined4 *puVar5;
  uint *puVar6;
  int iVar7;
  int local_20 [5];
  int *local_c;
  int *local_8;
  
  FUN_00450554(param_1,param_2);
  piVar3 = *(int **)(*(int *)PTR_DAT_004fd91c + 0x18);
  puVar5 = (undefined4 *)(**(code **)*piVar3)(piVar3);
  *puVar5 = *(undefined4 *)(DAT_004efc94 + 0x54);
  (**(code **)(*piVar3 + 0x14))(piVar3,4);
  bVar2 = *(byte *)(*(int *)(DAT_004efc94 + 0x68) + 5);
  puVar6 = (uint *)(**(code **)*piVar3)(piVar3);
  *puVar6 = (uint)bVar2;
  (**(code **)(*piVar3 + 0x14))(piVar3,4);
  iVar4 = *(int *)(DAT_004efc94 + 0x2c);
  FUN_0044d834(local_20,param_2);
  while( true ) {
    iVar7 = (**(code **)(local_20[0] + 0x28))(local_20);
    if (iVar7 == 0) break;
    local_c = *(int **)(iVar7 + 0xc);
    local_c[3] = local_c[3] + 1;
    local_c[3] = local_c[3] + 1;
    local_c[3] = local_c[3] + 1;
    local_8 = local_c;
    iVar7 = FUN_00452244(param_1,local_c);
    iVar7 = FUN_004290d8(iVar4,iVar7);
    puVar6 = (uint *)(**(code **)*piVar3)(piVar3);
    *puVar6 = (uint)(iVar7 != *(int *)(iVar4 + 0x14));
    (**(code **)(*piVar3 + 0x14))(piVar3,4);
    puVar5 = (undefined4 *)(**(code **)*piVar3)(piVar3);
    *puVar5 = *(undefined4 *)(iVar7 + 0xc);
    (**(code **)(*piVar3 + 0x14))(piVar3,4);
    piVar1 = local_8 + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(local_8,3);
    }
    piVar1 = local_c + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(local_c,3);
    }
  }
  FUN_0044d858(local_20,2);
  return;
}



/* @0047bf28 file=? name=FUN_0047bf28 */

void __cdecl FUN_0047bf28(int *param_1,byte param_2)

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



/* @0047bf54 file=? name=FUN_0047bf54 */

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

{
  int *piVar1;
  undefined4 *puVar2;
  
  if (*(int *)(param_3 + 4) == 3) {
    piVar1 = *(int **)(*(int *)PTR_DAT_004fd91c + 0x18);
    if (*(int *)(param_3 + 0xc) == 0) {
      (**(code **)(*piVar1 + 0xc))(piVar1,0);
    }
    puVar2 = (undefined4 *)FUN_00414b60();
    param_2[3] = *puVar2;
    FUN_0044f7f4(piVar1,param_2);
  }
  FUN_0041d59c(param_1,param_2,param_3);
  return;
}



/* @0047bfc4 file=? name=FUN_0047bfc4 */

undefined4 * __cdecl FUN_0047bfc4(undefined4 *param_1)

{
  FUN_0041d5b4(param_1,&DAT_004e3744);
  *param_1 = &PTR_FUN_004fdb84;
  return param_1;
}



/* @0047bfe4 file=? name=FUN_0047bfe4 */

void FUN_0047bfe4(undefined4 param_1,int param_2)

{
  int *piVar1;
  uint uVar2;
  int *piVar3;
  uint *puVar4;
  undefined4 *puVar5;
  int iVar6;
  uint uVar7;
  uint auStack_38 [8];
  undefined4 uStack_18;
  int iStack_14;
  int *piStack_10;
  int *piStack_c;
  int iStack_8;
  
  FUN_0044d834(auStack_38 + 3,param_2);
  piVar1 = *(int **)(DAT_004efc94 + 0x18);
  piVar3 = (int *)(**(code **)*piVar1)(piVar1);
  iVar6 = *piVar3;
  (**(code **)(*piVar1 + 0x14))(piVar1,4);
  puVar4 = (uint *)(**(code **)*piVar1)(piVar1);
  uVar2 = *puVar4;
  (**(code **)(*piVar1 + 0x14))(piVar1,4);
  if (iVar6 != *(int *)(DAT_004efc94 + 0x54)) {
    FUN_004dbb24(&DAT_00524e20,s_Error___Not_a_spool_file_for_thi_004fd9b0,(char *)0x0);
    FUN_004036a0(1);
  }
  uVar7 = (uint)*(byte *)(*(int *)(DAT_004efc94 + 0x68) + 5);
  if (uVar2 != uVar7) {
    FUN_004dbb24(&DAT_00524e20,s_Error___Spool_file_major_data_ve_004fd9e2,(char *)0x0);
    piVar3 = FUN_004db78c(&DAT_00524e20,uVar7);
    FUN_004dbb24(piVar3,s___not_004fda15,(char *)0x0);
    piVar3 = FUN_004db78c(piVar3,uVar2);
    FUN_004dbb24(piVar3,&DAT_004fda1c,(char *)0x0);
    FUN_004036a0(1);
  }
  iStack_8 = *(int *)(DAT_004efc94 + 0x2c);
  while( true ) {
    iVar6 = (**(code **)(auStack_38[3] + 0x28))(auStack_38 + 3);
    if (iVar6 == 0) break;
    piStack_10 = *(int **)(iVar6 + 0xc);
    piStack_10[3] = piStack_10[3] + 1;
    piStack_10[3] = piStack_10[3] + 1;
    piStack_c = piStack_10;
    piVar3 = (int *)(**(code **)*piVar1)(piVar1);
    iStack_14 = *piVar3;
    (**(code **)(*piVar1 + 0x14))(piVar1,4);
    puVar5 = (undefined4 *)(**(code **)*piVar1)(piVar1);
    uStack_18 = *puVar5;
    (**(code **)(*piVar1 + 0x14))(piVar1,4);
    puVar5 = (undefined4 *)FUN_00402298(0x1068);
    if (puVar5 == (undefined4 *)0x0) {
      puVar5 = (undefined4 *)0x0;
    }
    else {
      puVar5 = FUN_00450134(puVar5,uStack_18,*(undefined4 *)(iVar6 + 0x10),0,0,(int *)&piStack_c);
    }
    if (iStack_14 == 0) {
      FUN_00428ee0(iStack_8,(int)puVar5);
    }
    else {
      FUN_00428f94(iStack_8,(int)puVar5);
    }
    piVar3 = piStack_c + 3;
    *piVar3 = *piVar3 + -1;
    if (*piVar3 == 0) {
      FUN_004024d8(piStack_c,3);
    }
    piVar3 = piStack_10 + 3;
    *piVar3 = *piVar3 + -1;
    if (*piVar3 == 0) {
      FUN_004024d8(piStack_10,3);
    }
  }
  auStack_38[0] = 0xc;
  auStack_38[1] = 10;
  auStack_38[2] = 1;
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),2,DAT_004efc94,auStack_38,DAT_004e17f4);
  FUN_0044d858((int *)(auStack_38 + 3),2);
  return;
}



/* @0047bfea file=? name=FUN_0047bfea */

void FUN_0047bfea(void)

{
  int *piVar1;
  uint uVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  int *piVar6;
  uint *puVar7;
  undefined4 *puVar8;
  int iVar9;
  uint uVar10;
  int unaff_EBP;
  
  FUN_0044d834((undefined4 *)(unaff_EBP + -0x28),*(int *)(unaff_EBP + 0xc));
  piVar1 = *(int **)(DAT_004efc94 + 0x18);
  piVar6 = (int *)(**(code **)*piVar1)(piVar1);
  iVar9 = *piVar6;
  (**(code **)(*piVar1 + 0x14))(piVar1,4);
  puVar7 = (uint *)(**(code **)*piVar1)(piVar1);
  uVar2 = *puVar7;
  (**(code **)(*piVar1 + 0x14))(piVar1,4);
  if (iVar9 != *(int *)(DAT_004efc94 + 0x54)) {
    FUN_004dbb24(&DAT_00524e20,s_Error___Not_a_spool_file_for_thi_004fd9b0,(char *)0x0);
    FUN_004036a0(1);
  }
  uVar10 = (uint)*(byte *)(*(int *)(DAT_004efc94 + 0x68) + 5);
  if (uVar2 != uVar10) {
    FUN_004dbb24(&DAT_00524e20,s_Error___Spool_file_major_data_ve_004fd9e2,(char *)0x0);
    piVar6 = FUN_004db78c(&DAT_00524e20,uVar10);
    FUN_004dbb24(piVar6,s___not_004fda15,(char *)0x0);
    piVar6 = FUN_004db78c(piVar6,uVar2);
    FUN_004dbb24(piVar6,&DAT_004fda1c,(char *)0x0);
    FUN_004036a0(1);
  }
  *(undefined4 *)(unaff_EBP + -4) = *(undefined4 *)(DAT_004efc94 + 0x2c);
  while( true ) {
    iVar9 = (**(code **)(*(int *)(unaff_EBP + -0x28) + 0x28))(unaff_EBP + -0x28);
    if (iVar9 == 0) break;
    iVar3 = *(int *)(iVar9 + 0xc);
    *(int *)(unaff_EBP + -0xc) = iVar3;
    piVar6 = (int *)(iVar3 + 0xc);
    *piVar6 = *piVar6 + 1;
    *(int *)(unaff_EBP + -8) = *(int *)(unaff_EBP + -0xc);
    piVar6 = (int *)(*(int *)(unaff_EBP + -0xc) + 0xc);
    *piVar6 = *piVar6 + 1;
    puVar8 = (undefined4 *)(**(code **)*piVar1)(piVar1);
    *(undefined4 *)(unaff_EBP + -0x10) = *puVar8;
    (**(code **)(*piVar1 + 0x14))(piVar1,4);
    puVar8 = (undefined4 *)(**(code **)*piVar1)(piVar1);
    *(undefined4 *)(unaff_EBP + -0x14) = *puVar8;
    (**(code **)(*piVar1 + 0x14))(piVar1,4);
    puVar8 = (undefined4 *)FUN_00402298(0x1068);
    if (puVar8 == (undefined4 *)0x0) {
      puVar8 = (undefined4 *)0x0;
    }
    else {
      puVar8 = FUN_00450134(puVar8,*(undefined4 *)(unaff_EBP + -0x14),*(undefined4 *)(iVar9 + 0x10),
                            0,0,(int *)(unaff_EBP + -8));
    }
    if (*(int *)(unaff_EBP + -0x10) == 0) {
      FUN_00428ee0(*(int *)(unaff_EBP + -4),(int)puVar8);
    }
    else {
      FUN_00428f94(*(int *)(unaff_EBP + -4),(int)puVar8);
    }
    piVar4 = *(int **)(unaff_EBP + -8);
    piVar6 = piVar4 + 3;
    *piVar6 = *piVar6 + -1;
    if (*piVar6 == 0) {
      FUN_004024d8(piVar4,3);
    }
    piVar4 = *(int **)(unaff_EBP + -0xc);
    piVar6 = piVar4 + 3;
    *piVar6 = *piVar6 + -1;
    if (*piVar6 == 0) {
      FUN_004024d8(piVar4,3);
    }
  }
  *(undefined4 *)(unaff_EBP + -0x34) = 0xc;
  *(undefined4 *)(unaff_EBP + -0x30) = 10;
  uVar5 = DAT_004e17f4;
  *(undefined4 *)(unaff_EBP + -0x2c) = 1;
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),2,DAT_004efc94,(uint *)(unaff_EBP + -0x34),uVar5);
  FUN_0044d858((int *)(unaff_EBP + -0x28),2);
  return;
}



