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

// --- FUN_00631630 at 0x00631630 (size: 3537) ---


void FUN_00631630(int param_1,int param_2,undefined4 param_3,int param_4,undefined4 param_5,

                 int param_6,char param_7)



{

  undefined1 *puVar1;

  undefined1 *puVar2;

  short sVar3;

  int iVar4;

  undefined1 *puVar5;

  int iVar6;

  int iVar7;

  undefined1 *puVar8;

  undefined1 *puVar9;

  short *psVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  short *psVar16;

  int iVar17;

  undefined1 *puVar18;

  undefined1 *puVar19;

  undefined1 *puVar20;

  int iVar21;

  undefined1 local_58c [1280];

  int local_8c;

  int local_88;

  int local_84;

  int local_80;

  undefined1 *local_7c;

  undefined1 *local_78;

  int local_74;

  int local_70;

  int local_6c;

  int local_68;

  undefined1 *local_64;

  int local_60;

  undefined1 *local_5c;

  int local_58;

  int local_54;

  int local_50;

  undefined1 *local_4c;

  undefined1 *local_48;

  undefined1 *local_44;

  int local_40;

  short *local_3c;

  undefined1 *local_38;

  int local_34;

  int local_30;

  undefined1 *local_2c;

  undefined1 *local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  

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

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

    if (iVar4 == 2) {

      iVar14 = *(int *)(param_1 + 0x37bc);

      if (iVar14 == 1) {

        local_74 = 0;

        iVar12 = *(int *)(param_1 + 0x37c0) + -1;

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

          local_74 = 0;

          iVar6 = iVar12 * 0x10;

          local_7c = (undefined1 *)0x0;

          do {

            iVar12 = iVar12 + -1;

            local_74 = local_74 +

                       *(int *)(iVar6 + 4 + *(int *)(param_1 + 0x37cc)) *

                       *(int *)(iVar6 + 8 + *(int *)(param_1 + 0x37cc));

            iVar6 = iVar6 + -0x10;

          } while (iVar12 != -1);

          local_78 = (undefined1 *)0x2;

        }

        local_18 = local_74 * 0x40;

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

        local_6c = param_4 * 2 * local_18 + *(int *)(local_1c + 4);

        local_74 = local_74 * 0x100 + local_6c;

        goto LAB_00631677;

      }

    }

    else {

      iVar14 = *(int *)(param_1 + 0x37bc);

    }

  }

  else {

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

    iVar14 = *(int *)(param_1 + 0x37bc);

  }

  local_6c = 0;

  local_74 = 0;

LAB_00631677:

  puVar8 = (undefined1 *)0x0;

  local_70 = *(int *)(param_1 + 0x4834);

  iVar4 = FUN_0062f6a0(param_1 + 4,iVar4 * param_6,iVar14 * 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_8c);

  if (iVar4 == 0) {

    local_24 = *(int *)(param_2 + 0x2c);

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

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

      if (*(int *)(param_2 + 0x38) == 0) {

        local_24 = local_24 + 2;

      }

      else if (*(int *)(param_2 + 0x38) == 1) {

        local_24 = local_24 + 1;

      }

    }

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

    local_1c = 0;

    local_20 = param_6 << 5;

    while( true ) {

      if (iVar4 == 3) {

        iVar12 = 3;

      }

      else {

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

      }

      iVar6 = iVar14;

      if (iVar12 <= iVar14) {

        if (iVar4 == 3) {

          iVar6 = 3;

        }

        else {

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

        }

      }

      if (iVar6 <= local_1c) break;

      if ((*(int *)(param_1 + 0x58) != 4) || (local_1c < 1)) {

        local_48 = *(undefined1 **)(param_1 + 0x37b8);

        iVar11 = local_1c * 0x10;

        local_40 = iVar11;

        iVar12 = iVar11 + *(int *)(param_1 + 0x37cc);

        puVar8 = *(undefined1 **)(iVar12 + 4);

        local_60 = iVar12;

        local_5c = puVar8;

        puVar5 = (undefined1 *)((int)local_48 / (int)puVar8);

        local_44 = *(undefined1 **)(param_1 + 0x37bc);

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

        iVar6 = (int)local_44 / iVar14;

        if (param_7 == '\0') {

          if ((((*(int *)(param_1 + 0x4de8) == 1) && (local_48 == (undefined1 *)0x2)) &&

              (local_44 == (undefined1 *)0x1)) && (param_6 != 1)) {

            local_4c = local_58c;

            local_48 = (undefined1 *)0x0;

            if (0 < (int)puVar8) {

              local_54 = param_6 + -1;

              local_58 = param_6 + -6;

              local_50 = (int)puVar5 * param_6;

              local_44 = (undefined1 *)(param_6 * 8);

              puVar18 = (undefined1 *)0x0;

              local_7c = puVar5;

              do {

                iVar4 = 0;

                if (0 < (int)local_44) {

                  local_18 = local_6c + param_6 * 2;

                  iVar14 = 0;

                  local_28 = (undefined1 *)(local_70 + param_6 * 2);

                  local_48 = puVar18;

                  do {

                    puVar8 = (undefined1 *)(iVar4 << 2);

                    if (local_7c == (undefined1 *)0x2) {

                      local_5c = puVar8;

                      puVar18 = (undefined1 *)(iVar4 * 2);

                      local_2c = puVar18;

                      psVar16 = (short *)(local_70 + iVar4 * 2);

                      local_3c = psVar16;

                      sVar3 = *psVar16;

                      puVar5 = local_4c + iVar4 * 4;

                      local_38 = puVar5;

                      *puVar5 = (char)(*(short *)(local_18 + -2 + iVar4 * 2) + 1 + sVar3 * 3 >> 2);

                      puVar5[1] = (char)(psVar16[1] + 2 + sVar3 * 3 >> 2);

                      if (1 < local_54) {

                        psVar10 = psVar16 + 1;

                        local_30 = iVar14;

                        local_34 = iVar4;

                        do {

                          puVar8 = puVar8 + 2;

                          sVar3 = *psVar10;

                          puVar5 = local_4c + (int)puVar8;

                          *puVar5 = (char)(psVar10[-1] + 1 + sVar3 * 3 >> 2);

                          puVar5[1] = (char)(psVar10[1] + 2 + sVar3 * 3 >> 2);

                          psVar10 = psVar10 + 1;

                        } while ((int)psVar10 < (int)(psVar16 + param_6 + -1));

                        local_38 = puVar5;

                      }

                      puVar8 = local_38;

                      sVar3 = *(short *)(local_28 + -2 + (int)puVar18);

                      local_38[2] = (char)(*(short *)(local_28 + -4 + (int)puVar18) + 1 + sVar3 * 3

                                          >> 2);

                      puVar8[3] = (char)(*(short *)(puVar18 + local_74) + 2 + sVar3 * 3 >> 2);

                    }

                    else {

                      iVar12 = 0;

                      if (0 < param_6) {

                        if (param_6 < 6) {

                          puVar8 = local_4c + iVar4 * 4;

                        }

                        else {

                          puVar8 = local_4c + iVar4 * 4;

                          iVar6 = local_70 + iVar14;

                          local_30 = iVar14;

                          do {

                            puVar8[iVar12] = *(undefined1 *)(iVar6 + iVar12 * 2);

                            puVar8[iVar12 + 1] = *(undefined1 *)(iVar6 + 2 + iVar12 * 2);

                            puVar8[iVar12 + 2] = *(undefined1 *)(iVar6 + 4 + iVar12 * 2);

                            puVar8[iVar12 + 3] = *(undefined1 *)(iVar6 + 6 + iVar12 * 2);

                            puVar8[iVar12 + 4] = *(undefined1 *)(iVar6 + 8 + iVar12 * 2);

                            iVar12 = iVar12 + 5;

                          } while (iVar12 <= local_58);

                        }

                        local_34 = iVar4;

                        do {

                          puVar8[iVar12] = *(undefined1 *)(local_70 + iVar14 + iVar12 * 2);

                          iVar12 = iVar12 + 1;

                        } while (iVar12 < param_6);

                      }

                    }

                    iVar14 = iVar14 + 0x10;

                    iVar4 = iVar4 + 8;

                  } while (iVar4 < (int)local_44);

                  puVar8 = *(undefined1 **)(local_40 + 4 + *(int *)(param_1 + 0x37cc));

                  puVar18 = local_48;

                }

                local_70 = local_70 + 0x80;

                local_74 = local_74 + 0x80;

                local_6c = local_6c + 0x80;

                puVar18 = puVar18 + 1;

                local_4c = local_4c + local_50;

              } while ((int)puVar18 < (int)puVar8);

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

            }

          }

          else {

            local_50 = 0;

            if (0 < iVar14) {

              iVar7 = iVar6 * 0x20;

              local_4c = (undefined1 *)((int)puVar5 * param_6);

              local_48 = puVar5 + -5;

              puVar18 = (undefined1 *)0x0;

              local_44 = (undefined1 *)0x0;

              iVar4 = 0;

              local_68 = iVar7;

              local_18 = local_20 * iVar6;

              do {

                puVar19 = local_58c + (int)puVar18;

                iVar15 = 0;

                if (0 < (int)puVar8) {

                  local_44 = puVar18;

                  local_50 = iVar4;

                  local_60 = iVar12;

                  iVar14 = local_70;

                  do {

                    iVar12 = 0;

                    if (0 < param_6) {

                      puVar8 = (undefined1 *)0x0;

                      local_30 = iVar15;

                      local_2c = puVar19;

                      do {

                        iVar13 = 0;

                        if (0 < param_6) {

                          local_28 = puVar19 + (int)puVar8;

                          psVar16 = (short *)0x0;

                          local_38 = puVar8;

                          local_34 = iVar12;

                          do {

                            puVar9 = (undefined1 *)0x0;

                            if (0 < iVar7) {

                              puVar1 = puVar19 + (int)puVar8 + (int)psVar16;

                              local_3c = psVar16;

                              local_54 = iVar13;

                              do {

                                iVar17 = 0;

                                if (0 < (int)puVar5) {

                                  if ((int)puVar5 < 5) {

                                    puVar20 = (undefined1 *)(iVar12 * 0x10 + iVar14 + iVar13 * 2);

                                  }

                                  else {

                                    iVar21 = iVar12 * 0x10 + iVar14;

                                    puVar20 = (undefined1 *)(iVar21 + iVar13 * 2);

                                    puVar2 = puVar9 + (int)puVar1;

                                    local_58 = 0;

                                    local_5c = puVar2;

                                    do {

                                      puVar2[local_58] = *(undefined1 *)(iVar21 + iVar13 * 2);

                                      puVar2[local_58 + 1] = *(undefined1 *)(iVar21 + iVar13 * 2);

                                      puVar2[local_58 + 2] = *(undefined1 *)(iVar21 + iVar13 * 2);

                                      puVar2[local_58 + 3] = *(undefined1 *)(iVar21 + iVar13 * 2);

                                      iVar17 = local_58 + 4;

                                      local_58 = iVar17;

                                    } while (iVar17 <= (int)(puVar5 + -5));

                                  }

                                  local_64 = puVar9;

                                  do {

                                    (puVar9 + (int)puVar1)[iVar17] = *puVar20;

                                    iVar17 = iVar17 + 1;

                                  } while (iVar17 < (int)puVar5);

                                }

                                puVar9 = puVar9 + 0x20;

                                local_78 = puVar1;

                              } while ((int)puVar9 < iVar7);

                            }

                            psVar16 = (short *)((int)psVar16 + (int)puVar5);

                            iVar13 = iVar13 + 1;

                          } while (iVar13 < param_6);

                        }

                        puVar8 = puVar8 + iVar7;

                        iVar12 = iVar12 + 1;

                      } while (iVar12 < param_6);

                      local_60 = *(int *)(param_1 + 0x37cc) + iVar11;

                      puVar8 = *(undefined1 **)(local_60 + 4);

                    }

                    puVar19 = puVar19 + (int)puVar5 * param_6;

                    iVar14 = iVar14 + 0x80;

                    iVar15 = iVar15 + 1;

                  } while (iVar15 < (int)puVar8);

                  local_70 = iVar14;

                  iVar14 = *(int *)(local_60 + 8);

                  iVar12 = local_60;

                }

                puVar18 = puVar18 + local_20 * iVar6;

                iVar4 = iVar4 + 1;

              } while (iVar4 < iVar14);

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

              local_7c = puVar5;

            }

          }

        }

        else {

          local_50 = 0;

          if (0 < iVar14) {

            iVar7 = iVar6 * param_6;

            puVar5 = (undefined1 *)((int)puVar5 * param_6);

            local_44 = puVar5 + -6;

            iVar4 = 0;

            puVar18 = (undefined1 *)0x0;

            local_4c = (undefined1 *)0x0;

            local_68 = iVar7;

            do {

              iVar15 = 0;

              if (0 < (int)puVar8) {

                local_4c = puVar18;

                local_50 = iVar4;

                iVar14 = local_70;

                local_48 = local_58c + (int)puVar18;

                do {

                  iVar13 = 0;

                  if (0 < iVar7) {

                    puVar8 = (undefined1 *)0x0;

                    iVar12 = 0;

                    local_54 = iVar15;

                    do {

                      iVar17 = 0;

                      if (0 < (int)puVar5) {

                        if ((int)puVar5 < 6) {

                          local_64 = local_48 + (int)puVar8;

                        }

                        else {

                          puVar19 = local_48 + (int)puVar8;

                          local_64 = puVar19;

                          iVar21 = iVar14 + iVar12;

                          local_60 = iVar12;

                          do {

                            puVar19[iVar17] = *(undefined1 *)(iVar21 + iVar17 * 2);

                            puVar19[iVar17 + 1] = *(undefined1 *)(iVar21 + 2 + iVar17 * 2);

                            puVar19[iVar17 + 2] = *(undefined1 *)(iVar21 + 4 + iVar17 * 2);

                            puVar19[iVar17 + 3] = *(undefined1 *)(iVar21 + 6 + iVar17 * 2);

                            puVar19[iVar17 + 4] = *(undefined1 *)(iVar21 + 8 + iVar17 * 2);

                            iVar17 = iVar17 + 5;

                          } while (iVar17 <= (int)(puVar5 + -6));

                        }

                        local_5c = puVar8;

                        local_58 = iVar13;

                        do {

                          local_64[iVar17] = *(undefined1 *)(iVar14 + iVar12 + iVar17 * 2);

                          iVar17 = iVar17 + 1;

                        } while (iVar17 < (int)puVar5);

                      }

                      puVar8 = puVar8 + 0x20;

                      iVar12 = iVar12 + 0x10;

                      iVar13 = iVar13 + 1;

                    } while (iVar13 < iVar7);

                    iVar12 = *(int *)(param_1 + 0x37cc) + iVar11;

                    puVar8 = *(undefined1 **)(iVar12 + 4);

                  }

                  local_48 = local_48 + (int)puVar5;

                  iVar14 = iVar14 + 0x80;

                  iVar15 = iVar15 + 1;

                } while (iVar15 < (int)puVar8);

                local_70 = iVar14;

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

              }

              puVar18 = puVar18 + local_20 * iVar6;

              iVar4 = iVar4 + 1;

            } while (iVar4 < iVar14);

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

            local_7c = puVar5;

            local_78 = (undefined1 *)(local_20 * iVar6);

          }

        }

        puVar8 = local_58c;

        if ((iVar4 == 3) && (local_1c != 0)) {

          if (local_1c == 2) {

            local_24 = local_24 + 1;

          }

          if (local_88 < local_80) {

            puVar5 = (undefined1 *)(local_88 << 5);

            iVar4 = local_88;

            do {

              if (local_8c < local_84) {

                local_78 = puVar5;

                local_7c = puVar8;

                iVar14 = local_8c;

                do {

                  *(undefined1 *)(iVar4 * *(int *)(param_1 + 0x3c) + local_24 + iVar14 * 2) =

                       (puVar8 + (int)puVar5)[iVar14];

                  iVar14 = iVar14 + 2;

                } while (iVar14 < local_84);

              }

              puVar5 = puVar5 + 0x20;

              iVar4 = iVar4 + 1;

            } while (iVar4 < local_80);

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

          }

        }

        else {

          FUN_00633140(param_1,&local_8c,local_1c,local_24,puVar8);

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

        }

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

          local_24 = local_24 + -1;

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

        }

        else {

          local_24 = local_24 + 1;

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

        }

      }

      local_1c = local_1c + 1;

    }

    iVar14 = local_1c;

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

       (iVar14 = *(int *)(param_1 + 0x54), iVar14 + -1 != *(int *)(param_2 + 0x38))) {

      iVar14 = *(int *)(param_1 + 0x30);

    }

    if (((iVar4 != 0xff) || (*(int *)(param_1 + 0x58) != 0xff)) &&

       (iVar4 = local_24, iVar14 < *(int *)(param_1 + 0x30))) {

      do {

        FUN_00633140(param_1,&local_8c,iVar14,iVar4,puVar8);

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

          iVar4 = iVar4 + -1;

        }

        else {

          iVar4 = iVar4 + 1;

        }

        iVar14 = iVar14 + 1;

      } while (iVar14 < *(int *)(param_1 + 0x30));

    }

  }

  return;

}





// --- FUN_00632470 at 0x00632470 (size: 801) ---


void FUN_00632470(int param_1,int param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int local_44;

  int local_40;

  int local_3c;

  int local_38;

  int local_24;

  int local_1c;

  int local_18;

  

  iVar7 = *(int *)(param_1 + 0x4834);

  iVar2 = FUN_0062f6a0(param_1 + 4,param_5,param_5,param_3,param_4,*(undefined4 *)(param_1 + 0x30),

                       *(undefined4 *)(param_1 + 0x3c),*(undefined4 *)(param_1 + 0x20),

                       *(undefined4 *)(param_1 + 0x24),*(undefined4 *)(param_1 + 0x28),

                       param_2 + 0x2c,&local_44);

  if (iVar2 == 0) {

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

    if ((iVar2 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

      local_1c = *(int *)(param_2 + 0x2c) + 2;

    }

    else {

      local_1c = *(int *)(param_2 + 0x2c);

    }

    iVar6 = 0;

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

    local_24 = iVar7;

    if (0 < local_18) {

      do {

        if (iVar6 < *(int *)(param_1 + 0x37c0)) {

          iVar3 = iVar6 * 0x10;

          iVar7 = *(int *)(param_1 + 0x37cc) + iVar3;

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

          if (0 < iVar8) {

            iVar5 = *(int *)(iVar3 + 4 + *(int *)(param_1 + 0x37cc));

            iVar2 = 0;

            do {

              iVar4 = 0;

              if (0 < iVar5) {

                do {

                  if (local_40 < local_38) {

                    iVar8 = local_40 << 4;

                    iVar7 = local_40;

                    do {

                      if (local_44 < local_3c) {

                        iVar5 = local_44;

                        while( true ) {

                          iVar1 = iVar5 * 2;

                          local_18 = local_18 * iVar5;

                          iVar5 = iVar5 + 1;

                          *(undefined1 *)(local_18 + iVar7 * *(int *)(param_1 + 0x3c) + local_1c) =

                               *(undefined1 *)(local_24 + iVar8 + iVar1);

                          if (local_3c <= iVar5) break;

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

                        }

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

                      }

                      iVar8 = iVar8 + 0x10;

                      iVar7 = iVar7 + 1;

                    } while (iVar7 < local_38);

                    iVar7 = *(int *)(param_1 + 0x37cc) + iVar3;

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

                  }

                  local_24 = local_24 + 0x80;

                  iVar4 = iVar4 + 1;

                } while (iVar4 < iVar5);

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

              }

              iVar2 = iVar2 + 1;

            } while (iVar2 < iVar8);

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

          }

        }

        else if ((iVar6 == 3) && (iVar2 == 5)) {

          iVar7 = local_40;

          if (local_40 < local_38) {

            do {

              iVar2 = local_44;

              if (local_44 < local_3c) {

                while( true ) {

                  local_18 = local_18 * iVar2;

                  iVar2 = iVar2 + 1;

                  *(undefined1 *)(local_18 + iVar7 * *(int *)(param_1 + 0x3c) + local_1c) = 0xff;

                  if (local_3c <= iVar2) break;

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

                }

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

              }

              iVar7 = iVar7 + 1;

            } while (iVar7 < local_38);

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

          }

          local_24 = local_24 + 0x80;

        }

        while( true ) {

          if ((iVar2 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

            local_1c = local_1c + -1;

          }

          else {

            local_1c = local_1c + 1;

          }

          iVar6 = iVar6 + 1;

          if (local_18 <= iVar6) {

            return;

          }

          if ((iVar6 < 1) || (*(int *)(param_1 + 0x58) != 4)) break;

          iVar7 = local_40;

          if (local_40 < local_38) {

            do {

              iVar2 = local_44;

              if (local_44 < local_3c) {

                while( true ) {

                  local_18 = local_18 * iVar2;

                  if (iVar6 < 3) {

                    iVar8 = iVar7 * *(int *)(param_1 + 0x3c) + local_1c;

                    *(undefined1 *)(local_18 + iVar8) = *(undefined1 *)(local_18 + -1 + iVar8);

                  }

                  else {

                    *(undefined1 *)(local_18 + iVar7 * *(int *)(param_1 + 0x3c) + local_1c) = 0xff;

                  }

                  if (local_3c <= iVar2 + 1) break;

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

                  iVar2 = iVar2 + 1;

                }

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

              }

              iVar7 = iVar7 + 1;

            } while (iVar7 < local_38);

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

          }

        }

      } while( true );

    }

  }

  return;

}





// --- FUN_006327e0 at 0x006327E0 (size: 930) ---


void FUN_006327e0(int param_1,int param_2,undefined4 param_3,undefined4 param_4,int param_5)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  uint uVar9;

  int local_3c;

  int local_38;

  int local_34;

  int local_30;

  int local_1c;

  int local_18;

  

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

  if (((iVar1 != 1) && (iVar1 != 2)) && (iVar1 != 5)) {

    return;

  }

  iVar1 = FUN_0062f6a0(param_1 + 4,*(int *)(param_1 + 0x37b8) * param_5,

                       param_5 * *(int *)(param_1 + 0x37bc),param_3,param_4,

                       *(undefined4 *)(param_1 + 0x30),*(undefined4 *)(param_1 + 0x3c),

                       *(undefined4 *)(param_1 + 0x20),*(undefined4 *)(param_1 + 0x24),

                       *(undefined4 *)(param_1 + 0x28),param_2 + 0x2c,&local_3c);

  if (iVar1 == 0) {

    iVar1 = *(int *)(param_2 + 0x2c);

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

    if (local_18 == 3) {

      for (; local_38 < local_30; local_38 = local_38 + 1) {

        iVar4 = local_3c * 3;

        if (iVar4 < local_34 * 3) {

          do {

            iVar7 = local_38 * *(int *)(param_1 + 0x3c) + iVar1;

            uVar8 = (uint)*(byte *)(iVar7 + iVar4);

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

            uVar9 = (uint)*(byte *)(iVar7 + 2 + iVar4);

            iVar2 = ((int)(uVar9 * 0x167 + -0xb2f5) >> 8) + uVar8;

            if (iVar2 < 0x100) {

              if (iVar2 < 0) {

                iVar2 = 0;

              }

            }

            else {

              iVar2 = 0xff;

            }

            iVar3 = ((int)(uVar5 * -0x58 + 0x87f6 + uVar9 * -0xb7) >> 8) + uVar8;

            if (iVar3 < 0x100) {

              if (iVar3 < 0) {

                iVar3 = 0;

              }

            }

            else {

              iVar3 = 0xff;

            }

            iVar6 = uVar8 + ((int)(uVar5 * 0x1c6 + -0xe251) >> 8);

            if (iVar6 < 0x100) {

              if (iVar6 < 0) {

                iVar6 = 0;

              }

            }

            else {

              iVar6 = 0xff;

            }

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

              *(char *)(iVar7 + iVar4) = (char)iVar6;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar2;

            }

            else {

              *(char *)(iVar7 + iVar4) = (char)iVar2;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar6;

            }

            iVar4 = iVar4 + 3;

          } while (iVar4 < local_34 * 3);

        }

      }

    }

    else if (local_38 < local_30) {

      local_1c = local_34 * local_18;

      do {

        iVar4 = local_18 * local_3c;

        if (iVar4 < local_1c) {

          do {

            iVar7 = local_38 * *(int *)(param_1 + 0x3c) + iVar1;

            uVar5 = (uint)*(byte *)(iVar7 + iVar4);

            uVar8 = (uint)*(byte *)(iVar7 + 1 + iVar4);

            uVar9 = (uint)*(byte *)(iVar7 + 2 + iVar4);

            iVar2 = ((int)(uVar9 * 0x167 + -0xb2f5) >> 8) + uVar5;

            if (iVar2 < 0x100) {

              if (iVar2 < 0) {

                iVar2 = 0;

              }

            }

            else {

              iVar2 = 0xff;

            }

            iVar3 = ((int)(uVar8 * -0x58 + 0x87f6 + uVar9 * -0xb7) >> 8) + uVar5;

            if (iVar3 < 0x100) {

              if (iVar3 < 0) {

                iVar3 = 0;

              }

            }

            else {

              iVar3 = 0xff;

            }

            iVar6 = uVar5 + ((int)(uVar8 * 0x1c6 + -0xe251) >> 8);

            if (iVar6 < 0x100) {

              if (iVar6 < 0) {

                iVar6 = 0;

              }

            }

            else {

              iVar6 = 0xff;

            }

            if (*(int *)(param_1 + 0x58) == 6) {

              *(char *)(iVar7 + iVar4) = -1 - (char)iVar2;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = -1 - (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = -1 - (char)iVar6;

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

              local_1c = local_18 * local_34;

            }

            else if (*(int *)(param_1 + 0x58) == 3) {

              *(char *)(iVar7 + iVar4) = (char)iVar2;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar6;

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

              local_1c = local_18 * local_34;

            }

            iVar4 = iVar4 + local_18;

          } while (iVar4 < local_1c);

        }

        local_38 = local_38 + 1;

      } while (local_38 < local_30);

    }

  }

  return;

}





// --- FUN_00632ba0 at 0x00632BA0 (size: 469) ---


void FUN_00632ba0(int param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5,

                 undefined4 param_6,undefined1 param_7)



{

  int iVar1;

  

  if ((*(int *)(param_1 + 0x74) != 0) && (*(int *)(param_1 + 0x4de0) == 0)) {

    FUN_0062fb50(param_1,param_2,param_3,param_4,param_5,param_6,0,param_7);

    return;

  }

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

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

    FUN_0062faa0(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

    return;

  }

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

    FUN_00632470(param_1,param_2,param_4,param_5,param_6);

    FUN_006327e0(param_1,param_2,param_4,param_5,param_6);

    return;

  }

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

    if (*(int *)(param_1 + 0x34) != 3) {

      FUN_00632470(param_1,param_2,param_4,param_5,param_6);

      return;

    }

    FUN_0062faa0(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

    return;

  }

  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);

    return;

  }

  FUN_00631630(param_1,param_2,param_3,param_4,param_5,param_6,param_7);

  return;

}





// --- FUN_00632d80 at 0x00632D80 (size: 880) ---


void FUN_00632d80(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  uint uVar10;

  int iVar11;

  int local_18;

  

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

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

  if (((iVar2 != 2) && (iVar2 != 1)) && (iVar2 != 5)) {

    return;

  }

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

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

    if (iVar2 == 0) {

      uVar3 = (int)*(uint *)(param_1 + 0x28) >> 0x1f;

      iVar2 = (*(uint *)(param_1 + 0x28) ^ uVar3) - uVar3;

    }

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

    iVar4 = (*(int *)(param_1 + 0xc) - *(int *)(param_1 + 4)) * local_18;

    if (iVar4 == 0) {

      iVar4 = *(int *)(param_1 + 0x24) * local_18;

    }

    if (local_18 == 3) {

      iVar11 = iVar2 + -1;

      if (iVar2 != 0) {

        do {

          iVar2 = 0;

          if (0 < iVar4) {

            do {

              iVar7 = iVar11 * *(int *)(param_1 + 0x3c) + iVar1;

              uVar3 = (uint)*(byte *)(iVar7 + iVar2);

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

              uVar10 = (uint)*(byte *)(iVar7 + 2 + iVar2);

              iVar8 = ((int)(uVar10 * 0x167 + -0xb2f5) >> 8) + uVar3;

              if (iVar8 < 0x100) {

                if (iVar8 < 0) {

                  iVar8 = 0;

                }

              }

              else {

                iVar8 = 0xff;

              }

              iVar9 = ((int)(uVar5 * -0x58 + 0x87f6 + uVar10 * -0xb7) >> 8) + uVar3;

              if (iVar9 < 0x100) {

                if (iVar9 < 0) {

                  iVar9 = 0;

                }

              }

              else {

                iVar9 = 0xff;

              }

              iVar6 = uVar3 + ((int)(uVar5 * 0x1c6 + -0xe251) >> 8);

              if (iVar6 < 0x100) {

                if (iVar6 < 0) {

                  iVar6 = 0;

                }

              }

              else {

                iVar6 = 0xff;

              }

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

                *(char *)(iVar7 + iVar2) = (char)iVar6;

                *(char *)(iVar2 + 1 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = (char)iVar9;

                *(char *)(iVar2 + 2 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = (char)iVar8;

              }

              else {

                *(char *)(iVar7 + iVar2) = (char)iVar8;

                *(char *)(iVar2 + 1 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = (char)iVar9;

                *(char *)(iVar2 + 2 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = (char)iVar6;

              }

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

            } while (iVar2 < iVar4);

          }

          iVar11 = iVar11 + -1;

        } while (iVar11 != -1);

      }

    }

    else {

      iVar11 = iVar2 + -1;

      if (iVar2 != 0) {

        do {

          iVar2 = 0;

          if (0 < iVar4) {

            do {

              iVar7 = iVar11 * *(int *)(param_1 + 0x3c) + iVar1;

              uVar5 = (uint)*(byte *)(iVar7 + iVar2);

              uVar3 = (uint)*(byte *)(iVar7 + 1 + iVar2);

              uVar10 = (uint)*(byte *)(iVar7 + 2 + iVar2);

              iVar8 = ((int)(uVar10 * 0x167 + -0xb2f5) >> 8) + uVar5;

              if (iVar8 < 0x100) {

                if (iVar8 < 0) {

                  iVar8 = 0;

                }

              }

              else {

                iVar8 = 0xff;

              }

              iVar9 = ((int)(uVar3 * -0x58 + 0x87f6 + uVar10 * -0xb7) >> 8) + uVar5;

              if (iVar9 < 0x100) {

                if (iVar9 < 0) {

                  iVar9 = 0;

                }

              }

              else {

                iVar9 = 0xff;

              }

              iVar6 = uVar5 + ((int)(uVar3 * 0x1c6 + -0xe251) >> 8);

              if (iVar6 < 0x100) {

                if (iVar6 < 0) {

                  iVar6 = 0;

                }

              }

              else {

                iVar6 = 0xff;

              }

              if (*(int *)(param_1 + 0x58) == 6) {

                *(char *)(iVar7 + iVar2) = -1 - (char)iVar8;

                *(char *)(iVar2 + 1 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = -1 - (char)iVar9;

                *(char *)(iVar2 + 2 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = -1 - (char)iVar6;

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

              }

              else if (*(int *)(param_1 + 0x58) == 3) {

                *(char *)(iVar7 + iVar2) = (char)iVar8;

                *(char *)(iVar2 + 1 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = (char)iVar9;

                *(char *)(iVar2 + 2 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = (char)iVar6;

                *(undefined1 *)(iVar2 + 3 + *(int *)(param_1 + 0x3c) * iVar11 + iVar1) = 0xff;

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

              }

              iVar2 = iVar2 + local_18;

            } while (iVar2 < iVar4);

          }

          iVar11 = iVar11 + -1;

        } while (iVar11 != -1);

      }

    }

  }

  return;

}





// --- FUN_00633140 at 0x00633140 (size: 769) ---


void FUN_00633140(int param_1,int *param_2,int param_3,int param_4,int param_5)



{

  undefined1 *puVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  

  if ((*(int *)(param_1 + 0x30) <= param_3) && (*(int *)(param_1 + 0x34) != 3)) {

    return;

  }

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

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

    iVar5 = param_2[1];

    iVar7 = param_2[3];

    if (iVar5 < iVar7) {

      iVar3 = param_2[2];

      iVar2 = iVar5 << 5;

      do {

        iVar4 = *param_2;

        if (iVar4 < iVar3) {

          iVar7 = param_5 + iVar2;

          do {

            *(undefined1 *)(*(int *)(param_1 + 0x3c) * iVar5 + param_4 + iVar4 * 4) =

                 *(undefined1 *)(iVar7 + iVar4);

            *(undefined1 *)(*(int *)(param_1 + 0x3c) * iVar5 + param_4 + 1 + iVar4 * 4) =

                 *(undefined1 *)(iVar7 + iVar4);

            *(undefined1 *)(*(int *)(param_1 + 0x3c) * iVar5 + param_4 + 2 + iVar4 * 4) =

                 *(undefined1 *)(iVar7 + iVar4);

            *(undefined1 *)(*(int *)(param_1 + 0x3c) * iVar5 + param_4 + 3 + iVar4 * 4) = 0xff;

            iVar4 = iVar4 + 1;

            iVar3 = param_2[2];

          } while (iVar4 < iVar3);

          iVar7 = param_2[3];

        }

        iVar2 = iVar2 + 0x20;

        iVar5 = iVar5 + 1;

      } while (iVar5 < iVar7);

    }

  }

  else if (((iVar5 == 3) || (iVar5 == 1)) && (*(int *)(param_1 + 0x34) == 5)) {

    if (param_3 < 3) {

      iVar5 = param_2[1];

      iVar7 = param_2[3];

      if (iVar5 < iVar7) {

        iVar3 = param_2[2];

        iVar2 = iVar5 << 5;

        do {

          iVar4 = *param_2;

          if (iVar4 < iVar3) {

            do {

              *(undefined1 *)(iVar5 * *(int *)(param_1 + 0x3c) + param_4 + iVar4 * 4) =

                   *(undefined1 *)(param_5 + iVar2 + iVar4);

              iVar4 = iVar4 + 1;

              iVar3 = param_2[2];

            } while (iVar4 < iVar3);

            iVar7 = param_2[3];

          }

          iVar2 = iVar2 + 0x20;

          iVar5 = iVar5 + 1;

        } while (iVar5 < iVar7);

      }

    }

    else {

      iVar5 = param_2[1];

      iVar7 = param_2[3];

      if (iVar5 < iVar7) {

        iVar3 = param_2[2];

        do {

          iVar2 = *param_2;

          if (iVar2 < iVar3) {

            do {

              *(undefined1 *)(iVar5 * *(int *)(param_1 + 0x3c) + param_4 + iVar2 * 4) = 0xff;

              iVar2 = iVar2 + 1;

              iVar3 = param_2[2];

            } while (iVar2 < iVar3);

            iVar7 = param_2[3];

          }

          iVar5 = iVar5 + 1;

        } while (iVar5 < iVar7);

      }

    }

  }

  else if (((iVar5 == 4) && (*(int *)(param_1 + 0x34) == 1)) ||

          ((iVar5 == 4 && (*(int *)(param_1 + 0x34) == 2)))) {

    iVar5 = param_2[1];

    iVar7 = param_2[3];

    if (iVar5 < iVar7) {

      iVar3 = param_2[2];

      iVar2 = iVar5 << 5;

      do {

        iVar4 = *param_2;

        if (iVar4 < iVar3) {

          iVar7 = param_5 + iVar2;

          iVar6 = iVar4 * 3;

          do {

            *(undefined1 *)(iVar6 + *(int *)(param_1 + 0x3c) * iVar5 + param_4) =

                 *(undefined1 *)(iVar7 + iVar4);

            *(undefined1 *)(iVar6 + 1 + *(int *)(param_1 + 0x3c) * iVar5 + param_4) =

                 *(undefined1 *)(iVar7 + iVar4);

            puVar1 = (undefined1 *)(iVar7 + iVar4);

            iVar4 = iVar4 + 1;

            *(undefined1 *)(iVar6 + 2 + *(int *)(param_1 + 0x3c) * iVar5 + param_4) = *puVar1;

            iVar6 = iVar6 + 3;

            iVar3 = param_2[2];

          } while (iVar4 < iVar3);

          iVar7 = param_2[3];

        }

        iVar2 = iVar2 + 0x20;

        iVar5 = iVar5 + 1;

      } while (iVar5 < iVar7);

    }

  }

  else {

    iVar5 = param_2[1];

    iVar7 = param_2[3];

    if (iVar5 < iVar7) {

      iVar3 = param_2[2];

      iVar2 = iVar5 << 5;

      do {

        iVar4 = *param_2;

        if (iVar4 < iVar3) {

          do {

            puVar1 = (undefined1 *)(param_5 + iVar2 + iVar4);

            iVar7 = *(int *)(param_1 + 0x30) * iVar4;

            iVar4 = iVar4 + 1;

            *(undefined1 *)(iVar7 + iVar5 * *(int *)(param_1 + 0x3c) + param_4) = *puVar1;

            iVar3 = param_2[2];

          } while (iVar4 < iVar3);

          iVar7 = param_2[3];

        }

        iVar2 = iVar2 + 0x20;

        iVar5 = iVar5 + 1;

      } while (iVar5 < iVar7);

    }

  }

  return;

}





// --- FUN_00633470 at 0x00633470 (size: 4583) ---


void FUN_00633470(int param_1,int param_2,undefined4 param_3)



{

  short sVar1;

  short sVar2;

  short sVar3;

  short sVar4;

  short sVar5;

  short sVar6;

  int *piVar7;

  byte bVar8;

  undefined1 uVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  undefined1 *puVar13;

  uint uVar14;

  uint uVar15;

  int iVar16;

  int iVar17;

  int iVar18;

  short *psVar19;

  int iVar20;

  undefined1 *puVar21;

  short *psVar22;

  undefined1 *puVar23;

  int iVar24;

  undefined1 local_59c [1280];

  undefined1 local_9c [16];

  int local_8c;

  int local_88;

  int local_84;

  int local_80;

  undefined1 *local_7c;

  uint local_78;

  int local_74;

  uint local_70;

  undefined1 *local_6c;

  int local_68;

  int local_64;

  short *local_60;

  undefined1 *local_5c;

  undefined1 *local_58;

  int local_54;

  int local_50;

  int local_4c;

  int local_48;

  short *local_44;

  int local_40;

  undefined1 *local_3c;

  int local_38;

  int local_34;

  undefined1 *local_30;

  char local_2c;

  short *local_28;

  int local_24;

  short *local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  psVar22 = (short *)0x0;

  local_24 = 0;

  local_64 = 0;

  local_28 = (short *)0x0;

  local_14 = 0;

  local_18 = 0;

  local_1c = 0;

  local_20 = (short *)0x0;

  local_2c = '\0';

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

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

    if (iVar10 == 2) {

      iVar17 = *(int *)(param_1 + 0x37bc);

      if (iVar17 == 1) {

        iVar12 = 0;

        local_2c = '\x01';

        iVar11 = *(int *)(param_1 + 0x37c0) + -1;

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

          iVar20 = iVar11 * 0x10;

          local_8c = 0;

          do {

            iVar11 = iVar11 + -1;

            iVar12 = iVar12 + *(int *)(iVar20 + 4 + *(int *)(param_1 + 0x37cc)) *

                              *(int *)(iVar20 + 8 + *(int *)(param_1 + 0x37cc));

            iVar20 = iVar20 + -0x10;

            local_88 = iVar10;

          } while (iVar11 != -1);

        }

        local_30 = *(undefined1 **)(param_1 + 0x4dec);

        local_24 = param_2 * 2 * iVar12 * 0x40 + *(int *)(local_30 + 4);

        psVar22 = (short *)(iVar12 * 0x100 + local_24);

      }

    }

    else {

      iVar17 = *(int *)(param_1 + 0x37bc);

    }

    if ((iVar10 == 2) && (iVar17 == 2)) {

      iVar11 = *(int *)(param_1 + 0x37c0) + -1;

      local_2c = '\x02';

      iVar12 = 0;

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

        local_30 = *(undefined1 **)(param_1 + 0x37cc);

        iVar20 = iVar11 * 0x10;

        do {

          iVar11 = iVar11 + -1;

          iVar12 = iVar12 + *(int *)(local_30 + iVar20 + 4) * *(int *)(local_30 + iVar20 + 8);

          iVar20 = iVar20 + -0x10;

        } while (iVar11 != -1);

      }

      local_1c = iVar12 * 0x40;

      piVar7 = *(int **)(param_1 + 0x4dec);

      local_18 = *piVar7;

      iVar11 = param_2 * local_1c + local_1c;

      iVar12 = param_2 * local_1c + iVar12 * 0x80;

      local_64 = local_18 + iVar11 * 2;

      local_1c = param_2 * 2 * local_1c;

      local_14 = local_18 + local_1c;

      local_18 = local_18 + iVar12 * 2;

      iVar20 = piVar7[2];

      local_24 = local_1c + piVar7[1];

      psVar22 = (short *)(piVar7[1] + iVar12 * 2);

      local_28 = (short *)(iVar20 + iVar11 * 2);

      local_1c = local_1c + iVar20;

      local_20 = (short *)(iVar20 + iVar12 * 2);

      local_34 = 2;

      local_8c = 0;

      local_88 = iVar10;

    }

  }

  else {

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

    iVar17 = *(int *)(param_1 + 0x37bc);

  }

  puVar13 = (undefined1 *)0x0;

  local_60 = *(short **)(param_1 + 0x4834);

  iVar10 = FUN_0062f6a0(param_1 + 4,iVar10 * 8,iVar17 * 8,param_2,param_3,

                        *(undefined4 *)(param_1 + 0x30),*(undefined4 *)(param_1 + 0x3c),

                        *(undefined4 *)(param_1 + 0x20),*(undefined4 *)(param_1 + 0x24),

                        *(undefined4 *)(param_1 + 0x28),param_1 + 0x3814,local_9c);

  if (iVar10 == 0) {

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

    if ((iVar10 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

      local_48 = *(int *)(param_1 + 0x3814);

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

        local_48 = local_48 + 2;

      }

      else if (*(int *)(param_1 + 0x3820) == 1) {

        local_48 = local_48 + 1;

      }

    }

    else {

      local_48 = *(int *)(param_1 + 0x3814) + *(int *)(param_1 + 0x3820);

    }

    iVar17 = *(int *)(param_1 + 0x30);

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

    local_68 = 0;

    local_44 = psVar22;

    while( true ) {

      iVar12 = iVar17;

      if (iVar11 < iVar17) {

        iVar12 = iVar11;

      }

      if (iVar12 <= local_68) break;

      if ((*(int *)(param_1 + 0x58) != 4) || (local_68 < 1)) {

        local_34 = local_68 * 0x10;

        puVar13 = (undefined1 *)(local_34 + *(int *)(param_1 + 0x37cc));

        iVar10 = *(int *)(puVar13 + 4);

        iVar11 = *(int *)(param_1 + 0x37b8) / iVar10;

        iVar17 = *(int *)(puVar13 + 8);

        iVar12 = *(int *)(param_1 + 0x37bc) / iVar17;

        local_6c = puVar13;

        if (local_2c == '\x01') {

          puVar13 = local_59c;

          iVar17 = 0;

          if (0 < iVar10) {

            do {

              local_3c = puVar13 + 0x100;

              psVar22 = local_44;

              psVar19 = local_60;

              local_88 = iVar11;

              local_38 = iVar17;

              local_30 = puVar13;

              do {

                if (local_88 == 2) {

                  sVar1 = *psVar19;

                  *puVar13 = (char)(*(short *)(local_24 + 0xe) + 1 + sVar1 * 3 >> 2);

                  puVar13[1] = (char)(psVar19[1] + 2 + sVar1 * 3 >> 2);

                  sVar1 = psVar19[1];

                  puVar13[2] = (char)(sVar1 * 3 + 1 + (int)*psVar19 >> 2);

                  puVar13[3] = (char)(sVar1 * 3 + 2 + (int)psVar19[2] >> 2);

                  sVar1 = psVar19[2];

                  puVar13[4] = (char)(sVar1 * 3 + 1 + (int)psVar19[1] >> 2);

                  puVar13[5] = (char)(sVar1 * 3 + 2 + (int)psVar19[3] >> 2);

                  sVar1 = psVar19[3];

                  puVar13[6] = (char)(sVar1 * 3 + 1 + (int)psVar19[2] >> 2);

                  puVar13[7] = (char)(sVar1 * 3 + 2 + (int)psVar19[4] >> 2);

                  sVar1 = psVar19[4];

                  puVar13[8] = (char)(sVar1 * 3 + 1 + (int)psVar19[3] >> 2);

                  puVar13[9] = (char)(sVar1 * 3 + 2 + (int)psVar19[5] >> 2);

                  sVar1 = psVar19[5];

                  puVar13[10] = (char)(sVar1 * 3 + 1 + (int)psVar19[4] >> 2);

                  puVar13[0xb] = (char)(sVar1 * 3 + 2 + (int)psVar19[6] >> 2);

                  sVar1 = psVar19[6];

                  puVar13[0xc] = (char)(sVar1 * 3 + 1 + (int)psVar19[5] >> 2);

                  puVar13[0xd] = (char)(sVar1 * 3 + 2 + (int)psVar19[7] >> 2);

                  sVar1 = psVar19[7];

                  puVar13[0xe] = (char)(psVar19[6] + 1 + sVar1 * 3 >> 2);

                  puVar13[0xf] = (char)(*psVar22 + 2 + sVar1 * 3 >> 2);

                }

                else {

                  *puVar13 = (char)*psVar19;

                  puVar13[1] = (char)psVar19[1];

                  puVar13[2] = (char)psVar19[2];

                  puVar13[3] = (char)psVar19[3];

                  puVar13[4] = (char)psVar19[4];

                  puVar13[5] = (char)psVar19[5];

                  puVar13[6] = (char)psVar19[6];

                  puVar13[7] = (char)psVar19[7];

                }

                psVar19 = psVar19 + 8;

                psVar22 = psVar22 + 8;

                puVar13 = puVar13 + 0x20;

                local_24 = local_24 + 0x10;

              } while ((int)puVar13 < (int)local_3c);

              puVar13 = local_30 + local_88 * 8;

              iVar17 = local_38 + 1;

              iVar11 = local_88;

              local_60 = psVar19;

              local_44 = psVar22;

            } while (iVar17 < *(int *)(local_34 + 4 + *(int *)(param_1 + 0x37cc)));

          }

        }

        else if (local_2c == '\x02') {

          local_50 = 0;

          if (0 < iVar17) {

            local_8c = iVar12 * 0x100;

            local_84 = iVar11 * 8;

            local_80 = iVar12 * 0x20;

            local_30 = (undefined1 *)(iVar11 + -6);

            iVar20 = 0;

            do {

              puVar21 = local_59c + local_8c * iVar20;

              puVar23 = (undefined1 *)0x0;

              if (0 < iVar10) {

                do {

                  local_6c = puVar13;

                  if ((iVar11 == 2) && (iVar12 == 2)) {

                    local_40 = 7;

                    puVar13 = (undefined1 *)0x0;

                    psVar22 = local_28;

                    do {

                      local_28 = psVar22;

                      local_3c = puVar13;

                      sVar1 = *local_60;

                      sVar2 = local_60[1];

                      if (local_3c == (undefined1 *)0x0) {

                        sVar3 = *(short *)(local_64 + 0x70);

                        sVar4 = *(short *)(local_14 + 0x7e);

                        sVar5 = *(short *)(local_64 + 0x72);

                      }

                      else {

                        sVar3 = local_60[-8];

                        sVar4 = *(short *)(local_24 + -2);

                        sVar5 = local_60[-7];

                      }

                      local_70 = (uint)sVar4;

                      local_78 = (uint)sVar5;

                      if (local_40 == 0) {

                        sVar4 = *local_28;

                        sVar5 = *(short *)(local_1c + 0xe);

                        sVar6 = local_28[1];

                      }

                      else {

                        sVar4 = local_60[8];

                        sVar5 = *(short *)(local_24 + 0x1e);

                        sVar6 = local_60[9];

                      }

                      local_54 = sVar4 * 3;

                      local_6c = (undefined1 *)(int)sVar5;

                      local_74 = (int)sVar6;

                      iVar17 = *(short *)(local_24 + 0xe) * 3 + sVar1 * 9;

                      local_3c[(int)puVar21] = (char)((int)(iVar17 + sVar3 * 3 + 8 + local_70) >> 4)

                      ;

                      iVar10 = sVar1 * 9 + sVar2 * 3;

                      (local_3c + 1)[(int)puVar21] =

                           (char)((int)(sVar3 * 3 + iVar10 + 7 + local_78) >> 4);

                      (local_3c + 0x20)[(int)puVar21] =

                           (char)(iVar17 + local_54 + 8 + (int)local_6c >> 4);

                      puVar13 = puVar21 + 2 + (int)local_3c;

                      (local_3c + 0x21)[(int)puVar21] =

                           (char)(local_54 + iVar10 + 7 + local_74 >> 4);

                      psVar22 = local_60 + 1;

                      psVar19 = local_28 + 1;

                      do {

                        iVar10 = local_64;

                        local_28 = psVar19;

                        local_60 = psVar22;

                        local_64 = iVar10 + 2;

                        sVar1 = *local_60;

                        sVar2 = local_60[1];

                        if (local_3c == (undefined1 *)0x0) {

                          sVar3 = *(short *)(iVar10 + 0x72);

                          sVar4 = *(short *)(iVar10 + 0x70);

                          sVar5 = *(short *)(iVar10 + 0x74);

                        }

                        else {

                          sVar3 = local_60[-8];

                          sVar4 = local_60[-9];

                          sVar5 = local_60[-7];

                        }

                        local_74 = (int)sVar5;

                        local_78 = (uint)sVar4;

                        if (local_40 == 0) {

                          sVar4 = *local_28;

                          sVar5 = local_28[-1];

                          sVar6 = local_28[1];

                        }

                        else {

                          sVar4 = local_60[8];

                          sVar5 = local_60[7];

                          sVar6 = local_60[9];

                        }

                        local_38 = sVar4 * 3;

                        local_70 = (uint)sVar6;

                        local_7c = (undefined1 *)(int)sVar5;

                        iVar16 = local_60[-1] * 3 + sVar1 * 9;

                        *puVar13 = (char)((int)(iVar16 + sVar3 * 3 + 8 + local_78) >> 4);

                        iVar17 = sVar1 * 9 + sVar2 * 3;

                        puVar13[1] = (char)(sVar3 * 3 + iVar17 + 7 + local_74 >> 4);

                        puVar13[0x20] = (char)(iVar16 + local_38 + 8 + (int)local_7c >> 4);

                        puVar13[0x21] = (char)((int)(local_38 + iVar17 + 7 + local_70) >> 4);

                        puVar13 = puVar13 + 2;

                        psVar22 = local_60 + 1;

                        psVar19 = local_28 + 1;

                      } while ((int)puVar13 < (int)(puVar21 + 0xe + (int)local_3c));

                      iVar17 = local_60[1] * 9;

                      local_7c = (undefined1 *)(*local_44 * 3);

                      if (local_3c == (undefined1 *)0x0) {

                        sVar1 = *(short *)(iVar10 + 0x74);

                        sVar2 = *(short *)(iVar10 + 0x72);

                        sVar3 = *(short *)(local_18 + 0x70);

                      }

                      else {

                        sVar1 = local_60[-7];

                        sVar2 = local_60[-8];

                        sVar3 = local_44[-8];

                      }

                      local_6c = (undefined1 *)(int)sVar2;

                      local_78 = (uint)sVar3;

                      local_44 = local_44 + 8;

                      if (local_40 == 0) {

                        sVar2 = local_28[1];

                        sVar3 = *local_28;

                        sVar4 = *local_20;

                      }

                      else {

                        sVar2 = local_60[9];

                        sVar3 = local_60[8];

                        sVar4 = *local_44;

                      }

                      local_54 = sVar2 * 3;

                      local_70 = (uint)sVar3;

                      local_74 = (int)sVar4;

                      iVar16 = *local_60 * 3 + iVar17;

                      (local_3c + 0xe)[(int)puVar21] =

                           (char)(iVar16 + sVar1 * 3 + 8 + (int)local_6c >> 4);

                      local_60 = local_60 + 2;

                      (local_3c + 0xf)[(int)puVar21] =

                           (char)((int)(local_7c + local_78 + sVar1 * 3 + iVar17 + 7) >> 4);

                      (local_3c + 0x2e)[(int)puVar21] =

                           (char)((int)(iVar16 + local_54 + 8 + local_70) >> 4);

                      local_40 = local_40 + -1;

                      (local_3c + 0x2f)[(int)puVar21] =

                           (char)((int)(local_7c + local_74 + local_54 + iVar17 + 7) >> 4);

                      local_24 = local_24 + 0x10;

                      local_64 = iVar10 + -10;

                      puVar13 = local_3c + 0x40;

                      psVar22 = local_28 + -6;

                    } while (local_40 != -1);

                    puVar13 = puVar21 + 0x10;

                    local_64 = iVar10 + 0x76;

                    local_28 = local_28 + 0x3a;

                    local_14 = local_14 + 0x80;

                    local_18 = local_18 + 0x80;

                    local_1c = local_1c + 0x80;

                    local_20 = local_20 + 0x40;

                    local_6c = (undefined1 *)(*(int *)(param_1 + 0x37cc) + local_34);

                    iVar10 = *(int *)(local_6c + 4);

                    local_40 = -1;

                    local_5c = puVar21;

                    local_58 = puVar23;

                    local_50 = iVar20;

                  }

                  else {

                    iVar20 = 0;

                    iVar17 = *(int *)(local_6c + 8);

                    puVar13 = puVar21;

                    if (0 < iVar17) {

                      iVar16 = 0;

                      do {

                        puVar13 = local_59c + iVar16;

                        puVar23 = (undefined1 *)0x0;

                        if (0 < iVar10) {

                          do {

                            local_74 = 0;

                            if (0 < local_8c) {

                              iVar10 = 0;

                              do {

                                iVar17 = 0;

                                if (0 < local_84) {

                                  do {

                                    sVar1 = *local_60;

                                    iVar24 = 0;

                                    local_60 = local_60 + 1;

                                    if (0 < local_80) {

                                      do {

                                        iVar18 = 0;

                                        if (0 < iVar11) {

                                          uVar9 = (undefined1)sVar1;

                                          if (iVar11 < 6) {

                                            local_7c = puVar13 + iVar24 + iVar17 + iVar10;

                                          }

                                          else {

                                            local_7c = puVar13 + iVar24 + iVar17 + iVar10;

                                            do {

                                              local_7c[iVar18] = uVar9;

                                              local_7c[iVar18 + 1] = uVar9;

                                              local_7c[iVar18 + 2] = uVar9;

                                              local_7c[iVar18 + 3] = uVar9;

                                              local_7c[iVar18 + 4] = uVar9;

                                              iVar18 = iVar18 + 5;

                                            } while (iVar18 <= (int)local_30);

                                          }

                                          local_78 = (int)sVar1 & 0xff;

                                          do {

                                            local_7c[iVar18] = uVar9;

                                            iVar18 = iVar18 + 1;

                                          } while (iVar18 < iVar11);

                                        }

                                        iVar24 = iVar24 + 0x20;

                                        local_70 = (int)sVar1;

                                      } while (iVar24 < local_80);

                                    }

                                    iVar17 = iVar17 + iVar11;

                                    local_74 = iVar10;

                                  } while (iVar17 < local_84);

                                }

                                iVar10 = iVar10 + local_80;

                              } while (iVar10 < local_8c);

                              local_6c = (undefined1 *)(*(int *)(param_1 + 0x37cc) + local_34);

                              iVar10 = *(int *)(local_6c + 4);

                              local_5c = puVar13;

                              local_58 = puVar23;

                            }

                            puVar13 = puVar13 + iVar11 * 8;

                            local_64 = local_64 + 0x80;

                            local_24 = local_24 + 0x80;

                            local_44 = local_44 + 0x40;

                            puVar23 = puVar23 + 1;

                            local_28 = local_28 + 0x40;

                            local_14 = local_14 + 0x80;

                            local_18 = local_18 + 0x80;

                            local_1c = local_1c + 0x80;

                            local_20 = local_20 + 0x40;

                          } while ((int)puVar23 < iVar10);

                          iVar17 = *(int *)(local_6c + 8);

                          local_54 = iVar16;

                          local_50 = iVar20;

                        }

                        iVar16 = iVar16 + local_8c;

                        iVar20 = iVar20 + 1;

                      } while (iVar20 < iVar17);

                    }

                  }

                  puVar23 = puVar23 + 1;

                  puVar21 = puVar13;

                  puVar13 = local_6c;

                } while ((int)puVar23 < iVar10);

                iVar17 = *(int *)(local_6c + 8);

              }

              iVar20 = iVar20 + 1;

              local_88 = iVar11;

              local_4c = iVar12;

            } while (iVar20 < iVar17);

          }

        }

        else {

          uVar14 = 0;

          if (0 < iVar17) {

            local_38 = iVar12 * 0x100;

            local_4c = iVar12 * 0x20;

            local_3c = (undefined1 *)(iVar11 * 8);

            local_50 = iVar11 + -6;

            iVar12 = 0;

            local_40 = 0;

            do {

              puVar21 = local_59c + iVar12;

              local_54 = 0;

              local_30 = puVar21;

              if (0 < iVar10) {

                iVar17 = 0;

                do {

                  iVar20 = 0;

                  if (0 < local_38) {

                    do {

                      uVar15 = 0;

                      if (0 < (int)local_3c) {

                        local_6c = puVar21 + iVar20;

                        do {

                          sVar1 = *local_60;

                          iVar10 = 0;

                          local_60 = local_60 + 1;

                          if (0 < local_4c) {

                            local_58 = local_6c + uVar15;

                            bVar8 = (byte)sVar1;

                            local_5c = (undefined1 *)(uint)bVar8;

                            do {

                              iVar16 = 0;

                              if (0 < iVar11) {

                                if (5 < iVar11) {

                                  do {

                                    local_58[iVar16 + iVar10] = bVar8;

                                    local_58[iVar16 + iVar10 + 1] = bVar8;

                                    local_58[iVar16 + iVar10 + 2] = bVar8;

                                    local_58[iVar16 + iVar10 + 3] = bVar8;

                                    local_58[iVar16 + iVar10 + 4] = bVar8;

                                    iVar16 = iVar16 + 5;

                                  } while (iVar16 <= local_50);

                                }

                                do {

                                  local_58[iVar16 + iVar10] = bVar8;

                                  iVar16 = iVar16 + 1;

                                } while (iVar16 < iVar11);

                              }

                              iVar10 = iVar10 + 0x20;

                              local_78 = uVar15;

                            } while (iVar10 < local_4c);

                          }

                          uVar15 = uVar15 + iVar11;

                          local_74 = iVar20;

                          local_30 = puVar21;

                        } while ((int)uVar15 < (int)local_3c);

                      }

                      iVar20 = iVar20 + local_4c;

                    } while (iVar20 < local_38);

                    puVar13 = (undefined1 *)(*(int *)(param_1 + 0x37cc) + local_34);

                    iVar10 = *(int *)(puVar13 + 4);

                    local_54 = iVar17;

                  }

                  puVar21 = puVar21 + iVar11 * 8;

                  iVar17 = iVar17 + 1;

                } while (iVar17 < iVar10);

                iVar17 = *(int *)(puVar13 + 8);

                local_70 = uVar14;

                local_40 = iVar12;

              }

              iVar12 = iVar12 + local_38;

              uVar14 = uVar14 + 1;

              local_88 = iVar11;

            } while ((int)uVar14 < iVar17);

          }

        }

        puVar13 = local_59c;

        FUN_00633140(param_1,local_9c,local_68,local_48,puVar13);

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

        if ((iVar10 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

          local_48 = local_48 + -1;

          iVar17 = *(int *)(param_1 + 0x30);

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

        }

        else {

          local_48 = local_48 + 1;

          iVar17 = *(int *)(param_1 + 0x30);

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

        }

      }

      local_68 = local_68 + 1;

    }

    iVar11 = local_68;

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

       (iVar11 = *(int *)(param_1 + 0x54),

       *(int *)(param_1 + 0x54) + -1 != *(int *)(param_1 + 0x3820))) {

      iVar11 = iVar17;

    }

    if (((iVar10 != 0xff) || (*(int *)(param_1 + 0x58) != 0xff)) &&

       (iVar10 = local_48, iVar11 < iVar17)) {

      do {

        FUN_00633140(param_1,local_9c,iVar11,iVar10,puVar13);

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

          iVar10 = iVar10 + -1;

        }

        else {

          iVar10 = iVar10 + 1;

        }

        iVar11 = iVar11 + 1;

      } while (iVar11 < *(int *)(param_1 + 0x30));

    }

  }

  return;

}





// --- FUN_006346f0 at 0x006346F0 (size: 930) ---


void FUN_006346f0(int param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  uint uVar8;

  uint uVar9;

  int local_3c;

  int local_38;

  int local_34;

  int local_30;

  int local_1c;

  int local_18;

  

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

  if (((iVar1 != 2) && (iVar1 != 1)) && (iVar1 != 5)) {

    return;

  }

  iVar1 = FUN_0062f6a0(param_1 + 4,*(int *)(param_1 + 0x37b8) * 8,*(int *)(param_1 + 0x37bc) * 8,

                       param_3,param_4,*(undefined4 *)(param_1 + 0x30),

                       *(undefined4 *)(param_1 + 0x3c),*(undefined4 *)(param_1 + 0x20),

                       *(undefined4 *)(param_1 + 0x24),*(undefined4 *)(param_1 + 0x28),

                       param_2 + 0x2c,&local_3c);

  if (iVar1 == 0) {

    iVar1 = *(int *)(param_2 + 0x2c);

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

    if (local_18 == 3) {

      for (; local_38 < local_30; local_38 = local_38 + 1) {

        iVar4 = local_3c * 3;

        if (iVar4 < local_34 * 3) {

          do {

            iVar7 = local_38 * *(int *)(param_1 + 0x3c) + iVar1;

            uVar8 = (uint)*(byte *)(iVar7 + iVar4);

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

            uVar9 = (uint)*(byte *)(iVar7 + 2 + iVar4);

            iVar2 = ((int)(uVar9 * 0x167 + -0xb2f5) >> 8) + uVar8;

            if (iVar2 < 0x100) {

              if (iVar2 < 0) {

                iVar2 = 0;

              }

            }

            else {

              iVar2 = 0xff;

            }

            iVar3 = ((int)(uVar5 * -0x58 + 0x87f6 + uVar9 * -0xb7) >> 8) + uVar8;

            if (iVar3 < 0x100) {

              if (iVar3 < 0) {

                iVar3 = 0;

              }

            }

            else {

              iVar3 = 0xff;

            }

            iVar6 = uVar8 + ((int)(uVar5 * 0x1c6 + -0xe251) >> 8);

            if (iVar6 < 0x100) {

              if (iVar6 < 0) {

                iVar6 = 0;

              }

            }

            else {

              iVar6 = 0xff;

            }

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

              *(char *)(iVar7 + iVar4) = (char)iVar6;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar2;

            }

            else {

              *(char *)(iVar7 + iVar4) = (char)iVar2;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar6;

            }

            iVar4 = iVar4 + 3;

          } while (iVar4 < local_34 * 3);

        }

      }

    }

    else if (local_38 < local_30) {

      local_1c = local_34 * local_18;

      do {

        iVar4 = local_18 * local_3c;

        if (iVar4 < local_1c) {

          do {

            iVar7 = local_38 * *(int *)(param_1 + 0x3c) + iVar1;

            uVar5 = (uint)*(byte *)(iVar7 + iVar4);

            uVar8 = (uint)*(byte *)(iVar7 + 1 + iVar4);

            uVar9 = (uint)*(byte *)(iVar7 + 2 + iVar4);

            iVar2 = ((int)(uVar9 * 0x167 + -0xb2f5) >> 8) + uVar5;

            if (iVar2 < 0x100) {

              if (iVar2 < 0) {

                iVar2 = 0;

              }

            }

            else {

              iVar2 = 0xff;

            }

            iVar3 = ((int)(uVar8 * -0x58 + 0x87f6 + uVar9 * -0xb7) >> 8) + uVar5;

            if (iVar3 < 0x100) {

              if (iVar3 < 0) {

                iVar3 = 0;

              }

            }

            else {

              iVar3 = 0xff;

            }

            iVar6 = uVar5 + ((int)(uVar8 * 0x1c6 + -0xe251) >> 8);

            if (iVar6 < 0x100) {

              if (iVar6 < 0) {

                iVar6 = 0;

              }

            }

            else {

              iVar6 = 0xff;

            }

            if (*(int *)(param_1 + 0x58) == 6) {

              *(char *)(iVar7 + iVar4) = -1 - (char)iVar2;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = -1 - (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = -1 - (char)iVar6;

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

              local_1c = local_18 * local_34;

            }

            else if (*(int *)(param_1 + 0x58) == 3) {

              *(char *)(iVar7 + iVar4) = (char)iVar2;

              *(char *)(iVar4 + 1 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar3;

              *(char *)(iVar4 + 2 + *(int *)(param_1 + 0x3c) * local_38 + iVar1) = (char)iVar6;

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

              local_1c = local_18 * local_34;

            }

            iVar4 = iVar4 + local_18;

          } while (iVar4 < local_1c);

        }

        local_38 = local_38 + 1;

      } while (local_38 < local_30);

    }

  }

  return;

}





// --- FUN_00634ab0 at 0x00634AB0 (size: 704) ---


void FUN_00634ab0(int param_1,short *param_2,short *param_3,int param_4,uint *param_5,int param_6)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  short local_8c [48];

  uint local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = param_5[1];

  local_1c = local_2c * param_6 + param_4;

  iVar4 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_8c[iVar4 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar4 * 4 + 0x10] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_8c[iVar4 * 4 + 0x20] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_8c[iVar4 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar4 * 4 + 0x11] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_8c[iVar4 * 4 + 0x21] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_8c[iVar4 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar4 * 4 + 0x12] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_8c[iVar4 * 4 + 0x22] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_8c[iVar4 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_8c[iVar4 * 4 + 0x13] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_8c[iVar4 * 4 + 0x23] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar4 = iVar4 + 1;

  } while (iVar4 < 4);

  uVar6 = param_5[3];

  if ((int)local_2c < (int)uVar6) {

    uVar7 = param_5[2];

    local_28 = local_2c << 4;

    do {

      uVar8 = *param_5;

      if ((int)uVar8 < (int)uVar7) {

        local_24 = (int)(local_2c + (0x7fffffff < local_2c)) >> 1;

        local_20 = param_1 + local_28;

        do {

          iVar4 = (int)*(short *)(param_1 + local_28 + uVar8 * 2);

          local_14 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_24 * 4;

          iVar5 = local_8c[local_14] + iVar4;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          iVar3 = uVar8 * 3;

          sVar1 = local_8c[local_14 + 0x10];

          *(char *)(iVar3 + local_1c) = (char)iVar5;

          iVar5 = iVar4 - sVar1;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          *(char *)(iVar3 + 1 + local_1c) = (char)iVar5;

          iVar4 = iVar4 + local_8c[local_14 + 0x20];

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          uVar8 = uVar8 + 1;

          *(char *)(iVar3 + 2 + local_1c) = (char)iVar4;

          uVar7 = param_5[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar6 = param_5[3];

      }

      local_1c = local_1c + param_6;

      local_28 = local_28 + 0x10;

      local_2c = local_2c + 1;

    } while ((int)local_2c < (int)uVar6);

  }

  return;

}





// --- FUN_00634d90 at 0x00634D90 (size: 1977) ---


void FUN_00634d90(short *param_1,short *param_2,short *param_3,undefined1 *param_4,int param_5)



{

  short *psVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_48;

  short *local_34;

  short *local_30;

  

  local_48 = 0;

  local_34 = param_3;

  local_30 = param_2;

  do {

    iVar2 = *local_34 * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_30 * 0x58 + -0x87f6 + *local_34 * 0xb7 >> 8;

    iVar4 = *local_30 * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_34[1] * 0x167 + -0xb2f5 >> 8;

    iVar6 = local_30[1] * 0x58 + -0x87f6 + local_34[1] * 0xb7 >> 8;

    iVar7 = local_30[1] * 0x1c6 + -0xe251 >> 8;

    iVar8 = local_34[2] * 0x167 + -0xb2f5 >> 8;

    iVar9 = local_30[2] * 0x58 + -0x87f6 + local_34[2] * 0xb7 >> 8;

    iVar10 = local_30[2] * 0x1c6 + -0xe251 >> 8;

    iVar14 = local_34[3] * 0x167 + -0xb2f5 >> 8;

    psVar1 = local_30 + 3;

    iVar11 = *psVar1 * 0x58 + -0x87f6 + local_34[3] * 0xb7 >> 8;

    local_30 = local_30 + 8;

    iVar12 = *psVar1 * 0x1c6 + -0xe251 >> 8;

    iVar13 = (int)*param_1;

    iVar15 = iVar2 + iVar13;

    local_34 = local_34 + 8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    iVar13 = (int)param_1[1];

    iVar15 = iVar2 + iVar13;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[3] = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[4] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[5] = (char)iVar13;

    iVar13 = (int)param_1[2];

    iVar15 = iVar13 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    iVar15 = iVar13 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[7] = (char)iVar15;

    iVar13 = iVar13 + iVar7;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[8] = (char)iVar13;

    iVar13 = (int)param_1[3];

    iVar15 = iVar13 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[9] = (char)iVar15;

    iVar15 = iVar13 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[10] = (char)iVar15;

    iVar13 = iVar13 + iVar7;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0xb] = (char)iVar13;

    iVar13 = (int)param_1[4];

    iVar15 = iVar13 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar13 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar13 = iVar13 + iVar10;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0xe] = (char)iVar13;

    iVar13 = (int)param_1[5];

    iVar15 = iVar13 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xf] = (char)iVar15;

    iVar15 = iVar13 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x10] = (char)iVar15;

    iVar13 = iVar13 + iVar10;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x11] = (char)iVar13;

    iVar13 = (int)param_1[6];

    iVar15 = iVar13 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x12] = (char)iVar15;

    iVar15 = iVar13 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x13] = (char)iVar15;

    iVar13 = iVar13 + iVar12;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x14] = (char)iVar13;

    iVar13 = (int)param_1[7];

    iVar15 = iVar13 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x15] = (char)iVar15;

    iVar15 = iVar13 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x16] = (char)iVar15;

    iVar13 = iVar13 + iVar12;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x17] = (char)iVar13;

    iVar13 = (int)param_1[8];

    iVar15 = iVar2 + iVar13;

    param_4 = param_4 + param_5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    iVar15 = (int)param_1[9];

    iVar2 = iVar2 + iVar15;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[3] = (char)iVar2;

    iVar3 = iVar15 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_4[4] = (char)iVar3;

    iVar15 = iVar15 + iVar4;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[5] = (char)iVar15;

    iVar2 = (int)param_1[10];

    iVar15 = iVar2 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    iVar15 = iVar2 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[7] = (char)iVar15;

    iVar2 = iVar2 + iVar7;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[8] = (char)iVar2;

    iVar15 = (int)param_1[0xb];

    iVar5 = iVar5 + iVar15;

    if (iVar5 < 0x100) {

      if (iVar5 < 0) {

        iVar5 = 0;

      }

    }

    else {

      iVar5 = 0xff;

    }

    param_4[9] = (char)iVar5;

    iVar6 = iVar15 - iVar6;

    if (iVar6 < 0x100) {

      if (iVar6 < 0) {

        iVar6 = 0;

      }

    }

    else {

      iVar6 = 0xff;

    }

    param_4[10] = (char)iVar6;

    iVar15 = iVar15 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xb] = (char)iVar15;

    iVar2 = (int)param_1[0xc];

    iVar15 = iVar2 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar2 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0xe] = (char)iVar2;

    iVar15 = (int)param_1[0xd];

    iVar8 = iVar8 + iVar15;

    if (iVar8 < 0x100) {

      if (iVar8 < 0) {

        iVar8 = 0;

      }

    }

    else {

      iVar8 = 0xff;

    }

    param_4[0xf] = (char)iVar8;

    iVar9 = iVar15 - iVar9;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_4[0x10] = (char)iVar9;

    iVar15 = iVar15 + iVar10;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x11] = (char)iVar15;

    iVar2 = (int)param_1[0xe];

    iVar15 = iVar2 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x12] = (char)iVar15;

    iVar15 = iVar2 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x13] = (char)iVar15;

    iVar2 = iVar2 + iVar12;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0x14] = (char)iVar2;

    iVar15 = (int)param_1[0xf];

    iVar14 = iVar14 + iVar15;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x15] = (char)iVar14;

    iVar11 = iVar15 - iVar11;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_4[0x16] = (char)iVar11;

    iVar15 = iVar15 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_1 = param_1 + 0x10;

    param_4[0x17] = (char)iVar15;

    local_48 = local_48 + 2;

    param_4 = param_4 + param_5;

  } while (local_48 < 8);

  return;

}





// --- FUN_00635b50 at 0x00635B50 (size: 704) ---


void FUN_00635b50(int param_1,short *param_2,short *param_3,int param_4,uint *param_5,int param_6)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  short local_8c [48];

  uint local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = param_5[1];

  local_1c = local_2c * param_6 + param_4;

  iVar4 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_8c[iVar4 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar4 * 4 + 0x10] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_8c[iVar4 * 4 + 0x20] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_8c[iVar4 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar4 * 4 + 0x11] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_8c[iVar4 * 4 + 0x21] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_8c[iVar4 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar4 * 4 + 0x12] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_8c[iVar4 * 4 + 0x22] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_8c[iVar4 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_8c[iVar4 * 4 + 0x13] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_8c[iVar4 * 4 + 0x23] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar4 = iVar4 + 1;

  } while (iVar4 < 4);

  uVar6 = param_5[3];

  if ((int)local_2c < (int)uVar6) {

    uVar7 = param_5[2];

    local_28 = local_2c << 4;

    do {

      uVar8 = *param_5;

      if ((int)uVar8 < (int)uVar7) {

        local_24 = (int)(local_2c + (0x7fffffff < local_2c)) >> 1;

        local_20 = param_1 + local_28;

        do {

          iVar4 = (int)*(short *)(param_1 + local_28 + uVar8 * 2);

          local_14 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_24 * 4;

          iVar5 = local_8c[local_14 + 0x20] + iVar4;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          iVar3 = uVar8 * 3;

          sVar1 = local_8c[local_14 + 0x10];

          *(char *)(iVar3 + local_1c) = (char)iVar5;

          iVar5 = iVar4 - sVar1;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          *(char *)(iVar3 + 1 + local_1c) = (char)iVar5;

          iVar4 = iVar4 + local_8c[local_14];

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          uVar8 = uVar8 + 1;

          *(char *)(iVar3 + 2 + local_1c) = (char)iVar4;

          uVar7 = param_5[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar6 = param_5[3];

      }

      local_1c = local_1c + param_6;

      local_28 = local_28 + 0x10;

      local_2c = local_2c + 1;

    } while ((int)local_2c < (int)uVar6);

  }

  return;

}





// --- FUN_00635e30 at 0x00635E30 (size: 1977) ---


void FUN_00635e30(short *param_1,short *param_2,short *param_3,undefined1 *param_4,int param_5)



{

  short *psVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_48;

  short *local_34;

  short *local_30;

  

  local_48 = 0;

  local_30 = param_3;

  local_34 = param_2;

  do {

    iVar2 = *local_30 * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_34 * 0x58 + -0x87f6 + *local_30 * 0xb7 >> 8;

    iVar4 = *local_34 * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_30[1] * 0x167 + -0xb2f5 >> 8;

    iVar6 = local_34[1] * 0x58 + -0x87f6 + local_30[1] * 0xb7 >> 8;

    iVar7 = local_34[1] * 0x1c6 + -0xe251 >> 8;

    iVar8 = local_30[2] * 0x167 + -0xb2f5 >> 8;

    iVar14 = local_34[2] * 0x58 + -0x87f6 + local_30[2] * 0xb7 >> 8;

    iVar9 = local_34[2] * 0x1c6 + -0xe251 >> 8;

    psVar1 = local_30 + 3;

    local_30 = local_30 + 8;

    iVar10 = *psVar1 * 0x167 + -0xb2f5 >> 8;

    iVar11 = local_34[3] * 0x58 + -0x87f6 + *psVar1 * 0xb7 >> 8;

    iVar12 = local_34[3] * 0x1c6 + -0xe251 >> 8;

    iVar13 = (int)*param_1;

    iVar15 = iVar4 + iVar13;

    local_34 = local_34 + 8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar2;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    iVar13 = (int)param_1[1];

    iVar15 = iVar4 + iVar13;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[3] = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[4] = (char)iVar15;

    iVar13 = iVar13 + iVar2;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[5] = (char)iVar13;

    iVar13 = (int)param_1[2];

    iVar15 = iVar13 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    iVar15 = iVar13 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[7] = (char)iVar15;

    iVar13 = iVar13 + iVar5;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[8] = (char)iVar13;

    iVar13 = (int)param_1[3];

    iVar15 = iVar13 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[9] = (char)iVar15;

    iVar15 = iVar13 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[10] = (char)iVar15;

    iVar13 = iVar13 + iVar5;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0xb] = (char)iVar13;

    iVar13 = (int)param_1[4];

    iVar15 = iVar13 + iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar13 - iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar13 = iVar13 + iVar8;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0xe] = (char)iVar13;

    iVar13 = (int)param_1[5];

    iVar15 = iVar13 + iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xf] = (char)iVar15;

    iVar15 = iVar13 - iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x10] = (char)iVar15;

    iVar13 = iVar13 + iVar8;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x11] = (char)iVar13;

    iVar13 = (int)param_1[6];

    iVar15 = iVar13 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x12] = (char)iVar15;

    iVar15 = iVar13 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x13] = (char)iVar15;

    iVar13 = iVar13 + iVar10;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x14] = (char)iVar13;

    iVar13 = (int)param_1[7];

    iVar15 = iVar13 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x15] = (char)iVar15;

    iVar15 = iVar13 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x16] = (char)iVar15;

    iVar13 = iVar13 + iVar10;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x17] = (char)iVar13;

    iVar13 = (int)param_1[8];

    iVar15 = iVar4 + iVar13;

    param_4 = param_4 + param_5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar2;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    iVar15 = (int)param_1[9];

    iVar4 = iVar4 + iVar15;

    if (iVar4 < 0x100) {

      if (iVar4 < 0) {

        iVar4 = 0;

      }

    }

    else {

      iVar4 = 0xff;

    }

    param_4[3] = (char)iVar4;

    iVar3 = iVar15 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_4[4] = (char)iVar3;

    iVar15 = iVar15 + iVar2;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[5] = (char)iVar15;

    iVar2 = (int)param_1[10];

    iVar15 = iVar2 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    iVar15 = iVar2 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[7] = (char)iVar15;

    iVar2 = iVar2 + iVar5;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[8] = (char)iVar2;

    iVar15 = (int)param_1[0xb];

    iVar7 = iVar7 + iVar15;

    if (iVar7 < 0x100) {

      if (iVar7 < 0) {

        iVar7 = 0;

      }

    }

    else {

      iVar7 = 0xff;

    }

    param_4[9] = (char)iVar7;

    iVar6 = iVar15 - iVar6;

    if (iVar6 < 0x100) {

      if (iVar6 < 0) {

        iVar6 = 0;

      }

    }

    else {

      iVar6 = 0xff;

    }

    param_4[10] = (char)iVar6;

    iVar15 = iVar15 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xb] = (char)iVar15;

    iVar2 = (int)param_1[0xc];

    iVar15 = iVar2 + iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar2 - iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar2 = iVar2 + iVar8;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0xe] = (char)iVar2;

    iVar15 = (int)param_1[0xd];

    iVar9 = iVar9 + iVar15;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_4[0xf] = (char)iVar9;

    iVar14 = iVar15 - iVar14;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x10] = (char)iVar14;

    iVar15 = iVar15 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x11] = (char)iVar15;

    iVar2 = (int)param_1[0xe];

    iVar15 = iVar2 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x12] = (char)iVar15;

    iVar15 = iVar2 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x13] = (char)iVar15;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0x14] = (char)iVar2;

    iVar15 = (int)param_1[0xf];

    iVar12 = iVar12 + iVar15;

    if (iVar12 < 0x100) {

      if (iVar12 < 0) {

        iVar12 = 0;

      }

    }

    else {

      iVar12 = 0xff;

    }

    param_4[0x15] = (char)iVar12;

    iVar11 = iVar15 - iVar11;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_4[0x16] = (char)iVar11;

    iVar15 = iVar15 + iVar10;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_1 = param_1 + 0x10;

    param_4[0x17] = (char)iVar15;

    local_48 = local_48 + 2;

    param_4 = param_4 + param_5;

  } while (local_48 < 8);

  return;

}





// --- FUN_00636bf0 at 0x00636BF0 (size: 329) ---


void FUN_00636bf0(int param_1,int param_2,int param_3,int param_4,int *param_5,int param_6)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int local_20;

  

  iVar8 = param_5[1];

  iVar5 = param_5[3];

  param_4 = iVar8 * param_6 + param_4;

  if (iVar8 < iVar5) {

    iVar1 = param_5[2];

    iVar4 = iVar8 * 8;

    do {

      local_20 = *param_5;

      if (local_20 < iVar1) {

        iVar6 = local_20 * 3;

        iVar5 = local_20 + iVar4;

        do {

          iVar1 = (int)*(short *)(param_3 + iVar5 * 2);

          iVar3 = (int)*(short *)(param_2 + iVar5 * 2);

          iVar7 = (int)*(short *)(param_1 + iVar5 * 2);

          iVar2 = (short)((uint)(iVar1 * 0x167 + -0xb2f5) >> 8) + iVar7;

          if (iVar2 < 0x100) {

            if (iVar2 < 0) {

              iVar2 = 0;

            }

          }

          else {

            iVar2 = 0xff;

          }

          *(char *)(iVar6 + param_4) = (char)iVar2;

          iVar1 = iVar7 - (short)((uint)(iVar3 * 0x58 + -0x87f6 + iVar1 * 0xb7) >> 8);

          if (iVar1 < 0x100) {

            if (iVar1 < 0) {

              iVar1 = 0;

            }

          }

          else {

            iVar1 = 0xff;

          }

          *(char *)(iVar6 + 1 + param_4) = (char)iVar1;

          iVar7 = (short)((uint)(iVar3 * 0x1c6 + -0xe251) >> 8) + iVar7;

          if (iVar7 < 0x100) {

            if (iVar7 < 0) {

              iVar7 = 0;

            }

          }

          else {

            iVar7 = 0xff;

          }

          iVar5 = iVar5 + 1;

          *(char *)(iVar6 + 2 + param_4) = (char)iVar7;

          iVar6 = iVar6 + 3;

          local_20 = local_20 + 1;

          iVar1 = param_5[2];

        } while (local_20 < iVar1);

        iVar5 = param_5[3];

      }

      param_4 = param_4 + param_6;

      iVar4 = iVar4 + 8;

      iVar8 = iVar8 + 1;

    } while (iVar8 < iVar5);

  }

  return;

}





// --- FUN_00637010 at 0x00637010 (size: 329) ---


void FUN_00637010(int param_1,int param_2,int param_3,int param_4,int *param_5,int param_6)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int local_20;

  

  iVar8 = param_5[1];

  iVar5 = param_5[3];

  param_4 = iVar8 * param_6 + param_4;

  if (iVar8 < iVar5) {

    iVar1 = param_5[2];

    iVar4 = iVar8 * 8;

    do {

      local_20 = *param_5;

      if (local_20 < iVar1) {

        iVar6 = local_20 * 3;

        iVar5 = local_20 + iVar4;

        do {

          iVar1 = (int)*(short *)(param_3 + iVar5 * 2);

          iVar2 = (int)*(short *)(param_2 + iVar5 * 2);

          iVar7 = (int)*(short *)(param_1 + iVar5 * 2);

          iVar3 = (short)((uint)(iVar2 * 0x1c6 + -0xe251) >> 8) + iVar7;

          if (iVar3 < 0x100) {

            if (iVar3 < 0) {

              iVar3 = 0;

            }

          }

          else {

            iVar3 = 0xff;

          }

          *(char *)(iVar6 + param_4) = (char)iVar3;

          iVar2 = iVar7 - (short)((uint)(iVar2 * 0x58 + -0x87f6 + iVar1 * 0xb7) >> 8);

          if (iVar2 < 0x100) {

            if (iVar2 < 0) {

              iVar2 = 0;

            }

          }

          else {

            iVar2 = 0xff;

          }

          *(char *)(iVar6 + 1 + param_4) = (char)iVar2;

          iVar7 = (short)((uint)(iVar1 * 0x167 + -0xb2f5) >> 8) + iVar7;

          if (iVar7 < 0x100) {

            if (iVar7 < 0) {

              iVar7 = 0;

            }

          }

          else {

            iVar7 = 0xff;

          }

          iVar5 = iVar5 + 1;

          *(char *)(iVar6 + 2 + param_4) = (char)iVar7;

          iVar6 = iVar6 + 3;

          local_20 = local_20 + 1;

          iVar1 = param_5[2];

        } while (local_20 < iVar1);

        iVar5 = param_5[3];

      }

      param_4 = param_4 + param_6;

      iVar4 = iVar4 + 8;

      iVar8 = iVar8 + 1;

    } while (iVar8 < iVar5);

  }

  return;

}





// --- FUN_00637430 at 0x00637430 (size: 765) ---


void FUN_00637430(int param_1,short *param_2,short *param_3,int param_4,uint *param_5,int param_6)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  short local_ec [96];

  uint local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = param_5[1];

  local_1c = local_2c * param_6 + param_4;

  iVar4 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_ec[iVar4 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar4 * 4 + 0x20] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_ec[iVar4 * 4 + 0x40] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_ec[iVar4 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar4 * 4 + 0x21] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_ec[iVar4 * 4 + 0x41] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_ec[iVar4 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar4 * 4 + 0x22] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_ec[iVar4 * 4 + 0x42] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_ec[iVar4 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_ec[iVar4 * 4 + 0x23] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_ec[iVar4 * 4 + 0x43] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar4 = iVar4 + 1;

  } while (iVar4 < 8);

  uVar6 = param_5[3];

  if ((int)local_2c < (int)uVar6) {

    uVar7 = param_5[2];

    local_28 = local_2c << 4;

    do {

      uVar8 = *param_5;

      if ((int)uVar8 < (int)uVar7) {

        local_24 = local_2c * 2;

        local_20 = param_1 + local_28;

        do {

          iVar4 = (int)*(short *)(param_1 + local_28 + uVar8 * 2);

          local_14 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_2c * 4;

          iVar5 = local_ec[local_14] + iVar4;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          iVar3 = uVar8 * 3;

          sVar1 = local_ec[local_14 + 0x20];

          *(char *)(iVar3 + local_1c) = (char)iVar5;

          iVar5 = iVar4 - sVar1;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          *(char *)(iVar3 + 1 + local_1c) = (char)iVar5;

          iVar4 = iVar4 + local_ec[local_14 + 0x40];

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          uVar8 = uVar8 + 1;

          *(char *)(iVar3 + 2 + local_1c) = (char)iVar4;

          uVar7 = param_5[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar6 = param_5[3];

      }

      local_1c = local_1c + param_6;

      local_28 = local_28 + 0x10;

      local_2c = local_2c + 1;

    } while ((int)local_2c < (int)uVar6);

  }

  return;

}





// --- FUN_00637740 at 0x00637740 (size: 1252) ---


void FUN_00637740(short *param_1,short *param_2,short *param_3,undefined1 *param_4,int param_5)



{

  short *psVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_50;

  short *local_3c;

  short *local_38;

  

  local_50 = 0;

  local_3c = param_3;

  local_38 = param_2;

  do {

    iVar2 = *local_3c * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_38 * 0x58 + -0x87f6 + *local_3c * 0xb7 >> 8;

    iVar4 = *local_38 * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_3c[1] * 0x167 + -0xb2f5 >> 8;

    iVar6 = local_38[1] * 0x58 + -0x87f6 + local_3c[1] * 0xb7 >> 8;

    iVar7 = local_38[1] * 0x1c6 + -0xe251 >> 8;

    iVar8 = local_3c[2] * 0x167 + -0xb2f5 >> 8;

    iVar9 = local_38[2] * 0x58 + -0x87f6 + local_3c[2] * 0xb7 >> 8;

    iVar10 = local_38[2] * 0x1c6 + -0xe251 >> 8;

    psVar1 = local_3c + 3;

    iVar14 = *psVar1 * 0x167 + -0xb2f5 >> 8;

    local_3c = local_3c + 8;

    iVar11 = local_38[3] * 0x58 + -0x87f6 + *psVar1 * 0xb7 >> 8;

    iVar12 = local_38[3] * 0x1c6 + -0xe251 >> 8;

    iVar13 = (int)*param_1;

    iVar15 = iVar2 + iVar13;

    local_38 = local_38 + 8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    iVar15 = (int)param_1[1];

    iVar2 = iVar2 + iVar15;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[3] = (char)iVar2;

    iVar3 = iVar15 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_4[4] = (char)iVar3;

    iVar15 = iVar15 + iVar4;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[5] = (char)iVar15;

    iVar2 = (int)param_1[2];

    iVar15 = iVar2 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    iVar15 = iVar2 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[7] = (char)iVar15;

    iVar2 = iVar2 + iVar7;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[8] = (char)iVar2;

    iVar15 = (int)param_1[3];

    iVar5 = iVar5 + iVar15;

    if (iVar5 < 0x100) {

      if (iVar5 < 0) {

        iVar5 = 0;

      }

    }

    else {

      iVar5 = 0xff;

    }

    param_4[9] = (char)iVar5;

    iVar6 = iVar15 - iVar6;

    if (iVar6 < 0x100) {

      if (iVar6 < 0) {

        iVar6 = 0;

      }

    }

    else {

      iVar6 = 0xff;

    }

    param_4[10] = (char)iVar6;

    iVar15 = iVar15 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xb] = (char)iVar15;

    iVar2 = (int)param_1[4];

    iVar15 = iVar2 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar2 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0xe] = (char)iVar2;

    iVar15 = (int)param_1[5];

    iVar8 = iVar8 + iVar15;

    if (iVar8 < 0x100) {

      if (iVar8 < 0) {

        iVar8 = 0;

      }

    }

    else {

      iVar8 = 0xff;

    }

    param_4[0xf] = (char)iVar8;

    iVar9 = iVar15 - iVar9;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_4[0x10] = (char)iVar9;

    iVar15 = iVar15 + iVar10;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x11] = (char)iVar15;

    iVar2 = (int)param_1[6];

    iVar15 = iVar2 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x12] = (char)iVar15;

    iVar15 = iVar2 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x13] = (char)iVar15;

    iVar2 = iVar2 + iVar12;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0x14] = (char)iVar2;

    iVar15 = (int)param_1[7];

    iVar14 = iVar14 + iVar15;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x15] = (char)iVar14;

    iVar11 = iVar15 - iVar11;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_4[0x16] = (char)iVar11;

    iVar15 = iVar15 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_1 = param_1 + 8;

    param_4[0x17] = (char)iVar15;

    local_50 = local_50 + 1;

    param_4 = param_4 + param_5;

  } while (local_50 < 8);

  return;

}





// --- FUN_00637f60 at 0x00637F60 (size: 765) ---


void FUN_00637f60(int param_1,short *param_2,short *param_3,int param_4,uint *param_5,int param_6)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  short local_ec [96];

  uint local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_2c = param_5[1];

  local_1c = local_2c * param_6 + param_4;

  iVar4 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_ec[iVar4 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar4 * 4 + 0x20] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_ec[iVar4 * 4 + 0x40] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_ec[iVar4 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar4 * 4 + 0x21] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_ec[iVar4 * 4 + 0x41] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_ec[iVar4 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar4 * 4 + 0x22] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_ec[iVar4 * 4 + 0x42] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_ec[iVar4 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_ec[iVar4 * 4 + 0x23] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_ec[iVar4 * 4 + 0x43] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar4 = iVar4 + 1;

  } while (iVar4 < 8);

  uVar6 = param_5[3];

  if ((int)local_2c < (int)uVar6) {

    uVar7 = param_5[2];

    local_28 = local_2c << 4;

    do {

      uVar8 = *param_5;

      if ((int)uVar8 < (int)uVar7) {

        local_24 = local_2c * 2;

        local_20 = param_1 + local_28;

        do {

          iVar4 = (int)*(short *)(param_1 + local_28 + uVar8 * 2);

          local_14 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_2c * 4;

          iVar5 = local_ec[local_14 + 0x40] + iVar4;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          iVar3 = uVar8 * 3;

          sVar1 = local_ec[local_14 + 0x20];

          *(char *)(iVar3 + local_1c) = (char)iVar5;

          iVar5 = iVar4 - sVar1;

          local_18 = iVar5;

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

              local_18 = 0;

            }

          }

          else {

            iVar5 = 0xff;

            local_18 = 0xff;

          }

          *(char *)(iVar3 + 1 + local_1c) = (char)iVar5;

          iVar4 = iVar4 + local_ec[local_14];

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          uVar8 = uVar8 + 1;

          *(char *)(iVar3 + 2 + local_1c) = (char)iVar4;

          uVar7 = param_5[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar6 = param_5[3];

      }

      local_1c = local_1c + param_6;

      local_28 = local_28 + 0x10;

      local_2c = local_2c + 1;

    } while ((int)local_2c < (int)uVar6);

  }

  return;

}





// --- FUN_00638280 at 0x00638280 (size: 1252) ---


void FUN_00638280(short *param_1,short *param_2,short *param_3,undefined1 *param_4,int param_5)



{

  short *psVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_50;

  short *local_3c;

  short *local_38;

  

  local_50 = 0;

  local_38 = param_3;

  local_3c = param_2;

  do {

    iVar2 = *local_38 * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_3c * 0x58 + -0x87f6 + *local_38 * 0xb7 >> 8;

    iVar4 = *local_3c * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_38[1] * 0x167 + -0xb2f5 >> 8;

    iVar6 = local_3c[1] * 0x58 + -0x87f6 + local_38[1] * 0xb7 >> 8;

    iVar7 = local_3c[1] * 0x1c6 + -0xe251 >> 8;

    iVar8 = local_38[2] * 0x167 + -0xb2f5 >> 8;

    iVar14 = local_3c[2] * 0x58 + -0x87f6 + local_38[2] * 0xb7 >> 8;

    iVar9 = local_3c[2] * 0x1c6 + -0xe251 >> 8;

    psVar1 = local_38 + 3;

    local_38 = local_38 + 8;

    iVar10 = *psVar1 * 0x167 + -0xb2f5 >> 8;

    iVar11 = local_3c[3] * 0x58 + -0x87f6 + *psVar1 * 0xb7 >> 8;

    iVar12 = local_3c[3] * 0x1c6 + -0xe251 >> 8;

    iVar13 = (int)*param_1;

    iVar15 = iVar4 + iVar13;

    local_3c = local_3c + 8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar2;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    iVar15 = (int)param_1[1];

    iVar4 = iVar4 + iVar15;

    if (iVar4 < 0x100) {

      if (iVar4 < 0) {

        iVar4 = 0;

      }

    }

    else {

      iVar4 = 0xff;

    }

    param_4[3] = (char)iVar4;

    iVar3 = iVar15 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_4[4] = (char)iVar3;

    iVar15 = iVar15 + iVar2;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[5] = (char)iVar15;

    iVar2 = (int)param_1[2];

    iVar15 = iVar2 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    iVar15 = iVar2 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[7] = (char)iVar15;

    iVar2 = iVar2 + iVar5;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[8] = (char)iVar2;

    iVar15 = (int)param_1[3];

    iVar7 = iVar7 + iVar15;

    if (iVar7 < 0x100) {

      if (iVar7 < 0) {

        iVar7 = 0;

      }

    }

    else {

      iVar7 = 0xff;

    }

    param_4[9] = (char)iVar7;

    iVar6 = iVar15 - iVar6;

    if (iVar6 < 0x100) {

      if (iVar6 < 0) {

        iVar6 = 0;

      }

    }

    else {

      iVar6 = 0xff;

    }

    param_4[10] = (char)iVar6;

    iVar15 = iVar15 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xb] = (char)iVar15;

    iVar2 = (int)param_1[4];

    iVar15 = iVar2 + iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar2 - iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar2 = iVar2 + iVar8;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0xe] = (char)iVar2;

    iVar15 = (int)param_1[5];

    iVar9 = iVar9 + iVar15;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_4[0xf] = (char)iVar9;

    iVar14 = iVar15 - iVar14;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x10] = (char)iVar14;

    iVar15 = iVar15 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x11] = (char)iVar15;

    iVar2 = (int)param_1[6];

    iVar15 = iVar2 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x12] = (char)iVar15;

    iVar15 = iVar2 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x13] = (char)iVar15;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0x14] = (char)iVar2;

    iVar15 = (int)param_1[7];

    iVar12 = iVar12 + iVar15;

    if (iVar12 < 0x100) {

      if (iVar12 < 0) {

        iVar12 = 0;

      }

    }

    else {

      iVar12 = 0xff;

    }

    param_4[0x15] = (char)iVar12;

    iVar11 = iVar15 - iVar11;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_4[0x16] = (char)iVar11;

    iVar15 = iVar15 + iVar10;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_1 = param_1 + 8;

    param_4[0x17] = (char)iVar15;

    local_50 = local_50 + 1;

    param_4 = param_4 + param_5;

  } while (local_50 < 8);

  return;

}





// --- FUN_00638aa0 at 0x00638AA0 (size: 320) ---


void FUN_00638aa0(int param_1,int param_2,int param_3,int param_4,int *param_5,int param_6)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  

  iVar5 = param_5[1];

  iVar6 = param_5[3];

  param_4 = iVar5 * param_6 + param_4;

  if (iVar5 < iVar6) {

    iVar1 = param_5[2];

    iVar2 = iVar5 * 8;

    do {

      iVar7 = *param_5;

      if (iVar7 < iVar1) {

        iVar6 = iVar7 + iVar2;

        do {

          iVar1 = (int)*(short *)(param_1 + iVar6 * 2);

          iVar4 = (int)*(short *)(param_3 + iVar6 * 2);

          iVar8 = (int)*(short *)(param_2 + iVar6 * 2);

          iVar3 = (short)((uint)(iVar4 * 0x167 + -0xb2f5) >> 8) + iVar1;

          if (iVar3 < 0x100) {

            if (iVar3 < 0) {

              iVar3 = 0;

            }

          }

          else {

            iVar3 = 0xff;

          }

          *(char *)(param_4 + iVar7 * 4) = (char)iVar3;

          iVar3 = iVar1 - (short)((uint)(iVar8 * 0x58 + -0x87f6 + iVar4 * 0xb7) >> 8);

          if (iVar3 < 0x100) {

            if (iVar3 < 0) {

              iVar3 = 0;

            }

          }

          else {

            iVar3 = 0xff;

          }

          *(char *)(param_4 + 1 + iVar7 * 4) = (char)iVar3;

          iVar1 = iVar1 + (short)((uint)(iVar8 * 0x1c6 + -0xe251) >> 8);

          if (iVar1 < 0x100) {

            if (iVar1 < 0) {

              iVar1 = 0;

            }

          }

          else {

            iVar1 = 0xff;

          }

          iVar6 = iVar6 + 1;

          *(char *)(param_4 + 2 + iVar7 * 4) = (char)iVar1;

          *(undefined1 *)(param_4 + 3 + iVar7 * 4) = 0xff;

          iVar7 = iVar7 + 1;

          iVar1 = param_5[2];

        } while (iVar7 < iVar1);

        iVar6 = param_5[3];

      }

      param_4 = param_4 + param_6;

      iVar2 = iVar2 + 8;

      iVar5 = iVar5 + 1;

    } while (iVar5 < iVar6);

  }

  return;

}





// --- FUN_00639430 at 0x00639430 (size: 702) ---


void FUN_00639430(int param_1,short *param_2,short *param_3,int param_4,uint *param_5,int param_6)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  short local_e4 [96];

  uint local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_24 = param_5[1];

  local_14 = local_24 * param_6 + param_4;

  iVar3 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_e4[iVar3 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_e4[iVar3 * 4 + 0x20] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_e4[iVar3 * 4 + 0x40] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_e4[iVar3 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_e4[iVar3 * 4 + 0x21] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_e4[iVar3 * 4 + 0x41] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_e4[iVar3 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_e4[iVar3 * 4 + 0x22] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_e4[iVar3 * 4 + 0x42] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_e4[iVar3 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_e4[iVar3 * 4 + 0x23] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_e4[iVar3 * 4 + 0x43] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar3 = iVar3 + 1;

  } while (iVar3 < 8);

  uVar5 = param_5[3];

  if ((int)local_24 < (int)uVar5) {

    uVar7 = param_5[2];

    local_20 = local_24 << 4;

    do {

      uVar8 = *param_5;

      if ((int)uVar8 < (int)uVar7) {

        local_1c = local_24 * 2;

        local_18 = param_1 + local_20;

        do {

          iVar4 = (int)*(short *)(param_1 + local_20 + uVar8 * 2);

          iVar3 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_24 * 4;

          iVar6 = local_e4[iVar3] + iVar4;

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          *(char *)(local_14 + uVar8 * 4) = (char)iVar6;

          iVar6 = iVar4 - local_e4[iVar3 + 0x20];

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          sVar1 = local_e4[iVar3 + 0x40];

          *(char *)(local_14 + 1 + uVar8 * 4) = (char)iVar6;

          iVar4 = iVar4 + sVar1;

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          *(char *)(local_14 + 2 + uVar8 * 4) = (char)iVar4;

          *(undefined1 *)(local_14 + 3 + uVar8 * 4) = 0xff;

          uVar8 = uVar8 + 1;

          uVar7 = param_5[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar5 = param_5[3];

      }

      local_14 = local_14 + param_6;

      local_20 = local_20 + 0x10;

      local_24 = local_24 + 1;

    } while ((int)local_24 < (int)uVar5);

  }

  return;

}





// --- FUN_00639710 at 0x00639710 (size: 1282) ---


void FUN_00639710(short *param_1,short *param_2,short *param_3,undefined1 *param_4,int param_5)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int local_50;

  short *local_3c;

  short *local_38;

  

  local_50 = 0;

  local_3c = param_3;

  local_38 = param_2;

  do {

    iVar1 = *local_3c * 0x167 + -0xb2f5 >> 8;

    iVar2 = *local_38 * 0x58 + -0x87f6 + *local_3c * 0xb7 >> 8;

    iVar3 = *local_38 * 0x1c6 + -0xe251 >> 8;

    iVar4 = local_3c[1] * 0x167 + -0xb2f5 >> 8;

    iVar5 = local_38[1] * 0x58 + -0x87f6 + local_3c[1] * 0xb7 >> 8;

    iVar6 = local_38[1] * 0x1c6 + -0xe251 >> 8;

    iVar12 = local_3c[2] * 0x167 + -0xb2f5 >> 8;

    iVar7 = local_38[2] * 0x58 + -0x87f6 + local_3c[2] * 0xb7 >> 8;

    iVar8 = local_38[2] * 0x1c6 + -0xe251 >> 8;

    iVar9 = local_3c[3] * 0x167 + -0xb2f5 >> 8;

    iVar13 = local_38[3] * 0x58 + -0x87f6 + local_3c[3] * 0xb7 >> 8;

    iVar10 = local_38[3] * 0x1c6 + -0xe251 >> 8;

    iVar11 = (int)*param_1;

    iVar14 = iVar1 + iVar11;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    *param_4 = (char)iVar14;

    iVar14 = iVar11 - iVar2;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[1] = (char)iVar14;

    iVar11 = iVar11 + iVar3;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_4[2] = (char)iVar11;

    param_4[3] = 0xff;

    iVar14 = (int)param_1[1];

    iVar1 = iVar1 + iVar14;

    if (iVar1 < 0x100) {

      if (iVar1 < 0) {

        iVar1 = 0;

      }

    }

    else {

      iVar1 = 0xff;

    }

    param_4[4] = (char)iVar1;

    iVar2 = iVar14 - iVar2;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[5] = (char)iVar2;

    iVar14 = iVar14 + iVar3;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[6] = (char)iVar14;

    param_4[7] = 0xff;

    iVar1 = (int)param_1[2];

    iVar14 = iVar1 + iVar4;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[8] = (char)iVar14;

    iVar14 = iVar1 - iVar5;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[9] = (char)iVar14;

    iVar1 = iVar1 + iVar6;

    if (iVar1 < 0x100) {

      if (iVar1 < 0) {

        iVar1 = 0;

      }

    }

    else {

      iVar1 = 0xff;

    }

    param_4[10] = (char)iVar1;

    param_4[0xb] = 0xff;

    iVar14 = (int)param_1[3];

    iVar4 = iVar4 + iVar14;

    if (iVar4 < 0x100) {

      if (iVar4 < 0) {

        iVar4 = 0;

      }

    }

    else {

      iVar4 = 0xff;

    }

    param_4[0xc] = (char)iVar4;

    iVar5 = iVar14 - iVar5;

    if (iVar5 < 0x100) {

      if (iVar5 < 0) {

        iVar5 = 0;

      }

    }

    else {

      iVar5 = 0xff;

    }

    param_4[0xd] = (char)iVar5;

    iVar14 = iVar14 + iVar6;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0xe] = (char)iVar14;

    param_4[0xf] = 0xff;

    iVar1 = (int)param_1[4];

    iVar14 = iVar1 + iVar12;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x10] = (char)iVar14;

    iVar14 = iVar1 - iVar7;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x11] = (char)iVar14;

    iVar1 = iVar1 + iVar8;

    if (iVar1 < 0x100) {

      if (iVar1 < 0) {

        iVar1 = 0;

      }

    }

    else {

      iVar1 = 0xff;

    }

    param_4[0x12] = (char)iVar1;

    param_4[0x13] = 0xff;

    iVar14 = (int)param_1[5];

    iVar12 = iVar12 + iVar14;

    if (iVar12 < 0x100) {

      if (iVar12 < 0) {

        iVar12 = 0;

      }

    }

    else {

      iVar12 = 0xff;

    }

    param_4[0x14] = (char)iVar12;

    iVar7 = iVar14 - iVar7;

    if (iVar7 < 0x100) {

      if (iVar7 < 0) {

        iVar7 = 0;

      }

    }

    else {

      iVar7 = 0xff;

    }

    param_4[0x15] = (char)iVar7;

    iVar14 = iVar14 + iVar8;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x16] = (char)iVar14;

    param_4[0x17] = 0xff;

    iVar1 = (int)param_1[6];

    iVar14 = iVar1 + iVar9;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x18] = (char)iVar14;

    iVar14 = iVar1 - iVar13;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x19] = (char)iVar14;

    iVar1 = iVar1 + iVar10;

    if (iVar1 < 0x100) {

      if (iVar1 < 0) {

        iVar1 = 0;

      }

    }

    else {

      iVar1 = 0xff;

    }

    param_4[0x1a] = (char)iVar1;

    param_4[0x1b] = 0xff;

    iVar14 = (int)param_1[7];

    iVar9 = iVar9 + iVar14;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_4[0x1c] = (char)iVar9;

    iVar13 = iVar14 - iVar13;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x1d] = (char)iVar13;

    iVar14 = iVar14 + iVar10;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_1 = param_1 + 8;

    param_4[0x1e] = (char)iVar14;

    local_50 = local_50 + 1;

    param_4[0x1f] = 0xff;

    local_38 = local_38 + 8;

    local_3c = local_3c + 8;

    param_4 = param_4 + param_5;

  } while (local_50 < 8);

  return;

}





// --- FUN_00639f30 at 0x00639F30 (size: 665) ---


void FUN_00639f30(int param_1,short *param_2,short *param_3,int param_4,uint *param_5,int param_6)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  short local_84 [48];

  uint local_24;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  

  local_24 = param_5[1];

  local_14 = local_24 * param_6 + param_4;

  iVar3 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_84[iVar3 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_84[iVar3 * 4 + 0x10] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_84[iVar3 * 4 + 0x20] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_84[iVar3 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_84[iVar3 * 4 + 0x11] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_84[iVar3 * 4 + 0x21] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_84[iVar3 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_84[iVar3 * 4 + 0x12] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_84[iVar3 * 4 + 0x22] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_84[iVar3 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_84[iVar3 * 4 + 0x13] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_84[iVar3 * 4 + 0x23] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar3 = iVar3 + 1;

  } while (iVar3 < 4);

  uVar5 = param_5[3];

  if ((int)local_24 < (int)uVar5) {

    uVar7 = param_5[2];

    local_20 = local_24 << 4;

    do {

      uVar8 = *param_5;

      if ((int)uVar8 < (int)uVar7) {

        local_1c = (int)(local_24 + (0x7fffffff < local_24)) >> 1;

        local_18 = param_1 + local_20;

        do {

          iVar4 = (int)*(short *)(param_1 + local_20 + uVar8 * 2);

          iVar3 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_1c * 4;

          iVar6 = local_84[iVar3] + iVar4;

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          *(char *)(local_14 + uVar8 * 4) = (char)iVar6;

          iVar6 = iVar4 - local_84[iVar3 + 0x10];

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          sVar1 = local_84[iVar3 + 0x20];

          *(char *)(local_14 + 1 + uVar8 * 4) = (char)iVar6;

          iVar4 = iVar4 + sVar1;

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          *(char *)(local_14 + 2 + uVar8 * 4) = (char)iVar4;

          *(undefined1 *)(local_14 + 3 + uVar8 * 4) = 0xff;

          uVar8 = uVar8 + 1;

          uVar7 = param_5[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar5 = param_5[3];

      }

      local_14 = local_14 + param_6;

      local_20 = local_20 + 0x10;

      local_24 = local_24 + 1;

    } while ((int)local_24 < (int)uVar5);

  }

  return;

}





// --- FUN_0063a1f0 at 0x0063A1F0 (size: 2041) ---


void FUN_0063a1f0(short *param_1,short *param_2,short *param_3,undefined1 *param_4,int param_5)



{

  short *psVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_48;

  short *local_34;

  short *local_30;

  

  local_48 = 0;

  local_34 = param_3;

  local_30 = param_2;

  do {

    iVar2 = *local_34 * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_30 * 0x58 + -0x87f6 + *local_34 * 0xb7 >> 8;

    iVar4 = *local_30 * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_34[1] * 0x167 + -0xb2f5 >> 8;

    iVar6 = local_30[1] * 0x58 + -0x87f6 + local_34[1] * 0xb7 >> 8;

    iVar7 = local_30[1] * 0x1c6 + -0xe251 >> 8;

    iVar8 = local_34[2] * 0x167 + -0xb2f5 >> 8;

    iVar9 = local_30[2] * 0x58 + -0x87f6 + local_34[2] * 0xb7 >> 8;

    iVar10 = local_30[2] * 0x1c6 + -0xe251 >> 8;

    iVar14 = local_34[3] * 0x167 + -0xb2f5 >> 8;

    psVar1 = local_30 + 3;

    iVar11 = *psVar1 * 0x58 + -0x87f6 + local_34[3] * 0xb7 >> 8;

    local_30 = local_30 + 8;

    iVar12 = *psVar1 * 0x1c6 + -0xe251 >> 8;

    iVar13 = (int)*param_1;

    iVar15 = iVar2 + iVar13;

    local_34 = local_34 + 8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    param_4[3] = 0xff;

    iVar13 = (int)param_1[1];

    iVar15 = iVar2 + iVar13;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[4] = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[5] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[6] = (char)iVar13;

    param_4[7] = 0xff;

    iVar13 = (int)param_1[2];

    iVar15 = iVar13 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[8] = (char)iVar15;

    iVar15 = iVar13 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[9] = (char)iVar15;

    iVar13 = iVar13 + iVar7;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[10] = (char)iVar13;

    param_4[0xb] = 0xff;

    iVar13 = (int)param_1[3];

    iVar15 = iVar13 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xc] = (char)iVar15;

    iVar15 = iVar13 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xd] = (char)iVar15;

    iVar13 = iVar13 + iVar7;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0xe] = (char)iVar13;

    param_4[0xf] = 0xff;

    iVar13 = (int)param_1[4];

    iVar15 = iVar13 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x10] = (char)iVar15;

    iVar15 = iVar13 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x11] = (char)iVar15;

    iVar13 = iVar13 + iVar10;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x12] = (char)iVar13;

    param_4[0x13] = 0xff;

    iVar13 = (int)param_1[5];

    iVar15 = iVar13 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x14] = (char)iVar15;

    iVar15 = iVar13 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x15] = (char)iVar15;

    iVar13 = iVar13 + iVar10;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x16] = (char)iVar13;

    param_4[0x17] = 0xff;

    iVar13 = (int)param_1[6];

    iVar15 = iVar13 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x18] = (char)iVar15;

    iVar15 = iVar13 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x19] = (char)iVar15;

    iVar13 = iVar13 + iVar12;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x1a] = (char)iVar13;

    param_4[0x1b] = 0xff;

    iVar13 = (int)param_1[7];

    iVar15 = iVar13 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x1c] = (char)iVar15;

    iVar15 = iVar13 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x1d] = (char)iVar15;

    iVar13 = iVar13 + iVar12;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[0x1e] = (char)iVar13;

    param_4[0x1f] = 0xff;

    param_4 = param_4 + param_5;

    iVar13 = (int)param_1[8];

    iVar15 = iVar2 + iVar13;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_4 = (char)iVar15;

    iVar15 = iVar13 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[1] = (char)iVar15;

    iVar13 = iVar13 + iVar4;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_4[2] = (char)iVar13;

    param_4[3] = 0xff;

    iVar15 = (int)param_1[9];

    iVar2 = iVar2 + iVar15;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[4] = (char)iVar2;

    iVar3 = iVar15 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_4[5] = (char)iVar3;

    iVar15 = iVar15 + iVar4;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[6] = (char)iVar15;

    param_4[7] = 0xff;

    iVar2 = (int)param_1[10];

    iVar15 = iVar2 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[8] = (char)iVar15;

    iVar15 = iVar2 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[9] = (char)iVar15;

    iVar2 = iVar2 + iVar7;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[10] = (char)iVar2;

    param_4[0xb] = 0xff;

    iVar15 = (int)param_1[0xb];

    iVar5 = iVar5 + iVar15;

    if (iVar5 < 0x100) {

      if (iVar5 < 0) {

        iVar5 = 0;

      }

    }

    else {

      iVar5 = 0xff;

    }

    param_4[0xc] = (char)iVar5;

    iVar6 = iVar15 - iVar6;

    if (iVar6 < 0x100) {

      if (iVar6 < 0) {

        iVar6 = 0;

      }

    }

    else {

      iVar6 = 0xff;

    }

    param_4[0xd] = (char)iVar6;

    iVar15 = iVar15 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0xe] = (char)iVar15;

    param_4[0xf] = 0xff;

    iVar2 = (int)param_1[0xc];

    iVar15 = iVar2 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x10] = (char)iVar15;

    iVar15 = iVar2 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x11] = (char)iVar15;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0x12] = (char)iVar2;

    param_4[0x13] = 0xff;

    iVar15 = (int)param_1[0xd];

    iVar8 = iVar8 + iVar15;

    if (iVar8 < 0x100) {

      if (iVar8 < 0) {

        iVar8 = 0;

      }

    }

    else {

      iVar8 = 0xff;

    }

    param_4[0x14] = (char)iVar8;

    iVar9 = iVar15 - iVar9;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_4[0x15] = (char)iVar9;

    iVar15 = iVar15 + iVar10;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x16] = (char)iVar15;

    param_4[0x17] = 0xff;

    iVar2 = (int)param_1[0xe];

    iVar15 = iVar2 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x18] = (char)iVar15;

    iVar15 = iVar2 - iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_4[0x19] = (char)iVar15;

    iVar2 = iVar2 + iVar12;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_4[0x1a] = (char)iVar2;

    param_4[0x1b] = 0xff;

    iVar15 = (int)param_1[0xf];

    iVar14 = iVar14 + iVar15;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_4[0x1c] = (char)iVar14;

    iVar11 = iVar15 - iVar11;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_4[0x1d] = (char)iVar11;

    iVar15 = iVar15 + iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_1 = param_1 + 0x10;

    param_4[0x1e] = (char)iVar15;

    local_48 = local_48 + 2;

    param_4[0x1f] = 0xff;

    param_4 = param_4 + param_5;

  } while (local_48 < 8);

  return;

}





// --- FUN_0063af40 at 0x0063AF40 (size: 392) ---


void FUN_0063af40(int param_1,int param_2,int param_3,int param_4,int param_5,int *param_6,

                 int param_7)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int local_18;

  

  iVar8 = param_6[1];

  iVar2 = param_6[3];

  param_5 = iVar8 * param_7 + param_5;

  if (iVar8 < iVar2) {

    iVar4 = param_6[2];

    iVar3 = iVar8 << 4;

    iVar1 = iVar8 * 8;

    do {

      iVar6 = *param_6;

      if (iVar6 < iVar4) {

        local_18 = iVar6 + iVar1;

        do {

          iVar5 = (int)*(short *)(param_1 + local_18 * 2);

          iVar2 = (int)*(short *)(param_3 + local_18 * 2);

          iVar7 = (int)*(short *)(param_2 + local_18 * 2);

          iVar4 = (short)((uint)(iVar2 * 0x167 + -0xb2f5) >> 8) + iVar5;

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          *(char *)(param_5 + iVar6 * 4) = -1 - (char)iVar4;

          iVar2 = iVar5 - (short)((uint)(iVar7 * 0x58 + -0x87f6 + iVar2 * 0xb7) >> 8);

          if (iVar2 < 0x100) {

            if (iVar2 < 0) {

              iVar2 = 0;

            }

          }

          else {

            iVar2 = 0xff;

          }

          *(char *)(param_5 + 1 + iVar6 * 4) = -1 - (char)iVar2;

          iVar5 = iVar5 + (short)((uint)(iVar7 * 0x1c6 + -0xe251) >> 8);

          if (iVar5 < 0x100) {

            if (iVar5 < 0) {

              iVar5 = 0;

            }

          }

          else {

            iVar5 = 0xff;

          }

          *(char *)(param_5 + 2 + iVar6 * 4) = -1 - (char)iVar5;

          *(undefined1 *)(param_5 + 3 + iVar6 * 4) = *(undefined1 *)(param_4 + iVar3 + iVar6 * 2);

          iVar6 = iVar6 + 1;

          iVar4 = param_6[2];

          local_18 = local_18 + 1;

        } while (iVar6 < iVar4);

        iVar2 = param_6[3];

      }

      param_5 = param_5 + param_7;

      iVar3 = iVar3 + 0x10;

      iVar1 = iVar1 + 8;

      iVar8 = iVar8 + 1;

    } while (iVar8 < iVar2);

  }

  return;

}





// --- FUN_0063bac0 at 0x0063BAC0 (size: 769) ---


void FUN_0063bac0(int param_1,short *param_2,short *param_3,int param_4,int param_5,uint *param_6,

                 int param_7)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  short local_ec [96];

  uint local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  

  local_2c = param_6[1];

  local_18 = local_2c * param_7 + param_5;

  iVar3 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_ec[iVar3 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar3 * 4 + 0x20] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_ec[iVar3 * 4 + 0x40] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_ec[iVar3 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar3 * 4 + 0x21] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_ec[iVar3 * 4 + 0x41] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_ec[iVar3 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_ec[iVar3 * 4 + 0x22] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_ec[iVar3 * 4 + 0x42] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_ec[iVar3 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_ec[iVar3 * 4 + 0x23] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_ec[iVar3 * 4 + 0x43] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar3 = iVar3 + 1;

  } while (iVar3 < 8);

  uVar5 = param_6[3];

  if ((int)local_2c < (int)uVar5) {

    uVar7 = param_6[2];

    local_28 = local_2c << 4;

    do {

      uVar8 = *param_6;

      if ((int)uVar8 < (int)uVar7) {

        local_24 = local_2c * 2;

        local_1c = param_4 + local_28;

        local_20 = local_28 + param_1;

        do {

          iVar4 = (int)*(short *)(local_28 + param_1 + uVar8 * 2);

          iVar3 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_2c * 4;

          iVar6 = local_ec[iVar3] + iVar4;

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          *(char *)(local_18 + uVar8 * 4) = -1 - (char)iVar6;

          iVar6 = iVar4 - local_ec[iVar3 + 0x20];

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          sVar1 = local_ec[iVar3 + 0x40];

          *(char *)(local_18 + 1 + uVar8 * 4) = -1 - (char)iVar6;

          iVar4 = iVar4 + sVar1;

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          *(char *)(local_18 + 2 + uVar8 * 4) = -1 - (char)iVar4;

          *(undefined1 *)(local_18 + 3 + uVar8 * 4) =

               *(undefined1 *)(param_4 + local_28 + uVar8 * 2);

          uVar8 = uVar8 + 1;

          uVar7 = param_6[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar5 = param_6[3];

      }

      local_18 = local_18 + param_7;

      local_28 = local_28 + 0x10;

      local_2c = local_2c + 1;

    } while ((int)local_2c < (int)uVar5);

  }

  return;

}





// --- FUN_0063bdd0 at 0x0063BDD0 (size: 1489) ---


void FUN_0063bdd0(short *param_1,short *param_2,short *param_3,char *param_4,char *param_5,

                 int param_6)



{

  char *pcVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_50;

  short *local_3c;

  short *local_38;

  char *local_24;

  

  local_50 = 0;

  local_24 = param_4;

  local_3c = param_3;

  local_38 = param_2;

  do {

    iVar2 = *local_3c * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_38 * 0x58 + -0x87f6 + *local_3c * 0xb7 >> 8;

    iVar4 = *local_38 * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_3c[1] * 0x167 + -0xb2f5 >> 8;

    iVar6 = local_38[1] * 0x58 + -0x87f6 + local_3c[1] * 0xb7 >> 8;

    iVar7 = local_38[1] * 0x1c6 + -0xe251 >> 8;

    iVar8 = local_3c[2] * 0x167 + -0xb2f5 >> 8;

    iVar9 = local_38[2] * 0x58 + -0x87f6 + local_3c[2] * 0xb7 >> 8;

    iVar10 = local_38[2] * 0x1c6 + -0xe251 >> 8;

    iVar11 = local_3c[3] * 0x167 + -0xb2f5 >> 8;

    iVar12 = local_38[3] * 0x58 + -0x87f6 + local_3c[3] * 0xb7 >> 8;

    iVar13 = local_38[3] * 0x1c6 + -0xe251 >> 8;

    local_38 = local_38 + 8;

    iVar14 = (int)*param_1;

    local_3c = local_3c + 8;

    iVar15 = iVar2 + iVar14;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    *param_5 = -1 - (char)iVar15;

    iVar15 = iVar14 - iVar3;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[1] = -1 - (char)iVar15;

    iVar14 = iVar14 + iVar4;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[2] = -1 - (char)iVar14;

    param_5[3] = *local_24;

    iVar15 = (int)param_1[1];

    iVar2 = iVar2 + iVar15;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[4] = -1 - (char)iVar2;

    iVar3 = iVar15 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_5[5] = -1 - (char)iVar3;

    iVar15 = iVar15 + iVar4;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[6] = -1 - (char)iVar15;

    param_5[7] = local_24[2];

    iVar2 = (int)param_1[2];

    iVar15 = iVar2 + iVar5;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[8] = -1 - (char)iVar15;

    iVar15 = iVar2 - iVar6;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[9] = -1 - (char)iVar15;

    iVar2 = iVar2 + iVar7;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[10] = -1 - (char)iVar2;

    param_5[0xb] = local_24[4];

    iVar15 = (int)param_1[3];

    iVar5 = iVar5 + iVar15;

    if (iVar5 < 0x100) {

      if (iVar5 < 0) {

        iVar5 = 0;

      }

    }

    else {

      iVar5 = 0xff;

    }

    param_5[0xc] = -1 - (char)iVar5;

    iVar6 = iVar15 - iVar6;

    if (iVar6 < 0x100) {

      if (iVar6 < 0) {

        iVar6 = 0;

      }

    }

    else {

      iVar6 = 0xff;

    }

    param_5[0xd] = -1 - (char)iVar6;

    iVar15 = iVar15 + iVar7;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0xe] = -1 - (char)iVar15;

    param_5[0xf] = local_24[6];

    iVar2 = (int)param_1[4];

    iVar15 = iVar2 + iVar8;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0x10] = -1 - (char)iVar15;

    iVar15 = iVar2 - iVar9;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0x11] = -1 - (char)iVar15;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[0x12] = -1 - (char)iVar2;

    param_5[0x13] = local_24[8];

    iVar15 = (int)param_1[5];

    iVar8 = iVar8 + iVar15;

    if (iVar8 < 0x100) {

      if (iVar8 < 0) {

        iVar8 = 0;

      }

    }

    else {

      iVar8 = 0xff;

    }

    param_5[0x14] = -1 - (char)iVar8;

    iVar9 = iVar15 - iVar9;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_5[0x15] = -1 - (char)iVar9;

    iVar15 = iVar15 + iVar10;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0x16] = -1 - (char)iVar15;

    param_5[0x17] = local_24[10];

    iVar2 = (int)param_1[6];

    iVar15 = iVar2 + iVar11;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0x18] = -1 - (char)iVar15;

    iVar15 = iVar2 - iVar12;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0x19] = -1 - (char)iVar15;

    iVar2 = iVar2 + iVar13;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[0x1a] = -1 - (char)iVar2;

    param_5[0x1b] = local_24[0xc];

    iVar15 = (int)param_1[7];

    iVar11 = iVar11 + iVar15;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[0x1c] = -1 - (char)iVar11;

    iVar12 = iVar15 - iVar12;

    if (iVar12 < 0x100) {

      if (iVar12 < 0) {

        iVar12 = 0;

      }

    }

    else {

      iVar12 = 0xff;

    }

    param_5[0x1d] = -1 - (char)iVar12;

    iVar15 = iVar15 + iVar13;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_1 = param_1 + 8;

    param_5[0x1e] = -1 - (char)iVar15;

    pcVar1 = local_24 + 0xe;

    local_24 = local_24 + 0x10;

    param_5[0x1f] = *pcVar1;

    local_50 = local_50 + 1;

    param_5 = param_5 + param_6;

  } while (local_50 < 8);

  return;

}





// --- FUN_0063c780 at 0x0063C780 (size: 713) ---


void FUN_0063c780(int param_1,short *param_2,short *param_3,int param_4,int param_5,uint *param_6,

                 int param_7)



{

  short sVar1;

  short sVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  short local_8c [48];

  uint local_2c;

  int local_28;

  int local_24;

  int local_20;

  int local_1c;

  int local_18;

  

  local_2c = param_6[1];

  local_18 = local_2c * param_7 + param_5;

  iVar3 = 0;

  do {

    sVar1 = *param_3;

    sVar2 = *param_2;

    local_8c[iVar3 * 4] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar3 * 4 + 0x10] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    local_8c[iVar3 * 4 + 0x20] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[1];

    sVar2 = param_2[1];

    local_8c[iVar3 * 4 + 1] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar3 * 4 + 0x11] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    sVar1 = param_2[2];

    local_8c[iVar3 * 4 + 0x21] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    sVar2 = param_3[2];

    local_8c[iVar3 * 4 + 2] = (short)((uint)(sVar2 * 0x167 + -0xb2f5) >> 8);

    local_8c[iVar3 * 4 + 0x12] = (short)((uint)(sVar1 * 0x58 + -0x87f6 + sVar2 * 0xb7) >> 8);

    local_8c[iVar3 * 4 + 0x22] = (short)((uint)(sVar1 * 0x1c6 + -0xe251) >> 8);

    sVar1 = param_3[3];

    sVar2 = param_2[3];

    local_8c[iVar3 * 4 + 3] = (short)((uint)(sVar1 * 0x167 + -0xb2f5) >> 8);

    param_2 = param_2 + 8;

    local_8c[iVar3 * 4 + 0x13] = (short)((uint)(sVar2 * 0x58 + -0x87f6 + sVar1 * 0xb7) >> 8);

    param_3 = param_3 + 8;

    local_8c[iVar3 * 4 + 0x23] = (short)((uint)(sVar2 * 0x1c6 + -0xe251) >> 8);

    iVar3 = iVar3 + 1;

  } while (iVar3 < 4);

  uVar5 = param_6[3];

  if ((int)local_2c < (int)uVar5) {

    uVar7 = param_6[2];

    local_28 = local_2c << 4;

    do {

      uVar8 = *param_6;

      if ((int)uVar8 < (int)uVar7) {

        local_24 = (int)(local_2c + (0x7fffffff < local_2c)) >> 1;

        local_1c = param_4 + local_28;

        local_20 = local_28 + param_1;

        do {

          iVar4 = (int)*(short *)(local_28 + param_1 + uVar8 * 2);

          iVar3 = ((int)(uVar8 + (0x7fffffff < uVar8)) >> 1) + local_24 * 4;

          iVar6 = local_8c[iVar3] + iVar4;

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          *(char *)(local_18 + uVar8 * 4) = -1 - (char)iVar6;

          iVar6 = iVar4 - local_8c[iVar3 + 0x10];

          if (iVar6 < 0x100) {

            if (iVar6 < 0) {

              iVar6 = 0;

            }

          }

          else {

            iVar6 = 0xff;

          }

          sVar1 = local_8c[iVar3 + 0x20];

          *(char *)(local_18 + 1 + uVar8 * 4) = -1 - (char)iVar6;

          iVar4 = iVar4 + sVar1;

          if (iVar4 < 0x100) {

            if (iVar4 < 0) {

              iVar4 = 0;

            }

          }

          else {

            iVar4 = 0xff;

          }

          *(char *)(local_18 + 2 + uVar8 * 4) = -1 - (char)iVar4;

          *(undefined1 *)(local_18 + 3 + uVar8 * 4) =

               *(undefined1 *)(param_4 + local_28 + uVar8 * 2);

          uVar8 = uVar8 + 1;

          uVar7 = param_6[2];

        } while ((int)uVar8 < (int)uVar7);

        uVar5 = param_6[3];

      }

      local_18 = local_18 + param_7;

      local_28 = local_28 + 0x10;

      local_2c = local_2c + 1;

    } while ((int)local_2c < (int)uVar5);

  }

  return;

}





// --- FUN_0063ca70 at 0x0063CA70 (size: 2420) ---


void FUN_0063ca70(short *param_1,short *param_2,short *param_3,char *param_4,char *param_5,

                 int param_6)



{

  char *pcVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  int iVar11;

  int iVar12;

  int iVar13;

  int iVar14;

  int iVar15;

  int local_50;

  short *local_3c;

  short *local_38;

  short *local_14;

  

  local_50 = 0;

  local_3c = param_3;

  local_38 = param_2;

  local_14 = param_1;

  do {

    iVar2 = *local_3c * 0x167 + -0xb2f5 >> 8;

    iVar3 = *local_38 * 0x58 + -0x87f6 + *local_3c * 0xb7 >> 8;

    iVar4 = *local_38 * 0x1c6 + -0xe251 >> 8;

    iVar5 = local_3c[1] * 0x167 + -0xb2f5 >> 8;

    iVar13 = local_38[1] * 0x58 + -0x87f6 + local_3c[1] * 0xb7 >> 8;

    iVar6 = local_38[1] * 0x1c6 + -0xe251 >> 8;

    iVar7 = local_3c[2] * 0x167 + -0xb2f5 >> 8;

    iVar12 = local_38[2] * 0x58 + -0x87f6 + local_3c[2] * 0xb7 >> 8;

    iVar8 = local_38[2] * 0x1c6 + -0xe251 >> 8;

    iVar9 = local_3c[3] * 0x167 + -0xb2f5 >> 8;

    iVar15 = local_38[3] * 0x58 + -0x87f6 + local_3c[3] * 0xb7 >> 8;

    iVar10 = local_38[3] * 0x1c6 + -0xe251 >> 8;

    local_38 = local_38 + 8;

    iVar11 = (int)*local_14;

    local_3c = local_3c + 8;

    iVar14 = iVar2 + iVar11;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    *param_5 = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar3;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[1] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar4;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[2] = -1 - (char)iVar11;

    param_5[3] = *param_4;

    iVar11 = (int)local_14[1];

    iVar14 = iVar2 + iVar11;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[4] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar3;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[5] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar4;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[6] = -1 - (char)iVar11;

    param_5[7] = param_4[2];

    iVar11 = (int)local_14[2];

    iVar14 = iVar11 + iVar5;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[8] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar13;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[9] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar6;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[10] = -1 - (char)iVar11;

    param_5[0xb] = param_4[4];

    iVar11 = (int)local_14[3];

    iVar14 = iVar11 + iVar5;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0xc] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar13;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0xd] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar6;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[0xe] = -1 - (char)iVar11;

    param_5[0xf] = param_4[6];

    iVar11 = (int)local_14[4];

    iVar14 = iVar11 + iVar7;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x10] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar12;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x11] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar8;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[0x12] = -1 - (char)iVar11;

    param_5[0x13] = param_4[8];

    iVar11 = (int)local_14[5];

    iVar14 = iVar11 + iVar7;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x14] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar12;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x15] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar8;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[0x16] = -1 - (char)iVar11;

    param_5[0x17] = param_4[10];

    iVar11 = (int)local_14[6];

    iVar14 = iVar11 + iVar9;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x18] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar15;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x19] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar10;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[0x1a] = -1 - (char)iVar11;

    param_5[0x1b] = param_4[0xc];

    iVar11 = (int)local_14[7];

    iVar14 = iVar11 + iVar9;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x1c] = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar15;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x1d] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar10;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[0x1e] = -1 - (char)iVar11;

    param_5[0x1f] = param_4[0xe];

    iVar11 = (int)local_14[8];

    iVar14 = iVar2 + iVar11;

    param_5 = param_5 + param_6;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    *param_5 = -1 - (char)iVar14;

    iVar14 = iVar11 - iVar3;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[1] = -1 - (char)iVar14;

    iVar11 = iVar11 + iVar4;

    if (iVar11 < 0x100) {

      if (iVar11 < 0) {

        iVar11 = 0;

      }

    }

    else {

      iVar11 = 0xff;

    }

    param_5[2] = -1 - (char)iVar11;

    param_5[3] = param_4[0x10];

    iVar14 = (int)local_14[9];

    iVar2 = iVar2 + iVar14;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[4] = -1 - (char)iVar2;

    iVar3 = iVar14 - iVar3;

    if (iVar3 < 0x100) {

      if (iVar3 < 0) {

        iVar3 = 0;

      }

    }

    else {

      iVar3 = 0xff;

    }

    param_5[5] = -1 - (char)iVar3;

    iVar14 = iVar14 + iVar4;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[6] = -1 - (char)iVar14;

    param_5[7] = param_4[0x12];

    iVar2 = (int)local_14[10];

    iVar14 = iVar2 + iVar5;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[8] = -1 - (char)iVar14;

    iVar14 = iVar2 - iVar13;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[9] = -1 - (char)iVar14;

    iVar2 = iVar2 + iVar6;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[10] = -1 - (char)iVar2;

    param_5[0xb] = param_4[0x14];

    iVar14 = (int)local_14[0xb];

    iVar5 = iVar5 + iVar14;

    if (iVar5 < 0x100) {

      if (iVar5 < 0) {

        iVar5 = 0;

      }

    }

    else {

      iVar5 = 0xff;

    }

    param_5[0xc] = -1 - (char)iVar5;

    iVar13 = iVar14 - iVar13;

    if (iVar13 < 0x100) {

      if (iVar13 < 0) {

        iVar13 = 0;

      }

    }

    else {

      iVar13 = 0xff;

    }

    param_5[0xd] = -1 - (char)iVar13;

    iVar14 = iVar14 + iVar6;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0xe] = -1 - (char)iVar14;

    param_5[0xf] = param_4[0x16];

    iVar2 = (int)local_14[0xc];

    iVar14 = iVar2 + iVar7;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x10] = -1 - (char)iVar14;

    iVar14 = iVar2 - iVar12;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x11] = -1 - (char)iVar14;

    iVar2 = iVar2 + iVar8;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[0x12] = -1 - (char)iVar2;

    param_5[0x13] = param_4[0x18];

    iVar14 = (int)local_14[0xd];

    iVar7 = iVar7 + iVar14;

    if (iVar7 < 0x100) {

      if (iVar7 < 0) {

        iVar7 = 0;

      }

    }

    else {

      iVar7 = 0xff;

    }

    param_5[0x14] = -1 - (char)iVar7;

    iVar12 = iVar14 - iVar12;

    if (iVar12 < 0x100) {

      if (iVar12 < 0) {

        iVar12 = 0;

      }

    }

    else {

      iVar12 = 0xff;

    }

    param_5[0x15] = -1 - (char)iVar12;

    iVar14 = iVar14 + iVar8;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x16] = -1 - (char)iVar14;

    param_5[0x17] = param_4[0x1a];

    iVar2 = (int)local_14[0xe];

    iVar14 = iVar2 + iVar9;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x18] = -1 - (char)iVar14;

    iVar14 = iVar2 - iVar15;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    param_5[0x19] = -1 - (char)iVar14;

    iVar2 = iVar2 + iVar10;

    if (iVar2 < 0x100) {

      if (iVar2 < 0) {

        iVar2 = 0;

      }

    }

    else {

      iVar2 = 0xff;

    }

    param_5[0x1a] = -1 - (char)iVar2;

    param_5[0x1b] = param_4[0x1c];

    iVar14 = (int)local_14[0xf];

    iVar9 = iVar9 + iVar14;

    if (iVar9 < 0x100) {

      if (iVar9 < 0) {

        iVar9 = 0;

      }

    }

    else {

      iVar9 = 0xff;

    }

    param_5[0x1c] = -1 - (char)iVar9;

    iVar15 = iVar14 - iVar15;

    if (iVar15 < 0x100) {

      if (iVar15 < 0) {

        iVar15 = 0;

      }

    }

    else {

      iVar15 = 0xff;

    }

    param_5[0x1d] = -1 - (char)iVar15;

    iVar14 = iVar14 + iVar10;

    if (iVar14 < 0x100) {

      if (iVar14 < 0) {

        iVar14 = 0;

      }

    }

    else {

      iVar14 = 0xff;

    }

    local_50 = local_50 + 2;

    param_5[0x1e] = -1 - (char)iVar14;

    pcVar1 = param_4 + 0x1e;

    param_4 = param_4 + 0x20;

    param_5[0x1f] = *pcVar1;

    param_5 = param_5 + param_6;

    local_14 = local_14 + 0x10;

  } while (local_50 < 8);

  return;

}





// --- FUN_0063da90 at 0x0063DA90 (size: 166) ---


void FUN_0063da90(int param_1,int param_2,int param_3,int param_4,int *param_5,int param_6)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  

  iVar5 = param_5[1];

  iVar3 = param_5[3];

  param_4 = iVar5 * param_6 + param_4;

  if (iVar5 < iVar3) {

    iVar1 = param_5[2];

    iVar4 = iVar5 * 8;

    do {

      iVar2 = *param_5;

      if (iVar2 < iVar1) {

        iVar3 = iVar2 + iVar4;

        do {

          *(undefined1 *)(param_4 + iVar2 * 4) = *(undefined1 *)(param_1 + iVar3 * 2);

          *(undefined1 *)(param_4 + 1 + iVar2 * 4) = *(undefined1 *)(param_2 + iVar3 * 2);

          iVar1 = iVar3 * 2;

          iVar3 = iVar3 + 1;

          *(undefined1 *)(param_4 + 2 + iVar2 * 4) = *(undefined1 *)(param_3 + iVar1);

          *(undefined1 *)(param_4 + 3 + iVar2 * 4) = 0xff;

          iVar2 = iVar2 + 1;

          iVar1 = param_5[2];

        } while (iVar2 < iVar1);

        iVar3 = param_5[3];

      }

      param_4 = param_4 + param_6;

      iVar4 = iVar4 + 8;

      iVar5 = iVar5 + 1;

    } while (iVar5 < iVar3);

  }

  return;

}





// --- FUN_0063de40 at 0x0063DE40 (size: 178) ---


void FUN_0063de40(int param_1,int param_2,int param_3,int param_4,int param_5,int *param_6,

                 int param_7)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  

  iVar3 = param_6[1];

  iVar4 = param_6[3];

  param_5 = iVar3 * param_7 + param_5;

  if (iVar3 < iVar4) {

    iVar2 = param_6[2];

    iVar1 = iVar3 * 8;

    do {

      iVar5 = *param_6;

      if (iVar5 < iVar2) {

        iVar4 = iVar5 + iVar1;

        do {

          *(undefined1 *)(param_5 + iVar5 * 4) = *(undefined1 *)(param_1 + iVar4 * 2);

          *(undefined1 *)(param_5 + 1 + iVar5 * 4) = *(undefined1 *)(param_2 + iVar4 * 2);

          *(undefined1 *)(param_5 + 2 + iVar5 * 4) = *(undefined1 *)(param_3 + iVar4 * 2);

          *(undefined1 *)(param_5 + 3 + iVar5 * 4) = *(undefined1 *)(param_4 + iVar4 * 2);

          iVar4 = iVar4 + 1;

          iVar5 = iVar5 + 1;

          iVar2 = param_6[2];

        } while (iVar5 < iVar2);

        iVar4 = param_6[3];

      }

      param_5 = param_5 + param_7;

      iVar1 = iVar1 + 8;

      iVar3 = iVar3 + 1;

    } while (iVar3 < iVar4);

  }

  return;

}





// --- FUN_0063e230 at 0x0063E230 (size: 182) ---


void FUN_0063e230(int param_1,int param_2,int param_3,int param_4,int *param_5,int param_6)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int local_1c;

  

  iVar2 = param_5[1];

  param_1 = param_1 + iVar2 * 0x10;

  param_2 = param_2 + iVar2 * 0x10;

  param_4 = iVar2 * param_6 + param_4;

  local_1c = param_3 + iVar2 * 0x10;

  iVar3 = param_5[3];

  if (iVar2 < iVar3) {

    iVar1 = param_5[2];

    do {

      iVar4 = *param_5;

      if (iVar4 < iVar1) {

        iVar3 = iVar4 * 3;

        do {

          *(undefined1 *)(iVar3 + param_4) = *(undefined1 *)(param_1 + iVar4 * 2);

          *(undefined1 *)(iVar3 + 1 + param_4) = *(undefined1 *)(param_2 + iVar4 * 2);

          iVar1 = iVar4 * 2;

          iVar4 = iVar4 + 1;

          *(undefined1 *)(iVar3 + 2 + param_4) = *(undefined1 *)(local_1c + iVar1);

          iVar3 = iVar3 + 3;

          iVar1 = param_5[2];

        } while (iVar4 < iVar1);

        iVar3 = param_5[3];

      }

      param_1 = param_1 + 0x10;

      param_2 = param_2 + 0x10;

      iVar2 = iVar2 + 1;

      local_1c = local_1c + 0x10;

      param_4 = param_4 + param_6;

    } while (iVar2 < iVar3);

  }

  return;

}





// --- FUN_0063e2f0 at 0x0063E2F0 (size: 254) ---


void FUN_0063e2f0(undefined1 *param_1,undefined1 *param_2,undefined1 *param_3,undefined1 *param_4,

                 int param_5)



{

  undefined1 *puVar1;

  undefined1 *local_18;

  int local_14;

  undefined1 *local_10;

  

  local_14 = 0;

  local_18 = param_4;

  local_10 = param_3;

  do {

    *local_18 = *param_1;

    local_18[1] = *param_2;

    local_18[2] = *local_10;

    local_18[3] = param_1[2];

    local_18[4] = param_2[2];

    local_18[5] = local_10[2];

    local_18[6] = param_1[4];

    local_18[7] = param_2[4];

    local_18[8] = local_10[4];

    local_18[9] = param_1[6];

    local_18[10] = param_2[6];

    local_18[0xb] = local_10[6];

    local_18[0xc] = param_1[8];

    local_18[0xd] = param_2[8];

    local_18[0xe] = local_10[8];

    local_18[0xf] = param_1[10];

    local_18[0x10] = param_2[10];

    local_18[0x11] = local_10[10];

    local_18[0x12] = param_1[0xc];

    local_18[0x13] = param_2[0xc];

    local_18[0x14] = local_10[0xc];

    puVar1 = param_1 + 0xe;

    param_1 = param_1 + 0x10;

    local_18[0x15] = *puVar1;

    puVar1 = param_2 + 0xe;

    param_2 = param_2 + 0x10;

    local_18[0x16] = *puVar1;

    local_18[0x17] = local_10[0xe];

    local_14 = local_14 + 1;

    local_10 = local_10 + 0x10;

    local_18 = local_18 + param_5;

  } while (local_14 < 8);

  return;

}





// --- FUN_0063e570 at 0x0063E570 (size: 237) ---


void FUN_0063e570(int param_1,int param_2,int param_3,int param_4,uint *param_5,int param_6)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  uint uVar7;

  int local_1c;

  int local_18;

  

  uVar4 = param_5[1];

  iVar6 = (int)(uVar4 + (0x7fffffff < uVar4)) >> 1;

  param_4 = uVar4 * param_6 + param_4;

  local_18 = param_2 + iVar6 * 0x10;

  local_1c = param_3 + iVar6 * 0x10;

  param_1 = uVar4 * 0x10 + param_1;

  uVar2 = param_5[3];

  if ((int)uVar4 < (int)uVar2) {

    uVar5 = param_5[2];

    do {

      uVar7 = *param_5;

      if ((int)uVar7 < (int)uVar5) {

        iVar6 = uVar7 * 3;

        do {

          iVar1 = uVar7 * 2;

          iVar3 = (int)(uVar7 + (0x7fffffff < uVar7)) >> 1;

          uVar7 = uVar7 + 1;

          *(undefined1 *)(iVar6 + param_4) = *(undefined1 *)(param_1 + iVar1);

          *(undefined1 *)(iVar6 + 1 + param_4) = *(undefined1 *)(local_18 + iVar3 * 2);

          *(undefined1 *)(iVar6 + 2 + param_4) = *(undefined1 *)(local_1c + iVar3 * 2);

          iVar6 = iVar6 + 3;

          uVar5 = param_5[2];

        } while ((int)uVar7 < (int)uVar5);

        uVar2 = param_5[3];

      }

      param_1 = param_1 + 0x10;

      local_18 = local_18 + (uVar4 & 1) * 0x10;

      local_1c = local_1c + (uVar4 & 1) * 0x10;

      uVar4 = uVar4 + 1;

      param_4 = param_4 + param_6;

    } while ((int)uVar4 < (int)uVar2);

  }

  return;

}





// --- FUN_0063e660 at 0x0063E660 (size: 411) ---


void FUN_0063e660(undefined1 *param_1,undefined1 *param_2,undefined1 *param_3,undefined1 *param_4,

                 int param_5)



{

  undefined1 *puVar1;

  undefined1 *local_18;

  int local_14;

  undefined1 *local_10;

  

  local_14 = 0;

  local_18 = param_4;

  local_10 = param_3;

  do {

    *local_18 = *param_1;

    local_18[1] = *param_2;

    local_18[2] = *local_10;

    local_18[3] = param_1[2];

    local_18[4] = *param_2;

    local_18[5] = *local_10;

    local_18[6] = param_1[4];

    local_18[7] = param_2[2];

    local_18[8] = local_10[2];

    local_18[9] = param_1[6];

    local_18[10] = param_2[2];

    local_18[0xb] = local_10[2];

    local_18[0xc] = param_1[8];

    local_18[0xd] = param_2[4];

    local_18[0xe] = local_10[4];

    local_18[0xf] = param_1[10];

    local_18[0x10] = param_2[4];

    local_18[0x11] = local_10[4];

    local_18[0x12] = param_1[0xc];

    local_18[0x13] = param_2[6];

    local_18[0x14] = local_10[6];

    local_18[0x15] = param_1[0xe];

    local_18[0x16] = param_2[6];

    local_18[0x17] = local_10[6];

    local_18 = local_18 + param_5;

    *local_18 = param_1[0x10];

    local_18[1] = *param_2;

    local_18[2] = *local_10;

    local_18[3] = param_1[0x12];

    local_18[4] = *param_2;

    local_18[5] = *local_10;

    local_18[6] = param_1[0x14];

    local_18[7] = param_2[2];

    local_18[8] = local_10[2];

    local_18[9] = param_1[0x16];

    local_18[10] = param_2[2];

    local_18[0xb] = local_10[2];

    local_18[0xc] = param_1[0x18];

    local_18[0xd] = param_2[4];

    local_18[0xe] = local_10[4];

    local_18[0xf] = param_1[0x1a];

    local_18[0x10] = param_2[4];

    local_18[0x11] = local_10[4];

    local_18[0x12] = param_1[0x1c];

    local_18[0x13] = param_2[6];

    local_18[0x14] = local_10[6];

    puVar1 = param_1 + 0x1e;

    param_1 = param_1 + 0x20;

    local_18[0x15] = *puVar1;

    puVar1 = param_2 + 6;

    param_2 = param_2 + 0x10;

    local_18[0x16] = *puVar1;

    local_18[0x17] = local_10[6];

    local_14 = local_14 + 1;

    local_10 = local_10 + 0x10;

    local_18 = local_18 + param_5;

  } while (local_14 < 4);

  return;

}





// --- FUN_0063ec90 at 0x0063EC90 (size: 198) ---


void FUN_0063ec90(int param_1,int param_2,int param_3,int param_4,uint *param_5,int param_6)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  uint uVar7;

  int local_1c;

  

  uVar4 = param_5[1];

  param_1 = param_1 + uVar4 * 0x10;

  param_2 = param_2 + uVar4 * 0x10;

  param_4 = uVar4 * param_6 + param_4;

  local_1c = param_3 + uVar4 * 0x10;

  uVar6 = param_5[3];

  if ((int)uVar4 < (int)uVar6) {

    uVar2 = param_5[2];

    do {

      uVar7 = *param_5;

      if ((int)uVar7 < (int)uVar2) {

        iVar5 = uVar7 * 3;

        do {

          iVar1 = uVar7 * 2;

          iVar3 = (int)(uVar7 + (0x7fffffff < uVar7)) >> 1;

          uVar7 = uVar7 + 1;

          *(undefined1 *)(iVar5 + param_4) = *(undefined1 *)(param_1 + iVar1);

          *(undefined1 *)(iVar5 + 1 + param_4) = *(undefined1 *)(param_2 + iVar3 * 2);

          *(undefined1 *)(iVar5 + 2 + param_4) = *(undefined1 *)(local_1c + iVar3 * 2);

          iVar5 = iVar5 + 3;

          uVar2 = param_5[2];

        } while ((int)uVar7 < (int)uVar2);

        uVar6 = param_5[3];

      }

      param_1 = param_1 + 0x10;

      param_2 = param_2 + 0x10;

      uVar4 = uVar4 + 1;

      local_1c = local_1c + 0x10;

      param_4 = param_4 + param_6;

    } while ((int)uVar4 < (int)uVar6);

  }

  return;

}





// --- FUN_0063ed60 at 0x0063ED60 (size: 252) ---


void FUN_0063ed60(undefined1 *param_1,undefined1 *param_2,undefined1 *param_3,undefined1 *param_4,

                 int param_5)



{

  undefined1 *puVar1;

  undefined1 *local_18;

  int local_14;

  undefined1 *local_10;

  

  local_14 = 0;

  local_18 = param_4;

  local_10 = param_3;

  do {

    *local_18 = *param_1;

    local_18[1] = *param_2;

    local_18[2] = *local_10;

    local_18[3] = param_1[2];

    local_18[4] = *param_2;

    local_18[5] = *local_10;

    local_18[6] = param_1[4];

    local_18[7] = param_2[2];

    local_18[8] = local_10[2];

    local_18[9] = param_1[6];

    local_18[10] = param_2[2];

    local_18[0xb] = local_10[2];

    local_18[0xc] = param_1[8];

    local_18[0xd] = param_2[4];

    local_18[0xe] = local_10[4];

    local_18[0xf] = param_1[10];

    local_18[0x10] = param_2[4];

    local_18[0x11] = local_10[4];

    local_18[0x12] = param_1[0xc];

    local_18[0x13] = param_2[6];

    local_18[0x14] = local_10[6];

    puVar1 = param_1 + 0xe;

    param_1 = param_1 + 0x10;

    local_18[0x15] = *puVar1;

    puVar1 = param_2 + 6;

    param_2 = param_2 + 0x10;

    local_18[0x16] = *puVar1;

    local_18[0x17] = local_10[6];

    local_14 = local_14 + 1;

    local_10 = local_10 + 0x10;

    local_18 = local_18 + param_5;

  } while (local_14 < 8);

  return;

}





// --- FUN_0063f120 at 0x0063F120 (size: 212) ---


void FUN_0063f120(int param_1,int param_2,int param_3,int param_4,uint *param_5,int param_6)



{

  undefined1 uVar1;

  uint uVar2;

  uint uVar3;

  uint uVar4;

  int iVar5;

  uint uVar6;

  int local_18;

  

  uVar4 = param_5[1];

  param_1 = param_1 + uVar4 * 0x10;

  param_2 = param_2 + uVar4 * 0x10;

  param_4 = uVar4 * param_6 + param_4;

  local_18 = param_3 + uVar4 * 0x10;

  uVar6 = param_5[3];

  if ((int)uVar4 < (int)uVar6) {

    uVar2 = param_5[2];

    do {

      uVar3 = *param_5;

      if ((int)uVar3 < (int)uVar2) {

        do {

          iVar5 = (int)(uVar3 + (0x7fffffff < uVar3)) >> 1;

          *(undefined1 *)(param_4 + uVar3 * 2) = *(undefined1 *)(param_1 + uVar3 * 2);

          if ((uVar3 & 1) == 0) {

            uVar1 = (undefined1)*(undefined2 *)(param_2 + iVar5 * 2);

          }

          else {

            uVar1 = (undefined1)*(undefined2 *)(local_18 + iVar5 * 2);

          }

          *(undefined1 *)(param_4 + 1 + uVar3 * 2) = uVar1;

          uVar3 = uVar3 + 1;

          uVar2 = param_5[2];

        } while ((int)uVar3 < (int)uVar2);

        uVar6 = param_5[3];

      }

      param_1 = param_1 + 0x10;

      param_2 = param_2 + 0x10;

      uVar4 = uVar4 + 1;

      local_18 = local_18 + 0x10;

      param_4 = param_4 + param_6;

    } while ((int)uVar4 < (int)uVar6);

  }

  return;

}





// --- FUN_0063f5a0 at 0x0063F5A0 (size: 126) ---


void FUN_0063f5a0(int param_1,int param_2,int *param_3,int param_4)



{

  short sVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  

  iVar6 = param_3[1];

  iVar3 = param_3[3];

  param_2 = iVar6 * param_4 + param_2;

  if (iVar6 < iVar3) {

    iVar2 = param_3[2];

    iVar4 = iVar6 << 4;

    do {

      iVar5 = *param_3;

      if (iVar5 < iVar2) {

        do {

          sVar1 = *(short *)(param_1 + iVar4 + iVar5 * 2);

          if (sVar1 < 0x100) {

            if (sVar1 < 0) {

              sVar1 = 0;

            }

          }

          else {

            sVar1 = 0xff;

          }

          *(char *)(iVar5 + param_2) = (char)sVar1;

          iVar5 = iVar5 + 1;

          iVar2 = param_3[2];

        } while (iVar5 < iVar2);

        iVar3 = param_3[3];

      }

      param_2 = param_2 + param_4;

      iVar4 = iVar4 + 0x10;

      iVar6 = iVar6 + 1;

    } while (iVar6 < iVar3);

  }

  return;

}





// --- FUN_0063fc40 at 0x0063FC40 (size: 4784) ---


/* WARNING: Type propagation algorithm not settling */



void FUN_0063fc40(int param_1,int param_2,undefined4 param_3)



{

  short sVar1;

  short sVar2;

  short sVar3;

  short sVar4;

  short sVar5;

  short sVar6;

  int *piVar7;

  undefined1 uVar8;

  int iVar9;

  int iVar10;

  undefined1 *puVar11;

  undefined1 *puVar12;

  byte bVar13;

  undefined1 *puVar14;

  int iVar15;

  short *psVar16;

  int iVar17;

  short *psVar18;

  int iVar19;

  int iVar20;

  int iVar21;

  undefined1 *puVar22;

  undefined1 local_5ac [1280];

  undefined1 local_ac [16];

  undefined1 *local_9c;

  int local_98;

  int local_94;

  int local_90;

  int local_8c;

  int local_88;

  char local_84;

  short *local_80;

  short *local_7c;

  int local_78;

  int local_74;

  int local_70;

  int local_6c;

  short *local_68;

  short *local_64;

  uint local_60;

  uint local_5c;

  int local_58;

  undefined1 *local_54;

  uint local_50;

  int local_4c;

  undefined1 *local_48;

  undefined1 *local_44;

  undefined1 *local_40;

  int local_3c;

  int local_38;

  undefined1 *local_34;

  int local_30;

  undefined1 *local_2c;

  undefined1 *local_28;

  int local_24;

  undefined1 *local_20;

  int local_1c;

  int local_18;

  

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

    local_94 = *(int *)(param_1 + 0x30);

    if (local_94 <= *(int *)(param_1 + 0x3820)) {

      return;

    }

    iVar20 = (*(int **)(param_1 + 0x37e0))[0xd];

    local_90 = *(int *)(param_1 + 0x37b8);

    iVar9 = local_90 / *(int *)(iVar20 + 4);

    local_8c = *(int *)(param_1 + 0x37bc);

    iVar20 = local_8c / *(int *)(iVar20 + 8);

  }

  else {

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

    iVar20 = *(int *)(param_1 + 0x37bc);

    local_94 = *(int *)(param_1 + 0x30);

    local_90 = iVar9;

    local_8c = iVar20;

  }

  iVar9 = iVar9 * 8;

  local_80 = *(short **)(param_1 + 0x4834);

  local_88 = 0;

  local_68 = (short *)0x0;

  local_70 = 0;

  local_7c = (short *)0x0;

  local_6c = 0;

  local_78 = 0;

  local_74 = 0;

  local_64 = (short *)0x0;

  local_84 = '\0';

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

    if ((local_90 == 2) && (local_8c == 1)) {

      local_84 = '\x01';

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

        local_68 = (short *)0x0;

        iVar10 = *(int *)(param_1 + 0x37c0) + -1;

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

          iVar17 = iVar10 * 0x10;

          local_68 = (short *)0x0;

          local_9c = (undefined1 *)0x0;

          do {

            iVar10 = iVar10 + -1;

            local_68 = (short *)((int)local_68 +

                                *(int *)(iVar17 + 4 + *(int *)(param_1 + 0x37cc)) *

                                *(int *)(iVar17 + 8 + *(int *)(param_1 + 0x37cc)));

            iVar17 = iVar17 + -0x10;

            local_98 = iVar9;

          } while (iVar10 != -1);

        }

      }

      else {

        local_68 = (short *)0x1;

      }

      local_1c = (int)local_68 * 0x40;

      local_20 = *(undefined1 **)(param_1 + 0x4dec);

      local_88 = param_2 * 2 * local_1c + *(int *)(local_20 + 4);

      local_68 = (short *)((int)local_68 * 0x100 + local_88);

    }

    if ((local_90 == 2) && (local_8c == 2)) {

      local_84 = '\x02';

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

        iVar17 = 0;

        iVar10 = *(int *)(param_1 + 0x37c0) + -1;

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

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

          iVar21 = iVar10 * 0x10;

          do {

            iVar10 = iVar10 + -1;

            iVar17 = iVar17 + *(int *)(iVar21 + 4 + local_8c) * *(int *)(iVar21 + 8 + local_8c);

            iVar21 = iVar21 + -0x10;

          } while (iVar10 != -1);

        }

      }

      else {

        iVar17 = 1;

      }

      piVar7 = *(int **)(param_1 + 0x4dec);

      local_78 = *piVar7;

      iVar21 = (param_2 + 1) * iVar17 * 0x80;

      local_74 = param_2 * 2 * iVar17 * 0x40;

      local_70 = local_78 + iVar21;

      local_6c = local_78 + local_74;

      iVar17 = iVar17 * 0x80 * (param_2 + 2);

      local_78 = local_78 + iVar17;

      local_88 = piVar7[1] + local_74;

      local_68 = (short *)(piVar7[1] + iVar17);

      iVar10 = piVar7[2];

      local_74 = local_74 + iVar10;

      local_7c = (short *)(iVar21 + iVar10);

      local_64 = (short *)(iVar10 + iVar17);

      local_9c = (undefined1 *)0x0;

      local_98 = iVar9;

      local_18 = iVar20 * 8;

    }

  }

  puVar22 = (undefined1 *)0x0;

  iVar9 = FUN_0062f6a0(param_1 + 4,iVar9,iVar20 * 8,param_2,param_3,local_94,

                       *(undefined4 *)(param_1 + 0x3c),*(undefined4 *)(param_1 + 0x20),

                       *(undefined4 *)(param_1 + 0x24),*(undefined4 *)(param_1 + 0x28),

                       param_1 + 0x3814,local_ac);

  if (iVar9 == 0) {

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

    if ((iVar9 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

      local_8c = *(int *)(param_1 + 0x3814);

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

        local_8c = local_8c + 2;

      }

      else if (*(int *)(param_1 + 0x3820) == 1) {

        local_8c = local_8c + 1;

      }

    }

    else {

      local_8c = *(int *)(param_1 + 0x3814) + *(int *)(param_1 + 0x3820);

    }

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

    iVar20 = 0;

    local_18 = 0;

    while( true ) {

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

      iVar17 = local_1c;

      if (iVar10 <= local_1c) {

        iVar17 = iVar10;

      }

      if (iVar17 <= iVar20) break;

      if ((local_1c == 1) && (*(int *)(param_1 + 0x4de0) == 0)) {

        local_3c = 1;

        iVar10 = *(int *)(*(int *)(param_1 + 0x37e0) + 0x34);

        local_30 = 1;

        iVar9 = *(int *)(local_18 + 4 + iVar10);

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

      }

      else {

        iVar9 = *(int *)(*(int *)(param_1 + 0x37e0) + 0x34);

        iVar10 = *(int *)(local_18 + 8 + iVar9);

        iVar9 = *(int *)(local_18 + 4 + iVar9);

        local_3c = iVar10;

        local_30 = iVar9;

      }

      iVar9 = *(int *)(param_1 + 0x37b8) / iVar9;

      iVar10 = *(int *)(param_1 + 0x37bc) / iVar10;

      if (local_84 == '\x01') {

        puVar22 = local_5ac;

        iVar10 = 0;

        if (0 < local_30) {

          do {

            local_90 = iVar20;

            local_28 = puVar22 + 0x100;

            psVar16 = local_68;

            psVar18 = local_80;

            local_98 = iVar9;

            local_24 = iVar10;

            local_20 = puVar22;

            do {

              if (local_98 == 2) {

                sVar1 = *psVar18;

                *puVar22 = (char)(*(short *)(local_88 + 0xe) + 1 + sVar1 * 3 >> 2);

                puVar22[1] = (char)(psVar18[1] + 2 + sVar1 * 3 >> 2);

                sVar1 = psVar18[1];

                puVar22[2] = (char)(sVar1 * 3 + 1 + (int)*psVar18 >> 2);

                puVar22[3] = (char)(sVar1 * 3 + 2 + (int)psVar18[2] >> 2);

                sVar1 = psVar18[2];

                puVar22[4] = (char)(sVar1 * 3 + 1 + (int)psVar18[1] >> 2);

                puVar22[5] = (char)(sVar1 * 3 + 2 + (int)psVar18[3] >> 2);

                sVar1 = psVar18[3];

                puVar22[6] = (char)(sVar1 * 3 + 1 + (int)psVar18[2] >> 2);

                puVar22[7] = (char)(sVar1 * 3 + 2 + (int)psVar18[4] >> 2);

                sVar1 = psVar18[4];

                puVar22[8] = (char)(sVar1 * 3 + 1 + (int)psVar18[3] >> 2);

                puVar22[9] = (char)(sVar1 * 3 + 2 + (int)psVar18[5] >> 2);

                sVar1 = psVar18[5];

                puVar22[10] = (char)(sVar1 * 3 + 1 + (int)psVar18[4] >> 2);

                puVar22[0xb] = (char)(sVar1 * 3 + 2 + (int)psVar18[6] >> 2);

                sVar1 = psVar18[6];

                puVar22[0xc] = (char)(sVar1 * 3 + 1 + (int)psVar18[5] >> 2);

                puVar22[0xd] = (char)(sVar1 * 3 + 2 + (int)psVar18[7] >> 2);

                sVar1 = psVar18[7];

                puVar22[0xe] = (char)(psVar18[6] + 1 + sVar1 * 3 >> 2);

                puVar22[0xf] = (char)(*psVar16 + 2 + sVar1 * 3 >> 2);

              }

              else {

                *puVar22 = (char)*psVar18;

                puVar22[1] = (char)psVar18[1];

                puVar22[2] = (char)psVar18[2];

                puVar22[3] = (char)psVar18[3];

                puVar22[4] = (char)psVar18[4];

                puVar22[5] = (char)psVar18[5];

                puVar22[6] = (char)psVar18[6];

                puVar22[7] = (char)psVar18[7];

              }

              psVar18 = psVar18 + 8;

              psVar16 = psVar16 + 8;

              puVar22 = puVar22 + 0x20;

              local_88 = local_88 + 0x10;

            } while ((int)puVar22 < (int)local_28);

            puVar22 = local_20 + local_98 * 8;

            iVar10 = local_24 + 1;

            iVar9 = local_98;

            iVar20 = local_90;

            local_80 = psVar18;

            local_68 = psVar16;

          } while (iVar10 < local_30);

        }

      }

      else if (local_84 == '\x02') {

        iVar17 = 0;

        if (0 < local_3c) {

          local_4c = iVar10 * 0x100;

          local_50 = iVar9 * 8;

          local_54 = (undefined1 *)(iVar10 * 0x20);

          local_20 = (undefined1 *)(iVar9 + -6);

          do {

            puVar14 = (undefined1 *)0x0;

            puVar22 = local_5ac + local_4c * iVar17;

            if (0 < local_30) {

              do {

                if ((iVar9 == 2) && (iVar10 == 2)) {

                  local_28 = (undefined1 *)0x7;

                  puVar11 = (undefined1 *)0x0;

                  psVar16 = local_7c;

                  do {

                    local_7c = psVar16;

                    local_34 = puVar11;

                    sVar1 = *local_80;

                    sVar2 = local_80[1];

                    if (local_34 == (undefined1 *)0x0) {

                      sVar3 = *(short *)(local_70 + 0x70);

                      sVar4 = *(short *)(local_6c + 0x7e);

                      sVar5 = *(short *)(local_70 + 0x72);

                    }

                    else {

                      sVar3 = local_80[-8];

                      sVar4 = *(short *)(local_88 + -2);

                      sVar5 = local_80[-7];

                    }

                    local_5c = (uint)sVar4;

                    local_9c = (undefined1 *)(int)sVar5;

                    if (local_28 == (undefined1 *)0x0) {

                      sVar4 = *local_7c;

                      sVar5 = *(short *)(local_74 + 0xe);

                      sVar6 = local_7c[1];

                    }

                    else {

                      sVar4 = local_80[8];

                      sVar5 = *(short *)(local_88 + 0x1e);

                      sVar6 = local_80[9];

                    }

                    local_48 = (undefined1 *)(sVar4 * 3);

                    local_58 = (int)sVar5;

                    local_60 = (uint)sVar6;

                    iVar19 = *(short *)(local_88 + 0xe) * 3 + sVar1 * 9;

                    local_34[(int)puVar22] = (char)((int)(iVar19 + sVar3 * 3 + 8 + local_5c) >> 4);

                    iVar21 = sVar1 * 9 + sVar2 * 3;

                    (local_34 + 1)[(int)puVar22] =

                         (char)(sVar3 * 3 + iVar21 + 7 + (int)local_9c >> 4);

                    (local_34 + 0x20)[(int)puVar22] =

                         (char)(iVar19 + (int)local_48 + 8 + local_58 >> 4);

                    puVar11 = puVar22 + 2 + (int)local_34;

                    (local_34 + 0x21)[(int)puVar22] =

                         (char)((int)((int)local_48 + iVar21 + 7 + local_60) >> 4);

                    psVar16 = local_80 + 1;

                    psVar18 = local_7c + 1;

                    do {

                      iVar21 = local_70;

                      local_7c = psVar18;

                      local_80 = psVar16;

                      local_70 = iVar21 + 2;

                      sVar1 = *local_80;

                      sVar2 = local_80[1];

                      if (local_34 == (undefined1 *)0x0) {

                        sVar3 = *(short *)(iVar21 + 0x72);

                        sVar4 = *(short *)(iVar21 + 0x70);

                        sVar5 = *(short *)(iVar21 + 0x74);

                      }

                      else {

                        sVar3 = local_80[-8];

                        sVar4 = local_80[-9];

                        sVar5 = local_80[-7];

                      }

                      local_5c = (uint)sVar5;

                      local_60 = (uint)sVar4;

                      if (local_28 == (undefined1 *)0x0) {

                        sVar4 = *local_7c;

                        sVar5 = local_7c[-1];

                        sVar6 = local_7c[1];

                      }

                      else {

                        sVar4 = local_80[8];

                        sVar5 = local_80[7];

                        sVar6 = local_80[9];

                      }

                      local_24 = sVar4 * 3;

                      local_58 = (int)sVar6;

                      local_9c = (undefined1 *)(int)sVar5;

                      iVar15 = local_80[-1] * 3 + sVar1 * 9;

                      *puVar11 = (char)((int)(iVar15 + sVar3 * 3 + 8 + local_60) >> 4);

                      iVar19 = sVar1 * 9 + sVar2 * 3;

                      puVar11[1] = (char)((int)(sVar3 * 3 + iVar19 + 7 + local_5c) >> 4);

                      puVar11[0x20] = (char)(iVar15 + local_24 + 8 + (int)local_9c >> 4);

                      puVar11[0x21] = (char)(local_24 + iVar19 + 7 + local_58 >> 4);

                      puVar11 = puVar11 + 2;

                      psVar16 = local_80 + 1;

                      psVar18 = local_7c + 1;

                    } while ((int)puVar11 < (int)(puVar22 + 0xe + (int)local_34));

                    iVar19 = local_80[1] * 9;

                    local_2c = (undefined1 *)(*local_68 * 3);

                    if (local_34 == (undefined1 *)0x0) {

                      sVar1 = *(short *)(iVar21 + 0x74);

                      sVar2 = *(short *)(iVar21 + 0x72);

                      sVar3 = *(short *)(local_78 + 0x70);

                    }

                    else {

                      sVar1 = local_80[-7];

                      sVar2 = local_80[-8];

                      sVar3 = local_68[-8];

                    }

                    local_58 = (int)sVar2;

                    local_9c = (undefined1 *)(int)sVar3;

                    local_68 = local_68 + 8;

                    if (local_28 == (undefined1 *)0x0) {

                      sVar2 = local_7c[1];

                      sVar3 = *local_7c;

                      sVar4 = *local_64;

                    }

                    else {

                      sVar2 = local_80[9];

                      sVar3 = local_80[8];

                      sVar4 = *local_68;

                    }

                    local_48 = (undefined1 *)(sVar2 * 3);

                    local_5c = (uint)sVar3;

                    local_60 = (uint)sVar4;

                    iVar15 = *local_80 * 3 + iVar19;

                    (local_34 + 0xe)[(int)puVar22] = (char)(iVar15 + sVar1 * 3 + 8 + local_58 >> 4);

                    local_80 = local_80 + 2;

                    (local_34 + 0xf)[(int)puVar22] =

                         (char)((int)(local_2c + iVar19 + sVar1 * 3 + 7 + (int)local_9c) >> 4);

                    (local_34 + 0x2e)[(int)puVar22] =

                         (char)((int)(local_48 + local_5c + iVar15 + 8) >> 4);

                    local_28 = (undefined1 *)((int)local_28 + -1);

                    (local_34 + 0x2f)[(int)puVar22] =

                         (char)((int)(local_2c + iVar19 + (int)(local_48 + local_60 + 7)) >> 4);

                    local_88 = local_88 + 0x10;

                    local_70 = iVar21 + -10;

                    puVar11 = local_34 + 0x40;

                    psVar16 = local_7c + -6;

                  } while (local_28 != (undefined1 *)0xffffffff);

                  puVar11 = puVar22 + 0x10;

                  local_70 = iVar21 + 0x76;

                  local_7c = local_7c + 0x3a;

                  local_6c = local_6c + 0x80;

                  local_78 = local_78 + 0x80;

                  local_74 = local_74 + 0x80;

                  local_64 = local_64 + 0x40;

                  local_28 = (undefined1 *)0xffffffff;

                  local_44 = puVar22;

                  local_40 = puVar14;

                  local_38 = iVar17;

                }

                else {

                  iVar17 = 0;

                  puVar11 = puVar22;

                  if (0 < local_3c) {

                    puVar22 = (undefined1 *)0x0;

                    do {

                      puVar11 = local_5ac + (int)puVar22;

                      puVar14 = (undefined1 *)0x0;

                      if (0 < local_30) {

                        do {

                          puVar12 = (undefined1 *)0x0;

                          if (0 < local_4c) {

                            do {

                              iVar21 = 0;

                              if (0 < (int)local_50) {

                                do {

                                  sVar1 = *local_80;

                                  iVar19 = 0;

                                  local_80 = local_80 + 1;

                                  if (0 < (int)local_54) {

                                    do {

                                      iVar15 = 0;

                                      if (0 < iVar9) {

                                        uVar8 = (undefined1)sVar1;

                                        if (iVar9 < 6) {

                                          local_9c = puVar11 + (int)puVar12 + iVar19 + iVar21;

                                        }

                                        else {

                                          local_9c = puVar11 + (int)puVar12 + iVar19 + iVar21;

                                          do {

                                            local_9c[iVar15] = uVar8;

                                            local_9c[iVar15 + 1] = uVar8;

                                            local_9c[iVar15 + 2] = uVar8;

                                            local_9c[iVar15 + 3] = uVar8;

                                            local_9c[iVar15 + 4] = uVar8;

                                            iVar15 = iVar15 + 5;

                                          } while (iVar15 <= (int)local_20);

                                        }

                                        local_60 = (int)sVar1 & 0xff;

                                        do {

                                          local_9c[iVar15] = uVar8;

                                          iVar15 = iVar15 + 1;

                                        } while (iVar15 < iVar9);

                                      }

                                      iVar19 = iVar19 + 0x20;

                                      local_5c = (int)sVar1;

                                      local_58 = iVar21;

                                    } while (iVar19 < (int)local_54);

                                  }

                                  iVar21 = iVar21 + iVar9;

                                  local_48 = puVar12;

                                } while (iVar21 < (int)local_50);

                              }

                              puVar12 = puVar12 + (int)local_54;

                              local_44 = puVar11;

                              local_40 = puVar14;

                            } while ((int)puVar12 < local_4c);

                          }

                          puVar11 = puVar11 + iVar9 * 8;

                          local_70 = local_70 + 0x80;

                          local_88 = local_88 + 0x80;

                          local_68 = local_68 + 0x40;

                          puVar14 = puVar14 + 1;

                          local_7c = local_7c + 0x40;

                          local_6c = local_6c + 0x80;

                          local_78 = local_78 + 0x80;

                          local_74 = local_74 + 0x80;

                          local_64 = local_64 + 0x40;

                          local_38 = iVar17;

                          local_34 = puVar22;

                        } while ((int)puVar14 < local_30);

                      }

                      puVar22 = puVar22 + local_4c;

                      iVar17 = iVar17 + 1;

                    } while (iVar17 < local_3c);

                  }

                }

                puVar14 = puVar14 + 1;

                puVar22 = puVar11;

              } while ((int)puVar14 < local_30);

            }

            iVar17 = iVar17 + 1;

            local_98 = iVar9;

            local_94 = iVar10;

            local_90 = iVar20;

          } while (iVar17 < local_3c);

        }

      }

      else {

        iVar17 = 0;

        if (0 < local_3c) {

          local_48 = (undefined1 *)(iVar10 * 0x100);

          local_44 = (undefined1 *)(iVar9 * 8);

          local_94 = iVar10 * 0x20;

          local_20 = (undefined1 *)(iVar9 + -6);

          local_40 = (undefined1 *)0x0;

          puVar22 = (undefined1 *)0x0;

          do {

            puVar14 = local_5ac + (int)puVar22;

            iVar10 = 0;

            if (0 < local_30) {

              do {

                iVar21 = 0;

                if (0 < (int)local_48) {

                  do {

                    puVar11 = (undefined1 *)0x0;

                    if (0 < (int)local_44) {

                      local_2c = puVar14 + iVar21;

                      do {

                        sVar1 = *local_80;

                        iVar19 = 0;

                        local_80 = local_80 + 1;

                        if (0 < local_94) {

                          local_54 = puVar11 + (int)local_2c;

                          bVar13 = (byte)sVar1;

                          local_50 = (uint)bVar13;

                          do {

                            iVar15 = 0;

                            if (0 < iVar9) {

                              if (5 < iVar9) {

                                do {

                                  local_54[iVar15 + iVar19] = bVar13;

                                  local_54[iVar15 + iVar19 + 1] = bVar13;

                                  local_54[iVar15 + iVar19 + 2] = bVar13;

                                  local_54[iVar15 + iVar19 + 3] = bVar13;

                                  local_54[iVar15 + iVar19 + 4] = bVar13;

                                  iVar15 = iVar15 + 5;

                                } while (iVar15 <= (int)local_20);

                              }

                              do {

                                local_54[iVar15 + iVar19] = bVar13;

                                iVar15 = iVar15 + 1;

                              } while (iVar15 < iVar9);

                            }

                            iVar19 = iVar19 + 0x20;

                            local_28 = puVar11;

                          } while (iVar19 < local_94);

                        }

                        puVar11 = puVar11 + iVar9;

                        local_38 = iVar21;

                        local_34 = puVar14;

                      } while ((int)puVar11 < (int)local_44);

                    }

                    iVar21 = iVar21 + local_94;

                    local_24 = iVar10;

                  } while (iVar21 < (int)local_48);

                }

                puVar14 = puVar14 + iVar9 * 8;

                iVar10 = iVar10 + 1;

                local_4c = iVar17;

                local_40 = puVar22;

              } while (iVar10 < local_30);

            }

            puVar22 = puVar22 + (int)local_48;

            iVar17 = iVar17 + 1;

            local_98 = iVar9;

            local_90 = iVar20;

          } while (iVar17 < local_3c);

        }

      }

      puVar22 = local_5ac;

      FUN_00633140(param_1,local_ac,iVar20,local_8c,puVar22);

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

      if ((iVar9 == 2) && (*(int *)(param_1 + 0x58) == 1)) {

        local_8c = local_8c + -1;

      }

      else {

        local_8c = local_8c + 1;

      }

      local_18 = local_18 + 0x18;

      iVar20 = iVar20 + 1;

    }

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

       (iVar20 = *(int *)(param_1 + 0x54),

       *(int *)(param_1 + 0x54) + -1 != *(int *)(param_1 + 0x3820))) {

      iVar20 = iVar10;

    }

    if (((iVar9 != 0xff) || (*(int *)(param_1 + 0x58) != 0xff)) &&

       (iVar9 = local_8c, iVar20 < iVar10)) {

      do {

        FUN_00633140(param_1,local_ac,iVar20,iVar9,puVar22);

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

          iVar9 = iVar9 + -1;

        }

        else {

          iVar9 = iVar9 + 1;

        }

        iVar20 = iVar20 + 1;

      } while (iVar20 < *(int *)(param_1 + 0x30));

    }

  }

  return;

}





