All pastes #2067918 Raw Edit

Unnamed

public text v1 · immutable
#2067918 ·published 2011-05-24 01:39 UTC
rendered paste body

int __cdecl NET_SetConVar__ReadFromBuffer(int a1, int a2)
{
  void *v2; // edi@1
  int v3; // eax@1
  int v4; // edx@3
  int v5; // ecx@3
  signed int v6; // edx@6
  int v7; // ecx@7
  int v8; // edx@7
  int v9; // esi@10
  int v10; // ST4C_4@14
  int v11; // edi@17
  int v12; // esi@21
  unsigned int v13; // edx@23
  int v14; // esi@28
  int result; // eax@32
  int v16; // [sp+44h] [bp-234h]@16
  char v17; // [sp+4Bh] [bp-22Dh]@1
  int v18; // [sp+4Ch] [bp-22Ch]@9
  char v19; // [sp+54h] [bp-224h]@19
  char v20; // [sp+158h] [bp-120h]@21
  int v21; // [sp+25Ch] [bp-1Ch]@1

  v21 = *(_DWORD *)__stack_chk_guard_ptr;
  v2 = g_VProfCurrentProfile_ptr;
  v3 = *((_DWORD *)g_VProfCurrentProfile_ptr + 1027);
  v17 = v3 != 0;
  if ( v3 )
  {
    if ( (unsigned __int8)ThreadInMainThread(__stack_chk_guard_ptr) )
    {
      v4 = *((_DWORD *)v2 + 1029);
      v5 = (int)"NET_SetConVar::ReadFromBuffer";
      if ( *(char **)v4 != "NET_SetConVar::ReadFromBuffer" )
        *((_DWORD *)v2 + 1029) = CVProfNode__GetSubNode(v4, "NET_SetConVar::ReadFromBuffer", 1, "Unaccounted", 0);
      CVProfNode__EnterScope(v5);
      *((_BYTE *)g_VProfCurrentProfile_ptr + 4112) = 0;
    }
  }
  v6 = *(_DWORD *)(a2 + 20);
  if ( v6 > 7 )
  {
    v7 = off_55D5C4[8] & *(_DWORD *)(a2 + 16);
    v8 = v6 - 8;
    *(_DWORD *)(a2 + 20) = v8;
    if ( v8 )
    {
      *(_DWORD *)(a2 + 16) >>= 8;
    }
    else
    {
      *(_DWORD *)(a2 + 20) = 32;
      v13 = *(_DWORD *)(a2 + 24);
      if ( v13 == *(_DWORD *)(a2 + 28) )
      {
        *(_DWORD *)(a2 + 20) = 1;
        *(_DWORD *)(a2 + 16) = 0;
        *(_DWORD *)(a2 + 24) += 4;
      }
      else
      {
        if ( v13 <= *(_DWORD *)(a2 + 28) )
        {
          *(_DWORD *)(a2 + 16) = *(_DWORD *)v13;
          *(_DWORD *)(a2 + 24) = v13 + 4;
        }
        else
        {
          *(_BYTE *)(a2 + 4) = 1;
          *(_DWORD *)(a2 + 16) = 0;
        }
      }
    }
    v18 = v7;5
    goto LABEL_15;
  }
  v9 = *(_DWORD *)(a2 + 16);
  v7 = *(_DWORD *)(a2 + 24);
  if ( v7 == *(_DWORD *)(a2 + 28) )
  {
    *(_DWORD *)(a2 + 20) = 1;
    *(_DWORD *)(a2 + 16) = 0;
    *(_DWORD *)(a2 + 24) += 4;
    *(_BYTE *)(a2 + 4) = 1;
LABEL_27:
    *(_DWORD *)(a1 + 28) = 0;
    goto LABEL_28;
  }
  if ( (unsigned int)v7 <= *(_DWORD *)(a2 + 28) )
  {
    *(_DWORD *)(a2 + 16) = *(_DWORD *)v7;
    *(_DWORD *)(a2 + 24) = v7 + 4;
  }
  else
  {
    *(_BYTE *)(a2 + 4) = 1;
    *(_DWORD *)(a2 + 16) = 0;
  }
  if ( *(_BYTE *)(a2 + 4) )
    goto LABEL_27;
  v10 = (off_55D5C4[8 - v6] & *(_DWORD *)(a2 + 16)) << v6;
  *(_DWORD *)(a2 + 20) = 32 - (8 - v6);
  v7 = (unsigned __int8)(8 - v6);
  *(_DWORD *)(a2 + 16) >>= 8 - v6;
  v18 = v9 | v10;
LABEL_15:
  *(_DWORD *)(a1 + 28) = 0;
  if ( v18 > 0 )
  {
    v16 = 0;
    do
    {
      CBitRead__ReadString(a2, (int)&v19, 260, 0, 0);
      CBitRead__ReadString(a2, (int)&v20, 260, 0, 0);
      v12 = *(_DWORD *)(a1 + 28);
      CUtlVector_NET_SetConVar__cvar_s_CUtlMemory_NET_SetConVar__cvar_s_int____GrowVector(a1 + 16, 1);
      v7 = *(_DWORD *)(a1 + 28) + ~v12;
      if ( v7 > 0 )
      {
        v11 = 520 * v12;
        memmove(
          (void *)(520 * v12 + 520 + *(_DWORD *)(a1 + 16)),
          (const void *)(*(_DWORD *)(a1 + 16) + 520 * v12),
          520 * v7);
      }
      else
      {
        v11 = 520 * v12;
      }
      if ( *(_DWORD *)(a1 + 16) + v11 )
        memcpy((void *)(*(_DWORD *)(a1 + 16) + v11), &v19, 0x208u);
      ++v16;
    }
    while ( v16 != v18 );
  }
LABEL_28:
  v14 = *(_BYTE *)(a2 + 4);
  if ( v17 )
  {
    if ( !*((_BYTE *)g_VProfCurrentProfile_ptr + 4112) || *((_DWORD *)g_VProfCurrentProfile_ptr + 1027) )
    {
      if ( (unsigned __int8)ThreadInMainThread(v7) )
      {
        if ( (unsigned __int8)CVProfNode__ExitScope(*((_DWORD *)g_VProfCurrentProfile_ptr + 1029)) )
          *((_DWORD *)g_VProfCurrentProfile_ptr + 1029) = *(_DWORD *)(*((_DWORD *)g_VProfCurrentProfile_ptr + 1029) + 100);
        *((_BYTE *)g_VProfCurrentProfile_ptr + 4112) = *((_DWORD *)g_VProfCurrentProfile_ptr + 1029) == (_DWORD)((char *)g_VProfCurrentProfile_ptr + 4120);
      }
    }
  }
  result = (unsigned __int8)((_BYTE)v14 ^ 1);
  if ( *(_DWORD *)__stack_chk_guard_ptr != v21 )
    __stack_chk_fail(__stack_chk_guard_ptr, v14 ^ 1);
  return result;
}
// 4B9992: using guessed type int __fastcall ThreadInMainThread