请教高手分析这些代码可能用到的算法。
signed int __thiscall sub_409700(int this, const struct sockaddr *to)
{
int v2; // esi@1
int v3; // eax@1
signed int result; // eax@3
int v5; // esi@7
v2 = this;
**(_BYTE **)(this + 8) = 8;
*(_BYTE *)(*(_DWORD *)(this + 8) + 1) = 0;
*(_WORD *)(*(_DWORD *)(this + 8) + 4) = GetCurrentProcessId();
*(_WORD *)(*(_DWORD *)(v2 + 8) + 6) = 0;
*(_DWORD *)(*(_DWORD *)(v2 + 8) + 8) = GetTickCount();
*(_WORD *)(*(_DWORD *)(v2 + 8) + 2) = 0;
memset((void *)(*(_DWORD *)(v2 + 8) + 12), 0x30303030u, 0x20u);
*(_WORD *)(*(_DWORD *)(v2 + 8) + 2) = sub_409650(*(_DWORD *)(v2 + 8), 44);
v3 = sendto(*(_DWORD *)(v2 + 12), *(const char **)(v2 + 8), 44, 0, to, 16);
if ( v3 == -1 )
{
if ( GetLastError() == 10060 )
{
CString::operator_("Send Connect Timeout!");
result = 0;
}
else
{
CString::operator_("error!");
result = 0;
}
}
else
{
if ( v3 >= 32 )
{
v5 = v2 + 24;
*(_DWORD *)v5 = *(_DWORD *)&to->sa_family;
*(_DWORD *)(v5 + 4) = *(_DWORD *)&to->sa_data[2];
*(_DWORD *)(v5 + 8) = *(_DWORD *)&to->sa_data[6];
result = 1;
*(_DWORD *)(v5 + 12) = *(_DWORD *)&to->sa_data[10];
}
else
{
CString::operator_("Send Error!");
result = 0;
}
}
return result;
}
unsigned int __stdcall sub_409650(int a1, unsigned int a2)
{
int v2; // esi@1
unsigned int v3; // eax@1
unsigned int v4; // edx@2
int v5; // ecx@2
int v6; // edi@3
v2 = a2;
v3 = 0;
if ( (signed int)a2 <= 1 )
{
v5 = a1;
}
else
{
v4 = a2 >> 1;
v2 = a2 + -2 * (a2 >> 1);
v5 = a1;
do
{
v6 = *(_WORD *)v5;
v5 += 2;
v3 += v6;
--v4;
}
while ( v4 );
}
if ( v2 )
v3 += *(_BYTE *)v5;
return ~((unsigned __int16)v3 + (v3 >> 16) + (((unsigned __int16)v3 + (v3 >> 16)) >> 16));
}