Function at 0x402800
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x18
push ebx
mov ebx, dword [esp + 0x28]
push ebp
push esi
mov esi, dword [esp + 0x28]
movsx eax, byte [esi + 0x12d]
mov ecx, dword [esi + 0xc8]
xor edx, edx
shl eax, 6
cmp byte [esi + 0x126], 4
push edi
sete dl
xor edi, edi
lea eax, [eax + ecx + 0x1c]
mov dword [esp + 0x1c], eax
mov dword [esp + 0x14], edi
mov dword [esp + 0x10], edi
mov dword [esp + 0x34], ebx
mov dword [esp + 0x18], edx
xor dl, dl
cmp byte [esi + 0x127], 5
mov byte [esp + 0x2c], dl
jne 0x4028a3
mov ecx, dword [esi + 0xb8]
test ecx, 0x8000
je 0x4028a3
and ecx, 0xffff7fff
add eax, 8
mov dword [esi + 0xb8], ecx
cmp dword [eax], edi
je 0x40288a
mov ecx, dword [eax]
cmp ecx, esi
je 0x402885
cmp dword [ecx + 0x10], edi
lea eax, [ecx + 0x10]
jne 0x402875
jmp 0x40288a
mov ecx, dword [esi + 0x10]
mov dword [eax], ecx
movzx ebp, byte [esi + 0xb5]
and ebp, 0xc0
or ebp, 2
mov dword [esi + 0x10], edi
mov dword [esp + 0x38], ebp
jmp 0x4028a7
mov ebp, dword [esp + 0x38]
cmp ebp, 3
je 0x402b6e
cmp ebp, 7
je 0x402b69
cmp ebp, 8
je 0x402b69
mov al, byte [esi + 0x127]
cmp al, 5
je 0x4028e3
cmp al, 7
je 0x4028d4
cmp al, 8
jne 0x4028d9
cmp ebp, 4
je 0x4028e3
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x18
ret
mov eax, dword [esi + 0xb8]
test al, 0x10
jne 0x402af0
mov edi, dword [esp + 0x30]
or eax, 0x20
cmp ebp, 4
mov dword [esi + 0xb8], eax
mov dword [esp + 0x20], edi
mov dword [esp + 0x24], ebx
jl 0x402914
cmp ebp, 6
jle 0x4029ef
push ebp
lea edx, [esp + 0x24]
push edx
push 0x15
push esi
call fcn.00406bd0
add esp, 0x10
test eax, eax
jl 0x402ba2
je 0x402967
cmp dword [esp + 0x24], 0
je 0x40299c
mov eax, dword [esp + 0x1c]
or dword [esi + 0xb8], 0x8000
mov ecx, dword [eax + 8]
mov dword [esi + 0x10], ecx
push esi
mov dword [eax + 8], esi
call fcn.00404010
mov eax, dword [esp + 0x3c]
add esp, 4
mov byte [esi + 0xb5], al
or eax, 0x40
mov dword [esp + 0x38], eax
cmp dword [esp + 0x24], 0
je 0x40299c
mov eax, dword [esi + 0xb8]
test eax, 0x2000
je 0x40299c
movzx edx, byte [esi + 0xb4]
and eax, 0xffffdfff
mov dword [esi + 0xb8], eax
mov eax, dword [esp + 0x38]
and eax, 0xc0
or edx, eax
mov dword [esp + 0x38], edx
mov edi, dword [esp + 0x20]
cmp dword [esp + 0x30], edi
je 0x4029e7
test ebx, ebx
je 0x4029e0
cmp dword [esp + 0x24], 0
jne 0x4029e0
mov eax, dword [esi + 0xb8]
test eax, 0x2000
jne 0x4029cb
mov cl, byte [esp + 0x38]
and cl, 0x3f
mov byte [esi + 0xb4], cl
or eax, 0x2000
pop edi
mov dword [esi + 0xb8], eax
pop esi
pop ebp
mov eax, ebx
pop ebx
add esp, 0x18
ret
and dword [esi + 0xb8], 0xffffffdf
mov ebp, dword [esp + 0x38]
mov dl, byte [esp + 0x2c]
cmp byte [esi + 0x125], 0xd
mov ebx, dword [esp + 0x24]
mov dword [esp + 0x30], edi
jne 0x402af0
cmp dword [esp + 0x18], 0
je 0x402a23
lea ecx, [edi - 4]
mov byte [esp + 0x2c], 0x80
mov dl, byte [esp + 0x2c]
mov dword [esp + 0x10], 4
mov dword [esp + 0x14], ecx
and ebp, 0xf
cmp ebp, 6
ja case.0x402a2f.3
jmp dword [ebp*4 + 0x402bf8]
mov ecx, 1
jmp 0x402a5b
mov ecx, 2
jmp 0x402a5b
xor ecx, ecx
jmp 0x402a5b
mov ecx, 8
jmp 0x402a5b
mov ecx, 9
jmp 0x402a5b
mov ecx, 0xa
test byte [esp + 0x38], 0x40
jne 0x402a68
or ecx, 0x80
mov eax, dword [esp + 0x24]
cmp eax, 0x7e
jae 0x402a89
mov eax, dword [esp + 0x10]
add eax, 2
sub edi, eax
mov dword [esp + 0x10], eax
mov al, bl
or al, dl
mov byte [edi], cl
mov byte [edi + 1], al
jmp 0x402aec
mov ebp, dword [esp + 0x10]
cmp eax, 0x10000
mov eax, edi
jae 0x402ab0
add ebp, 4
sub eax, ebp
mov byte [eax], cl
or dl, 0x7e
mov ecx, ebx
mov byte [eax + 1], dl
shr ecx, 8
mov byte [eax + 2], cl
mov byte [eax + 3], bl
jmp 0x402ae8
add ebp, 0xa
sub eax, ebp
mov byte [eax], cl
or dl, 0x7f
mov byte [eax + 1], dl
mov byte [eax + 2], 0
mov byte [eax + 3], 0
mov byte [eax + 4], 0
mov byte [eax + 5], 0
mov edx, ebx
shr edx, 0x18
mov byte [eax + 6], dl
mov ecx, ebx
shr ecx, 0x10
mov edx, ebx
mov byte [eax + 7], cl
shr edx, 8
mov byte [eax + 8], dl
mov byte [eax + 9], bl
mov dword [esp + 0x10], ebp
mov ebp, dword [esp + 0x38]
cmp dword [esp + 0x18], 0
je 0x402b69
test byte [esi + 0xb8], 0x10
jne 0x402b27
call fcn.00402630
test eax, eax
je 0x402b23
push str.frame_mask_generation_failed_n
push 1
call fcn.00403280
add esp, 8
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x18
ret
mov ebp, dword [esp + 0x38]
cmp dword [esp + 0x14], 0
je 0x402b69
mov eax, 4
lea edi, [ebx + 4]
cmp edi, eax
jle 0x402b60
lea ebx, [ebx]
movzx ecx, byte [esi + 0xae]
and ecx, 3
mov dl, byte [ecx + esi + 0x1c]
mov ecx, dword [esp + 0x14]
xor byte [eax + ecx], dl
inc byte [esi + 0xae]
inc eax
cmp eax, edi
jl 0x402b40
mov eax, dword [esi + 0x1c]
mov ecx, dword [esp + 0x14]
mov dword [ecx], eax
cmp ebp, 3
jl 0x402bad
cmp ebp, 8
jg 0x402bad
mov ecx, dword [esp + 0x10]
mov eax, dword [esp + 0x30]
lea edx, [ecx + ebx]
push edx
sub eax, ecx
push eax
push esi
call fcn.00402660
add esp, 0xc
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret
push str.lws_write:_unknown_write_opc___wp_n
push 2
call fcn.00403280
add esp, 8
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x18
ret
mov edi, dword [esp + 0x10]
mov eax, dword [esp + 0x30]
add ebx, edi
push ebx
sub eax, edi
push eax
push esi
call fcn.00406ce0
or dword [esi + 0xb8], 0x10
mov ecx, dword [esi + 0xb8]
add esp, 0xc
test eax, eax
jle 0x402bf0
cmp eax, ebx
jne 0x402bee
mov eax, dword [esp + 0x34]
pop edi
and ecx, 0xffffffef
mov dword [esi + 0xb8], ecx
pop esi
pop ebp
pop ebx
add esp, 0x18
ret
sub eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret