Function at 0x405470
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x28
mov eax, dword [0x40c380]
push ebx
mov ebx, ecx
mov dword [esp + 0x28], eax
cmp dword [ebx], 0
mov dword [esp + 4], ebx
je 0x40549d
mov eax, 0xfffffffb
pop ebx
mov ecx, dword [esp + 0x24]
call fcn.00406674
add esp, 0x28
ret 0xc
mov ecx, dword [ebx + 4]
cmp ecx, 2
je 0x4054c1
mov eax, dword [ebx + 8]
test eax, eax
jne 0x4054c1
mov eax, 0xfffffffa
pop ebx
mov ecx, dword [esp + 0x24]
call fcn.00406674
add esp, 0x28
ret 0xc
push edi
mov edi, dword [esp + 0x34]
test edi, edi
je 0x4057d2
mov eax, dword [esp + 0x38]
test eax, eax
jle 0x4057d2
cdq
and edx, 0x7f
add eax, edx
push ebp
push esi
mov esi, eax
sar esi, 7
mov eax, ecx
sub eax, 0
mov dword [esp + 0x40], esi
je 0x405794
dec eax
je 0x4056de
dec eax
je 0x405516
pop esi
pop ebp
pop edi
or eax, 0xffffffff
pop ebx
mov ecx, dword [esp + 0x24]
call fcn.00406674
add esp, 0x28
ret 0xc
test esi, esi
mov eax, dword [ebx + 0xc]
mov ecx, dword [ebx + 0x10]
mov edx, dword [ebx + 0x14]
mov dword [esp + 0x14], eax
mov eax, dword [ebx + 0x18]
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], edx
mov dword [esp + 0x20], eax
jle 0x4057ba
mov ebp, dword [esp + 0x44]
mov dword [esp + 0x3c], esi
xor esi, esi
mov edx, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
mov eax, dword [esp + 0x1c]
mov bl, byte [esp + 0x15]
mov dword [esp + 0x24], ecx
mov ecx, dword [esp + 0x20]
mov dword [esp + 0x28], edx
lea edx, [esp + 0x24]
mov dword [esp + 0x2c], eax
push edx
mov eax, edx
mov dword [esp + 0x34], ecx
mov ecx, dword [esp + 0x14]
push eax
call fcn.00404b90
mov dl, byte [esp + 0x14]
mov al, byte [esp + 0x16]
shl dl, 1
mov cl, bl
shr cl, 7
or cl, dl
mov byte [esp + 0x14], cl
mov cl, al
shr cl, 7
shl bl, 1
or cl, bl
mov byte [esp + 0x15], cl
mov cl, byte [esp + 0x17]
mov dl, cl
shr dl, 7
shl al, 1
or dl, al
mov al, byte [esp + 0x18]
mov byte [esp + 0x16], dl
mov dl, al
shr dl, 7
shl cl, 1
or dl, cl
mov cl, byte [esp + 0x19]
mov byte [esp + 0x17], dl
mov dl, cl
shr dl, 7
shl al, 1
or dl, al
mov al, byte [esp + 0x1a]
mov byte [esp + 0x18], dl
mov dl, al
shr dl, 7
shl cl, 1
or dl, cl
mov cl, byte [esp + 0x1b]
mov byte [esp + 0x19], dl
mov dl, cl
shr dl, 7
shl al, 1
or dl, al
mov al, byte [esp + 0x1c]
mov byte [esp + 0x1a], dl
mov dl, al
shr dl, 7
shl cl, 1
or dl, cl
mov cl, byte [esp + 0x1d]
mov byte [esp + 0x1b], dl
mov dl, cl
shr dl, 7
shl al, 1
or dl, al
mov al, byte [esp + 0x1e]
mov byte [esp + 0x1c], dl
mov dl, al
shr dl, 7
shl cl, 1
or dl, cl
mov cl, byte [esp + 0x1f]
mov byte [esp + 0x1d], dl
mov dl, cl
shr dl, 7
shl al, 1
or dl, al
mov byte [esp + 0x1e], dl
mov al, byte [esp + 0x20]
shl cl, 1
mov dl, al
shr dl, 7
or dl, cl
mov cl, byte [esp + 0x21]
mov byte [esp + 0x1f], dl
mov dl, cl
shr dl, 7
shl al, 1
or dl, al
mov al, byte [esp + 0x22]
shl cl, 1
mov byte [esp + 0x20], dl
mov dl, al
shr dl, 7
or dl, cl
mov cl, byte [esp + 0x23]
shr cl, 7
shl al, 1
or cl, al
mov byte [esp + 0x21], dl
mov byte [esp + 0x22], cl
mov edx, esi
and edx, 7
mov eax, esi
shr eax, 3
mov bl, byte [eax + edi]
mov cl, 7
sub cl, dl
shr bl, cl
mov cl, byte [esp + 0x23]
shl cl, 1
and bl, 1
or bl, cl
mov byte [esp + 0x23], bl
mov bl, byte [esp + 0x24]
and bl, 0x80
mov cl, dl
mov dl, byte [eax + ebp]
shr bl, cl
xor dl, bl
inc esi
cmp esi, 0x80
mov byte [eax + ebp], dl
jl 0x405544
dec dword [esp + 0x3c]
jne 0x405542
mov esi, dword [esp + 0x40]
mov eax, esi
pop esi
pop ebp
pop edi
shl eax, 7
pop ebx
mov ecx, dword [esp + 0x24]
call fcn.00406674
add esp, 0x28
ret 0xc
test esi, esi
mov edx, dword [ebx + 0x10]
mov eax, dword [ebx + 0x14]
mov ecx, dword [ebx + 0x18]
mov ebp, dword [ebx + 0xc]
mov dword [esp + 0x18], edx
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], ecx
jle 0x4057ba
mov dword [esp + 0x3c], esi
mov esi, dword [esp + 0x44]
lea edx, [esp + 0x24]
push edx
push edi
mov ecx, ebx
call fcn.00404f60
mov edx, dword [esp + 0x18]
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x28]
xor eax, ebp
mov ebp, dword [esp + 0x1c]
xor ecx, edx
mov edx, dword [esp + 0x2c]
xor edx, ebp
mov ebp, dword [esp + 0x20]
xor dword [esp + 0x30], ebp
mov ebp, dword [edi]
mov dword [esi], eax
mov dword [esp + 0x24], eax
mov eax, dword [edi + 4]
mov dword [esi + 4], ecx
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x30]
mov dword [esp + 0x28], ecx
mov ecx, dword [edi + 8]
mov dword [esi + 8], edx
mov dword [esp + 0x2c], edx
mov edx, dword [edi + 0xc]
mov dword [esi + 0xc], eax
mov eax, dword [esp + 0x3c]
add edi, 0x10
add esi, 0x10
dec eax
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], edx
mov dword [esp + 0x3c], eax
jne 0x405706
mov esi, dword [esp + 0x40]
mov eax, esi
pop esi
pop ebp
pop edi
shl eax, 7
pop ebx
mov ecx, dword [esp + 0x24]
call fcn.00406674
add esp, 0x28
ret 0xc
test esi, esi
jle 0x4057ba
mov ebp, dword [esp + 0x44]
mov dword [esp + 0x3c], esi
push ebp
push edi
mov ecx, ebx
call fcn.00404f60
mov eax, dword [esp + 0x3c]
add edi, 0x10
add ebp, 0x10
dec eax
mov dword [esp + 0x3c], eax
jne 0x4057a0
mov eax, esi
pop esi
pop ebp
pop edi
shl eax, 7
pop ebx
mov ecx, dword [esp + 0x24]
call fcn.00406674
add esp, 0x28
ret 0xc
mov ecx, dword [esp + 0x2c]
pop edi
xor eax, eax
pop ebx
call fcn.00406674
add esp, 0x28
ret 0xc