Function at 0x508317
Capabilities:
Encode data using xor

Disassembly:
push ebx
mov ebx, dword [esp + 8]
push ebp
push esi
mov esi, dword [esp + 0x18]
mov edx, dword [ebx + 0xe8]
push edi
test edx, edx
je 0x508338
mov eax, dword [ebx + 0x84]
sub eax, esi
dec eax
jmp 0x50833a
mov eax, esi
mov ebp, dword [ebx + 0xcc]
mov edi, ebp
mov ecx, dword [ebx + 0xd4]
imul edi, eax
mov eax, ecx
imul eax, dword [esp + 0x18]
add edi, eax
add edi, dword [ebx + 0xc8]
test edx, edx
je 0x508360
neg ebp
cmp dword [ebx + 0xe0], 0
jne 0x508724
cmp dword [ebx + 0xe4], 0
jne 0x508724
mov eax, dword [ebx + 0xd8]
test al, 2
je 0x5083b4
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x508748
mov al, byte [ebx + 0xf0]
xor byte [edi + 2], al
mov al, byte [ebx + 0xf4]
xor byte [edi + 1], al
mov al, byte [ebx + 0xf8]
xor byte [edi], al
add edi, ebp
dec ecx
jne 0x508390
jmp 0x508748
test eax, 0x100
je 0x5083f4
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x508748
mov al, byte [ebx + 0xf0]
mov byte [edi + 2], al
mov al, byte [ebx + 0xf4]
mov byte [edi + 1], al
mov al, byte [ebx + 0xf8]
mov byte [edi], al
mov al, byte [ebx + 0xfc]
mov byte [edi + 3], al
add edi, ebp
dec ecx
jne 0x5083c7
jmp 0x508748
test al, 8
je 0x508420
cmp ecx, 4
jne 0x508748
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x508748
mov al, byte [ebx + 0xfc]
mov byte [edi + 3], al
add edi, ebp
dec ecx
jne 0x50840d
jmp 0x508748
test al, 0x10
je 0x5085cf
cmp ecx, 4
jne 0x508571
mov eax, dword [esp + 0x20]
jmp 0x508560
movzx edx, byte [edi + 3]
mov ecx, dword [ebx + 0xfc]
mov dword [esp + 0x18], edx
test ecx, ecx
jne 0x508452
movzx eax, byte [edi + 2]
jmp 0x508493
test edx, edx
jne 0x508461
mov eax, dword [ebx + 0xf0]
cdq
idiv ecx
jmp 0x50848f
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi + 2]
imul ecx, dword [ebx + 0xf0], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov edx, dword [esp + 0x18]
mov byte [edi + 2], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x5084a6
movzx eax, byte [edi + 1]
jmp 0x5084e3
test edx, edx
jne 0x5084b5
mov eax, dword [ebx + 0xf4]
cdq
idiv ecx
jmp 0x5084e3
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi + 1]
imul ecx, dword [ebx + 0xf4], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi + 1], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x5084f5
movzx eax, byte [edi]
jmp 0x508535
mov edx, dword [esp + 0x18]
test edx, edx
jne 0x508508
mov eax, dword [ebx + 0xf8]
cdq
idiv ecx
jmp 0x508535
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi]
imul ecx, dword [ebx + 0xf8], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi], al
imul ecx, dword [ebx + 0xfc], 0xff
mov eax, dword [ebx + 0x100]
imul eax, dword [esp + 0x18]
add eax, ecx
mov ecx, 0xff
cdq
idiv ecx
mov byte [edi + 3], al
mov eax, dword [esp + 0x14]
dec eax
add edi, ebp
mov dword [esp + 0x14], eax
test eax, eax
jne 0x50843a
jmp 0x508748
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x508748
mov esi, 0xff
movzx eax, byte [edi + 2]
imul eax, dword [ebx + 0x100]
add eax, dword [ebx + 0xf0]
cdq
idiv esi
mov byte [edi + 2], al
movzx eax, byte [edi + 1]
imul eax, dword [ebx + 0x100]
add eax, dword [ebx + 0xf4]
cdq
idiv esi
mov byte [edi + 1], al
movzx eax, byte [edi]
imul eax, dword [ebx + 0x100]
add eax, dword [ebx + 0xf8]
cdq
idiv esi
mov byte [edi], al
add edi, ebp
dec ecx
jne 0x508582
jmp 0x508748
test al, 0x20
je 0x5086fb
cmp ecx, 4
jne 0x5086fb
mov eax, dword [esp + 0x20]
jmp 0x5086ed
movzx edx, byte [edi + 3]
mov ecx, dword [ebx + 0xfc]
mov dword [esp + 0x18], edx
test ecx, ecx
jne 0x508601
movzx eax, byte [edi + 2]
jmp 0x508642
test edx, edx
jne 0x508610
mov eax, dword [ebx + 0xf0]
cdq
idiv ecx
jmp 0x50863e
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi + 2]
imul ecx, dword [ebx + 0xf0], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov edx, dword [esp + 0x18]
mov byte [edi + 2], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x508655
movzx eax, byte [edi + 1]
jmp 0x508692
test edx, edx
jne 0x508664
mov eax, dword [ebx + 0xf4]
cdq
idiv ecx
jmp 0x508692
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi + 1]
imul ecx, dword [ebx + 0xf4], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi + 1], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x5086a4
movzx eax, byte [edi]
jmp 0x5086e4
mov edx, dword [esp + 0x18]
test edx, edx
jne 0x5086b7
mov eax, dword [ebx + 0xf8]
cdq
idiv ecx
jmp 0x5086e4
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi]
imul ecx, dword [ebx + 0xf8], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi], al
mov eax, dword [esp + 0x14]
dec eax
add edi, ebp
mov dword [esp + 0x14], eax
test eax, eax
jne 0x5085e9
jmp 0x508748
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x508748
mov al, byte [ebx + 0xf0]
mov byte [edi + 2], al
mov al, byte [ebx + 0xf4]
mov byte [edi + 1], al
mov al, byte [ebx + 0xf8]
mov byte [edi], al
add edi, ebp
dec ecx
jne 0x508703
jmp 0x508748
mov eax, dword [esp + 0x20]
mov dword [esp + 0x14], eax
test eax, eax
je 0x508748
push edi
push esi
push dword [esp + 0x20]
push ebx
call fcn.00507e49
add esp, 0x10
add edi, ebp
inc esi
dec dword [esp + 0x14]
jne 0x508730
pop edi
pop esi
pop ebp
pop ebx
ret