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

// --- FUN_00620080 at 0x00620080 (size: 565) ---


void FUN_00620080(int param_1,int param_2,int param_3,int param_4,byte param_5,int param_6,

                 int *param_7,int param_8)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int aiStack_124 [64];

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  

  local_24 = *param_7;

  iVar6 = 0;

  for (iVar2 = param_3; iVar2 <= param_4; iVar2 = iVar2 + 1) {

    iVar4 = (int)*(short *)(param_2 + (&DAT_00907ee0)[iVar2] * 2);

    if (iVar4 < 0) {

      iVar4 = -iVar4;

    }

    iVar4 = iVar4 >> (param_5 & 0x1f);

    aiStack_124[iVar2] = iVar4;

    if (iVar4 == 1) {

      iVar6 = iVar2;

    }

  }

  iVar5 = 0;

  iVar3 = 0;

  iVar2 = param_6 + local_24;

  iVar4 = local_24;

  if (param_3 <= param_4) {

    local_18 = param_3;

    local_20 = iVar6;

    do {

      iVar6 = local_20;

      local_1c = aiStack_124[local_18];

      if (aiStack_124[local_18] == 0) {

        iVar5 = iVar5 + 1;

      }

      else {

        iVar4 = local_24;

        if (0xf < iVar5) {

          do {

            if (iVar6 < local_18) {

              local_24 = iVar4;

              goto LAB_006201e7;

            }

            FUN_0061fc30(param_1,param_8);

            if (iVar5 + -0xf < 0x60) {

              iVar2 = *(int *)(param_8 + 0x3c0);

            }

            else {

              iVar2 = *(int *)(param_8 + 0x3c0);

              do {

                iVar2 = iVar2 + 5;

                iVar5 = iVar5 + -0x50;

              } while (0x6e < iVar5);

            }

            do {

              iVar2 = iVar2 + 1;

              iVar5 = iVar5 + -0x10;

            } while (0xf < iVar5);

            *(int *)(param_8 + 0x3c0) = iVar2;

            iVar3 = 0;

            iVar2 = param_6;

            iVar4 = 0;

          } while (0xf < iVar5);

          local_24 = 0;

        }

LAB_006201e7:

        if (local_1c < 2) {

          FUN_0061fc30(param_1,param_8);

          local_24 = 0;

          piVar1 = (int *)(iVar5 * 0x40 + 4 + param_8);

          *piVar1 = *piVar1 + 1;

          iVar3 = 0;

          iVar5 = 0;

          iVar2 = param_6;

        }

        else {

          *(byte *)(iVar3 + iVar2) = (byte)local_1c & 1;

          iVar3 = iVar3 + 1;

        }

      }

      local_18 = local_18 + 1;

    } while (local_18 <= param_4);

    if ((0 < iVar5) || (iVar4 = local_24, 0 < iVar3)) {

      iVar6 = *(int *)(param_1 + 0x28) + 1;

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

      if ((iVar6 == 0x7fff) || (iVar4 = local_24 + iVar3, DAT_00833300 + -0x3f < local_24 + iVar3))

      {

        FUN_0061fc30(param_1,param_8);

        iVar4 = 0;

      }

    }

  }

  *param_7 = iVar4;

  return;

}





// --- FUN_006202f0 at 0x006202F0 (size: 469) ---


void FUN_006202f0(int param_1,int param_2,int param_3,int param_4,int param_5,byte param_6)



{

  undefined2 uVar1;

  undefined4 uVar2;

  int iVar3;

  uint uVar4;

  int local_1c;

  int local_18;

  uint local_14;

  

  local_1c = 0;

  if (param_4 <= param_5) {

    local_1c = 0;

    do {

      iVar3 = (int)*(short *)(param_3 + (&DAT_00907ee0)[param_4] * 2);

      if (iVar3 == 0) {

        local_1c = local_1c + 1;

      }

      else {

        if (iVar3 < 0) {

          uVar4 = -iVar3 >> (param_6 & 0x1f);

          local_14 = uVar4 ^ 0xffffffff;

        }

        else {

          uVar4 = iVar3 >> (param_6 & 0x1f);

          local_14 = uVar4;

        }

        if (uVar4 == 0) {

          local_1c = local_1c + 1;

        }

        else {

          FUN_0061fc90(param_1,param_2);

          while (0xf < local_1c) {

            FUN_0061fe10(param_1,param_2,&local_1c);

          }

          local_18 = 1;

          while (uVar4 = (int)uVar4 >> 1, uVar4 != 0) {

            local_18 = local_18 + 1;

          }

          iVar3 = local_1c * 0x10 + local_18;

          uVar1 = *(undefined2 *)(param_2 + 0x408 + iVar3 * 2);

          uVar2 = *(undefined4 *)(param_2 + 8 + iVar3 * 4);

          if (*(int *)(param_1 + 0x3c) == 0) {

            iVar3 = FUN_0061ed00(param_1,uVar1,uVar2);

          }

          else {

            iVar3 = FUN_0061ede0(param_1,uVar1,uVar2);

          }

          if (iVar3 != 0) {

            return;

          }

          if (*(int *)(param_1 + 0x3c) == 0) {

            iVar3 = FUN_0061ed00(param_1,local_14,local_18);

          }

          else {

            iVar3 = FUN_0061ede0(param_1,local_14,local_18);

          }

          if (iVar3 != 0) {

            return;

          }

          local_1c = 0;

        }

      }

      param_4 = param_4 + 1;

    } while (param_4 <= param_5);

  }

  if ((0 < local_1c) &&

     (iVar3 = *(int *)(param_1 + 0x28) + 1, *(int *)(param_1 + 0x28) = iVar3, iVar3 == 0x7fff)) {

    FUN_0061fc90(param_1,param_2);

  }

  return;

}





// --- FUN_006204f0 at 0x006204F0 (size: 953) ---


void FUN_006204f0(int param_1,int param_2,int param_3,int param_4,int param_5,byte param_6,

                 int param_7,int *param_8)



{

  undefined2 uVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  bool bVar7;

  int local_134;

  int aiStack_130 [64];

  int local_30;

  int local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  

  iVar4 = *param_8;

  local_20 = 0;

  local_134 = iVar4;

  if (param_4 <= param_5) {

    local_28 = iVar4;

    iVar6 = 0;

    iVar3 = param_4;

    do {

      iVar5 = (int)*(short *)(param_3 + (&DAT_00907ee0)[iVar3] * 2);

      if (iVar5 < 0) {

        iVar5 = -iVar5;

      }

      iVar5 = iVar5 >> (param_6 & 0x1f);

      aiStack_130[iVar3] = iVar5;

      if (iVar5 == 1) {

        iVar6 = iVar3;

      }

      iVar3 = iVar3 + 1;

    } while (iVar3 <= param_5);

    local_20 = iVar6;

    local_134 = local_28;

  }

  iVar3 = 0;

  local_30 = 0;

  local_1c = 0;

  iVar6 = local_134 + param_7;

  local_18 = iVar6;

  local_2c = local_1c;

  if (param_4 <= param_5) {

    local_2c = 0;

    local_134 = iVar4;

    do {

      iVar4 = aiStack_130[param_4];

      if (iVar4 == 0) {

        local_30 = local_30 + 1;

      }

      else {

        if ((0xf < local_30) && (iVar5 = param_4, param_4 <= local_20)) {

          do {

            local_24 = iVar5;

            local_28 = iVar4;

            FUN_0061fc90(param_1,param_2);

            FUN_0061fed0(param_1,param_7,&local_134);

            local_134 = 0;

            FUN_0061fe10(param_1,param_2,&local_30);

            FUN_0061fed0(param_1,iVar6,&local_2c);

            local_2c = 0;

            iVar6 = param_7;

            iVar4 = local_28;

            iVar5 = local_24;

          } while (0xf < local_30);

          iVar3 = 0;

          param_4 = local_24;

        }

        if (iVar4 < 2) {

          FUN_0061fc90(param_1,param_2);

          FUN_0061fed0(param_1,param_7,&local_134);

          local_134 = 0;

          uVar1 = *(undefined2 *)(param_2 + 0x40a + local_30 * 0x20);

          uVar2 = *(undefined4 *)(param_2 + 0xc + local_30 * 0x40);

          if (*(int *)(param_1 + 0x3c) == 0) {

            iVar4 = FUN_0061ed00(param_1,uVar1,uVar2);

          }

          else {

            iVar4 = FUN_0061ede0(param_1,uVar1,uVar2);

          }

          if (iVar4 != 0) goto LAB_00620880;

          bVar7 = -1 < *(short *)(param_3 + (&DAT_00907ee0)[param_4] * 2);

          if (*(int *)(param_1 + 0x3c) == 0) {

            iVar4 = FUN_0061ed00(param_1,bVar7,1);

          }

          else {

            iVar4 = FUN_0061ede0(param_1,bVar7,1);

          }

          if (iVar4 != 0) goto LAB_00620880;

          FUN_0061fed0(param_1,iVar6,&local_2c);

          iVar3 = 0;

          local_2c = 0;

          local_30 = 0;

          iVar6 = param_7;

        }

        else {

          *(byte *)(iVar6 + iVar3) = (byte)iVar4 & 1;

          iVar3 = local_2c + 1;

          local_2c = iVar3;

        }

      }

      param_4 = param_4 + 1;

    } while (param_4 <= param_5);

  }

  local_1c = local_2c;

  if ((0 < local_30) || (0 < iVar3)) {

    iVar4 = *(int *)(param_1 + 0x28) + 1;

    local_134 = local_134 + iVar3;

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

    if ((iVar4 == 0x7fff) || (DAT_00833300 + -0x3f < local_134)) {

      local_2c = local_1c;

      FUN_0061fc90(param_1,param_2);

      FUN_0061fed0(param_1,param_7,&local_134);

      local_134 = 0;

    }

  }

LAB_00620880:

  *param_8 = local_134;

  return;

}





// --- FUN_006208d0 at 0x006208D0 (size: 47) ---


uint FUN_006208d0(int param_1,int param_2)



{

  uint uVar1;

  

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) - param_2;

  uVar1 = __aullshr();

  return uVar1 & (1 << ((byte)param_2 & 0x1f)) - 1U;

}





// --- FUN_00620900 at 0x00620900 (size: 44) ---


uint FUN_00620900(undefined4 param_1,byte param_2)



{

  uint uVar1;

  

  uVar1 = __aullshr();

  return uVar1 & (1 << (param_2 & 0x1f)) - 1U;

}





// --- FUN_00620930 at 0x00620930 (size: 283) ---


int FUN_00620930(uint *param_1,int param_2)



{

  byte bVar1;

  byte *pbVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  byte *pbVar6;

  uint uVar7;

  

  uVar7 = param_1[3];

  do {

    if (0x18 < (int)uVar7) {

      return 0;

    }

    if ((char)param_1[0xc] != '\0') {

LAB_006209ea:

      if (param_2 <= (int)uVar7) {

        return 0;

      }

      return 100;

    }

    uVar7 = param_1[9];

    if ((int)uVar7 < 1) {

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

        return 0;

      }

      iVar4 = FUN_00649570(param_1);

      if (iVar4 != 0) {

        return iVar4;

      }

      uVar7 = param_1[9];

    }

    pbVar2 = (byte *)param_1[4];

    pbVar6 = pbVar2 + 1;

    uVar7 = uVar7 - 1;

    param_1[4] = (uint)pbVar6;

    uVar3 = (uint)*pbVar2;

    param_1[9] = uVar7;

    uVar5 = param_1[7] + 1;

    param_1[7] = uVar5;

    if (uVar3 == 0xff) {

      do {

        if ((int)uVar7 < 1) {

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

            return -0x15;

          }

          iVar4 = FUN_00649570(param_1);

          if (iVar4 != 0) {

            return iVar4;

          }

          uVar7 = param_1[9];

          pbVar6 = (byte *)param_1[4];

          uVar5 = param_1[7];

        }

        bVar1 = *pbVar6;

        pbVar6 = pbVar6 + 1;

        uVar7 = uVar7 - 1;

        param_1[4] = (uint)pbVar6;

        uVar5 = uVar5 + 1;

        param_1[9] = uVar7;

        param_1[7] = uVar5;

      } while (bVar1 == 0xff);

      if (bVar1 != 0) {

        *(byte *)(param_1 + 0xc) = bVar1;

        uVar7 = param_1[3];

        goto LAB_006209ea;

      }

      uVar3 = 0xff;

    }

    uVar5 = *param_1;

    *param_1 = uVar5 << 8 | uVar3;

    uVar7 = param_1[3] + 8;

    param_1[1] = param_1[1] << 8 | uVar5 >> 0x18;

    param_1[3] = uVar7;

  } while( true );

}





// --- FUN_00620a70 at 0x00620A70 (size: 229) ---


int FUN_00620a70(int param_1,int param_2,uint *param_3,int param_4)



{

  ushort uVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  

  if (*(int *)(param_1 + 0xc) < param_4) {

    iVar3 = FUN_00620930(param_1,param_4);

    if (iVar3 != 0) {

      return iVar3;

    }

  }

  uVar2 = FUN_006208d0(param_1,param_4);

  while( true ) {

    uVar1 = *(ushort *)(param_2 + 0x62a + param_4 * 2);

    uVar4 = (uint)(short)uVar1;

    if (((uVar4 & 0x8000) != 0) && (uVar4 != 0xffffffff)) {

      uVar4 = (uint)uVar1;

    }

    if ((int)uVar2 <= (int)uVar4) break;

    if (*(int *)(param_1 + 0xc) < 1) {

      iVar3 = FUN_00620930(param_1,1);

      if (iVar3 != 0) {

        return iVar3;

      }

    }

    uVar4 = FUN_006208d0(param_1,1);

    uVar2 = uVar2 * 2 | uVar4;

    param_4 = param_4 + 1;

  }

  if (param_4 < 0x11) {

    *param_3 = (uint)*(ushort *)

                      (param_2 + 0x408 +

                      (((uint)*(ushort *)(param_2 + 0x64e + param_4 * 2) -

                       (uint)*(ushort *)(param_2 + 0x608 + param_4 * 2)) + uVar2) * 2);

  }

  else {

    *param_3 = 0;

  }

  return 0;

}





// --- FUN_00620b60 at 0x00620B60 (size: 155) ---


int FUN_00620b60(int param_1,uint *param_2,int param_3)



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  

  if (*(int *)(param_1 + 0xc) < 8) {

    iVar1 = FUN_00620930(param_1,0);

    if (iVar1 != 0) {

      return iVar1;

    }

    if (*(int *)(param_1 + 0xc) < 8) {

      uVar2 = 1;

      goto LAB_00620ba9;

    }

  }

  iVar1 = FUN_00620900(param_1,8);

  uVar3 = (uint)*(ushort *)(param_3 + 10 + iVar1 * 4);

  if (uVar3 != 0) {

    *(uint *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) - uVar3;

    *param_2 = (uint)*(ushort *)(param_3 + 8 + iVar1 * 4);

    return 0;

  }

  uVar2 = 9;

LAB_00620ba9:

  iVar1 = FUN_00620a70(param_1,param_3,param_2,uVar2);

  if (iVar1 == 0) {

    return 0;

  }

  return iVar1;

}





// --- FUN_00621030 at 0x00621030 (size: 218) ---


int FUN_00621030(int param_1,undefined4 param_2,undefined2 *param_3,short *param_4,byte param_5)



{

  int iVar1;

  uint uVar2;

  short sVar3;

  uint local_14;

  

  local_14 = 0;

  iVar1 = FUN_00620b60(param_1,&local_14,param_2);

  if (iVar1 != 0) {

    if (iVar1 < 0) {

      return iVar1;

    }

    return 0;

  }

  if (local_14 == 0) {

    sVar3 = *param_4;

  }

  else {

    local_14 = local_14 & 0xf;

    if (*(int *)(param_1 + 0xc) < (int)local_14) {

      iVar1 = FUN_00620930(param_1,local_14);

      if (iVar1 != 0) {

        if (iVar1 < 0) {

          return iVar1;

        }

        return 0;

      }

    }

    uVar2 = FUN_006208d0(param_1,local_14);

    if ((1 << ((char)local_14 - 1U & 0x1f) & uVar2) == 0) {

      uVar2 = uVar2 + *(int *)(&DAT_009080c0 + local_14 * 4);

    }

    sVar3 = *param_4 + (short)uVar2;

    *param_4 = sVar3;

  }

  *param_3 = (short)((int)sVar3 << (param_5 & 0x1f));

  return 0;

}





// --- FUN_00621110 at 0x00621110 (size: 103) ---


int FUN_00621110(int param_1,ushort *param_2,byte param_3)



{

  int iVar1;

  

  if (*(int *)(param_1 + 0xc) < 1) {

    iVar1 = FUN_00620930(param_1,1);

    if (iVar1 != 0) {

      if (-1 < iVar1) {

        return 0;

      }

      return iVar1;

    }

  }

  iVar1 = FUN_006208d0(param_1,1);

  if (iVar1 != 0) {

    *param_2 = *param_2 | (ushort)(1 << (param_3 & 0x1f));

  }

  return 0;

}





// --- FUN_00621180 at 0x00621180 (size: 392) ---


ulonglong FUN_00621180(int param_1,uint param_2,undefined4 param_3,int param_4,int param_5,

                      byte param_6)



{

  uint uVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  ulonglong uVar5;

  uint local_14;

  

  uVar3 = param_2;

  if (*(int *)(param_1 + 0x28) < 1) {

    for (; param_4 <= param_5; param_4 = param_4 + 1) {

      uVar5 = FUN_00620b60(param_1,&local_14,param_3);

      if ((int)uVar5 != 0) {

        if ((int)uVar5 < 0) {

          return uVar5;

        }

        return uVar5 & 0xffffffff00000000;

      }

      iVar4 = (int)local_14 >> 4;

      local_14 = local_14 & 0xf;

      if (local_14 == 0) {

        if (iVar4 != 0xf) {

          iVar2 = 1 << ((byte)iVar4 & 0x1f);

          uVar3 = 0;

          if (iVar4 != 0) {

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

            if (*(int *)(param_1 + 0xc) < iVar4) {

              uVar5 = FUN_00620930(param_1,iVar4);

              if ((int)uVar5 != 0) {

                if ((int)uVar5 < 0) {

                  return uVar5;

                }

                return uVar5 & 0xffffffff00000000;

              }

            }

            iVar2 = FUN_006208d0(param_1,iVar4);

            uVar3 = *(uint *)(param_1 + 0x28);

            iVar2 = iVar2 + uVar3;

          }

          *(int *)(param_1 + 0x28) = iVar2 + -1;

          break;

        }

        param_4 = param_4 + 0xf;

        uVar3 = 0;

      }

      else {

        param_4 = param_4 + iVar4;

        if (*(int *)(param_1 + 0xc) < (int)local_14) {

          uVar5 = FUN_00620930(param_1,local_14);

          if ((int)uVar5 != 0) {

            if ((int)uVar5 < 0) {

              return uVar5;

            }

            return uVar5 & 0xffffffff00000000;

          }

        }

        uVar1 = FUN_006208d0(param_1,local_14);

        if ((1 << ((char)local_14 - 1U & 0x1f) & uVar1) == 0) {

          uVar3 = *(int *)(&DAT_009080c0 + local_14 * 4) + uVar1 << (param_6 & 0x1f);

          *(short *)(param_2 + (&DAT_00907ee0)[param_4] * 2) = (short)uVar3;

        }

        else {

          uVar3 = (&DAT_00907ee0)[param_4];

          *(short *)(param_2 + uVar3 * 2) = (short)(uVar1 << (param_6 & 0x1f));

        }

      }

    }

  }

  else {

    *(int *)(param_1 + 0x28) = *(int *)(param_1 + 0x28) + -1;

  }

  return (ulonglong)uVar3 << 0x20;

}





// --- FUN_00621330 at 0x00621330 (size: 743) ---


int FUN_00621330(int param_1,int param_2,undefined4 param_3,int param_4,int param_5,byte param_6)



{

  short sVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint local_1c;

  uint local_18;

  uint local_14;

  

  local_18 = 1 << (param_6 & 0x1f);

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

  local_14 = -1 << (param_6 & 0x1f);

  if ((iVar2 == 0) && (param_4 <= param_5)) {

    do {

      iVar2 = FUN_00620b60(param_1,&local_1c,param_3);

      if (iVar2 != 0) {

        if (iVar2 < 0) {

          return iVar2;

        }

        return 0;

      }

      iVar4 = (int)local_1c >> 4;

      local_1c = local_1c & 0xf;

      if (local_1c == 0) {

        if (iVar4 != 0xf) {

          iVar2 = 1 << ((byte)iVar4 & 0x1f);

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

          if (iVar4 != 0) {

            if (*(int *)(param_1 + 0xc) < iVar4) {

              iVar2 = FUN_00620930(param_1,iVar4);

              if (iVar2 != 0) {

                if (iVar2 < 0) {

                  return iVar2;

                }

                return 0;

              }

            }

            iVar2 = FUN_006208d0(param_1,iVar4);

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

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

          }

          goto LAB_006214bd;

        }

      }

      else {

        if (*(int *)(param_1 + 0xc) < 1) {

          iVar2 = FUN_00620930(param_1,1);

          if (iVar2 != 0) {

            if (iVar2 < 0) {

              return iVar2;

            }

            return 0;

          }

        }

        iVar2 = FUN_006208d0(param_1,1);

        if (iVar2 == 0) {

          local_1c = local_14;

        }

        else {

          local_1c = local_18;

        }

      }

      do {

        iVar2 = (&DAT_00907ee0)[param_4];

        if (*(short *)(param_2 + iVar2 * 2) == 0) {

          iVar4 = iVar4 + -1;

          if (iVar4 < 0) break;

        }

        else {

          if (*(int *)(param_1 + 0xc) < 1) {

            iVar3 = FUN_00620930(param_1,1);

            if (iVar3 != 0) {

              if (iVar3 < 0) {

                return iVar3;

              }

              return 0;

            }

          }

          iVar3 = FUN_006208d0(param_1,1);

          if (iVar3 != 0) {

            sVar1 = *(short *)(param_2 + iVar2 * 2);

            if (((int)sVar1 & local_18) == 0) {

              if (sVar1 < 0) {

                *(short *)(param_2 + iVar2 * 2) = sVar1 + (short)local_14;

              }

              else {

                *(short *)(param_2 + iVar2 * 2) = sVar1 + (short)local_18;

              }

            }

          }

        }

        param_4 = param_4 + 1;

      } while (param_4 <= param_5);

      if (local_1c != 0) {

        *(short *)(param_2 + (&DAT_00907ee0)[param_4] * 2) = (short)local_1c;

      }

      param_4 = param_4 + 1;

    } while (param_4 <= param_5);

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

  }

LAB_006214bd:

  if (0 < iVar2) {

    if (param_4 <= param_5) {

      do {

        iVar2 = (&DAT_00907ee0)[param_4];

        if (*(short *)(param_2 + iVar2 * 2) != 0) {

          if (*(int *)(param_1 + 0xc) < 1) {

            iVar4 = FUN_00620930(param_1,1);

            if (iVar4 != 0) {

              if (iVar4 < 0) {

                return iVar4;

              }

              return 0;

            }

          }

          iVar4 = FUN_006208d0(param_1,1);

          if (iVar4 != 0) {

            sVar1 = *(short *)(param_2 + iVar2 * 2);

            if (((int)sVar1 & local_18) == 0) {

              if (sVar1 < 0) {

                *(short *)(param_2 + iVar2 * 2) = sVar1 + (short)local_14;

              }

              else {

                *(short *)(param_2 + iVar2 * 2) = sVar1 + (short)local_18;

              }

            }

          }

        }

        param_4 = param_4 + 1;

      } while (param_4 <= param_5);

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

    }

    *(int *)(param_1 + 0x28) = iVar2 + -1;

  }

  return 0;

}





// --- FUN_00621640 at 0x00621640 (size: 264) ---


void FUN_00621640(int param_1)



{

  int iVar1;

  undefined2 local_84 [64];

  

  iVar1 = 0;

  do {

    local_84[(&DAT_00907ee0)[iVar1]] = *(undefined2 *)(param_1 + iVar1 * 2);

    local_84[(&DAT_00907ee4)[iVar1]] = *(undefined2 *)(param_1 + 2 + iVar1 * 2);

    local_84[(&DAT_00907ee8)[iVar1]] = *(undefined2 *)(param_1 + 4 + iVar1 * 2);

    local_84[(&DAT_00907eec)[iVar1]] = *(undefined2 *)(param_1 + 6 + iVar1 * 2);

    iVar1 = iVar1 + 4;

  } while (iVar1 < 0x40);

  iVar1 = 0;

  do {

    *(undefined2 *)(param_1 + iVar1 * 2) = local_84[iVar1];

    *(undefined2 *)(param_1 + 2 + iVar1 * 2) = local_84[iVar1 + 1];

    *(undefined2 *)(param_1 + 4 + iVar1 * 2) = local_84[iVar1 + 2];

    *(undefined2 *)(param_1 + 6 + iVar1 * 2) = local_84[iVar1 + 3];

    iVar1 = iVar1 + 4;

  } while (iVar1 < 0x40);

  *(undefined2 *)(param_1 + 0x80) = 0;

  *(undefined2 *)(param_1 + 0x82) = 0;

  *(undefined2 *)(param_1 + 0x84) = 0;

  *(undefined2 *)(param_1 + 0x86) = 0;

  *(undefined2 *)(param_1 + 0x88) = 0;

  *(undefined2 *)(param_1 + 0x8a) = 0;

  *(undefined2 *)(param_1 + 0x8c) = 0;

  *(undefined2 *)(param_1 + 0x8e) = 0;

  *(undefined2 *)(param_1 + 0x90) = 0;

  *(undefined2 *)(param_1 + 0x92) = 0;

  *(undefined2 *)(param_1 + 0x94) = 0;

  *(undefined2 *)(param_1 + 0x96) = 0;

  *(undefined2 *)(param_1 + 0x98) = 0;

  *(undefined2 *)(param_1 + 0x9a) = 0;

  *(undefined2 *)(param_1 + 0x9c) = 0;

  *(undefined2 *)(param_1 + 0x9e) = 0;

  return;

}





// --- FUN_00622940 at 0x00622940 (size: 35) ---


void FUN_00622940(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00654b90(param_1,param_2,param_3);

  return;

}





// --- FUN_00622970 at 0x00622970 (size: 35) ---


void FUN_00622970(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00654e10(param_1,param_2,param_3);

  return;

}





// --- FUN_006229a0 at 0x006229A0 (size: 107) ---


int FUN_006229a0(int param_1)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int aiStack_14 [2];

  

  iVar1 = (**(code **)(*(int *)(param_1 + 8) + 0x5c))(0,0,param_1);

  if ((iVar1 == 0) && (*(int *)(param_1 + 0x3c) != 0)) {

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

    iVar2 = FUN_00619550(*(int *)(param_1 + 0x3c),param_1 + 0x40,iVar3,aiStack_14);

    if ((iVar2 == 0) || (iVar3 != aiStack_14[0])) {

      iVar1 = -0x17;

    }

    else {

      *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_1 + 0x14);

    }

  }

  return iVar1;

}





// --- FUN_00622a10 at 0x00622A10 (size: 86) ---


undefined4 FUN_00622a10(int param_1)



{

  int iVar1;

  int iVar2;

  int local_c;

  

  iVar2 = *(int *)(param_1 + 0x10) - *(int *)(param_1 + 0x14);

  iVar1 = FUN_00619550(*(undefined4 *)(param_1 + 0x3c),param_1 + 0x40,iVar2,&local_c);

  if ((iVar1 != 0) && (iVar2 == local_c)) {

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

    *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x14) + *(int *)(param_1 + 0x20);

    return 0;

  }

  return 0xffffffe9;

}





// --- FUN_00622a70 at 0x00622A70 (size: 1723) ---


undefined4 FUN_00622a70(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  

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

  uVar2 = 0;

  if (*(int *)(param_1 + 0x74) == 0) {

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

    if ((iVar4 == 0) || (*(int *)(param_1 + 0x68) == 0)) {

      if ((iVar4 == 0) || (*(int *)(param_1 + 0x68) != 0)) {

        if ((iVar4 == 0) && (*(int *)(param_1 + 0x68) != 0)) {

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

          if ((iVar4 == 1) && (*(int *)(param_1 + 0x30) == 3)) {

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

            *(undefined1 **)(iVar1 + 0x60) = &LAB_0062e490;

            return uVar2;

          }

          if ((iVar4 == 3) && (*(int *)(param_1 + 0x30) == 3)) {

            if (*(int *)(param_1 + 0x34) == 1) {

              *(undefined4 *)(param_1 + 0x18) = 1;

              *(undefined1 **)(iVar1 + 0x60) = &LAB_006239b0;

              return uVar2;

            }

            if (*(int *)(param_1 + 0x34) == 2) {

              *(undefined4 *)(param_1 + 0x18) = 2;

              *(undefined1 **)(iVar1 + 0x60) = &LAB_00624350;

              return uVar2;

            }

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

            return uVar2;

          }

          if ((iVar4 == 3) && (*(int *)(param_1 + 0x30) == 4)) {

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

            *(undefined1 **)(iVar1 + 0x60) = &LAB_0062d510;

            return uVar2;

          }

          if (iVar4 != 4) {

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

            return uVar2;

          }

          if (*(int *)(param_1 + 0x30) == 4) {

            if (*(int *)(param_1 + 0x34) == 5) {

              *(undefined4 *)(param_1 + 0x18) = 10;

              *(undefined1 **)(iVar1 + 0x60) = &LAB_006287d0;

              return uVar2;

            }

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

            return uVar2;

          }

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

          return uVar2;

        }

        if (iVar4 != 0) {

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

          return uVar2;

        }

        if (*(int *)(param_1 + 0x68) != 0) {

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

          return uVar2;

        }

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

        if (((iVar4 == 1) && (*(int *)(param_1 + 0x34) == 4)) && (*(int *)(param_1 + 0x58) == 4)) {

          *(undefined4 *)(param_1 + 0x18) = 0x14;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062d420;

          return uVar2;

        }

        if (((iVar4 == 3) && (*(int *)(param_1 + 0x30) == 1)) && (*(int *)(param_1 + 0x58) == 3)) {

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

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062f380;

          return uVar2;

        }

        if ((iVar4 == 3) && (*(int *)(param_1 + 0x30) == 3)) {

          if (*(int *)(param_1 + 0x34) == 2) {

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

            *(undefined1 **)(iVar1 + 0x60) = &LAB_0062f380;

            return uVar2;

          }

          *(undefined4 *)(param_1 + 0x18) = 0xf;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062b190;

          return uVar2;

        }

        if ((iVar4 == 3) && (*(int *)(param_1 + 0x30) == 4)) {

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

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062f380;

          return uVar2;

        }

        if (iVar4 == 4) {

          *(undefined4 *)(param_1 + 0x18) = 0xe;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062aba0;

          return uVar2;

        }

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

        if ((*(int *)(param_1 + 0x58) == 0xff) && (*(int *)(param_1 + 0x34) == 0xff)) {

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062f380;

          return uVar2;

        }

      }

      else {

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

        if ((*(int *)(param_1 + 0x37c0) == 3) && (*(int *)(param_1 + 0x30) == 1)) {

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062ebb0;

          return uVar2;

        }

        if (((*(int *)(param_1 + 0x37c0) != 3) || (*(int *)(param_1 + 0x30) != 3)) ||

           (*(int *)(param_1 + 0x34) == 2)) {

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062ebb0;

          return uVar2;

        }

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

        iVar3 = *(int *)(iVar4 + 4);

        if ((((iVar3 == 2) && (*(int *)(iVar4 + 8) == 2)) &&

            ((*(int *)(iVar4 + 0x14) == 1 &&

             ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))))) &&

           (*(int *)(iVar4 + 0x28) == 1)) {

          *(undefined4 *)(param_1 + 0x18) = 0x10;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062bd10;

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

          iVar3 = *(int *)(iVar4 + 4);

        }

        if (((((iVar3 == 2) && (*(int *)(iVar4 + 8) == 1)) && (*(int *)(iVar4 + 0x14) == 1)) &&

            ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))) &&

           (*(int *)(iVar4 + 0x28) == 1)) {

          if (*(int *)(param_1 + 0x38) == 2) {

            *(undefined4 *)(param_1 + 0x18) = 0x12;

            *(undefined1 **)(iVar1 + 0x60) = &LAB_0062ce00;

            return uVar2;

          }

          *(undefined4 *)(param_1 + 0x18) = 0x11;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062c510;

          return uVar2;

        }

      }

    }

    else {

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

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

      if ((iVar4 < 1) || (0xff < iVar4)) {

        return 0xfffffff2;

      }

      if (iVar4 == 3) {

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

        if ((iVar4 == 1) && (*(int *)(param_1 + 0x30) == 3)) {

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

          if (((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 2)) &&

             ((*(int *)(iVar4 + 0x14) == 1 &&

              (((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)) &&

               (*(int *)(iVar4 + 0x28) == 1)))))) {

            *(undefined4 *)(param_1 + 0x18) = 3;

            *(undefined1 **)(iVar1 + 0x60) = &LAB_006254e0;

            return uVar2;

          }

          if (((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 1)) &&

             (((*(int *)(iVar4 + 0x14) == 1 &&

               ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))) &&

              (*(int *)(iVar4 + 0x28) == 1)))) {

            *(undefined4 *)(param_1 + 0x18) = 5;

            *(undefined1 **)(iVar1 + 0x60) = &LAB_00627250;

            return uVar2;

          }

        }

        else if ((iVar4 == 1) && (*(int *)(param_1 + 0x30) == 4)) {

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

          if (((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 2)) &&

             (((*(int *)(iVar4 + 0x14) == 1 &&

               ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))) &&

              (*(int *)(iVar4 + 0x28) == 1)))) {

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

            *(undefined1 **)(iVar1 + 0x60) = &LAB_0062d510;

            return uVar2;

          }

          if (((((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 1)) &&

               (*(int *)(iVar4 + 0x14) == 1)) &&

              ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))) &&

             (*(int *)(iVar4 + 0x28) == 1)) {

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

            *(undefined1 **)(iVar1 + 0x60) = &LAB_0062d510;

            return uVar2;

          }

        }

        else if ((iVar4 == 2) && (*(int *)(param_1 + 0x30) == 3)) {

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

          if ((*(int *)(iVar4 + 4) == 2) &&

             ((((*(int *)(iVar4 + 8) == 2 && (*(int *)(iVar4 + 0x14) == 1)) &&

               (*(int *)(iVar4 + 0x18) == 1)) &&

              ((*(int *)(iVar4 + 0x24) == 1 && (*(int *)(iVar4 + 0x28) == 1)))))) {

            *(undefined4 *)(param_1 + 0x18) = 4;

            *(undefined1 **)(iVar1 + 0x60) = &LAB_00626660;

            return uVar2;

          }

          if (((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 1)) &&

             ((*(int *)(iVar4 + 0x14) == 1 &&

              (((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)) &&

               (*(int *)(iVar4 + 0x28) == 1)))))) {

            *(undefined4 *)(param_1 + 0x18) = 6;

            *(undefined1 **)(iVar1 + 0x60) = &LAB_00627e50;

            return uVar2;

          }

        }

      }

      else if (((iVar4 == 4) && (*(int *)(param_1 + 0x34) == 5)) && (*(int *)(param_1 + 0x30) == 4))

      {

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

        if (((((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 2)) &&

             ((*(int *)(iVar4 + 0x14) == 1 &&

              ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))))) &&

            (*(int *)(iVar4 + 0x28) == 1)) &&

           ((*(int *)(iVar4 + 0x34) == 2 && (*(int *)(iVar4 + 0x38) == 2)))) {

          *(undefined4 *)(param_1 + 0x18) = 0xb;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_0062a730;

          return uVar2;

        }

        if ((((((*(int *)(iVar4 + 4) == 2) && (*(int *)(iVar4 + 8) == 1)) &&

              (*(int *)(iVar4 + 0x14) == 1)) &&

             ((*(int *)(iVar4 + 0x18) == 1 && (*(int *)(iVar4 + 0x24) == 1)))) &&

            (*(int *)(iVar4 + 0x28) == 1)) &&

           ((*(int *)(iVar4 + 0x34) == 2 && (*(int *)(iVar4 + 0x38) == 1)))) {

          *(undefined4 *)(param_1 + 0x18) = 0xc;

          *(undefined1 **)(iVar1 + 0x60) = &LAB_00629430;

          return uVar2;

        }

      }

    }

  }

  else {

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

  }

  return uVar2;

}





// --- FUN_00623130 at 0x00623130 (size: 1125) ---


void FUN_00623130(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  uint uVar1;

  undefined2 *puVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  undefined2 local_1c2;

  undefined2 local_1c0 [202];

  int local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  undefined2 *local_14;

  

  iVar3 = 0;

  if (0 < param_4) {

    local_1c = 0;

    local_20 = 0;

    local_28 = 0;

    local_14 = local_1c0;

    do {

      local_18 = 0;

      if (0 < param_3) {

        local_18 = 0;

        local_24 = iVar3;

        iVar6 = local_20;

        iVar7 = local_1c;

        do {

          uVar4 = (uint)*(byte *)(iVar7 + param_1);

          uVar5 = (uint)*(byte *)(iVar7 + 1 + param_1);

          uVar1 = (uint)*(byte *)(iVar7 + 2 + param_1);

          iVar7 = iVar7 + 3;

          local_1c0[iVar6] = (short)(uVar4 * 0x4d + uVar5 * 0x96 + -0x7f80 + uVar1 * 0x1d >> 8);

          local_1c0[iVar6 + 0x40] =

               (short)(uVar4 * -0x2b + uVar5 * -0x55 + 0x80 + uVar1 * 0x80 >> 8);

          local_1c0[iVar6 + 0x80] =

               (short)(uVar4 * 0x80 + uVar5 * -0x6b + 0x80 + uVar1 * -0x15 >> 8);

          iVar6 = iVar6 + 1;

          local_18 = local_18 + 1;

        } while (local_18 < param_3);

      }

      if (local_18 < 8) {

        local_2c = (int)local_1c0 + local_28;

        puVar2 = local_1c0 + local_18 + local_20;

        local_24 = iVar3;

        do {

          local_18 = local_18 + 1;

          *puVar2 = *(undefined2 *)((int)&local_1c2 + param_3 * 2 + local_28);

          puVar2[0x40] = *(undefined2 *)((int)local_1c0 + param_3 * 2 + local_28 + 0x7e);

          puVar2[0x80] = *(undefined2 *)((int)local_1c0 + param_3 * 2 + local_28 + 0xfe);

          puVar2 = puVar2 + 1;

        } while (local_18 < 8);

      }

      local_1c = local_1c + param_2;

      local_20 = local_20 + 8;

      local_28 = local_28 + 0x10;

      iVar3 = iVar3 + 1;

    } while (iVar3 < param_4);

  }

  if (iVar3 < 8) {

    puVar2 = local_1c0 + iVar3 * 8;

    do {

      *puVar2 = puVar2[-8];

      puVar2[0x40] = puVar2[0x38];

      iVar3 = iVar3 + 1;

      puVar2[0x80] = puVar2[0x78];

      puVar2[1] = puVar2[-7];

      puVar2[0x41] = puVar2[0x39];

      puVar2[0x81] = puVar2[0x79];

      puVar2[2] = puVar2[-6];

      puVar2[0x42] = puVar2[0x3a];

      puVar2[0x82] = puVar2[0x7a];

      puVar2[3] = puVar2[-5];

      puVar2[0x43] = puVar2[0x3b];

      puVar2[0x83] = puVar2[0x7b];

      puVar2[4] = puVar2[-4];

      puVar2[0x44] = puVar2[0x3c];

      puVar2[0x84] = puVar2[0x7c];

      puVar2[5] = puVar2[-3];

      puVar2[0x45] = puVar2[0x3d];

      puVar2[0x85] = puVar2[0x7d];

      puVar2[6] = puVar2[-2];

      puVar2[0x46] = puVar2[0x3e];

      puVar2[0x86] = puVar2[0x7e];

      puVar2[7] = puVar2[-1];

      puVar2[0x47] = puVar2[0x3f];

      puVar2[0x87] = puVar2[0x7f];

      puVar2 = puVar2 + 8;

    } while (iVar3 < 8);

  }

  iVar3 = 0;

  do {

    *(undefined2 *)(param_5 + iVar3 * 2) = local_1c0[iVar3];

    *(undefined2 *)(param_5 + 0x80 + iVar3 * 2) = local_1c0[iVar3 + 0x40];

    *(undefined2 *)(param_5 + 0x100 + iVar3 * 2) = local_1c0[iVar3 + 0x80];

    *(undefined2 *)(param_5 + 2 + iVar3 * 2) = local_1c0[iVar3 + 1];

    *(undefined2 *)(param_5 + 0x82 + iVar3 * 2) = local_1c0[iVar3 + 0x41];

    *(undefined2 *)(param_5 + 0x102 + iVar3 * 2) = local_1c0[iVar3 + 0x81];

    *(undefined2 *)(param_5 + 4 + iVar3 * 2) = local_1c0[iVar3 + 2];

    *(undefined2 *)(param_5 + 0x84 + iVar3 * 2) = local_1c0[iVar3 + 0x42];

    *(undefined2 *)(param_5 + 0x104 + iVar3 * 2) = local_1c0[iVar3 + 0x82];

    *(undefined2 *)(param_5 + 6 + iVar3 * 2) = local_1c0[iVar3 + 3];

    *(undefined2 *)(param_5 + 0x86 + iVar3 * 2) = local_1c0[iVar3 + 0x43];

    *(undefined2 *)(param_5 + 0x106 + iVar3 * 2) = local_1c0[iVar3 + 0x83];

    *(undefined2 *)(param_5 + 8 + iVar3 * 2) = local_1c0[iVar3 + 4];

    *(undefined2 *)(param_5 + 0x88 + iVar3 * 2) = local_1c0[iVar3 + 0x44];

    *(undefined2 *)(param_5 + 0x108 + iVar3 * 2) = local_1c0[iVar3 + 0x84];

    *(undefined2 *)(param_5 + 10 + iVar3 * 2) = local_1c0[iVar3 + 5];

    *(undefined2 *)(param_5 + 0x8a + iVar3 * 2) = local_1c0[iVar3 + 0x45];

    *(undefined2 *)(param_5 + 0x10a + iVar3 * 2) = local_1c0[iVar3 + 0x85];

    *(undefined2 *)(param_5 + 0xc + iVar3 * 2) = local_1c0[iVar3 + 6];

    *(undefined2 *)(param_5 + 0x8c + iVar3 * 2) = local_1c0[iVar3 + 0x46];

    *(undefined2 *)(param_5 + 0x10c + iVar3 * 2) = local_1c0[iVar3 + 0x86];

    *(undefined2 *)(param_5 + 0xe + iVar3 * 2) = local_1c0[iVar3 + 7];

    *(undefined2 *)(param_5 + 0x8e + iVar3 * 2) = local_1c0[iVar3 + 0x47];

    *(undefined2 *)(param_5 + 0x10e + iVar3 * 2) = local_1c0[iVar3 + 0x87];

    iVar3 = iVar3 + 8;

  } while (iVar3 < 0x40);

  return;

}





// --- FUN_00623ac0 at 0x00623AC0 (size: 1141) ---


void FUN_00623ac0(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  uint uVar1;

  undefined2 *puVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  undefined2 local_1c2;

  undefined2 local_1c0 [202];

  int local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  undefined2 *local_14;

  

  iVar3 = 0;

  if (0 < param_4) {

    local_1c = 0;

    local_20 = 0;

    local_28 = 0;

    local_14 = local_1c0;

    do {

      local_18 = 0;

      if (0 < param_3) {

        local_18 = 0;

        local_24 = iVar3;

        iVar6 = local_20;

        iVar7 = local_1c;

        do {

          uVar4 = (uint)*(byte *)(iVar7 + param_1);

          uVar5 = (uint)*(byte *)(iVar7 + 1 + param_1);

          uVar1 = (uint)*(byte *)(iVar7 + 2 + param_1);

          iVar7 = iVar7 + 3;

          local_1c0[iVar6] = (short)(uVar4 * 0x1d + uVar5 * 0x96 + -0x7f80 + uVar1 * 0x4d >> 8);

          local_1c0[iVar6 + 0x40] =

               (short)(uVar4 * 0x80 + uVar5 * -0x55 + 0x80 + uVar1 * -0x2b >> 8);

          local_1c0[iVar6 + 0x80] =

               (short)(uVar4 * -0x15 + uVar5 * -0x6b + 0x80 + uVar1 * 0x80 >> 8);

          iVar6 = iVar6 + 1;

          local_18 = local_18 + 1;

        } while (local_18 < param_3);

      }

      if (local_18 < 8) {

        local_2c = (int)local_1c0 + local_28;

        puVar2 = local_1c0 + local_18 + local_20;

        local_24 = iVar3;

        do {

          local_18 = local_18 + 1;

          *puVar2 = *(undefined2 *)((int)&local_1c2 + param_3 * 2 + local_28);

          puVar2[0x40] = *(undefined2 *)((int)local_1c0 + param_3 * 2 + local_28 + 0x7e);

          puVar2[0x80] = *(undefined2 *)((int)local_1c0 + param_3 * 2 + local_28 + 0xfe);

          puVar2 = puVar2 + 1;

        } while (local_18 < 8);

      }

      local_1c = local_1c + param_2;

      local_20 = local_20 + 8;

      local_28 = local_28 + 0x10;

      iVar3 = iVar3 + 1;

    } while (iVar3 < param_4);

  }

  if (iVar3 < 8) {

    puVar2 = local_1c0 + iVar3 * 8;

    do {

      *puVar2 = puVar2[-8];

      puVar2[0x40] = puVar2[0x38];

      iVar3 = iVar3 + 1;

      puVar2[0x80] = puVar2[0x78];

      puVar2[1] = puVar2[-7];

      puVar2[0x41] = puVar2[0x39];

      puVar2[0x81] = puVar2[0x79];

      puVar2[2] = puVar2[-6];

      puVar2[0x42] = puVar2[0x3a];

      puVar2[0x82] = puVar2[0x7a];

      puVar2[3] = puVar2[-5];

      puVar2[0x43] = puVar2[0x3b];

      puVar2[0x83] = puVar2[0x7b];

      puVar2[4] = puVar2[-4];

      puVar2[0x44] = puVar2[0x3c];

      puVar2[0x84] = puVar2[0x7c];

      puVar2[5] = puVar2[-3];

      puVar2[0x45] = puVar2[0x3d];

      puVar2[0x85] = puVar2[0x7d];

      puVar2[6] = puVar2[-2];

      puVar2[0x46] = puVar2[0x3e];

      puVar2[0x86] = puVar2[0x7e];

      puVar2[7] = puVar2[-1];

      puVar2[0x47] = puVar2[0x3f];

      puVar2[0x87] = puVar2[0x7f];

      puVar2 = puVar2 + 8;

    } while (iVar3 < 8);

  }

  iVar3 = 0;

  do {

    *(undefined2 *)(param_5 + iVar3 * 2) = local_1c0[iVar3];

    *(undefined2 *)(param_5 + 0x80 + iVar3 * 2) = local_1c0[iVar3 + 0x40];

    *(undefined2 *)(param_5 + 0x100 + iVar3 * 2) = local_1c0[iVar3 + 0x80];

    *(undefined2 *)(param_5 + 2 + iVar3 * 2) = local_1c0[iVar3 + 1];

    *(undefined2 *)(param_5 + 0x82 + iVar3 * 2) = local_1c0[iVar3 + 0x41];

    *(undefined2 *)(param_5 + 0x102 + iVar3 * 2) = local_1c0[iVar3 + 0x81];

    *(undefined2 *)(param_5 + 4 + iVar3 * 2) = local_1c0[iVar3 + 2];

    *(undefined2 *)(param_5 + 0x84 + iVar3 * 2) = local_1c0[iVar3 + 0x42];

    *(undefined2 *)(param_5 + 0x104 + iVar3 * 2) = local_1c0[iVar3 + 0x82];

    *(undefined2 *)(param_5 + 6 + iVar3 * 2) = local_1c0[iVar3 + 3];

    *(undefined2 *)(param_5 + 0x86 + iVar3 * 2) = local_1c0[iVar3 + 0x43];

    *(undefined2 *)(param_5 + 0x106 + iVar3 * 2) = local_1c0[iVar3 + 0x83];

    *(undefined2 *)(param_5 + 8 + iVar3 * 2) = local_1c0[iVar3 + 4];

    *(undefined2 *)(param_5 + 0x88 + iVar3 * 2) = local_1c0[iVar3 + 0x44];

    *(undefined2 *)(param_5 + 0x108 + iVar3 * 2) = local_1c0[iVar3 + 0x84];

    *(undefined2 *)(param_5 + 10 + iVar3 * 2) = local_1c0[iVar3 + 5];

    *(undefined2 *)(param_5 + 0x8a + iVar3 * 2) = local_1c0[iVar3 + 0x45];

    *(undefined2 *)(param_5 + 0x10a + iVar3 * 2) = local_1c0[iVar3 + 0x85];

    *(undefined2 *)(param_5 + 0xc + iVar3 * 2) = local_1c0[iVar3 + 6];

    *(undefined2 *)(param_5 + 0x8c + iVar3 * 2) = local_1c0[iVar3 + 0x46];

    *(undefined2 *)(param_5 + 0x10c + iVar3 * 2) = local_1c0[iVar3 + 0x86];

    *(undefined2 *)(param_5 + 0xe + iVar3 * 2) = local_1c0[iVar3 + 7];

    *(undefined2 *)(param_5 + 0x8e + iVar3 * 2) = local_1c0[iVar3 + 0x47];

    *(undefined2 *)(param_5 + 0x10e + iVar3 * 2) = local_1c0[iVar3 + 0x87];

    iVar3 = iVar3 + 8;

  } while (iVar3 < 0x40);

  return;

}





// --- FUN_00624460 at 0x00624460 (size: 1352) ---


void FUN_00624460(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  undefined2 *puVar1;

  uint uVar2;

  undefined2 *puVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  undefined2 *puVar7;

  int iVar8;

  int iVar9;

  undefined2 *puVar10;

  undefined2 local_642;

  undefined2 local_640 [16];

  undefined1 local_620 [478];

  undefined2 local_442 [256];

  undefined2 auStack_242 [267];

  int local_2c;

  int local_28;

  undefined2 *local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  iVar4 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_2c = 0;

    local_24 = local_640;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar4;

        iVar8 = local_1c;

        iVar9 = local_18;

        do {

          uVar5 = (uint)*(byte *)(iVar9 + param_1);

          uVar6 = (uint)*(byte *)(iVar9 + 1 + param_1);

          uVar2 = (uint)*(byte *)(iVar9 + 2 + param_1);

          iVar9 = iVar9 + 3;

          local_640[iVar8] = (short)(uVar5 * 0x4d + uVar6 * 0x96 + -0x7f80 + uVar2 * 0x1d >> 8);

          local_442[iVar8 + 1] = (short)(uVar5 * -0x2b + uVar6 * -0x55 + 0x80 + uVar2 * 0x80 >> 8);

          auStack_242[iVar8 + 1] = (short)(uVar5 * 0x80 + uVar6 * -0x6b + 0x80 + uVar2 * -0x15 >> 8)

          ;

          iVar8 = iVar8 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 0x10) {

        local_28 = (int)local_640 + local_2c;

        puVar3 = local_640 + local_14 + local_1c;

        local_20 = iVar4;

        do {

          local_14 = local_14 + 1;

          *puVar3 = *(undefined2 *)((int)&local_642 + param_3 * 2 + local_2c);

          puVar3[0x100] = *(undefined2 *)((int)local_442 + param_3 * 2 + local_2c);

          puVar3[0x200] = *(undefined2 *)((int)auStack_242 + param_3 * 2 + local_2c);

          puVar3 = puVar3 + 1;

        } while (local_14 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_2c = local_2c + 0x20;

      iVar4 = iVar4 + 1;

    } while (iVar4 < param_4);

  }

  if (iVar4 < 0x10) {

    puVar3 = local_640 + iVar4 * 0x10;

    do {

      *puVar3 = puVar3[-0x10];

      puVar3[0x100] = puVar3[0xf0];

      iVar4 = iVar4 + 1;

      puVar3[0x200] = puVar3[0x1f0];

      puVar3[1] = puVar3[-0xf];

      puVar3[0x101] = puVar3[0xf1];

      puVar3[0x201] = puVar3[0x1f1];

      puVar3[2] = puVar3[-0xe];

      puVar3[0x102] = puVar3[0xf2];

      puVar3[0x202] = puVar3[0x1f2];

      puVar3[3] = puVar3[-0xd];

      puVar3[0x103] = puVar3[0xf3];

      puVar3[0x203] = puVar3[499];

      puVar3[4] = puVar3[-0xc];

      puVar3[0x104] = puVar3[0xf4];

      puVar3[0x204] = puVar3[500];

      puVar3[5] = puVar3[-0xb];

      puVar3[0x105] = puVar3[0xf5];

      puVar3[0x205] = puVar3[0x1f5];

      puVar3[6] = puVar3[-10];

      puVar3[0x106] = puVar3[0xf6];

      puVar3[0x206] = puVar3[0x1f6];

      puVar3[7] = puVar3[-9];

      puVar3[0x107] = puVar3[0xf7];

      puVar3[0x207] = puVar3[0x1f7];

      puVar3[8] = puVar3[-8];

      puVar3[0x108] = puVar3[0xf8];

      puVar3[0x208] = puVar3[0x1f8];

      puVar3[9] = puVar3[-7];

      puVar3[0x109] = puVar3[0xf9];

      puVar3[0x209] = puVar3[0x1f9];

      puVar3[10] = puVar3[-6];

      puVar3[0x10a] = puVar3[0xfa];

      puVar3[0x20a] = puVar3[0x1fa];

      puVar3[0xb] = puVar3[-5];

      puVar3[0x10b] = puVar3[0xfb];

      puVar3[0x20b] = puVar3[0x1fb];

      puVar3[0xc] = puVar3[-4];

      puVar3[0x10c] = puVar3[0xfc];

      puVar3[0x20c] = puVar3[0x1fc];

      puVar3[0xd] = puVar3[-3];

      puVar3[0x10d] = puVar3[0xfd];

      puVar3[0x20d] = puVar3[0x1fd];

      puVar3[0xe] = puVar3[-2];

      puVar3[0x10e] = puVar3[0xfe];

      puVar3[0x20e] = puVar3[0x1fe];

      puVar3[0xf] = puVar3[-1];

      puVar3[0x10f] = puVar3[0xff];

      puVar3[0x20f] = puVar3[0x1ff];

      puVar3 = puVar3 + 0x10;

    } while (iVar4 < 0x10);

  }

  iVar8 = 0;

  iVar4 = 0;

  iVar9 = 0;

  do {

    puVar10 = (undefined2 *)(param_5 + iVar8 * 2);

    puVar3 = local_640 + iVar4;

    puVar7 = local_640 + iVar9;

    do {

      *puVar10 = *puVar3;

      puVar10[0x40] = puVar3[8];

      puVar10[0x80] = puVar3[0x80];

      puVar1 = puVar3 + 0x88;

      puVar3 = puVar3 + 1;

      puVar10[0xc0] = *puVar1;

      puVar10[0x100] =

           (short)((int)(short)puVar7[0x100] + (int)(short)puVar7[0x101] + (int)(short)puVar7[0x110]

                   + 2 + (int)(short)puVar7[0x111] >> 2);

      puVar10[0x140] =

           (short)((int)(short)puVar7[0x200] + (int)(short)puVar7[0x201] + (int)(short)puVar7[0x210]

                   + 2 + (int)(short)puVar7[0x211] >> 2);

      puVar10 = puVar10 + 1;

      puVar7 = puVar7 + 2;

    } while ((int)puVar7 < (int)(local_620 + iVar9 * 2));

    iVar8 = iVar8 + 8;

    iVar4 = iVar4 + 0x10;

    iVar9 = iVar9 + 0x20;

  } while (iVar9 < 0x100);

  return;

}





// --- FUN_006249b0 at 0x006249B0 (size: 2586) ---


void FUN_006249b0(byte *param_1,int param_2,undefined2 *param_3,undefined2 *param_4,

                 undefined2 *param_5)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  byte bVar4;

  byte bVar5;

  byte bVar6;

  byte bVar7;

  byte bVar8;

  byte bVar9;

  byte bVar10;

  byte bVar11;

  byte bVar12;

  byte bVar13;

  byte bVar14;

  byte bVar15;

  byte bVar16;

  byte bVar17;

  byte bVar18;

  byte bVar19;

  byte bVar20;

  byte bVar21;

  byte bVar22;

  byte bVar23;

  byte bVar24;

  byte bVar25;

  byte bVar26;

  byte bVar27;

  byte bVar28;

  byte bVar29;

  byte bVar30;

  byte bVar31;

  byte bVar32;

  byte bVar33;

  byte bVar34;

  byte bVar35;

  byte bVar36;

  byte bVar37;

  byte bVar38;

  byte bVar39;

  byte bVar40;

  byte bVar41;

  byte bVar42;

  byte bVar43;

  byte bVar44;

  byte bVar45;

  byte bVar46;

  byte bVar47;

  byte bVar48;

  int iVar49;

  int iVar50;

  int iVar51;

  int local_54;

  undefined2 *local_18;

  undefined2 *local_14;

  

  local_54 = 0;

  local_18 = param_5;

  local_14 = param_4;

  do {

    *param_3 = (short)((uint)*param_1 * 0x4d + (uint)param_1[1] * 0x96 + -0x7f80 +

                       (uint)param_1[2] * 0x1d >> 8);

    param_3[1] = (short)((uint)param_1[3] * 0x4d + (uint)param_1[4] * 0x96 + -0x7f80 +

                         (uint)param_1[5] * 0x1d >> 8);

    param_3[2] = (short)((uint)param_1[6] * 0x4d + (uint)param_1[7] * 0x96 + -0x7f80 +

                         (uint)param_1[8] * 0x1d >> 8);

    param_3[3] = (short)((uint)param_1[9] * 0x4d + (uint)param_1[10] * 0x96 + -0x7f80 +

                         (uint)param_1[0xb] * 0x1d >> 8);

    param_3[4] = (short)((uint)param_1[0xc] * 0x4d + (uint)param_1[0xd] * 0x96 + -0x7f80 +

                         (uint)param_1[0xe] * 0x1d >> 8);

    param_3[5] = (short)((uint)param_1[0xf] * 0x4d + (uint)param_1[0x10] * 0x96 + -0x7f80 +

                         (uint)param_1[0x11] * 0x1d >> 8);

    param_3[6] = (short)((uint)param_1[0x12] * 0x4d + (uint)param_1[0x13] * 0x96 + -0x7f80 +

                         (uint)param_1[0x14] * 0x1d >> 8);

    param_3[7] = (short)((uint)param_1[0x15] * 0x4d + (uint)param_1[0x16] * 0x96 + -0x7f80 +

                         (uint)param_1[0x17] * 0x1d >> 8);

    param_3[0x40] =

         (short)((uint)param_1[0x18] * 0x4d + (uint)param_1[0x19] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1a] * 0x1d >> 8);

    param_3[0x41] =

         (short)((uint)param_1[0x1b] * 0x4d + (uint)param_1[0x1c] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1d] * 0x1d >> 8);

    param_3[0x42] =

         (short)((uint)param_1[0x1e] * 0x4d + (uint)param_1[0x1f] * 0x96 + -0x7f80 +

                 (uint)param_1[0x20] * 0x1d >> 8);

    param_3[0x43] =

         (short)((uint)param_1[0x21] * 0x4d + (uint)param_1[0x22] * 0x96 + -0x7f80 +

                 (uint)param_1[0x23] * 0x1d >> 8);

    param_3[0x44] =

         (short)((uint)param_1[0x24] * 0x4d + (uint)param_1[0x25] * 0x96 + -0x7f80 +

                 (uint)param_1[0x26] * 0x1d >> 8);

    param_3[0x45] =

         (short)((uint)param_1[0x27] * 0x4d + (uint)param_1[0x28] * 0x96 + -0x7f80 +

                 (uint)param_1[0x29] * 0x1d >> 8);

    param_3[0x46] =

         (short)((uint)param_1[0x2a] * 0x4d + (uint)param_1[0x2b] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2c] * 0x1d >> 8);

    param_3[0x47] =

         (short)((uint)param_1[0x2d] * 0x4d + (uint)param_1[0x2e] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2f] * 0x1d >> 8);

    bVar1 = *param_1;

    bVar2 = param_1[3];

    bVar3 = param_1[1];

    bVar4 = param_1[4];

    bVar5 = param_1[2];

    bVar6 = param_1[5];

    bVar7 = param_1[9];

    bVar8 = param_1[6];

    bVar9 = param_1[7];

    bVar10 = param_1[10];

    bVar11 = param_1[0xb];

    bVar12 = param_1[8];

    bVar13 = param_1[0xc];

    bVar14 = param_1[0xf];

    bVar15 = param_1[0x10];

    bVar16 = param_1[0xd];

    bVar17 = param_1[0xe];

    bVar18 = param_1[0x11];

    bVar19 = param_1[0x15];

    bVar20 = param_1[0x12];

    bVar21 = param_1[0x13];

    bVar22 = param_1[0x16];

    bVar23 = param_1[0x17];

    bVar24 = param_1[0x14];

    bVar25 = param_1[0x18];

    bVar26 = param_1[0x1b];

    bVar27 = param_1[0x1c];

    bVar28 = param_1[0x19];

    bVar29 = param_1[0x1a];

    bVar30 = param_1[0x1d];

    bVar31 = param_1[0x21];

    bVar32 = param_1[0x1e];

    bVar33 = param_1[0x1f];

    bVar34 = param_1[0x22];

    bVar35 = param_1[0x23];

    bVar36 = param_1[0x20];

    bVar37 = param_1[0x24];

    bVar38 = param_1[0x27];

    bVar39 = param_1[0x28];

    bVar40 = param_1[0x25];

    bVar41 = param_1[0x26];

    bVar42 = param_1[0x29];

    bVar43 = param_1[0x2d];

    bVar44 = param_1[0x2a];

    bVar45 = param_1[0x2b];

    bVar46 = param_1[0x2e];

    bVar47 = param_1[0x2f];

    bVar48 = param_1[0x2c];

    param_1 = param_1 + param_2;

    param_3[8] = (short)((uint)*param_1 * 0x4d + (uint)param_1[1] * 0x96 + -0x7f80 +

                         (uint)param_1[2] * 0x1d >> 8);

    param_3[9] = (short)((uint)param_1[3] * 0x4d + (uint)param_1[4] * 0x96 + -0x7f80 +

                         (uint)param_1[5] * 0x1d >> 8);

    param_3[10] = (short)((uint)param_1[6] * 0x4d + (uint)param_1[7] * 0x96 + -0x7f80 +

                          (uint)param_1[8] * 0x1d >> 8);

    param_3[0xb] = (short)((uint)param_1[9] * 0x4d + (uint)param_1[10] * 0x96 + -0x7f80 +

                           (uint)param_1[0xb] * 0x1d >> 8);

    param_3[0xc] = (short)((uint)param_1[0xc] * 0x4d + (uint)param_1[0xd] * 0x96 + -0x7f80 +

                           (uint)param_1[0xe] * 0x1d >> 8);

    param_3[0xd] = (short)((uint)param_1[0xf] * 0x4d + (uint)param_1[0x10] * 0x96 + -0x7f80 +

                           (uint)param_1[0x11] * 0x1d >> 8);

    param_3[0xe] = (short)((uint)param_1[0x12] * 0x4d + (uint)param_1[0x13] * 0x96 + -0x7f80 +

                           (uint)param_1[0x14] * 0x1d >> 8);

    param_3[0xf] = (short)((uint)param_1[0x15] * 0x4d + (uint)param_1[0x16] * 0x96 + -0x7f80 +

                           (uint)param_1[0x17] * 0x1d >> 8);

    param_3[0x48] =

         (short)((uint)param_1[0x18] * 0x4d + (uint)param_1[0x19] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1a] * 0x1d >> 8);

    param_3[0x49] =

         (short)((uint)param_1[0x1b] * 0x4d + (uint)param_1[0x1c] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1d] * 0x1d >> 8);

    param_3[0x4a] =

         (short)((uint)param_1[0x1e] * 0x4d + (uint)param_1[0x1f] * 0x96 + -0x7f80 +

                 (uint)param_1[0x20] * 0x1d >> 8);

    param_3[0x4b] =

         (short)((uint)param_1[0x21] * 0x4d + (uint)param_1[0x22] * 0x96 + -0x7f80 +

                 (uint)param_1[0x23] * 0x1d >> 8);

    param_3[0x4c] =

         (short)((uint)param_1[0x24] * 0x4d + (uint)param_1[0x25] * 0x96 + -0x7f80 +

                 (uint)param_1[0x26] * 0x1d >> 8);

    param_3[0x4d] =

         (short)((uint)param_1[0x27] * 0x4d + (uint)param_1[0x28] * 0x96 + -0x7f80 +

                 (uint)param_1[0x29] * 0x1d >> 8);

    param_3[0x4e] =

         (short)((uint)param_1[0x2a] * 0x4d + (uint)param_1[0x2b] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2c] * 0x1d >> 8);

    param_3[0x4f] =

         (short)((uint)param_1[0x2d] * 0x4d + (uint)param_1[0x2e] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2f] * 0x1d >> 8);

    iVar51 = (uint)*param_1 + (uint)param_1[3] + (uint)bVar1 + (uint)bVar2;

    iVar50 = (uint)param_1[1] + (uint)param_1[4] + (uint)bVar3 + (uint)bVar4;

    iVar49 = (uint)param_1[2] + (uint)param_1[5] + (uint)bVar5 + (uint)bVar6;

    *local_14 = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    param_3 = param_3 + 0x10;

    *local_18 = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[6] + (uint)param_1[9] + (uint)bVar8 + (uint)bVar7;

    iVar50 = (uint)param_1[7] + (uint)param_1[10] + (uint)bVar9 + (uint)bVar10;

    iVar49 = (uint)param_1[8] + (uint)param_1[0xb] + (uint)bVar12 + (uint)bVar11;

    local_14[1] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[1] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[0xc] + (uint)param_1[0xf] + (uint)bVar13 + (uint)bVar14;

    iVar50 = (uint)param_1[0xd] + (uint)param_1[0x10] + (uint)bVar16 + (uint)bVar15;

    iVar49 = (uint)param_1[0xe] + (uint)param_1[0x11] + (uint)bVar17 + (uint)bVar18;

    local_14[2] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[2] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[0x12] + (uint)param_1[0x15] + (uint)bVar20 + (uint)bVar19;

    iVar50 = (uint)param_1[0x13] + (uint)param_1[0x16] + (uint)bVar21 + (uint)bVar22;

    iVar49 = (uint)param_1[0x14] + (uint)param_1[0x17] + (uint)bVar24 + (uint)bVar23;

    local_14[3] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[3] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[0x18] + (uint)param_1[0x1b] + (uint)bVar25 + (uint)bVar26;

    iVar50 = (uint)param_1[0x19] + (uint)param_1[0x1c] + (uint)bVar28 + (uint)bVar27;

    iVar49 = (uint)param_1[0x1a] + (uint)param_1[0x1d] + (uint)bVar29 + (uint)bVar30;

    local_14[4] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[4] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[0x1e] + (uint)param_1[0x21] + (uint)bVar32 + (uint)bVar31;

    iVar50 = (uint)param_1[0x1f] + (uint)param_1[0x22] + (uint)bVar33 + (uint)bVar34;

    iVar49 = (uint)param_1[0x20] + (uint)param_1[0x23] + (uint)bVar36 + (uint)bVar35;

    local_14[5] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[5] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[0x24] + (uint)param_1[0x27] + (uint)bVar37 + (uint)bVar38;

    iVar50 = (uint)param_1[0x25] + (uint)param_1[0x28] + (uint)bVar40 + (uint)bVar39;

    iVar49 = (uint)param_1[0x26] + (uint)param_1[0x29] + (uint)bVar41 + (uint)bVar42;

    local_14[6] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[6] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = (uint)param_1[0x2a] + (uint)param_1[0x2d] + (uint)bVar44 + (uint)bVar43;

    iVar50 = (uint)param_1[0x2b] + (uint)param_1[0x2e] + (uint)bVar45 + (uint)bVar46;

    iVar49 = (uint)param_1[0x2c] + (uint)param_1[0x2f] + (uint)bVar48 + (uint)bVar47;

    local_14[7] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[7] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    local_54 = local_54 + 2;

    local_14 = local_14 + 8;

    local_18 = local_18 + 8;

    param_1 = param_1 + param_2;

  } while (local_54 < 8);

  return;

}





// --- FUN_006255e0 at 0x006255E0 (size: 1352) ---


void FUN_006255e0(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  undefined2 *puVar1;

  uint uVar2;

  undefined2 *puVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  undefined2 *puVar7;

  int iVar8;

  int iVar9;

  undefined2 *puVar10;

  undefined2 local_642;

  undefined2 local_640 [16];

  undefined1 local_620 [478];

  undefined2 local_442 [256];

  undefined2 auStack_242 [267];

  int local_2c;

  int local_28;

  undefined2 *local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  iVar4 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_2c = 0;

    local_24 = local_640;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar4;

        iVar8 = local_1c;

        iVar9 = local_18;

        do {

          uVar5 = (uint)*(byte *)(iVar9 + param_1);

          uVar6 = (uint)*(byte *)(iVar9 + 1 + param_1);

          uVar2 = (uint)*(byte *)(iVar9 + 2 + param_1);

          iVar9 = iVar9 + 3;

          local_640[iVar8] = (short)(uVar5 * 0x1d + uVar6 * 0x96 + -0x7f80 + uVar2 * 0x4d >> 8);

          local_442[iVar8 + 1] = (short)(uVar5 * 0x80 + uVar6 * -0x55 + 0x80 + uVar2 * -0x2b >> 8);

          auStack_242[iVar8 + 1] = (short)(uVar5 * -0x15 + uVar6 * -0x6b + 0x80 + uVar2 * 0x80 >> 8)

          ;

          iVar8 = iVar8 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 0x10) {

        local_28 = (int)local_640 + local_2c;

        puVar3 = local_640 + local_14 + local_1c;

        local_20 = iVar4;

        do {

          local_14 = local_14 + 1;

          *puVar3 = *(undefined2 *)((int)&local_642 + param_3 * 2 + local_2c);

          puVar3[0x100] = *(undefined2 *)((int)local_442 + param_3 * 2 + local_2c);

          puVar3[0x200] = *(undefined2 *)((int)auStack_242 + param_3 * 2 + local_2c);

          puVar3 = puVar3 + 1;

        } while (local_14 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_2c = local_2c + 0x20;

      iVar4 = iVar4 + 1;

    } while (iVar4 < param_4);

  }

  if (iVar4 < 0x10) {

    puVar3 = local_640 + iVar4 * 0x10;

    do {

      *puVar3 = puVar3[-0x10];

      puVar3[0x100] = puVar3[0xf0];

      iVar4 = iVar4 + 1;

      puVar3[0x200] = puVar3[0x1f0];

      puVar3[1] = puVar3[-0xf];

      puVar3[0x101] = puVar3[0xf1];

      puVar3[0x201] = puVar3[0x1f1];

      puVar3[2] = puVar3[-0xe];

      puVar3[0x102] = puVar3[0xf2];

      puVar3[0x202] = puVar3[0x1f2];

      puVar3[3] = puVar3[-0xd];

      puVar3[0x103] = puVar3[0xf3];

      puVar3[0x203] = puVar3[499];

      puVar3[4] = puVar3[-0xc];

      puVar3[0x104] = puVar3[0xf4];

      puVar3[0x204] = puVar3[500];

      puVar3[5] = puVar3[-0xb];

      puVar3[0x105] = puVar3[0xf5];

      puVar3[0x205] = puVar3[0x1f5];

      puVar3[6] = puVar3[-10];

      puVar3[0x106] = puVar3[0xf6];

      puVar3[0x206] = puVar3[0x1f6];

      puVar3[7] = puVar3[-9];

      puVar3[0x107] = puVar3[0xf7];

      puVar3[0x207] = puVar3[0x1f7];

      puVar3[8] = puVar3[-8];

      puVar3[0x108] = puVar3[0xf8];

      puVar3[0x208] = puVar3[0x1f8];

      puVar3[9] = puVar3[-7];

      puVar3[0x109] = puVar3[0xf9];

      puVar3[0x209] = puVar3[0x1f9];

      puVar3[10] = puVar3[-6];

      puVar3[0x10a] = puVar3[0xfa];

      puVar3[0x20a] = puVar3[0x1fa];

      puVar3[0xb] = puVar3[-5];

      puVar3[0x10b] = puVar3[0xfb];

      puVar3[0x20b] = puVar3[0x1fb];

      puVar3[0xc] = puVar3[-4];

      puVar3[0x10c] = puVar3[0xfc];

      puVar3[0x20c] = puVar3[0x1fc];

      puVar3[0xd] = puVar3[-3];

      puVar3[0x10d] = puVar3[0xfd];

      puVar3[0x20d] = puVar3[0x1fd];

      puVar3[0xe] = puVar3[-2];

      puVar3[0x10e] = puVar3[0xfe];

      puVar3[0x20e] = puVar3[0x1fe];

      puVar3[0xf] = puVar3[-1];

      puVar3[0x10f] = puVar3[0xff];

      puVar3[0x20f] = puVar3[0x1ff];

      puVar3 = puVar3 + 0x10;

    } while (iVar4 < 0x10);

  }

  iVar8 = 0;

  iVar4 = 0;

  iVar9 = 0;

  do {

    puVar10 = (undefined2 *)(param_5 + iVar8 * 2);

    puVar3 = local_640 + iVar4;

    puVar7 = local_640 + iVar9;

    do {

      *puVar10 = *puVar3;

      puVar10[0x40] = puVar3[8];

      puVar10[0x80] = puVar3[0x80];

      puVar1 = puVar3 + 0x88;

      puVar3 = puVar3 + 1;

      puVar10[0xc0] = *puVar1;

      puVar10[0x100] =

           (short)((int)(short)puVar7[0x100] + (int)(short)puVar7[0x101] + (int)(short)puVar7[0x110]

                   + 2 + (int)(short)puVar7[0x111] >> 2);

      puVar10[0x140] =

           (short)((int)(short)puVar7[0x200] + (int)(short)puVar7[0x201] + (int)(short)puVar7[0x210]

                   + 2 + (int)(short)puVar7[0x211] >> 2);

      puVar10 = puVar10 + 1;

      puVar7 = puVar7 + 2;

    } while ((int)puVar7 < (int)(local_620 + iVar9 * 2));

    iVar8 = iVar8 + 8;

    iVar4 = iVar4 + 0x10;

    iVar9 = iVar9 + 0x20;

  } while (iVar9 < 0x100);

  return;

}





// --- FUN_00625b30 at 0x00625B30 (size: 2586) ---


void FUN_00625b30(byte *param_1,int param_2,undefined2 *param_3,undefined2 *param_4,

                 undefined2 *param_5)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  byte bVar4;

  byte bVar5;

  byte bVar6;

  byte bVar7;

  byte bVar8;

  byte bVar9;

  byte bVar10;

  byte bVar11;

  byte bVar12;

  byte bVar13;

  byte bVar14;

  byte bVar15;

  byte bVar16;

  byte bVar17;

  byte bVar18;

  byte bVar19;

  byte bVar20;

  byte bVar21;

  byte bVar22;

  byte bVar23;

  byte bVar24;

  byte bVar25;

  byte bVar26;

  byte bVar27;

  byte bVar28;

  byte bVar29;

  byte bVar30;

  byte bVar31;

  byte bVar32;

  byte bVar33;

  byte bVar34;

  byte bVar35;

  byte bVar36;

  byte bVar37;

  byte bVar38;

  byte bVar39;

  byte bVar40;

  byte bVar41;

  byte bVar42;

  byte bVar43;

  byte bVar44;

  byte bVar45;

  byte bVar46;

  byte bVar47;

  byte bVar48;

  int iVar49;

  int iVar50;

  int iVar51;

  int local_54;

  undefined2 *local_18;

  undefined2 *local_14;

  

  local_54 = 0;

  local_18 = param_5;

  local_14 = param_4;

  do {

    *param_3 = (short)((uint)param_1[2] * 0x4d + (uint)param_1[1] * 0x96 + -0x7f80 +

                       (uint)*param_1 * 0x1d >> 8);

    param_3[1] = (short)((uint)param_1[5] * 0x4d + (uint)param_1[4] * 0x96 + -0x7f80 +

                         (uint)param_1[3] * 0x1d >> 8);

    param_3[2] = (short)((uint)param_1[8] * 0x4d + (uint)param_1[7] * 0x96 + -0x7f80 +

                         (uint)param_1[6] * 0x1d >> 8);

    param_3[3] = (short)((uint)param_1[0xb] * 0x4d + (uint)param_1[10] * 0x96 + -0x7f80 +

                         (uint)param_1[9] * 0x1d >> 8);

    param_3[4] = (short)((uint)param_1[0xe] * 0x4d + (uint)param_1[0xd] * 0x96 + -0x7f80 +

                         (uint)param_1[0xc] * 0x1d >> 8);

    param_3[5] = (short)((uint)param_1[0x11] * 0x4d + (uint)param_1[0x10] * 0x96 + -0x7f80 +

                         (uint)param_1[0xf] * 0x1d >> 8);

    param_3[6] = (short)((uint)param_1[0x14] * 0x4d + (uint)param_1[0x13] * 0x96 + -0x7f80 +

                         (uint)param_1[0x12] * 0x1d >> 8);

    param_3[7] = (short)((uint)param_1[0x17] * 0x4d + (uint)param_1[0x16] * 0x96 + -0x7f80 +

                         (uint)param_1[0x15] * 0x1d >> 8);

    param_3[0x40] =

         (short)((uint)param_1[0x1a] * 0x4d + (uint)param_1[0x19] * 0x96 + -0x7f80 +

                 (uint)param_1[0x18] * 0x1d >> 8);

    param_3[0x41] =

         (short)((uint)param_1[0x1d] * 0x4d + (uint)param_1[0x1c] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1b] * 0x1d >> 8);

    param_3[0x42] =

         (short)((uint)param_1[0x20] * 0x4d + (uint)param_1[0x1f] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1e] * 0x1d >> 8);

    param_3[0x43] =

         (short)((uint)param_1[0x23] * 0x4d + (uint)param_1[0x22] * 0x96 + -0x7f80 +

                 (uint)param_1[0x21] * 0x1d >> 8);

    param_3[0x44] =

         (short)((uint)param_1[0x26] * 0x4d + (uint)param_1[0x25] * 0x96 + -0x7f80 +

                 (uint)param_1[0x24] * 0x1d >> 8);

    param_3[0x45] =

         (short)((uint)param_1[0x29] * 0x4d + (uint)param_1[0x28] * 0x96 + -0x7f80 +

                 (uint)param_1[0x27] * 0x1d >> 8);

    param_3[0x46] =

         (short)((uint)param_1[0x2c] * 0x4d + (uint)param_1[0x2b] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2a] * 0x1d >> 8);

    param_3[0x47] =

         (short)((uint)param_1[0x2f] * 0x4d + (uint)param_1[0x2e] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2d] * 0x1d >> 8);

    bVar1 = *param_1;

    bVar2 = param_1[3];

    bVar3 = param_1[1];

    bVar4 = param_1[4];

    bVar5 = param_1[2];

    bVar6 = param_1[5];

    bVar7 = param_1[9];

    bVar8 = param_1[6];

    bVar9 = param_1[7];

    bVar10 = param_1[10];

    bVar11 = param_1[0xb];

    bVar12 = param_1[8];

    bVar13 = param_1[0xc];

    bVar14 = param_1[0xf];

    bVar15 = param_1[0x10];

    bVar16 = param_1[0xd];

    bVar17 = param_1[0xe];

    bVar18 = param_1[0x11];

    bVar19 = param_1[0x15];

    bVar20 = param_1[0x12];

    bVar21 = param_1[0x13];

    bVar22 = param_1[0x16];

    bVar23 = param_1[0x17];

    bVar24 = param_1[0x14];

    bVar25 = param_1[0x18];

    bVar26 = param_1[0x1b];

    bVar27 = param_1[0x1c];

    bVar28 = param_1[0x19];

    bVar29 = param_1[0x1a];

    bVar30 = param_1[0x1d];

    bVar31 = param_1[0x21];

    bVar32 = param_1[0x1e];

    bVar33 = param_1[0x1f];

    bVar34 = param_1[0x22];

    bVar35 = param_1[0x23];

    bVar36 = param_1[0x20];

    bVar37 = param_1[0x24];

    bVar38 = param_1[0x27];

    bVar39 = param_1[0x28];

    bVar40 = param_1[0x25];

    bVar41 = param_1[0x26];

    bVar42 = param_1[0x29];

    bVar43 = param_1[0x2d];

    bVar44 = param_1[0x2a];

    bVar45 = param_1[0x2b];

    bVar46 = param_1[0x2e];

    bVar47 = param_1[0x2f];

    bVar48 = param_1[0x2c];

    param_1 = param_1 + param_2;

    param_3[8] = (short)((uint)param_1[2] * 0x4d + (uint)param_1[1] * 0x96 + -0x7f80 +

                         (uint)*param_1 * 0x1d >> 8);

    param_3[9] = (short)((uint)param_1[5] * 0x4d + (uint)param_1[4] * 0x96 + -0x7f80 +

                         (uint)param_1[3] * 0x1d >> 8);

    param_3[10] = (short)((uint)param_1[8] * 0x4d + (uint)param_1[7] * 0x96 + -0x7f80 +

                          (uint)param_1[6] * 0x1d >> 8);

    param_3[0xb] = (short)((uint)param_1[0xb] * 0x4d + (uint)param_1[10] * 0x96 + -0x7f80 +

                           (uint)param_1[9] * 0x1d >> 8);

    param_3[0xc] = (short)((uint)param_1[0xe] * 0x4d + (uint)param_1[0xd] * 0x96 + -0x7f80 +

                           (uint)param_1[0xc] * 0x1d >> 8);

    param_3[0xd] = (short)((uint)param_1[0x11] * 0x4d + (uint)param_1[0x10] * 0x96 + -0x7f80 +

                           (uint)param_1[0xf] * 0x1d >> 8);

    param_3[0xe] = (short)((uint)param_1[0x14] * 0x4d + (uint)param_1[0x13] * 0x96 + -0x7f80 +

                           (uint)param_1[0x12] * 0x1d >> 8);

    param_3[0xf] = (short)((uint)param_1[0x17] * 0x4d + (uint)param_1[0x16] * 0x96 + -0x7f80 +

                           (uint)param_1[0x15] * 0x1d >> 8);

    param_3[0x48] =

         (short)((uint)param_1[0x1a] * 0x4d + (uint)param_1[0x19] * 0x96 + -0x7f80 +

                 (uint)param_1[0x18] * 0x1d >> 8);

    param_3[0x49] =

         (short)((uint)param_1[0x1d] * 0x4d + (uint)param_1[0x1c] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1b] * 0x1d >> 8);

    param_3[0x4a] =

         (short)((uint)param_1[0x20] * 0x4d + (uint)param_1[0x1f] * 0x96 + -0x7f80 +

                 (uint)param_1[0x1e] * 0x1d >> 8);

    param_3[0x4b] =

         (short)((uint)param_1[0x23] * 0x4d + (uint)param_1[0x22] * 0x96 + -0x7f80 +

                 (uint)param_1[0x21] * 0x1d >> 8);

    param_3[0x4c] =

         (short)((uint)param_1[0x26] * 0x4d + (uint)param_1[0x25] * 0x96 + -0x7f80 +

                 (uint)param_1[0x24] * 0x1d >> 8);

    param_3[0x4d] =

         (short)((uint)param_1[0x29] * 0x4d + (uint)param_1[0x28] * 0x96 + -0x7f80 +

                 (uint)param_1[0x27] * 0x1d >> 8);

    param_3[0x4e] =

         (short)((uint)param_1[0x2c] * 0x4d + (uint)param_1[0x2b] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2a] * 0x1d >> 8);

    param_3[0x4f] =

         (short)((uint)param_1[0x2f] * 0x4d + (uint)param_1[0x2e] * 0x96 + -0x7f80 +

                 (uint)param_1[0x2d] * 0x1d >> 8);

    iVar51 = (uint)*param_1 + (uint)param_1[3] + (uint)bVar1 + (uint)bVar2;

    iVar50 = (uint)param_1[1] + (uint)param_1[4] + (uint)bVar3 + (uint)bVar4;

    iVar49 = (uint)param_1[2] + (uint)param_1[5] + (uint)bVar5 + (uint)bVar6;

    *local_14 = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    param_3 = param_3 + 0x10;

    *local_18 = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[6] + (uint)param_1[9] + (uint)bVar8 + (uint)bVar7;

    iVar50 = (uint)param_1[7] + (uint)param_1[10] + (uint)bVar9 + (uint)bVar10;

    iVar49 = (uint)param_1[8] + (uint)param_1[0xb] + (uint)bVar12 + (uint)bVar11;

    local_14[1] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[1] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[0xc] + (uint)param_1[0xf] + (uint)bVar13 + (uint)bVar14;

    iVar50 = (uint)param_1[0xd] + (uint)param_1[0x10] + (uint)bVar16 + (uint)bVar15;

    iVar49 = (uint)param_1[0xe] + (uint)param_1[0x11] + (uint)bVar17 + (uint)bVar18;

    local_14[2] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[2] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[0x12] + (uint)param_1[0x15] + (uint)bVar20 + (uint)bVar19;

    iVar50 = (uint)param_1[0x13] + (uint)param_1[0x16] + (uint)bVar21 + (uint)bVar22;

    iVar49 = (uint)param_1[0x14] + (uint)param_1[0x17] + (uint)bVar24 + (uint)bVar23;

    local_14[3] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[3] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[0x18] + (uint)param_1[0x1b] + (uint)bVar25 + (uint)bVar26;

    iVar50 = (uint)param_1[0x19] + (uint)param_1[0x1c] + (uint)bVar28 + (uint)bVar27;

    iVar49 = (uint)param_1[0x1a] + (uint)param_1[0x1d] + (uint)bVar29 + (uint)bVar30;

    local_14[4] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[4] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[0x1e] + (uint)param_1[0x21] + (uint)bVar32 + (uint)bVar31;

    iVar50 = (uint)param_1[0x1f] + (uint)param_1[0x22] + (uint)bVar33 + (uint)bVar34;

    iVar49 = (uint)param_1[0x20] + (uint)param_1[0x23] + (uint)bVar36 + (uint)bVar35;

    local_14[5] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[5] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[0x24] + (uint)param_1[0x27] + (uint)bVar37 + (uint)bVar38;

    iVar50 = (uint)param_1[0x25] + (uint)param_1[0x28] + (uint)bVar40 + (uint)bVar39;

    iVar49 = (uint)param_1[0x26] + (uint)param_1[0x29] + (uint)bVar41 + (uint)bVar42;

    local_14[6] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[6] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    iVar51 = (uint)param_1[0x2a] + (uint)param_1[0x2d] + (uint)bVar44 + (uint)bVar43;

    iVar50 = (uint)param_1[0x2b] + (uint)param_1[0x2e] + (uint)bVar45 + (uint)bVar46;

    iVar49 = (uint)param_1[0x2c] + (uint)param_1[0x2f] + (uint)bVar48 + (uint)bVar47;

    local_14[7] = (short)(iVar49 * -0x2b + iVar51 * 0x80 + 0x200 + iVar50 * -0x55 >> 10);

    local_18[7] = (short)(iVar49 * 0x80 + iVar51 * -0x15 + 0x200 + iVar50 * -0x6b >> 10);

    local_54 = local_54 + 2;

    local_14 = local_14 + 8;

    local_18 = local_18 + 8;

    param_1 = param_1 + param_2;

  } while (local_54 < 8);

  return;

}





// --- FUN_00626760 at 0x00626760 (size: 1263) ---


void FUN_00626760(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  undefined2 *puVar1;

  short *psVar2;

  short *psVar3;

  uint uVar4;

  undefined2 *puVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  undefined2 *puVar9;

  int iVar10;

  undefined2 *puVar11;

  int iVar12;

  undefined2 local_342;

  undefined2 local_340 [127];

  undefined2 local_242 [128];

  undefined2 auStack_142 [139];

  int local_2c;

  undefined2 *local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  iVar6 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_24 = 0;

    local_28 = local_340;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar6;

        iVar10 = local_1c;

        iVar12 = local_18;

        do {

          uVar7 = (uint)*(byte *)(iVar12 + param_1);

          uVar8 = (uint)*(byte *)(iVar12 + 1 + param_1);

          uVar4 = (uint)*(byte *)(iVar12 + 2 + param_1);

          iVar12 = iVar12 + 3;

          local_340[iVar10] = (short)(uVar7 * 0x4d + uVar8 * 0x96 + -0x7f80 + uVar4 * 0x1d >> 8);

          local_242[iVar10 + 1] = (short)(uVar7 * -0x2b + uVar8 * -0x55 + 0x80 + uVar4 * 0x80 >> 8);

          auStack_142[iVar10 + 1] =

               (short)(uVar7 * 0x80 + uVar8 * -0x6b + 0x80 + uVar4 * -0x15 >> 8);

          iVar10 = iVar10 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 0x10) {

        local_2c = (int)local_340 + local_24;

        puVar5 = local_340 + local_14 + local_1c;

        local_20 = iVar6;

        do {

          local_14 = local_14 + 1;

          *puVar5 = *(undefined2 *)((int)&local_342 + param_3 * 2 + local_24);

          puVar5[0x80] = *(undefined2 *)((int)local_242 + param_3 * 2 + local_24);

          puVar5[0x100] = *(undefined2 *)((int)auStack_142 + param_3 * 2 + local_24);

          puVar5 = puVar5 + 1;

        } while (local_14 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_24 = local_24 + 0x20;

      iVar6 = iVar6 + 1;

    } while (iVar6 < param_4);

  }

  if (iVar6 < 8) {

    puVar5 = local_340 + iVar6 * 0x10;

    do {

      *puVar5 = puVar5[-0x10];

      puVar5[0x80] = puVar5[0x70];

      iVar6 = iVar6 + 1;

      puVar5[0x100] = puVar5[0xf0];

      puVar5[1] = puVar5[-0xf];

      puVar5[0x81] = puVar5[0x71];

      puVar5[0x101] = puVar5[0xf1];

      puVar5[2] = puVar5[-0xe];

      puVar5[0x82] = puVar5[0x72];

      puVar5[0x102] = puVar5[0xf2];

      puVar5[3] = puVar5[-0xd];

      puVar5[0x83] = puVar5[0x73];

      puVar5[0x103] = puVar5[0xf3];

      puVar5[4] = puVar5[-0xc];

      puVar5[0x84] = puVar5[0x74];

      puVar5[0x104] = puVar5[0xf4];

      puVar5[5] = puVar5[-0xb];

      puVar5[0x85] = puVar5[0x75];

      puVar5[0x105] = puVar5[0xf5];

      puVar5[6] = puVar5[-10];

      puVar5[0x86] = puVar5[0x76];

      puVar5[0x106] = puVar5[0xf6];

      puVar5[7] = puVar5[-9];

      puVar5[0x87] = puVar5[0x77];

      puVar5[0x107] = puVar5[0xf7];

      puVar5[8] = puVar5[-8];

      puVar5[0x88] = puVar5[0x78];

      puVar5[0x108] = puVar5[0xf8];

      puVar5[9] = puVar5[-7];

      puVar5[0x89] = puVar5[0x79];

      puVar5[0x109] = puVar5[0xf9];

      puVar5[10] = puVar5[-6];

      puVar5[0x8a] = puVar5[0x7a];

      puVar5[0x10a] = puVar5[0xfa];

      puVar5[0xb] = puVar5[-5];

      puVar5[0x8b] = puVar5[0x7b];

      puVar5[0x10b] = puVar5[0xfb];

      puVar5[0xc] = puVar5[-4];

      puVar5[0x8c] = puVar5[0x7c];

      puVar5[0x10c] = puVar5[0xfc];

      puVar5[0xd] = puVar5[-3];

      puVar5[0x8d] = puVar5[0x7d];

      puVar5[0x10d] = puVar5[0xfd];

      puVar5[0xe] = puVar5[-2];

      puVar5[0x8e] = puVar5[0x7e];

      puVar5[0x10e] = puVar5[0xfe];

      puVar5[0xf] = puVar5[-1];

      puVar5[0x8f] = puVar5[0x7f];

      puVar5[0x10f] = puVar5[0xff];

      puVar5 = puVar5 + 0x10;

    } while (iVar6 < 8);

  }

  iVar6 = 0;

  local_2c = 0;

  local_28 = local_340;

  do {

    puVar5 = (undefined2 *)(param_5 + iVar6 * 2);

    puVar11 = local_28 + local_2c;

    puVar9 = local_28 + local_2c;

    do {

      *puVar5 = *puVar11;

      puVar1 = puVar11 + 8;

      puVar11 = puVar11 + 1;

      puVar5[0x40] = *puVar1;

      puVar5[0x80] = (short)((short)puVar9[0x80] + 1 + (int)(short)puVar9[0x81] >> 1);

      psVar2 = puVar9 + 0x100;

      psVar3 = puVar9 + 0x101;

      puVar9 = puVar9 + 2;

      puVar5[0xc0] = (short)(*psVar2 + 1 + (int)*psVar3 >> 1);

      puVar5 = puVar5 + 1;

    } while ((int)puVar9 < (int)(local_28 + local_2c + 0x10));

    iVar6 = iVar6 + 8;

    local_2c = local_2c + 0x10;

  } while (local_2c < 0x80);

  return;

}





// --- FUN_00627360 at 0x00627360 (size: 1263) ---


void FUN_00627360(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  undefined2 *puVar1;

  short *psVar2;

  short *psVar3;

  uint uVar4;

  undefined2 *puVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  undefined2 *puVar9;

  int iVar10;

  undefined2 *puVar11;

  int iVar12;

  undefined2 local_342;

  undefined2 local_340 [127];

  undefined2 local_242 [128];

  undefined2 auStack_142 [139];

  int local_2c;

  undefined2 *local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  iVar6 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_24 = 0;

    local_28 = local_340;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar6;

        iVar10 = local_1c;

        iVar12 = local_18;

        do {

          uVar7 = (uint)*(byte *)(iVar12 + param_1);

          uVar8 = (uint)*(byte *)(iVar12 + 1 + param_1);

          uVar4 = (uint)*(byte *)(iVar12 + 2 + param_1);

          iVar12 = iVar12 + 3;

          local_340[iVar10] = (short)(uVar7 * 0x1d + uVar8 * 0x96 + -0x7f80 + uVar4 * 0x4d >> 8);

          local_242[iVar10 + 1] = (short)(uVar7 * 0x80 + uVar8 * -0x55 + 0x80 + uVar4 * -0x2b >> 8);

          auStack_142[iVar10 + 1] =

               (short)(uVar7 * -0x15 + uVar8 * -0x6b + 0x80 + uVar4 * 0x80 >> 8);

          iVar10 = iVar10 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 0x10) {

        local_2c = (int)local_340 + local_24;

        puVar5 = local_340 + local_14 + local_1c;

        local_20 = iVar6;

        do {

          local_14 = local_14 + 1;

          *puVar5 = *(undefined2 *)((int)&local_342 + param_3 * 2 + local_24);

          puVar5[0x80] = *(undefined2 *)((int)local_242 + param_3 * 2 + local_24);

          puVar5[0x100] = *(undefined2 *)((int)auStack_142 + param_3 * 2 + local_24);

          puVar5 = puVar5 + 1;

        } while (local_14 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_24 = local_24 + 0x20;

      iVar6 = iVar6 + 1;

    } while (iVar6 < param_4);

  }

  if (iVar6 < 8) {

    puVar5 = local_340 + iVar6 * 0x10;

    do {

      *puVar5 = puVar5[-0x10];

      puVar5[0x80] = puVar5[0x70];

      iVar6 = iVar6 + 1;

      puVar5[0x100] = puVar5[0xf0];

      puVar5[1] = puVar5[-0xf];

      puVar5[0x81] = puVar5[0x71];

      puVar5[0x101] = puVar5[0xf1];

      puVar5[2] = puVar5[-0xe];

      puVar5[0x82] = puVar5[0x72];

      puVar5[0x102] = puVar5[0xf2];

      puVar5[3] = puVar5[-0xd];

      puVar5[0x83] = puVar5[0x73];

      puVar5[0x103] = puVar5[0xf3];

      puVar5[4] = puVar5[-0xc];

      puVar5[0x84] = puVar5[0x74];

      puVar5[0x104] = puVar5[0xf4];

      puVar5[5] = puVar5[-0xb];

      puVar5[0x85] = puVar5[0x75];

      puVar5[0x105] = puVar5[0xf5];

      puVar5[6] = puVar5[-10];

      puVar5[0x86] = puVar5[0x76];

      puVar5[0x106] = puVar5[0xf6];

      puVar5[7] = puVar5[-9];

      puVar5[0x87] = puVar5[0x77];

      puVar5[0x107] = puVar5[0xf7];

      puVar5[8] = puVar5[-8];

      puVar5[0x88] = puVar5[0x78];

      puVar5[0x108] = puVar5[0xf8];

      puVar5[9] = puVar5[-7];

      puVar5[0x89] = puVar5[0x79];

      puVar5[0x109] = puVar5[0xf9];

      puVar5[10] = puVar5[-6];

      puVar5[0x8a] = puVar5[0x7a];

      puVar5[0x10a] = puVar5[0xfa];

      puVar5[0xb] = puVar5[-5];

      puVar5[0x8b] = puVar5[0x7b];

      puVar5[0x10b] = puVar5[0xfb];

      puVar5[0xc] = puVar5[-4];

      puVar5[0x8c] = puVar5[0x7c];

      puVar5[0x10c] = puVar5[0xfc];

      puVar5[0xd] = puVar5[-3];

      puVar5[0x8d] = puVar5[0x7d];

      puVar5[0x10d] = puVar5[0xfd];

      puVar5[0xe] = puVar5[-2];

      puVar5[0x8e] = puVar5[0x7e];

      puVar5[0x10e] = puVar5[0xfe];

      puVar5[0xf] = puVar5[-1];

      puVar5[0x8f] = puVar5[0x7f];

      puVar5[0x10f] = puVar5[0xff];

      puVar5 = puVar5 + 0x10;

    } while (iVar6 < 8);

  }

  iVar6 = 0;

  local_2c = 0;

  local_28 = local_340;

  do {

    puVar5 = (undefined2 *)(param_5 + iVar6 * 2);

    puVar11 = local_28 + local_2c;

    puVar9 = local_28 + local_2c;

    do {

      *puVar5 = *puVar11;

      puVar1 = puVar11 + 8;

      puVar11 = puVar11 + 1;

      puVar5[0x40] = *puVar1;

      puVar5[0x80] = (short)((short)puVar9[0x80] + 1 + (int)(short)puVar9[0x81] >> 1);

      psVar2 = puVar9 + 0x100;

      psVar3 = puVar9 + 0x101;

      puVar9 = puVar9 + 2;

      puVar5[0xc0] = (short)(*psVar2 + 1 + (int)*psVar3 >> 1);

      puVar5 = puVar5 + 1;

    } while ((int)puVar9 < (int)(local_28 + local_2c + 0x10));

    iVar6 = iVar6 + 8;

    local_2c = local_2c + 0x10;

  } while (local_2c < 0x80);

  return;

}





// --- FUN_00627f60 at 0x00627F60 (size: 769) ---


void FUN_00627f60(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  undefined2 *puVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  undefined2 *puVar8;

  undefined2 *puVar9;

  undefined2 *puVar10;

  undefined2 uStack_242;

  undefined2 local_240 [63];

  undefined2 auStack_1c2 [64];

  undefined2 auStack_142 [64];

  short asStack_c2 [75];

  undefined2 *local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = local_240;

  iVar5 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_24 = 0;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar5;

        iVar7 = local_1c;

        local_28 = local_18;

        do {

          iVar3 = (int)(short)(0xff - (ushort)*(byte *)(local_28 + param_1));

          iVar6 = (int)(short)(0xff - (ushort)*(byte *)(local_28 + 1 + param_1));

          iVar4 = (int)(short)(0xff - (ushort)*(byte *)(local_28 + 2 + param_1));

          bVar2 = *(byte *)(local_28 + 3 + param_1);

          local_2c[iVar7] =

               (short)((uint)(iVar3 * 0x4d + iVar6 * 0x96 + -0x7f80 + iVar4 * 0x1d) >> 8);

          auStack_1c2[iVar7 + 1] =

               (short)((uint)(iVar3 * -0x2b + iVar6 * -0x55 + 0x80 + iVar4 * 0x80) >> 8);

          auStack_142[iVar7 + 1] =

               (short)((uint)(iVar3 * 0x80 + iVar6 * -0x6b + 0x80 + iVar4 * -0x15) >> 8);

          local_28 = local_28 + 4;

          asStack_c2[iVar7 + 1] = bVar2 - 0x80;

          iVar7 = iVar7 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 8) {

        local_28 = (int)local_2c + local_24;

        puVar8 = local_2c + local_14 + local_1c;

        local_20 = iVar5;

        do {

          local_14 = local_14 + 1;

          *puVar8 = *(undefined2 *)((int)&uStack_242 + param_3 * 2 + local_24);

          puVar8[0x40] = *(undefined2 *)((int)auStack_1c2 + param_3 * 2 + local_24);

          puVar8[0x80] = *(undefined2 *)((int)auStack_142 + param_3 * 2 + local_24);

          puVar8[0xc0] = *(undefined2 *)((int)asStack_c2 + param_3 * 2 + local_24);

          puVar8 = puVar8 + 1;

        } while (local_14 < 8);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 8;

      local_24 = local_24 + 0x10;

      iVar5 = iVar5 + 1;

    } while (iVar5 < param_4);

  }

  if (iVar5 < 8) {

    iVar7 = iVar5 << 3;

    puVar8 = local_2c + iVar5 * 8;

    do {

      puVar9 = local_2c + iVar7;

      puVar10 = puVar8;

      do {

        *puVar9 = puVar10[-8];

        puVar9[0x40] = puVar10[0x38];

        puVar9[0x80] = puVar10[0x78];

        puVar1 = puVar10 + 0xb8;

        puVar10 = puVar10 + 1;

        puVar9[0xc0] = *puVar1;

        puVar9 = puVar9 + 1;

      } while ((int)puVar10 < (int)(puVar8 + 8));

      iVar7 = iVar7 + 8;

      puVar8 = puVar8 + 8;

      iVar5 = iVar5 + 1;

    } while (iVar5 < 8);

  }

  iVar5 = 0;

  do {

    iVar7 = iVar5;

    do {

      *(undefined2 *)(param_5 + iVar7 * 2) = local_2c[iVar7];

      *(undefined2 *)(param_5 + 0x80 + iVar7 * 2) = local_2c[iVar7 + 0x40];

      *(undefined2 *)(param_5 + 0x100 + iVar7 * 2) = local_2c[iVar7 + 0x80];

      *(undefined2 *)(param_5 + 0x180 + iVar7 * 2) = local_2c[iVar7 + 0xc0];

      iVar7 = iVar7 + 1;

    } while (iVar7 < iVar5 + 8);

    iVar5 = iVar5 + 8;

  } while (iVar5 < 0x40);

  return;

}





// --- FUN_006288e0 at 0x006288E0 (size: 875) ---


void FUN_006288e0(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  short *psVar1;

  short *psVar2;

  undefined2 *puVar3;

  byte bVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  undefined2 *puVar10;

  undefined2 *puVar11;

  undefined2 *puVar12;

  undefined2 uStack_842;

  undefined2 local_840 [127];

  undefined2 auStack_742 [128];

  undefined2 auStack_642 [128];

  short asStack_542 [651];

  undefined2 *local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = local_840;

  iVar7 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_24 = 0;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar7;

        iVar9 = local_1c;

        local_28 = local_18;

        do {

          iVar5 = (int)(short)(0xff - (ushort)*(byte *)(local_28 + param_1));

          iVar8 = (int)(short)(0xff - (ushort)*(byte *)(local_28 + 1 + param_1));

          iVar6 = (int)(short)(0xff - (ushort)*(byte *)(local_28 + 2 + param_1));

          bVar4 = *(byte *)(local_28 + 3 + param_1);

          local_2c[iVar9] =

               (short)((uint)(iVar5 * 0x4d + iVar8 * 0x96 + -0x7f80 + iVar6 * 0x1d) >> 8);

          auStack_742[iVar9 + 1] =

               (short)((uint)(iVar5 * -0x2b + iVar8 * -0x55 + 0x80 + iVar6 * 0x80) >> 8);

          auStack_642[iVar9 + 1] =

               (short)((uint)(iVar5 * 0x80 + iVar8 * -0x6b + 0x80 + iVar6 * -0x15) >> 8);

          local_28 = local_28 + 4;

          asStack_542[iVar9 + 1] = bVar4 - 0x80;

          iVar9 = iVar9 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 0x10) {

        local_28 = (int)local_2c + local_24;

        puVar10 = local_2c + local_14 + local_1c;

        local_20 = iVar7;

        do {

          local_14 = local_14 + 1;

          *puVar10 = *(undefined2 *)((int)&uStack_842 + param_3 * 2 + local_24);

          puVar10[0x80] = *(undefined2 *)((int)auStack_742 + param_3 * 2 + local_24);

          puVar10[0x100] = *(undefined2 *)((int)auStack_642 + param_3 * 2 + local_24);

          puVar10[0x180] = *(undefined2 *)((int)asStack_542 + param_3 * 2 + local_24);

          puVar10 = puVar10 + 1;

        } while (local_14 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_24 = local_24 + 0x20;

      iVar7 = iVar7 + 1;

    } while (iVar7 < param_4);

  }

  if (iVar7 < 8) {

    iVar9 = iVar7 << 4;

    puVar10 = local_2c + iVar7 * 0x10;

    do {

      puVar11 = local_2c + iVar9;

      puVar12 = puVar10;

      do {

        *puVar11 = puVar12[-0x10];

        puVar11[0x80] = puVar12[0x70];

        puVar11[0x100] = puVar12[0xf0];

        puVar3 = puVar12 + 0x170;

        puVar12 = puVar12 + 1;

        puVar11[0x180] = *puVar3;

        puVar11 = puVar11 + 1;

      } while ((int)puVar12 < (int)(puVar10 + 0x10));

      iVar9 = iVar9 + 0x10;

      puVar10 = puVar10 + 0x10;

      iVar7 = iVar7 + 1;

    } while (iVar7 < 8);

  }

  iVar7 = 0;

  local_28 = 0;

  do {

    puVar10 = (undefined2 *)(param_5 + iVar7 * 2);

    puVar11 = local_2c + local_28;

    puVar12 = local_2c + local_28;

    do {

      *puVar10 = *puVar11;

      puVar10[0x40] = puVar11[8];

      puVar10[0x80] = (short)((short)puVar12[0x80] + 1 + (int)(short)puVar12[0x81] >> 1);

      psVar1 = puVar12 + 0x100;

      psVar2 = puVar12 + 0x101;

      puVar12 = puVar12 + 2;

      puVar10[0xc0] = (short)(*psVar1 + 1 + (int)*psVar2 >> 1);

      puVar10[0x100] = puVar11[0x180];

      puVar3 = puVar11 + 0x188;

      puVar11 = puVar11 + 1;

      puVar10[0x140] = *puVar3;

      puVar10 = puVar10 + 1;

    } while ((int)puVar12 < (int)(local_2c + local_28 + 0x10));

    iVar7 = iVar7 + 8;

    local_28 = local_28 + 0x10;

  } while (local_28 < 0x80);

  return;

}





// --- FUN_00629540 at 0x00629540 (size: 992) ---


void FUN_00629540(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  undefined2 *puVar1;

  byte bVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  undefined2 *puVar8;

  undefined2 *puVar9;

  undefined2 *puVar10;

  undefined2 uStack_842;

  undefined2 local_840 [255];

  undefined2 auStack_642 [256];

  undefined2 auStack_442 [256];

  short asStack_242 [267];

  undefined2 *local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = local_840;

  iVar5 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_28 = 0;

    do {

      local_14 = 0;

      if (0 < param_3) {

        local_14 = 0;

        local_20 = iVar5;

        iVar7 = local_1c;

        local_24 = local_18;

        do {

          iVar3 = (int)(short)(0xff - (ushort)*(byte *)(local_24 + param_1));

          iVar6 = (int)(short)(0xff - (ushort)*(byte *)(local_24 + 1 + param_1));

          iVar4 = (int)(short)(0xff - (ushort)*(byte *)(local_24 + 2 + param_1));

          bVar2 = *(byte *)(local_24 + 3 + param_1);

          local_2c[iVar7] =

               (short)((uint)(iVar3 * 0x4d + iVar6 * 0x96 + -0x7f80 + iVar4 * 0x1d) >> 8);

          auStack_642[iVar7 + 1] =

               (short)((uint)(iVar3 * -0x2b + iVar6 * -0x55 + 0x80 + iVar4 * 0x80) >> 8);

          auStack_442[iVar7 + 1] =

               (short)((uint)(iVar3 * 0x80 + iVar6 * -0x6b + 0x80 + iVar4 * -0x15) >> 8);

          local_24 = local_24 + 4;

          asStack_242[iVar7 + 1] = bVar2 - 0x80;

          iVar7 = iVar7 + 1;

          local_14 = local_14 + 1;

        } while (local_14 < param_3);

      }

      if (local_14 < 0x10) {

        local_24 = (int)local_2c + local_28;

        puVar8 = local_2c + local_14 + local_1c;

        local_20 = iVar5;

        do {

          local_14 = local_14 + 1;

          *puVar8 = *(undefined2 *)((int)&uStack_842 + param_3 * 2 + local_28);

          puVar8[0x100] = *(undefined2 *)((int)auStack_642 + param_3 * 2 + local_28);

          puVar8[0x200] = *(undefined2 *)((int)auStack_442 + param_3 * 2 + local_28);

          puVar8[0x300] = *(undefined2 *)((int)asStack_242 + param_3 * 2 + local_28);

          puVar8 = puVar8 + 1;

        } while (local_14 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_28 = local_28 + 0x20;

      iVar5 = iVar5 + 1;

    } while (iVar5 < param_4);

  }

  if (iVar5 < 0x10) {

    iVar7 = iVar5 << 4;

    puVar8 = local_2c + iVar5 * 0x10;

    do {

      puVar9 = local_2c + iVar7;

      puVar10 = puVar8;

      do {

        *puVar9 = puVar10[-0x10];

        puVar9[0x100] = puVar10[0xf0];

        puVar9[0x200] = puVar10[0x1f0];

        puVar1 = puVar10 + 0x2f0;

        puVar10 = puVar10 + 1;

        puVar9[0x300] = *puVar1;

        puVar9 = puVar9 + 1;

      } while ((int)puVar10 < (int)(puVar8 + 0x10));

      iVar7 = iVar7 + 0x10;

      puVar8 = puVar8 + 0x10;

      iVar5 = iVar5 + 1;

    } while (iVar5 < 0x10);

  }

  iVar7 = 0;

  iVar5 = 0;

  iVar3 = 0;

  do {

    puVar10 = (undefined2 *)(param_5 + iVar7 * 2);

    puVar8 = local_2c + iVar5;

    puVar9 = local_2c + iVar3;

    do {

      *puVar10 = *puVar8;

      puVar10[0x40] = puVar8[8];

      puVar10[0x80] = puVar8[0x80];

      puVar10[0xc0] = puVar8[0x88];

      puVar10[0x100] =

           (short)((int)(short)puVar9[0x100] + (int)(short)puVar9[0x101] + (int)(short)puVar9[0x110]

                   + 2 + (int)(short)puVar9[0x111] >> 2);

      puVar10[0x140] =

           (short)((int)(short)puVar9[0x200] + (int)(short)puVar9[0x201] + (int)(short)puVar9[0x210]

                   + 2 + (int)(short)puVar9[0x211] >> 2);

      puVar9 = puVar9 + 2;

      puVar10[0x180] = puVar8[0x300];

      puVar10[0x1c0] = puVar8[0x308];

      puVar10[0x200] = puVar8[0x380];

      puVar1 = puVar8 + 0x388;

      puVar8 = puVar8 + 1;

      puVar10[0x240] = *puVar1;

      puVar10 = puVar10 + 1;

    } while ((int)puVar9 < (int)(local_2c + iVar3 + 0x10));

    iVar7 = iVar7 + 8;

    iVar5 = iVar5 + 0x10;

    iVar3 = iVar3 + 0x20;

  } while (iVar3 < 0x100);

  return;

}





// --- FUN_00629920 at 0x00629920 (size: 3331) ---


void FUN_00629920(byte *param_1,int param_2,undefined2 *param_3,undefined2 *param_4,

                 undefined2 *param_5,short *param_6)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  byte bVar4;

  byte bVar5;

  byte bVar6;

  byte bVar7;

  byte bVar8;

  byte bVar9;

  byte bVar10;

  byte bVar11;

  byte bVar12;

  byte bVar13;

  byte bVar14;

  byte bVar15;

  byte bVar16;

  byte bVar17;

  byte bVar18;

  byte bVar19;

  byte bVar20;

  byte bVar21;

  byte bVar22;

  byte bVar23;

  byte bVar24;

  byte bVar25;

  byte bVar26;

  byte bVar27;

  byte bVar28;

  byte bVar29;

  byte bVar30;

  byte bVar31;

  byte bVar32;

  byte bVar33;

  byte bVar34;

  byte bVar35;

  byte bVar36;

  byte bVar37;

  byte bVar38;

  byte bVar39;

  byte bVar40;

  byte bVar41;

  byte bVar42;

  byte bVar43;

  byte bVar44;

  byte bVar45;

  byte bVar46;

  byte bVar47;

  byte bVar48;

  int iVar49;

  int iVar50;

  int iVar51;

  int local_80;

  short *local_1c;

  undefined2 *local_18;

  undefined2 *local_14;

  

  local_18 = param_5;

  local_14 = param_4;

  local_80 = 0;

  local_1c = param_6;

  do {

    *param_3 = (short)((uint)*param_1 * -0x4d + (uint)param_1[1] * -0x96 + 0x7f80 +

                       (uint)param_1[2] * -0x1d >> 8);

    param_3[1] = (short)((uint)param_1[4] * -0x4d + (uint)param_1[5] * -0x96 + 0x7f80 +

                         (uint)param_1[6] * -0x1d >> 8);

    param_3[2] = (short)((uint)param_1[8] * -0x4d + (uint)param_1[9] * -0x96 + 0x7f80 +

                         (uint)param_1[10] * -0x1d >> 8);

    param_3[3] = (short)((uint)param_1[0xc] * -0x4d + (uint)param_1[0xd] * -0x96 + 0x7f80 +

                         (uint)param_1[0xe] * -0x1d >> 8);

    param_3[4] = (short)((uint)param_1[0x10] * -0x4d + (uint)param_1[0x11] * -0x96 + 0x7f80 +

                         (uint)param_1[0x12] * -0x1d >> 8);

    param_3[5] = (short)((uint)param_1[0x14] * -0x4d + (uint)param_1[0x15] * -0x96 + 0x7f80 +

                         (uint)param_1[0x16] * -0x1d >> 8);

    param_3[6] = (short)((uint)param_1[0x18] * -0x4d + (uint)param_1[0x19] * -0x96 + 0x7f80 +

                         (uint)param_1[0x1a] * -0x1d >> 8);

    param_3[7] = (short)((uint)param_1[0x1c] * -0x4d + (uint)param_1[0x1d] * -0x96 + 0x7f80 +

                         (uint)param_1[0x1e] * -0x1d >> 8);

    param_3[0x40] =

         (short)((uint)param_1[0x20] * -0x4d + (uint)param_1[0x21] * -0x96 + 0x7f80 +

                 (uint)param_1[0x22] * -0x1d >> 8);

    param_3[0x41] =

         (short)((uint)param_1[0x24] * -0x4d + (uint)param_1[0x25] * -0x96 + 0x7f80 +

                 (uint)param_1[0x26] * -0x1d >> 8);

    param_3[0x42] =

         (short)((uint)param_1[0x28] * -0x4d + (uint)param_1[0x29] * -0x96 + 0x7f80 +

                 (uint)param_1[0x2a] * -0x1d >> 8);

    param_3[0x43] =

         (short)((uint)param_1[0x2c] * -0x4d + (uint)param_1[0x2d] * -0x96 + 0x7f80 +

                 (uint)param_1[0x2e] * -0x1d >> 8);

    param_3[0x44] =

         (short)((uint)param_1[0x30] * -0x4d + (uint)param_1[0x31] * -0x96 + 0x7f80 +

                 (uint)param_1[0x32] * -0x1d >> 8);

    param_3[0x45] =

         (short)((uint)param_1[0x34] * -0x4d + (uint)param_1[0x35] * -0x96 + 0x7f80 +

                 (uint)param_1[0x36] * -0x1d >> 8);

    param_3[0x46] =

         (short)((uint)param_1[0x38] * -0x4d + (uint)param_1[0x39] * -0x96 + 0x7f80 +

                 (uint)param_1[0x3a] * -0x1d >> 8);

    param_3[0x47] =

         (short)((uint)param_1[0x3c] * -0x4d + (uint)param_1[0x3d] * -0x96 + 0x7f80 +

                 (uint)param_1[0x3e] * -0x1d >> 8);

    *local_1c = param_1[3] - 0x80;

    local_1c[1] = param_1[7] - 0x80;

    local_1c[2] = param_1[0xb] - 0x80;

    local_1c[3] = param_1[0xf] - 0x80;

    local_1c[4] = param_1[0x13] - 0x80;

    local_1c[5] = param_1[0x17] - 0x80;

    local_1c[6] = param_1[0x1b] - 0x80;

    local_1c[7] = param_1[0x1f] - 0x80;

    local_1c[0x40] = param_1[0x23] - 0x80;

    local_1c[0x41] = param_1[0x27] - 0x80;

    local_1c[0x42] = param_1[0x2b] - 0x80;

    local_1c[0x43] = param_1[0x2f] - 0x80;

    local_1c[0x44] = param_1[0x33] - 0x80;

    local_1c[0x45] = param_1[0x37] - 0x80;

    local_1c[0x46] = param_1[0x3b] - 0x80;

    local_1c[0x47] = param_1[0x3f] - 0x80;

    bVar1 = *param_1;

    bVar2 = param_1[4];

    bVar3 = param_1[5];

    bVar4 = param_1[1];

    bVar5 = param_1[2];

    bVar6 = param_1[6];

    bVar7 = param_1[0xc];

    bVar8 = param_1[8];

    bVar9 = param_1[9];

    bVar10 = param_1[0xd];

    bVar11 = param_1[0xe];

    bVar12 = param_1[10];

    bVar13 = param_1[0x10];

    bVar14 = param_1[0x14];

    bVar15 = param_1[0x15];

    bVar16 = param_1[0x11];

    bVar17 = param_1[0x12];

    bVar18 = param_1[0x16];

    bVar19 = param_1[0x1c];

    bVar20 = param_1[0x18];

    bVar21 = param_1[0x19];

    bVar22 = param_1[0x1d];

    bVar23 = param_1[0x1e];

    bVar24 = param_1[0x1a];

    bVar25 = param_1[0x20];

    bVar26 = param_1[0x24];

    bVar27 = param_1[0x25];

    bVar28 = param_1[0x21];

    bVar29 = param_1[0x22];

    bVar30 = param_1[0x26];

    bVar31 = param_1[0x2c];

    bVar32 = param_1[0x28];

    bVar33 = param_1[0x29];

    bVar34 = param_1[0x2d];

    bVar35 = param_1[0x2e];

    bVar36 = param_1[0x2a];

    bVar37 = param_1[0x30];

    bVar38 = param_1[0x34];

    bVar39 = param_1[0x35];

    bVar40 = param_1[0x31];

    bVar41 = param_1[0x32];

    bVar42 = param_1[0x36];

    bVar43 = param_1[0x3c];

    bVar44 = param_1[0x38];

    bVar45 = param_1[0x39];

    bVar46 = param_1[0x3d];

    bVar47 = param_1[0x3e];

    bVar48 = param_1[0x3a];

    param_1 = param_1 + param_2;

    param_3[8] = (short)((uint)*param_1 * -0x4d + (uint)param_1[1] * -0x96 + 0x7f80 +

                         (uint)param_1[2] * -0x1d >> 8);

    param_3[9] = (short)((uint)param_1[4] * -0x4d + (uint)param_1[5] * -0x96 + 0x7f80 +

                         (uint)param_1[6] * -0x1d >> 8);

    param_3[10] = (short)((uint)param_1[8] * -0x4d + (uint)param_1[9] * -0x96 + 0x7f80 +

                          (uint)param_1[10] * -0x1d >> 8);

    param_3[0xb] = (short)((uint)param_1[0xc] * -0x4d + (uint)param_1[0xd] * -0x96 + 0x7f80 +

                           (uint)param_1[0xe] * -0x1d >> 8);

    param_3[0xc] = (short)((uint)param_1[0x10] * -0x4d + (uint)param_1[0x11] * -0x96 + 0x7f80 +

                           (uint)param_1[0x12] * -0x1d >> 8);

    param_3[0xd] = (short)((uint)param_1[0x14] * -0x4d + (uint)param_1[0x15] * -0x96 + 0x7f80 +

                           (uint)param_1[0x16] * -0x1d >> 8);

    param_3[0xe] = (short)((uint)param_1[0x18] * -0x4d + (uint)param_1[0x19] * -0x96 + 0x7f80 +

                           (uint)param_1[0x1a] * -0x1d >> 8);

    param_3[0xf] = (short)((uint)param_1[0x1c] * -0x4d + (uint)param_1[0x1d] * -0x96 + 0x7f80 +

                           (uint)param_1[0x1e] * -0x1d >> 8);

    param_3[0x48] =

         (short)((uint)param_1[0x20] * -0x4d + (uint)param_1[0x21] * -0x96 + 0x7f80 +

                 (uint)param_1[0x22] * -0x1d >> 8);

    param_3[0x49] =

         (short)((uint)param_1[0x24] * -0x4d + (uint)param_1[0x25] * -0x96 + 0x7f80 +

                 (uint)param_1[0x26] * -0x1d >> 8);

    param_3[0x4a] =

         (short)((uint)param_1[0x28] * -0x4d + (uint)param_1[0x29] * -0x96 + 0x7f80 +

                 (uint)param_1[0x2a] * -0x1d >> 8);

    param_3[0x4b] =

         (short)((uint)param_1[0x2c] * -0x4d + (uint)param_1[0x2d] * -0x96 + 0x7f80 +

                 (uint)param_1[0x2e] * -0x1d >> 8);

    param_3[0x4c] =

         (short)((uint)param_1[0x30] * -0x4d + (uint)param_1[0x31] * -0x96 + 0x7f80 +

                 (uint)param_1[0x32] * -0x1d >> 8);

    param_3[0x4d] =

         (short)((uint)param_1[0x34] * -0x4d + (uint)param_1[0x35] * -0x96 + 0x7f80 +

                 (uint)param_1[0x36] * -0x1d >> 8);

    param_3[0x4e] =

         (short)((uint)param_1[0x38] * -0x4d + (uint)param_1[0x39] * -0x96 + 0x7f80 +

                 (uint)param_1[0x3a] * -0x1d >> 8);

    param_3[0x4f] =

         (short)((uint)param_1[0x3c] * -0x4d + (uint)param_1[0x3d] * -0x96 + 0x7f80 +

                 (uint)param_1[0x3e] * -0x1d >> 8);

    local_1c[8] = param_1[3] - 0x80;

    local_1c[9] = param_1[7] - 0x80;

    local_1c[10] = param_1[0xb] - 0x80;

    local_1c[0xb] = param_1[0xf] - 0x80;

    local_1c[0xc] = param_1[0x13] - 0x80;

    local_1c[0xd] = param_1[0x17] - 0x80;

    local_1c[0xe] = param_1[0x1b] - 0x80;

    local_1c[0xf] = param_1[0x1f] - 0x80;

    local_1c[0x48] = param_1[0x23] - 0x80;

    local_1c[0x49] = param_1[0x27] - 0x80;

    local_1c[0x4a] = param_1[0x2b] - 0x80;

    local_1c[0x4b] = param_1[0x2f] - 0x80;

    local_1c[0x4c] = param_1[0x33] - 0x80;

    local_1c[0x4d] = param_1[0x37] - 0x80;

    local_1c[0x4e] = param_1[0x3b] - 0x80;

    local_1c[0x4f] = param_1[0x3f] - 0x80;

    iVar51 = 0x3fc - ((uint)*param_1 + (uint)param_1[4] + (uint)bVar1 + (uint)bVar2);

    iVar50 = 0x3fc - ((uint)param_1[1] + (uint)param_1[5] + (uint)bVar4 + (uint)bVar3);

    iVar49 = 0x3fc - ((uint)param_1[2] + (uint)param_1[6] + (uint)bVar5 + (uint)bVar6);

    *local_14 = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    *local_18 = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = 0x3fc - ((uint)param_1[8] + (uint)param_1[0xc] + (uint)bVar8 + (uint)bVar7);

    iVar50 = 0x3fc - ((uint)param_1[9] + (uint)param_1[0xd] + (uint)bVar9 + (uint)bVar10);

    iVar49 = 0x3fc - ((uint)param_1[10] + (uint)param_1[0xe] + (uint)bVar12 + (uint)bVar11);

    local_14[1] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[1] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = 0x3fc - ((uint)param_1[0x10] + (uint)param_1[0x14] + (uint)bVar13 + (uint)bVar14);

    iVar50 = 0x3fc - ((uint)param_1[0x11] + (uint)param_1[0x15] + (uint)bVar16 + (uint)bVar15);

    iVar49 = 0x3fc - ((uint)param_1[0x12] + (uint)param_1[0x16] + (uint)bVar17 + (uint)bVar18);

    local_14[2] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[2] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = 0x3fc - ((uint)param_1[0x18] + (uint)param_1[0x1c] + (uint)bVar20 + (uint)bVar19);

    iVar50 = 0x3fc - ((uint)param_1[0x19] + (uint)param_1[0x1d] + (uint)bVar21 + (uint)bVar22);

    iVar49 = 0x3fc - ((uint)param_1[0x1a] + (uint)param_1[0x1e] + (uint)bVar24 + (uint)bVar23);

    local_14[3] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[3] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = 0x3fc - ((uint)param_1[0x20] + (uint)param_1[0x24] + (uint)bVar25 + (uint)bVar26);

    iVar50 = 0x3fc - ((uint)param_1[0x21] + (uint)param_1[0x25] + (uint)bVar28 + (uint)bVar27);

    iVar49 = 0x3fc - ((uint)param_1[0x22] + (uint)param_1[0x26] + (uint)bVar29 + (uint)bVar30);

    local_14[4] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[4] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar51 = 0x3fc - ((uint)param_1[0x28] + (uint)param_1[0x2c] + (uint)bVar32 + (uint)bVar31);

    iVar50 = 0x3fc - ((uint)param_1[0x29] + (uint)param_1[0x2d] + (uint)bVar33 + (uint)bVar34);

    iVar49 = 0x3fc - ((uint)param_1[0x2a] + (uint)param_1[0x2e] + (uint)bVar36 + (uint)bVar35);

    local_14[5] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_18[5] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    iVar49 = 0x3fc - ((uint)param_1[0x30] + (uint)param_1[0x34] + (uint)bVar37 + (uint)bVar38);

    iVar50 = 0x3fc - ((uint)param_1[0x31] + (uint)param_1[0x35] + (uint)bVar40 + (uint)bVar39);

    iVar51 = 0x3fc - ((uint)param_1[0x32] + (uint)param_1[0x36] + (uint)bVar41 + (uint)bVar42);

    local_14[6] = (short)(iVar49 * -0x2b + iVar50 * -0x55 + 0x200 + iVar51 * 0x80 >> 10);

    local_18[6] = (short)(iVar49 * 0x80 + iVar50 * -0x6b + 0x200 + iVar51 * -0x15 >> 10);

    iVar51 = 0x3fc - ((uint)param_1[0x38] + (uint)param_1[0x3c] + (uint)bVar44 + (uint)bVar43);

    iVar50 = 0x3fc - ((uint)param_1[0x39] + (uint)param_1[0x3d] + (uint)bVar45 + (uint)bVar46);

    iVar49 = 0x3fc - ((uint)param_1[0x3a] + (uint)param_1[0x3e] + (uint)bVar48 + (uint)bVar47);

    local_14[7] = (short)(iVar51 * -0x2b + iVar50 * -0x55 + 0x200 + iVar49 * 0x80 >> 10);

    local_14 = local_14 + 8;

    param_3 = param_3 + 0x10;

    local_18[7] = (short)(iVar51 * 0x80 + iVar50 * -0x6b + 0x200 + iVar49 * -0x15 >> 10);

    local_18 = local_18 + 8;

    local_80 = local_80 + 2;

    param_1 = param_1 + param_2;

    local_1c = local_1c + 0x10;

  } while (local_80 < 8);

  return;

}





// --- FUN_0062a840 at 0x0062A840 (size: 700) ---


void FUN_0062a840(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  int iVar1;

  undefined2 *puVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  

  iVar4 = 0;

  if (0 < param_4) {

    iVar3 = 0;

    do {

      iVar1 = 0;

      iVar5 = iVar3;

      if (0 < param_3) {

        do {

          *(ushort *)(param_5 + iVar5 * 2) = *(byte *)(param_1 + iVar1 * 4) - 0x80;

          *(ushort *)(param_5 + 0x80 + iVar5 * 2) = *(byte *)(param_1 + 1 + iVar1 * 4) - 0x80;

          *(ushort *)(param_5 + 0x100 + iVar5 * 2) = *(byte *)(param_1 + 2 + iVar1 * 4) - 0x80;

          *(ushort *)(param_5 + 0x180 + iVar5 * 2) = *(byte *)(param_1 + 3 + iVar1 * 4) - 0x80;

          iVar1 = iVar1 + 1;

          iVar5 = iVar5 + 1;

        } while (iVar1 < param_3);

      }

      if (iVar1 < 8) {

        puVar2 = (undefined2 *)(param_5 + (iVar1 + iVar3) * 2);

        do {

          iVar1 = iVar1 + 1;

          *puVar2 = puVar2[-1];

          puVar2[0x40] = puVar2[0x3f];

          puVar2[0x80] = puVar2[0x7f];

          puVar2[0xc0] = puVar2[0xbf];

          puVar2 = puVar2 + 1;

        } while (iVar1 < 8);

      }

      param_1 = param_1 + param_2;

      iVar3 = iVar3 + 8;

      iVar4 = iVar4 + 1;

    } while (iVar4 < param_4);

  }

  if (iVar4 < 8) {

    puVar2 = (undefined2 *)(param_5 + iVar4 * 0x10);

    do {

      iVar4 = iVar4 + 1;

      *puVar2 = *(undefined2 *)(param_5 + -0x10 + param_4 * 0x10);

      puVar2[0x40] = *(undefined2 *)(param_5 + 0x70 + param_4 * 0x10);

      puVar2[0x80] = *(undefined2 *)(param_5 + 0xf0 + param_4 * 0x10);

      puVar2[0xc0] = *(undefined2 *)(param_5 + 0x170 + param_4 * 0x10);

      puVar2[1] = *(undefined2 *)(param_5 + -0xe + param_4 * 0x10);

      puVar2[0x41] = *(undefined2 *)(param_5 + 0x72 + param_4 * 0x10);

      puVar2[0x81] = *(undefined2 *)(param_5 + 0xf2 + param_4 * 0x10);

      puVar2[0xc1] = *(undefined2 *)(param_5 + 0x172 + param_4 * 0x10);

      puVar2[2] = *(undefined2 *)(param_5 + -0xc + param_4 * 0x10);

      puVar2[0x42] = *(undefined2 *)(param_5 + 0x74 + param_4 * 0x10);

      puVar2[0x82] = *(undefined2 *)(param_5 + 0xf4 + param_4 * 0x10);

      puVar2[0xc2] = *(undefined2 *)(param_5 + 0x174 + param_4 * 0x10);

      puVar2[3] = *(undefined2 *)(param_5 + -10 + param_4 * 0x10);

      puVar2[0x43] = *(undefined2 *)(param_5 + 0x76 + param_4 * 0x10);

      puVar2[0x83] = *(undefined2 *)(param_5 + 0xf6 + param_4 * 0x10);

      puVar2[0xc3] = *(undefined2 *)(param_5 + 0x176 + param_4 * 0x10);

      puVar2[4] = *(undefined2 *)(param_5 + -8 + param_4 * 0x10);

      puVar2[0x44] = *(undefined2 *)(param_5 + 0x78 + param_4 * 0x10);

      puVar2[0x84] = *(undefined2 *)(param_5 + 0xf8 + param_4 * 0x10);

      puVar2[0xc4] = *(undefined2 *)(param_5 + 0x178 + param_4 * 0x10);

      puVar2[5] = *(undefined2 *)(param_5 + -6 + param_4 * 0x10);

      puVar2[0x45] = *(undefined2 *)(param_5 + 0x7a + param_4 * 0x10);

      puVar2[0x85] = *(undefined2 *)(param_5 + 0xfa + param_4 * 0x10);

      puVar2[0xc5] = *(undefined2 *)(param_5 + 0x17a + param_4 * 0x10);

      puVar2[6] = *(undefined2 *)(param_5 + -4 + param_4 * 0x10);

      puVar2[0x46] = *(undefined2 *)(param_5 + 0x7c + param_4 * 0x10);

      puVar2[0x86] = *(undefined2 *)(param_5 + 0xfc + param_4 * 0x10);

      puVar2[0xc6] = *(undefined2 *)(param_5 + 0x17c + param_4 * 0x10);

      puVar2[7] = *(undefined2 *)(param_5 + -2 + param_4 * 0x10);

      puVar2[0x47] = *(undefined2 *)(param_5 + 0x7e + param_4 * 0x10);

      puVar2[0x87] = *(undefined2 *)(param_5 + 0xfe + param_4 * 0x10);

      puVar2[199] = *(undefined2 *)(param_5 + 0x17e + param_4 * 0x10);

      puVar2 = puVar2 + 8;

    } while (iVar4 < 8);

  }

  return;

}





// --- FUN_0062acb0 at 0x0062ACB0 (size: 892) ---


void FUN_0062acb0(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  short *psVar7;

  int iVar8;

  byte *pbVar9;

  

  iVar1 = 0;

  if (0 < param_4) {

    iVar3 = 0;

    iVar2 = 0;

    do {

      iVar4 = 0;

      iVar5 = iVar2;

      iVar8 = iVar3;

      if (0 < param_3) {

        do {

          iVar4 = iVar4 + 1;

          *(ushort *)(param_5 + iVar5 * 2) = *(byte *)(iVar8 + param_1) - 0x80;

          *(ushort *)(param_5 + 0x80 + iVar5 * 2) = *(byte *)(iVar8 + 1 + param_1) - 0x80;

          *(ushort *)(param_5 + 0x100 + iVar5 * 2) = *(byte *)(iVar8 + 2 + param_1) - 0x80;

          iVar5 = iVar5 + 1;

          iVar8 = iVar8 + 3;

        } while (iVar4 < param_3);

      }

      iVar8 = iVar4 * 3;

      iVar5 = iVar3 + iVar8;

      if (iVar4 < 8) {

        if (3 < 8 - iVar4) {

          iVar6 = iVar4 + iVar2;

          do {

            iVar4 = iVar4 + 3;

            *(ushort *)(param_5 + iVar6 * 2) = *(byte *)(iVar5 + -3 + param_1) - 0x80;

            *(ushort *)(param_5 + 0x80 + iVar6 * 2) = *(byte *)(iVar5 + -2 + param_1) - 0x80;

            *(ushort *)(param_5 + 0x100 + iVar6 * 2) = *(byte *)(iVar5 + -1 + param_1) - 0x80;

            *(ushort *)(param_5 + 2 + iVar6 * 2) = *(byte *)(iVar5 + -3 + param_1) - 0x80;

            *(ushort *)(param_5 + 0x82 + iVar6 * 2) = *(byte *)(iVar5 + -2 + param_1) - 0x80;

            *(ushort *)(param_5 + 0x102 + iVar6 * 2) = *(byte *)(iVar5 + -1 + param_1) - 0x80;

            *(ushort *)(param_5 + 4 + iVar6 * 2) = *(byte *)(iVar5 + -3 + param_1) - 0x80;

            *(ushort *)(param_5 + 0x84 + iVar6 * 2) = *(byte *)(iVar5 + -2 + param_1) - 0x80;

            *(ushort *)(param_5 + 0x104 + iVar6 * 2) = *(byte *)(iVar5 + -1 + param_1) - 0x80;

            iVar6 = iVar6 + 3;

          } while (iVar4 < 4);

        }

        pbVar9 = (byte *)(iVar3 + -3 + iVar8 + param_1);

        psVar7 = (short *)(param_5 + (iVar4 + iVar2) * 2);

        do {

          iVar4 = iVar4 + 1;

          *psVar7 = *pbVar9 - 0x80;

          psVar7[0x40] = pbVar9[1] - 0x80;

          psVar7[0x80] = pbVar9[2] - 0x80;

          psVar7 = psVar7 + 1;

        } while (iVar4 < 8);

      }

      iVar3 = iVar3 + param_2;

      iVar2 = iVar2 + 8;

      iVar1 = iVar1 + 1;

    } while (iVar1 < param_4);

  }

  iVar2 = iVar1 * 8;

  for (; iVar1 < 8; iVar1 = iVar1 + 1) {

    *(ushort *)(param_5 + iVar1 * 0x10) = *(byte *)(iVar2 + -8 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x80 + iVar1 * 0x10) = *(byte *)(iVar2 + -7 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x100 + iVar1 * 0x10) = *(byte *)(iVar2 + -6 + param_1) - 0x80;

    *(ushort *)(param_5 + 2 + iVar1 * 0x10) = *(byte *)(iVar2 + -5 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x82 + iVar1 * 0x10) = *(byte *)(iVar2 + -4 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x102 + iVar1 * 0x10) = *(byte *)(iVar2 + -3 + param_1) - 0x80;

    *(ushort *)(param_5 + 4 + iVar1 * 0x10) = *(byte *)(iVar2 + -2 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x84 + iVar1 * 0x10) = *(byte *)(iVar2 + -1 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x104 + iVar1 * 0x10) = *(byte *)(iVar2 + param_1) - 0x80;

    *(ushort *)(param_5 + 6 + iVar1 * 0x10) = *(byte *)(iVar2 + 1 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x86 + iVar1 * 0x10) = *(byte *)(iVar2 + 2 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x106 + iVar1 * 0x10) = *(byte *)(iVar2 + 3 + param_1) - 0x80;

    *(ushort *)(param_5 + 8 + iVar1 * 0x10) = *(byte *)(iVar2 + 4 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x88 + iVar1 * 0x10) = *(byte *)(iVar2 + 5 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x108 + iVar1 * 0x10) = *(byte *)(iVar2 + 6 + param_1) - 0x80;

    *(ushort *)(param_5 + 10 + iVar1 * 0x10) = *(byte *)(iVar2 + 7 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x8a + iVar1 * 0x10) = *(byte *)(iVar2 + 8 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x10a + iVar1 * 0x10) = *(byte *)(iVar2 + 9 + param_1) - 0x80;

    *(ushort *)(param_5 + 0xc + iVar1 * 0x10) = *(byte *)(iVar2 + 10 + param_1) - 0x80;

    *(ushort *)(param_5 + 0x8c + iVar1 * 0x10) = *(byte *)(iVar2 + 0xb + param_1) - 0x80;

    *(ushort *)(param_5 + 0x10c + iVar1 * 0x10) = *(byte *)(iVar2 + 0xc + param_1) - 0x80;

    *(ushort *)(param_5 + 0xe + iVar1 * 0x10) = *(byte *)(iVar2 + 0xd + param_1) - 0x80;

    *(ushort *)(param_5 + 0x8e + iVar1 * 0x10) = *(byte *)(iVar2 + 0xe + param_1) - 0x80;

    *(ushort *)(param_5 + 0x10e + iVar1 * 0x10) = *(byte *)(iVar2 + 0xf + param_1) - 0x80;

  }

  return;

}





// --- FUN_0062b2a0 at 0x0062B2A0 (size: 1261) ---


void FUN_0062b2a0(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  ushort *puVar1;

  ushort *puVar2;

  ushort *puVar3;

  ushort *puVar4;

  int iVar5;

  int iVar6;

  ushort *puVar7;

  int iVar8;

  ushort *puVar9;

  int iVar10;

  int iVar11;

  short *psVar12;

  ushort local_642;

  ushort local_640 [16];

  undefined1 local_620 [478];

  ushort local_442 [256];

  ushort auStack_242 [267];

  int local_2c;

  int local_28;

  ushort *local_24;

  int local_20;

  int local_1c;

  int local_18;

  

  iVar8 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_2c = 0;

    local_24 = local_640;

    do {

      iVar6 = 0;

      if (0 < param_3) {

        local_20 = iVar8;

        iVar10 = local_1c;

        iVar11 = local_18;

        do {

          iVar6 = iVar6 + 1;

          local_640[iVar10] = (ushort)*(byte *)(iVar11 + param_1);

          local_442[iVar10 + 1] = (ushort)*(byte *)(iVar11 + 1 + param_1);

          iVar5 = iVar11 + 2;

          iVar11 = iVar11 + 3;

          auStack_242[iVar10 + 1] = (ushort)*(byte *)(iVar5 + param_1);

          iVar10 = iVar10 + 1;

        } while (iVar6 < param_3);

      }

      if (iVar6 < 0x10) {

        local_28 = (int)local_640 + local_2c;

        puVar7 = local_640 + iVar6 + local_1c;

        local_20 = iVar8;

        do {

          iVar6 = iVar6 + 1;

          *puVar7 = *(ushort *)((int)&local_642 + param_3 * 2 + local_2c);

          puVar7[0x100] = *(ushort *)((int)local_442 + param_3 * 2 + local_2c);

          puVar7[0x200] = *(ushort *)((int)auStack_242 + param_3 * 2 + local_2c);

          puVar7 = puVar7 + 1;

        } while (iVar6 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_2c = local_2c + 0x20;

      iVar8 = iVar8 + 1;

    } while (iVar8 < param_4);

  }

  if (iVar8 < 0x10) {

    puVar7 = local_640 + iVar8 * 0x10;

    do {

      *puVar7 = puVar7[-0x10];

      puVar7[0x100] = puVar7[0xf0];

      iVar8 = iVar8 + 1;

      puVar7[0x200] = puVar7[0x1f0];

      puVar7[1] = puVar7[-0xf];

      puVar7[0x101] = puVar7[0xf1];

      puVar7[0x201] = puVar7[0x1f1];

      puVar7[2] = puVar7[-0xe];

      puVar7[0x102] = puVar7[0xf2];

      puVar7[0x202] = puVar7[0x1f2];

      puVar7[3] = puVar7[-0xd];

      puVar7[0x103] = puVar7[0xf3];

      puVar7[0x203] = puVar7[499];

      puVar7[4] = puVar7[-0xc];

      puVar7[0x104] = puVar7[0xf4];

      puVar7[0x204] = puVar7[500];

      puVar7[5] = puVar7[-0xb];

      puVar7[0x105] = puVar7[0xf5];

      puVar7[0x205] = puVar7[0x1f5];

      puVar7[6] = puVar7[-10];

      puVar7[0x106] = puVar7[0xf6];

      puVar7[0x206] = puVar7[0x1f6];

      puVar7[7] = puVar7[-9];

      puVar7[0x107] = puVar7[0xf7];

      puVar7[0x207] = puVar7[0x1f7];

      puVar7[8] = puVar7[-8];

      puVar7[0x108] = puVar7[0xf8];

      puVar7[0x208] = puVar7[0x1f8];

      puVar7[9] = puVar7[-7];

      puVar7[0x109] = puVar7[0xf9];

      puVar7[0x209] = puVar7[0x1f9];

      puVar7[10] = puVar7[-6];

      puVar7[0x10a] = puVar7[0xfa];

      puVar7[0x20a] = puVar7[0x1fa];

      puVar7[0xb] = puVar7[-5];

      puVar7[0x10b] = puVar7[0xfb];

      puVar7[0x20b] = puVar7[0x1fb];

      puVar7[0xc] = puVar7[-4];

      puVar7[0x10c] = puVar7[0xfc];

      puVar7[0x20c] = puVar7[0x1fc];

      puVar7[0xd] = puVar7[-3];

      puVar7[0x10d] = puVar7[0xfd];

      puVar7[0x20d] = puVar7[0x1fd];

      puVar7[0xe] = puVar7[-2];

      puVar7[0x10e] = puVar7[0xfe];

      puVar7[0x20e] = puVar7[0x1fe];

      puVar7[0xf] = puVar7[-1];

      puVar7[0x10f] = puVar7[0xff];

      puVar7[0x20f] = puVar7[0x1ff];

      puVar7 = puVar7 + 0x10;

    } while (iVar8 < 0x10);

  }

  iVar6 = 0;

  iVar8 = 0;

  iVar10 = 0;

  do {

    psVar12 = (short *)(param_5 + iVar6 * 2);

    puVar7 = local_640 + iVar8;

    puVar9 = local_640 + iVar10;

    do {

      *psVar12 = *puVar7 - 0x80;

      psVar12[0x40] = puVar7[8] - 0x80;

      psVar12[0x80] = puVar7[0x80] - 0x80;

      psVar12[0xc0] = puVar7[0x88] - 0x80;

      puVar7 = puVar7 + 1;

      psVar12[0x100] =

           (short)((int)(short)puVar9[0x100] + (int)(short)puVar9[0x101] + (int)(short)puVar9[0x110]

                   + 2 + (int)(short)puVar9[0x111] >> 2) + -0x80;

      puVar1 = puVar9 + 0x200;

      puVar2 = puVar9 + 0x201;

      puVar3 = puVar9 + 0x210;

      puVar4 = puVar9 + 0x211;

      puVar9 = puVar9 + 2;

      psVar12[0x140] =

           (short)((int)(short)*puVar1 + (int)(short)*puVar2 + (int)(short)*puVar3 + 2 +

                   (int)(short)*puVar4 >> 2) + -0x80;

      psVar12 = psVar12 + 1;

    } while ((int)puVar9 < (int)(local_620 + iVar10 * 2));

    iVar6 = iVar6 + 8;

    iVar8 = iVar8 + 0x10;

    iVar10 = iVar10 + 0x20;

  } while (iVar10 < 0x100);

  return;

}





// --- FUN_0062b790 at 0x0062B790 (size: 1284) ---


void FUN_0062b790(byte *param_1,int param_2,short *param_3,short *param_4,short *param_5)



{

  byte bVar1;

  byte bVar2;

  byte bVar3;

  byte bVar4;

  byte bVar5;

  byte bVar6;

  byte bVar7;

  byte bVar8;

  byte bVar9;

  byte bVar10;

  byte bVar11;

  byte bVar12;

  byte bVar13;

  byte bVar14;

  byte bVar15;

  byte bVar16;

  byte bVar17;

  byte bVar18;

  byte bVar19;

  byte bVar20;

  byte bVar21;

  byte bVar22;

  byte bVar23;

  byte bVar24;

  byte bVar25;

  byte bVar26;

  byte bVar27;

  byte bVar28;

  byte bVar29;

  byte bVar30;

  byte bVar31;

  byte bVar32;

  byte bVar33;

  byte bVar34;

  byte bVar35;

  byte bVar36;

  byte bVar37;

  byte bVar38;

  byte bVar39;

  byte bVar40;

  byte bVar41;

  byte bVar42;

  byte bVar43;

  byte bVar44;

  byte bVar45;

  byte bVar46;

  byte bVar47;

  byte bVar48;

  byte bVar49;

  byte bVar50;

  byte bVar51;

  byte bVar52;

  byte bVar53;

  byte bVar54;

  byte bVar55;

  byte bVar56;

  byte bVar57;

  byte bVar58;

  byte bVar59;

  byte bVar60;

  byte bVar61;

  byte bVar62;

  int local_90;

  

  local_90 = 0;

  do {

    *param_3 = *param_1 - 0x80;

    param_3[1] = param_1[3] - 0x80;

    param_3[2] = param_1[6] - 0x80;

    param_3[3] = param_1[9] - 0x80;

    param_3[4] = param_1[0xc] - 0x80;

    param_3[5] = param_1[0xf] - 0x80;

    param_3[6] = param_1[0x12] - 0x80;

    param_3[7] = param_1[0x15] - 0x80;

    param_3[0x40] = param_1[0x18] - 0x80;

    param_3[0x41] = param_1[0x1b] - 0x80;

    param_3[0x42] = param_1[0x1e] - 0x80;

    param_3[0x43] = param_1[0x21] - 0x80;

    param_3[0x44] = param_1[0x24] - 0x80;

    param_3[0x45] = param_1[0x27] - 0x80;

    param_3[0x46] = param_1[0x2a] - 0x80;

    param_3[0x47] = param_1[0x2d] - 0x80;

    bVar1 = param_1[1];

    bVar2 = param_1[4];

    bVar3 = param_1[7];

    bVar4 = param_1[10];

    bVar5 = param_1[0xd];

    bVar6 = param_1[0x10];

    bVar7 = param_1[0x16];

    bVar8 = param_1[0x13];

    bVar9 = param_1[0x19];

    bVar10 = param_1[0x1c];

    bVar11 = param_1[0x22];

    bVar12 = param_1[0x1f];

    bVar13 = param_1[0x25];

    bVar14 = param_1[0x28];

    bVar15 = param_1[0x2e];

    bVar16 = param_1[0x2b];

    bVar17 = param_1[2];

    bVar18 = param_1[5];

    bVar19 = param_1[0xb];

    bVar20 = param_1[8];

    bVar21 = param_1[0xe];

    bVar22 = param_1[0x11];

    bVar23 = param_1[0x17];

    bVar24 = param_1[0x14];

    bVar25 = param_1[0x1a];

    bVar26 = param_1[0x1d];

    bVar27 = param_1[0x23];

    bVar28 = param_1[0x20];

    bVar29 = param_1[0x26];

    bVar30 = param_1[0x29];

    bVar31 = param_1[0x2f];

    bVar32 = param_1[0x2c];

    param_1 = param_1 + param_2;

    param_3[8] = *param_1 - 0x80;

    param_3[9] = param_1[3] - 0x80;

    param_3[10] = param_1[6] - 0x80;

    param_3[0xb] = param_1[9] - 0x80;

    param_3[0xc] = param_1[0xc] - 0x80;

    param_3[0xd] = param_1[0xf] - 0x80;

    param_3[0xe] = param_1[0x12] - 0x80;

    param_3[0xf] = param_1[0x15] - 0x80;

    param_3[0x48] = param_1[0x18] - 0x80;

    param_3[0x49] = param_1[0x1b] - 0x80;

    param_3[0x4a] = param_1[0x1e] - 0x80;

    param_3[0x4b] = param_1[0x21] - 0x80;

    param_3[0x4c] = param_1[0x24] - 0x80;

    param_3[0x4d] = param_1[0x27] - 0x80;

    param_3[0x4e] = param_1[0x2a] - 0x80;

    param_3[0x4f] = param_1[0x2d] - 0x80;

    bVar33 = param_1[7];

    bVar34 = param_1[10];

    bVar35 = param_1[0x10];

    bVar36 = param_1[0xd];

    bVar37 = param_1[0x13];

    bVar38 = param_1[0x16];

    bVar39 = param_1[0x1c];

    bVar40 = param_1[0x19];

    bVar41 = param_1[0x1f];

    bVar42 = param_1[0x22];

    bVar43 = param_1[0x28];

    bVar44 = param_1[0x25];

    bVar45 = param_1[0x2b];

    bVar46 = param_1[0x2e];

    bVar47 = param_1[5];

    bVar48 = param_1[2];

    bVar49 = param_1[8];

    bVar50 = param_1[0xb];

    bVar51 = param_1[0x11];

    bVar52 = param_1[0xe];

    bVar53 = param_1[0x14];

    bVar54 = param_1[0x17];

    bVar55 = param_1[0x1d];

    bVar56 = param_1[0x1a];

    bVar57 = param_1[0x20];

    bVar58 = param_1[0x23];

    bVar59 = param_1[0x26];

    bVar60 = param_1[0x29];

    bVar61 = param_1[0x2c];

    bVar62 = param_1[0x2f];

    *param_4 = (short)((int)((uint)param_1[1] + (uint)param_1[4] + 2 + (uint)bVar1 + (uint)bVar2) >>

                      2) + -0x80;

    param_4[1] = (short)((int)((uint)bVar33 + (uint)bVar34 + 2 + (uint)bVar3 + (uint)bVar4) >> 2) +

                 -0x80;

    param_4[2] = (short)((int)((uint)bVar36 + (uint)bVar35 + 2 + (uint)bVar5 + (uint)bVar6) >> 2) +

                 -0x80;

    param_4[3] = (short)((int)((uint)bVar37 + (uint)bVar38 + 2 + (uint)bVar8 + (uint)bVar7) >> 2) +

                 -0x80;

    param_4[4] = (short)((int)((uint)bVar40 + (uint)bVar39 + 2 + (uint)bVar9 + (uint)bVar10) >> 2) +

                 -0x80;

    param_4[5] = (short)((int)((uint)bVar41 + (uint)bVar42 + 2 + (uint)bVar12 + (uint)bVar11) >> 2)

                 + -0x80;

    param_4[6] = (short)((int)((uint)bVar44 + (uint)bVar43 + 2 + (uint)bVar13 + (uint)bVar14) >> 2)

                 + -0x80;

    param_4[7] = (short)((int)((uint)bVar45 + (uint)bVar46 + 2 + (uint)bVar16 + (uint)bVar15) >> 2)

                 + -0x80;

    *param_5 = (short)((int)((uint)bVar48 + (uint)bVar47 + 2 + (uint)bVar17 + (uint)bVar18) >> 2) +

               -0x80;

    param_5[1] = (short)((int)((uint)bVar49 + (uint)bVar50 + 2 + (uint)bVar20 + (uint)bVar19) >> 2)

                 + -0x80;

    param_5[2] = (short)((int)((uint)bVar52 + (uint)bVar51 + 2 + (uint)bVar21 + (uint)bVar22) >> 2)

                 + -0x80;

    param_5[3] = (short)((int)((uint)bVar53 + (uint)bVar54 + 2 + (uint)bVar24 + (uint)bVar23) >> 2)

                 + -0x80;

    param_5[4] = (short)((int)((uint)bVar56 + (uint)bVar55 + 2 + (uint)bVar25 + (uint)bVar26) >> 2)

                 + -0x80;

    param_4 = param_4 + 8;

    param_5[5] = (short)((int)((uint)bVar57 + (uint)bVar58 + 2 + (uint)bVar28 + (uint)bVar27) >> 2)

                 + -0x80;

    param_5[6] = (short)((int)((uint)bVar59 + (uint)bVar60 + 2 + (uint)bVar29 + (uint)bVar30) >> 2)

                 + -0x80;

    param_5[7] = (short)((int)((uint)bVar61 + (uint)bVar62 + 2 + (uint)bVar32 + (uint)bVar31) >> 2)

                 + -0x80;

    param_5 = param_5 + 8;

    param_3 = param_3 + 0x10;

    param_1 = param_1 + param_2;

    local_90 = local_90 + 2;

  } while (local_90 < 8);

  return;

}





// --- FUN_0062be20 at 0x0062BE20 (size: 1165) ---


void FUN_0062be20(int param_1,int param_2,int param_3,int param_4,int param_5)



{

  int iVar1;

  int iVar2;

  ushort *puVar3;

  int iVar4;

  ushort *puVar5;

  int iVar6;

  int iVar7;

  short *psVar8;

  ushort local_342;

  ushort local_340 [127];

  ushort local_242 [128];

  ushort auStack_142 [139];

  int local_2c;

  ushort *local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  

  iVar4 = 0;

  if (0 < param_4) {

    local_18 = 0;

    local_1c = 0;

    local_24 = 0;

    local_28 = local_340;

    do {

      iVar2 = 0;

      if (0 < param_3) {

        local_20 = iVar4;

        iVar6 = local_1c;

        iVar7 = local_18;

        do {

          iVar2 = iVar2 + 1;

          local_340[iVar6] = (ushort)*(byte *)(iVar7 + param_1);

          local_242[iVar6 + 1] = (ushort)*(byte *)(iVar7 + 1 + param_1);

          iVar1 = iVar7 + 2;

          iVar7 = iVar7 + 3;

          auStack_142[iVar6 + 1] = (ushort)*(byte *)(iVar1 + param_1);

          iVar6 = iVar6 + 1;

        } while (iVar2 < param_3);

      }

      if (iVar2 < 0x10) {

        local_2c = (int)local_340 + local_24;

        puVar3 = local_340 + iVar2 + local_1c;

        local_20 = iVar4;

        do {

          iVar2 = iVar2 + 1;

          *puVar3 = *(ushort *)((int)&local_342 + param_3 * 2 + local_24);

          puVar3[0x80] = *(ushort *)((int)local_242 + param_3 * 2 + local_24);

          puVar3[0x100] = *(ushort *)((int)auStack_142 + param_3 * 2 + local_24);

          puVar3 = puVar3 + 1;

        } while (iVar2 < 0x10);

      }

      local_18 = local_18 + param_2;

      local_1c = local_1c + 0x10;

      local_24 = local_24 + 0x20;

      iVar4 = iVar4 + 1;

    } while (iVar4 < param_4);

  }

  if (iVar4 < 8) {

    puVar3 = local_340 + iVar4 * 0x10;

    do {

      *puVar3 = puVar3[-0x10];

      puVar3[0x80] = puVar3[0x70];

      iVar4 = iVar4 + 1;

      puVar3[0x100] = puVar3[0xf0];

      puVar3[1] = puVar3[-0xf];

      puVar3[0x81] = puVar3[0x71];

      puVar3[0x101] = puVar3[0xf1];

      puVar3[2] = puVar3[-0xe];

      puVar3[0x82] = puVar3[0x72];

      puVar3[0x102] = puVar3[0xf2];

      puVar3[3] = puVar3[-0xd];

      puVar3[0x83] = puVar3[0x73];

      puVar3[0x103] = puVar3[0xf3];

      puVar3[4] = puVar3[-0xc];

      puVar3[0x84] = puVar3[0x74];

      puVar3[0x104] = puVar3[0xf4];

      puVar3[5] = puVar3[-0xb];

      puVar3[0x85] = puVar3[0x75];

      puVar3[0x105] = puVar3[0xf5];

      puVar3[6] = puVar3[-10];

      puVar3[0x86] = puVar3[0x76];

      puVar3[0x106] = puVar3[0xf6];

      puVar3[7] = puVar3[-9];

      puVar3[0x87] = puVar3[0x77];

      puVar3[0x107] = puVar3[0xf7];

      puVar3[8] = puVar3[-8];

      puVar3[0x88] = puVar3[0x78];

      puVar3[0x108] = puVar3[0xf8];

      puVar3[9] = puVar3[-7];

      puVar3[0x89] = puVar3[0x79];

      puVar3[0x109] = puVar3[0xf9];

      puVar3[10] = puVar3[-6];

      puVar3[0x8a] = puVar3[0x7a];

      puVar3[0x10a] = puVar3[0xfa];

      puVar3[0xb] = puVar3[-5];

      puVar3[0x8b] = puVar3[0x7b];

      puVar3[0x10b] = puVar3[0xfb];

      puVar3[0xc] = puVar3[-4];

      puVar3[0x8c] = puVar3[0x7c];

      puVar3[0x10c] = puVar3[0xfc];

      puVar3[0xd] = puVar3[-3];

      puVar3[0x8d] = puVar3[0x7d];

      puVar3[0x10d] = puVar3[0xfd];

      puVar3[0xe] = puVar3[-2];

      puVar3[0x8e] = puVar3[0x7e];

      puVar3[0x10e] = puVar3[0xfe];

      puVar3[0xf] = puVar3[-1];

      puVar3[0x8f] = puVar3[0x7f];

      puVar3[0x10f] = puVar3[0xff];

      puVar3 = puVar3 + 0x10;

    } while (iVar4 < 8);

  }

  iVar4 = 0;

  local_2c = 0;

  local_28 = local_340;

  do {

    psVar8 = (short *)(param_5 + iVar4 * 2);

    puVar3 = local_28 + local_2c;

    puVar5 = local_28 + local_2c;

    do {

      *psVar8 = *puVar3 - 0x80;

      psVar8[0x40] = puVar3[8] - 0x80;

      psVar8[0x80] = (short)((short)puVar5[0x80] + 1 + (int)(short)puVar5[0x81] >> 1) + -0x80;

      psVar8[0xc0] = (short)((short)puVar5[0x100] + 1 + (int)(short)puVar5[0x101] >> 1) + -0x80;

      psVar8 = psVar8 + 1;

      puVar3 = puVar3 + 1;

      puVar5 = puVar5 + 2;

    } while ((int)puVar5 < (int)(local_28 + local_2c + 0x10));

    iVar4 = iVar4 + 8;

    local_2c = local_2c + 0x10;

  } while (local_2c < 0x80);

  return;

}





// --- FUN_0062c620 at 0x0062C620 (size: 1434) ---


void FUN_0062c620(int param_1,int param_2,uint param_3,int param_4,int param_5)



{

  int iVar1;

  ushort *puVar2;

  int iVar3;

  int iVar4;

  ushort *puVar5;

  uint uVar6;

  short *psVar7;

  ushort local_342;

  ushort local_340 [127];

  ushort local_242 [128];

  ushort auStack_142 [131];

  int local_3c;

  ushort *local_38;

  int local_34;

  int local_30;

  int local_2c;

  uint local_28;

  int local_24;

  uint local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  iVar3 = 0;

  if (0 < param_4) {

    local_30 = param_3 - 1;

    local_14 = 0;

    local_34 = param_3 * 2;

    local_3c = param_2;

    local_18 = 0;

    local_1c = 0;

    local_20 = param_3 & 1;

    local_24 = 0;

    local_38 = local_340;

    local_28 = param_3;

    do {

      uVar6 = 0;

      if (0 < local_30) {

        local_2c = local_14;

        iVar3 = local_14;

        iVar4 = local_18;

        do {

          uVar6 = uVar6 + 2;

          local_340[iVar4] = (ushort)*(byte *)(iVar3 + param_1);

          local_340[iVar4 + 1] = (ushort)*(byte *)(iVar3 + 2 + param_1);

          local_242[iVar4 + 1] = (ushort)*(byte *)(iVar3 + 1 + param_1);

          local_242[iVar4 + 2] = (ushort)*(byte *)(iVar3 + 1 + param_1);

          auStack_142[iVar4 + 1] = (ushort)*(byte *)(iVar3 + 3 + param_1);

          iVar1 = iVar3 + 3;

          iVar3 = iVar3 + 4;

          auStack_142[iVar4 + 2] = (ushort)*(byte *)(iVar1 + param_1);

          iVar4 = iVar4 + 2;

        } while ((int)uVar6 < local_30);

      }

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

        (&local_342)[local_28] = (ushort)*(byte *)(local_34 + -2 + param_1);

        local_242[local_28] = (ushort)*(byte *)(local_34 + -1 + param_1);

        auStack_142[local_28] = (ushort)*(byte *)(local_34 + -3 + param_1);

        uVar6 = param_3;

      }

      if ((int)uVar6 < 0x10) {

        local_2c = (int)local_340 + local_1c;

        puVar2 = local_340 + uVar6 + local_18;

        do {

          uVar6 = uVar6 + 1;

          *puVar2 = *(ushort *)((int)&local_342 + param_3 * 2 + local_1c);

          puVar2[0x80] = *(ushort *)((int)local_242 + param_3 * 2 + local_1c);

          puVar2[0x100] = *(ushort *)((int)auStack_142 + param_3 * 2 + local_1c);

          puVar2 = puVar2 + 1;

        } while ((int)uVar6 < 0x10);

      }

      local_14 = local_14 + param_2;

      local_18 = local_18 + 0x10;

      local_28 = local_28 + 0x10;

      local_34 = local_34 + param_2;

      iVar3 = local_24 + 1;

      local_1c = local_1c + 0x20;

      local_24 = iVar3;

    } while (iVar3 < param_4);

  }

  if (iVar3 < 8) {

    puVar2 = local_340 + iVar3 * 0x10;

    do {

      *puVar2 = puVar2[-0x10];

      puVar2[0x80] = puVar2[0x70];

      iVar3 = iVar3 + 1;

      puVar2[0x100] = puVar2[0xf0];

      puVar2[1] = puVar2[-0xf];

      puVar2[0x81] = puVar2[0x71];

      puVar2[0x101] = puVar2[0xf1];

      puVar2[2] = puVar2[-0xe];

      puVar2[0x82] = puVar2[0x72];

      puVar2[0x102] = puVar2[0xf2];

      puVar2[3] = puVar2[-0xd];

      puVar2[0x83] = puVar2[0x73];

      puVar2[0x103] = puVar2[0xf3];

      puVar2[4] = puVar2[-0xc];

      puVar2[0x84] = puVar2[0x74];

      puVar2[0x104] = puVar2[0xf4];

      puVar2[5] = puVar2[-0xb];

      puVar2[0x85] = puVar2[0x75];

      puVar2[0x105] = puVar2[0xf5];

      puVar2[6] = puVar2[-10];

      puVar2[0x86] = puVar2[0x76];

      puVar2[0x106] = puVar2[0xf6];

      puVar2[7] = puVar2[-9];

      puVar2[0x87] = puVar2[0x77];

      puVar2[0x107] = puVar2[0xf7];

      puVar2[8] = puVar2[-8];

      puVar2[0x88] = puVar2[0x78];

      puVar2[0x108] = puVar2[0xf8];

      puVar2[9] = puVar2[-7];

      puVar2[0x89] = puVar2[0x79];

      puVar2[0x109] = puVar2[0xf9];

      puVar2[10] = puVar2[-6];

      puVar2[0x8a] = puVar2[0x7a];

      puVar2[0x10a] = puVar2[0xfa];

      puVar2[0xb] = puVar2[-5];

      puVar2[0x8b] = puVar2[0x7b];

      puVar2[0x10b] = puVar2[0xfb];

      puVar2[0xc] = puVar2[-4];

      puVar2[0x8c] = puVar2[0x7c];

      puVar2[0x10c] = puVar2[0xfc];

      puVar2[0xd] = puVar2[-3];

      puVar2[0x8d] = puVar2[0x7d];

      puVar2[0x10d] = puVar2[0xfd];

      puVar2[0xe] = puVar2[-2];

      puVar2[0x8e] = puVar2[0x7e];

      puVar2[0x10e] = puVar2[0xfe];

      puVar2[0xf] = puVar2[-1];

      puVar2[0x8f] = puVar2[0x7f];

      puVar2[0x10f] = puVar2[0xff];

      puVar2 = puVar2 + 0x10;

    } while (iVar3 < 8);

  }

  iVar3 = 0;

  local_3c = 0;

  local_38 = local_340;

  do {

    psVar7 = (short *)(param_5 + iVar3 * 2);

    puVar2 = local_38 + local_3c;

    puVar5 = local_38 + local_3c;

    do {

      *psVar7 = *puVar2 - 0x80;

      psVar7[0x40] = puVar2[8] - 0x80;

      psVar7[0x80] = (short)((short)puVar5[0x80] + 1 + (int)(short)puVar5[0x81] >> 1) + -0x80;

      psVar7[0xc0] = (short)((short)puVar5[0x100] + 1 + (int)(short)puVar5[0x101] >> 1) + -0x80;

      psVar7 = psVar7 + 1;

      puVar2 = puVar2 + 1;

      puVar5 = puVar5 + 2;

    } while ((int)puVar5 < (int)(local_38 + local_3c + 0x10));

    iVar3 = iVar3 + 8;

    local_3c = local_3c + 0x10;

  } while (local_3c < 0x80);

  return;

}





// --- FUN_0062cf10 at 0x0062CF10 (size: 1112) ---


void FUN_0062cf10(int param_1,int param_2,uint param_3,int param_4,int param_5)



{

  byte *pbVar1;

  int iVar2;

  ushort *puVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  ushort local_e2;

  ushort local_e0 [70];

  int local_54;

  uint local_50;

  int local_4c;

  uint local_48;

  int local_44;

  int local_40;

  int local_3c;

  uint local_38;

  ushort *local_34;

  int local_30;

  int local_2c;

  uint local_28;

  ushort *local_24;

  int local_20;

  int local_1c;

  ushort *local_18;

  

  iVar5 = 0;

  if (0 < param_4) {

    local_38 = param_3 & 1;

    local_44 = param_3 * 2 + -2;

    local_48 = param_3;

    local_4c = param_3 - 5;

    local_40 = 0;

    local_54 = param_2;

    local_20 = 0;

    local_3c = 0;

    local_50 = param_3;

    local_1c = 0;

    local_24 = local_e0;

    local_40 = 0;

    local_28 = param_3;

    local_18 = local_e0;

    do {

      uVar6 = 0;

      if (0 < (int)param_3) {

        if (4 < (int)param_3) {

          local_34 = (ushort *)local_40;

          uVar6 = 0;

          iVar5 = local_40;

          iVar4 = local_20;

          do {

            uVar6 = uVar6 + 4;

            local_e0[iVar4] = (ushort)*(byte *)(iVar5 + param_1);

            local_e0[iVar4 + 1] = (ushort)*(byte *)(iVar5 + 1 + param_1);

            local_e0[iVar4 + 2] = (ushort)*(byte *)(iVar5 + 2 + param_1);

            iVar2 = iVar5 + 3;

            iVar5 = iVar5 + 4;

            local_e0[iVar4 + 3] = (ushort)*(byte *)(iVar2 + param_1);

            iVar4 = iVar4 + 4;

          } while ((int)uVar6 <= (int)(param_3 - 5));

        }

        local_30 = uVar6 + local_40;

        iVar5 = uVar6 + local_20;

        do {

          pbVar1 = (byte *)(local_30 + param_1);

          local_30 = local_30 + 1;

          uVar6 = uVar6 + 1;

          local_e0[iVar5] = (ushort)*pbVar1;

          iVar5 = iVar5 + 1;

        } while ((int)uVar6 < (int)param_3);

      }

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

        (&local_e2)[local_50] = (ushort)*(byte *)((local_28 - 1) + param_1);

        uVar6 = param_3;

      }

      if ((int)uVar6 < 8) {

        if ((int)(8 - uVar6) < 5) {

          local_34 = local_18 + (param_3 - 1);

        }

        else {

          local_2c = (int)local_e0 + local_3c;

          local_34 = (ushort *)(local_2c + local_44);

          local_30 = uVar6 + local_20;

          do {

            uVar6 = uVar6 + 4;

            local_e0[local_30] = *(ushort *)((int)&local_e2 + param_3 * 2 + local_3c);

            local_e0[local_30 + 1] = *(ushort *)((int)&local_e2 + param_3 * 2 + local_3c);

            local_e0[local_30 + 2] = *(ushort *)((int)&local_e2 + param_3 * 2 + local_3c);

            local_e0[local_30 + 3] = *(ushort *)((int)&local_e2 + param_3 * 2 + local_3c);

            local_30 = local_30 + 4;

          } while ((int)uVar6 < 3);

        }

        puVar3 = local_e0 + uVar6 + local_20;

        do {

          uVar6 = uVar6 + 1;

          *puVar3 = *local_34;

          puVar3 = puVar3 + 1;

        } while ((int)uVar6 < 8);

      }

      local_40 = local_40 + param_2;

      local_20 = local_20 + 8;

      local_50 = local_50 + 8;

      local_28 = local_28 + param_2;

      iVar5 = local_1c + 1;

      local_18 = local_18 + 8;

      local_3c = local_3c + 0x10;

      local_1c = iVar5;

    } while (iVar5 < param_4);

  }

  if (iVar5 < 8) {

    puVar3 = local_e0 + iVar5 * 8;

    do {

      *puVar3 = puVar3[-8];

      puVar3[1] = puVar3[-7];

      iVar5 = iVar5 + 1;

      puVar3[2] = puVar3[-6];

      puVar3[3] = puVar3[-5];

      puVar3[4] = puVar3[-4];

      puVar3[5] = puVar3[-3];

      puVar3[6] = puVar3[-2];

      puVar3[7] = puVar3[-1];

      puVar3 = puVar3 + 8;

    } while (iVar5 < 8);

  }

  iVar5 = 0;

  do {

    *(ushort *)(param_5 + iVar5 * 2) = local_e0[iVar5] - 0x80;

    *(ushort *)(param_5 + 2 + iVar5 * 2) = local_e0[iVar5 + 1] - 0x80;

    *(ushort *)(param_5 + 4 + iVar5 * 2) = local_e0[iVar5 + 2] - 0x80;

    *(ushort *)(param_5 + 6 + iVar5 * 2) = local_e0[iVar5 + 3] - 0x80;

    *(ushort *)(param_5 + 8 + iVar5 * 2) = local_e0[iVar5 + 4] - 0x80;

    *(ushort *)(param_5 + 10 + iVar5 * 2) = local_e0[iVar5 + 5] - 0x80;

    *(ushort *)(param_5 + 0xc + iVar5 * 2) = local_e0[iVar5 + 6] - 0x80;

    *(ushort *)(param_5 + 0xe + iVar5 * 2) = local_e0[iVar5 + 7] - 0x80;

    iVar5 = iVar5 + 8;

  } while (iVar5 < 0x40);

  return;

}





// --- FUN_0062f6a0 at 0x0062F6A0 (size: 455) ---


undefined4

FUN_0062f6a0(int *param_1,int param_2,int param_3,int param_4,int param_5,int param_6,int param_7,

            int param_8,int param_9,uint param_10,int *param_11,int *param_12)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  

  iVar1 = *param_1;

  uVar2 = (int)param_10 >> 0x1f;

  if (iVar1 == 0) {

    iVar4 = param_1[2];

    if (((iVar4 == 0) && (param_1[1] == 0)) && (param_1[3] == 0)) {

      param_5 = param_5 * param_3;

      *param_11 = param_6 * param_4 * param_2 + param_7 * param_5 + param_8;

      *param_12 = 0;

      param_9 = param_9 - param_4 * param_2;

      if (param_9 <= param_2) {

        param_2 = param_9;

      }

      param_12[2] = param_2;

      param_12[1] = 0;

      iVar1 = (param_10 ^ uVar2) - uVar2;

      if (iVar1 - param_5 <= param_3) {

        param_3 = iVar1 - param_5;

      }

      param_12[3] = param_3;

      return 0;

    }

  }

  else {

    iVar4 = param_1[2];

  }

  param_4 = param_4 * param_2;

  if (((param_4 < iVar4) && (iVar1 <= param_2 + param_4)) &&

     ((param_5 = param_5 * param_3, param_5 < param_1[3] && (param_1[1] <= param_3 + param_5)))) {

    *param_11 = param_6 * (param_4 - iVar1) + param_7 * (param_5 - param_1[1]) + param_8;

    iVar1 = *param_1 - param_4;

    if (iVar1 < 0) {

      iVar1 = 0;

    }

    *param_12 = iVar1;

    iVar4 = param_1[2] - param_4;

    iVar1 = iVar4;

    if (param_2 < iVar4) {

      iVar1 = param_2;

    }

    param_9 = (*param_1 - param_4) + param_9;

    if ((iVar1 < param_9) && (param_9 = param_2, iVar4 <= param_2)) {

      param_9 = iVar4;

    }

    param_12[2] = param_9;

    iVar1 = param_1[1] - param_5;

    if (iVar1 < 0) {

      iVar1 = 0;

    }

    param_12[1] = iVar1;

    iVar4 = (param_10 ^ uVar2) - uVar2;

    iVar3 = param_1[3] - param_5;

    iVar1 = iVar3;

    if (param_3 < iVar3) {

      iVar1 = param_3;

    }

    if (iVar1 < (param_1[1] - param_5) + iVar4) {

      if (iVar3 <= param_3) {

        param_3 = iVar3;

      }

    }

    else {

      param_3 = (param_1[1] - param_5) + iVar4;

    }

    param_12[3] = param_3;

    return 0;

  }

  return 0xfffffff8;

}





// --- FUN_0062f870 at 0x0062F870 (size: 297) ---


int * FUN_0062f870(int *param_1,int *param_2,int *param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  

  iVar1 = DAT_009088e4;

  if (*param_2 <= param_3[2]) {

    if (*param_3 <= param_2[2]) {

      if (param_2[1] <= param_3[3]) {

        if (param_3[1] <= param_2[3]) {

          if (*param_3 < *param_2) {

            iVar1 = *param_2;

          }

          else {

            iVar1 = *param_3;

          }

          if (param_3[1] < param_2[1]) {

            iVar2 = param_2[1];

          }

          else {

            iVar2 = param_3[1];

          }

          if (param_2[2] < param_3[2]) {

            iVar3 = param_2[2];

          }

          else {

            iVar3 = param_3[2];

          }

          if (param_2[3] < param_3[3]) {

            iVar4 = param_2[3];

          }

          else {

            iVar4 = param_3[3];

          }

          *param_1 = iVar1;

          param_1[1] = iVar2;

          param_1[2] = iVar3;

          param_1[3] = iVar4;

          return param_1;

        }

      }

    }

  }

  *param_1 = DAT_009088e0;

  iVar3 = DAT_009088ec;

  iVar2 = DAT_009088e8;

  param_1[1] = iVar1;

  param_1[2] = iVar2;

  param_1[3] = iVar3;

  return param_1;

}





// --- FUN_0062f9a0 at 0x0062F9A0 (size: 47) ---


undefined4 FUN_0062f9a0(int *param_1,int *param_2)



{

  if ((((*param_1 == *param_2) && (param_1[2] == param_2[2])) && (param_1[1] == param_2[1])) &&

     (param_1[3] == param_2[3])) {

    return 1;

  }

  return 0;

}





// --- FUN_0062f9d0 at 0x0062F9D0 (size: 47) ---


undefined4 FUN_0062f9d0(int *param_1,int *param_2)



{

  if ((((*param_1 == *param_2) && (param_1[2] == param_2[2])) && (param_1[1] == param_2[1])) &&

     (param_1[3] == param_2[3])) {

    return 0;

  }

  return 1;

}





// --- FUN_0062fa00 at 0x0062FA00 (size: 150) ---


int * FUN_0062fa00(int *param_1,int *param_2,int *param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  char cVar7;

  

  cVar7 = FUN_0062f9a0(param_2,&DAT_009088e0);

  iVar1 = DAT_009088e4;

  if (cVar7 != '\0') {

    *param_1 = DAT_009088e0;

    iVar3 = DAT_009088ec;

    iVar2 = DAT_009088e8;

    param_1[1] = iVar1;

    param_1[2] = iVar2;

    param_1[3] = iVar3;

    return param_1;

  }

  iVar1 = param_2[2];

  iVar2 = *param_3;

  iVar3 = param_2[1];

  iVar4 = param_2[3];

  iVar5 = param_3[1];

  iVar6 = param_3[1];

  *param_1 = *param_2 - *param_3;

  param_1[1] = iVar3 - iVar5;

  param_1[2] = iVar1 - iVar2;

  param_1[3] = iVar4 - iVar6;

  return param_1;

}





// --- FUN_0062faa0 at 0x0062FAA0 (size: 166) ---


void FUN_0062faa0(int param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5,

                 undefined4 param_6,undefined1 param_7)



{

  if ((*(int *)(param_3 + 8) == 0) && (*(int *)(param_1 + 0x4de0) != 0)) {

    FUN_0062fb50(param_1,param_2,param_3,param_4,param_5,param_6,1,param_7);

  }

  else {

    FUN_00631630(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

  }

  FUN_006327e0(param_1,param_2,param_4,param_5,param_6);

  return;

}





// --- FUN_0062fb50 at 0x0062FB50 (size: 6664) ---


/* WARNING: Type propagation algorithm not settling */



void FUN_0062fb50(int param_1,int param_2,int *param_3,int param_4,undefined4 param_5,int param_6,

                 int param_7,char param_8)



{

  short *psVar1;

  undefined1 *puVar2;

  short sVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  undefined1 *puVar7;

  undefined1 *puVar8;

  int iVar9;

  short *psVar10;

  short *psVar11;

  short *psVar12;

  undefined1 *puVar13;

  int iVar14;

  undefined1 *puVar15;

  int iVar16;

  undefined1 *puVar17;

  undefined1 *puVar18;

  undefined1 *puVar19;

  short *psVar20;

  int iVar21;

  int iVar22;

  short local_594 [640];

  int local_94;

  int local_90;

  int local_8c;

  int local_88;

  int local_84;

  int local_80;

  undefined1 *local_7c;

  int local_78;

  undefined1 *local_74;

  undefined1 *local_70;

  int local_6c;

  short *local_68;

  undefined1 *local_64;

  undefined1 *local_60;

  undefined1 *local_5c;

  undefined1 *local_58;

  int local_54;

  int local_50;

  int local_4c;

  int local_48;

  int local_44;

  short *local_40;

  short *local_3c;

  short *local_38;

  short *local_34;

  undefined1 *local_30;

  int local_2c;

  int local_28;

  int local_24;

  undefined1 *local_20;

  undefined1 *local_1c;

  short *local_18;

  

  local_34 = (short *)0x0;

  if (*param_3 == 1) {

    if (*(int *)(param_1 + 0x34) == 3) {

      iVar4 = 3;

    }

    else {

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

    }

    if (iVar4 <= *(int *)(param_2 + 0x38)) {

      return;

    }

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

    iVar5 = iVar4 / *(int *)(param_3[0xd] + 4);

    local_18 = *(short **)(param_1 + 0x37bc);

    psVar12 = (short *)((int)local_18 / *(int *)(param_3[0xd] + 8));

  }

  else {

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

    local_18 = *(short **)(param_1 + 0x37bc);

    psVar12 = local_18;

    iVar5 = iVar4;

  }

  if (((*(int *)(param_1 + 0x4de8) == 1) && (iVar4 == 2)) && (local_18 == (short *)0x1)) {

    if (*(int *)(param_1 + 0x74) == 0) {

      local_48 = 0;

      iVar4 = *(int *)(param_1 + 0x37c0) + -1;

      if (*(int *)(param_1 + 0x37c0) != 0) {

        iVar6 = iVar4 * 0x10;

        local_48 = 0;

        do {

          iVar4 = iVar4 + -1;

          local_48 = local_48 +

                     *(int *)(iVar6 + 4 + *(int *)(param_1 + 0x37cc)) *

                     *(int *)(iVar6 + 8 + *(int *)(param_1 + 0x37cc));

          iVar6 = iVar6 + -0x10;

          local_84 = iVar5 * param_6;

        } while (iVar4 != -1);

      }

    }

    else {

      local_48 = 1;

    }

    local_44 = param_4 * 2 * local_48 * 0x40 + *(int *)(*(int *)(param_1 + 0x4dec) + 4);

    local_48 = local_48 * 0x100 + local_44;

  }

  else {

    local_44 = 0;

    local_48 = 0;

  }

  local_4c = *(int *)(param_1 + 0x4834);

  iVar4 = FUN_0062f6a0(param_1 + 4,iVar5 * param_6,(int)psVar12 * param_6,param_4,param_5,

                       *(undefined4 *)(param_1 + 0x30),*(undefined4 *)(param_1 + 0x3c),

                       *(undefined4 *)(param_1 + 0x20),*(undefined4 *)(param_1 + 0x24),

                       *(undefined4 *)(param_1 + 0x28),param_2 + 0x2c,&local_94);

  if (iVar4 == 0) {

    if (param_7 == 0) {

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

      if ((iVar4 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

        local_50 = *(int *)(param_2 + 0x2c);

        if (*(int *)(param_2 + 0x38) == 0) {

          local_50 = local_50 + 2;

        }

        else if (*(int *)(param_2 + 0x38) == 1) {

          local_50 = local_50 + 1;

        }

      }

      else {

        local_50 = *(int *)(param_2 + 0x2c) + *(int *)(param_2 + 0x38);

      }

      iVar5 = *param_3;

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

      local_80 = 0;

      local_58 = (undefined1 *)0x0;

      local_54 = param_6 << 5;

      psVar12 = local_34;

      while( true ) {

        iVar9 = iVar6;

        if (iVar5 < iVar6) {

          iVar9 = iVar5;

        }

        if (iVar9 <= local_80) break;

        if ((*(int *)(param_1 + 0x58) != 4) || (local_80 < 1)) {

          iVar6 = param_3[0xd];

          if (iVar5 == 1) {

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

            puVar8 = *(undefined1 **)(iVar6 + 4);

          }

          else {

            iVar5 = *(int *)((int)local_58 + 8 + iVar6);

            puVar8 = *(undefined1 **)((int)local_58 + 4 + iVar6);

          }

          local_34 = *(short **)(param_1 + 0x37b8);

          puVar7 = (undefined1 *)((int)local_34 / (int)puVar8);

          local_30 = *(undefined1 **)(param_1 + 0x37bc);

          iVar6 = (int)local_30 / iVar5;

          if (param_8 == '\0') {

            if ((((*(int *)(param_1 + 0x4de8) == 1) && (local_34 == (short *)0x2)) &&

                (local_30 == (undefined1 *)0x1)) && (param_6 != 1)) {

              psVar12 = local_594;

              local_68 = psVar12;

              local_6c = 0;

              if (0 < (int)puVar8) {

                iVar4 = 0;

                local_74 = (undefined1 *)(param_6 + -1);

                local_84 = param_6 + -6;

                local_70 = (undefined1 *)((int)puVar7 * param_6);

                local_64 = (undefined1 *)(param_6 * 8);

                local_60 = puVar7;

                local_5c = puVar8;

                do {

                  iVar5 = 0;

                  if (0 < (int)local_64) {

                    local_30 = (undefined1 *)(local_44 + param_6 * 2);

                    local_34 = (short *)(local_4c + param_6 * 2);

                    puVar8 = (undefined1 *)0x0;

                    local_6c = iVar4;

                    local_68 = psVar12;

                    do {

                      psVar12 = (short *)(iVar5 << 2);

                      if (local_60 == (undefined1 *)0x2) {

                        local_18 = psVar12;

                        psVar11 = (short *)(iVar5 * 2);

                        local_38 = psVar11;

                        psVar10 = (short *)(local_4c + iVar5 * 2);

                        local_40 = psVar10;

                        sVar3 = *psVar10;

                        psVar20 = local_68 + iVar5 * 2;

                        local_3c = psVar20;

                        *(char *)psVar20 =

                             (char)(*(short *)(local_30 + iVar5 * 2 + -2) + 1 + sVar3 * 3 >> 2);

                        *(char *)((int)psVar20 + 1) = (char)(psVar10[1] + 2 + sVar3 * 3 >> 2);

                        if (1 < (int)local_74) {

                          psVar20 = psVar10 + 1;

                          local_7c = puVar8;

                          local_78 = iVar5;

                          do {

                            psVar12 = psVar12 + 1;

                            sVar3 = *psVar20;

                            psVar1 = (short *)((int)local_68 + (int)psVar12);

                            *(char *)psVar1 = (char)(psVar20[-1] + 1 + sVar3 * 3 >> 2);

                            *(char *)((int)psVar1 + 1) = (char)(psVar20[1] + 2 + sVar3 * 3 >> 2);

                            psVar20 = psVar20 + 1;

                          } while ((int)psVar20 < (int)(psVar10 + param_6 + -1));

                          local_3c = psVar1;

                        }

                        psVar12 = local_3c;

                        iVar4 = *(short *)((int)psVar11 + (int)local_34 + -2) * 3;

                        *(char *)(local_3c + 1) =

                             (char)(*(short *)((int)psVar11 + (int)local_34 + -4) + 1 + iVar4 >> 2);

                        *(char *)((int)psVar12 + 3) =

                             (char)(*(short *)((int)psVar11 + local_48) + 2 + iVar4 >> 2);

                      }

                      else {

                        iVar4 = 0;

                        if (0 < param_6) {

                          if (param_6 < 6) {

                            psVar12 = local_68 + iVar5 * 2;

                          }

                          else {

                            psVar12 = local_68 + iVar5 * 2;

                            local_7c = puVar8;

                            do {

                              *(undefined1 *)((int)psVar12 + iVar4) = puVar8[iVar4 * 2 + local_4c];

                              *(undefined1 *)((int)psVar12 + iVar4 + 1) =

                                   puVar8[iVar4 * 2 + local_4c + 2];

                              *(undefined1 *)((int)psVar12 + iVar4 + 2) =

                                   puVar8[iVar4 * 2 + local_4c + 4];

                              *(undefined1 *)((int)psVar12 + iVar4 + 3) =

                                   puVar8[iVar4 * 2 + local_4c + 6];

                              *(undefined1 *)((int)psVar12 + iVar4 + 4) =

                                   puVar8[iVar4 * 2 + local_4c + 8];

                              iVar4 = iVar4 + 5;

                            } while (iVar4 <= local_84);

                          }

                          local_78 = iVar5;

                          do {

                            *(undefined1 *)((int)psVar12 + iVar4) = puVar8[iVar4 * 2 + local_4c];

                            iVar4 = iVar4 + 1;

                          } while (iVar4 < param_6);

                        }

                      }

                      puVar8 = puVar8 + 0x10;

                      iVar5 = iVar5 + 8;

                      iVar4 = local_6c;

                      psVar12 = local_68;

                    } while (iVar5 < (int)local_64);

                  }

                  psVar12 = (short *)((int)psVar12 + (int)local_70);

                  local_4c = local_4c + 0x80;

                  local_48 = local_48 + 0x80;

                  local_44 = local_44 + 0x80;

                  iVar4 = iVar4 + 1;

                } while (iVar4 < (int)local_5c);

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

              }

            }

            else {

              iVar9 = 0;

              if (0 < iVar5) {

                iVar4 = iVar6 * 0x20;

                iVar16 = 0;

                local_60 = puVar7;

                local_6c = iVar4;

                do {

                  puVar17 = (undefined1 *)((int)local_594 + iVar16);

                  puVar18 = (undefined1 *)0x0;

                  if (0 < (int)puVar8) {

                    local_24 = iVar16;

                    local_28 = local_54 * iVar6;

                    local_2c = iVar9;

                    local_78 = iVar5;

                    local_5c = puVar8;

                    iVar22 = local_4c;

                    do {

                      psVar12 = (short *)0x0;

                      if (0 < param_6) {

                        psVar10 = (short *)0x0;

                        local_20 = puVar18;

                        local_1c = puVar17;

                        do {

                          iVar14 = 0;

                          if (0 < param_6) {

                            local_18 = (short *)((int)psVar10 + (int)puVar17);

                            puVar15 = (undefined1 *)0x0;

                            local_38 = psVar10;

                            local_3c = psVar12;

                            do {

                              psVar20 = (short *)0x0;

                              if (0 < iVar4) {

                                psVar11 = (short *)((int)psVar10 + (int)puVar17 + (int)puVar15);

                                local_68 = psVar11;

                                local_64 = puVar15;

                                local_84 = iVar14;

                                do {

                                  puVar13 = (undefined1 *)0x0;

                                  if (0 < (int)puVar7) {

                                    if ((int)puVar7 < 5) {

                                      puVar19 = (undefined1 *)

                                                ((int)psVar12 * 0x10 + iVar22 + iVar14 * 2);

                                    }

                                    else {

                                      iVar21 = (int)psVar12 * 0x10 + iVar22;

                                      puVar19 = (undefined1 *)(iVar21 + iVar14 * 2);

                                      puVar2 = (undefined1 *)((int)psVar20 + (int)psVar11);

                                      local_7c = (undefined1 *)0x0;

                                      local_74 = puVar2;

                                      local_70 = puVar19;

                                      do {

                                        puVar2[(int)local_7c] = *(undefined1 *)(iVar21 + iVar14 * 2)

                                        ;

                                        (puVar2 + 1)[(int)local_7c] =

                                             *(undefined1 *)(iVar21 + iVar14 * 2);

                                        (puVar2 + 2)[(int)local_7c] =

                                             *(undefined1 *)(iVar21 + iVar14 * 2);

                                        (puVar2 + 3)[(int)local_7c] =

                                             *(undefined1 *)(iVar21 + iVar14 * 2);

                                        puVar13 = local_7c + 4;

                                        local_7c = puVar13;

                                      } while ((int)puVar13 <= (int)(puVar7 + -5));

                                    }

                                    local_40 = psVar20;

                                    do {

                                      ((undefined1 *)((int)psVar20 + (int)psVar11))[(int)puVar13] =

                                           *puVar19;

                                      puVar13 = puVar13 + 1;

                                    } while ((int)puVar13 < (int)puVar7);

                                  }

                                  psVar20 = psVar20 + 0x10;

                                } while ((int)psVar20 < iVar4);

                              }

                              puVar15 = puVar15 + (int)puVar7;

                              iVar14 = iVar14 + 1;

                            } while (iVar14 < param_6);

                          }

                          psVar10 = psVar10 + iVar6 * 0x10;

                          psVar12 = (short *)((int)psVar12 + 1);

                        } while ((int)psVar12 < param_6);

                      }

                      puVar17 = puVar17 + (int)puVar7 * param_6;

                      iVar22 = iVar22 + 0x80;

                      puVar18 = puVar18 + 1;

                    } while ((int)puVar18 < (int)puVar8);

                    local_4c = iVar22;

                  }

                  iVar16 = iVar16 + local_54 * iVar6;

                  iVar9 = iVar9 + 1;

                } while (iVar9 < iVar5);

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

                local_34 = (short *)((int)puVar7 * param_6);

                local_30 = puVar7 + -5;

              }

            }

          }

          else {

            puVar18 = (undefined1 *)0x0;

            if (0 < iVar5) {

              iVar4 = iVar6 * param_6;

              puVar7 = (undefined1 *)((int)puVar7 * param_6);

              local_7c = puVar7 + -6;

              psVar12 = (short *)0x0;

              local_60 = puVar7;

              local_6c = iVar4;

              do {

                puVar17 = (undefined1 *)((int)local_594 + (int)psVar12);

                psVar10 = (short *)0x0;

                if (0 < (int)puVar8) {

                  local_68 = psVar12;

                  local_70 = (undefined1 *)(local_54 * iVar6);

                  local_74 = puVar18;

                  local_78 = iVar5;

                  local_5c = puVar8;

                  iVar9 = local_4c;

                  do {

                    psVar20 = (short *)0x0;

                    if (0 < iVar4) {

                      local_38 = (short *)0x0;

                      iVar16 = 0;

                      local_40 = psVar10;

                      psVar11 = (short *)0x0;

                      local_64 = puVar17;

                      do {

                        iVar22 = 0;

                        if (0 < (int)puVar7) {

                          if (5 < (int)puVar7) {

                            iVar14 = iVar9 + iVar16;

                            do {

                              *(undefined1 *)((int)psVar11 + (int)(puVar17 + iVar22)) =

                                   *(undefined1 *)(iVar14 + iVar22 * 2);

                              *(undefined1 *)((int)psVar11 + (int)(puVar17 + iVar22 + 1)) =

                                   *(undefined1 *)(iVar14 + 2 + iVar22 * 2);

                              *(undefined1 *)((int)psVar11 + (int)(puVar17 + iVar22 + 2)) =

                                   *(undefined1 *)(iVar14 + 4 + iVar22 * 2);

                              *(undefined1 *)((int)psVar11 + (int)(puVar17 + iVar22 + 3)) =

                                   *(undefined1 *)(iVar14 + 6 + iVar22 * 2);

                              *(undefined1 *)((int)psVar11 + (int)(puVar17 + iVar22 + 4)) =

                                   *(undefined1 *)(iVar14 + 8 + iVar22 * 2);

                              iVar22 = iVar22 + 5;

                              local_34 = (short *)iVar16;

                            } while (iVar22 <= (int)(puVar7 + -6));

                          }

                          local_30 = puVar17 + (int)psVar11;

                          local_38 = psVar11;

                          local_3c = psVar20;

                          do {

                            local_30[iVar22] = *(undefined1 *)(iVar9 + iVar16 + iVar22 * 2);

                            iVar22 = iVar22 + 1;

                          } while (iVar22 < (int)puVar7);

                        }

                        psVar11 = psVar11 + 0x10;

                        iVar16 = iVar16 + 0x10;

                        psVar20 = (short *)((int)psVar20 + 1);

                      } while ((int)psVar20 < iVar4);

                    }

                    puVar17 = puVar17 + (int)puVar7;

                    iVar9 = iVar9 + 0x80;

                    psVar10 = (short *)((int)psVar10 + 1);

                  } while ((int)psVar10 < (int)puVar8);

                  local_4c = iVar9;

                }

                psVar12 = (short *)((int)psVar12 + local_54 * iVar6);

                puVar18 = puVar18 + 1;

              } while ((int)puVar18 < iVar5);

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

            }

          }

          psVar12 = local_594;

          if ((iVar4 == 3) && (*(int *)(param_2 + 0x38) != 0)) {

            if (*(int *)(param_2 + 0x38) == 2) {

              local_50 = local_50 + 1;

            }

            if (local_90 < local_88) {

              puVar8 = (undefined1 *)(local_90 << 5);

              iVar4 = local_90;

              do {

                if (local_94 < local_8c) {

                  local_30 = puVar8;

                  local_34 = psVar12;

                  iVar5 = local_94;

                  do {

                    *(undefined1 *)(iVar4 * *(int *)(param_1 + 0x3c) + local_50 + iVar5 * 2) =

                         *(undefined1 *)((int)psVar12 + (int)(puVar8 + iVar5));

                    iVar5 = iVar5 + 2;

                  } while (iVar5 < local_8c);

                }

                puVar8 = puVar8 + 0x20;

                iVar4 = iVar4 + 1;

              } while (iVar4 < local_88);

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

            }

          }

          else {

            FUN_00633140(param_1,&local_94,local_80,local_50,psVar12);

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

          }

          if ((iVar4 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

            local_50 = local_50 + -1;

            iVar5 = *param_3;

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

          }

          else {

            local_50 = local_50 + 1;

            iVar5 = *param_3;

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

          }

        }

        local_58 = (undefined1 *)((int)local_58 + 0x18);

        local_80 = local_80 + 1;

      }

      iVar5 = local_80;

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

         (iVar5 = *(int *)(param_1 + 0x54),

         *(int *)(param_1 + 0x54) + -1 != *(int *)(param_2 + 0x38))) {

        iVar5 = iVar6;

      }

      if (((iVar4 != 0xff) || (*(int *)(param_1 + 0x58) != 0xff)) &&

         (iVar4 = local_50, local_34 = psVar12, iVar5 < iVar6)) {

        do {

          FUN_00633140(param_1,&local_94,iVar5,iVar4,psVar12);

          if ((*(int *)(param_1 + 0x34) == 2) && (*(int *)(param_1 + 0x58) == 1)) {

            iVar4 = iVar4 + -1;

          }

          else {

            iVar4 = iVar4 + 1;

          }

          iVar5 = iVar5 + 1;

        } while (iVar5 < *(int *)(param_1 + 0x30));

      }

    }

    else {

      local_78 = *(int *)(param_2 + 0x2c);

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

      if ((iVar4 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

        if (*(int *)(param_2 + 0x38) == 0) {

          local_78 = local_78 + 2;

        }

        else if (*(int *)(param_2 + 0x38) == 1) {

          local_78 = local_78 + 1;

        }

      }

      local_84 = 0;

      local_80 = param_6 << 5;

      local_7c = (undefined1 *)0x0;

      psVar12 = local_34;

      while( true ) {

        if (iVar4 == 3) {

          iVar5 = 3;

        }

        else {

          iVar5 = *param_3;

          if (*(int *)(param_1 + 0x30) <= *param_3) {

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

          }

        }

        if (iVar5 <= (int)local_7c) break;

        if ((*(int *)(param_1 + 0x58) != 4) || ((int)local_7c < 1)) {

          iVar5 = param_3[0xd];

          if (*param_3 == 1) {

            puVar8 = *(undefined1 **)(iVar5 + 8);

            psVar12 = *(short **)(iVar5 + 4);

          }

          else {

            puVar8 = *(undefined1 **)(local_84 + 8 + iVar5);

            psVar12 = *(short **)(local_84 + 4 + iVar5);

          }

          local_18 = *(short **)(param_1 + 0x37b8);

          iVar5 = (int)local_18 / (int)psVar12;

          local_1c = *(undefined1 **)(param_1 + 0x37bc);

          iVar6 = (int)local_1c / (int)puVar8;

          if (param_8 == '\0') {

            if ((((*(int *)(param_1 + 0x4de8) == 1) && (local_18 == (short *)0x2)) &&

                (local_1c == (undefined1 *)0x1)) && (param_6 != 1)) {

              psVar10 = local_594;

              local_1c = (undefined1 *)0x0;

              local_18 = psVar10;

              if (0 < (int)psVar12) {

                puVar8 = (undefined1 *)0x0;

                local_58 = (undefined1 *)(param_6 + -1);

                local_5c = (undefined1 *)(param_6 + -6);

                local_54 = iVar5 * param_6;

                local_40 = (short *)(param_6 * 8);

                local_50 = iVar5;

                local_34 = psVar12;

                do {

                  puVar7 = (undefined1 *)0x0;

                  if (0 < (int)local_40) {

                    local_20 = (undefined1 *)(local_44 + param_6 * 2);

                    local_24 = local_4c + param_6 * 2;

                    iVar4 = 0;

                    local_1c = puVar8;

                    local_18 = psVar10;

                    do {

                      puVar8 = (undefined1 *)((int)puVar7 << 2);

                      if (local_50 == 2) {

                        local_60 = puVar8;

                        iVar5 = (int)puVar7 * 2;

                        local_28 = iVar5;

                        psVar12 = (short *)(local_4c + (int)puVar7 * 2);

                        local_3c = psVar12;

                        sVar3 = *psVar12;

                        psVar10 = local_18 + (int)puVar7 * 2;

                        local_38 = psVar10;

                        *(char *)psVar10 =

                             (char)(*(short *)(local_20 + (int)puVar7 * 2 + -2) + 1 + sVar3 * 3 >> 2

                                   );

                        *(char *)((int)psVar10 + 1) = (char)(psVar12[1] + 1 + sVar3 * 3 >> 2);

                        if (1 < (int)local_58) {

                          psVar10 = psVar12 + 1;

                          local_2c = iVar4;

                          local_30 = puVar7;

                          do {

                            puVar8 = puVar8 + 2;

                            sVar3 = *psVar10;

                            psVar20 = (short *)((int)local_18 + (int)puVar8);

                            *(char *)psVar20 = (char)(psVar10[-1] + 1 + sVar3 * 3 >> 2);

                            *(char *)((int)psVar20 + 1) = (char)(psVar10[1] + 2 + sVar3 * 3 >> 2);

                            psVar10 = psVar10 + 1;

                          } while ((int)psVar10 < (int)(psVar12 + param_6 + -1));

                          local_38 = psVar20;

                        }

                        psVar12 = local_38;

                        iVar6 = *(short *)(local_24 + -2 + iVar5) * 3;

                        *(char *)(local_38 + 1) =

                             (char)(*(short *)(local_24 + -4 + iVar5) + 2 + iVar6 >> 2);

                        *(char *)((int)psVar12 + 3) =

                             (char)(*(short *)(local_48 + iVar5) + 2 + iVar6 >> 2);

                      }

                      else {

                        iVar5 = 0;

                        if (0 < param_6) {

                          if (param_6 < 6) {

                            psVar12 = local_18 + (int)puVar7 * 2;

                          }

                          else {

                            iVar6 = local_4c + iVar4;

                            psVar12 = local_18 + (int)puVar7 * 2;

                            local_2c = iVar4;

                            do {

                              *(undefined1 *)((int)psVar12 + iVar5) =

                                   *(undefined1 *)(iVar6 + iVar5 * 2);

                              *(undefined1 *)((int)psVar12 + iVar5 + 1) =

                                   *(undefined1 *)(iVar6 + 2 + iVar5 * 2);

                              *(undefined1 *)((int)psVar12 + iVar5 + 2) =

                                   *(undefined1 *)(iVar6 + 4 + iVar5 * 2);

                              *(undefined1 *)((int)psVar12 + iVar5 + 3) =

                                   *(undefined1 *)(iVar6 + 6 + iVar5 * 2);

                              *(undefined1 *)((int)psVar12 + iVar5 + 4) =

                                   *(undefined1 *)(iVar6 + 8 + iVar5 * 2);

                              iVar5 = iVar5 + 5;

                            } while (iVar5 <= (int)local_5c);

                          }

                          local_30 = puVar7;

                          do {

                            *(undefined1 *)((int)psVar12 + iVar5) =

                                 *(undefined1 *)(local_4c + iVar4 + iVar5 * 2);

                            iVar5 = iVar5 + 1;

                          } while (iVar5 < param_6);

                        }

                      }

                      iVar4 = iVar4 + 0x10;

                      puVar7 = puVar7 + 8;

                      puVar8 = local_1c;

                      psVar10 = local_18;

                    } while ((int)puVar7 < (int)local_40);

                  }

                  psVar10 = (short *)((int)psVar10 + local_54);

                  local_4c = local_4c + 0x80;

                  local_48 = local_48 + 0x80;

                  local_44 = local_44 + 0x80;

                  puVar8 = puVar8 + 1;

                } while ((int)puVar8 < (int)local_34);

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

              }

            }

            else {

              iVar9 = 0;

              if (0 < (int)puVar8) {

                iVar4 = iVar6 * 0x20;

                local_70 = (undefined1 *)(iVar5 * param_6);

                local_74 = (undefined1 *)(iVar5 + -5);

                iVar16 = 0;

                local_24 = 0;

                local_50 = iVar5;

                local_54 = iVar4;

                do {

                  puVar18 = (undefined1 *)((int)local_594 + iVar16);

                  puVar7 = (undefined1 *)0x0;

                  if (0 < (int)psVar12) {

                    local_24 = iVar16;

                    local_28 = local_80 * iVar6;

                    local_2c = iVar9;

                    local_30 = puVar8;

                    iVar22 = local_4c;

                    do {

                      psVar10 = (short *)0x0;

                      if (0 < param_6) {

                        iVar14 = 0;

                        local_20 = puVar7;

                        local_1c = puVar18;

                        do {

                          psVar20 = (short *)0x0;

                          if (0 < param_6) {

                            puVar17 = (undefined1 *)0x0;

                            local_6c = iVar14;

                            local_68 = psVar10;

                            do {

                              puVar15 = (undefined1 *)0x0;

                              if (0 < iVar4) {

                                puVar13 = (undefined1 *)((int)(puVar18 + iVar14) + (int)puVar17);

                                local_60 = puVar13;

                                local_64 = puVar17;

                                local_38 = psVar20;

                                do {

                                  psVar11 = (short *)0x0;

                                  if (0 < iVar5) {

                                    if (iVar5 < 5) {

                                      puVar19 = (undefined1 *)

                                                ((int)psVar10 * 0x10 + iVar22 + (int)psVar20 * 2);

                                    }

                                    else {

                                      iVar21 = (int)psVar10 * 0x10 + iVar22;

                                      puVar19 = (undefined1 *)(iVar21 + (int)psVar20 * 2);

                                      psVar1 = (short *)(puVar15 + (int)puVar13);

                                      local_3c = (short *)0x0;

                                      local_40 = psVar1;

                                      local_58 = puVar19;

                                      do {

                                        *(undefined1 *)((int)psVar1 + (int)local_3c) =

                                             *(undefined1 *)(iVar21 + (int)psVar20 * 2);

                                        ((undefined1 *)((int)psVar1 + 1))[(int)local_3c] =

                                             *(undefined1 *)(iVar21 + (int)psVar20 * 2);

                                        *(undefined1 *)((int)(psVar1 + 1) + (int)local_3c) =

                                             *(undefined1 *)(iVar21 + (int)psVar20 * 2);

                                        ((undefined1 *)((int)psVar1 + 3))[(int)local_3c] =

                                             *(undefined1 *)(iVar21 + (int)psVar20 * 2);

                                        psVar11 = local_3c + 2;

                                        local_3c = psVar11;

                                      } while ((int)psVar11 <= iVar5 + -5);

                                    }

                                    local_5c = puVar15;

                                    do {

                                      (puVar15 + (int)puVar13)[(int)psVar11] = *puVar19;

                                      psVar11 = (short *)((int)psVar11 + 1);

                                    } while ((int)psVar11 < iVar5);

                                  }

                                  puVar15 = puVar15 + 0x20;

                                } while ((int)puVar15 < iVar4);

                              }

                              puVar17 = puVar17 + iVar5;

                              psVar20 = (short *)((int)psVar20 + 1);

                              local_18 = (short *)(puVar18 + iVar14);

                            } while ((int)psVar20 < param_6);

                          }

                          iVar14 = iVar14 + iVar4;

                          psVar10 = (short *)((int)psVar10 + 1);

                        } while ((int)psVar10 < param_6);

                      }

                      puVar18 = puVar18 + iVar5 * param_6;

                      iVar22 = iVar22 + 0x80;

                      puVar7 = puVar7 + 1;

                    } while ((int)puVar7 < (int)psVar12);

                    local_4c = iVar22;

                    local_34 = psVar12;

                  }

                  iVar16 = iVar16 + local_80 * iVar6;

                  iVar9 = iVar9 + 1;

                } while (iVar9 < (int)puVar8);

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

              }

            }

          }

          else {

            iVar9 = 0;

            if (0 < (int)puVar8) {

              iVar4 = iVar6 * param_6;

              iVar5 = iVar5 * param_6;

              psVar10 = (short *)0x0;

              local_50 = iVar5;

              local_54 = iVar4;

              do {

                psVar11 = (short *)((int)local_594 + (int)psVar10);

                psVar20 = (short *)0x0;

                if (0 < (int)psVar12) {

                  local_38 = psVar10;

                  local_2c = local_80 * iVar6;

                  local_28 = iVar9;

                  local_30 = puVar8;

                  iVar16 = local_4c;

                  do {

                    iVar22 = 0;

                    if (0 < iVar4) {

                      local_1c = (undefined1 *)0x0;

                      puVar18 = (undefined1 *)0x0;

                      local_40 = psVar20;

                      local_3c = psVar11;

                      puVar7 = (undefined1 *)0x0;

                      do {

                        iVar14 = 0;

                        if (0 < iVar5) {

                          if (iVar5 < 6) {

                            local_5c = (undefined1 *)((int)psVar11 + (int)puVar7);

                            local_20 = puVar18 + iVar16;

                          }

                          else {

                            puVar17 = (undefined1 *)((int)psVar11 + (int)puVar7);

                            local_5c = puVar17;

                            puVar15 = puVar18 + iVar16;

                            local_20 = puVar15;

                            local_58 = puVar18;

                            do {

                              puVar17[iVar14] = puVar15[iVar14 * 2];

                              puVar17[iVar14 + 1] = puVar15[iVar14 * 2 + 2];

                              puVar17[iVar14 + 2] = puVar15[iVar14 * 2 + 4];

                              puVar17[iVar14 + 3] = puVar15[iVar14 * 2 + 6];

                              puVar17[iVar14 + 4] = puVar15[iVar14 * 2 + 8];

                              iVar14 = iVar14 + 5;

                            } while (iVar14 <= iVar5 + -6);

                          }

                          local_1c = puVar7;

                          local_24 = iVar22;

                          do {

                            local_5c[iVar14] = local_20[iVar14 * 2];

                            iVar14 = iVar14 + 1;

                          } while (iVar14 < iVar5);

                        }

                        puVar7 = puVar7 + 0x20;

                        puVar18 = puVar18 + 0x10;

                        iVar22 = iVar22 + 1;

                      } while (iVar22 < iVar4);

                    }

                    psVar11 = (short *)((int)psVar11 + iVar5);

                    iVar16 = iVar16 + 0x80;

                    psVar20 = (short *)((int)psVar20 + 1);

                  } while ((int)psVar20 < (int)psVar12);

                  local_4c = iVar16;

                  local_34 = psVar12;

                }

                psVar10 = (short *)((int)psVar10 + local_80 * iVar6);

                iVar9 = iVar9 + 1;

              } while (iVar9 < (int)puVar8);

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

              local_18 = (short *)(iVar5 + -6);

            }

          }

          psVar12 = local_594;

          if ((iVar4 == 3) && (local_7c != (undefined1 *)0x0)) {

            if (local_7c == (undefined1 *)0x2) {

              local_78 = local_78 + 1;

            }

            if (local_90 < local_88) {

              psVar10 = (short *)(local_90 << 5);

              iVar4 = local_90;

              do {

                if (local_94 < local_8c) {

                  local_18 = psVar10;

                  local_34 = psVar12;

                  iVar5 = local_94;

                  do {

                    *(undefined1 *)(iVar4 * *(int *)(param_1 + 0x3c) + local_78 + iVar5 * 2) =

                         ((undefined1 *)((int)psVar12 + (int)psVar10))[iVar5];

                    iVar5 = iVar5 + 2;

                  } while (iVar5 < local_8c);

                }

                psVar10 = psVar10 + 0x10;

                iVar4 = iVar4 + 1;

              } while (iVar4 < local_88);

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

            }

          }

          else {

            FUN_00633140(param_1,&local_94,local_7c,local_78,psVar12);

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

          }

          if ((iVar4 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

            local_78 = local_78 + -1;

          }

          else {

            local_78 = local_78 + 1;

          }

        }

        local_84 = local_84 + 0x18;

        local_7c = (undefined1 *)((int)local_7c + 1);

      }

      if (((iVar4 != 0xff) || (*(int *)(param_1 + 0x58) != 0xff)) &&

         (puVar8 = local_7c, iVar4 = local_78, local_34 = psVar12,

         (int)local_7c < *(int *)(param_1 + 0x30))) {

        do {

          FUN_00633140(param_1,&local_94,puVar8,iVar4,psVar12);

          if ((*(int *)(param_1 + 0x34) == 2) && (*(int *)(param_1 + 0x58) == 1)) {

            iVar4 = iVar4 + -1;

          }

          else {

            iVar4 = iVar4 + 1;

          }

          puVar8 = (undefined1 *)((int)puVar8 + 1);

        } while ((int)puVar8 < *(int *)(param_1 + 0x30));

      }

    }

  }

  return;

}





