Function at 0x40d3a0
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0xf1c
mov eax, dword [esp + 0xf20]
push ebx
mov ebx, dword [esp + 0xf30]
push ebp
imul eax, ebx
add eax, 0x1f
push esi
cdq
mov esi, dword [esp + 0xf34]
and edx, 0x1f
add eax, edx
push edi
mov edi, eax
mov ebp, esi
sar edi, 5
shl edi, 2
push edi
mov dword [esp + 0x24], edi
mov dword [esp + 0x2c], ebp
call fcn.0040fe70
add esp, 4
mov dword [esp + 0x24], eax
test eax, eax
jne 0x40d3fc
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xf1c
ret
dec ebx
cmp ebx, 0x17
ja case.0x40d40e.5
xor eax, eax
mov al, byte [ebx + 0x40d6e0]
jmp dword [eax*4 + 0x40d6cc]
mov ebp, dword [esp + 0xf40]
mov eax, dword [ebp]
lea ecx, [eax + eax*2]
mov eax, dword [ebp + 8]
lea edx, [eax + eax*2]
mov dword [esp + 0x28], edx
mov edx, dword [ebp + 4]
mov ebx, edx
mov dword [esp + 0x14], edx
imul ebx, edi
add ebx, ecx
add ebx, esi
mov eax, dword [ebp + 4]
mov ecx, dword [ebp + 0xc]
add eax, ecx
mov ecx, dword [esp + 0xf34]
cmp eax, ecx
jl 0x40d451
mov eax, ecx
cmp edx, eax
jae case.0x40d40e.5
mov edx, dword [ebp + 8]
mov esi, dword [esp + 0x24]
push edx
push ebx
push esi
call fcn.0040d1e0
mov ecx, dword [esp + 0x34]
mov edi, ebx
mov eax, ecx
add esp, 0xc
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x20]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x14]
inc ecx
add ebx, eax
mov dword [esp + 0x14], ecx
mov edx, ecx
jmp 0x40d43c
mov ebp, dword [esp + 0xf40]
mov ecx, dword [ebp + 8]
mov eax, dword [ebp]
mov dword [esp + 0x28], ecx
mov ecx, dword [ebp + 4]
mov ebx, ecx
mov dword [esp + 0x14], ecx
imul ebx, edi
add ebx, eax
add ebx, esi
mov edx, dword [ebp + 4]
mov eax, dword [ebp + 0xc]
add eax, edx
mov edx, dword [esp + 0xf34]
cmp eax, edx
jl 0x40d4c8
mov eax, edx
cmp ecx, eax
jae case.0x40d40e.5
mov ecx, dword [ebp + 8]
mov esi, dword [esp + 0x24]
push ecx
push ebx
push esi
call fcn.0040d220
mov ecx, dword [esp + 0x34]
mov edi, ebx
mov edx, ecx
mov eax, dword [esp + 0x2c]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
add esp, 0xc
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x14]
inc ecx
add ebx, eax
mov dword [esp + 0x14], ecx
jmp 0x40d4b3
xor eax, eax
mov cl, al
mov edx, eax
shl cl, 4
shr edx, 4
xor dl, cl
and dl, 0xf
xor dl, cl
mov byte [esp + eax + 0x2c], dl
inc eax
cmp eax, 0x100
jb 0x40d509
mov ebx, dword [esp + 0xf34]
test ebx, ebx
jbe case.0x40d40e.5
jmp 0x40d53b
mov edi, dword [esp + 0x20]
mov ecx, dword [esp + 0xf30]
mov edx, dword [esp + 0x24]
lea eax, [esp + 0x2c]
push eax
push ecx
push ebp
push edx
call fcn.0040d240
mov esi, dword [esp + 0x34]
mov ecx, edi
mov eax, ecx
mov edi, ebp
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
add esp, 0x10
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x20]
add ebp, ecx
dec ebx
jne 0x40d537
jmp case.0x40d40e.5
mov byte [esp + 0x14], 0
mov byte [esp + 0x15], 0x80
mov byte [esp + 0x16], 0xc0
mov byte [esp + 0x17], 0xe0
mov byte [esp + 0x18], 0xf0
mov byte [esp + 0x19], 0xf8
mov byte [esp + 0x1a], 0xfc
mov byte [esp + 0x1b], 0xfe
xor ebp, ebp
xor edx, edx
mov eax, 1
mov ecx, 0x80
test ebp, eax
je 0x40d5b6
or edx, ecx
add eax, eax
shr ecx, 1
cmp eax, 0x100
jb 0x40d5b0
mov byte [esp + ebp + 0x2c], dl
mov esi, 1
mov edi, ebp
lea ecx, [esi - 1]
mov al, 1
shl al, cl
mov edx, 0x80
mov byte [esp + 0x13], 0
sar edx, cl
mov byte [esp + 0x12], 0
mov byte [esp + 0x1f], al
xor eax, eax
test esi, esi
jbe 0x40d623
mov ebx, 0x80
mov cl, al
shr ebx, cl
test ebp, ebx
je 0x40d605
mov bl, dl
mov ecx, eax
shl bl, cl
or byte [esp + 0x13], bl
mov ebx, 1
mov ecx, eax
shl ebx, cl
test ebp, ebx
je 0x40d61e
mov bl, byte [esp + 0x1f]
mov cl, al
shr bl, cl
or byte [esp + 0x12], bl
inc eax
cmp eax, esi
jb 0x40d5ee
mov cl, byte [esp + 0x13]
mov dl, byte [esp + 0x12]
mov byte [esp + edi + 0x82c], cl
mov byte [esp + edi + 0x12c], dl
inc esi
add edi, 0x100
cmp esi, 8
jb 0x40d5cc
inc ebp
cmp ebp, 0x100
jl 0x40d5a4
mov ebx, dword [esp + 0xf34]
test ebx, ebx
jbe case.0x40d40e.5
mov ebp, dword [esp + 0x28]
mov esi, dword [esp + 0x24]
lea eax, [esp + 0x14]
lea ecx, [esp + 0x12c]
push eax
lea edx, [esp + 0x830]
push ecx
mov ecx, dword [esp + 0xf38]
lea eax, [esp + 0x34]
push edx
push eax
push ecx
push ebp
push esi
call fcn.0040d2c0
mov ecx, dword [esp + 0x3c]
mov edi, ebp
mov edx, ecx
add esp, 0x1c
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, edx
add ebp, ecx
dec ebx
mov dword [esp + 0x28], ebp
jne 0x40d65d
mov eax, dword [esp + 0x24]
push eax
call fcn.0040fa4a
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xf1c
ret