Function at 0x40ba80
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x2c
push esi
mov esi, dword [esp + 0x38]
xor eax, eax
push edi
mov edi, dword [esp + 0x38]
mov dword [esp + 0x28], eax
lea edx, [esi + 0xb7c]
mov dword [esp + 0x2c], edx
lea ecx, [edi + 0x1808]
mov dword [esp + 0x18], ecx
cmp dword [esp + 0x44], eax
jle 0x40bb41
mov ecx, dword [esp + 0x2c]
lea edx, [esi + 0x1d7c]
mov edi, dword [esp + 0x40]
mov dword [esp + 0x24], ecx
lea ecx, [esi + 0x3f1c]
mov dword [esp + 0x1c], edx
mov dword [esp + 0x20], ecx
mov eax, dword [esp + 0x3c]
movzx esi, word [edi + 4]
add esi, dword [eax + 4]
mov eax, dword [esp + 0x28]
push eax
push edx
push edi
push dword [esp + 0x48]
push ecx
push dword [esp + 0x2c]
call fcn.0040bdc0
push esi
push dword [esp + 0x38]
mov esi, dword [esp + 0x44]
push edi
push dword [esp + 0x60]
push esi
call fcn.0040c0a0
mov eax, dword [esp + 0x54]
add esi, 0x900
mov ecx, dword [esp + 0x4c]
inc eax
mov edx, dword [esp + 0x48]
add ecx, 0x27
add esp, 0x2c
mov dword [esp + 0x28], eax
add edi, 0x1c
mov dword [esp + 0x20], ecx
mov dword [esp + 0x24], esi
cmp eax, dword [esp + 0x44]
jl 0x40bad1
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x2c]
mov edi, dword [esp + 0x38]
jmp 0x40bb45
mov dword [esp + 0x2c], edx
mov al, byte [edi + 0x180b]
test al, 0x10
je 0x40bb6a
mov eax, dword [esp + 0x3c]
mov esi, dword [esp + 0x40]
add eax, 0x3f43
push ecx
push esi
push eax
push edx
call fcn.0040d290
add esp, 0x10
jmp 0x40bb82
and al, 0xe0
cmp al, 0x60
jne 0x40bb7e
push 0x240
push edx
call fcn.0040d490
add esp, 8
mov esi, dword [esp + 0x40]
cmp dword [esp + 0x44], 0
jle 0x40bdaf
lea ecx, [edi + 0x1809]
mov dword [esp + 0x20], 0
lea eax, [esi + 0xe]
mov dword [esp + 0xc], ecx
mov esi, dword [esp + 0x2c]
add edi, 0x180a
mov dword [esp + 8], edi
mov dword [esp + 0x28], eax
nop dword [eax]
nop dword [eax + eax]
movzx eax, byte [ecx]
mov ecx, eax
mov dword [esp + 0x18], 0x1f
shr eax, 3
shr ecx, 4
and eax, 1
and ecx, 1
add ecx, eax
movzx eax, byte [edi]
shr eax, 2
and eax, 3
lea edx, [ecx + ecx*2]
xor ecx, ecx
add edx, eax
mov eax, 2
cmp edx, 2
mov edx, dword [esp + 0x28]
sete cl
xor edi, edi
cmp byte [edx - 2], 0
cmovne edi, eax
shl edi, cl
cmp byte [edx], 0
mov dword [esp + 0x14], edi
je 0x40bcbf
lea eax, [edi - 1]
mov dword [esp + 0x18], eax
movzx eax, byte [edx - 1]
add eax, dword [edx - 0xe]
mov edx, dword [esp + 0x3c]
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x20]
add eax, edi
lea ecx, [edx + 0x1e1c]
lea eax, [eax + eax*8]
lea eax, [eax*8 + 0xb7c]
add eax, edx
mov dword [esp + 0x10], eax
mov edx, eax
mov eax, dword [esp + 0x24]
movzx esi, byte [eax]
test esi, esi
je 0x40bc9f
lea edi, [esi*8]
test esi, esi
je 0x40bc8a
lea eax, [esi*4]
mov dword [esp + 0x1c], eax
mov eax, dword [edx]
mov dword [ecx], eax
mov eax, dword [esp + 0x1c]
mov eax, dword [eax + edx]
mov dword [ecx + 4], eax
mov eax, dword [edi + edx]
add edx, 4
mov dword [ecx + 8], eax
add ecx, 0xc
sub esi, 1
jne 0x40bc67
mov eax, dword [esp + 0x24]
movzx esi, byte [eax + 3]
add eax, 3
add edx, edi
mov dword [esp + 0x24], eax
test esi, esi
jne 0x40bc51
mov edi, dword [esp + 0x14]
mov eax, dword [esp + 0x3c]
add eax, 0x1e1c
sub ecx, eax
and ecx, 0xfffffffc
push ecx
push eax
push dword [esp + 0x18]
call fcn.004347f0
mov esi, dword [esp + 0x38]
add esp, 0xc
push dword [esp + 0x18]
push esi
call fcn.0040b950
mov eax, dword [esp + 0x30]
add esp, 8
mov edx, esi
mov al, byte [eax - 3]
mov byte [esp + 0x33], al
mov eax, dword [esp + 0x38]
mov ecx, eax
test edi, edi
je 0x40bd03
push edi
push 0x5112e0
push eax
push esi
call fcn.0040c8c0
mov ecx, dword [esp + 0x48]
lea eax, [edi + edi*8]
lea edx, [esi + eax*8]
add esp, 0x10
lea eax, [edi + edi*8]
lea ecx, [ecx + eax*4]
mov eax, 0x20
sub eax, edi
cmp byte [esp + 0x33], 2
push eax
jne 0x40bd1e
push ecx
push edx
call fcn.0040cfe0
add esp, 0xc
jmp 0x40bd3d
xor eax, eax
mov edi, 0x48
cmp byte [esp + 0x37], 3
cmove eax, edi
add eax, 0x5112e0
push eax
push ecx
push edx
call fcn.0040c8c0
add esp, 0x10
movss xmm1, dword [0x511aa0]
lea ecx, [esi + 0x48]
mov edx, 0x10
nop dword [eax]
mov eax, 1
nop word [eax + eax]
movss xmm0, dword [ecx + eax*4]
xorps xmm0, xmm1
movss dword [ecx + eax*4], xmm0
add eax, 2
cmp eax, 0x12
jl 0x40bd60
add ecx, 0x90
sub edx, 1
jne 0x40bd50
add dword [esp + 0x20], 0x20
add esi, 0x900
add dword [esp + 0x38], 0x480
add dword [esp + 0x28], 0x1c
sub dword [esp + 0x44], 1
mov ecx, dword [esp + 0xc]
mov edi, dword [esp + 8]
mov dword [esp + 0x2c], esi
jne 0x40bbc0
pop edi
pop esi
add esp, 0x2c
ret