Function at 0x401988
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x2c
cmp dword [0x411080], 3
mov dword [esp + 0x24], 0
mov dword [esp + 0x20], 2
jg 0x401c68
mov eax, dword [0x411060]
xor ebp, ebp
test eax, eax
mov dword [0x4146d0], 2
je 0x40252e
mov ebx, dword [0x4146e0]
mov esi, dword [0x411040]
shl esi, 5
movzx ecx, byte [ebx + 0x421032]
xor esi, ecx
and esi, 0x7fff
movzx ecx, word [esi + esi + 0x4522e0]
mov edx, ebx
and edx, 0x7fff
test ecx, ecx
mov word [edx + edx + 0x4422e0], cx
mov dword [0x411040], esi
mov word [esi + esi + 0x4522e0], bx
je 0x401a2b
mov edi, ebx
sub edi, ecx
cmp edi, 0x7efa
ja 0x401a2b
mov eax, dword [section..data]
sub eax, 0x106
cmp eax, ebx
jae 0x40250a
cmp ebp, 2
jbe 0x401aac
sub esp, 8
lea esi, [ebp - 3]
sub ebx, dword [0x4146f0]
push esi
push ebx
call fcn.0040789c
mov edi, dword [0x411060]
mov ebx, dword [0x4110b0]
add esp, 0x10
sub edi, ebp
test ebx, ebx
mov dword [esp + 0x1c], eax
mov dword [0x411060], edi
mov dword [esp + 0x18], ebx
je 0x401f39
mov ebx, dword [0x4146e0]
cmp ebx, 0xfff
mov eax, ebx
mov ecx, ebp
ja 0x401ee8
mov edx, ebx
lea ecx, [ebx + ebp]
jmp 0x401aa2
movzx eax, byte [edx + 0x421030]
inc edx
add dword [0x411090], eax
cmp edx, 0xfff
ja 0x401edd
cmp ecx, edx
jne 0x401a88
jmp 0x401f3f
sub esp, 8
movzx eax, byte [ebx + 0x421030]
push eax
push 0
call fcn.0040789c
mov edi, dword [0x4110b0]
add esp, 0x10
test edi, edi
mov dword [esp + 0x1c], eax
mov dword [esp + 0x18], edi
je 0x401c5d
mov edx, dword [0x4146e0]
cmp edx, 0xfff
mov eax, edx
mov ebx, 1
ja 0x401b16
mov ecx, edx
lea ebx, [edx + 1]
cmp ebx, ecx
je 0x401b61
movzx esi, byte [ecx + 0x421030]
inc ecx
add dword [0x411090], esi
cmp ecx, 0xfff
jbe 0x401af1
sub ebx, 0x1000
mov eax, 0x1000
lea edi, [eax + ebx]
cmp edi, eax
mov ecx, eax
jbe 0x401b61
mov esi, dword [0x411090]
jmp 0x401b2d
inc ecx
cmp edi, ecx
jbe 0x401b5b
movzx eax, byte [ecx + 0x421030]
lea ebx, [eax + esi]
movzx eax, byte [ecx + 0x420030]
sub ebx, eax
cmp dword [0x4110a0], 0xffffffff
mov esi, ebx
jne 0x401b28
test ebx, 0xfff
jne 0x401b28
mov dword [0x4110a0], ecx
jmp 0x401b28
mov dword [0x411090], ebx
mov edi, dword [0x411060]
dec edi
mov dword [0x411060], edi
lea ebx, [edx + 1]
mov dword [0x4146e0], ebx
mov ecx, dword [esp + 0x18]
test ecx, ecx
je 0x401c50
cmp ebx, dword [0x4110a0]
jbe 0x401c50
mov dword [0x4110a0], 0xffffffff
mov dword [esp + 0x1c], 2
push 0
mov edi, dword [esp + 0x20]
dec edi
mov eax, dword [0x414720]
sub ebx, eax
push edi
xor edx, edx
test eax, eax
push ebx
js 0x401bbd
lea edx, [eax + 0x421030]
push edx
call fcn.004079f4
mov ebx, dword [0x4146e0]
add esp, 0x10
mov dword [0x414720], ebx
mov edi, dword [0x411060]
cmp edi, 0x105
ja 0x402014
mov eax, dword [0x411050]
test eax, eax
jne 0x402014
mov esi, dword [section..data]
sub esi, edi
sub esi, ebx
cmp esi, 0xffffffff
je 0x4021aa
cmp ebx, 0xfef9
ja 0x4020eb
test eax, eax
jne 0x401bd8
sub esp, 8
push esi
lea esi, [ebx + edi + 0x421030]
push esi
call dword [0x4146c0]
add esp, 0x10
test eax, eax
je 0x4021b3
cmp eax, 0xffffffff
je 0x4021b3
mov edi, dword [0x411060]
add edi, eax
mov dword [0x411060], edi
mov ebx, dword [0x4146e0]
jmp 0x401bd8
mov edx, dword [esp + 0x1c]
test edx, edx
je 0x401bd8
jmp 0x401ba1
mov edx, dword [0x4146e0]
jmp 0x401b61
mov edi, dword [0x411060]
test edi, edi
je 0x401fe1
mov ebx, dword [0x4146e0]
mov ebp, dword [0x411040]
shl ebp, 5
movzx ecx, byte [ebx + 0x421032]
xor ebp, ecx
and ebp, 0x7fff
mov eax, ebx
and eax, 0x7fff
movzx ecx, word [ebp + ebp + 0x4522e0]
mov word [eax + eax + 0x4422e0], cx
test ecx, ecx
mov eax, dword [esp + 0x20]
mov dword [0x411040], ebp
mov word [ebp + ebp + 0x4522e0], bx
mov dword [0x4146d0], eax
mov esi, dword [0x4146f0]
mov dword [esp + 0x20], 2
je 0x401e40
cmp eax, dword [0x411070]
mov edx, eax
jae 0x401d00
mov ebp, ebx
sub ebp, ecx
cmp ebp, 0x7efa
ja 0x401d00
mov eax, dword [section..data]
sub eax, 0x106
cmp eax, ebx
jae 0x401e11
cmp edx, 2
jbe 0x401d0f
cmp dword [esp + 0x20], edx
jbe 0x4021dd
mov ebp, dword [esp + 0x24]
test ebp, ebp
jne 0x4023ca
mov eax, dword [0x4110b0]
test eax, eax
je 0x401d76
cmp ebx, dword [0x4110a0]
jbe 0x401d76
mov dword [esp + 0x28], 2
mov eax, dword [0x414720]
push 0
sub ebx, eax
push 1
xor edx, edx
test eax, eax
mov dword [0x4110a0], 0xffffffff
push ebx
js 0x401d56
lea edx, [eax + 0x421030]
push edx
call fcn.004079f4
mov ebx, dword [0x4146e0]
mov dword [0x414720], ebx
add esp, 0x10
mov edi, dword [0x411060]
mov eax, dword [0x4110b0]
test eax, eax
mov dword [esp + 0x24], 1
je 0x401e57
cmp ebx, 0xfff
mov eax, ebx
mov ecx, 1
ja 0x401dc3
mov edx, ebx
lea ecx, [ebx + 1]
cmp ecx, edx
je 0x401e57
movzx ebp, byte [edx + 0x421030]
inc edx
add dword [0x411090], ebp
cmp edx, 0xfff
jbe 0x401d9a
sub ecx, 0x1000
mov eax, 0x1000
lea ecx, [eax + ecx]
cmp ecx, eax
mov edx, eax
mov dword [esp + 0x10], ecx
jbe 0x401e57
mov ebp, dword [0x411090]
mov esi, dword [0x4110a0]
jmp 0x401deb
inc edx
cmp dword [esp + 0x10], edx
jbe 0x401e4b
movzx eax, byte [edx + 0x421030]
lea ecx, [eax + ebp]
movzx eax, byte [edx + 0x420030]
sub ecx, eax
cmp esi, 0xffffffff
mov ebp, ecx
jne 0x401de4
test ecx, 0xfff
jne 0x401de4
mov esi, edx
jmp 0x401de4
sub esp, 0xc
push ecx
call fcn.0040b3b1
mov edi, dword [0x411060]
mov dword [esp + 0x30], eax
add esp, 0x10
cmp eax, edi
jbe 0x401e2f
mov dword [esp + 0x20], edi
cmp dword [esp + 0x20], 3
je 0x402398
mov ebx, dword [0x4146e0]
mov edx, dword [0x4146d0]
jmp 0x401d00
mov dword [0x4110a0], esi
mov dword [0x411090], ecx
inc ebx
mov dword [0x4146e0], ebx
dec edi
mov dword [0x411060], edi
cmp edi, 0x105
ja 0x401fbc
mov eax, dword [0x411050]
test eax, eax
jne 0x401fbc
mov esi, dword [section..data]
sub esi, edi
sub esi, ebx
cmp esi, 0xffffffff
je 0x4020e2
cmp ebx, 0xfef9
ja 0x402024
test eax, eax
jne 0x401e65
sub esp, 8
push esi
lea edx, [ebx + edi + 0x421030]
push edx
call dword [0x4146c0]
add esp, 0x10
test eax, eax
je 0x4021c8
cmp eax, 0xffffffff
je 0x4021c8
mov edi, dword [0x411060]
add edi, eax
mov dword [0x411060], edi
mov ebx, dword [0x4146e0]
jmp 0x401e65
sub ecx, 0x1000
mov eax, 0x1000
lea ecx, [eax + ecx]
cmp ecx, eax
mov edx, eax
mov dword [esp + 0x14], ecx
jbe 0x401f3f
mov esi, dword [0x411090]
jmp 0x401f0b
inc edx
cmp dword [esp + 0x14], edx
jbe 0x4023bf
movzx eax, byte [edx + 0x421030]
lea ecx, [eax + esi]
movzx esi, byte [edx + 0x420030]
sub ecx, esi
cmp dword [0x4110a0], 0xffffffff
mov esi, ecx
jne 0x401f00
test ecx, 0xfff
jne 0x401f00
mov dword [0x4110a0], edx
jmp 0x401f00
mov ebx, dword [0x4146e0]
cmp ebp, dword [0x411070]
ja 0x401f94
dec ebp
mov esi, dword [0x411040]
inc ebx
mov ecx, esi
shl ecx, 5
movzx esi, byte [ebx + 0x421032]
xor ecx, esi
and ecx, 0x7fff
mov edx, ebx
and edx, 0x7fff
movzx eax, word [ecx + ecx + 0x4522e0]
dec ebp
mov word [edx + edx + 0x4422e0], ax
mov esi, ecx
mov word [ecx + ecx + 0x4522e0], bx
jne 0x401f4e
inc ebx
mov dword [0x411040], ecx
jmp 0x401b71
add ebx, ebp
movzx ecx, byte [ebx + 0x421030]
shl ecx, 5
movzx edx, byte [ebx + 0x421031]
xor ecx, edx
xor ebp, ebp
mov dword [0x4146e0], ebx
mov dword [0x411040], ecx
jmp 0x401b77
test edi, edi
jne 0x401c7c
mov esi, dword [esp + 0x24]
test esi, esi
je 0x401fe7
sub esp, 8
movzx edi, byte [ebx + 0x42102f]
push edi
push 0
call fcn.0040789c
add esp, 0x10
mov ebx, dword [0x4146e0]
push 1
mov eax, dword [esp + 0x2c]
dec eax
push eax
mov eax, dword [0x414720]
sub ebx, eax
xor edx, edx
test eax, eax
push ebx
js 0x402003
lea edx, [eax + 0x421030]
push edx
call fcn.004079f4
add esp, 0x3c
pop ebx
pop esi
pop edi
pop ebp
ret
test edi, edi
jne 0x4019cb
jmp 0x402534
push eax
push 0x8000
push 0x429030
push 0x421030
call sub.msvcrt.dll_memcpy
mov ebx, dword [0x4146e0]
mov eax, dword [0x4110a0]
sub ebx, 0x8000
add esp, 0x10
sub dword [0x4146f0], 0x8000
cmp eax, 0xffffffff
mov dword [0x4146e0], ebx
je 0x40206c
sub eax, 0x8000
mov dword [0x4110a0], eax
sub dword [0x414720], 0x8000
xor edx, edx
movzx eax, word [edx + edx + 0x4522e0]
xor ecx, ecx
cmp eax, 0x7fff
jbe 0x40208f
lea ecx, [eax - 0x8000]
mov word [edx + edx + 0x4522e0], cx
inc edx
cmp edx, 0x7fff
jbe 0x402078
xor edx, edx
nop
movzx eax, word [edx + edx + 0x4422e0]
xor ecx, ecx
cmp eax, 0x7fff
jbe 0x4020bb
lea ecx, [eax - 0x8000]
mov word [edx + edx + 0x4422e0], cx
inc edx
cmp edx, 0x7fff
jbe 0x4020a4
add esi, 0x8000
mov edi, dword [0x411060]
mov eax, dword [0x411050]
jmp 0x401e9d
mov si, 0xfffe
jmp 0x401e9d
push eax
push 0x8000
push 0x429030
push 0x421030
call sub.msvcrt.dll_memcpy
mov ebx, dword [0x4146e0]
mov eax, dword [0x4110a0]
sub ebx, 0x8000
add esp, 0x10
sub dword [0x4146f0], 0x8000
cmp eax, 0xffffffff
mov dword [0x4146e0], ebx
je 0x402133
sub eax, 0x8000
mov dword [0x4110a0], eax
sub dword [0x414720], 0x8000
xor edx, edx
nop
movzx eax, word [edx + edx + 0x4522e0]
xor ecx, ecx
cmp eax, 0x7fff
jbe 0x402157
lea ecx, [eax - 0x8000]
mov word [edx + edx + 0x4522e0], cx
inc edx
cmp edx, 0x7fff
jbe 0x402140
xor edx, edx
nop
movzx eax, word [edx + edx + 0x4422e0]
xor ecx, ecx
cmp eax, 0x7fff
jbe 0x402183
lea ecx, [eax - 0x8000]
mov word [edx + edx + 0x4422e0], cx
inc edx
cmp edx, 0x7fff
jbe 0x40216c
add esi, 0x8000
mov edi, dword [0x411060]
mov eax, dword [0x411050]
jmp 0x401c10
mov si, 0xfffe
jmp 0x401c10
mov edi, dword [0x411060]
mov dword [0x411050], 1
jmp 0x401c48
mov edi, dword [0x411060]
mov dword [0x411050], 1
jmp 0x401ed5
sub esp, 8
sub ebx, esi
lea ebp, [edx - 3]
push ebp
lea edi, [ebx - 1]
push edi
call fcn.0040789c
mov edx, dword [0x4146d0]
mov ecx, dword [0x411060]
sub ecx, edx
mov ebx, dword [0x4110b0]
mov dword [esp + 0x38], eax
lea edi, [ecx + 1]
add esp, 0x10
lea esi, [edx - 2]
test ebx, ebx
mov dword [0x411060], edi
mov dword [0x4146d0], esi
mov dword [esp + 0xc], ebx
je 0x4022af
mov ebp, dword [0x4146e0]
cmp ebp, 0xfff
mov ecx, ebp
lea eax, [edx - 1]
ja 0x402266
mov edx, ebp
lea ecx, [ebp + eax]
cmp ecx, edx
je 0x4022b5
movzx eax, byte [edx + 0x421030]
inc edx
add dword [0x411090], eax
cmp edx, 0xfff
jbe 0x402241
lea eax, [ecx - 0x1000]
mov ecx, 0x1000
lea esi, [ecx + eax]
cmp esi, ecx
mov edx, ecx
jbe 0x4022b5
mov ebx, dword [0x411090]
jmp 0x402281
inc edx
cmp esi, edx
jbe 0x40253f
movzx eax, byte [edx + 0x421030]
lea ecx, [eax + ebx]
movzx ebx, byte [edx + 0x420030]
sub ecx, ebx
cmp dword [0x4110a0], 0xffffffff
mov ebx, ecx
jne 0x402278
test ecx, 0xfff
jne 0x402278
mov dword [0x4110a0], edx
jmp 0x402278
mov ebp, dword [0x4146e0]
mov edx, dword [0x411040]
mov dword [esp + 8], edx
mov esi, dword [0x4146d0]
lea ebx, [ebp + 1]
mov ecx, dword [esp + 8]
shl ecx, 5
movzx edx, byte [ebx + 0x421032]
xor ecx, edx
and ecx, 0x7fff
mov edx, ebx
and edx, 0x7fff
movzx eax, word [ecx + ecx + 0x4522e0]
dec esi
mov word [edx + edx + 0x4422e0], ax
mov ebp, ebx
mov dword [esp + 8], ecx
mov word [ecx + ecx + 0x4522e0], bx
jne 0x4022c5
mov esi, dword [esp + 0xc]
lea edx, [ebx + 1]
test esi, esi
mov dword [0x4146d0], 0
mov dword [0x411040], ecx
mov dword [esp + 0x24], 0
mov dword [esp + 0x20], 2
mov ebx, edx
mov dword [0x4146e0], edx
je 0x40254a
cmp edx, dword [0x4110a0]
jbe 0x40254a
mov dword [0x4110a0], 0xffffffff
mov dword [esp + 0x28], 2
push 0
mov edi, dword [esp + 0x2c]
dec edi
mov eax, dword [0x414720]
sub edx, eax
push edi
push edx
xor edx, edx
test eax, eax
js 0x402378
lea edx, [eax + 0x421030]
push edx
call fcn.004079f4
mov ebx, dword [0x4146e0]
add esp, 0x10
mov edi, dword [0x411060]
mov dword [0x414720], ebx
jmp 0x401e65
mov ebx, dword [0x4146e0]
mov edx, ebx
sub edx, dword [0x4146f0]
cmp edx, 0x1000
jbe 0x401e40
mov dword [esp + 0x20], 2
jmp 0x401e40
mov dword [0x411090], ecx
jmp 0x401f3f
sub esp, 8
movzx eax, byte [ebx + 0x42102f]
push eax
push 0
call fcn.0040789c
mov dword [esp + 0x38], eax
mov eax, dword [0x4110b0]
add esp, 0x10
test eax, eax
je 0x4024d3
mov edx, dword [0x4146e0]
cmp edx, dword [0x4110a0]
jbe 0x4024d9
mov dword [0x4110a0], 0xffffffff
mov dword [esp + 0x28], 2
push 0
mov esi, dword [esp + 0x2c]
dec esi
mov eax, dword [0x414720]
sub edx, eax
push esi
push edx
xor edx, edx
test eax, eax
js 0x402430
lea edx, [eax + 0x421030]
push edx
call fcn.004079f4
mov edx, dword [0x4146e0]
mov dword [0x414720], edx
add esp, 0x10
mov eax, dword [0x4110b0]
test eax, eax
je 0x4024f6
cmp edx, 0xfff
mov eax, edx
mov ebx, 1
ja 0x40248f
mov ecx, edx
lea ebx, [edx + 1]
cmp ebx, ecx
je 0x4024f6
movzx edi, byte [ecx + 0x421030]
inc ecx
add dword [0x411090], edi
cmp ecx, 0xfff
jbe 0x402466
sub ebx, 0x1000
mov eax, 0x1000
lea ebp, [eax + ebx]
cmp ebp, eax
mov ecx, eax
jbe 0x4024f6
mov edi, dword [0x411090]
mov esi, dword [0x4110a0]
jmp 0x4024ad
inc ecx
cmp ebp, ecx
jbe 0x4024ea
movzx eax, byte [ecx + 0x421030]
lea ebx, [eax + edi]
movzx eax, byte [ecx + 0x420030]
sub ebx, eax
cmp esi, 0xffffffff
mov edi, ebx
jne 0x4024a8
test ebx, 0xfff
jne 0x4024a8
mov esi, ecx
jmp 0x4024a8
mov edx, dword [0x4146e0]
mov ebx, dword [esp + 0x28]
test ebx, ebx
je 0x40244a
jmp 0x402414
mov dword [0x4110a0], esi
mov dword [0x411090], ebx
lea ebx, [edx + 1]
mov edi, dword [0x411060]
mov dword [0x4146e0], ebx
jmp 0x401e5e
sub esp, 0xc
push ecx
call fcn.0040b3b1
mov ebp, eax
mov eax, dword [0x411060]
add esp, 0x10
cmp ebp, eax
jbe 0x402523
mov ebp, eax
mov ebx, dword [0x4146e0]
jmp 0x401a2b
mov ebx, dword [0x4146e0]
push 1
mov eax, dword [esp + 0x20]
jmp 0x401fed
mov dword [0x411090], ecx
jmp 0x4022b5
mov ecx, dword [esp + 0x28]
test ecx, ecx
je 0x401e65
jmp 0x40235c