Function at 0x802220
Capabilities:
Encode data using xor

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x10
mov eax, dword [0xbcbae0]
xor ebp, ebp
xor eax, esp
mov dword [esp + 0xc], eax
cmp dword [edx + 0x38], 0
je 0x8025aa
mov esi, dword [ecx]
mov ebx, ecx
mov edi, edx
mov ecx, esi
call fcn.007c5030
test eax, eax
jne 0x8025aa
mov eax, dword [edi + 0x3c]
lea ecx, [esi + 0x168]
mov edx, dword [eax]
call fcn.007bf720
test eax, eax
jne 0x80242e
mov edx, fcn.007c8950
xor eax, eax
movzx esi, byte [0xbb1217]
imul edx, edx
and edx, 3
cmp edx, 2
sete al
mov ecx, eax
xor ecx, 1
lea eax, [ecx + eax*2]
or al, 4
movzx eax, al
bt esi, eax
jb 0x802411
mov al, byte [0xbb1217]
mov esi, ebx
xor ecx, ecx
cmp edx, 2
mov ah, 1
sete cl
mov ebx, ecx
xor ebx, 1
lea ecx, [ebx + ecx*2]
or cl, 4
xor cl, 7
shl ah, cl
or ah, al
lock cmpxchg byte [0xbb1217], ah
jne 0x8022a2
mov ecx, fcn.007c8950
xor edx, edx
movzx eax, al
imul ecx, ecx
and ecx, 3
cmp ecx, 2
sete dl
mov ebx, edx
xor ebx, 1
lea edx, [ebx + edx*2]
or dl, 4
xor dl, 7
movzx edx, dl
bt eax, edx
jae 0x80231c
mov ebx, esi
xor eax, eax
cmp ecx, 2
movzx esi, byte [0xbb1217]
sete al
mov edx, eax
xor edx, 1
lea eax, [edx + eax*2]
or al, 4
movzx eax, al
bt esi, eax
jae 0x8022f6
jmp 0x802411
xor eax, eax
cmp ecx, 2
movzx edx, byte [0xbb1217]
mov ebx, esi
sete al
mov ecx, eax
xor ecx, 1
lea eax, [ecx + eax*2]
or al, 4
movzx eax, al
bt edx, eax
jb 0x8023e6
mov eax, fcn.007c8950
xor ecx, ecx
imul eax, eax
and eax, 3
cmp eax, 2
sete cl
mov eax, ecx
xor eax, 0xa45d9b51
lea ecx, [eax + ecx*2 + 0x904]
mov eax, dword [0xbb1200]
mov edx, ecx
shr edx, 0x1f
or edx, ecx
xor eax, ecx
and cl, 7
mov dword [0xbb1200], eax
not eax
imul edx, eax
mov eax, dword [0xbb1204]
lea ebx, [edx + edx]
xor eax, edx
shr edx, 0x1e
mov dword [0xbb1204], eax
or ebx, edx
not eax
mov edx, dword [0xbb1208]
imul eax, ebx
lea ebx, [eax*4]
xor edx, eax
shr eax, 0x1d
mov dword [0xbb1208], edx
or ebx, eax
not edx
mov eax, dword [0xbb120c]
imul edx, ebx
lea ebx, [edx*8]
xor eax, edx
shr edx, 0x1c
mov dword [0xbb120c], eax
or ebx, edx
not eax
mov dl, 1
imul eax, ebx
shl dl, cl
mov ebx, esi
xor dword [0xbb1210], eax
or byte [0xbb1217], dl
mov eax, fcn.007c8950
xor ecx, ecx
imul eax, eax
and eax, 3
cmp eax, 2
sete cl
mov eax, ecx
xor eax, 1
lea ecx, [eax + ecx*2]
mov al, 0xfe
or cl, 4
xor cl, 7
rol al, cl
and byte [0xbb1217], al
mov eax, dword [edi + 0x3c]
push dword [eax]
push 0xbb1200
push ebx
call fcn.00782570
add esp, 0xc
mov ebp, 1
jmp 0x8025aa
mov dword [esp + 8], 0
mov ecx, esi
lea esi, [esp + 8]
mov edx, edi
mov ebp, dword [eax]
mov dword [esp + 4], ecx
push esi
push dword [ebp + 8]
push eax
call fcn.007c44e0
add esp, 0xc
mov edi, dword [esp + 8]
mov ebp, eax
test eax, eax
je 0x80259f
mov edx, fcn.0080e430
xor eax, eax
movzx esi, byte [0xbb121f]
and edx, 1
inc edx
mov ecx, edx
xor ecx, fcn.0080e430
sete al
mov ecx, eax
xor ecx, 3
lea eax, [ecx + eax*2]
bt esi, eax
jb 0x80258d
mov al, byte [0xbb121f]
mov dword [esp], ebx
mov esi, edx
xor ebx, ebx
mov ah, 1
xor esi, fcn.0080e430
sete bl
mov ecx, ebx
xor ecx, 3
lea ecx, [ecx + ebx*2]
xor cl, 7
shl ah, cl
or ah, al
lock cmpxchg byte [0xbb121f], ah
jne 0x802495
mov ecx, fcn.0080e430
xor edx, edx
movzx eax, al
and ecx, 1
inc ecx
mov esi, ecx
xor esi, fcn.0080e430
sete dl
mov ebx, edx
xor ebx, 3
lea edx, [ebx + edx*2]
xor dl, 7
movzx edx, dl
bt eax, edx
jae 0x80250f
mov ebx, dword [esp]
mov edx, ecx
xor eax, eax
movzx esi, byte [0xbb121f]
xor edx, fcn.0080e430
sete al
mov edx, eax
xor edx, 3
lea eax, [edx + eax*2]
bt esi, eax
jae 0x8024ec
jmp 0x80258d
xor eax, eax
xor ecx, fcn.0080e430
movzx edx, byte [0xbb121f]
mov ebx, dword [esp]
sete al
mov ecx, eax
xor ecx, 3
lea eax, [ecx + eax*2]
bt edx, eax
jb 0x802565
mov eax, fcn.0080e430
xor ecx, ecx
and eax, 1
inc eax
xor eax, fcn.0080e430
sete cl
mov eax, ecx
xor eax, 0x826f7f23
lea ecx, [eax + ecx*2 + 0x130]
mov al, 1
xor dword [0xbb1218], ecx
and cl, 7
shl al, cl
or byte [0xbb121f], al
mov eax, fcn.0080e430
xor ecx, ecx
and eax, 1
inc eax
xor eax, fcn.0080e430
sete cl
mov eax, ecx
xor eax, 3
lea ecx, [eax + ecx*2]
mov al, 0xfe
xor cl, 7
rol al, cl
and byte [0xbb121f], al
push edi
push 0xbb1218
push ebx
call fcn.00782570
add esp, 0xc
mov dword [ebx + 0xc], ebp
mov ecx, dword [esp + 4]
mov edx, edi
call fcn.00774f10
mov ecx, dword [esp + 0xc]
xor ecx, esp
call fcn.00980459
mov eax, ebp
add esp, 0x10
pop esi
pop edi
pop ebx
pop ebp
ret