void __cdecl sub_ida_func(int nInLen, char* pInputData, int nSize, char *pDestData)
{
__asm
{
PUSHAD
sub esp, 18h
mov esi, [ebp+10h]
mov edi, [ebp+8h]
mov ecx, edi
test edi, edi
jz short loc_6354BA7C
loc_6354BA6D:
mov eax, esi
cdq
idiv ecx
mov ebx, ecx
mov esi, ebx
mov ecx, edx
test ecx, ecx
jnz short loc_6354BA6D
loc_6354BA7C:
mov eax, edi
imul eax, [ebp+10h]
xor edx, edx
div esi
mov esi, eax
dec esi
mov [ebp-4h], esi
js loc_6354BB55
lea eax, [edi+edi]
mov [ebp-8h], eax
lea eax, ds:0Dh[edi*8]
mov [ebp-0Ch], eax
mov eax, edi
shl eax, 3
mov [ebp-10h], eax
jmp short loc_6354BAC3
loc_6354BABD:
mov edi, [ebp+8h]
mov esi, [ebp-4h]
loc_6354BAC3:
xor edx, edx
mov eax, esi
div edi
mov ecx, [ebp-8h]
sub ecx, edx
mov edx, [ebp-0Ch]
imul edx, eax
lea eax, [edx+ecx*8-1]
xor edx, edx
div dword ptr [ebp-10h]
mov ecx, edi
mov eax, esi
mov [ebp-18h], edx
sar edx, 3
sub ecx, edx
xor edx, edx
div dword ptr [ebp+10h]
mov eax, [ebp+14h]
lea esi, [edx+eax]
lea eax, [ecx-1]
xor edx, edx
div edi
mov edi, [ebp+0Ch]
movzx eax, byte ptr [edx+edi]
shl eax, 8
mov [ebp-14h], eax
mov eax, ecx
xor edx, edx
div dword ptr [ebp+8h]
mov ecx, [ebp-14h]
movzx eax, byte ptr [edx+edi]
or ecx, eax
mov eax, ecx
mov ecx, [ebp-18h]
and ecx, 7
inc ecx
sar eax, cl
movzx ecx, byte ptr [esi]
add ecx, ebx
and eax, 0FFh
lea ebx, [ecx+eax]
mov [esi], bl
sar ebx, 8
dec [ebp-4h]
jns short loc_6354BABD
test ebx, ebx
jz short loc_6354BB55
mov ecx, [ebp+10h]
jmp short loc_6354BB52
loc_6354BB43:
mov eax, [ebp+14h]
add eax, ecx
movzx edx, byte ptr [eax]
add ebx, edx
mov [eax], bl
sar ebx, 8
loc_6354BB52:
dec ecx
jns short loc_6354BB43
loc_6354BB55:
add esp, 18h
POPAD
}
{
__asm
{
PUSHAD
sub esp, 18h
mov esi, [ebp+10h]
mov edi, [ebp+8h]
mov ecx, edi
test edi, edi
jz short loc_6354BA7C
loc_6354BA6D:
mov eax, esi
cdq
idiv ecx
mov ebx, ecx
mov esi, ebx
mov ecx, edx
test ecx, ecx
jnz short loc_6354BA6D
loc_6354BA7C:
mov eax, edi
imul eax, [ebp+10h]
xor edx, edx
div esi
mov esi, eax
dec esi
mov [ebp-4h], esi
js loc_6354BB55
lea eax, [edi+edi]
mov [ebp-8h], eax
lea eax, ds:0Dh[edi*8]
mov [ebp-0Ch], eax
mov eax, edi
shl eax, 3
mov [ebp-10h], eax
jmp short loc_6354BAC3
loc_6354BABD:
mov edi, [ebp+8h]
mov esi, [ebp-4h]
loc_6354BAC3:
xor edx, edx
mov eax, esi
div edi
mov ecx, [ebp-8h]
sub ecx, edx
mov edx, [ebp-0Ch]
imul edx, eax
lea eax, [edx+ecx*8-1]
xor edx, edx
div dword ptr [ebp-10h]
mov ecx, edi
mov eax, esi
mov [ebp-18h], edx
sar edx, 3
sub ecx, edx
xor edx, edx
div dword ptr [ebp+10h]
mov eax, [ebp+14h]
lea esi, [edx+eax]
lea eax, [ecx-1]
xor edx, edx
div edi
mov edi, [ebp+0Ch]
movzx eax, byte ptr [edx+edi]
shl eax, 8
mov [ebp-14h], eax
mov eax, ecx
xor edx, edx
div dword ptr [ebp+8h]
mov ecx, [ebp-14h]
movzx eax, byte ptr [edx+edi]
or ecx, eax
mov eax, ecx
mov ecx, [ebp-18h]
and ecx, 7
inc ecx
sar eax, cl
movzx ecx, byte ptr [esi]
add ecx, ebx
and eax, 0FFh
lea ebx, [ecx+eax]
mov [esi], bl
sar ebx, 8
dec [ebp-4h]
jns short loc_6354BABD
test ebx, ebx
jz short loc_6354BB55
mov ecx, [ebp+10h]
jmp short loc_6354BB52
loc_6354BB43:
mov eax, [ebp+14h]
add eax, ecx
movzx edx, byte ptr [eax]
add ebx, edx
mov [eax], bl
sar ebx, 8
loc_6354BB52:
dec ecx
jns short loc_6354BB43
loc_6354BB55:
add esp, 18h
POPAD
}
}
char sz3AAText[8] = {0};
char sz3AAResult[0x10] = {0};
sz3AAText[3] = 0x3;
sz3AAText[4] = 0xAA;
sub_ida_func(0x5, sz3AAText, 0x10, sz3AAResult);