// Decompiled from acclient.exe — chunk 0x00660000
// Ghidra 12.0.4 + pyghidra headless

// --- FUN_00660090 at 0x00660090 (size: 82) ---


int __thiscall FUN_00660090(int param_1,uint *param_2)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = *param_2 % *(uint *)(param_1 + 0x68);

  iVar1 = *(int *)(*(int *)(param_1 + 0x60) + uVar2 * 4);

  while( true ) {

    if (iVar1 == 0) {

      return 0;

    }

    if (*(uint *)(iVar1 + 4) == *param_2) break;

    iVar1 = *(int *)(iVar1 + 8);

  }

  if (iVar1 == 0) {

    return 0;

  }

  FUN_0065fc20(param_1,*(int *)(param_1 + 0x60) + uVar2 * 4,iVar1);

  return iVar1;

}





// --- FUN_006600f0 at 0x006600F0 (size: 86) ---


undefined4 __thiscall FUN_006600f0(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined1 local_c [8];

  int local_4;

  

  uVar2 = param_2;

  FUN_0065ed80(local_c,param_2);

  if (local_4 != 0) {

    return *(undefined4 *)(local_4 + 8);

  }

  uVar1 = *(undefined4 *)(param_1 + 0x168);

  param_2 = uVar1;

  FUN_0065fff0(uVar2,&param_2);

  return uVar1;

}





// --- FUN_00660150 at 0x00660150 (size: 82) ---


undefined4 * __thiscall FUN_00660150(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007feb54;

  FUN_00409e20();

  param_1[1] = &PTR_FUN_007feb2c;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006601b0 at 0x006601B0 (size: 95) ---


int __thiscall FUN_006601b0(int param_1,uint *param_2)



{

  int iVar1;

  int iVar2;

  

  iVar2 = *(int *)(*(int *)(param_1 + 0x60) + (*param_2 % *(uint *)(param_1 + 0x68)) * 4);

  if (iVar2 != 0) {

    while (*(uint *)(iVar2 + 4) != *param_2) {

      iVar2 = *(int *)(iVar2 + 8);

      if (iVar2 == 0) {

        return 0;

      }

    }

    if (iVar2 != 0) {

      if (iVar2 == -4) {

        iVar1 = 0;

      }

      else {

        iVar1 = iVar2 + 0xc;

      }

      FUN_00410880(iVar1);

      FUN_00660090(param_2);

    }

  }

  return iVar2;

}





// --- FUN_00660210 at 0x00660210 (size: 8) ---


void FUN_00660210(void)



{

  FUN_006600f0();

  return;

}





// --- FUN_00660220 at 0x00660220 (size: 117) ---


undefined4 * __fastcall FUN_00660220(undefined4 *param_1)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_FUN_007feb58;

  FUN_0065f2a0(0);

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  FUN_0065f340(0);

  param_1[0x3c] = 0;

  param_1[0x3d] = 0;

  param_1[0x3e] = &PTR_FUN_007feb54;

  FUN_0065f3e0(0);

  param_1[0x3e] = &PTR_FUN_007feb54;

  param_1[0x5b] = 1;

  param_1[0x5c] = 0;

  uVar1 = FUN_0040fca0();

  FUN_0065eb70(uVar1);

  return param_1;

}





// --- FUN_006602c0 at 0x006602C0 (size: 531) ---


void __fastcall FUN_006602c0(undefined4 *param_1)



{

  uint uVar1;

  undefined4 *puVar2;

  int iVar3;

  int *piVar4;

  int iVar5;

  int *piVar6;

  int iVar7;

  uint uVar8;

  int *piVar9;

  

  *param_1 = &PTR_FUN_007feb58;

  if ((param_1[0x3b] != 0) && (param_1[0x3c] != 0)) {

    iVar5 = param_1[0x3c] + -0x10;

    while (iVar5 != 0) {

      uVar1 = *(uint *)(iVar5 + 8);

      for (iVar5 = *(int *)(param_1[0x38] + (uVar1 % (uint)param_1[0x3a]) * 4); iVar5 != 0;

          iVar5 = *(int *)(iVar5 + 0xc)) {

        if (*(uint *)(iVar5 + 8) == uVar1) {

          if (iVar5 != 0) {

            FUN_0065fe70(uVar1,4);

          }

          break;

        }

      }

      iVar5 = 0;

      if (param_1[0x3b] != 0) {

        if (param_1[0x3c] == 0) {

          iVar5 = 0;

        }

        else {

          iVar5 = param_1[0x3c] + -0x10;

        }

      }

    }

  }

  if ((param_1[0x1c] != 0) && (param_1[0x1d] != 0)) {

    piVar4 = (int *)(param_1[0x1d] + -0xc);

joined_r0x0066035d:

    if (piVar4 != (int *)0x0) {

      piVar4[5] = 0;

      (**(code **)(*piVar4 + 0x1c))();

      iVar5 = piVar4[3];

      if ((iVar5 == 0) || (iVar5 == 8)) {

        piVar9 = (int *)0x0;

      }

      else {

        piVar9 = (int *)(iVar5 + -0xc);

      }

      if ((uint *)(piVar4 + 1) == (uint *)0x0) {

        piVar6 = (int *)0x0;

      }

      else {

        piVar6 = piVar4 + 3;

      }

      if ((int *)piVar6[1] == (int *)0x0) {

        iVar5 = *(int *)param_1[0x1d];

        param_1[0x1d] = iVar5;

        if (iVar5 != 0) {

          *(undefined4 *)(iVar5 + 4) = 0;

        }

      }

      else {

        *(int *)piVar6[1] = *piVar6;

      }

      if (*piVar6 == 0) {

        puVar2 = *(undefined4 **)(param_1[0x1e] + 4);

        param_1[0x1e] = puVar2;

        if (puVar2 != (undefined4 *)0x0) {

          *puVar2 = 0;

        }

      }

      else {

        *(int *)(*piVar6 + 4) = piVar6[1];

      }

      *piVar6 = 0;

      piVar6[1] = 0;

      uVar1 = piVar4[1];

      uVar8 = uVar1 % (uint)param_1[0x1b];

      iVar5 = *(int *)(param_1[0x19] + uVar8 * 4);

      for (iVar3 = iVar5; piVar4 = piVar9, iVar3 != 0; iVar3 = *(int *)(iVar3 + 8)) {

        if (*(uint *)(iVar3 + 4) == uVar1) {

          if (iVar3 != 0) {

            if (iVar5 != iVar3) goto LAB_00660406;

            goto LAB_00660413;

          }

          break;

        }

      }

      goto joined_r0x0066035d;

    }

  }

  param_1[0x3e] = &PTR_FUN_007feb54;

  FUN_00409e20();

  param_1[0x3f] = &PTR_FUN_007feb2c;

  if ((undefined4 *)param_1[0x57] != param_1 + 0x40) {

    operator_delete__((undefined4 *)param_1[0x57]);

  }

  param_1[0x57] = 0;

  param_1[0x58] = 0;

  param_1[0x59] = 0;

  param_1[0x5a] = 0;

  param_1[0x20] = &PTR_FUN_007feb28;

  if ((undefined4 *)param_1[0x38] != param_1 + 0x21) {

    operator_delete__((undefined4 *)param_1[0x38]);

  }

  param_1[0x38] = 0;

  param_1[0x39] = 0;

  param_1[0x3a] = 0;

  param_1[0x3b] = 0;

  param_1[1] = &PTR_FUN_007feb24;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  return;

LAB_00660406:

  do {

    iVar7 = iVar5;

    iVar5 = *(int *)(iVar7 + 8);

  } while (iVar5 != iVar3);

  if (iVar7 == 0) {

LAB_00660413:

    *(undefined4 *)(param_1[0x19] + uVar8 * 4) = *(undefined4 *)(iVar5 + 8);

  }

  else {

    *(undefined4 *)(iVar7 + 8) = *(undefined4 *)(iVar5 + 8);

  }

  param_1[0x1c] = param_1[0x1c] + -1;

  goto joined_r0x0066035d;

}





// --- FUN_006604e0 at 0x006604E0 (size: 202) ---


undefined4 __thiscall FUN_006604e0(int param_1,uint param_2)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

  piVar1 = *(int **)(*(int *)(param_1 + 100) + (param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  while( true ) {

    if (piVar1 == (int *)0x0) {

      return 0;

    }

    if (piVar1[1] == param_2) break;

    piVar1 = (int *)piVar1[2];

  }

  if (piVar1 == (int *)0x0) {

    return 0;

  }

  if (((*(int *)(param_1 + 0xec) != 0) && (*(int *)(param_1 + 0xec) != 0)) &&

     (*(int *)(param_1 + 0xf0) != 0)) {

    iVar3 = *(int *)(param_1 + 0xf0) + -0x10;

    while (iVar2 = iVar3, iVar2 != 0) {

      iVar3 = *(int *)(iVar2 + 0x10);

      if ((iVar3 == 0) || (iVar3 == 8)) {

        iVar3 = 0;

      }

      else {

        iVar3 = iVar3 + -0x10;

      }

      if (*(int **)(iVar2 + 0x30) == piVar1) {

        FUN_0065fe70(*(undefined4 *)(iVar2 + 8),5);

      }

    }

  }

  piVar1[5] = 0;

  (**(code **)(*piVar1 + 0x1c))();

  FUN_006601b0(&param_2);

  return 1;

}





// --- FUN_006605b0 at 0x006605B0 (size: 34) ---


void __fastcall FUN_006605b0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007feb30;

  if (param_1[5] != 0) {

    FUN_006604e0(param_1[1]);

  }

  param_1[5] = 0;

  return;

}





// --- FUN_006605e0 at 0x006605E0 (size: 30) ---


void * __thiscall FUN_006605e0(void *param_1,byte param_2)



{

  FUN_006602c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00660600 at 0x00660600 (size: 54) ---


undefined4 * __thiscall FUN_00660600(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007feb30;

  if (param_1[5] != 0) {

    FUN_006604e0(param_1[1]);

  }

  param_1[5] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00660640 at 0x00660640 (size: 96) ---


int FUN_00660640(byte *param_1,uint param_2)



{

  byte *pbVar1;

  byte bVar2;

  char cVar3;

  int iVar4;

  int iVar5;

  

  if (param_1 != (byte *)0x0) {

    iVar5 = param_2 << 0x10;

    for (pbVar1 = param_1; pbVar1 < param_1 + (param_2 & 0xfffffffc); pbVar1 = pbVar1 + 4) {

      iVar5 = iVar5 + *(int *)pbVar1;

    }

    iVar4 = 0;

    cVar3 = '\x03';

    for (; pbVar1 < param_1 + param_2; pbVar1 = pbVar1 + 1) {

      bVar2 = cVar3 * '\b';

      cVar3 = cVar3 + -1;

      iVar4 = iVar4 + ((uint)*pbVar1 << (bVar2 & 0x1f));

    }

    return iVar4 + iVar5;

  }

  return 0;

}





// --- FUN_006606a0 at 0x006606A0 (size: 25) ---


void __fastcall FUN_006606a0(int param_1)



{

  if (*(undefined4 **)(param_1 + 8) != (undefined4 *)0x0) {

    (**(code **)**(undefined4 **)(param_1 + 8))(1);

  }

  *(undefined4 *)(param_1 + 8) = 0;

  return;

}





// --- FUN_00660770 at 0x00660770 (size: 26) ---


void __fastcall FUN_00660770(int param_1)



{

  operator_delete__(*(void **)(param_1 + 4));

  operator_delete__(*(void **)(param_1 + 8));

  return;

}





// --- FUN_00660790 at 0x00660790 (size: 123) ---


int * __thiscall FUN_00660790(int *param_1,int param_2,int param_3,int param_4)



{

  int iVar1;

  

  *param_1 = (int)&PTR_FUN_007feb7c;

  iVar1 = thunk_FUN_005df0f5(0x400);

  param_1[2] = iVar1;

  iVar1 = thunk_FUN_005df0f5(0x400);

  param_1[3] = iVar1;

  iVar1 = 0;

  do {

    *(undefined4 *)(iVar1 + param_1[2]) = 0;

    *(undefined4 *)(iVar1 + 4 + param_1[2]) = 0;

    *(undefined4 *)(iVar1 + 8 + param_1[2]) = 0;

    *(undefined4 *)(iVar1 + 0xc + param_1[2]) = 0;

    iVar1 = iVar1 + 0x10;

  } while (iVar1 < 0x400);

  param_1[4] = param_2;

  param_1[5] = param_3;

  param_1[6] = param_4;

  (**(code **)(*param_1 + 4))(param_1 + 1,1);

  return param_1;

}





// --- FUN_00660810 at 0x00660810 (size: 673) ---


void __thiscall FUN_00660810(int *param_1,undefined4 *param_2,char param_3)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int *piVar4;

  int local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  int local_10;

  int local_c;

  int local_8;

  int local_4;

  

  iVar2 = param_2[2];

  iVar1 = param_2[1];

  local_10 = -0x61c88647;

  local_14 = -0x61c88647;

  local_18 = -0x61c88647;

  local_1c = -0x61c88647;

  local_20 = -0x61c88647;

  local_24 = -0x61c88647;

  local_28 = -0x61c88647;

  local_2c = -0x61c88647;

  if (param_3 == '\0') {

    param_2[3] = 0;

    param_2[4] = 0;

    param_2[5] = 0;

  }

  local_c = 4;

  local_8 = iVar1;

  local_4 = iVar2;

  do {

    (**(code **)(*param_1 + 0x10))

              (&local_2c,&local_28,&local_24,&local_20,&local_1c,&local_18,&local_14,&local_10);

    local_c = local_c + -1;

  } while (local_c != 0);

  if (param_3 == '\0') {

    (**(code **)(*param_1 + 0x10))

              (&local_2c,&local_28,&local_24,&local_20,&local_1c,&local_18,&local_14,&local_10);

    *(int *)(iVar2 + 0x10) = local_2c;

    *(int *)(iVar2 + 0x14) = local_28;

    *(int *)(iVar2 + 0x18) = local_24;

    *(int *)(iVar2 + 0x1c) = local_20;

    *(int *)(iVar2 + 0x20) = local_1c;

    *(int *)(iVar2 + 0x24) = local_18;

    *(int *)(iVar2 + 0x28) = local_14;

    *(int *)(iVar2 + 0x2c) = local_10;

  }

  else {

    piVar4 = (int *)(iVar2 + 0xc);

    piVar3 = (int *)(iVar1 + 8);

    iVar2 = iVar2 - local_8;

    _param_3 = 0x20;

    do {

      local_2c = local_2c + piVar3[-2];

      local_28 = local_28 + piVar3[-1];

      local_24 = local_24 + *piVar3;

      local_20 = local_20 + piVar3[1];

      local_1c = local_1c + piVar3[2];

      local_18 = local_18 + piVar3[3];

      local_14 = local_14 + piVar3[4];

      local_10 = local_10 + piVar3[5];

      (**(code **)(*param_1 + 0x10))

                (&local_2c,&local_28,&local_24,&local_20,&local_1c,&local_18,&local_14,&local_10);

      piVar4[-3] = local_2c;

      piVar4[-2] = local_28;

      *(int *)(iVar2 + (int)piVar3) = local_24;

      *piVar4 = local_20;

      piVar4[1] = local_1c;

      piVar4[2] = local_18;

      piVar4[3] = local_14;

      piVar4[4] = local_10;

      piVar3 = piVar3 + 8;

      piVar4 = piVar4 + 8;

      _param_3 = _param_3 + -1;

    } while (_param_3 != 0);

    piVar4 = (int *)(local_4 + 8);

    iVar2 = 0x20;

    do {

      local_2c = local_2c + piVar4[-2];

      local_28 = local_28 + piVar4[-1];

      local_24 = local_24 + *piVar4;

      local_20 = local_20 + piVar4[1];

      local_1c = local_1c + piVar4[2];

      local_18 = local_18 + piVar4[3];

      local_14 = local_14 + piVar4[4];

      local_10 = local_10 + piVar4[5];

      (**(code **)(*param_1 + 0x10))

                (&local_2c,&local_28,&local_24,&local_20,&local_1c,&local_18,&local_14,&local_10);

      piVar4[-2] = local_2c;

      piVar4[-1] = local_28;

      *piVar4 = local_24;

      piVar4[1] = local_20;

      piVar4[2] = local_1c;

      piVar4[3] = local_18;

      piVar4[4] = local_14;

      piVar4[5] = local_10;

      piVar4 = piVar4 + 8;

      iVar2 = iVar2 + -1;

    } while (iVar2 != 0);

  }

  (**(code **)(*param_1 + 0xc))(param_2);

  *param_2 = 0x100;

  return;

}





// --- FUN_00660b80 at 0x00660B80 (size: 39) ---


undefined4 * __thiscall FUN_00660b80(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007feb7c;

  FUN_00660770();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00660bb0 at 0x00660BB0 (size: 70) ---


undefined4 * __thiscall FUN_00660bb0(undefined4 *param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  *param_1 = 1;

  param_1[1] = param_2;

  param_1[2] = 0;

  iVar1 = FUN_005df0f5(0x1c);

  if (iVar1 != 0) {

    uVar2 = param_1[1];

    uVar2 = FUN_00660790(uVar2,uVar2,uVar2);

    param_1[2] = uVar2;

    return param_1;

  }

  param_1[2] = 0;

  return param_1;

}





// --- FUN_00660c00 at 0x00660C00 (size: 653) ---


void FUN_00660c00(int param_1)



{

  uint *puVar1;

  uint *puVar2;

  uint *puVar3;

  int *piVar4;

  uint uVar5;

  uint uVar6;

  int iVar7;

  uint *puVar8;

  uint uVar9;

  int local_8;

  

  puVar2 = *(uint **)(param_1 + 8);

  *(int *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) + 1;

  piVar4 = *(int **)(param_1 + 4);

  uVar6 = *(uint *)(param_1 + 0xc);

  local_8 = *(int *)(param_1 + 0x10) + *(int *)(param_1 + 0x14);

  puVar1 = puVar2 + 0x80;

  puVar8 = puVar1;

  for (puVar3 = puVar2; puVar3 < puVar1; puVar3 = puVar3 + 4) {

    uVar5 = *puVar3;

    uVar9 = (uVar6 << 0xd ^ uVar6) + *puVar8;

    uVar6 = *(int *)((uVar5 & 0x3fc) + (int)puVar2) + local_8 + uVar9;

    *puVar3 = uVar6;

    iVar7 = *(int *)((uVar6 >> 8 & 0x3fc) + (int)puVar2) + uVar5;

    *piVar4 = iVar7;

    uVar6 = puVar3[1];

    uVar5 = (uVar9 >> 6 ^ uVar9) + puVar8[1];

    uVar9 = *(int *)((uVar6 & 0x3fc) + (int)puVar2) + iVar7 + uVar5;

    puVar3[1] = uVar9;

    iVar7 = *(int *)((uVar9 >> 8 & 0x3fc) + (int)puVar2) + uVar6;

    piVar4[1] = iVar7;

    uVar6 = puVar3[2];

    uVar9 = (uVar5 * 4 ^ uVar5) + puVar8[2];

    uVar5 = *(int *)((uVar6 & 0x3fc) + (int)puVar2) + iVar7 + uVar9;

    puVar3[2] = uVar5;

    iVar7 = *(int *)((uVar5 >> 8 & 0x3fc) + (int)puVar2) + uVar6;

    piVar4[2] = iVar7;

    uVar5 = puVar3[3];

    uVar6 = (uVar9 >> 0x10 ^ uVar9) + puVar8[3];

    uVar9 = *(int *)((uVar5 & 0x3fc) + (int)puVar2) + iVar7 + uVar6;

    puVar3[3] = uVar9;

    local_8 = *(int *)((uVar9 >> 8 & 0x3fc) + (int)puVar2) + uVar5;

    piVar4[3] = local_8;

    puVar8 = puVar8 + 4;

    piVar4 = piVar4 + 4;

  }

  puVar8 = puVar2;

  if (puVar2 < puVar1) {

    do {

      uVar5 = *puVar3;

      uVar9 = (uVar6 << 0xd ^ uVar6) + *puVar8;

      uVar6 = *(int *)((uVar5 & 0x3fc) + (int)puVar2) + local_8 + uVar9;

      *puVar3 = uVar6;

      iVar7 = *(int *)((uVar6 >> 8 & 0x3fc) + (int)puVar2) + uVar5;

      *piVar4 = iVar7;

      uVar6 = puVar3[1];

      uVar9 = (uVar9 >> 6 ^ uVar9) + puVar8[1];

      uVar5 = *(int *)((uVar6 & 0x3fc) + (int)puVar2) + iVar7 + uVar9;

      puVar3[1] = uVar5;

      iVar7 = *(int *)((uVar5 >> 8 & 0x3fc) + (int)puVar2) + uVar6;

      piVar4[1] = iVar7;

      uVar6 = puVar3[2];

      uVar9 = (uVar9 * 4 ^ uVar9) + puVar8[2];

      uVar5 = *(int *)((uVar6 & 0x3fc) + (int)puVar2) + iVar7 + uVar9;

      puVar3[2] = uVar5;

      iVar7 = *(int *)((uVar5 >> 8 & 0x3fc) + (int)puVar2) + uVar6;

      piVar4[2] = iVar7;

      uVar5 = puVar3[3];

      uVar6 = (uVar9 >> 0x10 ^ uVar9) + puVar8[3];

      uVar9 = *(int *)((uVar5 & 0x3fc) + (int)puVar2) + iVar7 + uVar6;

      puVar3[3] = uVar9;

      local_8 = *(int *)((uVar9 >> 8 & 0x3fc) + (int)puVar2) + uVar5;

      puVar8 = puVar8 + 4;

      piVar4[3] = local_8;

      puVar3 = puVar3 + 4;

      piVar4 = piVar4 + 4;

    } while (puVar8 < puVar1);

    *(uint *)(param_1 + 0xc) = uVar6;

    *(int *)(param_1 + 0x10) = local_8;

    return;

  }

  *(uint *)(param_1 + 0xc) = uVar6;

  *(int *)(param_1 + 0x10) = local_8;

  return;

}





// --- FUN_00660ea0 at 0x00660EA0 (size: 62) ---


undefined4 __fastcall FUN_00660ea0(int *param_1)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  

  *param_1 = *param_1 + 1;

  piVar3 = (int *)param_1[2];

  iVar4 = piVar3[1];

  piVar1 = piVar3 + 1;

  iVar2 = iVar4 + -1;

  *piVar1 = iVar2;

  if (iVar4 == 0) {

    (**(code **)(*piVar3 + 0xc))(piVar1);

    *piVar1 = 0xff;

    return *(undefined4 *)(piVar3[2] + 0x3fc);

  }

  return *(undefined4 *)(piVar3[2] + iVar2 * 4);

}





// --- FUN_00660ee0 at 0x00660EE0 (size: 98) ---


void __thiscall

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



{

  int *piVar1;

  int iVar2;

  uint *puVar3;

  int *piVar4;

  int iVar5;

  uint uVar6;

  

  if (param_5 == (uint *)0x0) {

    *param_1 = *param_1 + 1;

    piVar4 = (int *)param_1[2];

    iVar5 = piVar4[1];

    piVar1 = piVar4 + 1;

    iVar2 = iVar5 + -1;

    *piVar1 = iVar2;

    if (iVar5 == 0) {

      (**(code **)(*piVar4 + 0xc))(piVar1);

      *piVar1 = 0xff;

      uVar6 = *(uint *)(piVar4[2] + 0x3fc);

    }

    else {

      uVar6 = *(uint *)(piVar4[2] + iVar2 * 4);

    }

  }

  else {

    uVar6 = *param_5;

  }

  puVar3 = (uint *)((int)param_3 + (param_4 & 0xfffffffc));

  for (; param_3 < puVar3; param_3 = param_3 + 1) {

    *param_3 = *param_3 ^ uVar6;

  }

  return;

}





// --- FUN_00660f50 at 0x00660F50 (size: 249) ---


void __thiscall

FUN_00660f50(int *param_1,void *param_2,undefined4 *param_3,undefined4 param_4,undefined4 *param_5,

            char param_6)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  uint *puVar4;

  uint uVar5;

  size_t _Size;

  undefined4 *_Dst;

  uint local_4;

  

  uVar5 = (uint)param_5;

  local_4 = param_1[1] - *param_1 >> 2;

  puVar4 = (uint *)&param_5;

  if (param_5 <= local_4) {

    puVar4 = &local_4;

  }

  local_4 = *puVar4 + local_4;

  if (local_4 == 0) {

    param_5 = (undefined4 *)0x0;

  }

  else if (local_4 * 4 < 0x81) {

    param_5 = (undefined4 *)FUN_004050d0(local_4 * 4);

  }

  else {

    param_5 = (undefined4 *)FUN_005df0f5();

  }

  pvVar3 = (void *)*param_1;

  _Dst = param_5;

  if (param_2 != pvVar3) {

    pvVar2 = memmove(param_5,pvVar3,(int)param_2 - (int)pvVar3);

    _Dst = (undefined4 *)((int)pvVar2 + ((int)param_2 - (int)pvVar3));

  }

  for (; uVar5 != 0; uVar5 = uVar5 - 1) {

    *_Dst = *param_3;

    _Dst = _Dst + 1;

  }

  if ((param_6 == '\0') && ((void *)param_1[1] != param_2)) {

    _Size = param_1[1] - (int)param_2;

    pvVar3 = memmove(_Dst,param_2,_Size);

    _Dst = (undefined4 *)((int)pvVar3 + _Size);

  }

  iVar1 = *param_1;

  if (iVar1 != 0) {

    FUN_004051c0(iVar1,(param_1[2] - iVar1 >> 2) * 4);

  }

  *param_1 = (int)param_5;

  param_1[1] = (int)_Dst;

  param_1[2] = (int)(param_5 + local_4);

  return;

}





// --- FUN_00661050 at 0x00661050 (size: 53) ---


void __thiscall FUN_00661050(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4)



{

  *param_1 = param_2;

  param_1[1] = param_3;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  if (param_4 != 0) {

    param_1[6] = param_4;

    return;

  }

  param_1[6] = FUN_0040e900;

  return;

}





// --- FUN_00661090 at 0x00661090 (size: 118) ---


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



void __fastcall FUN_00661090(int param_1)



{

  uint uVar1;

  undefined4 *puVar2;

  

  puVar2 = *(undefined4 **)(param_1 + 8);

  if (puVar2 != *(undefined4 **)(param_1 + 0xc)) {

    do {

      operator_delete__((void *)*puVar2);

      puVar2 = puVar2 + 1;

    } while (puVar2 != *(undefined4 **)(param_1 + 0xc));

  }

  puVar2 = *(undefined4 **)(param_1 + 8);

  if (puVar2 != (undefined4 *)0x0) {

    uVar1 = (*(int *)(param_1 + 0x10) - (int)puVar2 >> 2) * 4;

    if (0x80 < uVar1) {

      operator_delete(puVar2);

      return;

    }

    FUN_00404d90(&DAT_008376c0);

    *puVar2 = *(undefined4 *)(&DAT_008376c8 + (uVar1 - 1 >> 3) * 4);

    *(undefined4 **)(&DAT_008376c8 + (uVar1 - 1 >> 3) * 4) = puVar2;

    _DAT_008376c0 = 0;

  }

  return;

}





// --- FUN_00661110 at 0x00661110 (size: 119) ---


void __fastcall FUN_00661110(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  int *piVar4;

  undefined1 local_5;

  int *local_4;

  

  local_4 = (int *)thunk_FUN_005df0f5(*param_1 * param_1[1]);

  iVar1 = *param_1;

  iVar3 = (param_1[1] + -1) * iVar1;

  for (piVar4 = local_4; piVar4 != (int *)(iVar3 + (int)local_4);

      piVar4 = (int *)((int)piVar4 + iVar1)) {

    *piVar4 = iVar1 + (int)piVar4;

    iVar1 = *param_1;

  }

  *piVar4 = param_1[5];

  param_1[5] = (int)local_4;

  puVar2 = (undefined4 *)param_1[3];

  if (puVar2 != (undefined4 *)param_1[4]) {

    if (puVar2 != (undefined4 *)0x0) {

      *puVar2 = local_4;

    }

    param_1[3] = param_1[3] + 4;

    return;

  }

  FUN_00660f50(puVar2,&local_4,&local_5,1,1);

  return;

}





// --- FUN_00661190 at 0x00661190 (size: 47) ---


void FUN_00661190(void)



{

  DWORD dwMessageId;

  DWORD dwLanguageId;

  HLOCAL *lpBuffer;

  DWORD nSize;

  va_list *Arguments;

  HLOCAL local_4;

  

  Arguments = (va_list *)0x0;

  nSize = 0;

  lpBuffer = &local_4;

  dwLanguageId = 0x400;

  dwMessageId = GetLastError();

  FormatMessageA(0x1100,(LPCVOID)0x0,dwMessageId,dwLanguageId,(LPSTR)lpBuffer,nSize,Arguments);

  LocalFree(local_4);

  return;

}





// --- FUN_006611c0 at 0x006611C0 (size: 104) ---


undefined1 FUN_006611c0(void)



{

  if (DAT_008f86ad == '\0') {

    DAT_008f86ad = '\x01';

    DAT_008f86ac = 1;

  }

  return DAT_008f86ac;

}





// --- FUN_006612a0 at 0x006612A0 (size: 242) ---


void FUN_006612a0(int *param_1,int *param_2)



{

  int iVar1;

  code *pcVar2;

  int iVar3;

  int *piVar4;

  int aiStack_28 [7];

  int iStack_c;

  int iStack_8;

  undefined1 uStack_4;

  

  if (((param_1[2] != 0) && (*param_1 != 7)) &&

     ((code *)(&PTR_LAB_00834150)[(*param_1 * 3 + param_1[1]) * 3 + param_1[4]] != (code *)0x0)) {

    (*(code *)(&PTR_LAB_00834150)[(*param_1 * 3 + param_1[1]) * 3 + param_1[4]])(param_1);

  }

  if ((param_2 != (int *)0x0) && (iVar3 = *param_2, iVar3 != 7)) {

    iVar1 = param_2[2];

    pcVar2 = (code *)(&PTR_LAB_00834270)[(iVar1 + iVar3 * 2 + iVar3) * 3 + param_1[4]];

    if (pcVar2 != (code *)0x0) {

      DAT_008f86b0._2_1_ = *(undefined1 *)((int)param_2 + 6);

      DAT_008f86b0._1_1_ = *(undefined1 *)((int)param_2 + 5);

      DAT_008f86b0._0_1_ = (undefined1)param_2[1];

      piVar4 = aiStack_28;

      for (iVar3 = 10; iVar3 != 0; iVar3 = iVar3 + -1) {

        *piVar4 = *param_1;

        param_1 = param_1 + 1;

        piVar4 = piVar4 + 1;

      }

      iStack_c = param_2[5];

      iStack_8 = param_2[6];

      if (iVar1 != 0) {

        uStack_4 = *(undefined1 *)((int)param_2 + 7);

        aiStack_28[2] = param_2[3];

        aiStack_28[3] = param_2[4];

        DAT_008f86b0._3_1_ = 0;

        (*pcVar2)(aiStack_28);

        return;

      }

      DAT_008f86b0._3_1_ = *(undefined1 *)((int)param_2 + 7);

      uStack_4 = 0xff;

      (*pcVar2)(aiStack_28);

    }

  }

  return;

}





// --- FUN_006613a0 at 0x006613A0 (size: 32) ---


void FUN_006613a0(int *param_1)



{

  if (*(code **)(&DAT_00834390 + (*param_1 * 3 + param_1[3]) * 4) != (code *)0x0) {

                    /* WARNING: Could not recover jumptable at 0x006613bd. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    (**(code **)(&DAT_00834390 + (*param_1 * 3 + param_1[3]) * 4))();

    return;

  }

  return;

}





// --- FUN_006615b0 at 0x006615B0 (size: 165) ---


void FUN_006615b0(int param_1)



{

  undefined1 *puVar1;

  undefined1 uVar2;

  undefined1 uVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  undefined1 *puVar7;

  undefined1 *puVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int local_10;

  

  iVar9 = *(int *)(param_1 + 8);

  iVar10 = *(int *)(param_1 + 0x14);

  if ((*(char *)(param_1 + 0x24) != '\0') && (local_10 = *(int *)(param_1 + 0x20), local_10 != 0)) {

    iVar4 = *(int *)(param_1 + 0x1c);

    iVar5 = *(int *)(param_1 + 0xc);

    iVar6 = *(int *)(param_1 + 0x18);

    do {

      if (iVar4 != 0) {

        puVar7 = (undefined1 *)(iVar4 * 3 + 2 + iVar9);

        puVar8 = (undefined1 *)(iVar4 * 3 + iVar10);

        iVar11 = iVar4;

        do {

          uVar2 = puVar7[-4];

          puVar1 = puVar7 + -5;

          puVar7 = puVar7 + -3;

          iVar11 = iVar11 + -1;

          uVar3 = *puVar7;

          puVar8[-3] = *puVar1;

          puVar8[-2] = uVar2;

          puVar7[iVar10 - iVar9] = uVar3;

          puVar8 = puVar8 + -3;

        } while (iVar11 != 0);

      }

      iVar9 = iVar9 + iVar5;

      iVar10 = iVar10 + iVar6;

      local_10 = local_10 + -1;

    } while (local_10 != 0);

  }

  return;

}





// --- FUN_00661660 at 0x00661660 (size: 338) ---


void FUN_00661660(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  uint *puVar8;

  int iVar9;

  int iVar10;

  ushort uVar11;

  short sVar12;

  short sVar14;

  short sVar16;

  uint5 uVar15;

  short sVar17;

  short sVar18;

  ulonglong uVar19;

  int local_2c;

  int local_28;

  int local_20;

  ulonglong uVar13;

  

  local_2c = *(int *)(param_1 + 8);

  iVar9 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_20 = *(int *)(param_1 + 0x20);

    iVar10 = *(byte *)(param_1 + 0x24) + 1;

    if (local_20 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar8 = (uint *)(iVar9 + iVar1 * 4);

          local_28 = iVar1;

          do {

            uVar4 = *(uint *)((local_2c - iVar9) + -4 + (int)puVar8);

            puVar8 = puVar8 + -1;

            uVar7 = uVar4 >> 0x18;

            if (iVar10 != 0x100) {

              uVar7 = (int)(uVar7 * iVar10) >> 8;

            }

            if (uVar7 != 0) {

              uVar5 = *puVar8;

              if (uVar7 + 1 == 0x100) {

                *puVar8 = (uVar5 ^ uVar4) & 0xffffff ^ uVar5;

              }

              else {

                uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar5 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar5 >> 0x10),uVar5)) >>

                                              0x20),uVar5) >> 0x18);

                uVar15 = (uint5)uVar6 & 0xffffffff00;

                uVar13 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)(uVar5 >> 8),(ushort)uVar5)) &

                         0xffffffff00ffffff;

                uVar11 = (ushort)uVar5 & 0xff;

                uVar19 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(uVar4 >> 0x10),uVar4) >> 0x18),

                                           CONCAT12((char)(uVar4 >> 8),(short)uVar4)) >> 0x10,

                                  (short)uVar4) & 0xff00ff00ff;

                sVar18 = (short)(uVar7 + 1);

                sVar14 = (short)(uVar13 >> 0x10);

                sVar16 = (short)(uVar15 >> 8);

                sVar17 = (short)(uVar15 >> 0x18);

                sVar12 = uVar11 - (((ushort)(uVar11 * sVar18) >> 8) -

                                  ((ushort)((short)uVar19 * sVar18) >> 8));

                sVar14 = sVar14 - (((ushort)(sVar14 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar13 >> 0x30) * sVar18) >> 8));

                *puVar8 = CONCAT13((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17),

                                   CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                            (0xff < sVar16),

                                            CONCAT11((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14

                                                     - (0xff < sVar14),

                                                     (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12

                                                     - (0xff < sVar12))));

              }

            }

            local_28 = local_28 + -1;

          } while (local_28 != 0);

        }

        local_2c = local_2c + iVar2;

        iVar9 = iVar9 + iVar3;

        local_20 = local_20 + -1;

      } while (local_20 != 0);

    }

  }

  return;

}





// --- FUN_006617c0 at 0x006617C0 (size: 393) ---


void FUN_006617c0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  ushort uVar5;

  ushort uVar6;

  uint uVar7;

  char *pcVar8;

  char *pcVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  short sVar13;

  short sVar14;

  short sVar15;

  ulonglong uVar16;

  uint local_28;

  int local_24;

  int local_1c;

  

  local_24 = *(int *)(param_1 + 8);

  iVar10 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar11 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pcVar8 = (char *)(iVar1 * 3 + 2 + iVar10);

          iVar12 = iVar1;

          do {

            uVar4 = *(uint *)(local_24 + -4 + iVar12 * 4);

            iVar12 = iVar12 + -1;

            pcVar9 = pcVar8 + -3;

            uVar7 = uVar4 >> 0x18;

            if (iVar11 != 0x100) {

              uVar7 = (int)(uVar7 * iVar11) >> 8;

            }

            if (uVar7 != 0) {

              uVar6 = (ushort)*(uint3 *)(pcVar8 + -5);

              local_28 = (uint)*(uint3 *)(pcVar8 + -5);

              if (uVar7 + 1 == 0x100) {

                local_28 = (local_28 ^ uVar4) & 0xffffff ^ local_28;

                pcVar8[-5] = (char)local_28;

                pcVar8[-4] = (char)(local_28 >> 8);

                *pcVar9 = (char)(local_28 >> 0x10);

              }

              else {

                uVar5 = (ushort)(CONCAT14(*pcVar9,local_28) >> 0x18);

                uVar16 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(uVar4 >> 0x10),uVar4) >> 0x18),

                                           CONCAT12((char)(uVar4 >> 8),(short)uVar4)) >> 0x10,

                                  (short)uVar4) & 0xff00ff00ff;

                sVar15 = (short)(uVar7 + 1);

                sVar14 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar13 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar15) >> 8) -

                         ((ushort)((short)uVar16 * sVar15) >> 8));

                sVar14 = sVar14 - (((ushort)(sVar14 * sVar15) >> 8) -

                                  ((ushort)((short)(uVar16 >> 0x10) * sVar15) >> 8));

                sVar15 = uVar5 - (((ushort)(uVar5 * sVar15) >> 8) -

                                 ((ushort)((short)(uVar16 >> 0x20) * sVar15) >> 8));

                pcVar8[-5] = (0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 - (0xff < sVar13);

                pcVar8[-4] = (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 - (0xff < sVar14);

                *pcVar9 = (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 - (0xff < sVar15);

              }

            }

            pcVar8 = pcVar9;

          } while (iVar12 != 0);

        }

        local_24 = local_24 + iVar2;

        iVar10 = iVar10 + iVar3;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_00661950 at 0x00661950 (size: 344) ---


void FUN_00661950(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  int iVar7;

  uint *puVar8;

  int iVar9;

  int iVar10;

  ushort uVar11;

  short sVar12;

  short sVar14;

  short sVar16;

  uint5 uVar15;

  short sVar17;

  short sVar18;

  ulonglong uVar19;

  uint local_28;

  int local_24;

  int local_20;

  int local_18;

  ulonglong uVar13;

  

  local_24 = *(int *)(param_1 + 8);

  iVar9 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar10 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar8 = (uint *)(iVar9 + iVar1 * 4);

          local_20 = iVar1;

          do {

            uVar4 = *(uint *)((local_24 - iVar9) + -4 + (int)puVar8);

            puVar8 = puVar8 + -1;

            local_28 = uVar4 & 0xffffff;

            iVar7 = 0xff;

            if ((iVar10 == 0x100) || (iVar7 = iVar10 * 0xff >> 8, iVar7 != 0)) {

              uVar5 = *puVar8;

              if (iVar7 + 1 == 0x100) {

                *puVar8 = (uVar5 ^ local_28) & 0xffffff ^ uVar5;

              }

              else {

                uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar5 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar5 >> 0x10),uVar5)) >>

                                              0x20),uVar5) >> 0x18);

                uVar15 = (uint5)uVar6 & 0xffffffff00;

                uVar13 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)(uVar5 >> 8),(ushort)uVar5)) &

                         0xffffffff00ffffff;

                uVar11 = (ushort)uVar5 & 0xff;

                uVar19 = (ulonglong)

                         (CONCAT52(CONCAT23((short)(CONCAT14((char)(local_28 >> 0x10),uVar4) >> 0x18

                                                   ),CONCAT12((char)(local_28 >> 8),(short)local_28)

                                           ) >> 0x10,(short)local_28) & 0xff00ffffff) & 0xff00ff00ff

                ;

                sVar18 = (short)(iVar7 + 1);

                sVar14 = (short)(uVar13 >> 0x10);

                sVar16 = (short)(uVar15 >> 8);

                sVar17 = (short)(uVar15 >> 0x18);

                sVar12 = uVar11 - (((ushort)(uVar11 * sVar18) >> 8) -

                                  ((ushort)((short)uVar19 * sVar18) >> 8));

                sVar14 = sVar14 - (((ushort)(sVar14 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar13 >> 0x30) * sVar18) >> 8));

                *puVar8 = CONCAT13((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17),

                                   CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                            (0xff < sVar16),

                                            CONCAT11((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14

                                                     - (0xff < sVar14),

                                                     (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12

                                                     - (0xff < sVar12))));

              }

            }

            local_20 = local_20 + -1;

          } while (local_20 != 0);

        }

        local_24 = local_24 + iVar2;

        iVar9 = iVar9 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00661ac0 at 0x00661AC0 (size: 395) ---


void FUN_00661ac0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  ushort uVar5;

  ushort uVar6;

  int iVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  short sVar14;

  short sVar15;

  short sVar16;

  byte bVar18;

  byte bVar19;

  ulonglong uVar17;

  uint local_20;

  int local_18;

  

  iVar10 = *(int *)(param_1 + 0x14);

  iVar11 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar13 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar8 = (byte *)(iVar1 * 3 + 2 + iVar10);

          iVar12 = iVar1;

          do {

            uVar4 = *(uint *)(iVar11 + -4 + iVar12 * 4);

            iVar12 = iVar12 + -1;

            pbVar9 = pbVar8 + -3;

            local_20 = uVar4 & 0xffffff;

            iVar7 = 0xff;

            if ((iVar13 == 0x100) || (iVar7 = iVar13 * 0xff >> 8, iVar7 != 0)) {

              uVar6 = *(ushort *)(pbVar8 + -5);

              bVar18 = (byte)(local_20 >> 8);

              bVar19 = (byte)(local_20 >> 0x10);

              if (iVar7 + 1 == 0x100) {

                pbVar8[-5] = (byte)local_20;

                pbVar8[-4] = bVar18;

                *pbVar9 = bVar19;

              }

              else {

                uVar5 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

                uVar17 = (ulonglong)

                         (CONCAT52(CONCAT23((short)(CONCAT14(bVar19,uVar4) >> 0x18),

                                            CONCAT12(bVar18,(short)local_20)) >> 0x10,

                                   (short)local_20) & 0xff00ffffff) & 0xff00ff00ff;

                sVar16 = (short)(iVar7 + 1);

                sVar15 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar14 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar16) >> 8) -

                         ((ushort)((short)uVar17 * sVar16) >> 8));

                sVar15 = sVar15 - (((ushort)(sVar15 * sVar16) >> 8) -

                                  ((ushort)((short)(uVar17 >> 0x10) * sVar16) >> 8));

                sVar16 = uVar5 - (((ushort)(uVar5 * sVar16) >> 8) -

                                 ((ushort)((short)(uVar17 >> 0x20) * sVar16) >> 8));

                pbVar8[-5] = (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 - (0xff < sVar14);

                pbVar8[-4] = (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 - (0xff < sVar15);

                *pbVar9 = (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16);

              }

            }

            pbVar8 = pbVar9;

          } while (iVar12 != 0);

        }

        iVar11 = iVar11 + iVar2;

        iVar10 = iVar10 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00661c50 at 0x00661C50 (size: 352) ---


void FUN_00661c50(int param_1)



{

  uint3 *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  undefined2 uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  undefined1 *puVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar17;

  short sVar19;

  uint5 uVar18;

  short sVar20;

  short sVar21;

  ulonglong uVar22;

  uint local_24;

  int local_1c;

  ulonglong uVar16;

  

  iVar10 = *(int *)(param_1 + 8);

  iVar13 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar11 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          puVar12 = (undefined1 *)(iVar2 * 3 + 2 + iVar10);

          iVar9 = iVar2;

          do {

            puVar1 = (uint3 *)(puVar12 + -5);

            uVar7 = (undefined2)*puVar1;

            puVar12 = puVar12 + -3;

            iVar9 = iVar9 + -1;

            local_24 = (uint)*puVar1;

            iVar8 = 0xff;

            if ((iVar11 == 0x100) || (iVar8 = iVar11 * 0xff >> 8, iVar8 != 0)) {

              uVar5 = *(uint *)(iVar13 + iVar9 * 4);

              if (iVar8 + 1 == 0x100) {

                *(uint *)(iVar13 + iVar9 * 4) = (uVar5 ^ local_24) & 0xffffff ^ uVar5;

              }

              else {

                uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar5 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar5 >> 0x10),uVar5)) >>

                                              0x20),uVar5) >> 0x18);

                uVar18 = (uint5)uVar6 & 0xffffffff00;

                uVar16 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)(uVar5 >> 8),(ushort)uVar5)) &

                         0xffffffff00ffffff;

                uVar14 = (ushort)uVar5 & 0xff;

                uVar22 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(*puVar12,local_24) >> 0x18),

                                           CONCAT12((char)((ushort)uVar7 >> 8),uVar7)) >> 0x10,uVar7

                                 ) & 0xff00ff00ff;

                sVar21 = (short)(iVar8 + 1);

                sVar17 = (short)(uVar16 >> 0x10);

                sVar19 = (short)(uVar18 >> 8);

                sVar20 = (short)(uVar18 >> 0x18);

                sVar15 = uVar14 - (((ushort)(uVar14 * sVar21) >> 8) -

                                  ((ushort)((short)uVar22 * sVar21) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                  ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

                sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                  ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

                sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                  ((ushort)((short)(uVar16 >> 0x30) * sVar21) >> 8));

                *(uint *)(iVar13 + iVar9 * 4) =

                     CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 - (0xff < sVar20),

                              CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                       (0xff < sVar19),

                                       CONCAT11((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                                (0xff < sVar17),

                                                (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                (0xff < sVar15))));

              }

            }

          } while (iVar9 != 0);

        }

        iVar10 = iVar10 + iVar3;

        iVar13 = iVar13 + iVar4;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_00661dc0 at 0x00661DC0 (size: 438) ---


void FUN_00661dc0(int param_1)



{

  byte *pbVar1;

  byte bVar2;

  byte bVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  ushort uVar7;

  ushort uVar8;

  int iVar9;

  byte *pbVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  short sVar15;

  short sVar16;

  short sVar17;

  ulonglong uVar18;

  undefined2 local_2c;

  int local_28;

  int local_24;

  int local_1c;

  

  local_28 = *(int *)(param_1 + 0x14);

  iVar13 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar12 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar4 = *(int *)(param_1 + 0x1c);

      iVar5 = *(int *)(param_1 + 0xc);

      iVar6 = *(int *)(param_1 + 0x18);

      do {

        if (iVar4 != 0) {

          iVar14 = iVar4 * 3 + iVar13;

          pbVar10 = (byte *)(iVar4 * 3 + 2 + local_28);

          local_24 = iVar4;

          do {

            pbVar1 = (byte *)(iVar14 + -3);

            bVar2 = pbVar10[(iVar13 - local_28) + -4];

            iVar14 = iVar14 + -3;

            pbVar11 = pbVar10 + -3;

            bVar3 = pbVar11[iVar13 - local_28];

            local_2c = CONCAT11(bVar2,*pbVar1);

            iVar9 = 0xff;

            if ((iVar12 == 0x100) || (iVar9 = iVar12 * 0xff >> 8, iVar9 != 0)) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              if (iVar9 + 1 == 0x100) {

                pbVar10[-5] = *pbVar1;

                pbVar10[-4] = bVar2;

                *pbVar11 = bVar3;

              }

              else {

                uVar7 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(((uint5)bVar3 << 0x20) >> 0x18),

                                           CONCAT12(bVar2,local_2c)) >> 0x10,local_2c) &

                         0xff00ff00ff;

                sVar17 = (short)(iVar9 + 1);

                sVar16 = (short)(CONCAT23(uVar7,CONCAT12((char)(uVar8 >> 8),uVar8)) >> 0x10);

                uVar7 = uVar7 >> 8;

                sVar15 = (uVar8 & 0xff) -

                         (((ushort)((uVar8 & 0xff) * sVar17) >> 8) -

                         ((ushort)((short)uVar18 * sVar17) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar17) >> 8));

                sVar17 = uVar7 - (((ushort)(uVar7 * sVar17) >> 8) -

                                 ((ushort)((short)(uVar18 >> 0x20) * sVar17) >> 8));

                pbVar10[-5] = (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 - (0xff < sVar15);

                pbVar10[-4] = (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16);

                *pbVar11 = (0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17);

              }

            }

            local_24 = local_24 + -1;

            pbVar10 = pbVar11;

          } while (local_24 != 0);

        }

        local_28 = local_28 + iVar6;

        iVar13 = iVar13 + iVar5;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_00661f80 at 0x00661F80 (size: 984) ---


void FUN_00661f80(uint param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  uint uVar12;

  uint *puVar13;

  uint uVar14;

  int iVar15;

  int iVar16;

  uint uVar17;

  uint uVar18;

  uint uVar19;

  int iVar20;

  uint local_58;

  uint local_54;

  uint local_50;

  uint local_4c;

  uint local_48;

  uint local_44;

  int local_38;

  int local_2c;

  

  iVar9 = *(int *)(param_1 + 0x14);

  iVar20 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_2c = *(int *)(param_1 + 0x20);

    iVar10 = *(byte *)(param_1 + 0x24) + 1;

    if (local_2c != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar13 = (uint *)(iVar9 + iVar1 * 4);

          local_38 = iVar1;

          do {

            uVar8 = *(uint *)((iVar20 - iVar9) + -4 + (int)puVar13);

            puVar13 = puVar13 + -1;

            iVar4 = (uVar8 >> 0x18) + (uint)(uVar8 >> 0x18 != 0);

            if (iVar10 != 0x100) {

              iVar4 = iVar4 * iVar10 >> 8;

            }

            if (iVar4 != 0) {

              uVar12 = *puVar13;

              uVar14 = uVar8 >> 8 & 0xff;

              uVar7 = uVar8 >> 0x10 & 0xff;

              uVar7 = uVar7 + (uVar7 != 0);

              uVar14 = uVar14 + (uVar14 != 0);

              uVar17 = (uVar8 & 0xff) + (uint)((uVar8 & 0xff) != 0);

              uVar8 = uVar7;

              uVar6 = uVar14;

              if ((uVar14 <= uVar7) && (uVar6 = uVar7, uVar14 < uVar7)) {

                uVar8 = uVar14;

              }

              uVar18 = uVar17;

              if ((uVar17 <= uVar6) && (uVar18 = uVar6, uVar17 < uVar8)) {

                uVar8 = uVar17;

              }

              iVar5 = uVar18 - uVar8;

              if (iVar5 == 0) {

                iVar15 = 0;

                iVar11 = 0;

              }

              else {

                iVar11 = (iVar5 * 0x100) / (int)uVar18;

                iVar15 = 0;

                if (uVar7 == uVar18) {

                  iVar16 = uVar14 - uVar17;

                  if (iVar16 < 0) {

                    iVar15 = 0x6000;

                  }

                }

                else if (uVar14 == uVar18) {

                  iVar16 = uVar17 - uVar7;

                  iVar15 = 0x2000;

                }

                else {

                  iVar16 = uVar7 - uVar14;

                  iVar15 = 0x4000;

                }

                iVar15 = (iVar16 << 0xc) / iVar5 + iVar15;

              }

              param_1._1_1_ = (byte)(uVar12 >> 8);

              uVar6 = (uint)param_1._1_1_;

              param_1._0_1_ = (char)uVar12;

              uVar17 = uVar12 & 0xff;

              param_1._2_1_ = (byte)(uVar12 >> 0x10);

              uVar14 = (uint)param_1._2_1_;

              uVar7 = uVar6 + (uVar6 != 0);

              uVar18 = uVar17 + (uVar17 != 0);

              uVar8 = uVar14 + (uVar14 != 0);

              if (uVar8 < uVar7) {

                uVar8 = uVar7;

              }

              if (uVar8 < uVar18) {

                uVar8 = uVar18;

              }

              param_1._3_1_ = (undefined1)(uVar12 >> 0x18);

              if (iVar4 == 0x100) {

                uVar12 = uVar8;

                uVar6 = uVar8;

                uVar7 = uVar8;

                if (iVar11 != 0) {

                  iVar4 = (int)(iVar15 + (iVar15 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar5 = (int)(uVar8 * iVar11 + ((int)(uVar8 * iVar11) >> 0x1f & 0xffU)) >> 8;

                  uVar6 = (iVar15 + ((iVar4 + 1) / 2) * -0x2000) * iVar5;

                  uVar14 = uVar8 - iVar5;

                  uVar12 = uVar6 & 0x80000fff;

                  if ((int)uVar12 < 0) {

                    uVar12 = (uVar12 - 1 | 0xfffff000) + 1;

                  }

                  iVar5 = (int)(uVar6 + ((int)uVar6 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar12 < -0x800) {

                    iVar5 = iVar5 + -1;

                  }

                  if (0x800 < (int)uVar12) {

                    iVar5 = iVar5 + 1;

                  }

                  uVar12 = local_58;

                  uVar6 = local_54;

                  uVar7 = local_50;

                  switch(iVar4) {

                  case 0:

                    uVar12 = uVar14;

                    uVar6 = uVar8;

                    uVar7 = uVar14 + iVar5;

                    break;

                  case 1:

                    uVar12 = uVar14;

                    uVar6 = uVar14 - iVar5;

                    uVar7 = uVar8;

                    break;

                  case 2:

                    uVar12 = uVar14 + iVar5;

                    uVar6 = uVar14;

                    uVar7 = uVar8;

                    break;

                  case 3:

                    uVar12 = uVar8;

                    uVar6 = uVar14;

                    uVar7 = uVar14 - iVar5;

                    break;

                  case 4:

                    uVar12 = uVar8;

                    uVar6 = uVar14 + iVar5;

                    uVar7 = uVar14;

                    break;

                  case 5:

                    uVar12 = uVar14 - iVar5;

                    uVar6 = uVar8;

                    uVar7 = uVar14;

                  }

                }

                local_50 = uVar7;

                local_54 = uVar6;

                local_58 = uVar12;

                local_54 = local_54 - (local_54 != 0);

                local_50 = local_50 - (local_50 != 0);

                local_58 = local_58 - (local_58 != 0);

                param_1 = CONCAT31(CONCAT21(CONCAT11(param_1._3_1_,(char)local_54),(char)local_50),

                                   (char)local_58);

              }

              else {

                uVar12 = uVar8;

                uVar7 = uVar8;

                uVar18 = uVar8;

                if (iVar11 != 0) {

                  iVar5 = (int)(iVar15 + (iVar15 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar11 = (int)(uVar8 * iVar11 + ((int)(uVar8 * iVar11) >> 0x1f & 0xffU)) >> 8;

                  uVar7 = (iVar15 + ((iVar5 + 1) / 2) * -0x2000) * iVar11;

                  uVar19 = uVar8 - iVar11;

                  uVar12 = uVar7 & 0x80000fff;

                  if ((int)uVar12 < 0) {

                    uVar12 = (uVar12 - 1 | 0xfffff000) + 1;

                  }

                  iVar11 = (int)(uVar7 + ((int)uVar7 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar12 < -0x800) {

                    iVar11 = iVar11 + -1;

                  }

                  if (0x800 < (int)uVar12) {

                    iVar11 = iVar11 + 1;

                  }

                  uVar12 = local_4c;

                  uVar7 = local_48;

                  uVar18 = local_44;

                  switch(iVar5) {

                  case 0:

                    uVar12 = uVar8;

                    uVar7 = uVar19 + iVar11;

                    uVar18 = uVar19;

                    break;

                  case 1:

                    uVar12 = uVar19 - iVar11;

                    uVar7 = uVar8;

                    uVar18 = uVar19;

                    break;

                  case 2:

                    uVar12 = uVar19;

                    uVar7 = uVar8;

                    uVar18 = uVar19 + iVar11;

                    break;

                  case 3:

                    uVar12 = uVar19;

                    uVar7 = uVar19 - iVar11;

                    uVar18 = uVar8;

                    break;

                  case 4:

                    uVar12 = uVar19 + iVar11;

                    uVar7 = uVar19;

                    uVar18 = uVar8;

                    break;

                  case 5:

                    uVar12 = uVar8;

                    uVar7 = uVar19;

                    uVar18 = uVar19 - iVar11;

                  }

                }

                local_44 = uVar18;

                local_48 = uVar7;

                local_4c = uVar12;

                local_4c = local_4c - (local_4c != 0);

                local_48 = local_48 - (local_48 != 0);

                local_44 = local_44 - (local_44 != 0);

                iVar5 = (uVar14 - local_4c) * iVar4;

                iVar11 = (uVar6 - local_48) * iVar4;

                iVar4 = (uVar17 - local_44) * iVar4;

                param_1 = CONCAT31(CONCAT21(CONCAT11(param_1._3_1_,

                                                     param_1._2_1_ -

                                                     (char)(iVar5 + (iVar5 >> 0x1f & 0xffU) >> 8)),

                                            param_1._1_1_ -

                                            (char)(iVar11 + (iVar11 >> 0x1f & 0xffU) >> 8)),

                                   (char)param_1 - (char)(iVar4 + (iVar4 >> 0x1f & 0xffU) >> 8));

              }

              *puVar13 = param_1;

            }

            local_38 = local_38 + -1;

          } while (local_38 != 0);

        }

        iVar20 = iVar20 + iVar2;

        iVar9 = iVar9 + iVar3;

        local_2c = local_2c + -1;

      } while (local_2c != 0);

    }

  }

  return;

}





// --- FUN_00662440 at 0x00662440 (size: 991) ---


void FUN_00662440(uint param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  int iVar9;

  byte bVar10;

  int iVar11;

  int iVar12;

  byte *pbVar13;

  byte *pbVar14;

  uint uVar15;

  int iVar16;

  int iVar17;

  int iVar18;

  uint uVar19;

  uint uVar20;

  uint uVar21;

  uint local_54;

  uint local_50;

  uint local_4c;

  uint local_48;

  uint local_44;

  int local_38;

  int local_34;

  int local_24;

  

  local_34 = *(int *)(param_1 + 0x14);

  local_38 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_24 = *(int *)(param_1 + 0x20);

    iVar9 = *(byte *)(param_1 + 0x24) + 1;

    if (local_24 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar13 = (byte *)(iVar1 * 3 + 2 + local_34);

          iVar18 = iVar1;

          do {

            uVar8 = *(uint *)(local_38 + -4 + iVar18 * 4);

            iVar18 = iVar18 + -1;

            pbVar14 = pbVar13 + -3;

            iVar11 = (uVar8 >> 0x18) + (uint)(uVar8 >> 0x18 != 0);

            if (iVar9 != 0x100) {

              iVar11 = iVar11 * iVar9 >> 8;

            }

            if (iVar11 != 0) {

              uVar15 = uVar8 >> 8 & 0xff;

              uVar7 = uVar8 >> 0x10 & 0xff;

              uVar7 = uVar7 + (uVar7 != 0);

              uVar15 = uVar15 + (uVar15 != 0);

              uVar19 = (uVar8 & 0xff) + (uint)((uVar8 & 0xff) != 0);

              uVar8 = uVar7;

              uVar6 = uVar15;

              if ((uVar15 <= uVar7) && (uVar6 = uVar7, uVar15 < uVar7)) {

                uVar8 = uVar15;

              }

              uVar20 = uVar19;

              if ((uVar19 <= uVar6) && (uVar20 = uVar6, uVar19 < uVar8)) {

                uVar8 = uVar19;

              }

              iVar5 = uVar20 - uVar8;

              if (iVar5 == 0) {

                iVar16 = 0;

                iVar12 = 0;

              }

              else {

                iVar12 = (iVar5 * 0x100) / (int)uVar20;

                iVar16 = 0;

                if (uVar7 == uVar20) {

                  iVar17 = uVar15 - uVar19;

                  if (iVar17 < 0) {

                    iVar16 = 0x6000;

                  }

                }

                else if (uVar15 == uVar20) {

                  iVar17 = uVar19 - uVar7;

                  iVar16 = 0x2000;

                }

                else {

                  iVar17 = uVar7 - uVar15;

                  iVar16 = 0x4000;

                }

                iVar16 = (iVar17 << 0xc) / iVar5 + iVar16;

              }

              uVar6 = (uint)pbVar13[-4];

              uVar19 = (uint)pbVar13[-5];

              uVar15 = (uint)*pbVar14;

              uVar7 = uVar6 + (uVar6 != 0);

              uVar20 = uVar19 + (uVar19 != 0);

              uVar8 = uVar15 + (uVar15 != 0);

              if (uVar8 < uVar7) {

                uVar8 = uVar7;

              }

              if (uVar8 < uVar20) {

                uVar8 = uVar20;

              }

              if (iVar11 == 0x100) {

                uVar6 = uVar8;

                uVar7 = uVar8;

                uVar15 = uVar8;

                if (iVar12 != 0) {

                  iVar11 = (int)(iVar16 + (iVar16 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar5 = (int)(uVar8 * iVar12 + ((int)(uVar8 * iVar12) >> 0x1f & 0xffU)) >> 8;

                  uVar7 = (iVar16 + ((iVar11 + 1) / 2) * -0x2000) * iVar5;

                  uVar19 = uVar8 - iVar5;

                  uVar6 = uVar7 & 0x80000fff;

                  if ((int)uVar6 < 0) {

                    uVar6 = (uVar6 - 1 | 0xfffff000) + 1;

                  }

                  iVar5 = (int)(uVar7 + ((int)uVar7 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar6 < -0x800) {

                    iVar5 = iVar5 + -1;

                  }

                  if (0x800 < (int)uVar6) {

                    iVar5 = iVar5 + 1;

                  }

                  uVar6 = param_1;

                  uVar7 = local_54;

                  uVar15 = local_50;

                  switch(iVar11) {

                  case 0:

                    uVar6 = uVar19;

                    uVar7 = uVar8;

                    uVar15 = uVar19 + iVar5;

                    break;

                  case 1:

                    uVar6 = uVar19;

                    uVar7 = uVar19 - iVar5;

                    uVar15 = uVar8;

                    break;

                  case 2:

                    uVar6 = uVar19 + iVar5;

                    uVar7 = uVar19;

                    uVar15 = uVar8;

                    break;

                  case 3:

                    uVar6 = uVar8;

                    uVar7 = uVar19;

                    uVar15 = uVar19 - iVar5;

                    break;

                  case 4:

                    uVar6 = uVar8;

                    uVar7 = uVar19 + iVar5;

                    uVar15 = uVar19;

                    break;

                  case 5:

                    uVar6 = uVar19 - iVar5;

                    uVar7 = uVar8;

                    uVar15 = uVar19;

                  }

                }

                local_50 = uVar15;

                local_54 = uVar7;

                param_1 = uVar6;

                uVar7 = local_54 - (local_54 != 0);

                local_50 = local_50 - (local_50 != 0);

                uVar8 = param_1 - (param_1 != 0);

                bVar10 = (byte)local_50;

                param_1 = uVar8;

                local_54 = uVar7;

              }

              else {

                uVar7 = uVar8;

                uVar20 = uVar8;

                uVar4 = uVar8;

                if (iVar12 != 0) {

                  iVar5 = (int)(iVar16 + (iVar16 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar12 = (int)(uVar8 * iVar12 + ((int)(uVar8 * iVar12) >> 0x1f & 0xffU)) >> 8;

                  uVar20 = (iVar16 + ((iVar5 + 1) / 2) * -0x2000) * iVar12;

                  uVar21 = uVar8 - iVar12;

                  uVar7 = uVar20 & 0x80000fff;

                  if ((int)uVar7 < 0) {

                    uVar7 = (uVar7 - 1 | 0xfffff000) + 1;

                  }

                  iVar12 = (int)(uVar20 + ((int)uVar20 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar7 < -0x800) {

                    iVar12 = iVar12 + -1;

                  }

                  if (0x800 < (int)uVar7) {

                    iVar12 = iVar12 + 1;

                  }

                  uVar7 = local_4c;

                  uVar20 = local_48;

                  uVar4 = local_44;

                  switch(iVar5) {

                  case 0:

                    uVar7 = uVar8;

                    uVar20 = uVar21 + iVar12;

                    uVar4 = uVar21;

                    break;

                  case 1:

                    uVar7 = uVar21 - iVar12;

                    uVar20 = uVar8;

                    uVar4 = uVar21;

                    break;

                  case 2:

                    uVar7 = uVar21;

                    uVar20 = uVar8;

                    uVar4 = uVar21 + iVar12;

                    break;

                  case 3:

                    uVar7 = uVar21;

                    uVar20 = uVar21 - iVar12;

                    uVar4 = uVar8;

                    break;

                  case 4:

                    uVar7 = uVar21 + iVar12;

                    uVar20 = uVar21;

                    uVar4 = uVar8;

                    break;

                  case 5:

                    uVar7 = uVar8;

                    uVar20 = uVar21;

                    uVar4 = uVar21 - iVar12;

                  }

                }

                local_44 = uVar4;

                local_48 = uVar20;

                local_4c = uVar7;

                local_4c = local_4c - (local_4c != 0);

                local_48 = local_48 - (local_48 != 0);

                local_44 = local_44 - (local_44 != 0);

                iVar5 = (uVar15 - local_4c) * iVar11;

                uVar7 = (uint)(byte)(*pbVar14 - (char)(iVar5 + (iVar5 >> 0x1f & 0xffU) >> 8));

                iVar5 = (uVar6 - local_48) * iVar11;

                bVar10 = pbVar13[-4] - (char)(iVar5 + (iVar5 >> 0x1f & 0xffU) >> 8);

                iVar11 = (uVar19 - local_44) * iVar11;

                uVar8 = (uint)(byte)(pbVar13[-5] - (char)((iVar11 >> 0x1f & 0xffU) + iVar11 >> 8));

              }

              pbVar13[-5] = (byte)uVar8;

              pbVar13[-4] = bVar10;

              *pbVar14 = (byte)uVar7;

            }

            pbVar13 = pbVar14;

          } while (iVar18 != 0);

        }

        local_38 = local_38 + iVar2;

        local_34 = local_34 + iVar3;

        local_24 = local_24 + -1;

      } while (local_24 != 0);

    }

  }

  return;

}





// --- FUN_00662900 at 0x00662900 (size: 984) ---


void FUN_00662900(uint param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  uint uVar11;

  uint *puVar12;

  uint uVar13;

  int iVar14;

  int iVar15;

  uint uVar16;

  uint uVar17;

  uint uVar18;

  int iVar19;

  uint local_50;

  uint local_4c;

  uint local_48;

  uint local_44;

  uint local_40;

  uint local_3c;

  int local_38;

  int local_30;

  int local_24;

  

  iVar8 = *(int *)(param_1 + 0x14);

  iVar19 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_24 = *(int *)(param_1 + 0x20);

    iVar9 = *(byte *)(param_1 + 0x24) + 1;

    if (local_24 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar12 = (uint *)(iVar8 + iVar1 * 4);

          local_30 = iVar1;

          do {

            uVar7 = *(uint *)((iVar19 - iVar8) + -4 + (int)puVar12);

            puVar12 = puVar12 + -1;

            local_38 = 0x100;

            if ((iVar9 == 0x100) || (local_38 = iVar9 * 0x100 >> 8, local_38 != 0)) {

              uVar11 = *puVar12;

              uVar13 = uVar7 >> 8 & 0xff;

              uVar6 = uVar7 >> 0x10 & 0xff;

              uVar6 = uVar6 + (uVar6 != 0);

              uVar13 = uVar13 + (uVar13 != 0);

              uVar16 = (uVar7 & 0xff) + (uint)((uVar7 & 0xff) != 0);

              uVar7 = uVar6;

              uVar5 = uVar13;

              if ((uVar13 <= uVar6) && (uVar5 = uVar6, uVar13 < uVar6)) {

                uVar7 = uVar13;

              }

              uVar17 = uVar16;

              if ((uVar16 <= uVar5) && (uVar17 = uVar5, uVar16 < uVar7)) {

                uVar7 = uVar16;

              }

              iVar4 = uVar17 - uVar7;

              if (iVar4 == 0) {

                iVar14 = 0;

                iVar10 = 0;

              }

              else {

                iVar10 = (iVar4 * 0x100) / (int)uVar17;

                iVar14 = 0;

                if (uVar6 == uVar17) {

                  iVar15 = uVar13 - uVar16;

                  if (iVar15 < 0) {

                    iVar14 = 0x6000;

                  }

                }

                else if (uVar13 == uVar17) {

                  iVar15 = uVar16 - uVar6;

                  iVar14 = 0x2000;

                }

                else {

                  iVar15 = uVar6 - uVar13;

                  iVar14 = 0x4000;

                }

                iVar14 = (iVar15 << 0xc) / iVar4 + iVar14;

              }

              param_1._1_1_ = (byte)(uVar11 >> 8);

              uVar5 = (uint)param_1._1_1_;

              param_1._0_1_ = (char)uVar11;

              uVar16 = uVar11 & 0xff;

              param_1._2_1_ = (byte)(uVar11 >> 0x10);

              uVar13 = (uint)param_1._2_1_;

              uVar6 = uVar5 + (uVar5 != 0);

              uVar17 = uVar16 + (uVar16 != 0);

              uVar7 = uVar13 + (uVar13 != 0);

              if (uVar7 < uVar6) {

                uVar7 = uVar6;

              }

              if (uVar7 < uVar17) {

                uVar7 = uVar17;

              }

              param_1._3_1_ = (undefined1)(uVar11 >> 0x18);

              if (local_38 == 0x100) {

                uVar11 = uVar7;

                uVar5 = uVar7;

                uVar6 = uVar7;

                if (iVar10 != 0) {

                  iVar4 = (int)(iVar14 + (iVar14 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar10 = (int)(uVar7 * iVar10 + ((int)(uVar7 * iVar10) >> 0x1f & 0xffU)) >> 8;

                  uVar5 = (iVar14 + ((iVar4 + 1) / 2) * -0x2000) * iVar10;

                  uVar13 = uVar7 - iVar10;

                  uVar11 = uVar5 & 0x80000fff;

                  if ((int)uVar11 < 0) {

                    uVar11 = (uVar11 - 1 | 0xfffff000) + 1;

                  }

                  iVar10 = (int)(uVar5 + ((int)uVar5 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar11 < -0x800) {

                    iVar10 = iVar10 + -1;

                  }

                  if (0x800 < (int)uVar11) {

                    iVar10 = iVar10 + 1;

                  }

                  uVar11 = local_50;

                  uVar5 = local_4c;

                  uVar6 = local_48;

                  switch(iVar4) {

                  case 0:

                    uVar11 = uVar13;

                    uVar5 = uVar7;

                    uVar6 = uVar13 + iVar10;

                    break;

                  case 1:

                    uVar11 = uVar13;

                    uVar5 = uVar13 - iVar10;

                    uVar6 = uVar7;

                    break;

                  case 2:

                    uVar11 = uVar13 + iVar10;

                    uVar5 = uVar13;

                    uVar6 = uVar7;

                    break;

                  case 3:

                    uVar11 = uVar7;

                    uVar5 = uVar13;

                    uVar6 = uVar13 - iVar10;

                    break;

                  case 4:

                    uVar11 = uVar7;

                    uVar5 = uVar13 + iVar10;

                    uVar6 = uVar13;

                    break;

                  case 5:

                    uVar11 = uVar13 - iVar10;

                    uVar5 = uVar7;

                    uVar6 = uVar13;

                  }

                }

                local_48 = uVar6;

                local_4c = uVar5;

                local_50 = uVar11;

                local_4c = local_4c - (local_4c != 0);

                local_48 = local_48 - (local_48 != 0);

                local_50 = local_50 - (local_50 != 0);

                param_1 = CONCAT31(CONCAT21(CONCAT11(param_1._3_1_,(char)local_4c),(char)local_48),

                                   (char)local_50);

              }

              else {

                uVar11 = uVar7;

                uVar6 = uVar7;

                uVar17 = uVar7;

                if (iVar10 != 0) {

                  iVar4 = (int)(iVar14 + (iVar14 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar10 = (int)(uVar7 * iVar10 + ((int)(uVar7 * iVar10) >> 0x1f & 0xffU)) >> 8;

                  uVar6 = (iVar14 + ((iVar4 + 1) / 2) * -0x2000) * iVar10;

                  uVar18 = uVar7 - iVar10;

                  uVar11 = uVar6 & 0x80000fff;

                  if ((int)uVar11 < 0) {

                    uVar11 = (uVar11 - 1 | 0xfffff000) + 1;

                  }

                  iVar10 = (int)(uVar6 + ((int)uVar6 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar11 < -0x800) {

                    iVar10 = iVar10 + -1;

                  }

                  if (0x800 < (int)uVar11) {

                    iVar10 = iVar10 + 1;

                  }

                  uVar11 = local_44;

                  uVar6 = local_40;

                  uVar17 = local_3c;

                  switch(iVar4) {

                  case 0:

                    uVar11 = uVar7;

                    uVar6 = uVar18 + iVar10;

                    uVar17 = uVar18;

                    break;

                  case 1:

                    uVar11 = uVar18 - iVar10;

                    uVar6 = uVar7;

                    uVar17 = uVar18;

                    break;

                  case 2:

                    uVar11 = uVar18;

                    uVar6 = uVar7;

                    uVar17 = uVar18 + iVar10;

                    break;

                  case 3:

                    uVar11 = uVar18;

                    uVar6 = uVar18 - iVar10;

                    uVar17 = uVar7;

                    break;

                  case 4:

                    uVar11 = uVar18 + iVar10;

                    uVar6 = uVar18;

                    uVar17 = uVar7;

                    break;

                  case 5:

                    uVar11 = uVar7;

                    uVar6 = uVar18;

                    uVar17 = uVar18 - iVar10;

                  }

                }

                local_3c = uVar17;

                local_40 = uVar6;

                local_44 = uVar11;

                local_44 = local_44 - (local_44 != 0);

                local_40 = local_40 - (local_40 != 0);

                local_3c = local_3c - (local_3c != 0);

                iVar4 = (uVar13 - local_44) * local_38;

                iVar10 = (uVar5 - local_40) * local_38;

                local_38 = (uVar16 - local_3c) * local_38;

                param_1 = CONCAT31(CONCAT21(CONCAT11(param_1._3_1_,

                                                     param_1._2_1_ -

                                                     (char)(iVar4 + (iVar4 >> 0x1f & 0xffU) >> 8)),

                                            param_1._1_1_ -

                                            (char)(iVar10 + (iVar10 >> 0x1f & 0xffU) >> 8)),

                                   (char)param_1 -

                                   (char)(local_38 + (local_38 >> 0x1f & 0xffU) >> 8));

              }

              *puVar12 = param_1;

            }

            local_30 = local_30 + -1;

          } while (local_30 != 0);

        }

        iVar19 = iVar19 + iVar2;

        iVar8 = iVar8 + iVar3;

        local_24 = local_24 + -1;

      } while (local_24 != 0);

    }

  }

  return;

}





// --- FUN_00663270 at 0x00663270 (size: 995) ---


void FUN_00663270(int param_1)



{

  byte *pbVar1;

  byte *pbVar2;

  byte *pbVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  int iVar9;

  uint uVar10;

  uint uVar11;

  int iVar12;

  int iVar13;

  uint uVar14;

  int iVar15;

  uint uVar16;

  int iVar17;

  int iVar18;

  int iVar19;

  uint uVar20;

  uint uVar21;

  uint uVar22;

  uint local_50;

  uint local_4c;

  uint local_48;

  uint local_44;

  uint local_40;

  uint local_3c;

  int local_38;

  int local_34;

  int local_24;

  

  iVar12 = *(int *)(param_1 + 8);

  local_34 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_24 = *(int *)(param_1 + 0x20);

    iVar19 = *(byte *)(param_1 + 0x24) + 1;

    if (local_24 != 0) {

      iVar4 = *(int *)(param_1 + 0x1c);

      iVar5 = *(int *)(param_1 + 0xc);

      iVar6 = *(int *)(param_1 + 0x18);

      do {

        if (iVar4 != 0) {

          iVar9 = iVar4 * 3 + 2 + iVar12;

          iVar15 = iVar4;

          do {

            pbVar1 = (byte *)(iVar9 + -4);

            pbVar2 = (byte *)(iVar9 + -3);

            pbVar3 = (byte *)(iVar9 + -5);

            iVar9 = iVar9 + -3;

            iVar15 = iVar15 + -1;

            local_38 = 0x100;

            if ((iVar19 == 0x100) || (local_38 = iVar19 * 0x100 >> 8, local_38 != 0)) {

              uVar14 = *(uint *)(local_34 + iVar15 * 4);

              uVar10 = (uint)*pbVar2 + (uint)(*pbVar2 != 0);

              uVar16 = (uint)*pbVar1 + (uint)(*pbVar1 != 0);

              uVar20 = (uint)*pbVar3 + (uint)(*pbVar3 != 0);

              uVar11 = uVar10;

              uVar8 = uVar16;

              if ((uVar16 <= uVar10) && (uVar8 = uVar10, uVar16 < uVar10)) {

                uVar11 = uVar16;

              }

              uVar21 = uVar20;

              if ((uVar20 <= uVar8) && (uVar21 = uVar8, uVar20 < uVar11)) {

                uVar11 = uVar20;

              }

              iVar7 = uVar21 - uVar11;

              if (iVar7 == 0) {

                iVar17 = 0;

                iVar13 = 0;

              }

              else {

                iVar13 = (iVar7 * 0x100) / (int)uVar21;

                iVar17 = 0;

                if (uVar10 == uVar21) {

                  iVar18 = uVar16 - uVar20;

                  if (iVar18 < 0) {

                    iVar17 = 0x6000;

                  }

                }

                else if (uVar16 == uVar21) {

                  iVar18 = uVar20 - uVar10;

                  iVar17 = 0x2000;

                }

                else {

                  iVar18 = uVar10 - uVar16;

                  iVar17 = 0x4000;

                }

                iVar17 = (iVar18 << 0xc) / iVar7 + iVar17;

              }

              param_1._1_1_ = (byte)(uVar14 >> 8);

              uVar8 = (uint)param_1._1_1_;

              param_1._0_1_ = (char)uVar14;

              uVar20 = uVar14 & 0xff;

              param_1._2_1_ = (byte)(uVar14 >> 0x10);

              uVar16 = (uint)param_1._2_1_;

              uVar10 = uVar8 + (uVar8 != 0);

              uVar21 = uVar20 + (uVar20 != 0);

              uVar11 = uVar16 + (uVar16 != 0);

              if (uVar11 < uVar10) {

                uVar11 = uVar10;

              }

              if (uVar11 < uVar21) {

                uVar11 = uVar21;

              }

              param_1._3_1_ = (undefined1)(uVar14 >> 0x18);

              if (local_38 == 0x100) {

                uVar14 = uVar11;

                uVar8 = uVar11;

                uVar10 = uVar11;

                if (iVar13 != 0) {

                  iVar7 = (int)(iVar17 + (iVar17 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar13 = (int)(uVar11 * iVar13 + ((int)(uVar11 * iVar13) >> 0x1f & 0xffU)) >> 8;

                  uVar8 = (iVar17 + ((iVar7 + 1) / 2) * -0x2000) * iVar13;

                  uVar16 = uVar11 - iVar13;

                  uVar14 = uVar8 & 0x80000fff;

                  if ((int)uVar14 < 0) {

                    uVar14 = (uVar14 - 1 | 0xfffff000) + 1;

                  }

                  iVar13 = (int)(uVar8 + ((int)uVar8 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar14 < -0x800) {

                    iVar13 = iVar13 + -1;

                  }

                  if (0x800 < (int)uVar14) {

                    iVar13 = iVar13 + 1;

                  }

                  uVar14 = local_50;

                  uVar8 = local_4c;

                  uVar10 = local_48;

                  switch(iVar7) {

                  case 0:

                    uVar14 = uVar16;

                    uVar8 = uVar11;

                    uVar10 = uVar16 + iVar13;

                    break;

                  case 1:

                    uVar14 = uVar16;

                    uVar8 = uVar16 - iVar13;

                    uVar10 = uVar11;

                    break;

                  case 2:

                    uVar14 = uVar16 + iVar13;

                    uVar8 = uVar16;

                    uVar10 = uVar11;

                    break;

                  case 3:

                    uVar14 = uVar11;

                    uVar8 = uVar16;

                    uVar10 = uVar16 - iVar13;

                    break;

                  case 4:

                    uVar14 = uVar11;

                    uVar8 = uVar16 + iVar13;

                    uVar10 = uVar16;

                    break;

                  case 5:

                    uVar14 = uVar16 - iVar13;

                    uVar8 = uVar11;

                    uVar10 = uVar16;

                  }

                }

                local_48 = uVar10;

                local_4c = uVar8;

                local_50 = uVar14;

                local_4c = local_4c - (local_4c != 0);

                local_48 = local_48 - (local_48 != 0);

                local_50 = local_50 - (local_50 != 0);

                param_1 = CONCAT31(CONCAT21(CONCAT11(param_1._3_1_,(char)local_4c),(char)local_48),

                                   (char)local_50);

              }

              else {

                uVar14 = uVar11;

                uVar10 = uVar11;

                uVar21 = uVar11;

                if (iVar13 != 0) {

                  iVar7 = (int)(iVar17 + (iVar17 >> 0x1f & 0xfffU)) >> 0xc;

                  iVar13 = (int)(uVar11 * iVar13 + ((int)(uVar11 * iVar13) >> 0x1f & 0xffU)) >> 8;

                  uVar10 = (iVar17 + ((iVar7 + 1) / 2) * -0x2000) * iVar13;

                  uVar22 = uVar11 - iVar13;

                  uVar14 = uVar10 & 0x80000fff;

                  if ((int)uVar14 < 0) {

                    uVar14 = (uVar14 - 1 | 0xfffff000) + 1;

                  }

                  iVar13 = (int)(uVar10 + ((int)uVar10 >> 0x1f & 0xfffU)) >> 0xc;

                  if ((int)uVar14 < -0x800) {

                    iVar13 = iVar13 + -1;

                  }

                  if (0x800 < (int)uVar14) {

                    iVar13 = iVar13 + 1;

                  }

                  uVar14 = local_44;

                  uVar10 = local_40;

                  uVar21 = local_3c;

                  switch(iVar7) {

                  case 0:

                    uVar14 = uVar11;

                    uVar10 = uVar22 + iVar13;

                    uVar21 = uVar22;

                    break;

                  case 1:

                    uVar14 = uVar22 - iVar13;

                    uVar10 = uVar11;

                    uVar21 = uVar22;

                    break;

                  case 2:

                    uVar14 = uVar22;

                    uVar10 = uVar11;

                    uVar21 = uVar22 + iVar13;

                    break;

                  case 3:

                    uVar14 = uVar22;

                    uVar10 = uVar22 - iVar13;

                    uVar21 = uVar11;

                    break;

                  case 4:

                    uVar14 = uVar22 + iVar13;

                    uVar10 = uVar22;

                    uVar21 = uVar11;

                    break;

                  case 5:

                    uVar14 = uVar11;

                    uVar10 = uVar22;

                    uVar21 = uVar22 - iVar13;

                  }

                }

                local_3c = uVar21;

                local_40 = uVar10;

                local_44 = uVar14;

                local_44 = local_44 - (local_44 != 0);

                local_40 = local_40 - (local_40 != 0);

                local_3c = local_3c - (local_3c != 0);

                iVar7 = (uVar16 - local_44) * local_38;

                iVar13 = (uVar8 - local_40) * local_38;

                local_38 = (uVar20 - local_3c) * local_38;

                param_1 = CONCAT31(CONCAT21(CONCAT11(param_1._3_1_,

                                                     param_1._2_1_ -

                                                     (char)(iVar7 + (iVar7 >> 0x1f & 0xffU) >> 8)),

                                            param_1._1_1_ -

                                            (char)(iVar13 + (iVar13 >> 0x1f & 0xffU) >> 8)),

                                   (char)param_1 -

                                   (char)(local_38 + (local_38 >> 0x1f & 0xffU) >> 8));

              }

              *(int *)(local_34 + iVar15 * 4) = param_1;

            }

          } while (iVar15 != 0);

        }

        iVar12 = iVar12 + iVar5;

        local_34 = local_34 + iVar6;

        local_24 = local_24 + -1;

      } while (local_24 != 0);

    }

  }

  return;

}





// --- FUN_00663c00 at 0x00663C00 (size: 337) ---


void FUN_00663c00(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  undefined4 uVar5;

  uint uVar6;

  ulonglong uVar7;

  int iVar8;

  undefined4 *puVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar13;

  short sVar15;

  uint5 uVar14;

  short sVar16;

  ushort uVar17;

  ushort uVar19;

  ushort uVar20;

  ulonglong uVar18;

  short sVar21;

  int local_28;

  int local_24;

  int local_1c;

  

  local_28 = *(int *)(param_1 + 8);

  iVar10 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar11 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar9 = (undefined4 *)(iVar10 + iVar1 * 4);

          local_24 = iVar1;

          do {

            uVar4 = *(uint *)((local_28 - iVar10) + -4 + (int)puVar9);

            puVar9 = puVar9 + -1;

            iVar8 = (uVar4 >> 0x18) + (uint)(uVar4 >> 0x18 != 0);

            if (iVar11 != 0x100) {

              iVar8 = iVar8 * iVar11 >> 8;

            }

            if (iVar8 != 0) {

              uVar5 = *puVar9;

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar14 = (uint5)uVar6 & 0xffffffff00;

              uVar18 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar12 = (ushort)uVar5 & 0xff;

              uVar20 = (ushort)(byte)(uVar4 >> 0x10);

              uVar19 = (ushort)(byte)(uVar4 >> 8);

              uVar7 = uVar18 >> 0x10 & 0xffffff00ff00;

              sVar13 = (short)(uVar18 >> 0x10);

              sVar15 = (short)(uVar14 >> 8);

              sVar16 = (short)(uVar14 >> 0x18);

              uVar17 = (ushort)(((ushort)(byte)uVar4 + (ushort)((byte)uVar4 != 0)) * uVar12) >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * sVar13) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * sVar15) >> 8;

              uVar18 = (ulonglong)CONCAT24(uVar20,CONCAT22(uVar19,uVar17)) | uVar7 << 0x10;

              if (iVar8 != 0x100) {

                sVar21 = (short)iVar8;

                uVar18 = CONCAT26(sVar16 - (((ushort)(sVar16 * sVar21) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar21) >> 8)),

                                  CONCAT24(sVar15 - (((ushort)(sVar15 * sVar21) >> 8) -

                                                    ((ushort)(uVar20 * sVar21) >> 8)),

                                           CONCAT22(sVar13 - (((ushort)(sVar13 * sVar21) >> 8) -

                                                             ((ushort)(uVar19 * sVar21) >> 8)),

                                                    uVar12 - (((ushort)(uVar12 * sVar21) >> 8) -

                                                             ((ushort)(uVar17 * sVar21) >> 8)))));

              }

              sVar13 = (short)uVar18;

              sVar15 = (short)(uVar18 >> 0x10);

              sVar16 = (short)(uVar18 >> 0x20);

              sVar21 = (short)(uVar18 >> 0x30);

              *puVar9 = CONCAT13((0 < sVar21) * (sVar21 < 0x100) * (char)(uVar18 >> 0x30) -

                                 (0xff < sVar21),

                                 CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)(uVar18 >> 0x20) -

                                          (0xff < sVar16),

                                          CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                                   (char)(uVar18 >> 0x10) - (0xff < sVar15),

                                                   (0 < sVar13) * (sVar13 < 0x100) * (char)uVar18 -

                                                   (0xff < sVar13))));

            }

            local_24 = local_24 + -1;

          } while (local_24 != 0);

        }

        local_28 = local_28 + iVar2;

        iVar10 = iVar10 + iVar3;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_00663d60 at 0x00663D60 (size: 387) ---


void FUN_00663d60(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  short sVar5;

  ushort uVar6;

  int iVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  ushort uVar13;

  short sVar15;

  undefined6 uVar14;

  ushort uVar16;

  ushort uVar17;

  ushort uVar18;

  short sVar19;

  int local_24;

  int local_1c;

  

  local_24 = *(int *)(param_1 + 8);

  iVar10 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar11 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar8 = (byte *)(iVar1 * 3 + 2 + iVar10);

          iVar12 = iVar1;

          do {

            uVar4 = *(uint *)(local_24 + -4 + iVar12 * 4);

            iVar12 = iVar12 + -1;

            pbVar9 = pbVar8 + -3;

            iVar7 = (uVar4 >> 0x18) + (uint)(uVar4 >> 0x18 != 0);

            if (iVar11 != 0x100) {

              iVar7 = iVar7 * iVar11 >> 8;

            }

            if (iVar7 != 0) {

              uVar16 = *(ushort *)(pbVar8 + -5);

              uVar6 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar13 = uVar16 & 0xff;

              uVar18 = (ushort)(byte)(uVar4 >> 0x10);

              uVar17 = (ushort)(byte)(uVar4 >> 8);

              sVar15 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar16 >> 8),uVar16)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar16 = (ushort)(((ushort)(byte)uVar4 + (ushort)((byte)uVar4 != 0)) * uVar13) >> 8;

              uVar17 = (ushort)((uVar17 + (uVar17 != 0)) * sVar15) >> 8;

              uVar18 = (ushort)((uVar18 + (uVar18 != 0)) * uVar6) >> 8;

              uVar14 = CONCAT24(uVar18,CONCAT22(uVar17,uVar16));

              if (iVar7 != 0x100) {

                sVar19 = (short)iVar7;

                uVar14 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar19) >> 8) -

                                          ((ushort)(uVar18 * sVar19) >> 8)),

                                  CONCAT22(sVar15 - (((ushort)(sVar15 * sVar19) >> 8) -

                                                    ((ushort)(uVar17 * sVar19) >> 8)),

                                           uVar13 - (((ushort)(uVar13 * sVar19) >> 8) -

                                                    ((ushort)(uVar16 * sVar19) >> 8))));

              }

              sVar15 = (short)uVar14;

              sVar19 = (short)((uint6)uVar14 >> 0x10);

              sVar5 = (short)((uint6)uVar14 >> 0x20);

              pbVar8[-5] = (0 < sVar15) * (sVar15 < 0x100) * (char)uVar14 - (0xff < sVar15);

              pbVar8[-4] = (0 < sVar19) * (sVar19 < 0x100) * (char)((uint6)uVar14 >> 0x10) -

                           (0xff < sVar19);

              *pbVar9 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar14 >> 0x20) -

                        (0xff < sVar5);

            }

            pbVar8 = pbVar9;

          } while (iVar12 != 0);

        }

        local_24 = local_24 + iVar2;

        iVar10 = iVar10 + iVar3;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_00663ef0 at 0x00663EF0 (size: 327) ---


void FUN_00663ef0(int param_1)



{

  uint *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  ulonglong uVar7;

  int iVar8;

  undefined4 *puVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar13;

  short sVar15;

  uint5 uVar14;

  short sVar16;

  ushort uVar17;

  ushort uVar19;

  ushort uVar20;

  ulonglong uVar18;

  short sVar21;

  int local_24;

  uint local_20;

  int local_1c;

  int local_18;

  

  local_24 = *(int *)(param_1 + 8);

  iVar10 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar11 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          puVar9 = (undefined4 *)(iVar10 + iVar2 * 4);

          local_1c = iVar2;

          do {

            puVar1 = (uint *)((local_24 - iVar10) + -4 + (int)puVar9);

            puVar9 = puVar9 + -1;

            iVar8 = 0x100;

            local_20 = *puVar1 & 0xffffff;

            if ((iVar11 == 0x100) || (iVar8 = iVar11 * 0x100 >> 8, iVar8 != 0)) {

              uVar5 = *puVar9;

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar14 = (uint5)uVar6 & 0xffffffff00;

              uVar18 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar12 = (ushort)uVar5 & 0xff;

              uVar20 = (ushort)(byte)(local_20 >> 0x10);

              uVar19 = (ushort)(byte)(local_20 >> 8);

              uVar7 = uVar18 >> 0x10 & 0xffffff00ff00;

              sVar13 = (short)(uVar18 >> 0x10);

              sVar15 = (short)(uVar14 >> 8);

              sVar16 = (short)(uVar14 >> 0x18);

              uVar17 = (ushort)(((ushort)(byte)local_20 + (ushort)((byte)local_20 != 0)) * uVar12)

                       >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * sVar13) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * sVar15) >> 8;

              uVar18 = (ulonglong)CONCAT24(uVar20,CONCAT22(uVar19,uVar17)) | uVar7 << 0x10;

              if (iVar8 != 0x100) {

                sVar21 = (short)iVar8;

                uVar18 = CONCAT26(sVar16 - (((ushort)(sVar16 * sVar21) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar21) >> 8)),

                                  CONCAT24(sVar15 - (((ushort)(sVar15 * sVar21) >> 8) -

                                                    ((ushort)(uVar20 * sVar21) >> 8)),

                                           CONCAT22(sVar13 - (((ushort)(sVar13 * sVar21) >> 8) -

                                                             ((ushort)(uVar19 * sVar21) >> 8)),

                                                    uVar12 - (((ushort)(uVar12 * sVar21) >> 8) -

                                                             ((ushort)(uVar17 * sVar21) >> 8)))));

              }

              sVar13 = (short)uVar18;

              sVar15 = (short)(uVar18 >> 0x10);

              sVar16 = (short)(uVar18 >> 0x20);

              sVar21 = (short)(uVar18 >> 0x30);

              *puVar9 = CONCAT13((0 < sVar21) * (sVar21 < 0x100) * (char)(uVar18 >> 0x30) -

                                 (0xff < sVar21),

                                 CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)(uVar18 >> 0x20) -

                                          (0xff < sVar16),

                                          CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                                   (char)(uVar18 >> 0x10) - (0xff < sVar15),

                                                   (0 < sVar13) * (sVar13 < 0x100) * (char)uVar18 -

                                                   (0xff < sVar13))));

            }

            local_1c = local_1c + -1;

          } while (local_1c != 0);

        }

        local_24 = local_24 + iVar3;

        iVar10 = iVar10 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00664040 at 0x00664040 (size: 371) ---


void FUN_00664040(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  int iVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar16;

  undefined6 uVar15;

  ushort uVar17;

  ushort uVar18;

  ushort uVar19;

  short sVar20;

  uint local_20;

  int local_18;

  

  iVar10 = *(int *)(param_1 + 0x14);

  iVar11 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar13 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pbVar8 = (byte *)(iVar2 * 3 + 2 + iVar10);

          iVar12 = iVar2;

          do {

            iVar1 = iVar12 * 4;

            iVar12 = iVar12 + -1;

            iVar7 = 0x100;

            pbVar9 = pbVar8 + -3;

            local_20 = *(uint *)(iVar11 + -4 + iVar1) & 0xffffff;

            if ((iVar13 == 0x100) || (iVar7 = iVar13 * 0x100 >> 8, iVar7 != 0)) {

              uVar17 = *(ushort *)(pbVar8 + -5);

              uVar6 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar14 = uVar17 & 0xff;

              uVar19 = (ushort)(byte)(local_20 >> 0x10);

              uVar18 = (ushort)(byte)(local_20 >> 8);

              sVar16 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar17 >> 8),uVar17)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar17 = (ushort)(((ushort)(byte)local_20 + (ushort)((byte)local_20 != 0)) * uVar14)

                       >> 8;

              uVar18 = (ushort)((uVar18 + (uVar18 != 0)) * sVar16) >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * uVar6) >> 8;

              uVar15 = CONCAT24(uVar19,CONCAT22(uVar18,uVar17));

              if (iVar7 != 0x100) {

                sVar20 = (short)iVar7;

                uVar15 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar20) >> 8) -

                                          ((ushort)(uVar19 * sVar20) >> 8)),

                                  CONCAT22(sVar16 - (((ushort)(sVar16 * sVar20) >> 8) -

                                                    ((ushort)(uVar18 * sVar20) >> 8)),

                                           uVar14 - (((ushort)(uVar14 * sVar20) >> 8) -

                                                    ((ushort)(uVar17 * sVar20) >> 8))));

              }

              sVar16 = (short)uVar15;

              sVar20 = (short)((uint6)uVar15 >> 0x10);

              sVar5 = (short)((uint6)uVar15 >> 0x20);

              pbVar8[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar15 - (0xff < sVar16);

              pbVar8[-4] = (0 < sVar20) * (sVar20 < 0x100) * (char)((uint6)uVar15 >> 0x10) -

                           (0xff < sVar20);

              *pbVar9 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar15 >> 0x20) -

                        (0xff < sVar5);

            }

            pbVar8 = pbVar9;

          } while (iVar12 != 0);

        }

        iVar11 = iVar11 + iVar3;

        iVar10 = iVar10 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_006641c0 at 0x006641C0 (size: 336) ---


void FUN_006641c0(int param_1)



{

  ushort *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  ulonglong uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  byte *pbVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar17;

  uint5 uVar16;

  short sVar18;

  ushort uVar19;

  ushort uVar21;

  ushort uVar22;

  ulonglong uVar20;

  short sVar23;

  ushort local_20;

  int local_18;

  

  iVar10 = *(int *)(param_1 + 8);

  iVar11 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar13 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pbVar12 = (byte *)(iVar2 * 3 + 2 + iVar10);

          iVar9 = iVar2;

          do {

            puVar1 = (ushort *)(pbVar12 + -5);

            uVar19 = *puVar1;

            pbVar12 = pbVar12 + -3;

            local_20 = (ushort)(byte)*puVar1;

            iVar8 = 0x100;

            iVar9 = iVar9 + -1;

            if ((iVar13 == 0x100) || (iVar8 = iVar13 * 0x100 >> 8, iVar8 != 0)) {

              uVar5 = *(undefined4 *)(iVar11 + iVar9 * 4);

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar16 = (uint5)uVar6 & 0xffffffff00;

              uVar20 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar5 & 0xff;

              uVar21 = uVar19 >> 8;

              uVar7 = uVar20 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar20 >> 0x10);

              sVar17 = (short)(uVar16 >> 8);

              sVar18 = (short)(uVar16 >> 0x18);

              uVar19 = (ushort)((local_20 + ((char)uVar19 != '\0')) * uVar14) >> 8;

              uVar21 = (ushort)((uVar21 + (uVar21 != 0)) * sVar15) >> 8;

              uVar22 = (ushort)(((ushort)*pbVar12 + (ushort)(*pbVar12 != 0)) * sVar17) >> 8;

              uVar20 = (ulonglong)CONCAT24(uVar22,CONCAT22(uVar21,uVar19)) | uVar7 << 0x10;

              if (iVar8 != 0x100) {

                sVar23 = (short)iVar8;

                uVar20 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar23) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar23) >> 8)),

                                  CONCAT24(sVar17 - (((ushort)(sVar17 * sVar23) >> 8) -

                                                    ((ushort)(uVar22 * sVar23) >> 8)),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar23) >> 8) -

                                                             ((ushort)(uVar21 * sVar23) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar23) >> 8) -

                                                             ((ushort)(uVar19 * sVar23) >> 8)))));

              }

              sVar15 = (short)uVar20;

              sVar17 = (short)(uVar20 >> 0x10);

              sVar18 = (short)(uVar20 >> 0x20);

              sVar23 = (short)(uVar20 >> 0x30);

              *(uint *)(iVar11 + iVar9 * 4) =

                   CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)(uVar20 >> 0x30) -

                            (0xff < sVar23),

                            CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar20 >> 0x20) -

                                     (0xff < sVar18),

                                     CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                              (char)(uVar20 >> 0x10) - (0xff < sVar17),

                                              (0 < sVar15) * (sVar15 < 0x100) * (char)uVar20 -

                                              (0xff < sVar15))));

            }

          } while (iVar9 != 0);

        }

        iVar10 = iVar10 + iVar3;

        iVar11 = iVar11 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00664320 at 0x00664320 (size: 414) ---


void FUN_00664320(int param_1)



{

  byte *pbVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  int iVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  ushort uVar13;

  short sVar15;

  undefined6 uVar14;

  ushort uVar16;

  ushort uVar17;

  ushort uVar18;

  short sVar19;

  int local_24;

  int local_20;

  int local_18;

  

  local_24 = *(int *)(param_1 + 0x14);

  iVar11 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar10 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          iVar12 = iVar2 * 3 + iVar11;

          pbVar8 = (byte *)(iVar2 * 3 + 2 + local_24);

          local_20 = iVar2;

          do {

            pbVar1 = (byte *)(iVar12 + -3);

            pbVar9 = pbVar8 + -3;

            iVar12 = iVar12 + -3;

            iVar7 = 0x100;

            if ((iVar10 == 0x100) || (iVar7 = iVar10 * 0x100 >> 8, iVar7 != 0)) {

              uVar16 = *(ushort *)(pbVar8 + -5);

              uVar6 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar13 = uVar16 & 0xff;

              sVar15 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar16 >> 8),uVar16)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar16 = (ushort)(((ushort)*pbVar1 + (ushort)(*pbVar1 != 0)) * uVar13) >> 8;

              uVar17 = (ushort)(((ushort)pbVar8[(iVar11 - local_24) + -4] +

                                (ushort)(pbVar8[(iVar11 - local_24) + -4] != 0)) * sVar15) >> 8;

              uVar18 = (ushort)(((ushort)pbVar9[iVar11 - local_24] +

                                (ushort)(pbVar9[iVar11 - local_24] != 0)) * uVar6) >> 8;

              uVar14 = CONCAT24(uVar18,CONCAT22(uVar17,uVar16));

              if (iVar7 != 0x100) {

                sVar19 = (short)iVar7;

                uVar14 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar19) >> 8) -

                                          ((ushort)(uVar18 * sVar19) >> 8)),

                                  CONCAT22(sVar15 - (((ushort)(sVar15 * sVar19) >> 8) -

                                                    ((ushort)(uVar17 * sVar19) >> 8)),

                                           uVar13 - (((ushort)(uVar13 * sVar19) >> 8) -

                                                    ((ushort)(uVar16 * sVar19) >> 8))));

              }

              sVar15 = (short)uVar14;

              sVar19 = (short)((uint6)uVar14 >> 0x10);

              sVar5 = (short)((uint6)uVar14 >> 0x20);

              pbVar8[-5] = (0 < sVar15) * (sVar15 < 0x100) * (char)uVar14 - (0xff < sVar15);

              pbVar8[-4] = (0 < sVar19) * (sVar19 < 0x100) * (char)((uint6)uVar14 >> 0x10) -

                           (0xff < sVar19);

              *pbVar9 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar14 >> 0x20) -

                        (0xff < sVar5);

            }

            local_20 = local_20 + -1;

            pbVar8 = pbVar9;

          } while (local_20 != 0);

        }

        local_24 = local_24 + iVar4;

        iVar11 = iVar11 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_006644c0 at 0x006644C0 (size: 348) ---


void FUN_006644c0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  undefined4 uVar5;

  uint uVar6;

  ushort uVar7;

  ulonglong uVar8;

  ushort uVar9;

  uint uVar10;

  undefined4 *puVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar17;

  uint5 uVar16;

  short sVar18;

  byte bVar19;

  ulonglong uVar20;

  short sVar21;

  ulonglong uVar22;

  int local_28;

  int local_24;

  int local_1c;

  

  local_28 = *(int *)(param_1 + 8);

  iVar12 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar13 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar11 = (undefined4 *)(iVar12 + iVar1 * 4);

          local_24 = iVar1;

          do {

            uVar4 = *(uint *)((local_28 - iVar12) + -4 + (int)puVar11);

            puVar11 = puVar11 + -1;

            uVar10 = uVar4 >> 0x18;

            if (iVar13 != 0x100) {

              uVar10 = (int)(uVar10 * iVar13) >> 8;

            }

            if (uVar10 != 0) {

              uVar5 = *puVar11;

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar16 = (uint5)uVar6 & 0xffffffff00;

              uVar20 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar5 & 0xff;

              uVar9 = (ushort)(byte)(uVar4 >> 0x10);

              uVar7 = (ushort)(byte)(uVar4 >> 8);

              bVar19 = (byte)uVar4;

              uVar8 = uVar20 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar20 >> 0x10);

              sVar17 = (short)(uVar16 >> 8);

              sVar18 = (short)(uVar16 >> 0x18);

              uVar22 = (ulonglong)

                       CONCAT24((sVar17 + uVar9) - ((ushort)((uVar9 + (uVar9 != 0)) * sVar17) >> 8),

                                CONCAT22((sVar15 + uVar7) -

                                         ((ushort)((uVar7 + (uVar7 != 0)) * sVar15) >> 8),

                                         (uVar14 + bVar19) -

                                         ((ushort)(((ushort)bVar19 + (ushort)(bVar19 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar20 = uVar22 | uVar8 << 0x10;

              if (uVar10 + 1 != 0x100) {

                sVar21 = (short)(uVar10 + 1);

                uVar20 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar21) >> 8) -

                                           ((ushort)((short)(uVar8 >> 0x20) * sVar21) >> 8)),

                                  CONCAT24(sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                                    ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8

                                                    )),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar21) >> 8) -

                                                             ((ushort)((short)(uVar22 >> 0x10) *

                                                                      sVar21) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar21) >> 8) -

                                                             ((ushort)((short)uVar22 * sVar21) >> 8)

                                                             ))));

              }

              sVar15 = (short)uVar20;

              sVar17 = (short)(uVar20 >> 0x10);

              sVar18 = (short)(uVar20 >> 0x20);

              sVar21 = (short)(uVar20 >> 0x30);

              *puVar11 = CONCAT13((0 < sVar21) * (sVar21 < 0x100) * (char)(uVar20 >> 0x30) -

                                  (0xff < sVar21),

                                  CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar20 >> 0x20)

                                           - (0xff < sVar18),

                                           CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                    (char)(uVar20 >> 0x10) - (0xff < sVar17),

                                                    (0 < sVar15) * (sVar15 < 0x100) * (char)uVar20 -

                                                    (0xff < sVar15))));

            }

            local_24 = local_24 + -1;

          } while (local_24 != 0);

        }

        local_28 = local_28 + iVar2;

        iVar12 = iVar12 + iVar3;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_00664620 at 0x00664620 (size: 394) ---


void FUN_00664620(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  short sVar5;

  ushort uVar6;

  ushort uVar7;

  ushort uVar8;

  ushort uVar9;

  uint uVar10;

  byte *pbVar11;

  byte *pbVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  ushort uVar16;

  short sVar17;

  byte bVar18;

  short sVar19;

  ulonglong uVar20;

  int local_24;

  int local_1c;

  

  local_24 = *(int *)(param_1 + 8);

  iVar13 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_1c = *(int *)(param_1 + 0x20);

    iVar14 = *(byte *)(param_1 + 0x24) + 1;

    if (local_1c != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar11 = (byte *)(iVar1 * 3 + 2 + iVar13);

          iVar15 = iVar1;

          do {

            uVar4 = *(uint *)(local_24 + -4 + iVar15 * 4);

            iVar15 = iVar15 + -1;

            pbVar12 = pbVar11 + -3;

            uVar10 = uVar4 >> 0x18;

            if (iVar14 != 0x100) {

              uVar10 = (int)(uVar10 * iVar14) >> 8;

            }

            if (uVar10 != 0) {

              uVar9 = *(ushort *)(pbVar11 + -5);

              uVar8 = (ushort)(((uint5)*pbVar12 << 0x20) >> 0x18);

              uVar16 = uVar9 & 0xff;

              uVar7 = (ushort)(byte)(uVar4 >> 0x10);

              uVar6 = (ushort)(byte)(uVar4 >> 8);

              bVar18 = (byte)uVar4;

              sVar17 = (short)(CONCAT23(uVar8,CONCAT12((char)(uVar9 >> 8),uVar9)) >> 0x10);

              uVar8 = uVar8 >> 8;

              uVar20 = (ulonglong)

                       CONCAT24((uVar8 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * uVar8) >> 8),

                                CONCAT22((sVar17 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar17) >> 8),

                                         (uVar16 + bVar18) -

                                         ((ushort)(((ushort)bVar18 + (ushort)(bVar18 != 0)) * uVar16

                                                  ) >> 8))) & 0xff00ff00ff;

              if (uVar10 + 1 != 0x100) {

                sVar19 = (short)(uVar10 + 1);

                uVar20 = (ulonglong)

                         CONCAT24(uVar8 - (((ushort)(uVar8 * sVar19) >> 8) -

                                          ((ushort)((short)(uVar20 >> 0x20) * sVar19) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar20 >> 0x10) * sVar19) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar19) >> 8) -

                                                    ((ushort)((short)uVar20 * sVar19) >> 8))));

              }

              sVar17 = (short)uVar20;

              sVar19 = (short)(uVar20 >> 0x10);

              sVar5 = (short)(uVar20 >> 0x20);

              pbVar11[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar20 - (0xff < sVar17);

              pbVar11[-4] = (0 < sVar19) * (sVar19 < 0x100) * (char)(uVar20 >> 0x10) -

                            (0xff < sVar19);

              *pbVar12 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar20 >> 0x20) - (0xff < sVar5);

            }

            pbVar11 = pbVar12;

          } while (iVar15 != 0);

        }

        local_24 = local_24 + iVar2;

        iVar13 = iVar13 + iVar3;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_006647b0 at 0x006647B0 (size: 354) ---


void FUN_006647b0(int param_1)



{

  uint *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  ushort uVar7;

  ulonglong uVar8;

  ushort uVar9;

  int iVar10;

  undefined4 *puVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar17;

  uint5 uVar16;

  short sVar18;

  byte bVar19;

  ulonglong uVar20;

  short sVar21;

  ulonglong uVar22;

  int local_24;

  uint local_20;

  int local_1c;

  int local_18;

  

  local_24 = *(int *)(param_1 + 8);

  iVar12 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar13 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          puVar11 = (undefined4 *)(iVar12 + iVar2 * 4);

          local_1c = iVar2;

          do {

            puVar1 = (uint *)((local_24 - iVar12) + -4 + (int)puVar11);

            puVar11 = puVar11 + -1;

            local_20 = *puVar1 & 0xffffff;

            iVar10 = 0xff;

            if ((iVar13 == 0x100) || (iVar10 = iVar13 * 0xff >> 8, iVar10 != 0)) {

              uVar5 = *puVar11;

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar16 = (uint5)uVar6 & 0xffffffff00;

              uVar20 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar5 & 0xff;

              uVar9 = (ushort)(byte)(local_20 >> 0x10);

              uVar7 = (ushort)(byte)(local_20 >> 8);

              bVar19 = (byte)local_20;

              uVar8 = uVar20 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar20 >> 0x10);

              sVar17 = (short)(uVar16 >> 8);

              sVar18 = (short)(uVar16 >> 0x18);

              uVar22 = (ulonglong)

                       CONCAT24((sVar17 + uVar9) - ((ushort)((uVar9 + (uVar9 != 0)) * sVar17) >> 8),

                                CONCAT22((sVar15 + uVar7) -

                                         ((ushort)((uVar7 + (uVar7 != 0)) * sVar15) >> 8),

                                         (uVar14 + bVar19) -

                                         ((ushort)(((ushort)bVar19 + (ushort)(bVar19 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar20 = uVar22 | uVar8 << 0x10;

              if (iVar10 + 1 != 0x100) {

                sVar21 = (short)(iVar10 + 1);

                uVar20 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar21) >> 8) -

                                           ((ushort)((short)(uVar8 >> 0x20) * sVar21) >> 8)),

                                  CONCAT24(sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                                    ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8

                                                    )),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar21) >> 8) -

                                                             ((ushort)((short)(uVar22 >> 0x10) *

                                                                      sVar21) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar21) >> 8) -

                                                             ((ushort)((short)uVar22 * sVar21) >> 8)

                                                             ))));

              }

              sVar15 = (short)uVar20;

              sVar17 = (short)(uVar20 >> 0x10);

              sVar18 = (short)(uVar20 >> 0x20);

              sVar21 = (short)(uVar20 >> 0x30);

              *puVar11 = CONCAT13((0 < sVar21) * (sVar21 < 0x100) * (char)(uVar20 >> 0x30) -

                                  (0xff < sVar21),

                                  CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar20 >> 0x20)

                                           - (0xff < sVar18),

                                           CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                    (char)(uVar20 >> 0x10) - (0xff < sVar17),

                                                    (0 < sVar15) * (sVar15 < 0x100) * (char)uVar20 -

                                                    (0xff < sVar15))));

            }

            local_1c = local_1c + -1;

          } while (local_1c != 0);

        }

        local_24 = local_24 + iVar3;

        iVar12 = iVar12 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00664920 at 0x00664920 (size: 394) ---


void FUN_00664920(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  short sVar4;

  ushort uVar5;

  ushort uVar6;

  ushort uVar7;

  ushort uVar8;

  int iVar9;

  byte *pbVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  ushort uVar16;

  short sVar17;

  byte bVar18;

  short sVar19;

  ulonglong uVar20;

  uint local_20;

  int local_18;

  

  iVar12 = *(int *)(param_1 + 0x14);

  iVar13 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar15 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar10 = (byte *)(iVar1 * 3 + 2 + iVar12);

          iVar14 = iVar1;

          do {

            iVar9 = iVar14 * 4;

            iVar14 = iVar14 + -1;

            pbVar11 = pbVar10 + -3;

            local_20 = *(uint *)(iVar13 + -4 + iVar9) & 0xffffff;

            iVar9 = 0xff;

            if ((iVar15 == 0x100) || (iVar9 = iVar15 * 0xff >> 8, iVar9 != 0)) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar7 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar16 = uVar8 & 0xff;

              uVar6 = (ushort)(byte)(local_20 >> 0x10);

              uVar5 = (ushort)(byte)(local_20 >> 8);

              bVar18 = (byte)local_20;

              sVar17 = (short)(CONCAT23(uVar7,CONCAT12((char)(uVar8 >> 8),uVar8)) >> 0x10);

              uVar7 = uVar7 >> 8;

              uVar20 = (ulonglong)

                       CONCAT24((uVar7 + uVar6) - ((ushort)((uVar6 + (uVar6 != 0)) * uVar7) >> 8),

                                CONCAT22((sVar17 + uVar5) -

                                         ((ushort)((uVar5 + (uVar5 != 0)) * sVar17) >> 8),

                                         (uVar16 + bVar18) -

                                         ((ushort)(((ushort)bVar18 + (ushort)(bVar18 != 0)) * uVar16

                                                  ) >> 8))) & 0xff00ff00ff;

              if (iVar9 + 1 != 0x100) {

                sVar19 = (short)(iVar9 + 1);

                uVar20 = (ulonglong)

                         CONCAT24(uVar7 - (((ushort)(uVar7 * sVar19) >> 8) -

                                          ((ushort)((short)(uVar20 >> 0x20) * sVar19) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar20 >> 0x10) * sVar19) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar19) >> 8) -

                                                    ((ushort)((short)uVar20 * sVar19) >> 8))));

              }

              sVar17 = (short)uVar20;

              sVar19 = (short)(uVar20 >> 0x10);

              sVar4 = (short)(uVar20 >> 0x20);

              pbVar10[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar20 - (0xff < sVar17);

              pbVar10[-4] = (0 < sVar19) * (sVar19 < 0x100) * (char)(uVar20 >> 0x10) -

                            (0xff < sVar19);

              *pbVar11 = (0 < sVar4) * (sVar4 < 0x100) * (char)(uVar20 >> 0x20) - (0xff < sVar4);

            }

            pbVar10 = pbVar11;

          } while (iVar14 != 0);

        }

        iVar13 = iVar13 + iVar2;

        iVar12 = iVar12 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00664ab0 at 0x00664AB0 (size: 363) ---


void FUN_00664ab0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  ulonglong uVar6;

  ushort uVar7;

  ushort uVar8;

  ushort uVar9;

  int iVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  ushort uVar16;

  short sVar17;

  short sVar19;

  uint5 uVar18;

  short sVar20;

  ulonglong uVar21;

  short sVar22;

  ulonglong uVar23;

  int local_18;

  

  iVar12 = *(int *)(param_1 + 8);

  iVar13 = *(int *)(param_1 + 0x14);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar15 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar11 = (byte *)(iVar1 * 3 + 2 + iVar12);

          iVar14 = iVar1;

          do {

            uVar8 = *(ushort *)(pbVar11 + -5);

            pbVar11 = pbVar11 + -3;

            iVar14 = iVar14 + -1;

            iVar10 = 0xff;

            if ((iVar15 == 0x100) || (iVar10 = iVar15 * 0xff >> 8, iVar10 != 0)) {

              uVar4 = *(undefined4 *)(iVar13 + iVar14 * 4);

              uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar18 = (uint5)uVar5 & 0xffffffff00;

              uVar21 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                       0xffffffff00ffffff;

              uVar16 = (ushort)uVar4 & 0xff;

              uVar7 = (ushort)*pbVar11;

              uVar9 = uVar8 >> 8;

              uVar6 = uVar21 >> 0x10 & 0xffffff00ff00;

              sVar17 = (short)(uVar21 >> 0x10);

              sVar19 = (short)(uVar18 >> 8);

              sVar20 = (short)(uVar18 >> 0x18);

              uVar23 = (ulonglong)

                       CONCAT24((sVar19 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * sVar19) >> 8),

                                CONCAT22((sVar17 + uVar9) -

                                         ((ushort)((uVar9 + (uVar9 != 0)) * sVar17) >> 8),

                                         (uVar16 + (uVar8 & 0xff)) -

                                         ((ushort)(((uVar8 & 0xff) + (ushort)((char)uVar8 != '\0'))

                                                  * uVar16) >> 8))) & 0xff00ff00ff;

              uVar21 = uVar23 | uVar6 << 0x10;

              if (iVar10 + 1 != 0x100) {

                sVar22 = (short)(iVar10 + 1);

                uVar21 = CONCAT26(sVar20 - (((ushort)(sVar20 * sVar22) >> 8) -

                                           ((ushort)((short)(uVar6 >> 0x20) * sVar22) >> 8)),

                                  CONCAT24(sVar19 - (((ushort)(sVar19 * sVar22) >> 8) -

                                                    ((ushort)((short)(uVar23 >> 0x20) * sVar22) >> 8

                                                    )),

                                           CONCAT22(sVar17 - (((ushort)(sVar17 * sVar22) >> 8) -

                                                             ((ushort)((short)(uVar23 >> 0x10) *

                                                                      sVar22) >> 8)),

                                                    uVar16 - (((ushort)(uVar16 * sVar22) >> 8) -

                                                             ((ushort)((short)uVar23 * sVar22) >> 8)

                                                             ))));

              }

              sVar17 = (short)uVar21;

              sVar19 = (short)(uVar21 >> 0x10);

              sVar20 = (short)(uVar21 >> 0x20);

              sVar22 = (short)(uVar21 >> 0x30);

              *(uint *)(iVar13 + iVar14 * 4) =

                   CONCAT13((0 < sVar22) * (sVar22 < 0x100) * (char)(uVar21 >> 0x30) -

                            (0xff < sVar22),

                            CONCAT12((0 < sVar20) * (sVar20 < 0x100) * (char)(uVar21 >> 0x20) -

                                     (0xff < sVar20),

                                     CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                              (char)(uVar21 >> 0x10) - (0xff < sVar19),

                                              (0 < sVar17) * (sVar17 < 0x100) * (char)uVar21 -

                                              (0xff < sVar17))));

            }

          } while (iVar14 != 0);

        }

        iVar12 = iVar12 + iVar2;

        iVar13 = iVar13 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00664c30 at 0x00664C30 (size: 437) ---


void FUN_00664c30(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  ushort uVar7;

  ushort uVar8;

  ushort uVar9;

  int iVar10;

  byte *pbVar11;

  byte *pbVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  ushort uVar16;

  short sVar17;

  short sVar18;

  ulonglong uVar19;

  int local_24;

  int local_20;

  int local_18;

  

  local_24 = *(int *)(param_1 + 0x14);

  iVar14 = *(int *)(param_1 + 8);

  if (*(byte *)(param_1 + 0x24) != 0) {

    local_18 = *(int *)(param_1 + 0x20);

    iVar13 = *(byte *)(param_1 + 0x24) + 1;

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          iVar15 = iVar2 * 3 + iVar14;

          pbVar11 = (byte *)(iVar2 * 3 + 2 + local_24);

          local_20 = iVar2;

          do {

            bVar1 = *(byte *)(iVar15 + -3);

            iVar15 = iVar15 + -3;

            pbVar12 = pbVar11 + -3;

            iVar10 = 0xff;

            if ((iVar13 == 0x100) || (iVar10 = iVar13 * 0xff >> 8, iVar10 != 0)) {

              uVar9 = *(ushort *)(pbVar11 + -5);

              uVar8 = (ushort)(((uint5)*pbVar12 << 0x20) >> 0x18);

              uVar16 = uVar9 & 0xff;

              uVar7 = (ushort)pbVar12[iVar14 - local_24];

              uVar6 = (ushort)pbVar11[(iVar14 - local_24) + -4];

              sVar17 = (short)(CONCAT23(uVar8,CONCAT12((char)(uVar9 >> 8),uVar9)) >> 0x10);

              uVar8 = uVar8 >> 8;

              uVar19 = (ulonglong)

                       CONCAT24((uVar8 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * uVar8) >> 8),

                                CONCAT22((sVar17 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar17) >> 8),

                                         (uVar16 + bVar1) -

                                         ((ushort)(((ushort)bVar1 + (ushort)(bVar1 != 0)) * uVar16)

                                         >> 8))) & 0xff00ff00ff;

              if (iVar10 + 1 != 0x100) {

                sVar18 = (short)(iVar10 + 1);

                uVar19 = (ulonglong)

                         CONCAT24(uVar8 - (((ushort)(uVar8 * sVar18) >> 8) -

                                          ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                                    ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar18) >> 8) -

                                                    ((ushort)((short)uVar19 * sVar18) >> 8))));

              }

              sVar17 = (short)uVar19;

              sVar18 = (short)(uVar19 >> 0x10);

              sVar5 = (short)(uVar19 >> 0x20);

              pbVar11[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar19 - (0xff < sVar17);

              pbVar11[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar19 >> 0x10) -

                            (0xff < sVar18);

              *pbVar12 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar19 >> 0x20) - (0xff < sVar5);

            }

            local_20 = local_20 + -1;

            pbVar11 = pbVar12;

          } while (local_20 != 0);

        }

        local_24 = local_24 + iVar4;

        iVar14 = iVar14 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00664e70 at 0x00664E70 (size: 173) ---


void FUN_00664e70(int param_1)



{

  int iVar1;

  int iVar2;

  undefined1 uVar3;

  undefined1 *puVar4;

  undefined1 uVar5;

  undefined1 uVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  

  uVar5 = (undefined1)DAT_008f86b0;

  uVar6 = (undefined1)((uint)DAT_008f86b0 >> 8);

  uVar3 = DAT_008f86b0._2_1_;

  if (*(int *)(param_1 + 8) == 0) {

    iVar8 = *(int *)(param_1 + 0x20);

    iVar7 = *(int *)(param_1 + 0x14);

    if (iVar8 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar4 = (undefined1 *)(iVar1 * 3 + 2 + iVar7);

          iVar9 = iVar1;

          do {

            iVar9 = iVar9 + -1;

            puVar4[-5] = uVar5;

            puVar4[-4] = uVar6;

            puVar4[-3] = uVar3;

            puVar4 = puVar4 + -3;

          } while (iVar9 != 0);

        }

        iVar7 = iVar7 - iVar2;

        iVar8 = iVar8 + -1;

      } while (iVar8 != 0);

    }

  }

  else {

    iVar8 = *(int *)(param_1 + 0x20);

    iVar7 = *(int *)(param_1 + 0x14);

    if (iVar8 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          puVar4 = (undefined1 *)(iVar1 * 3 + 2 + iVar7);

          iVar9 = iVar1;

          do {

            iVar9 = iVar9 + -1;

            puVar4[-5] = uVar5;

            puVar4[-4] = uVar6;

            puVar4[-3] = uVar3;

            puVar4 = puVar4 + -3;

          } while (iVar9 != 0);

        }

        iVar7 = iVar7 + iVar2;

        iVar8 = iVar8 + -1;

      } while (iVar8 != 0);

    }

  }

  return;

}





// --- FUN_00664f20 at 0x00664F20 (size: 246) ---


void FUN_00664f20(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  uint *puVar7;

  uint uVar8;

  int iVar9;

  uint uVar10;

  int iVar11;

  int local_c;

  

  uVar5 = DAT_008f86b0;

  local_c = *(int *)(param_1 + 0x20);

  iVar9 = *(int *)(param_1 + 0x14);

  iVar11 = *(int *)(param_1 + 8);

  if (local_c != 0) {

    iVar2 = *(int *)(param_1 + 0xc);

    iVar3 = *(int *)(param_1 + 0x18);

    uVar8 = *(uint *)(param_1 + 0x1c) >> 2;

    uVar6 = *(uint *)(param_1 + 0x1c) & 3;

    do {

      if (uVar8 != 0) {

        puVar7 = (uint *)(uVar8 * 0x10 + iVar9);

        uVar10 = uVar8;

        do {

          uVar4 = *(uint *)(iVar11 + -4 + uVar10 * 4);

          uVar10 = uVar10 - 1;

          puVar7[-1] = uVar4 & 0xff000000 | uVar5;

          puVar7[-2] = (uVar4 & 0xff0000) << 8 | uVar5;

          puVar7[-3] = (uVar4 & 0xff00) << 0x10 | uVar5;

          puVar7[-4] = uVar4 << 0x18 | uVar5;

          puVar7 = puVar7 + -4;

        } while (uVar10 != 0);

      }

      if (uVar6 != 0) {

        uVar10 = uVar6;

        while (uVar10 != 0) {

          iVar1 = uVar10 - 1;

          uVar10 = uVar10 - 1;

          *(uint *)(uVar8 * 0x10 + iVar9 + uVar10 * 4) =

               (uint)*(byte *)(iVar1 + iVar11 + uVar8 * 4) << 0x18 | uVar5;

        }

      }

      iVar11 = iVar11 + iVar2;

      iVar9 = iVar9 + iVar3;

      local_c = local_c + -1;

    } while (local_c != 0);

  }

  return;

}





// --- FUN_00665020 at 0x00665020 (size: 331) ---


void FUN_00665020(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  undefined1 *puVar3;

  uint uVar4;

  undefined1 uVar5;

  undefined1 uVar7;

  uint uVar8;

  uint uVar9;

  int local_14;

  int local_c;

  undefined1 uVar6;

  

  uVar2 = DAT_008f86b0;

  local_c = *(int *)(param_1 + 0x20);

  local_14 = *(int *)(param_1 + 0x14);

  if (local_c != 0) {

    iVar1 = *(int *)(param_1 + 0x18);

    uVar8 = *(uint *)(param_1 + 0x1c) >> 2;

    uVar4 = *(uint *)(param_1 + 0x1c) & 3;

    do {

      uVar5 = (undefined1)uVar2;

      uVar7 = (undefined1)((uint)uVar2 >> 8);

      uVar6 = (undefined1)((uint)uVar2 >> 0x10);

      if (uVar8 != 0) {

        puVar3 = (undefined1 *)(local_14 + 0xb + uVar8 * 0xc);

        uVar9 = uVar8;

        do {

          uVar9 = uVar9 - 1;

          puVar3[-0xe] = uVar5;

          puVar3[-0xd] = uVar7;

          puVar3[-0xc] = uVar6;

          puVar3[-0x11] = uVar5;

          puVar3[-0x10] = uVar7;

          puVar3[-0xf] = uVar6;

          puVar3[-0x14] = uVar5;

          puVar3[-0x13] = uVar7;

          puVar3[-0x17] = uVar5;

          puVar3[-0x16] = uVar7;

          puVar3[-0x12] = uVar6;

          puVar3[-0x15] = uVar6;

          puVar3 = puVar3 + -0xc;

        } while (uVar9 != 0);

      }

      if (uVar4 != 0) {

        puVar3 = (undefined1 *)(uVar4 * 3 + 2 + local_14 + uVar8 * 0xc);

        uVar9 = uVar4;

        do {

          uVar9 = uVar9 - 1;

          puVar3[-5] = uVar5;

          puVar3[-4] = uVar7;

          puVar3[-3] = uVar6;

          puVar3 = puVar3 + -3;

        } while (uVar9 != 0);

      }

      local_14 = local_14 + iVar1;

      local_c = local_c + -1;

    } while (local_c != 0);

  }

  return;

}





// --- FUN_00665320 at 0x00665320 (size: 540) ---


void FUN_00665320(int param_1)



{

  byte bVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar13;

  short sVar15;

  short sVar17;

  uint5 uVar16;

  short sVar18;

  short sVar19;

  undefined2 uVar20;

  undefined1 uVar23;

  ulonglong uVar21;

  undefined4 local_18;

  undefined4 local_10;

  ulonglong uVar14;

  undefined1 uVar22;

  

  uVar4 = DAT_008f86b0;

  iVar11 = *(int *)(param_1 + 0x14);

  uVar22 = (undefined1)(DAT_008f86b0 >> 8);

  uVar23 = (undefined1)(DAT_008f86b0 >> 0x10);

  uVar20 = (undefined2)DAT_008f86b0;

  if (*(int *)(param_1 + 8) == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    local_10 = *(int *)(param_1 + 0x20);

    local_18 = CONCAT13(bVar1,(int3)DAT_008f86b0);

    if (local_10 != 0) {

      iVar10 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar10 != 0) {

          iVar8 = iVar10;

          do {

            iVar8 = iVar8 + -1;

            if (bVar1 != 0) {

              uVar4 = *(uint *)(iVar11 + iVar8 * 4);

              sVar13 = bVar1 + 1;

              if (sVar13 == 0x100) {

                *(uint *)(iVar11 + iVar8 * 4) = (uVar4 ^ local_18) & 0xffffff ^ uVar4;

              }

              else {

                uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar4 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar4 >> 0x10),uVar4)) >>

                                              0x20),uVar4) >> 0x18);

                uVar16 = (uint5)uVar6 & 0xffffffff00;

                uVar14 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)(uVar4 >> 8),(ushort)uVar4)) &

                         0xffffffff00ffffff;

                uVar12 = (ushort)uVar4 & 0xff;

                uVar21 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(uVar23,local_18) >> 0x18),

                                           CONCAT12(uVar22,uVar20)) >> 0x10,uVar20) & 0xff00ff00ff;

                sVar17 = (short)(uVar14 >> 0x10);

                sVar18 = (short)(uVar16 >> 8);

                sVar19 = (short)(uVar16 >> 0x18);

                sVar15 = uVar12 - (((ushort)(uVar12 * sVar13) >> 8) -

                                  ((ushort)((short)uVar21 * sVar13) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar13) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x10) * sVar13) >> 8));

                sVar18 = sVar18 - (((ushort)(sVar18 * sVar13) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x20) * sVar13) >> 8));

                sVar19 = sVar19 - (((ushort)(sVar19 * sVar13) >> 8) -

                                  ((ushort)((short)(uVar14 >> 0x30) * sVar13) >> 8));

                *(uint *)(iVar11 + iVar8 * 4) =

                     CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 - (0xff < sVar19),

                              CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 -

                                       (0xff < sVar18),

                                       CONCAT11((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                                (0xff < sVar17),

                                                (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                (0xff < sVar15))));

              }

            }

          } while (iVar8 != 0);

        }

        iVar11 = iVar11 - iVar2;

        local_10 = local_10 + -1;

      } while (local_10 != 0);

    }

  }

  else {

    iVar10 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar8 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          uVar6 = DAT_008f86b0 >> 0x18;

          iVar9 = iVar2;

          do {

            iVar9 = iVar9 + -1;

            uVar7 = uVar6;

            if (iVar10 != 0x100) {

              uVar7 = (int)(uVar6 * iVar10) >> 8;

            }

            if (uVar7 != 0) {

              uVar3 = *(uint *)(iVar11 + iVar9 * 4);

              if (uVar7 + 1 == 0x100) {

                *(uint *)(iVar11 + iVar9 * 4) = (uVar4 ^ uVar3) & 0xffffff ^ uVar3;

              }

              else {

                uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar3 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar3 >> 0x10),uVar3)) >>

                                              0x20),uVar3) >> 0x18);

                uVar16 = (uint5)uVar5 & 0xffffffff00;

                uVar14 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)(uVar3 >> 8),(ushort)uVar3)) &

                         0xffffffff00ffffff;

                uVar12 = (ushort)uVar3 & 0xff;

                uVar21 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(uVar23,uVar4) >> 0x18),

                                           CONCAT12(uVar22,uVar20)) >> 0x10,uVar20) & 0xff00ff00ff;

                sVar19 = (short)(uVar7 + 1);

                sVar15 = (short)(uVar14 >> 0x10);

                sVar17 = (short)(uVar16 >> 8);

                sVar18 = (short)(uVar16 >> 0x18);

                sVar13 = uVar12 - (((ushort)(uVar12 * sVar19) >> 8) -

                                  ((ushort)((short)uVar21 * sVar19) >> 8));

                sVar15 = sVar15 - (((ushort)(sVar15 * sVar19) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x10) * sVar19) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar19) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x20) * sVar19) >> 8));

                sVar18 = sVar18 - (((ushort)(sVar18 * sVar19) >> 8) -

                                  ((ushort)((short)(uVar14 >> 0x30) * sVar19) >> 8));

                *(uint *)(iVar11 + iVar9 * 4) =

                     CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 - (0xff < sVar18),

                              CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                       (0xff < sVar17),

                                       CONCAT11((0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                (0xff < sVar15),

                                                (0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                                (0xff < sVar13))));

              }

            }

          } while (iVar9 != 0);

        }

        iVar11 = iVar11 + iVar8;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00665550 at 0x00665550 (size: 712) ---


void FUN_00665550(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  ushort uVar5;

  ushort uVar6;

  uint uVar7;

  uint uVar8;

  char *pcVar9;

  char *pcVar10;

  int iVar11;

  short sVar12;

  short sVar13;

  short sVar14;

  undefined2 uVar15;

  undefined1 uVar18;

  ulonglong uVar16;

  uint local_24;

  undefined4 local_20;

  int local_18;

  int local_14;

  int local_10;

  undefined1 uVar17;

  

  uVar7 = DAT_008f86b0;

  uVar17 = (undefined1)(DAT_008f86b0 >> 8);

  uVar18 = (undefined1)(DAT_008f86b0 >> 0x10);

  uVar15 = (undefined2)DAT_008f86b0;

  if (*(int *)(param_1 + 8) == 0) {

    iVar11 = *(int *)(param_1 + 0x14);

    bVar1 = *(byte *)(param_1 + 0x24);

    local_20 = CONCAT13(bVar1,(int3)DAT_008f86b0);

    local_10 = *(int *)(param_1 + 0x20);

    if (local_10 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pcVar9 = (char *)(iVar2 * 3 + 2 + iVar11);

          local_14 = iVar2;

          do {

            pcVar10 = pcVar9 + -3;

            if (bVar1 != 0) {

              uVar6 = (ushort)*(uint3 *)(pcVar9 + -5);

              sVar12 = bVar1 + 1;

              local_24 = (uint)*(uint3 *)(pcVar9 + -5);

              if (sVar12 == 0x100) {

                local_24 = (local_24 ^ local_20) & 0xffffff ^ local_24;

                pcVar9[-5] = (char)local_24;

                pcVar9[-4] = (char)(local_24 >> 8);

                *pcVar10 = (char)(local_24 >> 0x10);

              }

              else {

                uVar5 = (ushort)(CONCAT14(*pcVar10,local_24) >> 0x18);

                uVar16 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(uVar18,local_20) >> 0x18),

                                           CONCAT12(uVar17,uVar15)) >> 0x10,uVar15) & 0xff00ff00ff;

                sVar14 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar13 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar12) >> 8) -

                         ((ushort)((short)uVar16 * sVar12) >> 8));

                sVar14 = sVar14 - (((ushort)(sVar14 * sVar12) >> 8) -

                                  ((ushort)((short)(uVar16 >> 0x10) * sVar12) >> 8));

                sVar12 = uVar5 - (((ushort)(uVar5 * sVar12) >> 8) -

                                 ((ushort)((short)(uVar16 >> 0x20) * sVar12) >> 8));

                pcVar9[-5] = (0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 - (0xff < sVar13);

                pcVar9[-4] = (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 - (0xff < sVar14);

                *pcVar10 = (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12 - (0xff < sVar12);

              }

            }

            local_14 = local_14 + -1;

            pcVar9 = pcVar10;

          } while (local_14 != 0);

        }

        iVar11 = iVar11 - iVar3;

        local_10 = local_10 + -1;

      } while (local_10 != 0);

    }

  }

  else {

    local_20 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    iVar11 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    if (local_14 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          uVar4 = DAT_008f86b0 >> 0x18;

          pcVar9 = (char *)(iVar2 * 3 + 2 + local_20);

          local_18 = iVar2;

          do {

            pcVar10 = pcVar9 + -3;

            uVar8 = uVar4;

            if (iVar11 != 0x100) {

              uVar8 = (int)(uVar4 * iVar11) >> 8;

            }

            if (uVar8 != 0) {

              uVar6 = (ushort)*(uint3 *)(pcVar9 + -5);

              local_24 = (uint)*(uint3 *)(pcVar9 + -5);

              if (uVar8 + 1 == 0x100) {

                local_24 = (uVar7 ^ local_24) & 0xffffff ^ local_24;

                pcVar9[-5] = (char)local_24;

                pcVar9[-4] = (char)(local_24 >> 8);

                *pcVar10 = (char)(local_24 >> 0x10);

              }

              else {

                uVar5 = (ushort)(CONCAT14(*pcVar10,local_24) >> 0x18);

                uVar16 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(uVar18,uVar7) >> 0x18),

                                           CONCAT12(uVar17,uVar15)) >> 0x10,uVar15) & 0xff00ff00ff;

                sVar14 = (short)(uVar8 + 1);

                sVar13 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar12 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar14) >> 8) -

                         ((ushort)((short)uVar16 * sVar14) >> 8));

                sVar13 = sVar13 - (((ushort)(sVar13 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar16 >> 0x10) * sVar14) >> 8));

                sVar14 = uVar5 - (((ushort)(uVar5 * sVar14) >> 8) -

                                 ((ushort)((short)(uVar16 >> 0x20) * sVar14) >> 8));

                pcVar9[-5] = (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12 - (0xff < sVar12);

                pcVar9[-4] = (0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 - (0xff < sVar13);

                *pcVar10 = (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 - (0xff < sVar14);

              }

            }

            local_18 = local_18 + -1;

            pcVar9 = pcVar10;

          } while (local_18 != 0);

        }

        local_20 = local_20 + iVar3;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_00665820 at 0x00665820 (size: 653) ---


void FUN_00665820(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  int iVar10;

  int iVar11;

  uint uVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar17;

  short sVar19;

  uint5 uVar18;

  short sVar20;

  short sVar21;

  ulonglong uVar22;

  int local_34;

  int local_30;

  int local_18;

  ulonglong uVar16;

  

  local_34 = *(int *)(param_1 + 8);

  local_30 = *(int *)(param_1 + 0x14);

  local_18 = *(int *)(param_1 + 0x20);

  iVar10 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

  if (local_18 != 0) {

    iVar1 = *(int *)(param_1 + 0xc);

    iVar2 = *(int *)(param_1 + 0x18);

    uVar12 = *(uint *)(param_1 + 0x1c) >> 2;

    uVar7 = *(uint *)(param_1 + 0x1c) & 3;

    do {

      if (uVar12 != 0) {

        iVar13 = uVar12 * 0x10 + local_30;

        uVar5 = uVar12;

        do {

          uVar9 = *(uint *)(local_34 + -4 + uVar5 * 4);

          uVar5 = uVar5 - 1;

          iVar13 = iVar13 + -0x10;

          iVar11 = 3;

          do {

            uVar8 = uVar9 & 0xff000000 | DAT_008f86b0;

            uVar6 = uVar8 >> 0x18;

            if (iVar10 != 0x100) {

              uVar6 = (int)(uVar6 * iVar10) >> 8;

            }

            if (uVar6 != 0) {

              uVar3 = *(uint *)(iVar13 + iVar11 * 4);

              if (uVar6 + 1 == 0x100) {

                *(uint *)(iVar13 + iVar11 * 4) = (uVar3 ^ uVar8) & 0xffffff ^ uVar3;

              }

              else {

                uVar4 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar3 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar3 >> 0x10),uVar3)) >>

                                              0x20),uVar3) >> 0x18);

                uVar18 = (uint5)uVar4 & 0xffffffff00;

                uVar16 = (ulonglong)CONCAT43(uVar4,CONCAT12((char)(uVar3 >> 8),(ushort)uVar3)) &

                         0xffffffff00ffffff;

                uVar14 = (ushort)uVar3 & 0xff;

                uVar22 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar8) >>

                                                  0x18),

                                           CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0))

                                  >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                sVar21 = (short)(uVar6 + 1);

                sVar17 = (short)(uVar16 >> 0x10);

                sVar19 = (short)(uVar18 >> 8);

                sVar20 = (short)(uVar18 >> 0x18);

                sVar15 = uVar14 - (((ushort)(uVar14 * sVar21) >> 8) -

                                  ((ushort)((short)uVar22 * sVar21) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                  ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

                sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                  ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

                sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                  ((ushort)((short)(uVar16 >> 0x30) * sVar21) >> 8));

                *(uint *)(iVar13 + iVar11 * 4) =

                     CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 - (0xff < sVar20),

                              CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                       (0xff < sVar19),

                                       CONCAT11((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                                (0xff < sVar17),

                                                (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                (0xff < sVar15))));

              }

            }

            uVar9 = uVar9 << 8;

            iVar11 = iVar11 + -1;

          } while (-1 < iVar11);

        } while (uVar5 != 0);

      }

      if (uVar7 != 0) {

        iVar13 = uVar12 * 0x10 + local_30;

        uVar5 = uVar7;

        while (uVar5 != 0) {

          iVar11 = uVar5 - 1;

          uVar5 = uVar5 - 1;

          uVar6 = (uint)*(byte *)(iVar11 + local_34 + uVar12 * 4) << 0x18 | DAT_008f86b0;

          uVar9 = uVar6 >> 0x18;

          if (iVar10 != 0x100) {

            uVar9 = (int)(uVar9 * iVar10) >> 8;

          }

          if (uVar9 != 0) {

            uVar8 = *(uint *)(iVar13 + uVar5 * 4);

            if (uVar9 + 1 == 0x100) {

              *(uint *)(iVar13 + uVar5 * 4) = (uVar8 ^ uVar6) & 0xffffff ^ uVar8;

            }

            else {

              uVar3 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar8 >> 0x18) << 0x30)

                                                             >> 0x28),

                                                      CONCAT14((char)(uVar8 >> 0x10),uVar8)) >> 0x20

                                            ),uVar8) >> 0x18);

              uVar18 = (uint5)uVar3 & 0xffffffff00;

              uVar16 = (ulonglong)CONCAT43(uVar3,CONCAT12((char)(uVar8 >> 8),(ushort)uVar8)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar8 & 0xff;

              uVar22 = (ulonglong)

                       CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar6) >>

                                                0x18),

                                         CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0)) >>

                                0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

              sVar21 = (short)(uVar9 + 1);

              sVar17 = (short)(uVar16 >> 0x10);

              sVar19 = (short)(uVar18 >> 8);

              sVar20 = (short)(uVar18 >> 0x18);

              sVar15 = uVar14 - (((ushort)(uVar14 * sVar21) >> 8) -

                                ((ushort)((short)uVar22 * sVar21) >> 8));

              sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

              sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

              sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                ((ushort)((short)(uVar16 >> 0x30) * sVar21) >> 8));

              *(uint *)(iVar13 + uVar5 * 4) =

                   CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 - (0xff < sVar20),

                            CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                     (0xff < sVar19),

                                     CONCAT11((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                              (0xff < sVar17),

                                              (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                              (0xff < sVar15))));

            }

          }

        }

      }

      local_34 = local_34 + iVar1;

      local_30 = local_30 + iVar2;

      local_18 = local_18 + -1;

    } while (local_18 != 0);

  }

  return;

}





// --- FUN_00665ab0 at 0x00665AB0 (size: 790) ---


void FUN_00665ab0(int param_1)



{

  int iVar1;

  int iVar2;

  ushort uVar3;

  ushort uVar4;

  uint uVar5;

  uint uVar6;

  int iVar7;

  uint uVar8;

  char *pcVar9;

  char *pcVar10;

  int iVar11;

  uint uVar12;

  uint uVar13;

  uint uVar14;

  int iVar15;

  short sVar16;

  short sVar17;

  short sVar18;

  ulonglong uVar19;

  undefined4 local_3c;

  uint local_38;

  int local_34;

  int local_18;

  

  local_34 = *(int *)(param_1 + 8);

  iVar15 = *(int *)(param_1 + 0x14);

  iVar7 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

  local_18 = *(int *)(param_1 + 0x20);

  if (local_18 != 0) {

    iVar1 = *(int *)(param_1 + 0xc);

    iVar2 = *(int *)(param_1 + 0x18);

    uVar12 = *(uint *)(param_1 + 0x1c) >> 2;

    uVar8 = *(uint *)(param_1 + 0x1c) & 3;

    do {

      if (uVar12 != 0) {

        pcVar9 = (char *)(iVar15 + 0xb + uVar12 * 0xc);

        uVar5 = uVar12;

        do {

          uVar14 = *(uint *)(local_34 + -4 + uVar5 * 4);

          uVar5 = uVar5 - 1;

          pcVar9 = pcVar9 + -0xc;

          iVar11 = 4;

          pcVar10 = pcVar9;

          do {

            uVar13 = uVar14 & 0xff000000 | DAT_008f86b0;

            uVar6 = uVar13 >> 0x18;

            if (iVar7 != 0x100) {

              uVar6 = (int)(uVar6 * iVar7) >> 8;

            }

            if (uVar6 != 0) {

              uVar4 = *(ushort *)(pcVar10 + -2);

              local_3c = (uint)CONCAT12(*pcVar10,uVar4);

              if (uVar6 + 1 == 0x100) {

                local_3c = (local_3c ^ uVar13) & 0xffffff ^ local_3c;

                pcVar10[-2] = (char)local_3c;

                pcVar10[-1] = (char)(local_3c >> 8);

                *pcVar10 = (char)(local_3c >> 0x10);

              }

              else {

                uVar3 = (ushort)(CONCAT14(*pcVar10,local_3c) >> 0x18);

                uVar19 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar13) >>

                                                  0x18),

                                           CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0))

                                  >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                sVar18 = (short)(uVar6 + 1);

                sVar17 = (short)(CONCAT23(uVar3,CONCAT12((char)(uVar4 >> 8),uVar4)) >> 0x10);

                uVar3 = uVar3 >> 8;

                sVar16 = (uVar4 & 0xff) -

                         (((ushort)((uVar4 & 0xff) * sVar18) >> 8) -

                         ((ushort)((short)uVar19 * sVar18) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8));

                sVar18 = uVar3 - (((ushort)(uVar3 * sVar18) >> 8) -

                                 ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8));

                pcVar10[-2] = (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16);

                pcVar10[-1] = (0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17);

                *pcVar10 = (0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 - (0xff < sVar18);

              }

            }

            uVar14 = uVar14 << 8;

            pcVar10 = pcVar10 + -3;

            iVar11 = iVar11 + -1;

          } while (iVar11 != 0);

        } while (uVar5 != 0);

      }

      if (uVar8 != 0) {

        pcVar9 = (char *)(uVar8 * 3 + 2 + iVar15 + uVar12 * 0xc);

        uVar5 = uVar8;

        do {

          iVar11 = uVar5 - 1;

          uVar5 = uVar5 - 1;

          uVar6 = (uint)*(byte *)(iVar11 + local_34 + uVar12 * 4) << 0x18 | DAT_008f86b0;

          pcVar10 = pcVar9 + -3;

          uVar14 = uVar6 >> 0x18;

          if (iVar7 != 0x100) {

            uVar14 = (int)(uVar14 * iVar7) >> 8;

          }

          if (uVar14 != 0) {

            uVar4 = (ushort)*(uint3 *)(pcVar9 + -5);

            local_38 = (uint)*(uint3 *)(pcVar9 + -5);

            if (uVar14 + 1 == 0x100) {

              local_38 = (local_38 ^ uVar6) & 0xffffff ^ local_38;

              pcVar9[-5] = (char)local_38;

              pcVar9[-4] = (char)(local_38 >> 8);

              *pcVar10 = (char)(local_38 >> 0x10);

            }

            else {

              uVar3 = (ushort)(CONCAT14(*pcVar10,local_38) >> 0x18);

              uVar19 = (ulonglong)

                       CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar6) >>

                                                0x18),

                                         CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0)) >>

                                0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

              sVar18 = (short)(uVar14 + 1);

              sVar17 = (short)(CONCAT23(uVar3,CONCAT12((char)(uVar4 >> 8),uVar4)) >> 0x10);

              uVar3 = uVar3 >> 8;

              sVar16 = (uVar4 & 0xff) -

                       (((ushort)((uVar4 & 0xff) * sVar18) >> 8) -

                       ((ushort)((short)uVar19 * sVar18) >> 8));

              sVar17 = sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8));

              sVar18 = uVar3 - (((ushort)(uVar3 * sVar18) >> 8) -

                               ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8));

              pcVar9[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16);

              pcVar9[-4] = (0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17);

              *pcVar10 = (0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 - (0xff < sVar18);

            }

          }

          pcVar9 = pcVar10;

        } while (uVar5 != 0);

      }

      local_34 = local_34 + iVar1;

      iVar15 = iVar15 + iVar2;

      local_18 = local_18 + -1;

    } while (local_18 != 0);

  }

  return;

}





// --- FUN_00665dd0 at 0x00665DD0 (size: 616) ---


void FUN_00665dd0(int param_1)



{

  uint *puVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  uint uVar9;

  int iVar10;

  int iVar11;

  uint *puVar12;

  ushort uVar13;

  short sVar14;

  short sVar16;

  short sVar18;

  uint5 uVar17;

  short sVar19;

  short sVar20;

  ulonglong uVar21;

  undefined4 local_2c;

  int local_24;

  int local_18;

  ulonglong uVar15;

  

  uVar7 = DAT_008f86b0;

  local_2c = *(int *)(param_1 + 8);

  if (local_2c == 0) {

    bVar2 = *(byte *)(param_1 + 0x24);

    iVar10 = *(int *)(param_1 + 0x14);

    local_18 = *(int *)(param_1 + 0x20);

    local_2c = CONCAT13(bVar2,(int3)DAT_008f86b0);

    if (local_18 != 0) {

      iVar11 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar11 != 0) {

          iVar8 = iVar11;

          do {

            iVar8 = iVar8 + -1;

            if (bVar2 != 0) {

              uVar9 = *(uint *)(iVar10 + iVar8 * 4);

              sVar14 = bVar2 + 1;

              if (sVar14 == 0x100) {

                *(uint *)(iVar10 + iVar8 * 4) = (uVar9 ^ local_2c) & 0xffffff ^ uVar9;

              }

              else {

                uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar9 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar9 >> 0x10),uVar9)) >>

                                              0x20),uVar9) >> 0x18);

                uVar17 = (uint5)uVar5 & 0xffffffff00;

                uVar15 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)(uVar9 >> 8),(ushort)uVar9)) &

                         0xffffffff00ffffff;

                uVar13 = (ushort)uVar9 & 0xff;

                uVar21 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(uVar7 >> 0x10),local_2c) >> 0x18)

                                           ,CONCAT12((char)(uVar7 >> 8),(short)uVar7)) >> 0x10,

                                  (short)uVar7) & 0xff00ff00ff;

                sVar18 = (short)(uVar15 >> 0x10);

                sVar19 = (short)(uVar17 >> 8);

                sVar20 = (short)(uVar17 >> 0x18);

                sVar16 = uVar13 - (((ushort)(uVar13 * sVar14) >> 8) -

                                  ((ushort)((short)uVar21 * sVar14) >> 8));

                sVar18 = sVar18 - (((ushort)(sVar18 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x10) * sVar14) >> 8));

                sVar19 = sVar19 - (((ushort)(sVar19 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x20) * sVar14) >> 8));

                sVar20 = sVar20 - (((ushort)(sVar20 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x30) * sVar14) >> 8));

                *(uint *)(iVar10 + iVar8 * 4) =

                     CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 - (0xff < sVar20),

                              CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                       (0xff < sVar19),

                                       CONCAT11((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 -

                                                (0xff < sVar18),

                                                (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                                (0xff < sVar16))));

              }

            }

          } while (iVar8 != 0);

        }

        iVar10 = iVar10 - iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  else {

    iVar10 = *(int *)(param_1 + 0x14);

    iVar11 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar3 = *(int *)(param_1 + 0x1c);

      iVar8 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar3 != 0) {

          puVar12 = (uint *)(iVar10 + iVar3 * 4);

          local_24 = iVar3;

          do {

            puVar1 = (uint *)((local_2c - iVar10) + -4 + (int)puVar12);

            puVar12 = puVar12 + -1;

            uVar9 = *puVar1 & 0xff000000 | DAT_008f86b0;

            uVar7 = uVar9 >> 0x18;

            if (iVar11 != 0x100) {

              uVar7 = (int)(uVar7 * iVar11) >> 8;

            }

            if (uVar7 != 0) {

              uVar5 = *puVar12;

              if (uVar7 + 1 == 0x100) {

                *puVar12 = (uVar5 ^ uVar9) & 0xffffff ^ uVar5;

              }

              else {

                uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar5 >> 0x18) <<

                                                                0x30) >> 0x28),

                                                        CONCAT14((char)(uVar5 >> 0x10),uVar5)) >>

                                              0x20),uVar5) >> 0x18);

                uVar17 = (uint5)uVar6 & 0xffffffff00;

                uVar15 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)(uVar5 >> 8),(ushort)uVar5)) &

                         0xffffffff00ffffff;

                uVar13 = (ushort)uVar5 & 0xff;

                uVar21 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar9) >>

                                                  0x18),

                                           CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0))

                                  >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                sVar20 = (short)(uVar7 + 1);

                sVar16 = (short)(uVar15 >> 0x10);

                sVar18 = (short)(uVar17 >> 8);

                sVar19 = (short)(uVar17 >> 0x18);

                sVar14 = uVar13 - (((ushort)(uVar13 * sVar20) >> 8) -

                                  ((ushort)((short)uVar21 * sVar20) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar20) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x10) * sVar20) >> 8));

                sVar18 = sVar18 - (((ushort)(sVar18 * sVar20) >> 8) -

                                  ((ushort)((short)(uVar21 >> 0x20) * sVar20) >> 8));

                sVar19 = sVar19 - (((ushort)(sVar19 * sVar20) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x30) * sVar20) >> 8));

                *puVar12 = CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 - (0xff < sVar19)

                                    ,CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 -

                                              (0xff < sVar18),

                                              CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                                       (char)sVar16 - (0xff < sVar16),

                                                       (0 < sVar14) * (sVar14 < 0x100) *

                                                       (char)sVar14 - (0xff < sVar14))));

              }

            }

            local_24 = local_24 + -1;

          } while (local_24 != 0);

        }

        local_2c = local_2c + iVar8;

        iVar10 = iVar10 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00666050 at 0x00666050 (size: 734) ---


void FUN_00666050(int param_1)



{

  int iVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  ushort uVar6;

  ushort uVar7;

  uint uVar8;

  char *pcVar9;

  char *pcVar10;

  int iVar11;

  uint uVar12;

  int iVar13;

  int iVar14;

  short sVar15;

  short sVar16;

  short sVar17;

  ulonglong uVar18;

  uint local_28;

  undefined4 local_24;

  int local_18;

  int local_14;

  

  uVar8 = DAT_008f86b0;

  local_24 = *(int *)(param_1 + 8);

  if (local_24 == 0) {

    iVar13 = *(int *)(param_1 + 0x14);

    bVar2 = *(byte *)(param_1 + 0x24);

    local_24 = CONCAT13(bVar2,(int3)DAT_008f86b0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar11 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar11 != 0) {

          pcVar9 = (char *)(iVar11 * 3 + 2 + iVar13);

          local_18 = iVar11;

          do {

            pcVar10 = pcVar9 + -3;

            if (bVar2 != 0) {

              uVar7 = (ushort)*(uint3 *)(pcVar9 + -5);

              sVar15 = bVar2 + 1;

              local_28 = (uint)*(uint3 *)(pcVar9 + -5);

              if (sVar15 == 0x100) {

                local_28 = (local_28 ^ local_24) & 0xffffff ^ local_28;

                pcVar9[-5] = (char)local_28;

                pcVar9[-4] = (char)(local_28 >> 8);

                *pcVar10 = (char)(local_28 >> 0x10);

              }

              else {

                uVar6 = (ushort)(CONCAT14(*pcVar10,local_28) >> 0x18);

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(uVar8 >> 0x10),local_24) >> 0x18)

                                           ,CONCAT12((char)(uVar8 >> 8),(short)uVar8)) >> 0x10,

                                  (short)uVar8) & 0xff00ff00ff;

                sVar17 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar7 >> 8),uVar7)) >> 0x10);

                uVar6 = uVar6 >> 8;

                sVar16 = (uVar7 & 0xff) -

                         (((ushort)((uVar7 & 0xff) * sVar15) >> 8) -

                         ((ushort)((short)uVar18 * sVar15) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar15) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar15) >> 8));

                sVar15 = uVar6 - (((ushort)(uVar6 * sVar15) >> 8) -

                                 ((ushort)((short)(uVar18 >> 0x20) * sVar15) >> 8));

                pcVar9[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16);

                pcVar9[-4] = (0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17);

                *pcVar10 = (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 - (0xff < sVar15);

              }

            }

            local_18 = local_18 + -1;

            pcVar9 = pcVar10;

          } while (local_18 != 0);

        }

        iVar13 = iVar13 - iVar3;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar13 = *(int *)(param_1 + 0x14);

    iVar11 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar3 = *(int *)(param_1 + 0x1c);

      iVar4 = *(int *)(param_1 + 0xc);

      iVar5 = *(int *)(param_1 + 0x18);

      do {

        if (iVar3 != 0) {

          pcVar9 = (char *)(iVar3 * 3 + 2 + iVar13);

          iVar14 = iVar3;

          do {

            iVar1 = iVar14 * 4;

            iVar14 = iVar14 + -1;

            uVar12 = *(uint *)(local_24 + -4 + iVar1) & 0xff000000 | DAT_008f86b0;

            pcVar10 = pcVar9 + -3;

            uVar8 = uVar12 >> 0x18;

            if (iVar11 != 0x100) {

              uVar8 = (int)(uVar8 * iVar11) >> 8;

            }

            if (uVar8 != 0) {

              uVar7 = (ushort)*(uint3 *)(pcVar9 + -5);

              local_28 = (uint)*(uint3 *)(pcVar9 + -5);

              if (uVar8 + 1 == 0x100) {

                local_28 = (local_28 ^ uVar12) & 0xffffff ^ local_28;

                pcVar9[-5] = (char)local_28;

                pcVar9[-4] = (char)(local_28 >> 8);

                *pcVar10 = (char)(local_28 >> 0x10);

              }

              else {

                uVar6 = (ushort)(CONCAT14(*pcVar10,local_28) >> 0x18);

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar12) >>

                                                  0x18),

                                           CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0))

                                  >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                sVar17 = (short)(uVar8 + 1);

                sVar16 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar7 >> 8),uVar7)) >> 0x10);

                uVar6 = uVar6 >> 8;

                sVar15 = (uVar7 & 0xff) -

                         (((ushort)((uVar7 & 0xff) * sVar17) >> 8) -

                         ((ushort)((short)uVar18 * sVar17) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar17) >> 8));

                sVar17 = uVar6 - (((ushort)(uVar6 * sVar17) >> 8) -

                                 ((ushort)((short)(uVar18 >> 0x20) * sVar17) >> 8));

                pcVar9[-5] = (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 - (0xff < sVar15);

                pcVar9[-4] = (0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16);

                *pcVar10 = (0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17);

              }

            }

            pcVar9 = pcVar10;

          } while (iVar14 != 0);

        }

        local_24 = local_24 + iVar4;

        iVar13 = iVar13 + iVar5;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_00669ba0 at 0x00669BA0 (size: 538) ---


void FUN_00669ba0(int param_1)



{

  byte bVar1;

  int iVar2;

  undefined4 uVar3;

  uint uVar4;

  ulonglong uVar5;

  uint uVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar13;

  short sVar14;

  short sVar16;

  uint5 uVar15;

  short sVar17;

  ushort uVar18;

  ushort uVar20;

  ushort uVar21;

  ulonglong uVar19;

  undefined4 local_14;

  undefined4 local_c;

  

  uVar6 = DAT_008f86b0;

  if (*(int *)(param_1 + 8) == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    iVar11 = *(int *)(param_1 + 0x14);

    local_c = *(int *)(param_1 + 0x20);

    if (local_c != 0) {

      iVar10 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar10 != 0) {

          iVar9 = iVar10;

          do {

            iVar9 = iVar9 + -1;

            sVar13 = (ushort)bVar1 + (ushort)(bVar1 != 0);

            if (sVar13 != 0) {

              uVar3 = *(undefined4 *)(iVar11 + iVar9 * 4);

              uVar4 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar3 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar3 >> 0x10),uVar3))

                                            >> 0x20),uVar3) >> 0x18);

              uVar15 = (uint5)uVar4 & 0xffffffff00;

              uVar19 = (ulonglong)CONCAT43(uVar4,CONCAT12((char)((uint)uVar3 >> 8),(ushort)uVar3)) &

                       0xffffffff00ffffff;

              uVar12 = (ushort)uVar3 & 0xff;

              uVar21 = (ushort)(byte)(uVar6 >> 0x10);

              uVar20 = (ushort)(byte)(uVar6 >> 8);

              uVar5 = uVar19 >> 0x10 & 0xffffff00ff00;

              sVar14 = (short)(uVar19 >> 0x10);

              sVar16 = (short)(uVar15 >> 8);

              sVar17 = (short)(uVar15 >> 0x18);

              uVar18 = (ushort)(((ushort)(byte)uVar6 + (ushort)((byte)uVar6 != 0)) * uVar12) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * sVar14) >> 8;

              uVar21 = (ushort)((uVar21 + (uVar21 != 0)) * sVar16) >> 8;

              uVar19 = (ulonglong)CONCAT24(uVar21,CONCAT22(uVar20,uVar18)) | uVar5 << 0x10;

              if (sVar13 != 0x100) {

                uVar19 = CONCAT26(sVar17 - (((ushort)(sVar17 * sVar13) >> 8) -

                                           ((ushort)((short)(uVar5 >> 0x20) * sVar13) >> 8)),

                                  CONCAT24(sVar16 - (((ushort)(sVar16 * sVar13) >> 8) -

                                                    ((ushort)(uVar21 * sVar13) >> 8)),

                                           CONCAT22(sVar14 - (((ushort)(sVar14 * sVar13) >> 8) -

                                                             ((ushort)(uVar20 * sVar13) >> 8)),

                                                    uVar12 - (((ushort)(uVar12 * sVar13) >> 8) -

                                                             ((ushort)(uVar18 * sVar13) >> 8)))));

              }

              sVar13 = (short)uVar19;

              sVar14 = (short)(uVar19 >> 0x10);

              sVar16 = (short)(uVar19 >> 0x20);

              sVar17 = (short)(uVar19 >> 0x30);

              *(uint *)(iVar11 + iVar9 * 4) =

                   CONCAT13((0 < sVar17) * (sVar17 < 0x100) * (char)(uVar19 >> 0x30) -

                            (0xff < sVar17),

                            CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)(uVar19 >> 0x20) -

                                     (0xff < sVar16),

                                     CONCAT11((0 < sVar14) * (sVar14 < 0x100) *

                                              (char)(uVar19 >> 0x10) - (0xff < sVar14),

                                              (0 < sVar13) * (sVar13 < 0x100) * (char)uVar19 -

                                              (0xff < sVar13))));

            }

          } while (iVar9 != 0);

        }

        iVar11 = iVar11 - iVar2;

        local_c = local_c + -1;

      } while (local_c != 0);

    }

  }

  else {

    iVar11 = *(int *)(param_1 + 0x14);

    iVar10 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar9 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          uVar6 = DAT_008f86b0 >> 0x18;

          iVar8 = iVar2;

          do {

            iVar8 = iVar8 + -1;

            iVar7 = uVar6 + (uVar6 != 0);

            if (iVar10 != 0x100) {

              iVar7 = iVar7 * iVar10 >> 8;

            }

            if (iVar7 != 0) {

              uVar3 = *(undefined4 *)(iVar11 + iVar8 * 4);

              uVar4 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar3 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar3 >> 0x10),uVar3))

                                            >> 0x20),uVar3) >> 0x18);

              uVar15 = (uint5)uVar4 & 0xffffffff00;

              uVar19 = (ulonglong)CONCAT43(uVar4,CONCAT12((char)((uint)uVar3 >> 8),(ushort)uVar3)) &

                       0xffffffff00ffffff;

              uVar12 = (ushort)uVar3 & 0xff;

              uVar21 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar20 = (ushort)(byte)(DAT_008f86b0 >> 8);

              uVar5 = uVar19 >> 0x10 & 0xffffff00ff00;

              sVar13 = (short)(uVar19 >> 0x10);

              sVar14 = (short)(uVar15 >> 8);

              sVar16 = (short)(uVar15 >> 0x18);

              uVar18 = (ushort)(((ushort)(byte)DAT_008f86b0 + (ushort)((byte)DAT_008f86b0 != 0)) *

                               uVar12) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * sVar13) >> 8;

              uVar21 = (ushort)((uVar21 + (uVar21 != 0)) * sVar14) >> 8;

              uVar19 = (ulonglong)CONCAT24(uVar21,CONCAT22(uVar20,uVar18)) | uVar5 << 0x10;

              if (iVar7 != 0x100) {

                sVar17 = (short)iVar7;

                uVar19 = CONCAT26(sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                           ((ushort)((short)(uVar5 >> 0x20) * sVar17) >> 8)),

                                  CONCAT24(sVar14 - (((ushort)(sVar14 * sVar17) >> 8) -

                                                    ((ushort)(uVar21 * sVar17) >> 8)),

                                           CONCAT22(sVar13 - (((ushort)(sVar13 * sVar17) >> 8) -

                                                             ((ushort)(uVar20 * sVar17) >> 8)),

                                                    uVar12 - (((ushort)(uVar12 * sVar17) >> 8) -

                                                             ((ushort)(uVar18 * sVar17) >> 8)))));

              }

              sVar13 = (short)uVar19;

              sVar14 = (short)(uVar19 >> 0x10);

              sVar16 = (short)(uVar19 >> 0x20);

              sVar17 = (short)(uVar19 >> 0x30);

              *(uint *)(iVar11 + iVar8 * 4) =

                   CONCAT13((0 < sVar17) * (sVar17 < 0x100) * (char)(uVar19 >> 0x30) -

                            (0xff < sVar17),

                            CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)(uVar19 >> 0x20) -

                                     (0xff < sVar16),

                                     CONCAT11((0 < sVar14) * (sVar14 < 0x100) *

                                              (char)(uVar19 >> 0x10) - (0xff < sVar14),

                                              (0 < sVar13) * (sVar13 < 0x100) * (char)uVar19 -

                                              (0xff < sVar13))));

            }

          } while (iVar8 != 0);

        }

        iVar11 = iVar11 + iVar9;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_00669dd0 at 0x00669DD0 (size: 682) ---


void FUN_00669dd0(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  short sVar4;

  uint uVar5;

  ushort uVar6;

  int iVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar14;

  short sVar15;

  undefined6 uVar13;

  ushort uVar16;

  ushort uVar17;

  ushort uVar18;

  int local_1c;

  int local_10;

  int local_c;

  

  uVar5 = DAT_008f86b0;

  if (*(int *)(param_1 + 8) == 0) {

    iVar10 = *(int *)(param_1 + 0x14);

    bVar1 = *(byte *)(param_1 + 0x24);

    local_c = *(int *)(param_1 + 0x20);

    if (local_c != 0) {

      iVar11 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar11 != 0) {

          pbVar8 = (byte *)(iVar11 * 3 + 2 + iVar10);

          local_10 = iVar11;

          do {

            pbVar9 = pbVar8 + -3;

            sVar14 = (ushort)bVar1 + (ushort)(bVar1 != 0);

            if (sVar14 != 0) {

              uVar16 = *(ushort *)(pbVar8 + -5);

              uVar6 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar12 = uVar16 & 0xff;

              uVar18 = (ushort)(byte)(uVar5 >> 0x10);

              uVar17 = (ushort)(byte)(uVar5 >> 8);

              sVar15 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar16 >> 8),uVar16)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar16 = (ushort)(((ushort)(byte)uVar5 + (ushort)((byte)uVar5 != 0)) * uVar12) >> 8;

              uVar17 = (ushort)((uVar17 + (uVar17 != 0)) * sVar15) >> 8;

              uVar18 = (ushort)((uVar18 + (uVar18 != 0)) * uVar6) >> 8;

              uVar13 = CONCAT24(uVar18,CONCAT22(uVar17,uVar16));

              if (sVar14 != 0x100) {

                uVar13 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar14) >> 8) -

                                          ((ushort)(uVar18 * sVar14) >> 8)),

                                  CONCAT22(sVar15 - (((ushort)(sVar15 * sVar14) >> 8) -

                                                    ((ushort)(uVar17 * sVar14) >> 8)),

                                           uVar12 - (((ushort)(uVar12 * sVar14) >> 8) -

                                                    ((ushort)(uVar16 * sVar14) >> 8))));

              }

              sVar14 = (short)uVar13;

              sVar15 = (short)((uint6)uVar13 >> 0x10);

              sVar4 = (short)((uint6)uVar13 >> 0x20);

              pbVar8[-5] = (0 < sVar14) * (sVar14 < 0x100) * (char)uVar13 - (0xff < sVar14);

              pbVar8[-4] = (0 < sVar15) * (sVar15 < 0x100) * (char)((uint6)uVar13 >> 0x10) -

                           (0xff < sVar15);

              *pbVar9 = (0 < sVar4) * (sVar4 < 0x100) * (char)((uint6)uVar13 >> 0x20) -

                        (0xff < sVar4);

            }

            local_10 = local_10 + -1;

            pbVar8 = pbVar9;

          } while (local_10 != 0);

        }

        iVar10 = iVar10 - iVar2;

        local_c = local_c + -1;

      } while (local_c != 0);

    }

  }

  else {

    iVar10 = *(int *)(param_1 + 0x14);

    iVar11 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_10 = *(int *)(param_1 + 0x20);

    if (local_10 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          uVar5 = DAT_008f86b0 >> 0x18;

          pbVar8 = (byte *)(iVar2 * 3 + 2 + iVar10);

          local_1c = iVar2;

          do {

            pbVar9 = pbVar8 + -3;

            iVar7 = uVar5 + (uVar5 != 0);

            if (iVar11 != 0x100) {

              iVar7 = iVar7 * iVar11 >> 8;

            }

            if (iVar7 != 0) {

              uVar16 = *(ushort *)(pbVar8 + -5);

              uVar6 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar12 = uVar16 & 0xff;

              uVar18 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar17 = (ushort)(byte)(DAT_008f86b0 >> 8);

              sVar14 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar16 >> 8),uVar16)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar16 = (ushort)(((ushort)(byte)DAT_008f86b0 + (ushort)((byte)DAT_008f86b0 != 0)) *

                               uVar12) >> 8;

              uVar17 = (ushort)((uVar17 + (uVar17 != 0)) * sVar14) >> 8;

              uVar18 = (ushort)((uVar18 + (uVar18 != 0)) * uVar6) >> 8;

              uVar13 = CONCAT24(uVar18,CONCAT22(uVar17,uVar16));

              if (iVar7 != 0x100) {

                sVar15 = (short)iVar7;

                uVar13 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar15) >> 8) -

                                          ((ushort)(uVar18 * sVar15) >> 8)),

                                  CONCAT22(sVar14 - (((ushort)(sVar14 * sVar15) >> 8) -

                                                    ((ushort)(uVar17 * sVar15) >> 8)),

                                           uVar12 - (((ushort)(uVar12 * sVar15) >> 8) -

                                                    ((ushort)(uVar16 * sVar15) >> 8))));

              }

              sVar14 = (short)uVar13;

              sVar15 = (short)((uint6)uVar13 >> 0x10);

              sVar4 = (short)((uint6)uVar13 >> 0x20);

              pbVar8[-5] = (0 < sVar14) * (sVar14 < 0x100) * (char)uVar13 - (0xff < sVar14);

              pbVar8[-4] = (0 < sVar15) * (sVar15 < 0x100) * (char)((uint6)uVar13 >> 0x10) -

                           (0xff < sVar15);

              *pbVar9 = (0 < sVar4) * (sVar4 < 0x100) * (char)((uint6)uVar13 >> 0x20) -

                        (0xff < sVar4);

            }

            local_1c = local_1c + -1;

            pbVar8 = pbVar9;

          } while (local_1c != 0);

        }

        iVar10 = iVar10 + iVar3;

        local_10 = local_10 + -1;

      } while (local_10 != 0);

    }

  }

  return;

}





// --- FUN_0066a080 at 0x0066A080 (size: 591) ---


void FUN_0066a080(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  ulonglong uVar6;

  uint uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  ushort uVar13;

  short sVar14;

  short sVar15;

  short sVar17;

  uint5 uVar16;

  short sVar18;

  ushort uVar19;

  ushort uVar21;

  ushort uVar22;

  ulonglong uVar20;

  undefined4 local_20;

  undefined4 local_14;

  

  uVar7 = DAT_008f86b0;

  iVar10 = *(int *)(param_1 + 8);

  if (iVar10 == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    iVar10 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar12 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar12 != 0) {

          iVar9 = iVar12;

          do {

            iVar9 = iVar9 + -1;

            sVar14 = (ushort)bVar1 + (ushort)(bVar1 != 0);

            if (sVar14 != 0) {

              uVar4 = *(undefined4 *)(iVar10 + iVar9 * 4);

              uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar16 = (uint5)uVar5 & 0xffffffff00;

              uVar20 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                       0xffffffff00ffffff;

              uVar13 = (ushort)uVar4 & 0xff;

              uVar22 = (ushort)(byte)(uVar7 >> 0x10);

              uVar21 = (ushort)(byte)(uVar7 >> 8);

              uVar6 = uVar20 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar20 >> 0x10);

              sVar17 = (short)(uVar16 >> 8);

              sVar18 = (short)(uVar16 >> 0x18);

              uVar19 = (ushort)(((ushort)(byte)uVar7 + (ushort)((byte)uVar7 != 0)) * uVar13) >> 8;

              uVar21 = (ushort)((uVar21 + (uVar21 != 0)) * sVar15) >> 8;

              uVar22 = (ushort)((uVar22 + (uVar22 != 0)) * sVar17) >> 8;

              uVar20 = (ulonglong)CONCAT24(uVar22,CONCAT22(uVar21,uVar19)) | uVar6 << 0x10;

              if (sVar14 != 0x100) {

                uVar20 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar14) >> 8) -

                                           ((ushort)((short)(uVar6 >> 0x20) * sVar14) >> 8)),

                                  CONCAT24(sVar17 - (((ushort)(sVar17 * sVar14) >> 8) -

                                                    ((ushort)(uVar22 * sVar14) >> 8)),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar14) >> 8) -

                                                             ((ushort)(uVar21 * sVar14) >> 8)),

                                                    uVar13 - (((ushort)(uVar13 * sVar14) >> 8) -

                                                             ((ushort)(uVar19 * sVar14) >> 8)))));

              }

              sVar14 = (short)uVar20;

              sVar15 = (short)(uVar20 >> 0x10);

              sVar17 = (short)(uVar20 >> 0x20);

              sVar18 = (short)(uVar20 >> 0x30);

              *(uint *)(iVar10 + iVar9 * 4) =

                   CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar20 >> 0x30) -

                            (0xff < sVar18),

                            CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)(uVar20 >> 0x20) -

                                     (0xff < sVar17),

                                     CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                              (char)(uVar20 >> 0x10) - (0xff < sVar15),

                                              (0 < sVar14) * (sVar14 < 0x100) * (char)uVar20 -

                                              (0xff < sVar14))));

            }

          } while (iVar9 != 0);

        }

        iVar10 = iVar10 - iVar2;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    local_20 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    if (local_14 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar9 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      iVar11 = iVar2;

      do {

        while (iVar11 != 0) {

          iVar8 = iVar11 + -1;

          iVar11 = iVar11 + -1;

          uVar7 = ((uint)*(byte *)(iVar8 + iVar10) << 0x18 | DAT_008f86b0) >> 0x18;

          iVar8 = uVar7 + (uVar7 != 0);

          if (iVar12 != 0x100) {

            iVar8 = iVar8 * iVar12 >> 8;

          }

          if (iVar8 != 0) {

            uVar4 = *(undefined4 *)(local_20 + iVar11 * 4);

            uVar7 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                            0x30) >> 0x28),

                                                    CONCAT14((char)((uint)uVar4 >> 0x10),uVar4)) >>

                                          0x20),uVar4) >> 0x18);

            uVar16 = (uint5)uVar7 & 0xffffffff00;

            uVar20 = (ulonglong)CONCAT43(uVar7,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                     0xffffffff00ffffff;

            uVar13 = (ushort)uVar4 & 0xff;

            uVar22 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

            uVar21 = (ushort)(byte)(DAT_008f86b0 >> 8);

            uVar6 = uVar20 >> 0x10 & 0xffffff00ff00;

            sVar14 = (short)(uVar20 >> 0x10);

            sVar15 = (short)(uVar16 >> 8);

            sVar17 = (short)(uVar16 >> 0x18);

            uVar19 = (ushort)(((ushort)(byte)DAT_008f86b0 + (ushort)((byte)DAT_008f86b0 != 0)) *

                             uVar13) >> 8;

            uVar21 = (ushort)((uVar21 + (uVar21 != 0)) * sVar14) >> 8;

            uVar22 = (ushort)((uVar22 + (uVar22 != 0)) * sVar15) >> 8;

            uVar20 = (ulonglong)CONCAT24(uVar22,CONCAT22(uVar21,uVar19)) | uVar6 << 0x10;

            if (iVar8 != 0x100) {

              sVar18 = (short)iVar8;

              uVar20 = CONCAT26(sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                         ((ushort)((short)(uVar6 >> 0x20) * sVar18) >> 8)),

                                CONCAT24(sVar15 - (((ushort)(sVar15 * sVar18) >> 8) -

                                                  ((ushort)(uVar22 * sVar18) >> 8)),

                                         CONCAT22(sVar14 - (((ushort)(sVar14 * sVar18) >> 8) -

                                                           ((ushort)(uVar21 * sVar18) >> 8)),

                                                  uVar13 - (((ushort)(uVar13 * sVar18) >> 8) -

                                                           ((ushort)(uVar19 * sVar18) >> 8)))));

            }

            sVar14 = (short)uVar20;

            sVar15 = (short)(uVar20 >> 0x10);

            sVar17 = (short)(uVar20 >> 0x20);

            sVar18 = (short)(uVar20 >> 0x30);

            *(uint *)(local_20 + iVar11 * 4) =

                 CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar20 >> 0x30) - (0xff < sVar18)

                          ,CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)(uVar20 >> 0x20) -

                                    (0xff < sVar17),

                                    CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                             (char)(uVar20 >> 0x10) - (0xff < sVar15),

                                             (0 < sVar14) * (sVar14 < 0x100) * (char)uVar20 -

                                             (0xff < sVar14))));

          }

        }

        iVar10 = iVar10 + iVar9;

        local_20 = local_20 + iVar3;

        local_14 = local_14 + -1;

        iVar11 = iVar2;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_0066a2e0 at 0x0066A2E0 (size: 713) ---


void FUN_0066a2e0(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  uint uVar7;

  int iVar8;

  byte *pbVar9;

  int iVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar16;

  short sVar17;

  undefined6 uVar15;

  ushort uVar18;

  ushort uVar19;

  ushort uVar20;

  int local_24;

  int local_18;

  int local_14;

  

  uVar7 = DAT_008f86b0;

  local_24 = *(int *)(param_1 + 8);

  if (local_24 == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    iVar12 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar10 = *(int *)(param_1 + 0x18);

      iVar2 = *(int *)(param_1 + 0x1c);

      do {

        if (iVar2 != 0) {

          pbVar9 = (byte *)(iVar2 * 3 + 2 + iVar12);

          local_18 = iVar2;

          do {

            pbVar11 = pbVar9 + -3;

            sVar16 = (ushort)bVar1 + (ushort)(bVar1 != 0);

            if (sVar16 != 0) {

              uVar18 = *(ushort *)(pbVar9 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar14 = uVar18 & 0xff;

              uVar20 = (ushort)(byte)(uVar7 >> 0x10);

              uVar19 = (ushort)(byte)(uVar7 >> 8);

              sVar17 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar18 >> 8),uVar18)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar18 = (ushort)(((ushort)(byte)uVar7 + (ushort)((byte)uVar7 != 0)) * uVar14) >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * sVar17) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * uVar6) >> 8;

              uVar15 = CONCAT24(uVar20,CONCAT22(uVar19,uVar18));

              if (sVar16 != 0x100) {

                uVar15 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar16) >> 8) -

                                          ((ushort)(uVar20 * sVar16) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar16) >> 8) -

                                                    ((ushort)(uVar19 * sVar16) >> 8)),

                                           uVar14 - (((ushort)(uVar14 * sVar16) >> 8) -

                                                    ((ushort)(uVar18 * sVar16) >> 8))));

              }

              sVar16 = (short)uVar15;

              sVar17 = (short)((uint6)uVar15 >> 0x10);

              sVar5 = (short)((uint6)uVar15 >> 0x20);

              pbVar9[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar15 - (0xff < sVar16);

              pbVar9[-4] = (0 < sVar17) * (sVar17 < 0x100) * (char)((uint6)uVar15 >> 0x10) -

                           (0xff < sVar17);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar15 >> 0x20) -

                         (0xff < sVar5);

            }

            local_18 = local_18 + -1;

            pbVar9 = pbVar11;

          } while (local_18 != 0);

        }

        iVar12 = iVar12 - iVar10;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar12 = *(int *)(param_1 + 0x14);

    iVar10 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pbVar9 = (byte *)(iVar2 * 3 + 2 + iVar12);

          iVar13 = iVar2;

          do {

            iVar8 = iVar13 + -1;

            iVar13 = iVar13 + -1;

            uVar7 = ((uint)*(byte *)(iVar8 + local_24) << 0x18 | DAT_008f86b0) >> 0x18;

            pbVar11 = pbVar9 + -3;

            iVar8 = uVar7 + (uVar7 != 0);

            if (iVar10 != 0x100) {

              iVar8 = iVar8 * iVar10 >> 8;

            }

            if (iVar8 != 0) {

              uVar18 = *(ushort *)(pbVar9 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar14 = uVar18 & 0xff;

              uVar20 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar19 = (ushort)(byte)(DAT_008f86b0 >> 8);

              sVar16 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar18 >> 8),uVar18)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar18 = (ushort)(((ushort)(byte)DAT_008f86b0 + (ushort)((byte)DAT_008f86b0 != 0)) *

                               uVar14) >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * sVar16) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * uVar6) >> 8;

              uVar15 = CONCAT24(uVar20,CONCAT22(uVar19,uVar18));

              if (iVar8 != 0x100) {

                sVar17 = (short)iVar8;

                uVar15 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar17) >> 8) -

                                          ((ushort)(uVar20 * sVar17) >> 8)),

                                  CONCAT22(sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                                    ((ushort)(uVar19 * sVar17) >> 8)),

                                           uVar14 - (((ushort)(uVar14 * sVar17) >> 8) -

                                                    ((ushort)(uVar18 * sVar17) >> 8))));

              }

              sVar16 = (short)uVar15;

              sVar17 = (short)((uint6)uVar15 >> 0x10);

              sVar5 = (short)((uint6)uVar15 >> 0x20);

              pbVar9[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar15 - (0xff < sVar16);

              pbVar9[-4] = (0 < sVar17) * (sVar17 < 0x100) * (char)((uint6)uVar15 >> 0x10) -

                           (0xff < sVar17);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar15 >> 0x20) -

                         (0xff < sVar5);

            }

            pbVar9 = pbVar11;

          } while (iVar13 != 0);

        }

        local_24 = local_24 + iVar3;

        iVar12 = iVar12 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066a5c0 at 0x0066A5C0 (size: 606) ---


void FUN_0066a5c0(int param_1)



{

  uint *puVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  ulonglong uVar7;

  uint uVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  undefined4 *puVar13;

  ushort uVar14;

  short sVar15;

  short sVar16;

  short sVar18;

  uint5 uVar17;

  short sVar19;

  ushort uVar20;

  ushort uVar22;

  ushort uVar23;

  ulonglong uVar21;

  int local_28;

  int local_20;

  int local_18;

  

  uVar8 = DAT_008f86b0;

  local_28 = *(int *)(param_1 + 8);

  if (local_28 == 0) {

    bVar2 = *(byte *)(param_1 + 0x24);

    iVar10 = *(int *)(param_1 + 0x14);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar12 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar12 != 0) {

          iVar11 = iVar12;

          do {

            iVar11 = iVar11 + -1;

            sVar15 = (ushort)bVar2 + (ushort)(bVar2 != 0);

            if (sVar15 != 0) {

              uVar5 = *(undefined4 *)(iVar10 + iVar11 * 4);

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar17 = (uint5)uVar6 & 0xffffffff00;

              uVar21 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar5 & 0xff;

              uVar23 = (ushort)(byte)(uVar8 >> 0x10);

              uVar22 = (ushort)(byte)(uVar8 >> 8);

              uVar7 = uVar21 >> 0x10 & 0xffffff00ff00;

              sVar16 = (short)(uVar21 >> 0x10);

              sVar18 = (short)(uVar17 >> 8);

              sVar19 = (short)(uVar17 >> 0x18);

              uVar20 = (ushort)(((ushort)(byte)uVar8 + (ushort)((byte)uVar8 != 0)) * uVar14) >> 8;

              uVar22 = (ushort)((uVar22 + (uVar22 != 0)) * sVar16) >> 8;

              uVar23 = (ushort)((uVar23 + (uVar23 != 0)) * sVar18) >> 8;

              uVar21 = (ulonglong)CONCAT24(uVar23,CONCAT22(uVar22,uVar20)) | uVar7 << 0x10;

              if (sVar15 != 0x100) {

                uVar21 = CONCAT26(sVar19 - (((ushort)(sVar19 * sVar15) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar15) >> 8)),

                                  CONCAT24(sVar18 - (((ushort)(sVar18 * sVar15) >> 8) -

                                                    ((ushort)(uVar23 * sVar15) >> 8)),

                                           CONCAT22(sVar16 - (((ushort)(sVar16 * sVar15) >> 8) -

                                                             ((ushort)(uVar22 * sVar15) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar15) >> 8) -

                                                             ((ushort)(uVar20 * sVar15) >> 8)))));

              }

              sVar15 = (short)uVar21;

              sVar16 = (short)(uVar21 >> 0x10);

              sVar18 = (short)(uVar21 >> 0x20);

              sVar19 = (short)(uVar21 >> 0x30);

              *(uint *)(iVar10 + iVar11 * 4) =

                   CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)(uVar21 >> 0x30) -

                            (0xff < sVar19),

                            CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x20) -

                                     (0xff < sVar18),

                                     CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                              (char)(uVar21 >> 0x10) - (0xff < sVar16),

                                              (0 < sVar15) * (sVar15 < 0x100) * (char)uVar21 -

                                              (0xff < sVar15))));

            }

          } while (iVar11 != 0);

        }

        iVar10 = iVar10 - iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  else {

    local_18 = *(int *)(param_1 + 0x20);

    iVar10 = *(int *)(param_1 + 0x14);

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    if (local_18 != 0) {

      iVar3 = *(int *)(param_1 + 0x1c);

      iVar11 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar3 != 0) {

          puVar13 = (undefined4 *)(iVar10 + iVar3 * 4);

          local_20 = iVar3;

          do {

            puVar1 = (uint *)((local_28 - iVar10) + -4 + (int)puVar13);

            puVar13 = puVar13 + -1;

            uVar8 = (*puVar1 & 0xff000000 | DAT_008f86b0) >> 0x18;

            iVar9 = uVar8 + (uVar8 != 0);

            if (iVar12 != 0x100) {

              iVar9 = iVar9 * iVar12 >> 8;

            }

            if (iVar9 != 0) {

              uVar5 = *puVar13;

              uVar8 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar17 = (uint5)uVar8 & 0xffffffff00;

              uVar21 = (ulonglong)CONCAT43(uVar8,CONCAT12((char)((uint)uVar5 >> 8),(ushort)uVar5)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar5 & 0xff;

              uVar23 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar22 = (ushort)(byte)(DAT_008f86b0 >> 8);

              uVar7 = uVar21 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar21 >> 0x10);

              sVar16 = (short)(uVar17 >> 8);

              sVar18 = (short)(uVar17 >> 0x18);

              uVar20 = (ushort)(((ushort)(byte)DAT_008f86b0 + (ushort)((byte)DAT_008f86b0 != 0)) *

                               uVar14) >> 8;

              uVar22 = (ushort)((uVar22 + (uVar22 != 0)) * sVar15) >> 8;

              uVar23 = (ushort)((uVar23 + (uVar23 != 0)) * sVar16) >> 8;

              uVar21 = (ulonglong)CONCAT24(uVar23,CONCAT22(uVar22,uVar20)) | uVar7 << 0x10;

              if (iVar9 != 0x100) {

                sVar19 = (short)iVar9;

                uVar21 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar19) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar19) >> 8)),

                                  CONCAT24(sVar16 - (((ushort)(sVar16 * sVar19) >> 8) -

                                                    ((ushort)(uVar23 * sVar19) >> 8)),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar19) >> 8) -

                                                             ((ushort)(uVar22 * sVar19) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar19) >> 8) -

                                                             ((ushort)(uVar20 * sVar19) >> 8)))));

              }

              sVar15 = (short)uVar21;

              sVar16 = (short)(uVar21 >> 0x10);

              sVar18 = (short)(uVar21 >> 0x20);

              sVar19 = (short)(uVar21 >> 0x30);

              *puVar13 = CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)(uVar21 >> 0x30) -

                                  (0xff < sVar19),

                                  CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x20)

                                           - (0xff < sVar18),

                                           CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                                    (char)(uVar21 >> 0x10) - (0xff < sVar16),

                                                    (0 < sVar15) * (sVar15 < 0x100) * (char)uVar21 -

                                                    (0xff < sVar15))));

            }

            local_20 = local_20 + -1;

          } while (local_20 != 0);

        }

        local_28 = local_28 + iVar11;

        iVar10 = iVar10 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066a830 at 0x0066A830 (size: 722) ---


void FUN_0066a830(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  uint uVar7;

  int iVar8;

  byte *pbVar9;

  int iVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar16;

  short sVar17;

  undefined6 uVar15;

  ushort uVar18;

  ushort uVar19;

  ushort uVar20;

  int local_24;

  int local_18;

  int local_14;

  

  uVar7 = DAT_008f86b0;

  local_24 = *(int *)(param_1 + 8);

  if (local_24 == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    iVar12 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar10 = *(int *)(param_1 + 0x18);

      iVar2 = *(int *)(param_1 + 0x1c);

      do {

        if (iVar2 != 0) {

          pbVar9 = (byte *)(iVar2 * 3 + 2 + iVar12);

          local_18 = iVar2;

          do {

            pbVar11 = pbVar9 + -3;

            sVar16 = (ushort)bVar1 + (ushort)(bVar1 != 0);

            if (sVar16 != 0) {

              uVar18 = *(ushort *)(pbVar9 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar14 = uVar18 & 0xff;

              uVar20 = (ushort)(byte)(uVar7 >> 0x10);

              uVar19 = (ushort)(byte)(uVar7 >> 8);

              sVar17 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar18 >> 8),uVar18)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar18 = (ushort)(((ushort)(byte)uVar7 + (ushort)((byte)uVar7 != 0)) * uVar14) >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * sVar17) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * uVar6) >> 8;

              uVar15 = CONCAT24(uVar20,CONCAT22(uVar19,uVar18));

              if (sVar16 != 0x100) {

                uVar15 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar16) >> 8) -

                                          ((ushort)(uVar20 * sVar16) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar16) >> 8) -

                                                    ((ushort)(uVar19 * sVar16) >> 8)),

                                           uVar14 - (((ushort)(uVar14 * sVar16) >> 8) -

                                                    ((ushort)(uVar18 * sVar16) >> 8))));

              }

              sVar16 = (short)uVar15;

              sVar17 = (short)((uint6)uVar15 >> 0x10);

              sVar5 = (short)((uint6)uVar15 >> 0x20);

              pbVar9[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar15 - (0xff < sVar16);

              pbVar9[-4] = (0 < sVar17) * (sVar17 < 0x100) * (char)((uint6)uVar15 >> 0x10) -

                           (0xff < sVar17);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar15 >> 0x20) -

                         (0xff < sVar5);

            }

            local_18 = local_18 + -1;

            pbVar9 = pbVar11;

          } while (local_18 != 0);

        }

        iVar12 = iVar12 - iVar10;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar12 = *(int *)(param_1 + 0x14);

    iVar10 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pbVar9 = (byte *)(iVar2 * 3 + 2 + iVar12);

          iVar13 = iVar2;

          do {

            iVar8 = iVar13 * 4;

            iVar13 = iVar13 + -1;

            uVar7 = (*(uint *)(local_24 + -4 + iVar8) & 0xff000000 | DAT_008f86b0) >> 0x18;

            pbVar11 = pbVar9 + -3;

            iVar8 = uVar7 + (uVar7 != 0);

            if (iVar10 != 0x100) {

              iVar8 = iVar8 * iVar10 >> 8;

            }

            if (iVar8 != 0) {

              uVar18 = *(ushort *)(pbVar9 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar14 = uVar18 & 0xff;

              uVar20 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar19 = (ushort)(byte)(DAT_008f86b0 >> 8);

              sVar16 = (short)(CONCAT23(uVar6,CONCAT12((char)(uVar18 >> 8),uVar18)) >> 0x10);

              uVar6 = uVar6 >> 8;

              uVar18 = (ushort)(((ushort)(byte)DAT_008f86b0 + (ushort)((byte)DAT_008f86b0 != 0)) *

                               uVar14) >> 8;

              uVar19 = (ushort)((uVar19 + (uVar19 != 0)) * sVar16) >> 8;

              uVar20 = (ushort)((uVar20 + (uVar20 != 0)) * uVar6) >> 8;

              uVar15 = CONCAT24(uVar20,CONCAT22(uVar19,uVar18));

              if (iVar8 != 0x100) {

                sVar17 = (short)iVar8;

                uVar15 = CONCAT24(uVar6 - (((ushort)(uVar6 * sVar17) >> 8) -

                                          ((ushort)(uVar20 * sVar17) >> 8)),

                                  CONCAT22(sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                                    ((ushort)(uVar19 * sVar17) >> 8)),

                                           uVar14 - (((ushort)(uVar14 * sVar17) >> 8) -

                                                    ((ushort)(uVar18 * sVar17) >> 8))));

              }

              sVar16 = (short)uVar15;

              sVar17 = (short)((uint6)uVar15 >> 0x10);

              sVar5 = (short)((uint6)uVar15 >> 0x20);

              pbVar9[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar15 - (0xff < sVar16);

              pbVar9[-4] = (0 < sVar17) * (sVar17 < 0x100) * (char)((uint6)uVar15 >> 0x10) -

                           (0xff < sVar17);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)((uint6)uVar15 >> 0x20) -

                         (0xff < sVar5);

            }

            pbVar9 = pbVar11;

          } while (iVar13 != 0);

        }

        local_24 = local_24 + iVar3;

        iVar12 = iVar12 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066ab10 at 0x0066AB10 (size: 567) ---


void FUN_0066ab10(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  ushort uVar4;

  ulonglong uVar5;

  ushort uVar6;

  uint uVar7;

  uint uVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  ushort uVar13;

  short sVar14;

  short sVar15;

  short sVar17;

  uint5 uVar16;

  short sVar18;

  byte bVar19;

  byte bVar20;

  ulonglong uVar21;

  ulonglong uVar22;

  undefined4 local_14;

  undefined4 local_c;

  

  uVar7 = DAT_008f86b0;

  if (*(int *)(param_1 + 8) == 0) {

    iVar12 = *(int *)(param_1 + 0x14);

    bVar19 = *(byte *)(param_1 + 0x24);

    local_c = *(int *)(param_1 + 0x20);

    if (local_c != 0) {

      iVar11 = *(int *)(param_1 + 0x1c);

      iVar1 = *(int *)(param_1 + 0x18);

      do {

        if (iVar11 != 0) {

          iVar10 = iVar11;

          do {

            iVar10 = iVar10 + -1;

            if (bVar19 != 0) {

              uVar2 = *(undefined4 *)(iVar12 + iVar10 * 4);

              uVar8 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar2 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar2 >> 0x10),uVar2))

                                            >> 0x20),uVar2) >> 0x18);

              uVar16 = (uint5)uVar8 & 0xffffffff00;

              uVar21 = (ulonglong)CONCAT43(uVar8,CONCAT12((char)((uint)uVar2 >> 8),(ushort)uVar2)) &

                       0xffffffff00ffffff;

              uVar13 = (ushort)uVar2 & 0xff;

              uVar6 = (ushort)(byte)(uVar7 >> 0x10);

              uVar4 = (ushort)(byte)(uVar7 >> 8);

              bVar20 = (byte)uVar7;

              uVar5 = uVar21 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar21 >> 0x10);

              sVar17 = (short)(uVar16 >> 8);

              sVar18 = (short)(uVar16 >> 0x18);

              sVar14 = bVar19 + 1;

              uVar22 = (ulonglong)

                       CONCAT24((sVar17 + uVar6) - ((ushort)((uVar6 + (uVar6 != 0)) * sVar17) >> 8),

                                CONCAT22((sVar15 + uVar4) -

                                         ((ushort)((uVar4 + (uVar4 != 0)) * sVar15) >> 8),

                                         (uVar13 + bVar20) -

                                         ((ushort)(((ushort)bVar20 + (ushort)(bVar20 != 0)) * uVar13

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar21 = uVar22 | uVar5 << 0x10;

              if (sVar14 != 0x100) {

                uVar21 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar14) >> 8) -

                                           ((ushort)((short)(uVar5 >> 0x20) * sVar14) >> 8)),

                                  CONCAT24(sVar17 - (((ushort)(sVar17 * sVar14) >> 8) -

                                                    ((ushort)((short)(uVar22 >> 0x20) * sVar14) >> 8

                                                    )),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar14) >> 8) -

                                                             ((ushort)((short)(uVar22 >> 0x10) *

                                                                      sVar14) >> 8)),

                                                    uVar13 - (((ushort)(uVar13 * sVar14) >> 8) -

                                                             ((ushort)((short)uVar22 * sVar14) >> 8)

                                                             ))));

              }

              sVar14 = (short)uVar21;

              sVar15 = (short)(uVar21 >> 0x10);

              sVar17 = (short)(uVar21 >> 0x20);

              sVar18 = (short)(uVar21 >> 0x30);

              *(uint *)(iVar12 + iVar10 * 4) =

                   CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x30) -

                            (0xff < sVar18),

                            CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)(uVar21 >> 0x20) -

                                     (0xff < sVar17),

                                     CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                              (char)(uVar21 >> 0x10) - (0xff < sVar15),

                                              (0 < sVar14) * (sVar14 < 0x100) * (char)uVar21 -

                                              (0xff < sVar14))));

            }

          } while (iVar10 != 0);

        }

        iVar12 = iVar12 - iVar1;

        local_c = local_c + -1;

      } while (local_c != 0);

    }

  }

  else {

    iVar12 = *(int *)(param_1 + 0x14);

    iVar11 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar10 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          uVar7 = DAT_008f86b0 >> 0x18;

          iVar9 = iVar1;

          do {

            iVar9 = iVar9 + -1;

            uVar8 = uVar7;

            if (iVar11 != 0x100) {

              uVar8 = (int)(uVar7 * iVar11) >> 8;

            }

            if (uVar8 != 0) {

              uVar2 = *(undefined4 *)(iVar12 + iVar9 * 4);

              uVar3 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar2 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar2 >> 0x10),uVar2))

                                            >> 0x20),uVar2) >> 0x18);

              uVar16 = (uint5)uVar3 & 0xffffffff00;

              uVar21 = (ulonglong)CONCAT43(uVar3,CONCAT12((char)((uint)uVar2 >> 8),(ushort)uVar2)) &

                       0xffffffff00ffffff;

              uVar13 = (ushort)uVar2 & 0xff;

              uVar6 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar4 = (ushort)(byte)(DAT_008f86b0 >> 8);

              bVar19 = (byte)DAT_008f86b0;

              uVar5 = uVar21 >> 0x10 & 0xffffff00ff00;

              sVar14 = (short)(uVar21 >> 0x10);

              sVar15 = (short)(uVar16 >> 8);

              sVar17 = (short)(uVar16 >> 0x18);

              uVar22 = (ulonglong)

                       CONCAT24((sVar15 + uVar6) - ((ushort)((uVar6 + (uVar6 != 0)) * sVar15) >> 8),

                                CONCAT22((sVar14 + uVar4) -

                                         ((ushort)((uVar4 + (uVar4 != 0)) * sVar14) >> 8),

                                         (uVar13 + bVar19) -

                                         ((ushort)(((ushort)bVar19 + (ushort)(bVar19 != 0)) * uVar13

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar21 = uVar22 | uVar5 << 0x10;

              if (uVar8 + 1 != 0x100) {

                sVar18 = (short)(uVar8 + 1);

                uVar21 = CONCAT26(sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                           ((ushort)((short)(uVar5 >> 0x20) * sVar18) >> 8)),

                                  CONCAT24(sVar15 - (((ushort)(sVar15 * sVar18) >> 8) -

                                                    ((ushort)((short)(uVar22 >> 0x20) * sVar18) >> 8

                                                    )),

                                           CONCAT22(sVar14 - (((ushort)(sVar14 * sVar18) >> 8) -

                                                             ((ushort)((short)(uVar22 >> 0x10) *

                                                                      sVar18) >> 8)),

                                                    uVar13 - (((ushort)(uVar13 * sVar18) >> 8) -

                                                             ((ushort)((short)uVar22 * sVar18) >> 8)

                                                             ))));

              }

              sVar14 = (short)uVar21;

              sVar15 = (short)(uVar21 >> 0x10);

              sVar17 = (short)(uVar21 >> 0x20);

              sVar18 = (short)(uVar21 >> 0x30);

              *(uint *)(iVar12 + iVar9 * 4) =

                   CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x30) -

                            (0xff < sVar18),

                            CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)(uVar21 >> 0x20) -

                                     (0xff < sVar17),

                                     CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                              (char)(uVar21 >> 0x10) - (0xff < sVar15),

                                              (0 < sVar14) * (sVar14 < 0x100) * (char)uVar21 -

                                              (0xff < sVar14))));

            }

          } while (iVar9 != 0);

        }

        iVar12 = iVar12 + iVar10;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_0066ad50 at 0x0066AD50 (size: 688) ---


void FUN_0066ad50(int param_1)



{

  int iVar1;

  int iVar2;

  short sVar3;

  ushort uVar4;

  ushort uVar5;

  uint uVar6;

  ushort uVar7;

  ushort uVar8;

  uint uVar9;

  byte *pbVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar16;

  byte bVar17;

  byte bVar18;

  ulonglong uVar19;

  int local_1c;

  int local_10;

  int local_c;

  

  uVar6 = DAT_008f86b0;

  if (*(int *)(param_1 + 8) == 0) {

    iVar12 = *(int *)(param_1 + 0x14);

    bVar17 = *(byte *)(param_1 + 0x24);

    local_c = *(int *)(param_1 + 0x20);

    if (local_c != 0) {

      iVar13 = *(int *)(param_1 + 0x1c);

      iVar1 = *(int *)(param_1 + 0x18);

      do {

        if (iVar13 != 0) {

          pbVar10 = (byte *)(iVar13 * 3 + 2 + iVar12);

          local_10 = iVar13;

          do {

            pbVar11 = pbVar10 + -3;

            if (bVar17 != 0) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar7 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar14 = uVar8 & 0xff;

              uVar5 = (ushort)(byte)(uVar6 >> 0x10);

              uVar4 = (ushort)(byte)(uVar6 >> 8);

              bVar18 = (byte)uVar6;

              sVar16 = (short)(CONCAT23(uVar7,CONCAT12((char)(uVar8 >> 8),uVar8)) >> 0x10);

              uVar7 = uVar7 >> 8;

              sVar15 = bVar17 + 1;

              uVar19 = (ulonglong)

                       CONCAT24((uVar7 + uVar5) - ((ushort)((uVar5 + (uVar5 != 0)) * uVar7) >> 8),

                                CONCAT22((sVar16 + uVar4) -

                                         ((ushort)((uVar4 + (uVar4 != 0)) * sVar16) >> 8),

                                         (uVar14 + bVar18) -

                                         ((ushort)(((ushort)bVar18 + (ushort)(bVar18 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              if (sVar15 != 0x100) {

                uVar19 = (ulonglong)

                         CONCAT24(uVar7 - (((ushort)(uVar7 * sVar15) >> 8) -

                                          ((ushort)((short)(uVar19 >> 0x20) * sVar15) >> 8)),

                                  CONCAT22(sVar16 - (((ushort)(sVar16 * sVar15) >> 8) -

                                                    ((ushort)((short)(uVar19 >> 0x10) * sVar15) >> 8

                                                    )),

                                           uVar14 - (((ushort)(uVar14 * sVar15) >> 8) -

                                                    ((ushort)((short)uVar19 * sVar15) >> 8))));

              }

              sVar15 = (short)uVar19;

              sVar16 = (short)(uVar19 >> 0x10);

              sVar3 = (short)(uVar19 >> 0x20);

              pbVar10[-5] = (0 < sVar15) * (sVar15 < 0x100) * (char)uVar19 - (0xff < sVar15);

              pbVar10[-4] = (0 < sVar16) * (sVar16 < 0x100) * (char)(uVar19 >> 0x10) -

                            (0xff < sVar16);

              *pbVar11 = (0 < sVar3) * (sVar3 < 0x100) * (char)(uVar19 >> 0x20) - (0xff < sVar3);

            }

            local_10 = local_10 + -1;

            pbVar10 = pbVar11;

          } while (local_10 != 0);

        }

        iVar12 = iVar12 - iVar1;

        local_c = local_c + -1;

      } while (local_c != 0);

    }

  }

  else {

    iVar12 = *(int *)(param_1 + 0x14);

    iVar13 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_10 = *(int *)(param_1 + 0x20);

    if (local_10 != 0) {

      iVar1 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar1 != 0) {

          uVar6 = DAT_008f86b0 >> 0x18;

          pbVar10 = (byte *)(iVar1 * 3 + 2 + iVar12);

          local_1c = iVar1;

          do {

            pbVar11 = pbVar10 + -3;

            uVar9 = uVar6;

            if (iVar13 != 0x100) {

              uVar9 = (int)(uVar6 * iVar13) >> 8;

            }

            if (uVar9 != 0) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar7 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar14 = uVar8 & 0xff;

              uVar5 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar4 = (ushort)(byte)(DAT_008f86b0 >> 8);

              bVar17 = (byte)DAT_008f86b0;

              sVar15 = (short)(CONCAT23(uVar7,CONCAT12((char)(uVar8 >> 8),uVar8)) >> 0x10);

              uVar7 = uVar7 >> 8;

              uVar19 = (ulonglong)

                       CONCAT24((uVar7 + uVar5) - ((ushort)((uVar5 + (uVar5 != 0)) * uVar7) >> 8),

                                CONCAT22((sVar15 + uVar4) -

                                         ((ushort)((uVar4 + (uVar4 != 0)) * sVar15) >> 8),

                                         (uVar14 + bVar17) -

                                         ((ushort)(((ushort)bVar17 + (ushort)(bVar17 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              if (uVar9 + 1 != 0x100) {

                sVar16 = (short)(uVar9 + 1);

                uVar19 = (ulonglong)

                         CONCAT24(uVar7 - (((ushort)(uVar7 * sVar16) >> 8) -

                                          ((ushort)((short)(uVar19 >> 0x20) * sVar16) >> 8)),

                                  CONCAT22(sVar15 - (((ushort)(sVar15 * sVar16) >> 8) -

                                                    ((ushort)((short)(uVar19 >> 0x10) * sVar16) >> 8

                                                    )),

                                           uVar14 - (((ushort)(uVar14 * sVar16) >> 8) -

                                                    ((ushort)((short)uVar19 * sVar16) >> 8))));

              }

              sVar15 = (short)uVar19;

              sVar16 = (short)(uVar19 >> 0x10);

              sVar3 = (short)(uVar19 >> 0x20);

              pbVar10[-5] = (0 < sVar15) * (sVar15 < 0x100) * (char)uVar19 - (0xff < sVar15);

              pbVar10[-4] = (0 < sVar16) * (sVar16 < 0x100) * (char)(uVar19 >> 0x10) -

                            (0xff < sVar16);

              *pbVar11 = (0 < sVar3) * (sVar3 < 0x100) * (char)(uVar19 >> 0x20) - (0xff < sVar3);

            }

            local_1c = local_1c + -1;

            pbVar10 = pbVar11;

          } while (local_1c != 0);

        }

        iVar12 = iVar12 + iVar2;

        local_10 = local_10 + -1;

      } while (local_10 != 0);

    }

  }

  return;

}





// --- FUN_0066b010 at 0x0066B010 (size: 606) ---


void FUN_0066b010(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  ushort uVar6;

  ulonglong uVar7;

  ushort uVar8;

  uint uVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar16;

  short sVar18;

  uint5 uVar17;

  short sVar19;

  byte bVar20;

  byte bVar21;

  ulonglong uVar22;

  ulonglong uVar23;

  undefined4 local_20;

  int local_14;

  

  uVar9 = DAT_008f86b0;

  local_20 = *(int *)(param_1 + 8);

  if (local_20 == 0) {

    iVar11 = *(int *)(param_1 + 0x14);

    bVar20 = *(byte *)(param_1 + 0x24);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar13 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar13 != 0) {

          iVar10 = iVar13;

          do {

            iVar10 = iVar10 + -1;

            if (bVar20 != 0) {

              uVar4 = *(undefined4 *)(iVar11 + iVar10 * 4);

              uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar17 = (uint5)uVar5 & 0xffffffff00;

              uVar22 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar4 & 0xff;

              uVar8 = (ushort)(byte)(uVar9 >> 0x10);

              uVar6 = (ushort)(byte)(uVar9 >> 8);

              bVar21 = (byte)uVar9;

              uVar7 = uVar22 >> 0x10 & 0xffffff00ff00;

              sVar16 = (short)(uVar22 >> 0x10);

              sVar18 = (short)(uVar17 >> 8);

              sVar19 = (short)(uVar17 >> 0x18);

              sVar15 = bVar20 + 1;

              uVar23 = (ulonglong)

                       CONCAT24((sVar18 + uVar8) - ((ushort)((uVar8 + (uVar8 != 0)) * sVar18) >> 8),

                                CONCAT22((sVar16 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar16) >> 8),

                                         (uVar14 + bVar21) -

                                         ((ushort)(((ushort)bVar21 + (ushort)(bVar21 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar22 = uVar23 | uVar7 << 0x10;

              if (sVar15 != 0x100) {

                uVar22 = CONCAT26(sVar19 - (((ushort)(sVar19 * sVar15) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar15) >> 8)),

                                  CONCAT24(sVar18 - (((ushort)(sVar18 * sVar15) >> 8) -

                                                    ((ushort)((short)(uVar23 >> 0x20) * sVar15) >> 8

                                                    )),

                                           CONCAT22(sVar16 - (((ushort)(sVar16 * sVar15) >> 8) -

                                                             ((ushort)((short)(uVar23 >> 0x10) *

                                                                      sVar15) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar15) >> 8) -

                                                             ((ushort)((short)uVar23 * sVar15) >> 8)

                                                             ))));

              }

              sVar15 = (short)uVar22;

              sVar16 = (short)(uVar22 >> 0x10);

              sVar18 = (short)(uVar22 >> 0x20);

              sVar19 = (short)(uVar22 >> 0x30);

              *(uint *)(iVar11 + iVar10 * 4) =

                   CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)(uVar22 >> 0x30) -

                            (0xff < sVar19),

                            CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar22 >> 0x20) -

                                     (0xff < sVar18),

                                     CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                              (char)(uVar22 >> 0x10) - (0xff < sVar16),

                                              (0 < sVar15) * (sVar15 < 0x100) * (char)uVar22 -

                                              (0xff < sVar15))));

            }

          } while (iVar10 != 0);

        }

        iVar11 = iVar11 - iVar2;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar11 = *(int *)(param_1 + 0x14);

    iVar13 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar10 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      iVar12 = iVar2;

      do {

        while (iVar12 != 0) {

          iVar1 = iVar12 + -1;

          iVar12 = iVar12 + -1;

          uVar9 = ((uint)*(byte *)(iVar1 + local_20) << 0x18 | DAT_008f86b0) >> 0x18;

          if (iVar13 != 0x100) {

            uVar9 = (int)(uVar9 * iVar13) >> 8;

          }

          if (uVar9 != 0) {

            uVar4 = *(undefined4 *)(iVar11 + iVar12 * 4);

            uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                            0x30) >> 0x28),

                                                    CONCAT14((char)((uint)uVar4 >> 0x10),uVar4)) >>

                                          0x20),uVar4) >> 0x18);

            uVar17 = (uint5)uVar5 & 0xffffffff00;

            uVar22 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                     0xffffffff00ffffff;

            uVar14 = (ushort)uVar4 & 0xff;

            uVar8 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

            uVar6 = (ushort)(byte)(DAT_008f86b0 >> 8);

            bVar20 = (byte)DAT_008f86b0;

            uVar7 = uVar22 >> 0x10 & 0xffffff00ff00;

            sVar15 = (short)(uVar22 >> 0x10);

            sVar16 = (short)(uVar17 >> 8);

            sVar18 = (short)(uVar17 >> 0x18);

            uVar23 = (ulonglong)

                     CONCAT24((sVar16 + uVar8) - ((ushort)((uVar8 + (uVar8 != 0)) * sVar16) >> 8),

                              CONCAT22((sVar15 + uVar6) -

                                       ((ushort)((uVar6 + (uVar6 != 0)) * sVar15) >> 8),

                                       (uVar14 + bVar20) -

                                       ((ushort)(((ushort)bVar20 + (ushort)(bVar20 != 0)) * uVar14)

                                       >> 8))) & 0xff00ff00ff;

            uVar22 = uVar23 | uVar7 << 0x10;

            if (uVar9 + 1 != 0x100) {

              sVar19 = (short)(uVar9 + 1);

              uVar22 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar19) >> 8) -

                                         ((ushort)((short)(uVar7 >> 0x20) * sVar19) >> 8)),

                                CONCAT24(sVar16 - (((ushort)(sVar16 * sVar19) >> 8) -

                                                  ((ushort)((short)(uVar23 >> 0x20) * sVar19) >> 8))

                                         ,CONCAT22(sVar15 - (((ushort)(sVar15 * sVar19) >> 8) -

                                                            ((ushort)((short)(uVar23 >> 0x10) *

                                                                     sVar19) >> 8)),

                                                   uVar14 - (((ushort)(uVar14 * sVar19) >> 8) -

                                                            ((ushort)((short)uVar23 * sVar19) >> 8))

                                                  )));

            }

            sVar15 = (short)uVar22;

            sVar16 = (short)(uVar22 >> 0x10);

            sVar18 = (short)(uVar22 >> 0x20);

            sVar19 = (short)(uVar22 >> 0x30);

            *(uint *)(iVar11 + iVar12 * 4) =

                 CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)(uVar22 >> 0x30) - (0xff < sVar19)

                          ,CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar22 >> 0x20) -

                                    (0xff < sVar18),

                                    CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                             (char)(uVar22 >> 0x10) - (0xff < sVar16),

                                             (0 < sVar15) * (sVar15 < 0x100) * (char)uVar22 -

                                             (0xff < sVar15))));

          }

        }

        local_20 = local_20 + iVar10;

        iVar11 = iVar11 + iVar3;

        local_14 = local_14 + -1;

        iVar12 = iVar2;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_0066b270 at 0x0066B270 (size: 736) ---


void FUN_0066b270(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  ushort uVar7;

  ushort uVar8;

  ushort uVar9;

  uint uVar10;

  byte *pbVar11;

  int iVar12;

  byte *pbVar13;

  int iVar14;

  int iVar15;

  ushort uVar16;

  short sVar17;

  short sVar18;

  byte bVar19;

  byte bVar20;

  ulonglong uVar21;

  int local_24;

  int local_18;

  int local_14;

  

  uVar10 = DAT_008f86b0;

  local_24 = *(int *)(param_1 + 8);

  if (local_24 == 0) {

    bVar19 = *(byte *)(param_1 + 0x24);

    iVar14 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar12 = *(int *)(param_1 + 0x18);

      iVar2 = *(int *)(param_1 + 0x1c);

      do {

        if (iVar2 != 0) {

          pbVar11 = (byte *)(iVar2 * 3 + 2 + iVar14);

          local_18 = iVar2;

          do {

            pbVar13 = pbVar11 + -3;

            if (bVar19 != 0) {

              uVar9 = *(ushort *)(pbVar11 + -5);

              uVar8 = (ushort)(((uint5)*pbVar13 << 0x20) >> 0x18);

              uVar16 = uVar9 & 0xff;

              uVar7 = (ushort)(byte)(uVar10 >> 0x10);

              uVar6 = (ushort)(byte)(uVar10 >> 8);

              bVar20 = (byte)uVar10;

              sVar18 = (short)(CONCAT23(uVar8,CONCAT12((char)(uVar9 >> 8),uVar9)) >> 0x10);

              uVar8 = uVar8 >> 8;

              sVar17 = bVar19 + 1;

              uVar21 = (ulonglong)

                       CONCAT24((uVar8 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * uVar8) >> 8),

                                CONCAT22((sVar18 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar18) >> 8),

                                         (uVar16 + bVar20) -

                                         ((ushort)(((ushort)bVar20 + (ushort)(bVar20 != 0)) * uVar16

                                                  ) >> 8))) & 0xff00ff00ff;

              if (sVar17 != 0x100) {

                uVar21 = (ulonglong)

                         CONCAT24(uVar8 - (((ushort)(uVar8 * sVar17) >> 8) -

                                          ((ushort)((short)(uVar21 >> 0x20) * sVar17) >> 8)),

                                  CONCAT22(sVar18 - (((ushort)(sVar18 * sVar17) >> 8) -

                                                    ((ushort)((short)(uVar21 >> 0x10) * sVar17) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar17) >> 8) -

                                                    ((ushort)((short)uVar21 * sVar17) >> 8))));

              }

              sVar17 = (short)uVar21;

              sVar18 = (short)(uVar21 >> 0x10);

              sVar5 = (short)(uVar21 >> 0x20);

              pbVar11[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar21 - (0xff < sVar17);

              pbVar11[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x10) -

                            (0xff < sVar18);

              *pbVar13 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar21 >> 0x20) - (0xff < sVar5);

            }

            local_18 = local_18 + -1;

            pbVar11 = pbVar13;

          } while (local_18 != 0);

        }

        iVar14 = iVar14 - iVar12;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar14 = *(int *)(param_1 + 0x14);

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pbVar11 = (byte *)(iVar2 * 3 + 2 + iVar14);

          iVar15 = iVar2;

          do {

            iVar1 = iVar15 + -1;

            iVar15 = iVar15 + -1;

            pbVar13 = pbVar11 + -3;

            uVar10 = ((uint)*(byte *)(iVar1 + local_24) << 0x18 | DAT_008f86b0) >> 0x18;

            if (iVar12 != 0x100) {

              uVar10 = (int)(uVar10 * iVar12) >> 8;

            }

            if (uVar10 != 0) {

              uVar9 = *(ushort *)(pbVar11 + -5);

              uVar8 = (ushort)(((uint5)*pbVar13 << 0x20) >> 0x18);

              uVar16 = uVar9 & 0xff;

              uVar7 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar6 = (ushort)(byte)(DAT_008f86b0 >> 8);

              bVar19 = (byte)DAT_008f86b0;

              sVar17 = (short)(CONCAT23(uVar8,CONCAT12((char)(uVar9 >> 8),uVar9)) >> 0x10);

              uVar8 = uVar8 >> 8;

              uVar21 = (ulonglong)

                       CONCAT24((uVar8 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * uVar8) >> 8),

                                CONCAT22((sVar17 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar17) >> 8),

                                         (uVar16 + bVar19) -

                                         ((ushort)(((ushort)bVar19 + (ushort)(bVar19 != 0)) * uVar16

                                                  ) >> 8))) & 0xff00ff00ff;

              if (uVar10 + 1 != 0x100) {

                sVar18 = (short)(uVar10 + 1);

                uVar21 = (ulonglong)

                         CONCAT24(uVar8 - (((ushort)(uVar8 * sVar18) >> 8) -

                                          ((ushort)((short)(uVar21 >> 0x20) * sVar18) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                                    ((ushort)((short)(uVar21 >> 0x10) * sVar18) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar18) >> 8) -

                                                    ((ushort)((short)uVar21 * sVar18) >> 8))));

              }

              sVar17 = (short)uVar21;

              sVar18 = (short)(uVar21 >> 0x10);

              sVar5 = (short)(uVar21 >> 0x20);

              pbVar11[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar21 - (0xff < sVar17);

              pbVar11[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x10) -

                            (0xff < sVar18);

              *pbVar13 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar21 >> 0x20) - (0xff < sVar5);

            }

            pbVar11 = pbVar13;

          } while (iVar15 != 0);

        }

        local_24 = local_24 + iVar3;

        iVar14 = iVar14 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066b570 at 0x0066B570 (size: 624) ---


void FUN_0066b570(int param_1)



{

  uint *puVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  ushort uVar6;

  ulonglong uVar7;

  ushort uVar8;

  uint uVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  undefined4 *puVar13;

  ushort uVar14;

  short sVar15;

  short sVar16;

  short sVar18;

  uint5 uVar17;

  short sVar19;

  byte bVar20;

  byte bVar21;

  ulonglong uVar22;

  ulonglong uVar23;

  int local_28;

  int local_20;

  int local_14;

  

  uVar9 = DAT_008f86b0;

  local_28 = *(int *)(param_1 + 8);

  iVar11 = *(int *)(param_1 + 0x14);

  if (local_28 == 0) {

    bVar20 = *(byte *)(param_1 + 0x24);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar12 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar12 != 0) {

          iVar10 = iVar12;

          do {

            iVar10 = iVar10 + -1;

            if (bVar20 != 0) {

              uVar4 = *(undefined4 *)(iVar11 + iVar10 * 4);

              uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar17 = (uint5)uVar5 & 0xffffffff00;

              uVar22 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar4 & 0xff;

              uVar8 = (ushort)(byte)(uVar9 >> 0x10);

              uVar6 = (ushort)(byte)(uVar9 >> 8);

              bVar21 = (byte)uVar9;

              uVar7 = uVar22 >> 0x10 & 0xffffff00ff00;

              sVar16 = (short)(uVar22 >> 0x10);

              sVar18 = (short)(uVar17 >> 8);

              sVar19 = (short)(uVar17 >> 0x18);

              sVar15 = bVar20 + 1;

              uVar23 = (ulonglong)

                       CONCAT24((sVar18 + uVar8) - ((ushort)((uVar8 + (uVar8 != 0)) * sVar18) >> 8),

                                CONCAT22((sVar16 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar16) >> 8),

                                         (uVar14 + bVar21) -

                                         ((ushort)(((ushort)bVar21 + (ushort)(bVar21 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar22 = uVar23 | uVar7 << 0x10;

              if (sVar15 != 0x100) {

                uVar22 = CONCAT26(sVar19 - (((ushort)(sVar19 * sVar15) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar15) >> 8)),

                                  CONCAT24(sVar18 - (((ushort)(sVar18 * sVar15) >> 8) -

                                                    ((ushort)((short)(uVar23 >> 0x20) * sVar15) >> 8

                                                    )),

                                           CONCAT22(sVar16 - (((ushort)(sVar16 * sVar15) >> 8) -

                                                             ((ushort)((short)(uVar23 >> 0x10) *

                                                                      sVar15) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar15) >> 8) -

                                                             ((ushort)((short)uVar23 * sVar15) >> 8)

                                                             ))));

              }

              sVar15 = (short)uVar22;

              sVar16 = (short)(uVar22 >> 0x10);

              sVar18 = (short)(uVar22 >> 0x20);

              sVar19 = (short)(uVar22 >> 0x30);

              *(uint *)(iVar11 + iVar10 * 4) =

                   CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)(uVar22 >> 0x30) -

                            (0xff < sVar19),

                            CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar22 >> 0x20) -

                                     (0xff < sVar18),

                                     CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                              (char)(uVar22 >> 0x10) - (0xff < sVar16),

                                              (0 < sVar15) * (sVar15 < 0x100) * (char)uVar22 -

                                              (0xff < sVar15))));

            }

          } while (iVar10 != 0);

        }

        iVar11 = iVar11 - iVar2;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar10 = *(int *)(param_1 + 0xc);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          puVar13 = (undefined4 *)(iVar11 + iVar2 * 4);

          local_20 = iVar2;

          do {

            puVar1 = (uint *)((local_28 - iVar11) + -4 + (int)puVar13);

            puVar13 = puVar13 + -1;

            uVar9 = (*puVar1 & 0xff000000 | DAT_008f86b0) >> 0x18;

            if (iVar12 != 0x100) {

              uVar9 = (int)(uVar9 * iVar12) >> 8;

            }

            if (uVar9 != 0) {

              uVar4 = *puVar13;

              uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar17 = (uint5)uVar5 & 0xffffffff00;

              uVar22 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),(ushort)uVar4)) &

                       0xffffffff00ffffff;

              uVar14 = (ushort)uVar4 & 0xff;

              uVar8 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar6 = (ushort)(byte)(DAT_008f86b0 >> 8);

              bVar20 = (byte)DAT_008f86b0;

              uVar7 = uVar22 >> 0x10 & 0xffffff00ff00;

              sVar15 = (short)(uVar22 >> 0x10);

              sVar16 = (short)(uVar17 >> 8);

              sVar18 = (short)(uVar17 >> 0x18);

              uVar23 = (ulonglong)

                       CONCAT24((sVar16 + uVar8) - ((ushort)((uVar8 + (uVar8 != 0)) * sVar16) >> 8),

                                CONCAT22((sVar15 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar15) >> 8),

                                         (uVar14 + bVar20) -

                                         ((ushort)(((ushort)bVar20 + (ushort)(bVar20 != 0)) * uVar14

                                                  ) >> 8))) & 0xff00ff00ff;

              uVar22 = uVar23 | uVar7 << 0x10;

              if (uVar9 + 1 != 0x100) {

                sVar19 = (short)(uVar9 + 1);

                uVar22 = CONCAT26(sVar18 - (((ushort)(sVar18 * sVar19) >> 8) -

                                           ((ushort)((short)(uVar7 >> 0x20) * sVar19) >> 8)),

                                  CONCAT24(sVar16 - (((ushort)(sVar16 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar23 >> 0x20) * sVar19) >> 8

                                                    )),

                                           CONCAT22(sVar15 - (((ushort)(sVar15 * sVar19) >> 8) -

                                                             ((ushort)((short)(uVar23 >> 0x10) *

                                                                      sVar19) >> 8)),

                                                    uVar14 - (((ushort)(uVar14 * sVar19) >> 8) -

                                                             ((ushort)((short)uVar23 * sVar19) >> 8)

                                                             ))));

              }

              sVar15 = (short)uVar22;

              sVar16 = (short)(uVar22 >> 0x10);

              sVar18 = (short)(uVar22 >> 0x20);

              sVar19 = (short)(uVar22 >> 0x30);

              *puVar13 = CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)(uVar22 >> 0x30) -

                                  (0xff < sVar19),

                                  CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)(uVar22 >> 0x20)

                                           - (0xff < sVar18),

                                           CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                                    (char)(uVar22 >> 0x10) - (0xff < sVar16),

                                                    (0 < sVar15) * (sVar15 < 0x100) * (char)uVar22 -

                                                    (0xff < sVar15))));

            }

            local_20 = local_20 + -1;

          } while (local_20 != 0);

        }

        local_28 = local_28 + iVar10;

        iVar11 = iVar11 + iVar3;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_0066b7e0 at 0x0066B7E0 (size: 731) ---


void FUN_0066b7e0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  ushort uVar7;

  ushort uVar8;

  ushort uVar9;

  uint uVar10;

  byte *pbVar11;

  int iVar12;

  byte *pbVar13;

  int iVar14;

  int iVar15;

  ushort uVar16;

  short sVar17;

  short sVar18;

  byte bVar19;

  byte bVar20;

  ulonglong uVar21;

  int local_24;

  int local_18;

  int local_14;

  

  uVar10 = DAT_008f86b0;

  local_24 = *(int *)(param_1 + 8);

  if (local_24 == 0) {

    bVar19 = *(byte *)(param_1 + 0x24);

    iVar14 = *(int *)(param_1 + 0x14);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar12 = *(int *)(param_1 + 0x18);

      iVar2 = *(int *)(param_1 + 0x1c);

      do {

        if (iVar2 != 0) {

          pbVar11 = (byte *)(iVar2 * 3 + 2 + iVar14);

          local_18 = iVar2;

          do {

            pbVar13 = pbVar11 + -3;

            if (bVar19 != 0) {

              uVar9 = *(ushort *)(pbVar11 + -5);

              uVar8 = (ushort)(((uint5)*pbVar13 << 0x20) >> 0x18);

              uVar16 = uVar9 & 0xff;

              uVar7 = (ushort)(byte)(uVar10 >> 0x10);

              uVar6 = (ushort)(byte)(uVar10 >> 8);

              bVar20 = (byte)uVar10;

              sVar18 = (short)(CONCAT23(uVar8,CONCAT12((char)(uVar9 >> 8),uVar9)) >> 0x10);

              uVar8 = uVar8 >> 8;

              sVar17 = bVar19 + 1;

              uVar21 = (ulonglong)

                       CONCAT24((uVar8 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * uVar8) >> 8),

                                CONCAT22((sVar18 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar18) >> 8),

                                         (uVar16 + bVar20) -

                                         ((ushort)(((ushort)bVar20 + (ushort)(bVar20 != 0)) * uVar16

                                                  ) >> 8))) & 0xff00ff00ff;

              if (sVar17 != 0x100) {

                uVar21 = (ulonglong)

                         CONCAT24(uVar8 - (((ushort)(uVar8 * sVar17) >> 8) -

                                          ((ushort)((short)(uVar21 >> 0x20) * sVar17) >> 8)),

                                  CONCAT22(sVar18 - (((ushort)(sVar18 * sVar17) >> 8) -

                                                    ((ushort)((short)(uVar21 >> 0x10) * sVar17) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar17) >> 8) -

                                                    ((ushort)((short)uVar21 * sVar17) >> 8))));

              }

              sVar17 = (short)uVar21;

              sVar18 = (short)(uVar21 >> 0x10);

              sVar5 = (short)(uVar21 >> 0x20);

              pbVar11[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar21 - (0xff < sVar17);

              pbVar11[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x10) -

                            (0xff < sVar18);

              *pbVar13 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar21 >> 0x20) - (0xff < sVar5);

            }

            local_18 = local_18 + -1;

            pbVar11 = pbVar13;

          } while (local_18 != 0);

        }

        iVar14 = iVar14 - iVar12;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar14 = *(int *)(param_1 + 0x14);

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          pbVar11 = (byte *)(iVar2 * 3 + 2 + iVar14);

          iVar15 = iVar2;

          do {

            iVar1 = iVar15 * 4;

            iVar15 = iVar15 + -1;

            pbVar13 = pbVar11 + -3;

            uVar10 = (*(uint *)(local_24 + -4 + iVar1) & 0xff000000 | DAT_008f86b0) >> 0x18;

            if (iVar12 != 0x100) {

              uVar10 = (int)(uVar10 * iVar12) >> 8;

            }

            if (uVar10 != 0) {

              uVar9 = *(ushort *)(pbVar11 + -5);

              uVar8 = (ushort)(((uint5)*pbVar13 << 0x20) >> 0x18);

              uVar16 = uVar9 & 0xff;

              uVar7 = (ushort)(byte)(DAT_008f86b0 >> 0x10);

              uVar6 = (ushort)(byte)(DAT_008f86b0 >> 8);

              bVar19 = (byte)DAT_008f86b0;

              sVar17 = (short)(CONCAT23(uVar8,CONCAT12((char)(uVar9 >> 8),uVar9)) >> 0x10);

              uVar8 = uVar8 >> 8;

              uVar21 = (ulonglong)

                       CONCAT24((uVar8 + uVar7) - ((ushort)((uVar7 + (uVar7 != 0)) * uVar8) >> 8),

                                CONCAT22((sVar17 + uVar6) -

                                         ((ushort)((uVar6 + (uVar6 != 0)) * sVar17) >> 8),

                                         (uVar16 + bVar19) -

                                         ((ushort)(((ushort)bVar19 + (ushort)(bVar19 != 0)) * uVar16

                                                  ) >> 8))) & 0xff00ff00ff;

              if (uVar10 + 1 != 0x100) {

                sVar18 = (short)(uVar10 + 1);

                uVar21 = (ulonglong)

                         CONCAT24(uVar8 - (((ushort)(uVar8 * sVar18) >> 8) -

                                          ((ushort)((short)(uVar21 >> 0x20) * sVar18) >> 8)),

                                  CONCAT22(sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                                    ((ushort)((short)(uVar21 >> 0x10) * sVar18) >> 8

                                                    )),

                                           uVar16 - (((ushort)(uVar16 * sVar18) >> 8) -

                                                    ((ushort)((short)uVar21 * sVar18) >> 8))));

              }

              sVar17 = (short)uVar21;

              sVar18 = (short)(uVar21 >> 0x10);

              sVar5 = (short)(uVar21 >> 0x20);

              pbVar11[-5] = (0 < sVar17) * (sVar17 < 0x100) * (char)uVar21 - (0xff < sVar17);

              pbVar11[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar21 >> 0x10) -

                            (0xff < sVar18);

              *pbVar13 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar21 >> 0x20) - (0xff < sVar5);

            }

            pbVar11 = pbVar13;

          } while (iVar15 != 0);

        }

        local_24 = local_24 + iVar3;

        iVar14 = iVar14 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066bad0 at 0x0066BAD0 (size: 597) ---


void FUN_0066bad0(int param_1)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  uint uVar5;

  uint uVar6;

  int iVar7;

  uint uVar8;

  int iVar9;

  int iVar10;

  ulonglong uVar11;

  ulonglong uVar12;

  ushort uVar13;

  uint6 uVar15;

  short sVar17;

  ushort uVar18;

  short sVar19;

  short sVar20;

  short sVar21;

  ushort uVar22;

  uint6 uVar23;

  ulonglong uVar24;

  undefined4 local_c;

  ulonglong uVar14;

  uint5 uVar16;

  

  if (*(int *)(param_1 + 8) == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    iVar10 = *(int *)(param_1 + 0x14);

    iVar9 = *(int *)(param_1 + 0x20);

    if (iVar9 != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          iVar7 = iVar2;

          do {

            iVar7 = iVar7 + -1;

            if (bVar1 != 0) {

              uVar4 = *(undefined4 *)(iVar10 + iVar7 * 4);

              uVar8 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar16 = (uint5)uVar8 & 0xffffffff00;

              uVar13 = (ushort)uVar4;

              uVar14 = (ulonglong)CONCAT43(uVar8,CONCAT12((char)((uint)uVar4 >> 8),uVar13)) &

                       0xffffffff00ffffff;

              uVar15 = (uint6)(uVar14 >> 0x10);

              uVar11 = CONCAT62(uVar15,uVar13) & 0xff00ff00ff;

              uVar18 = (ushort)(uVar11 >> 0x10);

              uVar23 = CONCAT24(-(ushort)(uVar18 < (ushort)(uVar11 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar11 < uVar18),

                                         -(ushort)((ushort)uVar11 != 0)));

              uVar24 = ~(ulonglong)uVar23 & uVar11 << 0x10;

              uVar11 = uVar11 & uVar23;

              uVar12 = uVar11 | uVar24;

              uVar18 = (ushort)(uVar12 >> 0x20);

              uVar22 = (ushort)uVar11;

              uVar24 = (ulonglong)

                       CONCAT24(-(ushort)(uVar22 < uVar18),

                                CONCAT22(-(ushort)((ushort)(uVar24 >> 0x30) <

                                                  (ushort)(uVar12 >> 0x10)),

                                         -(ushort)(uVar18 < uVar22)));

              uVar11 = (ulonglong)uVar15 & 0xffffff00ff00;

              sVar17 = bVar1 + 1;

              uVar12 = uVar12 & uVar24 | ~uVar24 & (uVar12 << 0x20 | uVar12 >> 0x20) & 0xff00ff00ff;

              uVar24 = uVar12 | uVar11 << 0x10;

              if (sVar17 != 0x100) {

                sVar19 = (short)(uVar14 >> 0x10);

                sVar20 = (short)(uVar16 >> 8);

                sVar21 = (short)(uVar16 >> 0x18);

                uVar24 = CONCAT26(sVar21 - (((ushort)(sVar21 * sVar17) >> 8) -

                                           ((ushort)((short)(uVar11 >> 0x20) * sVar17) >> 8)),

                                  CONCAT24(sVar20 - (((ushort)(sVar20 * sVar17) >> 8) -

                                                    ((ushort)((short)(uVar12 >> 0x20) * sVar17) >> 8

                                                    )),

                                           CONCAT22(sVar19 - (((ushort)(sVar19 * sVar17) >> 8) -

                                                             ((ushort)((short)(uVar12 >> 0x10) *

                                                                      sVar17) >> 8)),

                                                    (uVar13 & 0xff) -

                                                    (((ushort)((uVar13 & 0xff) * sVar17) >> 8) -

                                                    ((ushort)((short)uVar12 * sVar17) >> 8)))));

              }

              sVar17 = (short)uVar24;

              sVar19 = (short)(uVar24 >> 0x10);

              sVar20 = (short)(uVar24 >> 0x20);

              sVar21 = (short)(uVar24 >> 0x30);

              *(uint *)(iVar10 + iVar7 * 4) =

                   CONCAT13((0 < sVar21) * (sVar21 < 0x100) * (char)(uVar24 >> 0x30) -

                            (0xff < sVar21),

                            CONCAT12((0 < sVar20) * (sVar20 < 0x100) * (char)(uVar24 >> 0x20) -

                                     (0xff < sVar20),

                                     CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                              (char)(uVar24 >> 0x10) - (0xff < sVar19),

                                              (0 < sVar17) * (sVar17 < 0x100) * (char)uVar24 -

                                              (0xff < sVar17))));

            }

          } while (iVar7 != 0);

        }

        iVar10 = iVar10 - iVar3;

        iVar9 = iVar9 + -1;

      } while (iVar9 != 0);

    }

  }

  else {

    iVar10 = *(int *)(param_1 + 0x14);

    iVar9 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_c = *(int *)(param_1 + 0x20);

    if (local_c != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          uVar8 = (uint)DAT_008f86b0._3_1_;

          iVar7 = iVar2;

          do {

            iVar7 = iVar7 + -1;

            uVar6 = uVar8;

            if (iVar9 != 0x100) {

              uVar6 = (int)(uVar8 * iVar9) >> 8;

            }

            if (uVar6 != 0) {

              uVar4 = *(undefined4 *)(iVar10 + iVar7 * 4);

              uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar4 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar4 >> 0x10),uVar4))

                                            >> 0x20),uVar4) >> 0x18);

              uVar16 = (uint5)uVar5 & 0xffffffff00;

              uVar13 = (ushort)uVar4;

              uVar14 = (ulonglong)CONCAT43(uVar5,CONCAT12((char)((uint)uVar4 >> 8),uVar13)) &

                       0xffffffff00ffffff;

              uVar15 = (uint6)(uVar14 >> 0x10);

              uVar11 = CONCAT62(uVar15,uVar13) & 0xff00ff00ff;

              uVar18 = (ushort)(uVar11 >> 0x10);

              uVar23 = CONCAT24(-(ushort)(uVar18 < (ushort)(uVar11 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar11 < uVar18),

                                         -(ushort)((ushort)uVar11 != 0)));

              uVar24 = ~(ulonglong)uVar23 & uVar11 << 0x10;

              uVar11 = uVar11 & uVar23;

              uVar12 = uVar11 | uVar24;

              uVar18 = (ushort)(uVar12 >> 0x20);

              uVar22 = (ushort)uVar11;

              uVar24 = (ulonglong)

                       CONCAT24(-(ushort)(uVar22 < uVar18),

                                CONCAT22(-(ushort)((ushort)(uVar24 >> 0x30) <

                                                  (ushort)(uVar12 >> 0x10)),

                                         -(ushort)(uVar18 < uVar22)));

              uVar11 = (ulonglong)uVar15 & 0xffffff00ff00;

              uVar12 = uVar12 & uVar24 | ~uVar24 & (uVar12 << 0x20 | uVar12 >> 0x20) & 0xff00ff00ff;

              uVar24 = uVar12 | uVar11 << 0x10;

              if (uVar6 + 1 != 0x100) {

                sVar17 = (short)(uVar6 + 1);

                sVar19 = (short)(uVar14 >> 0x10);

                sVar20 = (short)(uVar16 >> 8);

                sVar21 = (short)(uVar16 >> 0x18);

                uVar24 = CONCAT26(sVar21 - (((ushort)(sVar21 * sVar17) >> 8) -

                                           ((ushort)((short)(uVar11 >> 0x20) * sVar17) >> 8)),

                                  CONCAT24(sVar20 - (((ushort)(sVar20 * sVar17) >> 8) -

                                                    ((ushort)((short)(uVar12 >> 0x20) * sVar17) >> 8

                                                    )),

                                           CONCAT22(sVar19 - (((ushort)(sVar19 * sVar17) >> 8) -

                                                             ((ushort)((short)(uVar12 >> 0x10) *

                                                                      sVar17) >> 8)),

                                                    (uVar13 & 0xff) -

                                                    (((ushort)((uVar13 & 0xff) * sVar17) >> 8) -

                                                    ((ushort)((short)uVar12 * sVar17) >> 8)))));

              }

              sVar17 = (short)uVar24;

              sVar19 = (short)(uVar24 >> 0x10);

              sVar20 = (short)(uVar24 >> 0x20);

              sVar21 = (short)(uVar24 >> 0x30);

              *(uint *)(iVar10 + iVar7 * 4) =

                   CONCAT13((0 < sVar21) * (sVar21 < 0x100) * (char)(uVar24 >> 0x30) -

                            (0xff < sVar21),

                            CONCAT12((0 < sVar20) * (sVar20 < 0x100) * (char)(uVar24 >> 0x20) -

                                     (0xff < sVar20),

                                     CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                              (char)(uVar24 >> 0x10) - (0xff < sVar19),

                                              (0 < sVar17) * (sVar17 < 0x100) * (char)uVar24 -

                                              (0xff < sVar17))));

            }

          } while (iVar7 != 0);

        }

        iVar10 = iVar10 + iVar3;

        local_c = local_c + -1;

      } while (local_c != 0);

    }

  }

  return;

}





// --- FUN_0066bd40 at 0x0066BD40 (size: 727) ---


void FUN_0066bd40(int param_1)



{

  byte bVar1;

  int iVar2;

  short sVar3;

  ushort uVar4;

  uint5 uVar5;

  ushort uVar6;

  uint uVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  uint uVar13;

  ulonglong uVar14;

  ulonglong uVar15;

  short sVar16;

  ushort uVar17;

  short sVar18;

  ushort uVar19;

  uint6 uVar20;

  ulonglong uVar21;

  int local_14;

  int local_10;

  int local_c;

  

  iVar10 = *(int *)(param_1 + 0x14);

  if (*(int *)(param_1 + 8) == 0) {

    bVar1 = *(byte *)(param_1 + 0x24);

    local_10 = *(int *)(param_1 + 0x20);

    if (local_10 != 0) {

      iVar12 = *(int *)(param_1 + 0x1c);

      iVar2 = *(int *)(param_1 + 0x18);

      do {

        if (iVar12 != 0) {

          pbVar8 = (byte *)(iVar12 * 3 + 2 + iVar10);

          iVar11 = iVar12;

          do {

            pbVar9 = pbVar8 + -3;

            if (bVar1 != 0) {

              uVar6 = *(ushort *)(pbVar8 + -5);

              uVar4 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar5 = CONCAT23(uVar4,CONCAT12((char)(uVar6 >> 8),uVar6));

              uVar14 = (ulonglong)CONCAT52(uVar5 >> 0x10,uVar6) & 0xff00ff00ff;

              uVar17 = (ushort)(uVar14 >> 0x10);

              uVar20 = CONCAT24(-(ushort)(uVar17 < (ushort)(uVar14 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar14 < uVar17),

                                         -(ushort)((ushort)uVar14 != 0)));

              uVar21 = ~(ulonglong)uVar20 & uVar14 << 0x10;

              uVar14 = uVar14 & uVar20;

              uVar15 = uVar14 | uVar21;

              uVar17 = (ushort)(uVar15 >> 0x20);

              uVar19 = (ushort)uVar14;

              uVar14 = (ulonglong)

                       CONCAT24(-(ushort)(uVar19 < uVar17),

                                CONCAT22(-(ushort)((ushort)(uVar21 >> 0x30) <

                                                  (ushort)(uVar15 >> 0x10)),

                                         -(ushort)(uVar17 < uVar19)));

              sVar16 = bVar1 + 1;

              uVar14 = uVar15 & uVar14 | ~uVar14 & (uVar15 << 0x20 | uVar15 >> 0x20) & 0xff00ff00ff;

              if (sVar16 != 0x100) {

                sVar18 = (short)(uVar5 >> 0x10);

                uVar4 = uVar4 >> 8;

                uVar14 = (ulonglong)

                         CONCAT24(uVar4 - (((ushort)(uVar4 * sVar16) >> 8) -

                                          ((ushort)((short)(uVar14 >> 0x20) * sVar16) >> 8)),

                                  CONCAT22(sVar18 - (((ushort)(sVar18 * sVar16) >> 8) -

                                                    ((ushort)((short)(uVar14 >> 0x10) * sVar16) >> 8

                                                    )),

                                           (uVar6 & 0xff) -

                                           (((ushort)((uVar6 & 0xff) * sVar16) >> 8) -

                                           ((ushort)((short)uVar14 * sVar16) >> 8))));

              }

              sVar16 = (short)uVar14;

              sVar18 = (short)(uVar14 >> 0x10);

              sVar3 = (short)(uVar14 >> 0x20);

              pbVar8[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar14 - (0xff < sVar16);

              pbVar8[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar14 >> 0x10) -

                           (0xff < sVar18);

              *pbVar9 = (0 < sVar3) * (sVar3 < 0x100) * (char)(uVar14 >> 0x20) - (0xff < sVar3);

            }

            iVar11 = iVar11 + -1;

            pbVar8 = pbVar9;

          } while (iVar11 != 0);

        }

        iVar10 = iVar10 - iVar2;

        local_10 = local_10 + -1;

      } while (local_10 != 0);

    }

  }

  else {

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_c = *(int *)(param_1 + 0x20);

    if (local_c != 0) {

      iVar2 = *(int *)(param_1 + 0x1c);

      iVar11 = *(int *)(param_1 + 0x18);

      do {

        if (iVar2 != 0) {

          uVar13 = (uint)DAT_008f86b0._3_1_;

          pbVar8 = (byte *)(iVar2 * 3 + 2 + iVar10);

          local_14 = iVar2;

          do {

            pbVar9 = pbVar8 + -3;

            uVar7 = uVar13;

            if (iVar12 != 0x100) {

              uVar7 = (int)(uVar13 * iVar12) >> 8;

            }

            if (uVar7 != 0) {

              uVar6 = *(ushort *)(pbVar8 + -5);

              uVar4 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

              uVar5 = CONCAT23(uVar4,CONCAT12((char)(uVar6 >> 8),uVar6));

              uVar14 = (ulonglong)CONCAT52(uVar5 >> 0x10,uVar6) & 0xff00ff00ff;

              uVar17 = (ushort)(uVar14 >> 0x10);

              uVar20 = CONCAT24(-(ushort)(uVar17 < (ushort)(uVar14 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar14 < uVar17),

                                         -(ushort)((ushort)uVar14 != 0)));

              uVar21 = ~(ulonglong)uVar20 & uVar14 << 0x10;

              uVar14 = uVar14 & uVar20;

              uVar15 = uVar14 | uVar21;

              uVar17 = (ushort)(uVar15 >> 0x20);

              uVar19 = (ushort)uVar14;

              uVar14 = (ulonglong)

                       CONCAT24(-(ushort)(uVar19 < uVar17),

                                CONCAT22(-(ushort)((ushort)(uVar21 >> 0x30) <

                                                  (ushort)(uVar15 >> 0x10)),

                                         -(ushort)(uVar17 < uVar19)));

              uVar14 = uVar15 & uVar14 | ~uVar14 & (uVar15 << 0x20 | uVar15 >> 0x20) & 0xff00ff00ff;

              if (uVar7 + 1 != 0x100) {

                sVar16 = (short)(uVar7 + 1);

                sVar18 = (short)(uVar5 >> 0x10);

                uVar4 = uVar4 >> 8;

                uVar14 = (ulonglong)

                         CONCAT24(uVar4 - (((ushort)(uVar4 * sVar16) >> 8) -

                                          ((ushort)((short)(uVar14 >> 0x20) * sVar16) >> 8)),

                                  CONCAT22(sVar18 - (((ushort)(sVar18 * sVar16) >> 8) -

                                                    ((ushort)((short)(uVar14 >> 0x10) * sVar16) >> 8

                                                    )),

                                           (uVar6 & 0xff) -

                                           (((ushort)((uVar6 & 0xff) * sVar16) >> 8) -

                                           ((ushort)((short)uVar14 * sVar16) >> 8))));

              }

              sVar16 = (short)uVar14;

              sVar18 = (short)(uVar14 >> 0x10);

              sVar3 = (short)(uVar14 >> 0x20);

              pbVar8[-5] = (0 < sVar16) * (sVar16 < 0x100) * (char)uVar14 - (0xff < sVar16);

              pbVar8[-4] = (0 < sVar18) * (sVar18 < 0x100) * (char)(uVar14 >> 0x10) -

                           (0xff < sVar18);

              *pbVar9 = (0 < sVar3) * (sVar3 < 0x100) * (char)(uVar14 >> 0x20) - (0xff < sVar3);

            }

            local_14 = local_14 + -1;

            pbVar8 = pbVar9;

          } while (local_14 != 0);

        }

        iVar10 = iVar10 + iVar11;

        local_c = local_c + -1;

      } while (local_c != 0);

    }

  }

  return;

}





// --- FUN_0066c020 at 0x0066C020 (size: 627) ---


void FUN_0066c020(int param_1)



{

  int iVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  uint uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  ulonglong uVar13;

  ulonglong uVar14;

  ushort uVar15;

  uint6 uVar17;

  short sVar19;

  ushort uVar20;

  short sVar21;

  short sVar22;

  short sVar23;

  ushort uVar24;

  uint6 uVar25;

  ulonglong uVar26;

  undefined4 local_14;

  ulonglong uVar16;

  uint5 uVar18;

  

  iVar10 = *(int *)(param_1 + 8);

  if (iVar10 == 0) {

    bVar2 = *(byte *)(param_1 + 0x24);

    iVar10 = *(int *)(param_1 + 0x14);

    iVar12 = *(int *)(param_1 + 0x20);

    if (iVar12 != 0) {

      iVar11 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0x18);

      do {

        if (iVar11 != 0) {

          iVar9 = iVar11;

          do {

            iVar9 = iVar9 + -1;

            if (bVar2 != 0) {

              uVar5 = *(undefined4 *)(iVar10 + iVar9 * 4);

              uVar7 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar18 = (uint5)uVar7 & 0xffffffff00;

              uVar15 = (ushort)uVar5;

              uVar16 = (ulonglong)CONCAT43(uVar7,CONCAT12((char)((uint)uVar5 >> 8),uVar15)) &

                       0xffffffff00ffffff;

              uVar17 = (uint6)(uVar16 >> 0x10);

              uVar13 = CONCAT62(uVar17,uVar15) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar13 >> 0x10);

              uVar25 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar13 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar13 < uVar20),

                                         -(ushort)((ushort)uVar13 != 0)));

              uVar26 = ~(ulonglong)uVar25 & uVar13 << 0x10;

              uVar13 = uVar13 & uVar25;

              uVar14 = uVar13 | uVar26;

              uVar20 = (ushort)(uVar14 >> 0x20);

              uVar24 = (ushort)uVar13;

              uVar26 = (ulonglong)

                       CONCAT24(-(ushort)(uVar24 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar26 >> 0x30) <

                                                  (ushort)(uVar14 >> 0x10)),

                                         -(ushort)(uVar20 < uVar24)));

              uVar13 = (ulonglong)uVar17 & 0xffffff00ff00;

              sVar19 = bVar2 + 1;

              uVar14 = uVar14 & uVar26 | ~uVar26 & (uVar14 << 0x20 | uVar14 >> 0x20) & 0xff00ff00ff;

              uVar26 = uVar14 | uVar13 << 0x10;

              if (sVar19 != 0x100) {

                sVar21 = (short)(uVar16 >> 0x10);

                sVar22 = (short)(uVar18 >> 8);

                sVar23 = (short)(uVar18 >> 0x18);

                uVar26 = CONCAT26(sVar23 - (((ushort)(sVar23 * sVar19) >> 8) -

                                           ((ushort)((short)(uVar13 >> 0x20) * sVar19) >> 8)),

                                  CONCAT24(sVar22 - (((ushort)(sVar22 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar14 >> 0x20) * sVar19) >> 8

                                                    )),

                                           CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                             ((ushort)((short)(uVar14 >> 0x10) *

                                                                      sVar19) >> 8)),

                                                    (uVar15 & 0xff) -

                                                    (((ushort)((uVar15 & 0xff) * sVar19) >> 8) -

                                                    ((ushort)((short)uVar14 * sVar19) >> 8)))));

              }

              sVar19 = (short)uVar26;

              sVar21 = (short)(uVar26 >> 0x10);

              sVar22 = (short)(uVar26 >> 0x20);

              sVar23 = (short)(uVar26 >> 0x30);

              *(uint *)(iVar10 + iVar9 * 4) =

                   CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)(uVar26 >> 0x30) -

                            (0xff < sVar23),

                            CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)(uVar26 >> 0x20) -

                                     (0xff < sVar22),

                                     CONCAT11((0 < sVar21) * (sVar21 < 0x100) *

                                              (char)(uVar26 >> 0x10) - (0xff < sVar21),

                                              (0 < sVar19) * (sVar19 < 0x100) * (char)uVar26 -

                                              (0xff < sVar19))));

            }

          } while (iVar9 != 0);

        }

        iVar10 = iVar10 - iVar3;

        iVar12 = iVar12 + -1;

      } while (iVar12 != 0);

    }

  }

  else {

    iVar12 = *(int *)(param_1 + 0x14);

    iVar11 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar3 = *(int *)(param_1 + 0x1c);

      iVar9 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      iVar8 = iVar3;

      do {

        while (iVar8 != 0) {

          iVar1 = iVar8 + -1;

          iVar8 = iVar8 + -1;

          uVar7 = ((uint)*(byte *)(iVar1 + iVar10) << 0x18 | DAT_008f86b0) >> 0x18;

          if (iVar11 != 0x100) {

            uVar7 = (int)(uVar7 * iVar11) >> 8;

          }

          if (uVar7 != 0) {

            uVar5 = *(undefined4 *)(iVar12 + iVar8 * 4);

            uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                            0x30) >> 0x28),

                                                    CONCAT14((char)((uint)uVar5 >> 0x10),uVar5)) >>

                                          0x20),uVar5) >> 0x18);

            uVar18 = (uint5)uVar6 & 0xffffffff00;

            uVar15 = (ushort)uVar5;

            uVar16 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),uVar15)) &

                     0xffffffff00ffffff;

            uVar17 = (uint6)(uVar16 >> 0x10);

            uVar13 = CONCAT62(uVar17,uVar15) & 0xff00ff00ff;

            uVar20 = (ushort)(uVar13 >> 0x10);

            uVar25 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar13 >> 0x20)),

                              CONCAT22(-(ushort)((ushort)uVar13 < uVar20),

                                       -(ushort)((ushort)uVar13 != 0)));

            uVar26 = ~(ulonglong)uVar25 & uVar13 << 0x10;

            uVar13 = uVar13 & uVar25;

            uVar14 = uVar13 | uVar26;

            uVar20 = (ushort)(uVar14 >> 0x20);

            uVar24 = (ushort)uVar13;

            uVar26 = (ulonglong)

                     CONCAT24(-(ushort)(uVar24 < uVar20),

                              CONCAT22(-(ushort)((ushort)(uVar26 >> 0x30) < (ushort)(uVar14 >> 0x10)

                                                ),-(ushort)(uVar20 < uVar24)));

            uVar13 = (ulonglong)uVar17 & 0xffffff00ff00;

            uVar14 = uVar14 & uVar26 | ~uVar26 & (uVar14 << 0x20 | uVar14 >> 0x20) & 0xff00ff00ff;

            uVar26 = uVar14 | uVar13 << 0x10;

            if (uVar7 + 1 != 0x100) {

              sVar19 = (short)(uVar7 + 1);

              sVar21 = (short)(uVar16 >> 0x10);

              sVar22 = (short)(uVar18 >> 8);

              sVar23 = (short)(uVar18 >> 0x18);

              uVar26 = CONCAT26(sVar23 - (((ushort)(sVar23 * sVar19) >> 8) -

                                         ((ushort)((short)(uVar13 >> 0x20) * sVar19) >> 8)),

                                CONCAT24(sVar22 - (((ushort)(sVar22 * sVar19) >> 8) -

                                                  ((ushort)((short)(uVar14 >> 0x20) * sVar19) >> 8))

                                         ,CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                            ((ushort)((short)(uVar14 >> 0x10) *

                                                                     sVar19) >> 8)),

                                                   (uVar15 & 0xff) -

                                                   (((ushort)((uVar15 & 0xff) * sVar19) >> 8) -

                                                   ((ushort)((short)uVar14 * sVar19) >> 8)))));

            }

            sVar19 = (short)uVar26;

            sVar21 = (short)(uVar26 >> 0x10);

            sVar22 = (short)(uVar26 >> 0x20);

            sVar23 = (short)(uVar26 >> 0x30);

            *(uint *)(iVar12 + iVar8 * 4) =

                 CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)(uVar26 >> 0x30) - (0xff < sVar23)

                          ,CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)(uVar26 >> 0x20) -

                                    (0xff < sVar22),

                                    CONCAT11((0 < sVar21) * (sVar21 < 0x100) *

                                             (char)(uVar26 >> 0x10) - (0xff < sVar21),

                                             (0 < sVar19) * (sVar19 < 0x100) * (char)uVar26 -

                                             (0xff < sVar19))));

          }

        }

        iVar10 = iVar10 + iVar9;

        iVar12 = iVar12 + iVar4;

        local_14 = local_14 + -1;

        iVar8 = iVar3;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_0066c2a0 at 0x0066C2A0 (size: 762) ---


void FUN_0066c2a0(int param_1)



{

  int iVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  uint5 uVar7;

  ushort uVar8;

  uint uVar9;

  byte *pbVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int iVar16;

  ulonglong uVar17;

  ulonglong uVar18;

  short sVar19;

  ushort uVar20;

  short sVar21;

  ushort uVar22;

  uint6 uVar23;

  ulonglong uVar24;

  int local_1c;

  int local_18;

  

  iVar14 = *(int *)(param_1 + 8);

  iVar12 = *(int *)(param_1 + 0x14);

  if (iVar14 == 0) {

    bVar2 = *(byte *)(param_1 + 0x24);

    local_1c = *(int *)(param_1 + 0x20);

    if (local_1c != 0) {

      iVar14 = *(int *)(param_1 + 0x1c);

      iVar16 = *(int *)(param_1 + 0x18);

      do {

        if (iVar14 != 0) {

          pbVar10 = (byte *)(iVar14 * 3 + 2 + iVar12);

          iVar13 = iVar14;

          do {

            pbVar11 = pbVar10 + -3;

            if (bVar2 != 0) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar7 = CONCAT23(uVar6,CONCAT12((char)(uVar8 >> 8),uVar8));

              uVar17 = (ulonglong)CONCAT52(uVar7 >> 0x10,uVar8) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar17 >> 0x10);

              uVar23 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar17 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar17 < uVar20),

                                         -(ushort)((ushort)uVar17 != 0)));

              uVar24 = ~(ulonglong)uVar23 & uVar17 << 0x10;

              uVar17 = uVar17 & uVar23;

              uVar18 = uVar17 | uVar24;

              uVar20 = (ushort)(uVar18 >> 0x20);

              uVar22 = (ushort)uVar17;

              uVar17 = (ulonglong)

                       CONCAT24(-(ushort)(uVar22 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar24 >> 0x30) <

                                                  (ushort)(uVar18 >> 0x10)),

                                         -(ushort)(uVar20 < uVar22)));

              sVar19 = bVar2 + 1;

              uVar17 = uVar18 & uVar17 | ~uVar17 & (uVar18 << 0x20 | uVar18 >> 0x20) & 0xff00ff00ff;

              if (sVar19 != 0x100) {

                sVar21 = (short)(uVar7 >> 0x10);

                uVar6 = uVar6 >> 8;

                uVar17 = (ulonglong)

                         CONCAT24(uVar6 - (((ushort)(uVar6 * sVar19) >> 8) -

                                          ((ushort)((short)(uVar17 >> 0x20) * sVar19) >> 8)),

                                  CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar17 >> 0x10) * sVar19) >> 8

                                                    )),

                                           (uVar8 & 0xff) -

                                           (((ushort)((uVar8 & 0xff) * sVar19) >> 8) -

                                           ((ushort)((short)uVar17 * sVar19) >> 8))));

              }

              sVar19 = (short)uVar17;

              sVar21 = (short)(uVar17 >> 0x10);

              sVar5 = (short)(uVar17 >> 0x20);

              pbVar10[-5] = (0 < sVar19) * (sVar19 < 0x100) * (char)uVar17 - (0xff < sVar19);

              pbVar10[-4] = (0 < sVar21) * (sVar21 < 0x100) * (char)(uVar17 >> 0x10) -

                            (0xff < sVar21);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar17 >> 0x20) - (0xff < sVar5);

            }

            iVar13 = iVar13 + -1;

            pbVar10 = pbVar11;

          } while (iVar13 != 0);

        }

        iVar12 = iVar12 - iVar16;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  else {

    iVar16 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar13 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar13 != 0) {

          pbVar10 = (byte *)(iVar13 * 3 + 2 + iVar12);

          iVar15 = iVar13;

          do {

            iVar1 = iVar15 + -1;

            iVar15 = iVar15 + -1;

            pbVar11 = pbVar10 + -3;

            uVar9 = ((uint)*(byte *)(iVar1 + iVar14) << 0x18 | DAT_008f86b0) >> 0x18;

            if (iVar16 != 0x100) {

              uVar9 = (int)(uVar9 * iVar16) >> 8;

            }

            if (uVar9 != 0) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar7 = CONCAT23(uVar6,CONCAT12((char)(uVar8 >> 8),uVar8));

              uVar17 = (ulonglong)CONCAT52(uVar7 >> 0x10,uVar8) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar17 >> 0x10);

              uVar23 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar17 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar17 < uVar20),

                                         -(ushort)((ushort)uVar17 != 0)));

              uVar24 = ~(ulonglong)uVar23 & uVar17 << 0x10;

              uVar17 = uVar17 & uVar23;

              uVar18 = uVar17 | uVar24;

              uVar20 = (ushort)(uVar18 >> 0x20);

              uVar22 = (ushort)uVar17;

              uVar17 = (ulonglong)

                       CONCAT24(-(ushort)(uVar22 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar24 >> 0x30) <

                                                  (ushort)(uVar18 >> 0x10)),

                                         -(ushort)(uVar20 < uVar22)));

              uVar17 = uVar18 & uVar17 | ~uVar17 & (uVar18 << 0x20 | uVar18 >> 0x20) & 0xff00ff00ff;

              if (uVar9 + 1 != 0x100) {

                sVar19 = (short)(uVar9 + 1);

                sVar21 = (short)(uVar7 >> 0x10);

                uVar6 = uVar6 >> 8;

                uVar17 = (ulonglong)

                         CONCAT24(uVar6 - (((ushort)(uVar6 * sVar19) >> 8) -

                                          ((ushort)((short)(uVar17 >> 0x20) * sVar19) >> 8)),

                                  CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar17 >> 0x10) * sVar19) >> 8

                                                    )),

                                           (uVar8 & 0xff) -

                                           (((ushort)((uVar8 & 0xff) * sVar19) >> 8) -

                                           ((ushort)((short)uVar17 * sVar19) >> 8))));

              }

              sVar19 = (short)uVar17;

              sVar21 = (short)(uVar17 >> 0x10);

              sVar5 = (short)(uVar17 >> 0x20);

              pbVar10[-5] = (0 < sVar19) * (sVar19 < 0x100) * (char)uVar17 - (0xff < sVar19);

              pbVar10[-4] = (0 < sVar21) * (sVar21 < 0x100) * (char)(uVar17 >> 0x10) -

                            (0xff < sVar21);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar17 >> 0x20) - (0xff < sVar5);

            }

            pbVar10 = pbVar11;

          } while (iVar15 != 0);

        }

        iVar14 = iVar14 + iVar3;

        iVar12 = iVar12 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066c5b0 at 0x0066C5B0 (size: 675) ---


void FUN_0066c5b0(int param_1)



{

  uint *puVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  undefined4 *puVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  ulonglong uVar13;

  ulonglong uVar14;

  ushort uVar15;

  uint6 uVar17;

  short sVar19;

  ushort uVar20;

  short sVar21;

  short sVar22;

  short sVar23;

  ushort uVar24;

  uint6 uVar25;

  ulonglong uVar26;

  int local_28;

  int local_20;

  int local_14;

  ulonglong uVar16;

  uint5 uVar18;

  

  uVar7 = DAT_008f86b0;

  local_28 = *(int *)(param_1 + 8);

  iVar11 = *(int *)(param_1 + 0x14);

  if (local_28 == 0) {

    bVar2 = *(byte *)(param_1 + 0x24);

    iVar12 = *(int *)(param_1 + 0x20);

    if (iVar12 != 0) {

      iVar3 = *(int *)(param_1 + 0x1c);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar3 != 0) {

          iVar10 = iVar3;

          do {

            iVar10 = iVar10 + -1;

            if (bVar2 != 0) {

              uVar5 = *(undefined4 *)(iVar11 + iVar10 * 4);

              uVar7 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar18 = (uint5)uVar7 & 0xffffffff00;

              uVar15 = (ushort)uVar5;

              uVar16 = (ulonglong)CONCAT43(uVar7,CONCAT12((char)((uint)uVar5 >> 8),uVar15)) &

                       0xffffffff00ffffff;

              uVar17 = (uint6)(uVar16 >> 0x10);

              uVar13 = CONCAT62(uVar17,uVar15) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar13 >> 0x10);

              uVar25 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar13 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar13 < uVar20),

                                         -(ushort)((ushort)uVar13 != 0)));

              uVar26 = ~(ulonglong)uVar25 & uVar13 << 0x10;

              uVar13 = uVar13 & uVar25;

              uVar14 = uVar13 | uVar26;

              uVar20 = (ushort)(uVar14 >> 0x20);

              uVar24 = (ushort)uVar13;

              uVar26 = (ulonglong)

                       CONCAT24(-(ushort)(uVar24 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar26 >> 0x30) <

                                                  (ushort)(uVar14 >> 0x10)),

                                         -(ushort)(uVar20 < uVar24)));

              uVar13 = (ulonglong)uVar17 & 0xffffff00ff00;

              sVar19 = bVar2 + 1;

              uVar14 = uVar14 & uVar26 | ~uVar26 & (uVar14 << 0x20 | uVar14 >> 0x20) & 0xff00ff00ff;

              uVar26 = uVar14 | uVar13 << 0x10;

              if (sVar19 != 0x100) {

                sVar21 = (short)(uVar16 >> 0x10);

                sVar22 = (short)(uVar18 >> 8);

                sVar23 = (short)(uVar18 >> 0x18);

                uVar26 = CONCAT26(sVar23 - (((ushort)(sVar23 * sVar19) >> 8) -

                                           ((ushort)((short)(uVar13 >> 0x20) * sVar19) >> 8)),

                                  CONCAT24(sVar22 - (((ushort)(sVar22 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar14 >> 0x20) * sVar19) >> 8

                                                    )),

                                           CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                             ((ushort)((short)(uVar14 >> 0x10) *

                                                                      sVar19) >> 8)),

                                                    (uVar15 & 0xff) -

                                                    (((ushort)((uVar15 & 0xff) * sVar19) >> 8) -

                                                    ((ushort)((short)uVar14 * sVar19) >> 8)))));

              }

              sVar19 = (short)uVar26;

              sVar21 = (short)(uVar26 >> 0x10);

              sVar22 = (short)(uVar26 >> 0x20);

              sVar23 = (short)(uVar26 >> 0x30);

              *(uint *)(iVar11 + iVar10 * 4) =

                   CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)(uVar26 >> 0x30) -

                            (0xff < sVar23),

                            CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)(uVar26 >> 0x20) -

                                     (0xff < sVar22),

                                     CONCAT11((0 < sVar21) * (sVar21 < 0x100) *

                                              (char)(uVar26 >> 0x10) - (0xff < sVar21),

                                              (0 < sVar19) * (sVar19 < 0x100) * (char)uVar26 -

                                              (0xff < sVar19))));

            }

          } while (iVar10 != 0);

        }

        iVar11 = iVar11 - iVar4;

        iVar12 = iVar12 + -1;

      } while (iVar12 != 0);

    }

  }

  else {

    iVar12 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_14 = *(int *)(param_1 + 0x20);

    if (local_14 != 0) {

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x1c);

      iVar10 = *(int *)(param_1 + 0x18);

      do {

        if (iVar4 != 0) {

          puVar9 = (undefined4 *)(iVar11 + iVar4 * 4);

          local_20 = iVar4;

          do {

            puVar1 = (uint *)((local_28 - iVar11) + -4 + (int)puVar9);

            puVar9 = puVar9 + -1;

            uVar8 = (*puVar1 & 0xff000000 | uVar7) >> 0x18;

            if (iVar12 != 0x100) {

              uVar8 = (int)(uVar8 * iVar12) >> 8;

            }

            if (uVar8 != 0) {

              uVar5 = *puVar9;

              uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)((uint)uVar5 >> 0x18) <<

                                                              0x30) >> 0x28),

                                                      CONCAT14((char)((uint)uVar5 >> 0x10),uVar5))

                                            >> 0x20),uVar5) >> 0x18);

              uVar18 = (uint5)uVar6 & 0xffffffff00;

              uVar15 = (ushort)uVar5;

              uVar16 = (ulonglong)CONCAT43(uVar6,CONCAT12((char)((uint)uVar5 >> 8),uVar15)) &

                       0xffffffff00ffffff;

              uVar17 = (uint6)(uVar16 >> 0x10);

              uVar13 = CONCAT62(uVar17,uVar15) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar13 >> 0x10);

              uVar25 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar13 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar13 < uVar20),

                                         -(ushort)((ushort)uVar13 != 0)));

              uVar26 = ~(ulonglong)uVar25 & uVar13 << 0x10;

              uVar13 = uVar13 & uVar25;

              uVar14 = uVar13 | uVar26;

              uVar20 = (ushort)(uVar14 >> 0x20);

              uVar24 = (ushort)uVar13;

              uVar26 = (ulonglong)

                       CONCAT24(-(ushort)(uVar24 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar26 >> 0x30) <

                                                  (ushort)(uVar14 >> 0x10)),

                                         -(ushort)(uVar20 < uVar24)));

              uVar13 = (ulonglong)uVar17 & 0xffffff00ff00;

              uVar14 = uVar14 & uVar26 | ~uVar26 & (uVar14 << 0x20 | uVar14 >> 0x20) & 0xff00ff00ff;

              uVar26 = uVar14 | uVar13 << 0x10;

              if (uVar8 + 1 != 0x100) {

                sVar19 = (short)(uVar8 + 1);

                sVar21 = (short)(uVar16 >> 0x10);

                sVar22 = (short)(uVar18 >> 8);

                sVar23 = (short)(uVar18 >> 0x18);

                uVar26 = CONCAT26(sVar23 - (((ushort)(sVar23 * sVar19) >> 8) -

                                           ((ushort)((short)(uVar13 >> 0x20) * sVar19) >> 8)),

                                  CONCAT24(sVar22 - (((ushort)(sVar22 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar14 >> 0x20) * sVar19) >> 8

                                                    )),

                                           CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                             ((ushort)((short)(uVar14 >> 0x10) *

                                                                      sVar19) >> 8)),

                                                    (uVar15 & 0xff) -

                                                    (((ushort)((uVar15 & 0xff) * sVar19) >> 8) -

                                                    ((ushort)((short)uVar14 * sVar19) >> 8)))));

              }

              sVar19 = (short)uVar26;

              sVar21 = (short)(uVar26 >> 0x10);

              sVar22 = (short)(uVar26 >> 0x20);

              sVar23 = (short)(uVar26 >> 0x30);

              *puVar9 = CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)(uVar26 >> 0x30) -

                                 (0xff < sVar23),

                                 CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)(uVar26 >> 0x20) -

                                          (0xff < sVar22),

                                          CONCAT11((0 < sVar21) * (sVar21 < 0x100) *

                                                   (char)(uVar26 >> 0x10) - (0xff < sVar21),

                                                   (0 < sVar19) * (sVar19 < 0x100) * (char)uVar26 -

                                                   (0xff < sVar19))));

            }

            local_20 = local_20 + -1;

          } while (local_20 != 0);

        }

        local_28 = local_28 + iVar3;

        iVar11 = iVar11 + iVar10;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  return;

}





// --- FUN_0066c860 at 0x0066C860 (size: 759) ---


void FUN_0066c860(int param_1)



{

  int iVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  short sVar5;

  ushort uVar6;

  uint5 uVar7;

  ushort uVar8;

  uint uVar9;

  byte *pbVar10;

  byte *pbVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int iVar16;

  ulonglong uVar17;

  ulonglong uVar18;

  short sVar19;

  ushort uVar20;

  short sVar21;

  ushort uVar22;

  uint6 uVar23;

  ulonglong uVar24;

  int local_1c;

  int local_18;

  

  iVar12 = *(int *)(param_1 + 0x14);

  iVar14 = *(int *)(param_1 + 8);

  if (iVar14 == 0) {

    bVar2 = *(byte *)(param_1 + 0x24);

    local_1c = *(int *)(param_1 + 0x20);

    if (local_1c != 0) {

      iVar14 = *(int *)(param_1 + 0x1c);

      iVar16 = *(int *)(param_1 + 0x18);

      do {

        if (iVar14 != 0) {

          pbVar10 = (byte *)(iVar14 * 3 + 2 + iVar12);

          iVar13 = iVar14;

          do {

            pbVar11 = pbVar10 + -3;

            if (bVar2 != 0) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar7 = CONCAT23(uVar6,CONCAT12((char)(uVar8 >> 8),uVar8));

              uVar17 = (ulonglong)CONCAT52(uVar7 >> 0x10,uVar8) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar17 >> 0x10);

              uVar23 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar17 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar17 < uVar20),

                                         -(ushort)((ushort)uVar17 != 0)));

              uVar24 = ~(ulonglong)uVar23 & uVar17 << 0x10;

              uVar17 = uVar17 & uVar23;

              uVar18 = uVar17 | uVar24;

              uVar20 = (ushort)(uVar18 >> 0x20);

              uVar22 = (ushort)uVar17;

              uVar17 = (ulonglong)

                       CONCAT24(-(ushort)(uVar22 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar24 >> 0x30) <

                                                  (ushort)(uVar18 >> 0x10)),

                                         -(ushort)(uVar20 < uVar22)));

              sVar19 = bVar2 + 1;

              uVar17 = uVar18 & uVar17 | ~uVar17 & (uVar18 << 0x20 | uVar18 >> 0x20) & 0xff00ff00ff;

              if (sVar19 != 0x100) {

                sVar21 = (short)(uVar7 >> 0x10);

                uVar6 = uVar6 >> 8;

                uVar17 = (ulonglong)

                         CONCAT24(uVar6 - (((ushort)(uVar6 * sVar19) >> 8) -

                                          ((ushort)((short)(uVar17 >> 0x20) * sVar19) >> 8)),

                                  CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar17 >> 0x10) * sVar19) >> 8

                                                    )),

                                           (uVar8 & 0xff) -

                                           (((ushort)((uVar8 & 0xff) * sVar19) >> 8) -

                                           ((ushort)((short)uVar17 * sVar19) >> 8))));

              }

              sVar19 = (short)uVar17;

              sVar21 = (short)(uVar17 >> 0x10);

              sVar5 = (short)(uVar17 >> 0x20);

              pbVar10[-5] = (0 < sVar19) * (sVar19 < 0x100) * (char)uVar17 - (0xff < sVar19);

              pbVar10[-4] = (0 < sVar21) * (sVar21 < 0x100) * (char)(uVar17 >> 0x10) -

                            (0xff < sVar21);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar17 >> 0x20) - (0xff < sVar5);

            }

            iVar13 = iVar13 + -1;

            pbVar10 = pbVar11;

          } while (iVar13 != 0);

        }

        iVar12 = iVar12 - iVar16;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  else {

    iVar16 = (uint)*(byte *)(param_1 + 0x24) + (uint)(*(byte *)(param_1 + 0x24) != 0);

    local_18 = *(int *)(param_1 + 0x20);

    if (local_18 != 0) {

      iVar13 = *(int *)(param_1 + 0x1c);

      iVar3 = *(int *)(param_1 + 0xc);

      iVar4 = *(int *)(param_1 + 0x18);

      do {

        if (iVar13 != 0) {

          pbVar10 = (byte *)(iVar13 * 3 + 2 + iVar12);

          iVar15 = iVar13;

          do {

            iVar1 = iVar15 * 4;

            iVar15 = iVar15 + -1;

            pbVar11 = pbVar10 + -3;

            uVar9 = (*(uint *)(iVar14 + -4 + iVar1) & 0xff000000 | DAT_008f86b0) >> 0x18;

            if (iVar16 != 0x100) {

              uVar9 = (int)(uVar9 * iVar16) >> 8;

            }

            if (uVar9 != 0) {

              uVar8 = *(ushort *)(pbVar10 + -5);

              uVar6 = (ushort)(((uint5)*pbVar11 << 0x20) >> 0x18);

              uVar7 = CONCAT23(uVar6,CONCAT12((char)(uVar8 >> 8),uVar8));

              uVar17 = (ulonglong)CONCAT52(uVar7 >> 0x10,uVar8) & 0xff00ff00ff;

              uVar20 = (ushort)(uVar17 >> 0x10);

              uVar23 = CONCAT24(-(ushort)(uVar20 < (ushort)(uVar17 >> 0x20)),

                                CONCAT22(-(ushort)((ushort)uVar17 < uVar20),

                                         -(ushort)((ushort)uVar17 != 0)));

              uVar24 = ~(ulonglong)uVar23 & uVar17 << 0x10;

              uVar17 = uVar17 & uVar23;

              uVar18 = uVar17 | uVar24;

              uVar20 = (ushort)(uVar18 >> 0x20);

              uVar22 = (ushort)uVar17;

              uVar17 = (ulonglong)

                       CONCAT24(-(ushort)(uVar22 < uVar20),

                                CONCAT22(-(ushort)((ushort)(uVar24 >> 0x30) <

                                                  (ushort)(uVar18 >> 0x10)),

                                         -(ushort)(uVar20 < uVar22)));

              uVar17 = uVar18 & uVar17 | ~uVar17 & (uVar18 << 0x20 | uVar18 >> 0x20) & 0xff00ff00ff;

              if (uVar9 + 1 != 0x100) {

                sVar19 = (short)(uVar9 + 1);

                sVar21 = (short)(uVar7 >> 0x10);

                uVar6 = uVar6 >> 8;

                uVar17 = (ulonglong)

                         CONCAT24(uVar6 - (((ushort)(uVar6 * sVar19) >> 8) -

                                          ((ushort)((short)(uVar17 >> 0x20) * sVar19) >> 8)),

                                  CONCAT22(sVar21 - (((ushort)(sVar21 * sVar19) >> 8) -

                                                    ((ushort)((short)(uVar17 >> 0x10) * sVar19) >> 8

                                                    )),

                                           (uVar8 & 0xff) -

                                           (((ushort)((uVar8 & 0xff) * sVar19) >> 8) -

                                           ((ushort)((short)uVar17 * sVar19) >> 8))));

              }

              sVar19 = (short)uVar17;

              sVar21 = (short)(uVar17 >> 0x10);

              sVar5 = (short)(uVar17 >> 0x20);

              pbVar10[-5] = (0 < sVar19) * (sVar19 < 0x100) * (char)uVar17 - (0xff < sVar19);

              pbVar10[-4] = (0 < sVar21) * (sVar21 < 0x100) * (char)(uVar17 >> 0x10) -

                            (0xff < sVar21);

              *pbVar11 = (0 < sVar5) * (sVar5 < 0x100) * (char)(uVar17 >> 0x20) - (0xff < sVar5);

            }

            pbVar10 = pbVar11;

          } while (iVar15 != 0);

        }

        iVar14 = iVar14 + iVar3;

        iVar12 = iVar12 + iVar4;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066cd10 at 0x0066CD10 (size: 567) ---


void FUN_0066cd10(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int in_EAX;

  uint *puVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  ushort uVar10;

  short sVar11;

  undefined1 uVar14;

  short sVar15;

  short sVar17;

  ulonglong uVar12;

  short sVar18;

  undefined8 uVar19;

  short sVar20;

  undefined2 uVar21;

  undefined1 uVar24;

  ulonglong uVar22;

  float fVar25;

  float fVar26;

  float fVar27;

  float fVar28;

  float fVar29;

  float fVar30;

  undefined1 auVar31 [16];

  undefined1 auVar32 [16];

  undefined4 local_4c;

  int local_48;

  int local_40;

  int local_38;

  undefined1 uVar13;

  uint5 uVar16;

  undefined1 uVar23;

  

  local_48 = *(int *)(in_EAX + 8);

  iVar8 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_38 = *(int *)(in_EAX + 0x20);

    iVar5 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_38 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          puVar4 = (uint *)(iVar8 + iVar1 * 4);

          local_40 = iVar1;

          do {

            uVar9 = *(uint *)((local_48 - iVar8) + -4 + (int)puVar4);

            puVar4 = puVar4 + -1;

            uVar6 = uVar9 >> 0x18;

            if (iVar5 != 0x100) {

              uVar6 = (int)(uVar6 * iVar5) >> 8;

            }

            if (uVar6 != 0) {

              iVar7 = uVar6 + 1;

              if (iVar7 != 0x100) {

                uVar6 = *puVar4;

                local_4c._3_1_ = (byte)(uVar6 >> 0x18);

                if (local_4c._3_1_ != 0) {

                  uVar14 = (undefined1)(uVar6 >> 0x10);

                  uVar24 = (undefined1)(uVar9 >> 0x10);

                  uVar13 = (undefined1)(uVar6 >> 8);

                  uVar10 = (ushort)uVar6;

                  uVar23 = (undefined1)(uVar9 >> 8);

                  uVar21 = (undefined2)uVar9;

                  if (local_4c._3_1_ == 0xff) {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar14,uVar6)) >> 0x20),

                                            uVar6) >> 0x18);

                    uVar16 = (uint5)uVar6 & 0xffffffff00;

                    uVar12 = (ulonglong)CONCAT43(uVar6,CONCAT12(uVar13,uVar10)) & 0xffffffff00ffffff

                    ;

                    uVar22 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar24,uVar9) >> 0x18),

                                               CONCAT12(uVar23,uVar21)) >> 0x10,uVar21) &

                             0xff00ff00ff;

                    sVar20 = (short)iVar7;

                    sVar15 = (short)(uVar12 >> 0x10);

                    sVar17 = (short)(uVar16 >> 8);

                    sVar18 = (short)(uVar16 >> 0x18);

                    sVar11 = (uVar10 & 0xff) -

                             (((ushort)((uVar10 & 0xff) * sVar20) >> 8) -

                             ((ushort)((short)uVar22 * sVar20) >> 8));

                    sVar15 = sVar15 - (((ushort)(sVar15 * sVar20) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x10) * sVar20) >> 8));

                    sVar17 = sVar17 - (((ushort)(sVar17 * sVar20) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x20) * sVar20) >> 8));

                    sVar18 = sVar18 - (((ushort)(sVar18 * sVar20) >> 8) -

                                      ((ushort)((short)(uVar12 >> 0x30) * sVar20) >> 8));

                    uVar9 = CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 -

                                     (0xff < sVar18),

                                     CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                              (0xff < sVar17),

                                              CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                                       (char)sVar15 - (0xff < sVar15),

                                                       (0 < sVar11) * (sVar11 < 0x100) *

                                                       (char)sVar11 - (0xff < sVar11))));

                  }

                  else {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_4c._3_1_ << 0x30)

                                                                   >> 0x28),CONCAT14(uVar14,uVar6))

                                                  >> 0x20),uVar6) >> 0x18);

                    uVar16 = (uint5)uVar6 & 0xffffffff00;

                    uVar12 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar6,CONCAT12(uVar13,uVar10)) >> 0x10),uVar10

                                     ) & 0xffffffff00ff00ff;

                    fVar25 = (float)(ushort)(uVar16 >> 8);

                    fVar27 = (float)(ushort)(uVar16 >> 0x18);

                    fVar26 = (float)((uint)uVar12 & 0xffff);

                    fVar28 = (float)(ushort)(uVar12 >> 0x10);

                    uVar9 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar9 >> 0x18) <<

                                                                    0x30) >> 0x28),

                                                            CONCAT14(uVar24,uVar9)) >> 0x20),uVar9)

                                  >> 0x18);

                    uVar16 = (uint5)uVar9 & 0xffffffff00;

                    uVar12 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar9,CONCAT12(uVar23,uVar21)) >> 0x10),uVar21

                                     ) & 0xffffffff00ff00ff;

                    fVar29 = (float)iVar7;

                    iVar7 = local_4c._3_1_ + 1 +

                            (iVar7 - ((int)((local_4c._3_1_ + 1) * iVar7) >> 8));

                    fVar30 = (float)iVar7;

                    auVar32._4_4_ = fVar30;

                    auVar32._0_4_ = fVar30;

                    auVar31._0_4_ = (fVar26 - (float)((uint)uVar12 & 0xffff)) * fVar29;

                    auVar31._4_4_ = (fVar28 - (float)(ushort)(uVar12 >> 0x10)) * fVar29;

                    auVar31._8_4_ = (fVar25 - (float)(ushort)(uVar16 >> 8)) * fVar29;

                    auVar31._12_4_ = (fVar27 - (float)(ushort)(uVar16 >> 0x18)) * fVar29;

                    auVar32._8_4_ = fVar30;

                    auVar32._12_4_ = fVar30;

                    auVar32 = divps(auVar31,auVar32);

                    uVar19 = packssdw(CONCAT44(ROUND(fVar28 - auVar32._4_4_),

                                               ROUND(fVar26 - auVar32._0_4_)),

                                      CONCAT44(ROUND(fVar27 - auVar32._12_4_),

                                               ROUND(fVar25 - auVar32._8_4_)));

                    sVar11 = (short)uVar19;

                    sVar15 = (short)((ulonglong)uVar19 >> 0x10);

                    sVar17 = (short)((ulonglong)uVar19 >> 0x20);

                    local_4c = CONCAT13((char)iVar7 + -1,

                                        CONCAT12((0 < sVar17) * (sVar17 < 0x100) *

                                                 (char)((ulonglong)uVar19 >> 0x20) - (0xff < sVar17)

                                                 ,CONCAT11((0 < sVar15) * (sVar15 < 0x100) *

                                                           (char)((ulonglong)uVar19 >> 0x10) -

                                                           (0xff < sVar15),

                                                           (0 < sVar11) * (sVar11 < 0x100) *

                                                           (char)uVar19 - (0xff < sVar11))));

                    uVar9 = local_4c;

                  }

                }

              }

              *puVar4 = uVar9;

            }

            local_40 = local_40 + -1;

          } while (local_40 != 0);

        }

        local_48 = local_48 + iVar2;

        iVar8 = iVar8 + iVar3;

        local_38 = local_38 + -1;

      } while (local_38 != 0);

    }

  }

  return;

}





// --- FUN_0066cf50 at 0x0066CF50 (size: 512) ---


void FUN_0066cf50(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  int in_EAX;

  uint uVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  int iVar9;

  int iVar10;

  uint *puVar11;

  byte bVar15;

  ushort uVar12;

  short sVar13;

  byte bVar16;

  short sVar17;

  short sVar19;

  uint5 uVar18;

  short sVar20;

  short sVar21;

  byte bVar23;

  byte bVar24;

  ulonglong uVar22;

  undefined4 local_44;

  int local_3c;

  int local_38;

  int local_2c;

  ulonglong uVar14;

  

  local_3c = *(int *)(in_EAX + 8);

  iVar10 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_2c = *(int *)(in_EAX + 0x20);

    iVar7 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_2c != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          puVar11 = (uint *)(iVar10 + iVar1 * 4);

          local_38 = iVar1;

          do {

            uVar5 = *(uint *)((local_3c - iVar10) + -4 + (int)puVar11);

            puVar11 = puVar11 + -1;

            uVar8 = uVar5 >> 0x18;

            if (iVar7 != 0x100) {

              uVar8 = (int)(uVar8 * iVar7) >> 8;

            }

            if (uVar8 != 0) {

              iVar9 = uVar8 + 1;

              if (iVar9 != 0x100) {

                uVar8 = *puVar11;

                local_44._3_1_ = (byte)(uVar8 >> 0x18);

                if (local_44._3_1_ != 0) {

                  bVar15 = (byte)(uVar8 >> 8);

                  bVar16 = (byte)(uVar8 >> 0x10);

                  bVar23 = (byte)(uVar5 >> 8);

                  bVar24 = (byte)(uVar5 >> 0x10);

                  if (local_44._3_1_ == 0xff) {

                    uVar4 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar16,uVar8)) >> 0x20),

                                            uVar8) >> 0x18);

                    uVar18 = (uint5)uVar4 & 0xffffffff00;

                    uVar14 = (ulonglong)CONCAT43(uVar4,CONCAT12(bVar15,(ushort)uVar8)) &

                             0xffffffff00ffffff;

                    uVar12 = (ushort)uVar8 & 0xff;

                    uVar22 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(bVar24,uVar5) >> 0x18),

                                               CONCAT12(bVar23,(short)uVar5)) >> 0x10,(short)uVar5)

                             & 0xff00ff00ff;

                    sVar21 = (short)iVar9;

                    sVar17 = (short)(uVar14 >> 0x10);

                    sVar19 = (short)(uVar18 >> 8);

                    sVar20 = (short)(uVar18 >> 0x18);

                    sVar13 = uVar12 - (((ushort)(uVar12 * sVar21) >> 8) -

                                      ((ushort)((short)uVar22 * sVar21) >> 8));

                    sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar14 >> 0x30) * sVar21) >> 8));

                    uVar5 = CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 -

                                     (0xff < sVar20),

                                     CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                              (0xff < sVar19),

                                              CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                       (char)sVar17 - (0xff < sVar17),

                                                       (0 < sVar13) * (sVar13 < 0x100) *

                                                       (char)sVar13 - (0xff < sVar13))));

                  }

                  else {

                    iVar6 = local_44._3_1_ + 1 +

                            (iVar9 - ((int)((local_44._3_1_ + 1) * iVar9) >> 8));

                    local_44._0_1_ = (char)uVar8;

                    local_44 = CONCAT13((char)iVar6 + -1,

                                        CONCAT21(CONCAT11(bVar16 - (char)((int)(((uint)bVar16 -

                                                                                (uint)bVar24) *

                                                                               iVar9) / iVar6),

                                                          bVar15 - (char)((int)(((uint)bVar15 -

                                                                                (uint)bVar23) *

                                                                               iVar9) / iVar6)),

                                                 (char)local_44 -

                                                 (char)((int)(((uVar8 & 0xff) - (uVar5 & 0xff)) *

                                                             iVar9) / iVar6)));

                    uVar5 = local_44;

                  }

                }

              }

              *puVar11 = uVar5;

            }

            local_38 = local_38 + -1;

          } while (local_38 != 0);

        }

        local_3c = local_3c + iVar2;

        iVar10 = iVar10 + iVar3;

        local_2c = local_2c + -1;

      } while (local_2c != 0);

    }

  }

  return;

}





// --- FUN_0066d150 at 0x0066D150 (size: 321) ---


void FUN_0066d150(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  int in_EAX;

  uint uVar5;

  uint *puVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  ushort uVar10;

  short sVar11;

  short sVar12;

  short sVar13;

  short sVar14;

  ushort uVar16;

  ulonglong uVar15;

  int local_30;

  int local_28;

  int local_20;

  

  local_30 = *(int *)(in_EAX + 8);

  iVar7 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_20 = *(int *)(in_EAX + 0x20);

    iVar8 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_20 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          puVar6 = (uint *)(iVar7 + iVar1 * 4);

          local_28 = iVar1;

          do {

            uVar9 = *(uint *)((local_30 - iVar7) + -4 + (int)puVar6);

            puVar6 = puVar6 + -1;

            uVar5 = uVar9 >> 0x18;

            if (iVar8 != 0x100) {

              uVar5 = (int)(uVar5 * iVar8) >> 8;

            }

            if (uVar5 != 0) {

              if (uVar5 + 1 != 0x100) {

                uVar4 = *puVar6;

                uVar10 = (ushort)uVar4 & 0xff;

                uVar15 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(uVar9 >> 0x10),uVar9) >> 0x18),

                                           CONCAT12((char)(uVar9 >> 8),(short)uVar9)) >> 0x10,

                                  (short)uVar9) & 0xff00ff00ff;

                sVar14 = (short)(uVar5 + 1);

                uVar16 = (ushort)(byte)(uVar4 >> 8);

                sVar13 = (short)CONCAT21(0xff00,(char)(uVar4 >> 0x10));

                sVar11 = uVar10 - (((ushort)(uVar10 * sVar14) >> 8) -

                                  ((ushort)((short)uVar15 * sVar14) >> 8));

                sVar12 = uVar16 - (((ushort)(uVar16 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x10) * sVar14) >> 8));

                sVar13 = sVar13 - (((ushort)(sVar13 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x20) * sVar14) >> 8));

                sVar14 = 0xff - (((ushort)(sVar14 * 0xff) >> 8) - ((ushort)(sVar14 * 0xff) >> 8));

                uVar9 = CONCAT13((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 - (0xff < sVar14),

                                 CONCAT12((0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                          (0xff < sVar13),

                                          CONCAT11((0 < sVar12) * (sVar12 < 0x100) * (char)sVar12 -

                                                   (0xff < sVar12),

                                                   (0 < sVar11) * (sVar11 < 0x100) * (char)sVar11 -

                                                   (0xff < sVar11))));

              }

              *puVar6 = uVar9;

            }

            local_28 = local_28 + -1;

          } while (local_28 != 0);

        }

        local_30 = local_30 + iVar2;

        iVar7 = iVar7 + iVar3;

        local_20 = local_20 + -1;

      } while (local_20 != 0);

    }

  }

  return;

}





// --- FUN_0066d2a0 at 0x0066D2A0 (size: 370) ---


void FUN_0066d2a0(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  ushort uVar4;

  ushort uVar5;

  int in_EAX;

  uint uVar6;

  byte *pbVar7;

  byte *pbVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  short sVar12;

  short sVar13;

  short sVar14;

  ulonglong uVar15;

  uint local_30;

  int local_2c;

  int local_24;

  

  local_2c = *(int *)(in_EAX + 8);

  iVar9 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_24 = *(int *)(in_EAX + 0x20);

    iVar10 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_24 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar7 = (byte *)(iVar1 * 3 + 2 + iVar9);

          iVar11 = iVar1;

          do {

            local_30 = *(uint *)(local_2c + -4 + iVar11 * 4);

            iVar11 = iVar11 + -1;

            pbVar8 = pbVar7 + -3;

            uVar6 = local_30 >> 0x18;

            if (iVar10 != 0x100) {

              uVar6 = (int)(uVar6 * iVar10) >> 8;

            }

            if (uVar6 != 0) {

              if (uVar6 + 1 != 0x100) {

                uVar5 = *(ushort *)(pbVar7 + -5);

                uVar4 = (ushort)(((uint5)*pbVar8 << 0x20) >> 0x18);

                uVar15 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(local_30 >> 0x10),local_30) >>

                                                  0x18),

                                           CONCAT12((char)(local_30 >> 8),(short)local_30)) >> 0x10,

                                  (short)local_30) & 0xff00ff00ff;

                sVar14 = (short)(uVar6 + 1);

                sVar13 = (short)(CONCAT23(uVar4,CONCAT12((char)(uVar5 >> 8),uVar5)) >> 0x10);

                uVar4 = uVar4 >> 8;

                sVar12 = (uVar5 & 0xff) -

                         (((ushort)((uVar5 & 0xff) * sVar14) >> 8) -

                         ((ushort)((short)uVar15 * sVar14) >> 8));

                sVar13 = sVar13 - (((ushort)(sVar13 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x10) * sVar14) >> 8));

                sVar14 = uVar4 - (((ushort)(uVar4 * sVar14) >> 8) -

                                 ((ushort)((short)(uVar15 >> 0x20) * sVar14) >> 8));

                local_30 = (uint)CONCAT12((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                          (0xff < sVar14),

                                          CONCAT11((0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                                   (0xff < sVar13),

                                                   (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12 -

                                                   (0xff < sVar12)));

              }

              pbVar7[-5] = (byte)local_30;

              pbVar7[-4] = (byte)(local_30 >> 8);

              *pbVar8 = (byte)(local_30 >> 0x10);

            }

            pbVar7 = pbVar8;

          } while (iVar11 != 0);

        }

        local_2c = local_2c + iVar2;

        iVar9 = iVar9 + iVar3;

        local_24 = local_24 + -1;

      } while (local_24 != 0);

    }

  }

  return;

}





// --- FUN_0066d420 at 0x0066D420 (size: 573) ---


void FUN_0066d420(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  uint uVar6;

  int in_EAX;

  undefined4 *puVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  ushort uVar11;

  short sVar12;

  undefined1 uVar15;

  short sVar16;

  short sVar18;

  ulonglong uVar13;

  short sVar19;

  undefined8 uVar20;

  short sVar21;

  undefined2 uVar22;

  undefined1 uVar25;

  ulonglong uVar23;

  float fVar26;

  float fVar27;

  float fVar28;

  float fVar29;

  float fVar30;

  float fVar31;

  undefined1 auVar32 [16];

  undefined1 auVar33 [16];

  undefined4 local_4c;

  undefined4 local_48;

  int local_44;

  int local_40;

  int local_34;

  undefined1 uVar14;

  uint5 uVar17;

  undefined1 uVar24;

  

  local_44 = *(int *)(in_EAX + 8);

  iVar9 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_34 = *(int *)(in_EAX + 0x20);

    iVar10 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_34 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          puVar7 = (undefined4 *)(iVar9 + iVar1 * 4);

          local_40 = iVar1;

          do {

            uVar4 = *(undefined4 *)((local_44 - iVar9) + -4 + (int)puVar7);

            puVar7 = puVar7 + -1;

            local_4c = CONCAT13(0xff,(int3)uVar4);

            iVar8 = 0xff;

            if ((iVar10 == 0x100) || (iVar8 = iVar10 * 0xff >> 8, iVar8 != 0)) {

              iVar8 = iVar8 + 1;

              if (iVar8 != 0x100) {

                uVar5 = *puVar7;

                local_48._3_1_ = (byte)((uint)uVar5 >> 0x18);

                if (local_48._3_1_ != 0) {

                  uVar15 = (undefined1)((uint)uVar5 >> 0x10);

                  uVar14 = (undefined1)((uint)uVar5 >> 8);

                  uVar11 = (ushort)uVar5;

                  uVar24 = (undefined1)((uint)uVar4 >> 8);

                  uVar25 = (undefined1)((uint)uVar4 >> 0x10);

                  uVar22 = (undefined2)uVar4;

                  if (local_48._3_1_ == 0xff) {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar15,uVar5)) >> 0x20),

                                            uVar5) >> 0x18);

                    uVar17 = (uint5)uVar6 & 0xffffffff00;

                    uVar13 = (ulonglong)CONCAT43(uVar6,CONCAT12(uVar14,uVar11)) & 0xffffffff00ffffff

                    ;

                    uVar23 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar25,local_4c) >> 0x18),

                                               CONCAT12(uVar24,uVar22)) >> 0x10,uVar22) &

                             0xff00ff00ff;

                    sVar21 = (short)iVar8;

                    sVar16 = (short)(uVar13 >> 0x10);

                    sVar18 = (short)(uVar17 >> 8);

                    sVar19 = (short)(uVar17 >> 0x18);

                    sVar12 = (uVar11 & 0xff) -

                             (((ushort)((uVar11 & 0xff) * sVar21) >> 8) -

                             ((ushort)((short)uVar23 * sVar21) >> 8));

                    sVar16 = sVar16 - (((ushort)(sVar16 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar23 >> 0x10) * sVar21) >> 8));

                    sVar18 = sVar18 - (((ushort)(sVar18 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar23 >> 0x20) * sVar21) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar13 >> 0x30) * sVar21) >> 8));

                    local_4c = CONCAT13((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                        (0xff < sVar19),

                                        CONCAT12((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 -

                                                 (0xff < sVar18),

                                                 CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                                          (char)sVar16 - (0xff < sVar16),

                                                          (0 < sVar12) * (sVar12 < 0x100) *

                                                          (char)sVar12 - (0xff < sVar12))));

                  }

                  else {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_48._3_1_ << 0x30)

                                                                   >> 0x28),CONCAT14(uVar15,uVar5))

                                                  >> 0x20),uVar5) >> 0x18);

                    uVar17 = (uint5)uVar6 & 0xffffffff00;

                    uVar13 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar6,CONCAT12(uVar14,uVar11)) >> 0x10),uVar11

                                     ) & 0xffffffff00ff00ff;

                    fVar26 = (float)(ushort)(uVar17 >> 8);

                    fVar28 = (float)(ushort)(uVar17 >> 0x18);

                    fVar27 = (float)((uint)uVar13 & 0xffff);

                    fVar29 = (float)(ushort)(uVar13 >> 0x10);

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar25,local_4c)) >>

                                                  0x20),local_4c) >> 0x18);

                    uVar17 = (uint5)uVar6 & 0xffffffff00;

                    uVar13 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar6,CONCAT12(uVar24,uVar22)) >> 0x10),uVar22

                                     ) & 0xffffffff00ff00ff;

                    fVar30 = (float)iVar8;

                    iVar8 = local_48._3_1_ + 1 +

                            (iVar8 - ((int)((local_48._3_1_ + 1) * iVar8) >> 8));

                    fVar31 = (float)iVar8;

                    auVar33._4_4_ = fVar31;

                    auVar33._0_4_ = fVar31;

                    auVar32._0_4_ = (fVar27 - (float)((uint)uVar13 & 0xffff)) * fVar30;

                    auVar32._4_4_ = (fVar29 - (float)(ushort)(uVar13 >> 0x10)) * fVar30;

                    auVar32._8_4_ = (fVar26 - (float)(ushort)(uVar17 >> 8)) * fVar30;

                    auVar32._12_4_ = (fVar28 - (float)(ushort)(uVar17 >> 0x18)) * fVar30;

                    auVar33._8_4_ = fVar31;

                    auVar33._12_4_ = fVar31;

                    auVar33 = divps(auVar32,auVar33);

                    uVar20 = packssdw(CONCAT44(ROUND(fVar29 - auVar33._4_4_),

                                               ROUND(fVar27 - auVar33._0_4_)),

                                      CONCAT44(ROUND(fVar28 - auVar33._12_4_),

                                               ROUND(fVar26 - auVar33._8_4_)));

                    sVar12 = (short)uVar20;

                    sVar16 = (short)((ulonglong)uVar20 >> 0x10);

                    sVar18 = (short)((ulonglong)uVar20 >> 0x20);

                    local_48 = CONCAT13((char)iVar8 + -1,

                                        CONCAT12((0 < sVar18) * (sVar18 < 0x100) *

                                                 (char)((ulonglong)uVar20 >> 0x20) - (0xff < sVar18)

                                                 ,CONCAT11((0 < sVar16) * (sVar16 < 0x100) *

                                                           (char)((ulonglong)uVar20 >> 0x10) -

                                                           (0xff < sVar16),

                                                           (0 < sVar12) * (sVar12 < 0x100) *

                                                           (char)uVar20 - (0xff < sVar12))));

                    local_4c = local_48;

                  }

                }

              }

              *puVar7 = local_4c;

            }

            local_40 = local_40 + -1;

          } while (local_40 != 0);

        }

        local_44 = local_44 + iVar2;

        iVar9 = iVar9 + iVar3;

        local_34 = local_34 + -1;

      } while (local_34 != 0);

    }

  }

  return;

}





// --- FUN_0066d660 at 0x0066D660 (size: 522) ---


void FUN_0066d660(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  uint uVar6;

  int in_EAX;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  uint *puVar11;

  byte bVar15;

  ushort uVar12;

  short sVar13;

  byte bVar16;

  short sVar17;

  short sVar19;

  uint5 uVar18;

  short sVar20;

  short sVar21;

  byte bVar23;

  byte bVar24;

  ulonglong uVar22;

  undefined4 local_44;

  undefined4 local_40;

  int local_3c;

  int local_38;

  int local_28;

  ulonglong uVar14;

  

  local_3c = *(int *)(in_EAX + 8);

  iVar10 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_28 = *(int *)(in_EAX + 0x20);

    iVar8 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_28 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          puVar11 = (uint *)(iVar10 + iVar1 * 4);

          local_38 = iVar1;

          do {

            uVar4 = *(uint *)((local_3c - iVar10) + -4 + (int)puVar11);

            puVar11 = puVar11 + -1;

            local_40 = CONCAT13(0xff,(int3)uVar4);

            iVar9 = 0xff;

            if ((iVar8 == 0x100) || (iVar9 = iVar8 * 0xff >> 8, iVar9 != 0)) {

              iVar9 = iVar9 + 1;

              if (iVar9 != 0x100) {

                uVar5 = *puVar11;

                local_44._3_1_ = (byte)(uVar5 >> 0x18);

                if (local_44._3_1_ != 0) {

                  bVar15 = (byte)(uVar5 >> 8);

                  bVar16 = (byte)(uVar5 >> 0x10);

                  bVar23 = (byte)(uVar4 >> 8);

                  bVar24 = (byte)(uVar4 >> 0x10);

                  if (local_44._3_1_ == 0xff) {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar16,uVar5)) >> 0x20),

                                            uVar5) >> 0x18);

                    uVar18 = (uint5)uVar6 & 0xffffffff00;

                    uVar14 = (ulonglong)CONCAT43(uVar6,CONCAT12(bVar15,(ushort)uVar5)) &

                             0xffffffff00ffffff;

                    uVar12 = (ushort)uVar5 & 0xff;

                    uVar22 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(bVar24,local_40) >> 0x18),

                                               CONCAT12(bVar23,(short)uVar4)) >> 0x10,(short)uVar4)

                             & 0xff00ff00ff;

                    sVar21 = (short)iVar9;

                    sVar17 = (short)(uVar14 >> 0x10);

                    sVar19 = (short)(uVar18 >> 8);

                    sVar20 = (short)(uVar18 >> 0x18);

                    sVar13 = uVar12 - (((ushort)(uVar12 * sVar21) >> 8) -

                                      ((ushort)((short)uVar22 * sVar21) >> 8));

                    sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar14 >> 0x30) * sVar21) >> 8));

                    local_40 = CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 -

                                        (0xff < sVar20),

                                        CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                                 (0xff < sVar19),

                                                 CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                          (char)sVar17 - (0xff < sVar17),

                                                          (0 < sVar13) * (sVar13 < 0x100) *

                                                          (char)sVar13 - (0xff < sVar13))));

                  }

                  else {

                    iVar7 = local_44._3_1_ + 1 +

                            (iVar9 - ((int)((local_44._3_1_ + 1) * iVar9) >> 8));

                    local_44._0_1_ = (char)uVar5;

                    local_44 = CONCAT13((char)iVar7 + -1,

                                        CONCAT21(CONCAT11(bVar16 - (char)((int)(((uint)bVar16 -

                                                                                (uint)bVar24) *

                                                                               iVar9) / iVar7),

                                                          bVar15 - (char)((int)(((uint)bVar15 -

                                                                                (uint)bVar23) *

                                                                               iVar9) / iVar7)),

                                                 (char)local_44 -

                                                 (char)((int)(((uVar5 & 0xff) - (uVar4 & 0xff)) *

                                                             iVar9) / iVar7)));

                    local_40 = local_44;

                  }

                }

              }

              *puVar11 = local_40;

            }

            local_38 = local_38 + -1;

          } while (local_38 != 0);

        }

        local_3c = local_3c + iVar2;

        iVar10 = iVar10 + iVar3;

        local_28 = local_28 + -1;

      } while (local_28 != 0);

    }

  }

  return;

}





// --- FUN_0066d870 at 0x0066D870 (size: 342) ---


void FUN_0066d870(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  undefined4 uVar4;

  undefined4 uVar5;

  int in_EAX;

  int iVar6;

  undefined4 *puVar7;

  int iVar8;

  int iVar9;

  ushort uVar10;

  short sVar11;

  short sVar12;

  short sVar13;

  short sVar14;

  ushort uVar16;

  ulonglong uVar15;

  undefined4 local_34;

  int local_30;

  int local_28;

  int local_1c;

  

  local_30 = *(int *)(in_EAX + 8);

  iVar8 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_1c = *(int *)(in_EAX + 0x20);

    iVar9 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_1c != 0) {

      iVar1 = *(int *)(in_EAX + 0xc);

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          puVar7 = (undefined4 *)(iVar8 + iVar2 * 4);

          local_28 = iVar2;

          do {

            uVar4 = *(undefined4 *)((local_30 - iVar8) + -4 + (int)puVar7);

            puVar7 = puVar7 + -1;

            local_34 = CONCAT13(0xff,(int3)uVar4);

            iVar6 = 0xff;

            if ((iVar9 == 0x100) || (iVar6 = iVar9 * 0xff >> 8, iVar6 != 0)) {

              if (iVar6 + 1 != 0x100) {

                uVar5 = *puVar7;

                uVar10 = (ushort)uVar5 & 0xff;

                uVar15 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)((uint)uVar4 >> 0x10),local_34) >>

                                                  0x18),

                                           CONCAT12((char)((uint)uVar4 >> 8),(short)uVar4)) >> 0x10,

                                  (short)uVar4) & 0xff00ff00ff;

                sVar14 = (short)(iVar6 + 1);

                uVar16 = (ushort)(byte)((uint)uVar5 >> 8);

                sVar13 = (short)CONCAT21(0xff00,(char)((uint)uVar5 >> 0x10));

                sVar11 = uVar10 - (((ushort)(uVar10 * sVar14) >> 8) -

                                  ((ushort)((short)uVar15 * sVar14) >> 8));

                sVar12 = uVar16 - (((ushort)(uVar16 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x10) * sVar14) >> 8));

                sVar13 = sVar13 - (((ushort)(sVar13 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x20) * sVar14) >> 8));

                sVar14 = 0xff - (((ushort)(sVar14 * 0xff) >> 8) - ((ushort)(sVar14 * 0xff) >> 8));

                local_34 = CONCAT13((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 - (0xff < sVar14)

                                    ,CONCAT12((0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                              (0xff < sVar13),

                                              CONCAT11((0 < sVar12) * (sVar12 < 0x100) *

                                                       (char)sVar12 - (0xff < sVar12),

                                                       (0 < sVar11) * (sVar11 < 0x100) *

                                                       (char)sVar11 - (0xff < sVar11))));

              }

              *puVar7 = local_34;

            }

            local_28 = local_28 + -1;

          } while (local_28 != 0);

        }

        local_30 = local_30 + iVar1;

        iVar8 = iVar8 + iVar3;

        local_1c = local_1c + -1;

      } while (local_1c != 0);

    }

  }

  return;

}





// --- FUN_0066d9d0 at 0x0066D9D0 (size: 360) ---


void FUN_0066d9d0(void)



{

  int iVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  ushort uVar5;

  ushort uVar6;

  int in_EAX;

  int iVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  short sVar14;

  short sVar15;

  short sVar16;

  ulonglong uVar17;

  uint local_28;

  int local_20;

  

  iVar10 = *(int *)(in_EAX + 0x14);

  iVar11 = *(int *)(in_EAX + 8);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_20 = *(int *)(in_EAX + 0x20);

    iVar13 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_20 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0xc);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          pbVar8 = (byte *)(iVar1 * 3 + 2 + iVar10);

          iVar12 = iVar1;

          do {

            uVar4 = *(uint *)(iVar11 + -4 + iVar12 * 4);

            iVar12 = iVar12 + -1;

            pbVar9 = pbVar8 + -3;

            local_28 = uVar4 & 0xffffff;

            iVar7 = 0xff;

            if ((iVar13 == 0x100) || (iVar7 = iVar13 * 0xff >> 8, iVar7 != 0)) {

              if (iVar7 + 1 != 0x100) {

                uVar6 = *(ushort *)(pbVar8 + -5);

                uVar5 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

                uVar17 = (ulonglong)

                         (CONCAT52(CONCAT23((short)(CONCAT14((char)(local_28 >> 0x10),uVar4) >> 0x18

                                                   ),CONCAT12((char)(local_28 >> 8),(short)local_28)

                                           ) >> 0x10,(short)local_28) & 0xff00ffffff) & 0xff00ff00ff

                ;

                sVar16 = (short)(iVar7 + 1);

                sVar15 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar14 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar16) >> 8) -

                         ((ushort)((short)uVar17 * sVar16) >> 8));

                sVar15 = sVar15 - (((ushort)(sVar15 * sVar16) >> 8) -

                                  ((ushort)((short)(uVar17 >> 0x10) * sVar16) >> 8));

                sVar16 = uVar5 - (((ushort)(uVar5 * sVar16) >> 8) -

                                 ((ushort)((short)(uVar17 >> 0x20) * sVar16) >> 8));

                local_28 = (uint)CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                          (0xff < sVar16),

                                          CONCAT11((0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                   (0xff < sVar15),

                                                   (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                                   (0xff < sVar14)));

              }

              pbVar8[-5] = (byte)local_28;

              pbVar8[-4] = (byte)(local_28 >> 8);

              *pbVar9 = (byte)(local_28 >> 0x10);

            }

            pbVar8 = pbVar9;

          } while (iVar12 != 0);

        }

        iVar11 = iVar11 + iVar2;

        iVar10 = iVar10 + iVar3;

        local_20 = local_20 + -1;

      } while (local_20 != 0);

    }

  }

  return;

}





// --- FUN_0066db40 at 0x0066DB40 (size: 588) ---


void FUN_0066db40(void)



{

  undefined3 *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  uint uVar6;

  undefined3 uVar7;

  int in_EAX;

  undefined4 uVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  undefined1 uVar18;

  short sVar19;

  short sVar21;

  ulonglong uVar16;

  short sVar22;

  undefined8 uVar23;

  short sVar24;

  undefined2 uVar25;

  undefined1 uVar28;

  ulonglong uVar26;

  float fVar29;

  float fVar30;

  float fVar31;

  float fVar32;

  float fVar33;

  float fVar34;

  undefined1 auVar35 [16];

  undefined1 auVar36 [16];

  undefined4 local_48;

  undefined4 local_44;

  undefined4 local_40;

  undefined4 local_38;

  undefined1 uVar17;

  uint5 uVar20;

  undefined1 uVar27;

  

  iVar10 = *(int *)(in_EAX + 8);

  local_40 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_38 = *(int *)(in_EAX + 0x20);

    iVar11 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_38 != 0) {

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0xc);

      iVar4 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          local_48 = 0xff000000;

          iVar13 = iVar2 * 3 + 2 + iVar10;

          iVar9 = iVar2;

          do {

            puVar1 = (undefined3 *)(iVar13 + -5);

            iVar13 = iVar13 + -3;

            iVar9 = iVar9 + -1;

            uVar7 = *puVar1;

            local_48 = CONCAT13(local_48._3_1_,uVar7);

            iVar12 = 0xff;

            if ((iVar11 == 0x100) || (iVar12 = iVar11 * 0xff >> 8, iVar12 != 0)) {

              iVar12 = iVar12 + 1;

              uVar8 = local_48;

              if (iVar12 != 0x100) {

                uVar5 = *(undefined4 *)(local_40 + iVar9 * 4);

                local_44._3_1_ = (byte)((uint)uVar5 >> 0x18);

                if (local_44._3_1_ != 0) {

                  uVar18 = (undefined1)((uint)uVar5 >> 0x10);

                  uVar17 = (undefined1)((uint)uVar5 >> 8);

                  uVar14 = (ushort)uVar5;

                  uVar27 = (undefined1)((uint3)uVar7 >> 8);

                  uVar28 = (undefined1)((uint3)uVar7 >> 0x10);

                  uVar25 = (undefined2)uVar7;

                  if (local_44._3_1_ == 0xff) {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar18,uVar5)) >> 0x20),

                                            uVar5) >> 0x18);

                    uVar20 = (uint5)uVar6 & 0xffffffff00;

                    uVar16 = (ulonglong)CONCAT43(uVar6,CONCAT12(uVar17,uVar14)) & 0xffffffff00ffffff

                    ;

                    uVar26 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar28,local_48) >> 0x18),

                                               CONCAT12(uVar27,uVar25)) >> 0x10,uVar25) &

                             0xff00ff00ff;

                    sVar24 = (short)iVar12;

                    sVar19 = (short)(uVar16 >> 0x10);

                    sVar21 = (short)(uVar20 >> 8);

                    sVar22 = (short)(uVar20 >> 0x18);

                    sVar15 = (uVar14 & 0xff) -

                             (((ushort)((uVar14 & 0xff) * sVar24) >> 8) -

                             ((ushort)((short)uVar26 * sVar24) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar26 >> 0x10) * sVar24) >> 8));

                    sVar21 = sVar21 - (((ushort)(sVar21 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar26 >> 0x20) * sVar24) >> 8));

                    sVar22 = sVar22 - (((ushort)(sVar22 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar16 >> 0x30) * sVar24) >> 8));

                    uVar8 = CONCAT13((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 -

                                     (0xff < sVar22),

                                     CONCAT12((0 < sVar21) * (sVar21 < 0x100) * (char)sVar21 -

                                              (0xff < sVar21),

                                              CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                       (char)sVar19 - (0xff < sVar19),

                                                       (0 < sVar15) * (sVar15 < 0x100) *

                                                       (char)sVar15 - (0xff < sVar15))));

                  }

                  else {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_44._3_1_ << 0x30)

                                                                   >> 0x28),CONCAT14(uVar18,uVar5))

                                                  >> 0x20),uVar5) >> 0x18);

                    uVar20 = (uint5)uVar6 & 0xffffffff00;

                    uVar16 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar6,CONCAT12(uVar17,uVar14)) >> 0x10),uVar14

                                     ) & 0xffffffff00ff00ff;

                    fVar29 = (float)(ushort)(uVar20 >> 8);

                    fVar31 = (float)(ushort)(uVar20 >> 0x18);

                    fVar30 = (float)((uint)uVar16 & 0xffff);

                    fVar32 = (float)(ushort)(uVar16 >> 0x10);

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_48._3_1_ << 0x30)

                                                                   >> 0x28),

                                                            CONCAT14(uVar28,local_48)) >> 0x20),

                                            local_48) >> 0x18);

                    uVar20 = (uint5)uVar6 & 0xffffffff00;

                    uVar16 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar6,CONCAT12(uVar27,uVar25)) >> 0x10),uVar25

                                     ) & 0xffffffff00ff00ff;

                    fVar33 = (float)iVar12;

                    iVar12 = local_44._3_1_ + 1 +

                             (iVar12 - ((int)((local_44._3_1_ + 1) * iVar12) >> 8));

                    fVar34 = (float)iVar12;

                    auVar36._4_4_ = fVar34;

                    auVar36._0_4_ = fVar34;

                    auVar35._0_4_ = (fVar30 - (float)((uint)uVar16 & 0xffff)) * fVar33;

                    auVar35._4_4_ = (fVar32 - (float)(ushort)(uVar16 >> 0x10)) * fVar33;

                    auVar35._8_4_ = (fVar29 - (float)(ushort)(uVar20 >> 8)) * fVar33;

                    auVar35._12_4_ = (fVar31 - (float)(ushort)(uVar20 >> 0x18)) * fVar33;

                    auVar36._8_4_ = fVar34;

                    auVar36._12_4_ = fVar34;

                    auVar36 = divps(auVar35,auVar36);

                    uVar23 = packssdw(CONCAT44(ROUND(fVar32 - auVar36._4_4_),

                                               ROUND(fVar30 - auVar36._0_4_)),

                                      CONCAT44(ROUND(fVar31 - auVar36._12_4_),

                                               ROUND(fVar29 - auVar36._8_4_)));

                    sVar15 = (short)uVar23;

                    sVar19 = (short)((ulonglong)uVar23 >> 0x10);

                    sVar21 = (short)((ulonglong)uVar23 >> 0x20);

                    local_44 = CONCAT13((char)iVar12 + -1,

                                        CONCAT12((0 < sVar21) * (sVar21 < 0x100) *

                                                 (char)((ulonglong)uVar23 >> 0x20) - (0xff < sVar21)

                                                 ,CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                           (char)((ulonglong)uVar23 >> 0x10) -

                                                           (0xff < sVar19),

                                                           (0 < sVar15) * (sVar15 < 0x100) *

                                                           (char)uVar23 - (0xff < sVar15))));

                    uVar8 = local_44;

                  }

                }

              }

              *(undefined4 *)(local_40 + iVar9 * 4) = uVar8;

            }

          } while (iVar9 != 0);

        }

        local_40 = local_40 + iVar4;

        iVar10 = iVar10 + iVar3;

        local_38 = local_38 + -1;

      } while (local_38 != 0);

    }

  }

  return;

}





// --- FUN_0066dd90 at 0x0066DD90 (size: 527) ---


void FUN_0066dd90(void)



{

  uint3 *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint3 uVar7;

  int in_EAX;

  undefined4 uVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  byte bVar18;

  ushort uVar15;

  short sVar16;

  byte bVar19;

  short sVar20;

  short sVar22;

  uint5 uVar21;

  short sVar23;

  short sVar24;

  byte bVar26;

  byte bVar27;

  ulonglong uVar25;

  undefined4 local_40;

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_30;

  ulonglong uVar17;

  

  iVar11 = *(int *)(in_EAX + 8);

  local_38 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_30 = *(int *)(in_EAX + 0x20);

    iVar12 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_30 != 0) {

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0xc);

      iVar4 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          local_40 = 0xff000000;

          iVar14 = iVar2 * 3 + 2 + iVar11;

          iVar9 = iVar2;

          do {

            puVar1 = (uint3 *)(iVar14 + -5);

            iVar14 = iVar14 + -3;

            iVar9 = iVar9 + -1;

            uVar7 = *puVar1;

            local_40 = CONCAT13(local_40._3_1_,uVar7);

            iVar13 = 0xff;

            if ((iVar12 == 0x100) || (iVar13 = iVar12 * 0xff >> 8, iVar13 != 0)) {

              iVar13 = iVar13 + 1;

              uVar8 = local_40;

              if (iVar13 != 0x100) {

                uVar5 = *(uint *)(local_38 + iVar9 * 4);

                local_3c._3_1_ = (byte)(uVar5 >> 0x18);

                if (local_3c._3_1_ != 0) {

                  bVar18 = (byte)(uVar5 >> 8);

                  bVar19 = (byte)(uVar5 >> 0x10);

                  bVar26 = (byte)(uVar7 >> 8);

                  bVar27 = (byte)(uVar7 >> 0x10);

                  if (local_3c._3_1_ == 0xff) {

                    uVar6 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar19,uVar5)) >> 0x20),

                                            uVar5) >> 0x18);

                    uVar21 = (uint5)uVar6 & 0xffffffff00;

                    uVar17 = (ulonglong)CONCAT43(uVar6,CONCAT12(bVar18,(ushort)uVar5)) &

                             0xffffffff00ffffff;

                    uVar15 = (ushort)uVar5 & 0xff;

                    uVar25 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(bVar27,local_40) >> 0x18),

                                               CONCAT12(bVar26,(short)uVar7)) >> 0x10,(short)uVar7)

                             & 0xff00ff00ff;

                    sVar24 = (short)iVar13;

                    sVar20 = (short)(uVar17 >> 0x10);

                    sVar22 = (short)(uVar21 >> 8);

                    sVar23 = (short)(uVar21 >> 0x18);

                    sVar16 = uVar15 - (((ushort)(uVar15 * sVar24) >> 8) -

                                      ((ushort)((short)uVar25 * sVar24) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar25 >> 0x10) * sVar24) >> 8));

                    sVar22 = sVar22 - (((ushort)(sVar22 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar25 >> 0x20) * sVar24) >> 8));

                    sVar23 = sVar23 - (((ushort)(sVar23 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar17 >> 0x30) * sVar24) >> 8));

                    uVar8 = CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)sVar23 -

                                     (0xff < sVar23),

                                     CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 -

                                              (0xff < sVar22),

                                              CONCAT11((0 < sVar20) * (sVar20 < 0x100) *

                                                       (char)sVar20 - (0xff < sVar20),

                                                       (0 < sVar16) * (sVar16 < 0x100) *

                                                       (char)sVar16 - (0xff < sVar16))));

                  }

                  else {

                    iVar10 = local_3c._3_1_ + 1 +

                             (iVar13 - ((int)((local_3c._3_1_ + 1) * iVar13) >> 8));

                    local_3c._0_1_ = (char)uVar5;

                    local_3c = CONCAT13((char)iVar10 + -1,

                                        CONCAT21(CONCAT11(bVar19 - (char)((int)(((uint)bVar19 -

                                                                                (uint)bVar27) *

                                                                               iVar13) / iVar10),

                                                          bVar18 - (char)((int)(((uint)bVar18 -

                                                                                (uint)bVar26) *

                                                                               iVar13) / iVar10)),

                                                 (char)local_3c -

                                                 (char)((int)(((uVar5 & 0xff) - (uVar7 & 0xff)) *

                                                             iVar13) / iVar10)));

                    uVar8 = local_3c;

                  }

                }

              }

              *(undefined4 *)(local_38 + iVar9 * 4) = uVar8;

            }

          } while (iVar9 != 0);

        }

        local_38 = local_38 + iVar4;

        iVar11 = iVar11 + iVar3;

        local_30 = local_30 + -1;

      } while (local_30 != 0);

    }

  }

  return;

}





// --- FUN_0066dfb0 at 0x0066DFB0 (size: 336) ---


void FUN_0066dfb0(void)



{

  undefined1 *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined2 uVar5;

  int in_EAX;

  int iVar6;

  undefined4 uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  undefined1 *puVar11;

  int iVar12;

  ushort uVar13;

  short sVar14;

  short sVar15;

  short sVar16;

  short sVar17;

  ushort uVar19;

  ulonglong uVar18;

  undefined4 local_2c;

  int local_20;

  

  iVar9 = *(int *)(in_EAX + 8);

  iVar10 = *(int *)(in_EAX + 0x14);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_20 = *(int *)(in_EAX + 0x20);

    iVar12 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_20 != 0) {

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0xc);

      iVar4 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          local_2c = 0xff000000;

          puVar11 = (undefined1 *)(iVar2 * 3 + 2 + iVar9);

          iVar8 = iVar2;

          do {

            puVar1 = puVar11 + -4;

            uVar5 = *(undefined2 *)(puVar11 + -5);

            puVar11 = puVar11 + -3;

            iVar8 = iVar8 + -1;

            local_2c = CONCAT22(CONCAT11(local_2c._3_1_,*puVar11),uVar5);

            iVar6 = 0xff;

            if ((iVar12 == 0x100) || (iVar6 = iVar12 * 0xff >> 8, iVar6 != 0)) {

              uVar7 = local_2c;

              if (iVar6 + 1 != 0x100) {

                uVar7 = *(undefined4 *)(iVar10 + iVar8 * 4);

                uVar13 = (ushort)uVar7 & 0xff;

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(*puVar11,local_2c) >> 0x18),

                                           CONCAT12(*puVar1,uVar5)) >> 0x10,uVar5) & 0xff00ff00ff;

                sVar17 = (short)(iVar6 + 1);

                uVar19 = (ushort)(byte)((uint)uVar7 >> 8);

                sVar16 = (short)CONCAT21(0xff00,(char)((uint)uVar7 >> 0x10));

                sVar14 = uVar13 - (((ushort)(uVar13 * sVar17) >> 8) -

                                  ((ushort)((short)uVar18 * sVar17) >> 8));

                sVar15 = uVar19 - (((ushort)(uVar19 * sVar17) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar17) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x20) * sVar17) >> 8));

                sVar17 = 0xff - (((ushort)(sVar17 * 0xff) >> 8) - ((ushort)(sVar17 * 0xff) >> 8));

                uVar7 = CONCAT13((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 - (0xff < sVar17),

                                 CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                          (0xff < sVar16),

                                          CONCAT11((0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                   (0xff < sVar15),

                                                   (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                                   (0xff < sVar14))));

              }

              *(undefined4 *)(iVar10 + iVar8 * 4) = uVar7;

            }

          } while (iVar8 != 0);

        }

        iVar9 = iVar9 + iVar3;

        iVar10 = iVar10 + iVar4;

        local_20 = local_20 + -1;

      } while (local_20 != 0);

    }

  }

  return;

}





// --- FUN_0066e110 at 0x0066E110 (size: 407) ---


void FUN_0066e110(void)



{

  undefined1 *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  ushort uVar5;

  ushort uVar6;

  undefined2 uVar7;

  int in_EAX;

  int iVar8;

  byte *pbVar9;

  byte *pbVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  short sVar14;

  short sVar15;

  short sVar16;

  ulonglong uVar17;

  undefined4 local_30;

  int local_2c;

  int local_28;

  int local_20;

  

  local_2c = *(int *)(in_EAX + 0x14);

  iVar12 = *(int *)(in_EAX + 8);

  if (*(byte *)(in_EAX + 0x24) != 0) {

    local_20 = *(int *)(in_EAX + 0x20);

    iVar11 = *(byte *)(in_EAX + 0x24) + 1;

    if (local_20 != 0) {

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0xc);

      iVar4 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          iVar13 = iVar2 * 3 + iVar12;

          pbVar9 = (byte *)(iVar2 * 3 + 2 + local_2c);

          local_28 = iVar2;

          do {

            puVar1 = (undefined1 *)(iVar13 + -3);

            iVar13 = iVar13 + -3;

            pbVar10 = pbVar9 + -3;

            local_30._0_2_ = CONCAT11(pbVar9[(iVar12 - local_2c) + -4],*puVar1);

            uVar7 = (undefined2)local_30;

            local_30 = (uint)CONCAT12(pbVar10[iVar12 - local_2c],(undefined2)local_30);

            iVar8 = 0xff;

            if ((iVar11 == 0x100) || (iVar8 = iVar11 * 0xff >> 8, iVar8 != 0)) {

              if (iVar8 + 1 != 0x100) {

                uVar6 = *(ushort *)(pbVar9 + -5);

                uVar5 = (ushort)(((uint5)*pbVar10 << 0x20) >> 0x18);

                uVar17 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(pbVar10[iVar12 - local_2c],local_30) >>

                                                  0x18),

                                           CONCAT12(pbVar9[(iVar12 - local_2c) + -4],uVar7)) >> 0x10

                                  ,uVar7) & 0xff00ff00ff;

                sVar16 = (short)(iVar8 + 1);

                sVar15 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar14 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar16) >> 8) -

                         ((ushort)((short)uVar17 * sVar16) >> 8));

                sVar15 = sVar15 - (((ushort)(sVar15 * sVar16) >> 8) -

                                  ((ushort)((short)(uVar17 >> 0x10) * sVar16) >> 8));

                sVar16 = uVar5 - (((ushort)(uVar5 * sVar16) >> 8) -

                                 ((ushort)((short)(uVar17 >> 0x20) * sVar16) >> 8));

                local_30 = (uint)CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                          (0xff < sVar16),

                                          CONCAT11((0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                   (0xff < sVar15),

                                                   (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                                   (0xff < sVar14)));

              }

              pbVar9[-5] = (byte)local_30;

              pbVar9[-4] = (byte)(local_30 >> 8);

              *pbVar10 = (byte)(local_30 >> 0x10);

            }

            local_28 = local_28 + -1;

            pbVar9 = pbVar10;

          } while (local_28 != 0);

        }

        local_2c = local_2c + iVar4;

        iVar12 = iVar12 + iVar3;

        local_20 = local_20 + -1;

      } while (local_20 != 0);

    }

  }

  return;

}





// --- FUN_0066e2b0 at 0x0066E2B0 (size: 1118) ---


void FUN_0066e2b0(void)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  undefined1 auVar4 [16];

  int in_EAX;

  uint uVar5;

  int iVar6;

  uint uVar7;

  int iVar8;

  uint uVar9;

  uint uVar10;

  int iVar11;

  uint uVar12;

  uint uVar13;

  ushort uVar14;

  short sVar15;

  undefined1 uVar18;

  short sVar19;

  short sVar21;

  ulonglong uVar16;

  short sVar22;

  undefined8 uVar23;

  short sVar24;

  undefined2 uVar25;

  undefined1 uVar28;

  ulonglong uVar26;

  float fVar29;

  float fVar30;

  float fVar31;

  float fVar32;

  float fVar33;

  undefined1 auVar34 [16];

  undefined1 auVar35 [16];

  undefined1 auVar36 [16];

  float fVar37;

  undefined4 local_64;

  int local_60;

  int local_5c;

  int local_54;

  int local_44;

  undefined1 uVar17;

  uint5 uVar20;

  undefined1 uVar27;

  

  local_60 = *(int *)(in_EAX + 8);

  local_5c = *(int *)(in_EAX + 0x14);

  iVar6 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

  local_44 = *(int *)(in_EAX + 0x20);

  if (local_44 != 0) {

    uVar9 = *(uint *)(in_EAX + 0x1c) >> 2;

    uVar7 = *(uint *)(in_EAX + 0x1c) & 3;

    iVar1 = *(int *)(in_EAX + 0xc);

    iVar2 = *(int *)(in_EAX + 0x18);

    do {

      if (uVar9 != 0) {

        iVar8 = uVar9 * 0x10 + local_5c;

        uVar5 = uVar9;

        do {

          uVar13 = *(uint *)(local_60 + -4 + uVar5 * 4);

          uVar5 = uVar5 - 1;

          iVar8 = iVar8 + -0x10;

          local_54 = 3;

          do {

            uVar12 = uVar13 & 0xff000000 | DAT_008f86b0;

            uVar10 = uVar12 >> 0x18;

            if (iVar6 != 0x100) {

              uVar10 = (int)(uVar10 * iVar6) >> 8;

            }

            if (uVar10 != 0) {

              iVar11 = uVar10 + 1;

              if (iVar11 != 0x100) {

                uVar3 = *(undefined4 *)(iVar8 + local_54 * 4);

                local_64._3_1_ = (byte)((uint)uVar3 >> 0x18);

                if (local_64._3_1_ != 0) {

                  uVar18 = (undefined1)((uint)uVar3 >> 0x10);

                  uVar28 = (undefined1)(DAT_008f86b0 >> 0x10);

                  uVar17 = (undefined1)((uint)uVar3 >> 8);

                  uVar14 = (ushort)uVar3;

                  uVar27 = (undefined1)(DAT_008f86b0 >> 8);

                  uVar25 = (undefined2)DAT_008f86b0;

                  if (local_64._3_1_ == 0xff) {

                    uVar10 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar18,uVar3)) >> 0x20)

                                             ,uVar3) >> 0x18);

                    uVar20 = (uint5)uVar10 & 0xffffffff00;

                    uVar16 = (ulonglong)CONCAT43(uVar10,CONCAT12(uVar17,uVar14)) &

                             0xffffffff00ffffff;

                    uVar26 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar28,uVar12) >> 0x18),

                                               CONCAT12(uVar27,uVar25)) >> 0x10,uVar25) &

                             0xff00ff00ff;

                    sVar24 = (short)iVar11;

                    sVar19 = (short)(uVar16 >> 0x10);

                    sVar21 = (short)(uVar20 >> 8);

                    sVar22 = (short)(uVar20 >> 0x18);

                    sVar15 = (uVar14 & 0xff) -

                             (((ushort)((uVar14 & 0xff) * sVar24) >> 8) -

                             ((ushort)((short)uVar26 * sVar24) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar26 >> 0x10) * sVar24) >> 8));

                    sVar21 = sVar21 - (((ushort)(sVar21 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar26 >> 0x20) * sVar24) >> 8));

                    sVar22 = sVar22 - (((ushort)(sVar22 * sVar24) >> 8) -

                                      ((ushort)((short)(uVar16 >> 0x30) * sVar24) >> 8));

                    uVar12 = CONCAT13((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 -

                                      (0xff < sVar22),

                                      CONCAT12((0 < sVar21) * (sVar21 < 0x100) * (char)sVar21 -

                                               (0xff < sVar21),

                                               CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                        (char)sVar19 - (0xff < sVar19),

                                                        (0 < sVar15) * (sVar15 < 0x100) *

                                                        (char)sVar15 - (0xff < sVar15))));

                  }

                  else {

                    uVar10 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_64._3_1_ << 0x30)

                                                                    >> 0x28),CONCAT14(uVar18,uVar3))

                                                   >> 0x20),uVar3) >> 0x18);

                    uVar20 = (uint5)uVar10 & 0xffffffff00;

                    uVar16 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar10,CONCAT12(uVar17,uVar14)) >> 0x10),

                                      uVar14) & 0xffffffff00ff00ff;

                    fVar29 = (float)(ushort)(uVar20 >> 8);

                    fVar31 = (float)(ushort)(uVar20 >> 0x18);

                    fVar30 = (float)((uint)uVar16 & 0xffff);

                    fVar32 = (float)(ushort)(uVar16 >> 0x10);

                    uVar12 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar12 >> 0x18)

                                                                     << 0x30) >> 0x28),

                                                             CONCAT14(uVar28,uVar12)) >> 0x20),

                                             uVar12) >> 0x18);

                    uVar20 = (uint5)uVar12 & 0xffffffff00;

                    uVar16 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar12,CONCAT12(uVar27,uVar25)) >> 0x10),

                                      uVar25) & 0xffffffff00ff00ff;

                    fVar33 = (float)iVar11;

                    iVar11 = local_64._3_1_ + 1 +

                             (iVar11 - ((int)((local_64._3_1_ + 1) * iVar11) >> 8));

                    fVar37 = (float)iVar11;

                    auVar36._4_4_ = fVar37;

                    auVar36._0_4_ = fVar37;

                    auVar34._0_4_ = (fVar30 - (float)((uint)uVar16 & 0xffff)) * fVar33;

                    auVar34._4_4_ = (fVar32 - (float)(ushort)(uVar16 >> 0x10)) * fVar33;

                    auVar34._8_4_ = (fVar29 - (float)(ushort)(uVar20 >> 8)) * fVar33;

                    auVar34._12_4_ = (fVar31 - (float)(ushort)(uVar20 >> 0x18)) * fVar33;

                    auVar36._8_4_ = fVar37;

                    auVar36._12_4_ = fVar37;

                    auVar36 = divps(auVar34,auVar36);

                    uVar23 = packssdw(CONCAT44(ROUND(fVar32 - auVar36._4_4_),

                                               ROUND(fVar30 - auVar36._0_4_)),

                                      CONCAT44(ROUND(fVar31 - auVar36._12_4_),

                                               ROUND(fVar29 - auVar36._8_4_)));

                    sVar15 = (short)uVar23;

                    sVar19 = (short)((ulonglong)uVar23 >> 0x10);

                    sVar21 = (short)((ulonglong)uVar23 >> 0x20);

                    local_64 = CONCAT13((char)iVar11 + -1,

                                        CONCAT12((0 < sVar21) * (sVar21 < 0x100) *

                                                 (char)((ulonglong)uVar23 >> 0x20) - (0xff < sVar21)

                                                 ,CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                           (char)((ulonglong)uVar23 >> 0x10) -

                                                           (0xff < sVar19),

                                                           (0 < sVar15) * (sVar15 < 0x100) *

                                                           (char)uVar23 - (0xff < sVar15))));

                    uVar12 = local_64;

                  }

                }

              }

              *(uint *)(iVar8 + local_54 * 4) = uVar12;

            }

            uVar13 = uVar13 << 8;

            local_54 = local_54 + -1;

          } while (-1 < local_54);

        } while (uVar5 != 0);

      }

      if (uVar7 != 0) {

        iVar8 = uVar9 * 0x10 + local_5c;

        uVar5 = uVar7;

        while (uVar5 != 0) {

          iVar11 = uVar5 - 1;

          uVar5 = uVar5 - 1;

          uVar13 = (uint)*(byte *)(iVar11 + local_60 + uVar9 * 4) << 0x18 | DAT_008f86b0;

          uVar12 = uVar13 >> 0x18;

          if (iVar6 != 0x100) {

            uVar12 = (int)(uVar12 * iVar6) >> 8;

          }

          if (uVar12 != 0) {

            iVar11 = uVar12 + 1;

            if (iVar11 != 0x100) {

              uVar3 = *(undefined4 *)(iVar8 + uVar5 * 4);

              local_64._3_1_ = (byte)((uint)uVar3 >> 0x18);

              if (local_64._3_1_ != 0) {

                uVar18 = (undefined1)((uint)uVar3 >> 0x10);

                uVar28 = (undefined1)(DAT_008f86b0 >> 0x10);

                uVar17 = (undefined1)((uint)uVar3 >> 8);

                uVar14 = (ushort)uVar3;

                uVar27 = (undefined1)(DAT_008f86b0 >> 8);

                uVar25 = (undefined2)DAT_008f86b0;

                if (local_64._3_1_ == 0xff) {

                  uVar12 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar18,uVar3)) >> 0x20),

                                           uVar3) >> 0x18);

                  uVar20 = (uint5)uVar12 & 0xffffffff00;

                  uVar16 = (ulonglong)CONCAT43(uVar12,CONCAT12(uVar17,uVar14)) & 0xffffffff00ffffff;

                  uVar26 = (ulonglong)

                           CONCAT52(CONCAT23((short)(CONCAT14(uVar28,uVar13) >> 0x18),

                                             CONCAT12(uVar27,uVar25)) >> 0x10,uVar25) & 0xff00ff00ff

                  ;

                  sVar24 = (short)iVar11;

                  sVar19 = (short)(uVar16 >> 0x10);

                  sVar21 = (short)(uVar20 >> 8);

                  sVar22 = (short)(uVar20 >> 0x18);

                  sVar15 = (uVar14 & 0xff) -

                           (((ushort)((uVar14 & 0xff) * sVar24) >> 8) -

                           ((ushort)((short)uVar26 * sVar24) >> 8));

                  sVar19 = sVar19 - (((ushort)(sVar19 * sVar24) >> 8) -

                                    ((ushort)((short)(uVar26 >> 0x10) * sVar24) >> 8));

                  sVar21 = sVar21 - (((ushort)(sVar21 * sVar24) >> 8) -

                                    ((ushort)((short)(uVar26 >> 0x20) * sVar24) >> 8));

                  sVar22 = sVar22 - (((ushort)(sVar22 * sVar24) >> 8) -

                                    ((ushort)((short)(uVar16 >> 0x30) * sVar24) >> 8));

                  uVar13 = CONCAT13((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 - (0xff < sVar22)

                                    ,CONCAT12((0 < sVar21) * (sVar21 < 0x100) * (char)sVar21 -

                                              (0xff < sVar21),

                                              CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                       (char)sVar19 - (0xff < sVar19),

                                                       (0 < sVar15) * (sVar15 < 0x100) *

                                                       (char)sVar15 - (0xff < sVar15))));

                }

                else {

                  uVar12 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_64._3_1_ << 0x30)

                                                                  >> 0x28),CONCAT14(uVar18,uVar3))

                                                 >> 0x20),uVar3) >> 0x18);

                  uVar20 = (uint5)uVar12 & 0xffffffff00;

                  uVar16 = (ulonglong)

                           CONCAT52((int5)(CONCAT43(uVar12,CONCAT12(uVar17,uVar14)) >> 0x10),uVar14)

                           & 0xffffffff00ff00ff;

                  fVar29 = (float)(ushort)(uVar20 >> 8);

                  fVar31 = (float)(ushort)(uVar20 >> 0x18);

                  fVar30 = (float)((uint)uVar16 & 0xffff);

                  fVar32 = (float)(ushort)(uVar16 >> 0x10);

                  uVar13 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar13 >> 0x18) <<

                                                                   0x30) >> 0x28),

                                                           CONCAT14(uVar28,uVar13)) >> 0x20),uVar13)

                                 >> 0x18);

                  uVar20 = (uint5)uVar13 & 0xffffffff00;

                  uVar16 = (ulonglong)

                           CONCAT52((int5)(CONCAT43(uVar13,CONCAT12(uVar27,uVar25)) >> 0x10),uVar25)

                           & 0xffffffff00ff00ff;

                  fVar33 = (float)iVar11;

                  iVar11 = local_64._3_1_ + 1 +

                           (iVar11 - ((int)((local_64._3_1_ + 1) * iVar11) >> 8));

                  fVar37 = (float)iVar11;

                  auVar35._0_4_ = (fVar30 - (float)((uint)uVar16 & 0xffff)) * fVar33;

                  auVar35._4_4_ = (fVar32 - (float)(ushort)(uVar16 >> 0x10)) * fVar33;

                  auVar35._8_4_ = (fVar29 - (float)(ushort)(uVar20 >> 8)) * fVar33;

                  auVar35._12_4_ = (fVar31 - (float)(ushort)(uVar20 >> 0x18)) * fVar33;

                  auVar4._4_4_ = fVar37;

                  auVar4._0_4_ = fVar37;

                  auVar4._8_4_ = fVar37;

                  auVar4._12_4_ = fVar37;

                  auVar36 = divps(auVar35,auVar4);

                  uVar23 = packssdw(CONCAT44(ROUND(fVar32 - auVar36._4_4_),

                                             ROUND(fVar30 - auVar36._0_4_)),

                                    CONCAT44(ROUND(fVar31 - auVar36._12_4_),

                                             ROUND(fVar29 - auVar36._8_4_)));

                  sVar15 = (short)uVar23;

                  sVar19 = (short)((ulonglong)uVar23 >> 0x10);

                  sVar21 = (short)((ulonglong)uVar23 >> 0x20);

                  local_64 = CONCAT13((char)iVar11 + -1,

                                      CONCAT12((0 < sVar21) * (sVar21 < 0x100) *

                                               (char)((ulonglong)uVar23 >> 0x20) - (0xff < sVar21),

                                               CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                        (char)((ulonglong)uVar23 >> 0x10) -

                                                        (0xff < sVar19),

                                                        (0 < sVar15) * (sVar15 < 0x100) *

                                                        (char)uVar23 - (0xff < sVar15))));

                  uVar13 = local_64;

                }

              }

            }

            *(uint *)(iVar8 + uVar5 * 4) = uVar13;

          }

        }

      }

      local_60 = local_60 + iVar1;

      local_5c = local_5c + iVar2;

      local_44 = local_44 + -1;

    } while (local_44 != 0);

  }

  return;

}





// --- FUN_0066e720 at 0x0066E720 (size: 988) ---


void FUN_0066e720(void)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int in_EAX;

  uint uVar4;

  int iVar5;

  uint uVar6;

  int iVar7;

  int iVar8;

  uint uVar9;

  uint uVar10;

  uint uVar11;

  int iVar12;

  uint uVar13;

  byte bVar17;

  ushort uVar14;

  short sVar15;

  byte bVar18;

  short sVar19;

  short sVar21;

  uint5 uVar20;

  short sVar22;

  short sVar23;

  ulonglong uVar24;

  undefined4 local_50;

  int local_48;

  int local_44;

  int local_40;

  int local_28;

  ulonglong uVar16;

  

  local_44 = *(int *)(in_EAX + 8);

  local_40 = *(int *)(in_EAX + 0x14);

  iVar5 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

  local_28 = *(int *)(in_EAX + 0x20);

  if (local_28 != 0) {

    uVar10 = *(uint *)(in_EAX + 0x1c) >> 2;

    uVar6 = *(uint *)(in_EAX + 0x1c) & 3;

    iVar1 = *(int *)(in_EAX + 0xc);

    iVar2 = *(int *)(in_EAX + 0x18);

    do {

      if (uVar10 != 0) {

        iVar8 = uVar10 * 0x10 + local_40;

        uVar4 = uVar10;

        do {

          uVar13 = *(uint *)(local_44 + -4 + uVar4 * 4);

          uVar4 = uVar4 - 1;

          iVar8 = iVar8 + -0x10;

          local_48 = 3;

          do {

            uVar9 = uVar13 & 0xff000000 | DAT_008f86b0;

            uVar11 = uVar9 >> 0x18;

            if (iVar5 != 0x100) {

              uVar11 = (int)(uVar11 * iVar5) >> 8;

            }

            if (uVar11 != 0) {

              iVar12 = uVar11 + 1;

              if (iVar12 != 0x100) {

                uVar11 = *(uint *)(iVar8 + local_48 * 4);

                local_50._3_1_ = (byte)(uVar11 >> 0x18);

                if (local_50._3_1_ != 0) {

                  bVar17 = (byte)(uVar11 >> 8);

                  bVar18 = (byte)(uVar11 >> 0x10);

                  if (local_50._3_1_ == 0xff) {

                    uVar3 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar18,uVar11)) >> 0x20)

                                            ,uVar11) >> 0x18);

                    uVar20 = (uint5)uVar3 & 0xffffffff00;

                    uVar16 = (ulonglong)CONCAT43(uVar3,CONCAT12(bVar17,(ushort)uVar11)) &

                             0xffffffff00ffffff;

                    uVar14 = (ushort)uVar11 & 0xff;

                    uVar24 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar9)

                                                      >> 0x18),

                                               CONCAT12((char)(DAT_008f86b0 >> 8),

                                                        (short)DAT_008f86b0)) >> 0x10,

                                      (short)DAT_008f86b0) & 0xff00ff00ff;

                    sVar23 = (short)iVar12;

                    sVar19 = (short)(uVar16 >> 0x10);

                    sVar21 = (short)(uVar20 >> 8);

                    sVar22 = (short)(uVar20 >> 0x18);

                    sVar15 = uVar14 - (((ushort)(uVar14 * sVar23) >> 8) -

                                      ((ushort)((short)uVar24 * sVar23) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar23) >> 8) -

                                      ((ushort)((short)(uVar24 >> 0x10) * sVar23) >> 8));

                    sVar21 = sVar21 - (((ushort)(sVar21 * sVar23) >> 8) -

                                      ((ushort)((short)(uVar24 >> 0x20) * sVar23) >> 8));

                    sVar22 = sVar22 - (((ushort)(sVar22 * sVar23) >> 8) -

                                      ((ushort)((short)(uVar16 >> 0x30) * sVar23) >> 8));

                    uVar9 = CONCAT13((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 -

                                     (0xff < sVar22),

                                     CONCAT12((0 < sVar21) * (sVar21 < 0x100) * (char)sVar21 -

                                              (0xff < sVar21),

                                              CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                       (char)sVar19 - (0xff < sVar19),

                                                       (0 < sVar15) * (sVar15 < 0x100) *

                                                       (char)sVar15 - (0xff < sVar15))));

                  }

                  else {

                    iVar7 = local_50._3_1_ + 1 +

                            (iVar12 - ((int)((local_50._3_1_ + 1) * iVar12) >> 8));

                    local_50._0_1_ = (char)uVar11;

                    local_50 = CONCAT13((char)iVar7 + -1,

                                        CONCAT21(CONCAT11(bVar18 - (char)((int)(((uint)bVar18 -

                                                                                ((DAT_008f86b0 &

                                                                                 0xff0000) >> 0x10))

                                                                               * iVar12) / iVar7),

                                                          bVar17 - (char)((int)(((uint)bVar17 -

                                                                                ((DAT_008f86b0 &

                                                                                 0xff00) >> 8)) *

                                                                               iVar12) / iVar7)),

                                                 (char)local_50 -

                                                 (char)((int)(((uVar11 & 0xff) -

                                                              (DAT_008f86b0 & 0xff)) * iVar12) /

                                                       iVar7)));

                    uVar9 = local_50;

                  }

                }

              }

              *(uint *)(iVar8 + local_48 * 4) = uVar9;

            }

            uVar13 = uVar13 << 8;

            local_48 = local_48 + -1;

          } while (-1 < local_48);

        } while (uVar4 != 0);

      }

      if (uVar6 != 0) {

        iVar8 = uVar10 * 0x10 + local_40;

        uVar4 = uVar6;

        while (uVar4 != 0) {

          iVar12 = uVar4 - 1;

          uVar4 = uVar4 - 1;

          uVar13 = (uint)*(byte *)(iVar12 + local_44 + uVar10 * 4) << 0x18 | DAT_008f86b0;

          uVar9 = uVar13 >> 0x18;

          if (iVar5 != 0x100) {

            uVar9 = (int)(uVar9 * iVar5) >> 8;

          }

          if (uVar9 != 0) {

            iVar12 = uVar9 + 1;

            if (iVar12 != 0x100) {

              uVar9 = *(uint *)(iVar8 + uVar4 * 4);

              local_50._3_1_ = (byte)(uVar9 >> 0x18);

              if (local_50._3_1_ != 0) {

                bVar17 = (byte)(uVar9 >> 8);

                bVar18 = (byte)(uVar9 >> 0x10);

                if (local_50._3_1_ == 0xff) {

                  uVar11 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar18,uVar9)) >> 0x20),

                                           uVar9) >> 0x18);

                  uVar20 = (uint5)uVar11 & 0xffffffff00;

                  uVar16 = (ulonglong)CONCAT43(uVar11,CONCAT12(bVar17,(ushort)uVar9)) &

                           0xffffffff00ffffff;

                  uVar14 = (ushort)uVar9 & 0xff;

                  uVar24 = (ulonglong)

                           CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar13)

                                                    >> 0x18),

                                             CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0)

                                            ) >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                  sVar23 = (short)iVar12;

                  sVar19 = (short)(uVar16 >> 0x10);

                  sVar21 = (short)(uVar20 >> 8);

                  sVar22 = (short)(uVar20 >> 0x18);

                  sVar15 = uVar14 - (((ushort)(uVar14 * sVar23) >> 8) -

                                    ((ushort)((short)uVar24 * sVar23) >> 8));

                  sVar19 = sVar19 - (((ushort)(sVar19 * sVar23) >> 8) -

                                    ((ushort)((short)(uVar24 >> 0x10) * sVar23) >> 8));

                  sVar21 = sVar21 - (((ushort)(sVar21 * sVar23) >> 8) -

                                    ((ushort)((short)(uVar24 >> 0x20) * sVar23) >> 8));

                  sVar22 = sVar22 - (((ushort)(sVar22 * sVar23) >> 8) -

                                    ((ushort)((short)(uVar16 >> 0x30) * sVar23) >> 8));

                  uVar13 = CONCAT13((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 - (0xff < sVar22)

                                    ,CONCAT12((0 < sVar21) * (sVar21 < 0x100) * (char)sVar21 -

                                              (0xff < sVar21),

                                              CONCAT11((0 < sVar19) * (sVar19 < 0x100) *

                                                       (char)sVar19 - (0xff < sVar19),

                                                       (0 < sVar15) * (sVar15 < 0x100) *

                                                       (char)sVar15 - (0xff < sVar15))));

                }

                else {

                  iVar7 = local_50._3_1_ + 1 +

                          (iVar12 - ((int)((local_50._3_1_ + 1) * iVar12) >> 8));

                  local_50._0_1_ = (char)uVar9;

                  local_50 = CONCAT31(CONCAT12((char)iVar7 + -1,

                                               CONCAT11(bVar18 - (char)((int)(((uint)bVar18 -

                                                                              ((DAT_008f86b0 &

                                                                               0xff0000) >> 0x10)) *

                                                                             iVar12) / iVar7),

                                                        bVar17 - (char)((int)(((uint)bVar17 -

                                                                              ((DAT_008f86b0 &

                                                                               0xff00) >> 8)) *

                                                                             iVar12) / iVar7))),

                                      (char)local_50 -

                                      (char)((int)(((uVar9 & 0xff) - (DAT_008f86b0 & 0xff)) * iVar12

                                                  ) / iVar7));

                  uVar13 = local_50;

                }

              }

            }

            *(uint *)(iVar8 + uVar4 * 4) = uVar13;

          }

        }

      }

      local_44 = local_44 + iVar1;

      local_40 = local_40 + iVar2;

      local_28 = local_28 + -1;

    } while (local_28 != 0);

  }

  return;

}





// --- FUN_0066eb00 at 0x0066EB00 (size: 1010) ---


void FUN_0066eb00(void)



{

  int iVar1;

  undefined4 uVar2;

  undefined1 auVar3 [16];

  uint uVar4;

  int in_EAX;

  uint uVar5;

  undefined4 uVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar13;

  undefined1 uVar16;

  short sVar17;

  short sVar19;

  ulonglong uVar14;

  short sVar20;

  undefined8 uVar21;

  short sVar22;

  undefined2 uVar23;

  byte bVar26;

  undefined1 uVar27;

  ulonglong uVar24;

  float fVar28;

  float fVar29;

  float fVar30;

  float fVar31;

  float fVar32;

  float fVar33;

  undefined1 auVar34 [16];

  undefined1 auVar35 [16];

  undefined1 auVar36 [16];

  undefined4 local_3c;

  undefined4 local_38;

  undefined4 local_2c;

  undefined4 local_28;

  undefined1 uVar15;

  uint5 uVar18;

  undefined1 uVar25;

  

  uVar4 = DAT_008f86b0;

  if (*(int *)(in_EAX + 8) == 0) {

    iVar11 = *(int *)(in_EAX + 0x14);

    bVar26 = *(byte *)(in_EAX + 0x24);

    local_3c = CONCAT13(bVar26,(int3)DAT_008f86b0);

    local_28 = *(int *)(in_EAX + 0x20);

    if (local_28 != 0) {

      iVar7 = *(int *)(in_EAX + 0x1c);

      iVar1 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar7 != 0) {

          iVar9 = iVar7;

          do {

            iVar9 = iVar9 + -1;

            if (bVar26 != 0) {

              iVar8 = bVar26 + 1;

              uVar6 = local_3c;

              if (iVar8 != 0x100) {

                uVar2 = *(undefined4 *)(iVar11 + iVar9 * 4);

                local_38._3_1_ = (byte)((uint)uVar2 >> 0x18);

                if (local_38._3_1_ != 0) {

                  uVar16 = (undefined1)((uint)uVar2 >> 0x10);

                  uVar15 = (undefined1)((uint)uVar2 >> 8);

                  uVar12 = (ushort)uVar2;

                  uVar25 = (undefined1)(uVar4 >> 8);

                  uVar27 = (undefined1)(uVar4 >> 0x10);

                  uVar23 = (undefined2)uVar4;

                  if (local_38._3_1_ == 0xff) {

                    uVar5 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar16,uVar2)) >> 0x20),

                                            uVar2) >> 0x18);

                    uVar18 = (uint5)uVar5 & 0xffffffff00;

                    uVar14 = (ulonglong)CONCAT43(uVar5,CONCAT12(uVar15,uVar12)) & 0xffffffff00ffffff

                    ;

                    uVar24 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar27,local_3c) >> 0x18),

                                               CONCAT12(uVar25,uVar23)) >> 0x10,uVar23) &

                             0xff00ff00ff;

                    sVar22 = (short)iVar8;

                    sVar17 = (short)(uVar14 >> 0x10);

                    sVar19 = (short)(uVar18 >> 8);

                    sVar20 = (short)(uVar18 >> 0x18);

                    sVar13 = (uVar12 & 0xff) -

                             (((ushort)((uVar12 & 0xff) * sVar22) >> 8) -

                             ((ushort)((short)uVar24 * sVar22) >> 8));

                    sVar17 = sVar17 - (((ushort)(sVar17 * sVar22) >> 8) -

                                      ((ushort)((short)(uVar24 >> 0x10) * sVar22) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar22) >> 8) -

                                      ((ushort)((short)(uVar24 >> 0x20) * sVar22) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar22) >> 8) -

                                      ((ushort)((short)(uVar14 >> 0x30) * sVar22) >> 8));

                    uVar6 = CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 -

                                     (0xff < sVar20),

                                     CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                              (0xff < sVar19),

                                              CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                       (char)sVar17 - (0xff < sVar17),

                                                       (0 < sVar13) * (sVar13 < 0x100) *

                                                       (char)sVar13 - (0xff < sVar13))));

                  }

                  else {

                    uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_38._3_1_ << 0x30)

                                                                   >> 0x28),CONCAT14(uVar16,uVar2))

                                                  >> 0x20),uVar2) >> 0x18);

                    uVar18 = (uint5)uVar5 & 0xffffffff00;

                    uVar14 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar5,CONCAT12(uVar15,uVar12)) >> 0x10),uVar12

                                     ) & 0xffffffff00ff00ff;

                    fVar28 = (float)(ushort)(uVar18 >> 8);

                    fVar30 = (float)(ushort)(uVar18 >> 0x18);

                    fVar29 = (float)((uint)uVar14 & 0xffff);

                    fVar31 = (float)(ushort)(uVar14 >> 0x10);

                    uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)bVar26 << 0x30) >> 0x28)

                                                            ,CONCAT14(uVar27,local_3c)) >> 0x20),

                                            local_3c) >> 0x18);

                    uVar18 = (uint5)uVar5 & 0xffffffff00;

                    uVar14 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar5,CONCAT12(uVar25,uVar23)) >> 0x10),uVar23

                                     ) & 0xffffffff00ff00ff;

                    fVar32 = (float)iVar8;

                    iVar8 = local_38._3_1_ + 1 +

                            (iVar8 - ((int)((local_38._3_1_ + 1) * iVar8) >> 8));

                    fVar33 = (float)iVar8;

                    auVar35._4_4_ = fVar33;

                    auVar35._0_4_ = fVar33;

                    auVar36._0_4_ = (fVar29 - (float)((uint)uVar14 & 0xffff)) * fVar32;

                    auVar36._4_4_ = (fVar31 - (float)(ushort)(uVar14 >> 0x10)) * fVar32;

                    auVar36._8_4_ = (fVar28 - (float)(ushort)(uVar18 >> 8)) * fVar32;

                    auVar36._12_4_ = (fVar30 - (float)(ushort)(uVar18 >> 0x18)) * fVar32;

                    auVar35._8_4_ = fVar33;

                    auVar35._12_4_ = fVar33;

                    auVar35 = divps(auVar36,auVar35);

                    uVar21 = packssdw(CONCAT44(ROUND(fVar31 - auVar35._4_4_),

                                               ROUND(fVar29 - auVar35._0_4_)),

                                      CONCAT44(ROUND(fVar30 - auVar35._12_4_),

                                               ROUND(fVar28 - auVar35._8_4_)));

                    sVar13 = (short)uVar21;

                    sVar17 = (short)((ulonglong)uVar21 >> 0x10);

                    sVar19 = (short)((ulonglong)uVar21 >> 0x20);

                    local_38 = CONCAT13((char)iVar8 + -1,

                                        CONCAT12((0 < sVar19) * (sVar19 < 0x100) *

                                                 (char)((ulonglong)uVar21 >> 0x20) - (0xff < sVar19)

                                                 ,CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                           (char)((ulonglong)uVar21 >> 0x10) -

                                                           (0xff < sVar17),

                                                           (0 < sVar13) * (sVar13 < 0x100) *

                                                           (char)uVar21 - (0xff < sVar13))));

                    uVar6 = local_38;

                  }

                }

              }

              *(undefined4 *)(iVar11 + iVar9 * 4) = uVar6;

            }

          } while (iVar9 != 0);

        }

        iVar11 = iVar11 - iVar1;

        local_28 = local_28 + -1;

      } while (local_28 != 0);

    }

  }

  else {

    iVar11 = *(int *)(in_EAX + 0x14);

    iVar7 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

    local_2c = *(int *)(in_EAX + 0x20);

    if (local_2c != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar9 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          uVar4 = DAT_008f86b0 >> 0x18;

          iVar8 = iVar1;

          do {

            iVar8 = iVar8 + -1;

            uVar5 = uVar4;

            if (iVar7 != 0x100) {

              uVar5 = (int)(uVar4 * iVar7) >> 8;

            }

            if (uVar5 != 0) {

              iVar10 = uVar5 + 1;

              uVar5 = DAT_008f86b0;

              if (iVar10 != 0x100) {

                uVar6 = *(undefined4 *)(iVar11 + iVar8 * 4);

                local_3c._3_1_ = (byte)((uint)uVar6 >> 0x18);

                if (local_3c._3_1_ != 0) {

                  uVar16 = (undefined1)((uint)uVar6 >> 0x10);

                  uVar15 = (undefined1)((uint)uVar6 >> 8);

                  uVar12 = (ushort)uVar6;

                  uVar25 = (undefined1)(DAT_008f86b0 >> 8);

                  bVar26 = (byte)(DAT_008f86b0 >> 0x10);

                  uVar23 = (undefined2)DAT_008f86b0;

                  if (local_3c._3_1_ == 0xff) {

                    uVar5 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar16,uVar6)) >> 0x20),

                                            uVar6) >> 0x18);

                    uVar18 = (uint5)uVar5 & 0xffffffff00;

                    uVar14 = (ulonglong)CONCAT43(uVar5,CONCAT12(uVar15,uVar12)) & 0xffffffff00ffffff

                    ;

                    uVar24 = (ulonglong)

                             CONCAT52((int5)(CONCAT43((int)(((uint7)bVar26 << 0x20) >> 0x18),

                                                      CONCAT12(uVar25,uVar23)) >> 0x10),uVar23) &

                             0xff00ff00ff;

                    sVar22 = (short)iVar10;

                    sVar17 = (short)(uVar14 >> 0x10);

                    sVar19 = (short)(uVar18 >> 8);

                    sVar20 = (short)(uVar18 >> 0x18);

                    sVar13 = (uVar12 & 0xff) -

                             (((ushort)((uVar12 & 0xff) * sVar22) >> 8) -

                             ((ushort)((short)uVar24 * sVar22) >> 8));

                    sVar17 = sVar17 - (((ushort)(sVar17 * sVar22) >> 8) -

                                      ((ushort)((short)(uVar24 >> 0x10) * sVar22) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar22) >> 8) -

                                      ((ushort)((short)(uVar24 >> 0x20) * sVar22) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar22) >> 8) -

                                      ((ushort)((short)(uVar14 >> 0x30) * sVar22) >> 8));

                    uVar5 = CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 -

                                     (0xff < sVar20),

                                     CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                              (0xff < sVar19),

                                              CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                       (char)sVar17 - (0xff < sVar17),

                                                       (0 < sVar13) * (sVar13 < 0x100) *

                                                       (char)sVar13 - (0xff < sVar13))));

                  }

                  else {

                    uVar5 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_3c._3_1_ << 0x30)

                                                                   >> 0x28),CONCAT14(uVar16,uVar6))

                                                  >> 0x20),uVar6) >> 0x18);

                    uVar18 = (uint5)uVar5 & 0xffffffff00;

                    uVar14 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar5,CONCAT12(uVar15,uVar12)) >> 0x10),uVar12

                                     ) & 0xffffffff00ff00ff;

                    fVar28 = (float)(ushort)(uVar18 >> 8);

                    fVar30 = (float)(ushort)(uVar18 >> 0x18);

                    fVar29 = (float)((uint)uVar14 & 0xffff);

                    fVar31 = (float)(ushort)(uVar14 >> 0x10);

                    uVar5 = (uint)(((uint7)bVar26 << 0x20) >> 0x18);

                    uVar14 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar5,CONCAT12(uVar25,uVar23)) >> 0x10),uVar23

                                     ) & 0xffffffff00ff00ff;

                    fVar32 = (float)iVar10;

                    iVar10 = local_3c._3_1_ + 1 +

                             (iVar10 - ((int)((local_3c._3_1_ + 1) * iVar10) >> 8));

                    fVar33 = (float)iVar10;

                    auVar3._4_4_ = fVar33;

                    auVar3._0_4_ = fVar33;

                    auVar34._0_4_ = (fVar29 - (float)((uint)uVar14 & 0xffff)) * fVar32;

                    auVar34._4_4_ = (fVar31 - (float)(ushort)(uVar14 >> 0x10)) * fVar32;

                    auVar34._8_4_ = (fVar28 - (float)(uVar5 >> 8)) * fVar32;

                    auVar34._12_4_ = (fVar30 - (float)(DAT_008f86b0 >> 0x18)) * fVar32;

                    auVar3._8_4_ = fVar33;

                    auVar3._12_4_ = fVar33;

                    auVar35 = divps(auVar34,auVar3);

                    uVar21 = packssdw(CONCAT44(ROUND(fVar31 - auVar35._4_4_),

                                               ROUND(fVar29 - auVar35._0_4_)),

                                      CONCAT44(ROUND(fVar30 - auVar35._12_4_),

                                               ROUND(fVar28 - auVar35._8_4_)));

                    sVar13 = (short)uVar21;

                    sVar17 = (short)((ulonglong)uVar21 >> 0x10);

                    sVar19 = (short)((ulonglong)uVar21 >> 0x20);

                    local_3c = CONCAT13((char)iVar10 + -1,

                                        CONCAT12((0 < sVar19) * (sVar19 < 0x100) *

                                                 (char)((ulonglong)uVar21 >> 0x20) - (0xff < sVar19)

                                                 ,CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                           (char)((ulonglong)uVar21 >> 0x10) -

                                                           (0xff < sVar17),

                                                           (0 < sVar13) * (sVar13 < 0x100) *

                                                           (char)uVar21 - (0xff < sVar13))));

                    uVar5 = local_3c;

                  }

                }

              }

              *(uint *)(iVar11 + iVar8 * 4) = uVar5;

            }

          } while (iVar8 != 0);

        }

        iVar11 = iVar11 + iVar9;

        local_2c = local_2c + -1;

      } while (local_2c != 0);

    }

  }

  return;

}





// --- FUN_0066ef10 at 0x0066EF10 (size: 896) ---


void FUN_0066ef10(void)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  int in_EAX;

  uint uVar5;

  undefined4 uVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  byte bVar14;

  ushort uVar11;

  short sVar12;

  byte bVar15;

  byte bVar16;

  short sVar17;

  short sVar19;

  uint5 uVar18;

  short sVar20;

  short sVar21;

  byte bVar23;

  byte bVar24;

  ulonglong uVar22;

  undefined4 local_34;

  undefined4 local_30;

  undefined4 local_24;

  int local_20;

  ulonglong uVar13;

  

  uVar5 = DAT_008f86b0;

  if (*(int *)(in_EAX + 8) == 0) {

    iVar8 = *(int *)(in_EAX + 0x14);

    bVar14 = *(byte *)(in_EAX + 0x24);

    local_30 = CONCAT13(bVar14,(int3)DAT_008f86b0);

    local_20 = *(int *)(in_EAX + 0x20);

    if (local_20 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar1 != 0) {

          iVar10 = iVar1;

          do {

            iVar10 = iVar10 + -1;

            if (bVar14 != 0) {

              iVar9 = bVar14 + 1;

              uVar6 = local_30;

              if (iVar9 != 0x100) {

                uVar3 = *(uint *)(iVar8 + iVar10 * 4);

                local_34._3_1_ = (byte)(uVar3 >> 0x18);

                if (local_34._3_1_ != 0) {

                  bVar15 = (byte)(uVar3 >> 8);

                  bVar16 = (byte)(uVar3 >> 0x10);

                  bVar23 = (byte)(uVar5 >> 8);

                  bVar24 = (byte)(uVar5 >> 0x10);

                  if (local_34._3_1_ == 0xff) {

                    uVar4 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar16,uVar3)) >> 0x20),

                                            uVar3) >> 0x18);

                    uVar18 = (uint5)uVar4 & 0xffffffff00;

                    uVar13 = (ulonglong)CONCAT43(uVar4,CONCAT12(bVar15,(ushort)uVar3)) &

                             0xffffffff00ffffff;

                    uVar11 = (ushort)uVar3 & 0xff;

                    uVar22 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(bVar24,local_30) >> 0x18),

                                               CONCAT12(bVar23,(short)uVar5)) >> 0x10,(short)uVar5)

                             & 0xff00ff00ff;

                    sVar21 = (short)iVar9;

                    sVar17 = (short)(uVar13 >> 0x10);

                    sVar19 = (short)(uVar18 >> 8);

                    sVar20 = (short)(uVar18 >> 0x18);

                    sVar12 = uVar11 - (((ushort)(uVar11 * sVar21) >> 8) -

                                      ((ushort)((short)uVar22 * sVar21) >> 8));

                    sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

                    sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                      ((ushort)((short)(uVar13 >> 0x30) * sVar21) >> 8));

                    uVar6 = CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 -

                                     (0xff < sVar20),

                                     CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                              (0xff < sVar19),

                                              CONCAT11((0 < sVar17) * (sVar17 < 0x100) *

                                                       (char)sVar17 - (0xff < sVar17),

                                                       (0 < sVar12) * (sVar12 < 0x100) *

                                                       (char)sVar12 - (0xff < sVar12))));

                  }

                  else {

                    iVar7 = local_34._3_1_ + 1 +

                            (iVar9 - ((int)((local_34._3_1_ + 1) * iVar9) >> 8));

                    local_34._0_1_ = (char)uVar3;

                    local_34 = CONCAT13((char)iVar7 + -1,

                                        CONCAT21(CONCAT11(bVar16 - (char)((int)(((uint)bVar16 -

                                                                                (uint)bVar24) *

                                                                               iVar9) / iVar7),

                                                          bVar15 - (char)((int)(((uint)bVar15 -

                                                                                (uint)bVar23) *

                                                                               iVar9) / iVar7)),

                                                 (char)local_34 -

                                                 (char)((int)(((uVar3 & 0xff) - (uVar5 & 0xff)) *

                                                             iVar9) / iVar7)));

                    uVar6 = local_34;

                  }

                }

              }

              *(undefined4 *)(iVar8 + iVar10 * 4) = uVar6;

            }

          } while (iVar10 != 0);

        }

        iVar8 = iVar8 - iVar2;

        local_20 = local_20 + -1;

      } while (local_20 != 0);

    }

  }

  else {

    local_30 = *(int *)(in_EAX + 0x14);

    local_24 = *(int *)(in_EAX + 0x20);

    iVar8 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

    if (local_24 != 0) {

      iVar1 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0x18);

      iVar10 = iVar1;

      do {

        while (iVar10 != 0) {

          uVar5 = DAT_008f86b0 >> 0x18;

          iVar10 = iVar10 + -1;

          if (iVar8 != 0x100) {

            uVar5 = (int)(uVar5 * iVar8) >> 8;

          }

          if (uVar5 != 0) {

            iVar9 = uVar5 + 1;

            uVar5 = DAT_008f86b0;

            if (iVar9 != 0x100) {

              uVar3 = *(uint *)(local_30 + iVar10 * 4);

              local_34._3_1_ = (byte)(uVar3 >> 0x18);

              if (local_34._3_1_ != 0) {

                bVar14 = (byte)(uVar3 >> 8);

                bVar15 = (byte)(uVar3 >> 0x10);

                if (local_34._3_1_ == 0xff) {

                  uVar5 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(bVar15,uVar3)) >> 0x20),

                                          uVar3) >> 0x18);

                  uVar18 = (uint5)uVar5 & 0xffffffff00;

                  uVar13 = (ulonglong)CONCAT43(uVar5,CONCAT12(bVar14,(ushort)uVar3)) &

                           0xffffffff00ffffff;

                  uVar11 = (ushort)uVar3 & 0xff;

                  uVar22 = (ulonglong)

                           CONCAT52((int5)(CONCAT43((int)(((uint7)(byte)(DAT_008f86b0 >> 0x10) <<

                                                          0x20) >> 0x18),

                                                    CONCAT12((char)(DAT_008f86b0 >> 8),

                                                             (short)DAT_008f86b0)) >> 0x10),

                                    (short)DAT_008f86b0) & 0xff00ff00ff;

                  sVar21 = (short)iVar9;

                  sVar17 = (short)(uVar13 >> 0x10);

                  sVar19 = (short)(uVar18 >> 8);

                  sVar20 = (short)(uVar18 >> 0x18);

                  sVar12 = uVar11 - (((ushort)(uVar11 * sVar21) >> 8) -

                                    ((ushort)((short)uVar22 * sVar21) >> 8));

                  sVar17 = sVar17 - (((ushort)(sVar17 * sVar21) >> 8) -

                                    ((ushort)((short)(uVar22 >> 0x10) * sVar21) >> 8));

                  sVar19 = sVar19 - (((ushort)(sVar19 * sVar21) >> 8) -

                                    ((ushort)((short)(uVar22 >> 0x20) * sVar21) >> 8));

                  sVar20 = sVar20 - (((ushort)(sVar20 * sVar21) >> 8) -

                                    ((ushort)((short)(uVar13 >> 0x30) * sVar21) >> 8));

                  uVar5 = CONCAT13((0 < sVar20) * (sVar20 < 0x100) * (char)sVar20 - (0xff < sVar20),

                                   CONCAT12((0 < sVar19) * (sVar19 < 0x100) * (char)sVar19 -

                                            (0xff < sVar19),

                                            CONCAT11((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17

                                                     - (0xff < sVar17),

                                                     (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12

                                                     - (0xff < sVar12))));

                }

                else {

                  iVar7 = local_34._3_1_ + 1 + (iVar9 - ((int)((local_34._3_1_ + 1) * iVar9) >> 8));

                  local_34._0_1_ = (char)uVar3;

                  local_34 = CONCAT13((char)iVar7 + -1,

                                      CONCAT21(CONCAT11(bVar15 - (char)((int)(((uint)bVar15 -

                                                                              (DAT_008f86b0 >> 0x10

                                                                              & 0xff)) * iVar9) /

                                                                       iVar7),

                                                        bVar14 - (char)((int)(((uint)bVar14 -

                                                                              (DAT_008f86b0 >> 8 &

                                                                              0xff)) * iVar9) /

                                                                       iVar7)),

                                               (char)local_34 -

                                               (char)((int)(((uVar3 & 0xff) - (DAT_008f86b0 & 0xff))

                                                           * iVar9) / iVar7)));

                  uVar5 = local_34;

                }

              }

            }

            *(uint *)(local_30 + iVar10 * 4) = uVar5;

          }

        }

        local_30 = local_30 + iVar2;

        local_24 = local_24 + -1;

        iVar10 = iVar1;

      } while (local_24 != 0);

    }

  }

  return;

}





// --- FUN_0066f2a0 at 0x0066F2A0 (size: 619) ---


void FUN_0066f2a0(void)



{

  int iVar1;

  int iVar2;

  undefined4 uVar3;

  int in_EAX;

  uint uVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  uint uVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  ushort uVar14;

  short sVar15;

  short sVar16;

  short sVar17;

  short sVar18;

  ushort uVar20;

  ulonglong uVar19;

  int local_3c;

  int local_24;

  

  local_3c = *(int *)(in_EAX + 8);

  iVar11 = *(int *)(in_EAX + 0x14);

  local_24 = *(int *)(in_EAX + 0x20);

  iVar6 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

  if (local_24 != 0) {

    uVar9 = *(uint *)(in_EAX + 0x1c) >> 2;

    uVar7 = *(uint *)(in_EAX + 0x1c) & 3;

    iVar1 = *(int *)(in_EAX + 0xc);

    iVar2 = *(int *)(in_EAX + 0x18);

    do {

      if (uVar9 != 0) {

        iVar13 = uVar9 * 0x10 + iVar11;

        uVar4 = uVar9;

        do {

          uVar10 = *(uint *)(local_3c + -4 + uVar4 * 4);

          uVar4 = uVar4 - 1;

          iVar13 = iVar13 + -0x10;

          iVar12 = 3;

          do {

            uVar8 = uVar10 & 0xff000000 | DAT_008f86b0;

            uVar5 = uVar8 >> 0x18;

            if (iVar6 != 0x100) {

              uVar5 = (int)(uVar5 * iVar6) >> 8;

            }

            if (uVar5 != 0) {

              if (uVar5 + 1 != 0x100) {

                uVar3 = *(undefined4 *)(iVar13 + iVar12 * 4);

                uVar14 = (ushort)uVar3 & 0xff;

                uVar19 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar8) >>

                                                  0x18),

                                           CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0))

                                  >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                sVar18 = (short)(uVar5 + 1);

                uVar20 = (ushort)(byte)((uint)uVar3 >> 8);

                sVar17 = (short)CONCAT21(0xff00,(char)((uint)uVar3 >> 0x10));

                sVar15 = uVar14 - (((ushort)(uVar14 * sVar18) >> 8) -

                                  ((ushort)((short)uVar19 * sVar18) >> 8));

                sVar16 = uVar20 - (((ushort)(uVar20 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8));

                sVar17 = sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                  ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8));

                sVar18 = 0xff - (((ushort)(sVar18 * 0xff) >> 8) - ((ushort)(sVar18 * 0xff) >> 8));

                uVar8 = CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 - (0xff < sVar18),

                                 CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                          (0xff < sVar17),

                                          CONCAT11((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                                   (0xff < sVar16),

                                                   (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                   (0xff < sVar15))));

              }

              *(uint *)(iVar13 + iVar12 * 4) = uVar8;

            }

            uVar10 = uVar10 << 8;

            iVar12 = iVar12 + -1;

          } while (-1 < iVar12);

        } while (uVar4 != 0);

      }

      if (uVar7 != 0) {

        iVar13 = uVar9 * 0x10 + iVar11;

        uVar4 = uVar7;

        while (uVar4 != 0) {

          iVar12 = uVar4 - 1;

          uVar4 = uVar4 - 1;

          uVar5 = (uint)*(byte *)(iVar12 + local_3c + uVar9 * 4) << 0x18 | DAT_008f86b0;

          uVar10 = uVar5 >> 0x18;

          if (iVar6 != 0x100) {

            uVar10 = (int)(uVar10 * iVar6) >> 8;

          }

          if (uVar10 != 0) {

            if (uVar10 + 1 != 0x100) {

              uVar3 = *(undefined4 *)(iVar13 + uVar4 * 4);

              uVar14 = (ushort)uVar3 & 0xff;

              uVar19 = (ulonglong)

                       CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),uVar5) >>

                                                0x18),

                                         CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0)) >>

                                0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

              sVar18 = (short)(uVar10 + 1);

              uVar20 = (ushort)(byte)((uint)uVar3 >> 8);

              sVar17 = (short)CONCAT21(0xff00,(char)((uint)uVar3 >> 0x10));

              sVar15 = uVar14 - (((ushort)(uVar14 * sVar18) >> 8) -

                                ((ushort)((short)uVar19 * sVar18) >> 8));

              sVar16 = uVar20 - (((ushort)(uVar20 * sVar18) >> 8) -

                                ((ushort)((short)(uVar19 >> 0x10) * sVar18) >> 8));

              sVar17 = sVar17 - (((ushort)(sVar17 * sVar18) >> 8) -

                                ((ushort)((short)(uVar19 >> 0x20) * sVar18) >> 8));

              sVar18 = 0xff - (((ushort)(sVar18 * 0xff) >> 8) - ((ushort)(sVar18 * 0xff) >> 8));

              uVar5 = CONCAT13((0 < sVar18) * (sVar18 < 0x100) * (char)sVar18 - (0xff < sVar18),

                               CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                        (0xff < sVar17),

                                        CONCAT11((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                                 (0xff < sVar16),

                                                 (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                 (0xff < sVar15))));

            }

            *(uint *)(iVar13 + uVar4 * 4) = uVar5;

          }

        }

      }

      local_3c = local_3c + iVar1;

      iVar11 = iVar11 + iVar2;

      local_24 = local_24 + -1;

    } while (local_24 != 0);

  }

  return;

}





// --- FUN_0066f510 at 0x0066F510 (size: 529) ---


void FUN_0066f510(void)



{

  byte bVar1;

  int iVar2;

  uint uVar3;

  uint uVar4;

  int in_EAX;

  uint uVar5;

  uint uVar6;

  undefined4 uVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  ushort uVar12;

  short sVar13;

  short sVar14;

  short sVar15;

  short sVar16;

  undefined2 uVar17;

  undefined1 uVar20;

  ushort uVar21;

  ulonglong uVar18;

  undefined4 local_20;

  undefined4 local_18;

  undefined4 local_14;

  undefined1 uVar19;

  

  uVar4 = DAT_008f86b0;

  uVar19 = (undefined1)(DAT_008f86b0 >> 8);

  uVar20 = (undefined1)(DAT_008f86b0 >> 0x10);

  uVar17 = (undefined2)DAT_008f86b0;

  if (*(int *)(in_EAX + 8) == 0) {

    iVar10 = *(int *)(in_EAX + 0x14);

    bVar1 = *(byte *)(in_EAX + 0x24);

    local_20 = CONCAT13(bVar1,(int3)DAT_008f86b0);

    local_14 = *(int *)(in_EAX + 0x20);

    if (local_14 != 0) {

      iVar11 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar11 != 0) {

          iVar9 = iVar11;

          do {

            iVar9 = iVar9 + -1;

            if (bVar1 != 0) {

              sVar13 = bVar1 + 1;

              uVar7 = local_20;

              if (sVar13 != 0x100) {

                uVar7 = *(undefined4 *)(iVar10 + iVar9 * 4);

                uVar12 = (ushort)uVar7 & 0xff;

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(uVar20,local_20) >> 0x18),

                                           CONCAT12(uVar19,uVar17)) >> 0x10,uVar17) & 0xff00ff00ff;

                uVar21 = (ushort)(byte)((uint)uVar7 >> 8);

                sVar16 = (short)CONCAT21(0xff00,(char)((uint)uVar7 >> 0x10));

                sVar14 = uVar12 - (((ushort)(uVar12 * sVar13) >> 8) -

                                  ((ushort)((short)uVar18 * sVar13) >> 8));

                sVar15 = uVar21 - (((ushort)(uVar21 * sVar13) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar13) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar13) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x20) * sVar13) >> 8));

                sVar13 = 0xff - (((ushort)(sVar13 * 0xff) >> 8) - ((ushort)(sVar13 * 0xff) >> 8));

                uVar7 = CONCAT13((0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 - (0xff < sVar13),

                                 CONCAT12((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                          (0xff < sVar16),

                                          CONCAT11((0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                   (0xff < sVar15),

                                                   (0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                                   (0xff < sVar14))));

              }

              *(undefined4 *)(iVar10 + iVar9 * 4) = uVar7;

            }

          } while (iVar9 != 0);

        }

        iVar10 = iVar10 - iVar2;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar10 = *(int *)(in_EAX + 0x14);

    iVar11 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

    local_18 = *(int *)(in_EAX + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar9 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          uVar3 = DAT_008f86b0 >> 0x18;

          iVar8 = iVar2;

          do {

            iVar8 = iVar8 + -1;

            uVar5 = uVar3;

            if (iVar11 != 0x100) {

              uVar5 = (int)(uVar3 * iVar11) >> 8;

            }

            if (uVar5 != 0) {

              uVar6 = uVar4;

              if (uVar5 + 1 != 0x100) {

                uVar7 = *(undefined4 *)(iVar10 + iVar8 * 4);

                uVar12 = (ushort)uVar7 & 0xff;

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14(uVar20,uVar4) >> 0x18),

                                           CONCAT12(uVar19,uVar17)) >> 0x10,uVar17) & 0xff00ff00ff;

                sVar16 = (short)(uVar5 + 1);

                uVar21 = (ushort)(byte)((uint)uVar7 >> 8);

                sVar15 = (short)CONCAT21(0xff00,(char)((uint)uVar7 >> 0x10));

                sVar13 = uVar12 - (((ushort)(uVar12 * sVar16) >> 8) -

                                  ((ushort)((short)uVar18 * sVar16) >> 8));

                sVar14 = uVar21 - (((ushort)(uVar21 * sVar16) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar16) >> 8));

                sVar15 = sVar15 - (((ushort)(sVar15 * sVar16) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x20) * sVar16) >> 8));

                sVar16 = 0xff - (((ushort)(sVar16 * 0xff) >> 8) - ((ushort)(sVar16 * 0xff) >> 8));

                uVar6 = CONCAT13((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 - (0xff < sVar16),

                                 CONCAT12((0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                          (0xff < sVar15),

                                          CONCAT11((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                                   (0xff < sVar14),

                                                   (0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                                   (0xff < sVar13))));

              }

              *(uint *)(iVar10 + iVar8 * 4) = uVar6;

            }

          } while (iVar8 != 0);

        }

        iVar10 = iVar10 + iVar9;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066f730 at 0x0066F730 (size: 743) ---


void FUN_0066f730(void)



{

  int iVar1;

  int iVar2;

  ushort uVar3;

  ushort uVar4;

  int in_EAX;

  uint uVar5;

  uint uVar6;

  int iVar7;

  uint uVar8;

  int iVar9;

  uint uVar10;

  byte *pbVar11;

  byte *pbVar12;

  uint uVar13;

  int iVar14;

  short sVar15;

  short sVar16;

  short sVar17;

  ulonglong uVar18;

  uint local_44;

  uint local_40;

  int local_3c;

  int local_20;

  

  local_3c = *(int *)(in_EAX + 8);

  iVar14 = *(int *)(in_EAX + 0x14);

  iVar7 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

  local_20 = *(int *)(in_EAX + 0x20);

  if (local_20 != 0) {

    iVar1 = *(int *)(in_EAX + 0xc);

    iVar2 = *(int *)(in_EAX + 0x18);

    uVar10 = *(uint *)(in_EAX + 0x1c) >> 2;

    uVar8 = *(uint *)(in_EAX + 0x1c) & 3;

    do {

      if (uVar10 != 0) {

        pbVar11 = (byte *)(iVar14 + 0xb + uVar10 * 0xc);

        uVar5 = uVar10;

        do {

          uVar13 = *(uint *)(local_3c + -4 + uVar5 * 4);

          uVar5 = uVar5 - 1;

          pbVar11 = pbVar11 + -0xc;

          iVar9 = 4;

          pbVar12 = pbVar11;

          do {

            local_44 = uVar13 & 0xff000000 | DAT_008f86b0;

            uVar6 = local_44 >> 0x18;

            if (iVar7 != 0x100) {

              uVar6 = (int)(uVar6 * iVar7) >> 8;

            }

            if (uVar6 != 0) {

              if (uVar6 + 1 != 0x100) {

                uVar4 = *(ushort *)(pbVar12 + -2);

                uVar3 = (ushort)(((uint5)*pbVar12 << 0x20) >> 0x18);

                uVar18 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),local_44)

                                                  >> 0x18),

                                           CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0))

                                  >> 0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

                sVar17 = (short)(uVar6 + 1);

                sVar16 = (short)(CONCAT23(uVar3,CONCAT12((char)(uVar4 >> 8),uVar4)) >> 0x10);

                uVar3 = uVar3 >> 8;

                sVar15 = (uVar4 & 0xff) -

                         (((ushort)((uVar4 & 0xff) * sVar17) >> 8) -

                         ((ushort)((short)uVar18 * sVar17) >> 8));

                sVar16 = sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                  ((ushort)((short)(uVar18 >> 0x10) * sVar17) >> 8));

                sVar17 = uVar3 - (((ushort)(uVar3 * sVar17) >> 8) -

                                 ((ushort)((short)(uVar18 >> 0x20) * sVar17) >> 8));

                local_44 = (uint)CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                          (0xff < sVar17),

                                          CONCAT11((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                                   (0xff < sVar16),

                                                   (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                   (0xff < sVar15)));

              }

              pbVar12[-2] = (byte)local_44;

              pbVar12[-1] = (byte)(local_44 >> 8);

              *pbVar12 = (byte)(local_44 >> 0x10);

            }

            uVar13 = uVar13 << 8;

            pbVar12 = pbVar12 + -3;

            iVar9 = iVar9 + -1;

          } while (iVar9 != 0);

        } while (uVar5 != 0);

      }

      if (uVar8 != 0) {

        pbVar11 = (byte *)(uVar8 * 3 + 2 + iVar14 + uVar10 * 0xc);

        uVar5 = uVar8;

        do {

          iVar9 = uVar5 - 1;

          uVar5 = uVar5 - 1;

          local_40 = (uint)*(byte *)(iVar9 + local_3c + uVar10 * 4) << 0x18 | DAT_008f86b0;

          pbVar12 = pbVar11 + -3;

          uVar13 = local_40 >> 0x18;

          if (iVar7 != 0x100) {

            uVar13 = (int)(uVar13 * iVar7) >> 8;

          }

          if (uVar13 != 0) {

            if (uVar13 + 1 != 0x100) {

              uVar4 = *(ushort *)(pbVar11 + -5);

              uVar3 = (ushort)(((uint5)*pbVar12 << 0x20) >> 0x18);

              uVar18 = (ulonglong)

                       CONCAT52(CONCAT23((short)(CONCAT14((char)(DAT_008f86b0 >> 0x10),local_40) >>

                                                0x18),

                                         CONCAT12((char)(DAT_008f86b0 >> 8),(short)DAT_008f86b0)) >>

                                0x10,(short)DAT_008f86b0) & 0xff00ff00ff;

              sVar17 = (short)(uVar13 + 1);

              sVar16 = (short)(CONCAT23(uVar3,CONCAT12((char)(uVar4 >> 8),uVar4)) >> 0x10);

              uVar3 = uVar3 >> 8;

              sVar15 = (uVar4 & 0xff) -

                       (((ushort)((uVar4 & 0xff) * sVar17) >> 8) -

                       ((ushort)((short)uVar18 * sVar17) >> 8));

              sVar16 = sVar16 - (((ushort)(sVar16 * sVar17) >> 8) -

                                ((ushort)((short)(uVar18 >> 0x10) * sVar17) >> 8));

              sVar17 = uVar3 - (((ushort)(uVar3 * sVar17) >> 8) -

                               ((ushort)((short)(uVar18 >> 0x20) * sVar17) >> 8));

              local_40 = (uint)CONCAT12((0 < sVar17) * (sVar17 < 0x100) * (char)sVar17 -

                                        (0xff < sVar17),

                                        CONCAT11((0 < sVar16) * (sVar16 < 0x100) * (char)sVar16 -

                                                 (0xff < sVar16),

                                                 (0 < sVar15) * (sVar15 < 0x100) * (char)sVar15 -

                                                 (0xff < sVar15)));

            }

            pbVar11[-5] = (byte)local_40;

            pbVar11[-4] = (byte)(local_40 >> 8);

            *pbVar12 = (byte)(local_40 >> 0x10);

          }

          pbVar11 = pbVar12;

        } while (uVar5 != 0);

      }

      local_3c = local_3c + iVar1;

      iVar14 = iVar14 + iVar2;

      local_20 = local_20 + -1;

    } while (local_20 != 0);

  }

  return;

}





// --- FUN_0066fa30 at 0x0066FA30 (size: 659) ---


void FUN_0066fa30(void)



{

  byte bVar1;

  int iVar2;

  int iVar3;

  uint uVar4;

  ushort uVar5;

  ushort uVar6;

  int in_EAX;

  uint uVar7;

  byte *pbVar8;

  byte *pbVar9;

  int iVar10;

  int iVar11;

  short sVar12;

  short sVar13;

  short sVar14;

  ulonglong uVar15;

  uint local_28;

  undefined4 local_24;

  int local_18;

  int local_14;

  

  uVar4 = DAT_008f86b0;

  if (*(int *)(in_EAX + 8) == 0) {

    iVar10 = *(int *)(in_EAX + 0x14);

    bVar1 = *(byte *)(in_EAX + 0x24);

    local_14 = *(int *)(in_EAX + 0x20);

    local_24 = CONCAT13(bVar1,(int3)DAT_008f86b0);

    if (local_14 != 0) {

      iVar11 = *(int *)(in_EAX + 0x1c);

      iVar2 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar11 != 0) {

          pbVar8 = (byte *)(iVar11 * 3 + 2 + iVar10);

          local_18 = iVar11;

          do {

            pbVar9 = pbVar8 + -3;

            if (bVar1 != 0) {

              sVar12 = bVar1 + 1;

              if (sVar12 == 0x100) {

                local_28 = local_24;

              }

              else {

                uVar6 = *(ushort *)(pbVar8 + -5);

                uVar5 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

                uVar15 = (ulonglong)

                         CONCAT52(CONCAT23((short)(CONCAT14((char)(uVar4 >> 0x10),local_24) >> 0x18)

                                           ,CONCAT12((char)(uVar4 >> 8),(short)uVar4)) >> 0x10,

                                  (short)uVar4) & 0xff00ff00ff;

                sVar14 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar13 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar12) >> 8) -

                         ((ushort)((short)uVar15 * sVar12) >> 8));

                sVar14 = sVar14 - (((ushort)(sVar14 * sVar12) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x10) * sVar12) >> 8));

                sVar12 = uVar5 - (((ushort)(uVar5 * sVar12) >> 8) -

                                 ((ushort)((short)(uVar15 >> 0x20) * sVar12) >> 8));

                local_28 = (uint)CONCAT12((0 < sVar12) * (sVar12 < 0x100) * (char)sVar12 -

                                          (0xff < sVar12),

                                          CONCAT11((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                                   (0xff < sVar14),

                                                   (0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                                   (0xff < sVar13)));

              }

              pbVar8[-5] = (byte)local_28;

              pbVar8[-4] = (byte)(local_28 >> 8);

              *pbVar9 = (byte)(local_28 >> 0x10);

            }

            local_18 = local_18 + -1;

            pbVar8 = pbVar9;

          } while (local_18 != 0);

        }

        iVar10 = iVar10 - iVar2;

        local_14 = local_14 + -1;

      } while (local_14 != 0);

    }

  }

  else {

    iVar10 = *(int *)(in_EAX + 0x14);

    iVar11 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

    local_18 = *(int *)(in_EAX + 0x20);

    if (local_18 != 0) {

      iVar2 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar2 != 0) {

          uVar4 = DAT_008f86b0 >> 0x18;

          pbVar8 = (byte *)(iVar2 * 3 + 2 + iVar10);

          local_24 = iVar2;

          do {

            pbVar9 = pbVar8 + -3;

            uVar7 = uVar4;

            if (iVar11 != 0x100) {

              uVar7 = (int)(uVar4 * iVar11) >> 8;

            }

            if (uVar7 != 0) {

              if (uVar7 + 1 == 0x100) {

                local_28 = DAT_008f86b0;

              }

              else {

                uVar6 = *(ushort *)(pbVar8 + -5);

                uVar5 = (ushort)(((uint5)*pbVar9 << 0x20) >> 0x18);

                uVar15 = (ulonglong)

                         CONCAT52((int5)(CONCAT43((int)(((uint7)(byte)(DAT_008f86b0 >> 0x10) << 0x20

                                                        ) >> 0x18),

                                                  CONCAT12((char)(DAT_008f86b0 >> 8),

                                                           (short)DAT_008f86b0)) >> 0x10),

                                  (short)DAT_008f86b0) & 0xff00ff00ff;

                sVar14 = (short)(uVar7 + 1);

                sVar13 = (short)(CONCAT23(uVar5,CONCAT12((char)(uVar6 >> 8),uVar6)) >> 0x10);

                uVar5 = uVar5 >> 8;

                sVar12 = (uVar6 & 0xff) -

                         (((ushort)((uVar6 & 0xff) * sVar14) >> 8) -

                         ((ushort)((short)uVar15 * sVar14) >> 8));

                sVar13 = sVar13 - (((ushort)(sVar13 * sVar14) >> 8) -

                                  ((ushort)((short)(uVar15 >> 0x10) * sVar14) >> 8));

                sVar14 = uVar5 - (((ushort)(uVar5 * sVar14) >> 8) -

                                 ((ushort)((short)(uVar15 >> 0x20) * sVar14) >> 8));

                local_28 = (uint)CONCAT12((0 < sVar14) * (sVar14 < 0x100) * (char)sVar14 -

                                          (0xff < sVar14),

                                          CONCAT11((0 < sVar13) * (sVar13 < 0x100) * (char)sVar13 -

                                                   (0xff < sVar13),

                                                   (0 < sVar12) * (sVar12 < 0x100) * (char)sVar12 -

                                                   (0xff < sVar12)));

              }

              pbVar8[-5] = (byte)local_28;

              pbVar8[-4] = (byte)(local_28 >> 8);

              *pbVar9 = (byte)(local_28 >> 0x10);

            }

            local_24 = local_24 + -1;

            pbVar8 = pbVar9;

          } while (local_24 != 0);

        }

        iVar10 = iVar10 + iVar3;

        local_18 = local_18 + -1;

      } while (local_18 != 0);

    }

  }

  return;

}





// --- FUN_0066fcd0 at 0x0066FCD0 (size: 1071) ---


void FUN_0066fcd0(void)



{

  uint *puVar1;

  byte bVar2;

  int iVar3;

  undefined4 uVar4;

  undefined1 auVar5 [16];

  int in_EAX;

  undefined4 uVar6;

  uint *puVar7;

  int iVar8;

  int iVar9;

  uint uVar10;

  int iVar11;

  int iVar12;

  uint uVar13;

  int iVar14;

  ushort uVar15;

  short sVar16;

  undefined1 uVar19;

  short sVar20;

  short sVar22;

  ulonglong uVar17;

  short sVar23;

  undefined8 uVar24;

  short sVar25;

  undefined2 uVar26;

  undefined1 uVar29;

  ulonglong uVar27;

  float fVar30;

  float fVar31;

  float fVar32;

  float fVar33;

  float fVar34;

  float fVar35;

  undefined1 auVar36 [16];

  undefined1 auVar37 [16];

  undefined1 auVar38 [16];

  undefined4 local_4c;

  undefined4 local_48;

  int local_3c;

  int local_38;

  int local_34;

  undefined1 uVar18;

  uint5 uVar21;

  undefined1 uVar28;

  

  uVar10 = DAT_008f86b0;

  local_48 = *(int *)(in_EAX + 8);

  if (local_48 == 0) {

    iVar11 = *(int *)(in_EAX + 0x14);

    bVar2 = *(byte *)(in_EAX + 0x24);

    local_4c = CONCAT13(bVar2,(int3)DAT_008f86b0);

    local_38 = *(int *)(in_EAX + 0x20);

    if (local_38 != 0) {

      iVar8 = *(int *)(in_EAX + 0x1c);

      iVar3 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar8 != 0) {

          iVar9 = iVar8;

          do {

            iVar9 = iVar9 + -1;

            if (bVar2 != 0) {

              iVar12 = bVar2 + 1;

              uVar6 = local_4c;

              if (iVar12 != 0x100) {

                uVar4 = *(undefined4 *)(iVar11 + iVar9 * 4);

                local_48._3_1_ = (byte)((uint)uVar4 >> 0x18);

                if (local_48._3_1_ != 0) {

                  uVar19 = (undefined1)((uint)uVar4 >> 0x10);

                  uVar18 = (undefined1)((uint)uVar4 >> 8);

                  uVar15 = (ushort)uVar4;

                  uVar28 = (undefined1)(uVar10 >> 8);

                  uVar29 = (undefined1)(uVar10 >> 0x10);

                  uVar26 = (undefined2)uVar10;

                  if (local_48._3_1_ == 0xff) {

                    uVar13 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar19,uVar4)) >> 0x20)

                                             ,uVar4) >> 0x18);

                    uVar21 = (uint5)uVar13 & 0xffffffff00;

                    uVar17 = (ulonglong)CONCAT43(uVar13,CONCAT12(uVar18,uVar15)) &

                             0xffffffff00ffffff;

                    uVar27 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar29,local_4c) >> 0x18),

                                               CONCAT12(uVar28,uVar26)) >> 0x10,uVar26) &

                             0xff00ff00ff;

                    sVar25 = (short)iVar12;

                    sVar20 = (short)(uVar17 >> 0x10);

                    sVar22 = (short)(uVar21 >> 8);

                    sVar23 = (short)(uVar21 >> 0x18);

                    sVar16 = (uVar15 & 0xff) -

                             (((ushort)((uVar15 & 0xff) * sVar25) >> 8) -

                             ((ushort)((short)uVar27 * sVar25) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar25) >> 8) -

                                      ((ushort)((short)(uVar27 >> 0x10) * sVar25) >> 8));

                    sVar22 = sVar22 - (((ushort)(sVar22 * sVar25) >> 8) -

                                      ((ushort)((short)(uVar27 >> 0x20) * sVar25) >> 8));

                    sVar23 = sVar23 - (((ushort)(sVar23 * sVar25) >> 8) -

                                      ((ushort)((short)(uVar17 >> 0x30) * sVar25) >> 8));

                    uVar6 = CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)sVar23 -

                                     (0xff < sVar23),

                                     CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 -

                                              (0xff < sVar22),

                                              CONCAT11((0 < sVar20) * (sVar20 < 0x100) *

                                                       (char)sVar20 - (0xff < sVar20),

                                                       (0 < sVar16) * (sVar16 < 0x100) *

                                                       (char)sVar16 - (0xff < sVar16))));

                  }

                  else {

                    uVar13 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_48._3_1_ << 0x30)

                                                                    >> 0x28),CONCAT14(uVar19,uVar4))

                                                   >> 0x20),uVar4) >> 0x18);

                    uVar21 = (uint5)uVar13 & 0xffffffff00;

                    uVar17 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar13,CONCAT12(uVar18,uVar15)) >> 0x10),

                                      uVar15) & 0xffffffff00ff00ff;

                    fVar30 = (float)(ushort)(uVar21 >> 8);

                    fVar32 = (float)(ushort)(uVar21 >> 0x18);

                    fVar31 = (float)((uint)uVar17 & 0xffff);

                    fVar33 = (float)(ushort)(uVar17 >> 0x10);

                    uVar13 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)bVar2 << 0x30) >> 0x28)

                                                             ,CONCAT14(uVar29,local_4c)) >> 0x20),

                                             local_4c) >> 0x18);

                    uVar21 = (uint5)uVar13 & 0xffffffff00;

                    uVar17 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar13,CONCAT12(uVar28,uVar26)) >> 0x10),

                                      uVar26) & 0xffffffff00ff00ff;

                    fVar34 = (float)iVar12;

                    iVar12 = local_48._3_1_ + 1 +

                             (iVar12 - ((int)((local_48._3_1_ + 1) * iVar12) >> 8));

                    fVar35 = (float)iVar12;

                    auVar37._4_4_ = fVar35;

                    auVar37._0_4_ = fVar35;

                    auVar38._0_4_ = (fVar31 - (float)((uint)uVar17 & 0xffff)) * fVar34;

                    auVar38._4_4_ = (fVar33 - (float)(ushort)(uVar17 >> 0x10)) * fVar34;

                    auVar38._8_4_ = (fVar30 - (float)(ushort)(uVar21 >> 8)) * fVar34;

                    auVar38._12_4_ = (fVar32 - (float)(ushort)(uVar21 >> 0x18)) * fVar34;

                    auVar37._8_4_ = fVar35;

                    auVar37._12_4_ = fVar35;

                    auVar37 = divps(auVar38,auVar37);

                    uVar24 = packssdw(CONCAT44(ROUND(fVar33 - auVar37._4_4_),

                                               ROUND(fVar31 - auVar37._0_4_)),

                                      CONCAT44(ROUND(fVar32 - auVar37._12_4_),

                                               ROUND(fVar30 - auVar37._8_4_)));

                    sVar16 = (short)uVar24;

                    sVar20 = (short)((ulonglong)uVar24 >> 0x10);

                    sVar22 = (short)((ulonglong)uVar24 >> 0x20);

                    local_48 = CONCAT13((char)iVar12 + -1,

                                        CONCAT12((0 < sVar22) * (sVar22 < 0x100) *

                                                 (char)((ulonglong)uVar24 >> 0x20) - (0xff < sVar22)

                                                 ,CONCAT11((0 < sVar20) * (sVar20 < 0x100) *

                                                           (char)((ulonglong)uVar24 >> 0x10) -

                                                           (0xff < sVar20),

                                                           (0 < sVar16) * (sVar16 < 0x100) *

                                                           (char)uVar24 - (0xff < sVar16))));

                    uVar6 = local_48;

                  }

                }

              }

              *(undefined4 *)(iVar11 + iVar9 * 4) = uVar6;

            }

          } while (iVar9 != 0);

        }

        iVar11 = iVar11 - iVar3;

        local_38 = local_38 + -1;

      } while (local_38 != 0);

    }

  }

  else {

    iVar11 = *(int *)(in_EAX + 0x14);

    iVar8 = (uint)*(byte *)(in_EAX + 0x24) + (uint)(*(byte *)(in_EAX + 0x24) != 0);

    local_34 = *(int *)(in_EAX + 0x20);

    if (local_34 != 0) {

      iVar3 = *(int *)(in_EAX + 0x1c);

      iVar9 = *(int *)(in_EAX + 0xc);

      iVar12 = *(int *)(in_EAX + 0x18);

      do {

        if (iVar3 != 0) {

          puVar7 = (uint *)(iVar11 + iVar3 * 4);

          local_3c = iVar3;

          do {

            puVar1 = (uint *)((int)puVar7 + (local_48 - iVar11) + -4);

            puVar7 = puVar7 + -1;

            uVar10 = *puVar1 & 0xff000000 | DAT_008f86b0;

            uVar13 = uVar10 >> 0x18;

            if (iVar8 != 0x100) {

              uVar13 = (int)(uVar13 * iVar8) >> 8;

            }

            if (uVar13 != 0) {

              iVar14 = uVar13 + 1;

              if (iVar14 != 0x100) {

                uVar13 = *puVar7;

                local_4c._3_1_ = (byte)(uVar13 >> 0x18);

                if (local_4c._3_1_ != 0) {

                  uVar19 = (undefined1)(uVar13 >> 0x10);

                  uVar29 = (undefined1)(DAT_008f86b0 >> 0x10);

                  uVar18 = (undefined1)(uVar13 >> 8);

                  uVar15 = (ushort)uVar13;

                  uVar28 = (undefined1)(DAT_008f86b0 >> 8);

                  uVar26 = (undefined2)DAT_008f86b0;

                  if (local_4c._3_1_ == 0xff) {

                    uVar13 = (uint)(CONCAT34((int3)(CONCAT25(0xff00,CONCAT14(uVar19,uVar13)) >> 0x20

                                                   ),uVar13) >> 0x18);

                    uVar21 = (uint5)uVar13 & 0xffffffff00;

                    uVar17 = (ulonglong)CONCAT43(uVar13,CONCAT12(uVar18,uVar15)) &

                             0xffffffff00ffffff;

                    uVar27 = (ulonglong)

                             CONCAT52(CONCAT23((short)(CONCAT14(uVar29,uVar10) >> 0x18),

                                               CONCAT12(uVar28,uVar26)) >> 0x10,uVar26) &

                             0xff00ff00ff;

                    sVar25 = (short)iVar14;

                    sVar20 = (short)(uVar17 >> 0x10);

                    sVar22 = (short)(uVar21 >> 8);

                    sVar23 = (short)(uVar21 >> 0x18);

                    sVar16 = (uVar15 & 0xff) -

                             (((ushort)((uVar15 & 0xff) * sVar25) >> 8) -

                             ((ushort)((short)uVar27 * sVar25) >> 8));

                    sVar20 = sVar20 - (((ushort)(sVar20 * sVar25) >> 8) -

                                      ((ushort)((short)(uVar27 >> 0x10) * sVar25) >> 8));

                    sVar22 = sVar22 - (((ushort)(sVar22 * sVar25) >> 8) -

                                      ((ushort)((short)(uVar27 >> 0x20) * sVar25) >> 8));

                    sVar23 = sVar23 - (((ushort)(sVar23 * sVar25) >> 8) -

                                      ((ushort)((short)(uVar17 >> 0x30) * sVar25) >> 8));

                    uVar10 = CONCAT13((0 < sVar23) * (sVar23 < 0x100) * (char)sVar23 -

                                      (0xff < sVar23),

                                      CONCAT12((0 < sVar22) * (sVar22 < 0x100) * (char)sVar22 -

                                               (0xff < sVar22),

                                               CONCAT11((0 < sVar20) * (sVar20 < 0x100) *

                                                        (char)sVar20 - (0xff < sVar20),

                                                        (0 < sVar16) * (sVar16 < 0x100) *

                                                        (char)sVar16 - (0xff < sVar16))));

                  }

                  else {

                    uVar13 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)local_4c._3_1_ << 0x30)

                                                                    >> 0x28),CONCAT14(uVar19,uVar13)

                                                            ) >> 0x20),uVar13) >> 0x18);

                    uVar21 = (uint5)uVar13 & 0xffffffff00;

                    uVar17 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar13,CONCAT12(uVar18,uVar15)) >> 0x10),

                                      uVar15) & 0xffffffff00ff00ff;

                    fVar30 = (float)(ushort)(uVar21 >> 8);

                    fVar32 = (float)(ushort)(uVar21 >> 0x18);

                    fVar31 = (float)((uint)uVar17 & 0xffff);

                    fVar33 = (float)(ushort)(uVar17 >> 0x10);

                    uVar10 = (uint)(CONCAT34((int3)(CONCAT25((short)(((uint7)(byte)(uVar10 >> 0x18)

                                                                     << 0x30) >> 0x28),

                                                             CONCAT14(uVar29,uVar10)) >> 0x20),

                                             uVar10) >> 0x18);

                    uVar21 = (uint5)uVar10 & 0xffffffff00;

                    uVar17 = (ulonglong)

                             CONCAT52((int5)(CONCAT43(uVar10,CONCAT12(uVar28,uVar26)) >> 0x10),

                                      uVar26) & 0xffffffff00ff00ff;

                    fVar34 = (float)iVar14;

                    iVar14 = local_4c._3_1_ + 1 +

                             (iVar14 - ((int)((local_4c._3_1_ + 1) * iVar14) >> 8));

                    fVar35 = (float)iVar14;

                    auVar5._4_4_ = fVar35;

                    auVar5._0_4_ = fVar35;

                    auVar36._0_4_ = (fVar31 - (float)((uint)uVar17 & 0xffff)) * fVar34;

                    auVar36._4_4_ = (fVar33 - (float)(ushort)(uVar17 >> 0x10)) * fVar34;

                    auVar36._8_4_ = (fVar30 - (float)(ushort)(uVar21 >> 8)) * fVar34;

                    auVar36._12_4_ = (fVar32 - (float)(ushort)(uVar21 >> 0x18)) * fVar34;

                    auVar5._8_4_ = fVar35;

                    auVar5._12_4_ = fVar35;

                    auVar37 = divps(auVar36,auVar5);

                    uVar24 = packssdw(CONCAT44(ROUND(fVar33 - auVar37._4_4_),

                                               ROUND(fVar31 - auVar37._0_4_)),

                                      CONCAT44(ROUND(fVar32 - auVar37._12_4_),

                                               ROUND(fVar30 - auVar37._8_4_)));

                    sVar16 = (short)uVar24;

                    sVar20 = (short)((ulonglong)uVar24 >> 0x10);

                    sVar22 = (short)((ulonglong)uVar24 >> 0x20);

                    local_4c = CONCAT13((char)iVar14 + -1,

                                        CONCAT12((0 < sVar22) * (sVar22 < 0x100) *

                                                 (char)((ulonglong)uVar24 >> 0x20) - (0xff < sVar22)

                                                 ,CONCAT11((0 < sVar20) * (sVar20 < 0x100) *

                                                           (char)((ulonglong)uVar24 >> 0x10) -

                                                           (0xff < sVar20),

                                                           (0 < sVar16) * (sVar16 < 0x100) *

                                                           (char)uVar24 - (0xff < sVar16))));

                    uVar10 = local_4c;

                  }

                }

              }

              *puVar7 = uVar10;

            }

            local_3c = local_3c + -1;

          } while (local_3c != 0);

        }

        local_48 = local_48 + iVar9;

        iVar11 = iVar11 + iVar12;

        local_34 = local_34 + -1;

      } while (local_34 != 0);

    }

  }

  return;

}





