Function at 0x401040
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
push 0x88
push 1
mov dword [ebp - 0x18], edx
mov dword [ebp - 0xc], ecx
call fcn.004159b0
mov edx, eax
add esp, 8
mov dword [ebp - 4], edx
test edx, edx
jne 0x40106b
or eax, 0xffffffff
mov esp, ebp
pop ebp
ret
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
xor ebx, ebx
mov esi, edx
mov eax, dword [edi]
mov ecx, dword [edi + 4]
mov dword [edx + 0x80], eax
mov dword [edx + 0x84], ecx
xor eax, eax
mov edx, eax
lea ecx, [eax + ebx]
and edx, 7
inc eax
xor cl, byte [edx + edi]
mov byte [esi], cl
inc esi
cmp eax, 0x10
jl 0x401088
inc ebx
cmp ebx, 8
jl 0x401086
mov ebx, dword [ebp - 0x18]
push ebx
push 1
call fcn.004159b0
mov esi, eax
add esp, 8
mov dword [ebp - 8], esi
test esi, esi
jne 0x4010cf
mov esi, dword [ebp - 4]
push esi
call fcn.004179a0
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
xor edx, edx
xor ecx, ecx
test ebx, ebx
je 0x40112b
mov eax, dword [ebp - 0xc]
mov esi, edx
mov edi, dword [ebp - 8]
mov dword [ebp - 0x18], edx
mov al, byte [ecx + eax]
inc ecx
mov byte [edi + edx], al
inc edx
mov edi, dword [ebp - 4]
cmp ecx, ebx
jae 0x401128
and esi, 7
mov al, byte [esi + edi + 0x80]
mov esi, dword [ebp - 0xc]
xor al, byte [ecx + esi]
test al, 0xc0
jne 0x401128
inc ecx
test byte [ebp - 0x18], 1
je 0x401124
cmp ecx, ebx
jae 0x401128
mov eax, edx
and eax, 7
mov al, byte [eax + edi + 0x80]
xor al, byte [ecx + esi]
test al, 0xc0
jne 0x401128
inc ecx
cmp ecx, ebx
jb 0x4010d7
mov esi, dword [ebp - 8]
mov eax, dword [ebp + 0x10]
lea edi, [edx + 0xf]
and edi, 0xfffffff0
push edi
push 1
mov dword [eax], edx
mov dword [ebp - 0x24], edi
call fcn.004159b0
mov ebx, eax
add esp, 8
mov dword [ebp - 0x20], ebx
test ebx, ebx
jne 0x401169
push esi
call fcn.004179a0
mov esi, dword [ebp - 4]
push esi
call fcn.004179a0
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x10]
mov esi, dword [eax]
push esi
push dword [ebp - 8]
push ebx
call fcn.004144f0
mov eax, edi
sub eax, esi
push eax
lea eax, [esi + ebx]
push 0x90
push eax
call fcn.00413a70
add esp, 0x18
test edi, edi
je 0x40122d
mov eax, dword [ebp - 4]
add eax, 0x70
xor esi, esi
mov dword [ebp - 0x1c], eax
mov eax, dword [ebx + esi]
mov edi, 8
mov ecx, dword [ebx + esi + 4]
mov edx, dword [ebx + esi + 0xc]
mov dword [ebp - 0xc], eax
mov eax, dword [ebx + esi + 8]
mov ebx, dword [ebp - 0x1c]
mov dword [ebp - 0x10], eax
nop
mov dword [ebp - 0x14], ecx
lea ebx, [ebx - 0x10]
add ecx, dword [ebx + 0x10]
mov eax, dword [ebp - 0x14]
mov dword [ebp - 0x18], edx
add edx, dword [ebx + 0x10]
ror ecx, 0x1d
xor ecx, dword [ebx + 0x10]
xor ecx, dword [ebp - 0xc]
ror edx, 0x1d
xor edx, dword [ebx + 0x10]
xor edx, dword [ebp - 0x10]
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0x18]
mov dword [ebp - 0x10], eax
sub edi, 1
jne 0x4011c0
mov ebx, dword [ebp - 0x20]
mov eax, dword [ebp - 0x14]
mov edi, dword [ebp - 0x24]
mov dword [ebx + esi + 4], eax
mov eax, dword [ebp - 0x18]
mov dword [ebx + esi], ecx
mov dword [ebx + esi + 8], edx
mov dword [ebx + esi + 0xc], eax
add esi, 0x10
cmp esi, edi
jb 0x4011a1
mov esi, dword [ebp - 4]
lea eax, [edi - 1]
add eax, ebx
nop dword [eax]
cmp byte [eax], 0x90
jne 0x401230
dec eax
sub edi, 1
jne 0x401220
jmp 0x401230
mov esi, dword [ebp - 4]
mov eax, dword [ebp + 0xc]
push dword [ebp - 8]
mov dword [eax], ebx
mov eax, dword [ebp + 0x10]
mov dword [eax], edi
call fcn.004179a0
push esi
call fcn.004179a0
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret