Function at 0x407040
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x4c
mov dword [esp + 0x20], ecx
mov ecx, dword [edx + 4]
mov dword [esp + 0x1c], eax
mov dword [esp + 0x24], edx
test ecx, ecx
mov dword [esp + 0x28], ecx
je 0x4072c0
mov eax, dword [edx]
xor ebp, ebp
lea ecx, [eax + ecx*8]
lea esi, [esi]
mov edx, dword [eax]
add edx, dword [eax + 4]
add eax, 8
xor ebp, edx
cmp eax, ecx
jne 0x407070
mov eax, dword [esp + 0x28]
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x1c]
mov edi, dword [eax + 0x460]
test edi, edi
jle 0x4072cf
mov eax, dword [esp + 0x1c]
mov ebx, edi
xor esi, esi
mov edi, ebp
mov ebp, ebx
mov eax, dword [eax + 0x45c]
mov dword [esp + 0x2c], eax
jmp 0x4070be
add esi, 1
add eax, 0x28
cmp esi, ebp
je 0x407160
cmp dword [eax], edi
jne 0x4070b0
mov ebx, dword [esp + 0x18]
cmp ebx, dword [eax + 8]
jne 0x4070b0
movzx edx, byte [eax + 0x10]
cmp edx, dword [esp + 0x20]
jne 0x4070b0
test ebx, ebx
je 0x40727f
mov ecx, dword [esp + 0x24]
mov edx, dword [eax + 4]
mov ecx, dword [ecx]
mov ebx, dword [edx + 4]
cmp dword [ecx + 4], ebx
jne 0x4070b0
mov ebx, dword [edx]
cmp dword [ecx], ebx
jne 0x4070b0
mov dword [esp + 0x30], edi
add ecx, 8
add edx, 8
xor ebx, ebx
mov dword [esp + 0x34], eax
mov dword [esp + 0x38], esi
mov edi, dword [esp + 0x18]
mov dword [esp + 0x3c], ebp
jmp 0x40712a
mov ebp, dword [edx + 4]
cmp dword [ecx + 4], ebp
mov esi, ecx
mov eax, edx
jne 0x407131
add ecx, 8
add edx, 8
mov eax, dword [eax]
cmp dword [esi], eax
jne 0x407131
add ebx, 1
cmp ebx, edi
jne 0x407112
cmp dword [esp + 0x18], ebx
mov edi, dword [esp + 0x30]
mov eax, dword [esp + 0x34]
mov esi, dword [esp + 0x38]
mov ebp, dword [esp + 0x3c]
je 0x40727f
add esi, 1
add eax, 0x28
cmp esi, ebp
jne 0x4070be
lea esi, [esi]
lea ecx, [esi + esi*4]
mov eax, ebp
mov ebp, edi
mov edi, eax
lea ebx, [ecx*8]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x28]
mov eax, dword [esp + 0x2c]
cmp edi, dword [ecx + 0x464]
jae 0x4072a0
mov edi, dword [esp + 0x1c]
mov dword [edi + 0x45c], eax
add eax, ebx
mov dword [eax], ebp
add eax, 4
call fcn.00404f40
mov ebp, dword [esp + 0x24]
mov ecx, dword [edi + 0x45c]
lea edx, [ebp + 4]
add ecx, ebx
mov eax, ebp
add ecx, 4
call fcn.00406fc0
movzx ecx, byte [esp + 0x20]
mov eax, dword [edi + 0x45c]
mov byte [eax + ebx + 0x10], cl
add ebx, dword [edi + 0x45c]
xor edi, edi
mov dword [ebx + 0x20], 0
mov edx, dword [ebp + 4]
mov ecx, ebx
mov byte [ebx + 0x11], 0
mov byte [ebx + 0x12], 0
mov word [ebx + 0x14], di
mov dword [ebx + 0x18], 0
test edx, edx
mov dword [ebx + 0x1c], 0
je 0x407274
mov eax, dword [esp + 0x1c]
mov ebx, dword [esp + 0x20]
mov ebp, dword [eax + 0xc]
mov eax, dword [esp + 0x24]
and ebx, 0xf
mov dword [esp + 0x20], ebx
mov dword [esp + 0x24], esi
mov eax, dword [eax]
lea edi, [eax + edx*8]
jmp 0x40722f
cmp edx, 0x101
je 0x407290
add eax, 8
cmp eax, edi
je 0x407270
mov edx, dword [eax]
mov edx, dword [ebp + edx*4]
test edx, edx
jns 0x407220
mov esi, dword [eax + 4]
mov ebx, esi
sar ebx, 4
mov dword [esp + 0x18], ebx
mov ebx, esi
sar ebx, 8
or ebx, dword [esp + 0x18]
or ebx, esi
test dword [esp + 0x20], ebx
je 0x40725a
or word [ecx + 0x14], si
mov ebx, dword [ecx + 0x18]
test ebx, ebx
jne 0x407228
add eax, 8
mov dword [ecx + 0x18], edx
cmp eax, edi
jne 0x40722f
nop
lea esi, [esi]
mov esi, dword [esp + 0x24]
mov eax, dword [esp + 0x1c]
add dword [eax + 0x460], 1
add esp, 0x4c
mov eax, esi
pop ebx
pop esi
pop edi
pop ebp
ret
mov edx, 0x777
mov byte [ecx + 0x11], 1
mov word [ecx + 0x14], dx
jmp 0x407228
mov edx, edi
add ecx, 0x464
mov dword [esp], 0x28
call fcn.00405140
mov edi, dword [esp + 0x24]
mov edx, dword [edi + 4]
jmp 0x407188
mov dword [esp + 0x18], 0
xor ebp, ebp
jmp 0x407086
mov eax, dword [eax + 0x45c]
xor ebx, ebx
xor esi, esi
mov dword [esp + 0x2c], eax
jmp 0x407170