Function at 0x412443
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x18
mov eax, dword [0x51478c]
mov cx, word [0x5147a4]
mov edx, dword [esp + 0x24]
mov dword [esp + 4], eax
dec eax
mov dword [0x51478c], eax
inc cx
mov word [0x5147a4], cx
push ebx
mov ebx, dword [esp + 0x20]
push ebp
push esi
movzx ecx, cx
mov eax, dword [ebx]
push edi
movzx eax, word [edx + eax*2]
mov dword [esp + 0x24], eax
mov eax, dword [0x514770]
mov al, byte [eax + 0xafc]
mov byte [esp + 0x2c], al
mov eax, dword [0x514784]
inc eax
mov dword [0x514784], eax
add eax, eax
mov edi, dword [ebx + eax*8]
movzx eax, word [edx + 0x2f80]
xor edx, edx
div dword [ebx + ecx*4]
add edi, dword [0x514798]
mov eax, dword [0x514778]
dec eax
mov dword [esp + 0x10], edi
mov dword [0x514778], eax
xor eax, 0x4ae
mov esi, dword [ebx]
imul ecx, esi, 0xc
dec esi
mov dword [esp + 0x1c], eax
mov eax, dword [0x5147a8]
mov dword [esp + 0x18], edx
mov eax, dword [ecx + eax + 0x64]
mov dword [ebx], esi
movzx ecx, word [0x5147a4]
mov dword [esp + 0x20], eax
mov eax, dword [0x51479c]
cmp ecx, dword [eax + esi*4]
jle 0x4126d7
cmp dword [0x514784], 0x173
jne 0x4126d7
movzx eax, word [0x514788]
mov ebp, dword [esp + 0x30]
cmp eax, dword [esi*4 + 0xfe6]
je 0x4126db
mov ecx, dword [esp + 0x10]
mov eax, 0x4de
cdq
mov edi, dword [ebp]
mov esi, dword [0x514794]
mov ecx, dword [ecx]
idiv dword [ebp + ecx*4]
mov ecx, dword [esp + 0x1c]
or dword [esi + edi*8], edx
mov si, word [0x5147a4]
mov edx, dword [esp + 0x34]
movzx eax, si
imul eax, eax, 6
mov edi, dword [esp + 0x18]
movzx ecx, cl
movzx edx, byte [eax + edx]
movzx eax, byte [esp + 0x2c]
imul edx, ecx
movzx ecx, dl
xor edx, edx
imul ecx, eax
inc si
mov word [0x5147a4], si
inc dword [ebx]
mov eax, dword [ebx]
mov esi, dword [ebp]
mov dword [esp + 0x2c], ecx
imul eax, dword [eax*4 + 0xff6], 0x1676
movzx ecx, word [edi + esi*8]
div ecx
mov word [edi + esi*8], dx
mov esi, dword [esp + 0x14]
movzx eax, word [0x514788]
dec esi
mov edi, dword [esp + 0x10]
and eax, esi
and dword [0x514784], eax
mov eax, dword [ebp]
mov dword [esp + 0x14], esi
mov edx, dword [edi + eax*4]
movzx eax, byte [0x514762]
mov dword [esp + 0x34], edx
cmp edx, eax
jle 0x4126df
mov eax, dword [esp + 0x2c]
movzx eax, al
mov dword [esp + 0x1c], eax
dec dword [ebx]
mov ecx, dword [ebx]
sub ebx, 4
mov eax, dword [0x51479c]
push dword [esp + 0x34]
mov dword [esp + 0x30], ebx
lea esi, [edi + ecx*4]
mov eax, dword [eax + ecx*4]
imul eax, dword [edx*4 + 0x331c]
xor edx, edx
push 0x779
imul eax, dword [esp + 0x24]
xor eax, 0x10e2
div dword [esi + 0x40]
mov edx, dword [esp + 0x3c]
mov dword [esi + 0x40], eax
mov eax, dword [ebp]
mov ecx, dword [0x5147a8]
imul eax, dword [eax*4 + 0x331c], 0x876
or dword [ecx + edx*4], eax
mov ecx, 0xffff
mov ax, word [0x5147a4]
add ax, cx
mov ecx, dword [0x514770]
mov word [0x5147a4], ax
movzx ebx, ax
mov eax, dword [esp + 0x20]
mov esi, dword [ecx + 0x73a0]
movzx ebp, word [eax + ebx*2]
imul eax, ebx, 0xc
mov edi, dword [eax + ecx]
mov eax, dword [esp + 0x38]
xor edi, 0x123
mov ecx, dword [esp + 0x18]
imul eax, dword [eax], 0xc
mov edx, dword [eax + ecx]
mov eax, dword [ecx]
mov ecx, dword [esp + 0x28]
movzx ecx, byte [eax + ecx]
mov eax, ebx
push ecx
push edx
xor edx, edx
mov ecx, 0xca9
div ecx
push dword [esp + 0x2c]
push esi
push edi
push dword [0x514778]
push eax
push ebp
push dword [esp + 0x4c]
call fcn.00404153
mov edx, dword [0x514784]
add esp, 0x2c
mov ecx, dword [0x514790]
mov ebx, dword [esp + 0x2c]
mov ebp, dword [esp + 0x30]
mov edi, dword [esp + 0x10]
mov dword [ecx + edx*4], eax
mov edx, dword [esp + 0x34]
dec dword [0x514784]
inc edx
movzx eax, byte [0x514762]
mov dword [esp + 0x34], edx
cmp edx, eax
jg 0x4125d2
jmp 0x4126db
mov ebp, dword [esp + 0x30]
mov esi, dword [esp + 0x14]
mov ecx, dword [ebx]
mov eax, dword [0x514768]
movzx edx, word [0x514788]
movzx ecx, byte [ecx + eax]
cmp ecx, edx
jbe 0x412705
mov eax, dword [ebp]
inc ecx
mov eax, dword [ebx + eax*4]
mov dword [0x514798], eax
cmp ecx, edx
jg 0x4126f5
mov eax, dword [ebx]
lea ecx, [esi + 1]
mov esi, 0x6ec
xor edx, edx
xor ecx, esi
mov eax, dword [ebx + eax*4]
add eax, ecx
mov ecx, 0x4eb
div ecx
mov eax, dword [ebp]
add eax, eax
and edx, esi
mov dword [edi + eax*8], edx
xor edx, edx
dec dword [ebx]
mov ecx, dword [ebx]
mov eax, dword [0x514794]
pop edi
pop esi
pop ebp
lea ecx, [eax + ecx*4]
mov eax, 0x16f7
div dword [ecx]
pop ebx
mov dword [ecx], eax
movzx eax, word [0x514760]
add esp, 0x18
ret