All pastes #2045676 Raw Edit

Unnamed

public text v1 · immutable
#2045676 ·published 2011-04-13 03:02 UTC
rendered paste body
char __cdecl SpeakBabel(const char *Source, char *Dest, int a3, unsigned __int8 a4, int a5)
{
  size_t v5; // eax@1
  size_t v6; // edx@1
  const char *v7; // ebx@1
  char *v8; // edi@10
  char *v9; // ebx@11
  signed int v10; // eax@14
  char v11; // cl@14
  int v12; // esi@18
  size_t v13; // eax@22
  signed int v14; // esi@24
  size_t v15; // edi@25
  unsigned __int8 v16; // bl@34
  size_t v17; // eax@72
  int v18; // edi@73
  char *v19; // esi@74
  unsigned __int8 v20; // al@76
  char v21; // dl@87
  int v22; // esi@98
  int v23; // eax@100
  int *v24; // esi@100
  char *v26; // [sp-8h] [bp-202Ch]@33
  const char *v27; // [sp-4h] [bp-2028h]@33
  const char *v28; // [sp-4h] [bp-2028h]@39
  char Str; // [sp+Ch] [bp-2018h]@21
  char C[4096]; // [sp+100Ch] [bp-1018h]@9
  int v31; // [sp+200Ch] [bp-18h]@72
  int v32; // [sp+2010h] [bp-14h]@10
  char Str1[16]; // [sp+2014h] [bp-10h]@22

  v7 = Source;
  v5 = strlen(Source);
  v6 = 0;
  if ( Dest && Source )
  {
    if ( a4 > 0x63u && a5 )
    {
      LOBYTE(v5) = (unsigned int)strcpy(Dest, Source);
      return v5;
    }
    *Dest = 0;
    if ( (signed int)v5 > 4095 )
      v5 = 4095;
    if ( (signed int)v5 > 0 )
    {
      v6 = v5;
      memcpy(C, Source, v5);
    }
    C[v6] = 0;
    v8 = C;
    v32 = (int)C;
    if ( strlen(C) )
    {
      v9 = Dest;
      while ( 1 )
      {
        if ( *v8 == 18 )
        {
          v11 = v8[1];
          v10 = 1;
          while ( v11 && v11 != 18 )
            v11 = v8[v10++ + 1];
          v12 = (int)&v8[v10];
          if ( v8[v10] == 18 )
          {
            strncat(v9, v8, v10 + 1);
            strcat(v9, L" ");
            v32 = v12 + 1;
          }
          else
          {
            *v8 = 81;
          }
          goto LABEL_96;
        }
        v32 = CEverQuest__GrabFirstWord(v8, &Str);
        if ( strlen(&Str) )
        {
          nullterminated_strncpy(Str1, &Str, 0x10u);
        }
        else
        {
          nullterminated_strncpy(Str1, (char *)v32, 0x10u);
          v13 = strlen(Str1);
          v32 += v13;
        }
        v14 = 0;
        if ( !a5 )
        {
          v15 = strlen(Str1);
          if ( (signed int)v15 > 0 )
          {
            if ( BadWord(Str1) )
            {
              if ( (signed int)v15 > 0 )
              {
                do
                  Str1[v14++] = RandNbr() % 26 + 96;
                while ( v14 < (signed int)v15 );
              }
              if ( strlen(v9) )
                strcat(v9, Str1);
              else
                strcpy(v9, Str1);
              if ( v9[strlen(v9) - 1] != 32 )
              {
                v27 = L" ";
                v26 = Dest;
LABEL_95:
                strcat(v26, v27);
                goto LABEL_96;
              }
              goto LABEL_96;
            }
          }
        }
        v16 = number_percent();
        if ( v16 > a4 && (signed int)strlen(Str1) < 8 )
        {
          if ( !stricmp(Str1, "I") || !stricmp(Str1, "I'") || !stricmp(Str1, "my") )
          {
            v28 = "me";
LABEL_71:
            strcpy(Str1, v28);
            goto LABEL_72;
          }
          if ( !stricmp(Str1, "let's") || !stricmp(Str1, &byte_5BF00C) )
          {
            v28 = (const char *)&unk_5BED3C;
            goto LABEL_71;
          }
          if ( !stricmp(Str1, "they'll") )
          {
            v28 = "them";
            goto LABEL_71;
          }
          if ( !stricmp(Str1, "it's") || !stricmp(Str1, off_5BEFF0) )
          {
            v28 = "it";
            goto LABEL_71;
          }
          if ( !stricmp(Str1, "went") )
          {
            v28 = "did go";
            goto LABEL_71;
          }
          if ( !stricmp(Str1, "a")
            || !stricmp(Str1, "am")
            || !stricmp(Str1, "an")
            || !stricmp(Str1, "to")
            || !stricmp(Str1, "or")
            || !stricmp(Str1, "do")
            || !stricmp(Str1, off_5BEFD0)
            || !stricmp(Str1, off_5BEFCC)
            || !stricmp(Str1, _string_)
            || !stricmp(Str1, off_5BEFC4)
            || !stricmp(Str1, off_5BEFC0)
            || !stricmp(Str1, "were")
            || !stricmp(Str1, "that") )
          {
LABEL_66:
            v28 = byte_5DF120;
            goto LABEL_71;
          }
          if ( v16 - a4 > 20 )
          {
            if ( !stricmp(Str1, "of") || !stricmp(Str1, "is") )
              goto LABEL_66;
            if ( !stricmp(Str1, off_5BEFA8) )
            {
              v28 = (const char *)&off_5BEFA4;
              goto LABEL_71;
            }
            if ( !stricmp(Str1, "best") )
            {
              v28 = "more better";
              goto LABEL_71;
            }
          }
        }
LABEL_72:
        v17 = strlen(Str1);
        v31 = v17;
        if ( (signed int)v17 > 0 )
        {
          v18 = 0;
          if ( (signed int)v17 > 0 )
          {
            do
            {
              v19 = &Str1[v18];
              if ( isalpha((unsigned __int8)Str1[v18]) )
              {
                if ( number_percent() > 40 )
                {
                  v20 = number_percent();
                  if ( v20 > 5u )
                  {
                    if ( v20 > a4 + 10 )
                    {
                      if ( v20 <= 0x62u || v18 <= 0 || *((_BYTE *)&v32 + v18 + 3) == 32 || v19[1] == 32 )
                      {
                        if ( v20 - a4 <= 30 )
                        {
                          if ( IsVowel(*v19) )
                          {
                            *v19 = ReturnRandomVowel();
                          }
                          else
                          {
                            do
                            {
                              v21 = RandNbr() % 25 + 97;
                              *v19 = v21;
                            }
                            while ( IsVowel(v21) );
                          }
                        }
                        else
                        {
                          *v19 = RandNbr() % 26 + 96;
                        }
                      }
                      else
                      {
                        *v19 = 32;
                      }
                    }
                  }
                }
              }
              ++v18;
            }
            while ( v18 < v31 );
          }
          if ( strlen(Str1) )
          {
            if ( strlen(Dest) )
              strcat(Dest, Str1);
            else
              strcpy(Dest, Str1);
            if ( Dest[strlen(Dest) - 1] != 32 )
            {
              v27 = L" ";
              v26 = Dest;
              goto LABEL_95;
            }
          }
        }
LABEL_96:
        if ( !strlen((const char *)v32) )
        {
          v7 = Source;
          break;
        }
        v9 = Dest;
        v8 = (char *)v32;
      }
    }
    v5 = strlen(v7);
    v22 = v5 - 1;
    if ( (signed int)(v5 - 1) > 0 )
    {
      v5 = strlen(Dest);
      if ( v5 )
      {
        v23 = (unsigned __int8)v7[v22];
        v24 = (int *)&v7[v22];
        if ( !isalpha(v23) )
        {
          if ( !isdigit(*(_BYTE *)v24) )
            Dest[strlen(Dest) - 2] = *(_BYTE *)v24;
        }
        Dest[strlen(Dest) - 1] = 0;
        LOBYTE(v5) = *Dest;
        if ( *Dest >= 97 )
        {
          if ( (_BYTE)v5 <= 122 )
            v5 = (char)v5 - 32;
        }
        *Dest = v5;
      }
    }
  }
  return v5;
}