Function at 0x405040
Capabilities:
Encode data using xor

Disassembly:
push ebp
push ebx
push esi
push edi
mov edi, dword [esp + 0x14]
mov edx, dword [esp + 0x18]
mov esi, dword [esp + 0x1c]
mov ebp, dword [esp + 0x20]
xor eax, eax
xor ebx, ebx
cmp edx, 0
je 0x405367
mov al, byte [edi]
mov bl, byte [edi + 4]
add edi, 8
lea ecx, [esi + edx]
sub ebp, esi
mov dword [esp + 0x18], ecx
inc al
cmp dword [edi + 0x100], 0xffffffff
je 0x405330
mov ecx, dword [edi + eax*4]
and edx, 0xfffffffc
je 0x4052f0
test edx, 0xfffffff8
mov dword [esp + 0x20], ebp
je 0x405240
lea ebp, [0x496410]
bt dword [ebp], 0x1a
jae 0x405240
mov ebp, dword [esp + 0x20]
and edx, 0xfffffff8
lea edx, [esi + edx - 8]
mov dword [edi - 4], edx
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
movq mm0, qword [esi]
mov ecx, dword [edi + eax*4]
movd mm2, dword [edi + edx*4]
jmp 0x40511a
add bl, cl
psllq mm1, 0x38
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
movq mm0, qword [esi]
movq qword [ebp + esi - 8], mm2
mov ecx, dword [edi + eax*4]
movd mm2, dword [edi + edx*4]
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm0
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
add bl, cl
psllq mm1, 8
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
add bl, cl
psllq mm1, 0x10
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
add bl, cl
psllq mm1, 0x18
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
add bl, cl
psllq mm1, 0x20
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
add bl, cl
psllq mm1, 0x28
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
add bl, cl
psllq mm1, 0x30
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
inc eax
add edx, ecx
movzx eax, al
movzx edx, dl
pxor mm2, mm1
mov ecx, dword [edi + eax*4]
movd mm1, dword [edi + edx*4]
mov edx, ebx
xor ebx, ebx
mov bl, dl
cmp esi, dword [edi - 4]
lea esi, [esi + 8]
jb 0x4050f0
psllq mm1, 0x38
pxor mm2, mm1
movq qword [ebp + esi - 8], mm2
emms
cmp esi, dword [esp + 0x18]
je 0x40535f
jmp 0x4052f0
lea edx, [esi + edx - 4]
mov dword [esp + 0x1c], edx
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
add edx, ecx
inc al
and edx, 0xff
mov ecx, dword [edi + eax*4]
mov ebp, dword [edi + edx*4]
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
add edx, ecx
inc al
and edx, 0xff
ror ebp, 8
mov ecx, dword [edi + eax*4]
or ebp, dword [edi + edx*4]
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
add edx, ecx
inc al
and edx, 0xff
ror ebp, 8
mov ecx, dword [edi + eax*4]
or ebp, dword [edi + edx*4]
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
add edx, ecx
inc al
and edx, 0xff
ror ebp, 8
mov ecx, dword [esp + 0x20]
or ebp, dword [edi + edx*4]
ror ebp, 8
xor ebp, dword [esi]
cmp esi, dword [esp + 0x1c]
mov dword [ecx + esi], ebp
lea esi, [esi + 4]
mov ecx, dword [edi + eax*4]
jb 0x405248
cmp esi, dword [esp + 0x18]
je 0x40535f
mov ebp, dword [esp + 0x20]
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
add bl, cl
mov edx, dword [edi + ebx*4]
mov dword [edi + ebx*4], ecx
mov dword [edi + eax*4], edx
add edx, ecx
inc al
and edx, 0xff
mov edx, dword [edi + edx*4]
xor dl, byte [esi]
lea esi, [esi + 1]
mov ecx, dword [edi + eax*4]
cmp esi, dword [esp + 0x18]
mov byte [ebp + esi - 1], dl
jb 0x4052f0
jmp 0x40535f
movzx ecx, byte [edi + eax]
add bl, cl
movzx edx, byte [edi + ebx]
mov byte [edi + ebx], cl
mov byte [edi + eax], dl
add dl, cl
movzx edx, byte [edi + edx]
add al, 1
xor dl, byte [esi]
lea esi, [esi + 1]
movzx ecx, byte [edi + eax]
cmp esi, dword [esp + 0x18]
mov byte [ebp + esi - 1], dl
jb 0x405334
dec al
mov dword [edi - 4], ebx
mov byte [edi - 8], al
pop edi
pop esi
pop ebx
pop ebp
ret