Function at 0x404080
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x18
mov eax, dword [0x41308c]
push ebx
push ebp
push esi
and al, 0xfe
xor esi, esi
cmp eax, 0x136
push edi
mov dword [esp + 0x10], esi
jle 0x4040a3
sar dword [0x41308c], 1
jmp 0x4040ad
mov dword [0x41308c], 0x9b
cmp dword [0x438eb4], esi
jne 0x4040bf
mov dword [0x438eb4], 0x249f0
mov edi, dword [esp + 0x2c]
mov eax, dword [0x4130ec]
cmp edi, esi
je 0x4040d8
mov ecx, eax
neg ecx
mov dword [0x438f7c], ecx
jmp 0x4040df
mov dword [0x438f7c], eax
neg eax
mov edx, dword [0x413090]
mov dword [0x438f80], eax
push edx
mov dword [0x419ffc], esi
mov byte [0x425020], 0
mov dword [0x41ac50], esi
call fcn.0040b630
mov dword [0x438d98], eax
mov eax, dword [0x413090]
push eax
call fcn.0040b630
push 1
mov dword [0x417f40], eax
mov dword [0x438ecc], esi
call fcn.0040b630
push edi
mov dword [0x437d14], eax
mov dword [0x437d60], edi
call fcn.00408600
mov al, byte [0x425020]
add esp, 0x10
test al, al
mov dword [0x41a660], esi
mov dword [0x41b290], esi
mov dword [0x437d18], esi
jne 0x40487e
mov eax, dword [esp + 0x34]
mov esi, dword [esp + 0x2c]
xor ebx, ebx
cmp eax, ebx
jne 0x40416f
push esi
call fcn.00406140
add esp, 4
mov cl, byte [0x438ed4]
mov dword [0x437f6c], 0x5dc
inc cl
and cl, 7
mov byte [0x438ed4], cl
jne 0x404193
mov byte [0x438ed4], 1
mov edx, dword [0x413090]
push edx
call fcn.0040b630
mov dword [0x438d98], eax
mov eax, dword [0x413090]
push eax
call fcn.0040b630
mov ebp, 1
mov dword [0x417f40], eax
push ebp
mov dword [0x41a640], ebx
call fcn.0040b630
mov ecx, dword [0x413094]
mov dword [0x437d14], eax
mov eax, dword [0x4383d8]
add esp, 0xc
cmp eax, ebx
mov dword [0x417f4c], ecx
mov dword [0x41f5b4], ebx
mov dword [0x41a690], ebx
mov dword [0x41b118], ebx
mov dword [0x438d9c], ebx
mov dword [0x417fc8], ebx
mov dword [0x438914], ebx
mov dword [0x42501c], ebx
mov dword [0x437d60], esi
je 0x4048a8
mov edx, dword [esp + 0x30]
push edx
call fcn.0040a440
mov al, byte [0x41a1be]
add esp, 4
cmp al, 1
mov dword [0x437f70], ebp
jbe 0x40423d
xor ecx, ecx
mov cl, al
inc ecx
mov dword [0x437f70], ecx
mov edx, dword [0x413090]
mov dword [0x419ffc], ebx
push edx
mov byte [0x425020], 0
call fcn.0040b630
mov dword [0x438d98], eax
mov eax, dword [0x413090]
push eax
call fcn.0040b630
push ebp
mov dword [0x417f40], eax
call fcn.0040b630
mov edx, dword [0x437f70]
add esp, 0xc
mov ecx, 0x42
mov esi, 0x41a0b8
mov edi, 0x41b298
mov dword [0x437d14], eax
cmp edx, ebp
mov eax, 0xffff7fff
rep movsd dword es:[edi], dword [esi]
jle 0x4042b7
mov ecx, dword [0x41f5a4]
lea eax, [ecx - 0x64]
add ecx, 0x64
mov dword [0x41b294], eax
mov dword [0x41a644], eax
mov dword [0x41f5b0], ecx
jmp 0x4042cb
mov dword [0x41b294], eax
mov dword [0x41a644], eax
mov dword [0x41f5b0], 0x8001
cmp edx, 0x3c
mov dword [0x41ac4c], ebx
jg 0x4047bc
mov edx, dword [0x4130c0]
mov al, byte [0x41b39d]
mov ebx, dword [esp + 0x2c]
cmp al, 1
mov ebp, 1
jb 0x404385
mov dword [esp + 0x14], 0x41b29c
mov dword [esp + 0x30], 0x41b3a4
mov dword [esp + 0x34], 0x41b3a0
mov edi, dword [esp + 0x34]
mov ecx, 0x42
lea esi, [edi - 0x108]
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [esp + 0x30]
mov edx, dword [ecx]
push edx
push ebx
push ebp
call fcn.0040b690
add esp, 0xc
test eax, eax
je 0x40437f
push ebx
push ebp
call fcn.00402470
mov esi, dword [esp + 0x1c]
push ebx
mov eax, dword [esi]
push eax
push ebp
call fcn.00404f50
mov edi, dword [esp + 0x48]
mov edx, dword [esp + 0x44]
xor ecx, ecx
add esp, 0x14
mov cl, byte [0x41b39d]
xor ebx, 1
inc ebp
add edi, 0x108
add edx, 0x10c
add esi, 4
cmp ebp, ecx
mov dword [esp + 0x34], edi
mov dword [esp + 0x30], edx
mov dword [esp + 0x14], esi
jle 0x40430e
mov edx, dword [0x4130c0]
dec ebp
xor edi, edi
cmp ebp, edi
jle 0x4043b1
lea esi, [ebp*4 + 0x41b298]
mov edx, dword [esi]
xor ebx, 1
push ebx
push edx
push ebp
call fcn.0040a790
add esp, 0xc
dec ebp
sub esi, 4
cmp ebp, edi
jg 0x404393
mov edx, dword [0x4130c0]
cmp dword [0x41a660], edi
je 0x404467
mov ecx, dword [0x413098]
cmp ecx, 0x493e0
mov dword [0x413094], ecx
jl 0x4043d8
mov ecx, 0x493e0
jmp 0x4043e5
cmp ecx, 0x1388
jg 0x4043eb
mov ecx, 0x1388
mov dword [0x413094], ecx
cmp dword [0x438ee4], edi
jne 0x40445d
mov eax, dword [0x417f68]
cmp edx, 0x12c
jle 0x404404
cmp eax, edi
je 0x404467
cmp edx, 0x64
jg 0x404444
cmp eax, edi
jne 0x404444
cmp edx, 0x32
jle 0x40442b
mov eax, 0x66666667
imul ecx
sar edx, 3
mov eax, edx
shr eax, 0x1f
add edx, eax
mov dword [0x413094], edx
jmp 0x404467
mov eax, 0x51eb851f
imul ecx
sar edx, 5
mov ecx, edx
shr ecx, 0x1f
add edx, ecx
mov dword [0x413094], edx
jmp 0x404467
mov eax, 0x66666667
imul ecx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
mov dword [0x413094], edx
jmp 0x404467
mov dword [0x413094], 0x1388
cmp dword [0x419ffc], edi
jne 0x40459d
mov ebx, dword [esp + 0x10]
mov edx, dword [0x41f5b0]
mov ecx, dword [0x41b294]
mov ebp, 0xffff7fff
mov al, byte [0x425020]
test al, al
jne 0x4045ad
push edi
call fcn.0040b630
mov esi, eax
mov eax, dword [0x437f70]
lea eax, [eax + eax*2]
lea ecx, [eax + eax*4]
mov eax, dword [esp + 0x30]
lea edx, [ecx*4 + 0x2d]
mov ecx, dword [0x41f5b0]
push edx
mov edx, dword [0x41b294]
push eax
push ecx
push edx
call fcn.00409a50
mov ecx, dword [0x41a660]
mov ebx, eax
mov eax, dword [0x4130d8]
push edi
cmp eax, ecx
mov dword [esp + 0x28], ebx
sbb ecx, ecx
neg ecx
mov dword [0x41ac4c], ecx
call fcn.0040b630
mov ecx, dword [0x438ecc]
mov edx, dword [0x41f5b0]
sub eax, esi
add esp, 0x18
add ecx, eax
cmp ebx, edx
mov dword [0x438ecc], ecx
jl 0x404544
mov al, byte [0x41874c]
mov ecx, ebp
and al, 0x7d
or al, 2
test al, 1
mov byte [0x41874c], al
jne 0x40451f
lea ecx, [edx - 1]
mov edx, 0x8001
mov dword [0x41b294], ecx
mov dword [0x41a644], ecx
mov dword [0x41f5b0], edx
mov dword [0x418740], edi
mov dword [0x418744], edi
jmp 0x40458f
mov ecx, dword [0x41b294]
cmp ebx, ecx
jg 0x4045ad
mov al, byte [0x41874c]
test al, 2
jne 0x4045ad
and al, 0x7f
mov dword [0x418740], edi
or al, 1
mov dword [0x418744], edi
test al, 2
mov byte [0x41874c], al
je 0x40457b
mov edx, 0x8001
mov dword [0x41f5b0], edx
mov ecx, ebp
mov dword [0x41a644], ebp
mov dword [0x41b294], ecx
mov dword [0x417f44], edi
cmp dword [0x419ffc], edi
je 0x404488
jmp 0x4045ad
mov ebx, dword [esp + 0x10]
mov edx, dword [0x41f5b0]
mov ecx, dword [0x41b294]
mov eax, dword [0x41a644]
cmp eax, ecx
jle 0x4045bf
cmp eax, edx
jge 0x4045bf
mov dword [0x419ff4], eax
mov edx, dword [0x413090]
push edx
call fcn.0040b630
add esp, 4
mov dword [0x41a474], eax
mov edx, dword [0x4383d8]
mov eax, 1
lea ecx, [edx - 1]
cmp ecx, eax
jle 0x404664
dec ecx
mov edx, 0x418760
mov dword [esp + 0x34], ecx
mov esi, dword [edx - 0xc]
mov ebp, dword [edx + 4]
lea ecx, [edx - 0x10]
cmp esi, ebp
ja 0x404648
jb 0x404606
mov esi, dword [ecx]
mov ebp, dword [edx]
cmp esi, ebp
jae 0x404648
mov eax, ecx
mov esi, dword [eax]
mov ebx, dword [eax + 4]
mov ebp, dword [eax + 8]
mov eax, dword [eax + 0xc]
mov dword [esp + 0x24], eax
mov eax, edx
mov edi, dword [eax]
mov dword [ecx], edi
mov edi, dword [eax + 4]
mov dword [ecx + 4], edi
mov edi, dword [eax + 8]
mov dword [ecx + 8], edi
xor edi, edi
mov eax, dword [eax + 0xc]
mov dword [ecx + 0xc], eax
mov ecx, edx
mov eax, dword [esp + 0x24]
mov dword [ecx], esi
mov dword [ecx + 4], ebx
mov ebx, dword [esp + 0x10]
mov dword [ecx + 8], ebp
mov dword [ecx + 0xc], eax
xor eax, eax
mov ecx, dword [esp + 0x34]
add edx, 0x10
dec ecx
mov dword [esp + 0x34], ecx
jne 0x4045ef
cmp eax, edi
je 0x4045d3
mov edx, dword [0x4383d8]
cmp edx, edi
jle 0x40468a
mov eax, 0x41874c
mov ecx, edx
mov byte [eax], 0
add eax, 0x10
dec ecx
jne 0x40466f
mov eax, 0x418740
mov ecx, edx
mov dword [eax], edi
mov dword [eax + 4], edi
add eax, 0x10
dec ecx
jne 0x40467f
mov esi, dword [0x41a474]
mov ecx, dword [0x417f40]
sub esi, ecx
cmp esi, 0xa
jbe 0x4046bd
mov ecx, dword [0x41a660]
push edi
push 0x64
push edi
push ecx
call fcn.0040b880
push edi
push esi
push edx
push eax
call fcn.0040b9f0
mov dword [0x413098], eax
jmp 0x4046c7
mov dword [0x413098], 0x2710
cmp dword [0x419ffc], edi
jne 0x404717
mov al, byte [0x425020]
test al, al
jne 0x404717
cmp dword [0x41ac4c], edi
jne 0x4046f9
cmp dword [0x413064], edi
jle 0x4046f9
cmp ebx, 0x7ed4
jg 0x4046f9
cmp byte [0x41b39c], 2
jne 0x404717
cmp ebx, 0xffff8001
je 0x404717
mov edx, dword [esp + 0x2c]
push 0x41b298
push ebx
push esi
push edx
push 5
call fcn.0040aba0
add esp, 0x14
lea eax, [ebx - 0x64]
mov dword [0x41b294], eax
mov dword [0x41a644], eax
lea eax, [ebx + 0x64]
mov dword [0x41f5b0], eax
mov eax, dword [0x437f70]
cmp eax, 3
jle 0x404751
cmp ebx, 0x7ed4
jle 0x404751
mov ecx, 0x7fff
sub ecx, eax
cmp ebx, ecx
jl 0x404751
cmp ebx, dword [0x438198]
jg 0x4047bc
mov ecx, dword [0x438eb8]
cmp eax, ecx
jl 0x40475f
cmp ecx, edi
jne 0x4047bc
cmp dword [0x419ffc], edi
jne 0x4047bc
mov al, byte [0x425020]
test al, al
jne 0x4047bc
mov edx, dword [0x413090]
push edx
call fcn.0040b630
mov edx, dword [0x417f40]
mov cl, byte [0x438ee0]
add esp, 4
sub eax, edx
mov edx, dword [0x4130c0]
mov dword [0x41a474], eax
test cl, cl
je 0x4047a0
cmp eax, edx
jge 0x4047bc
cmp dword [0x413064], edi
jle 0x4047bc
mov eax, dword [0x437f70]
inc eax
cmp eax, 0x3c
mov dword [0x437f70], eax
jle 0x4042e0
mov eax, dword [0x413090]
push eax
call fcn.0040b630
push 1
mov dword [0x41a474], eax
call fcn.0040b630
mov esi, eax
mov eax, dword [0x437d14]
add esp, 8
sub esi, eax
mov dword [0x417f6c], esi
je 0x404853
mov eax, dword [0x438ecc]
xor edx, edx
lea eax, [eax + eax*4]
lea eax, [eax + eax*4]
shl eax, 2
div esi
cmp esi, 0xa
mov dword [0x41a640], eax
jbe 0x404824
mov ecx, dword [0x41a660]
push 0
push 0x64
push 0
push ecx
call fcn.0040b880
push 0
push esi
push edx
push eax
call fcn.0040b9f0
mov dword [0x413098], eax
mov eax, dword [0x438eb4]
test eax, eax
je 0x40485f
mov edx, dword [0x413098]
lea ecx, [edx + eax*8]
add eax, ecx
mov ecx, eax
mov eax, 0x66666667
imul ecx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
mov dword [0x438eb4], edx
jmp 0x40486b
mov dword [0x41a640], 0x64
jmp 0x404824
mov ecx, dword [0x413098]
mov dword [0x438eb4], ecx
mov eax, dword [0x41f5b4]
test eax, eax
jne 0x40487e
mov dword [0x41f5b4], 1
mov eax, dword [0x413090]
push eax
call fcn.0040b630
mov dword [0x41ac48], eax
mov eax, dword [0x419ff4]
add esp, 4
mov dword [0x438ebc], 0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret
mov edx, dword [0x413090]
push edx
call fcn.0040b630
add esp, 4
mov dword [0x41ac48], eax
mov al, byte [0x417fc4]
cmp esi, ebx
mov byte [0x41b39d], 0
mov byte [0x41b39e], 0xa
jne 0x4048d8
mov al, byte [0x437a58]
mov ecx, esi
movsx edx, al
xor ecx, ebp
push ecx
push edx
call fcn.00401900
add esp, 8
test eax, eax
mov eax, 0xffff8001
jne 0x4048f9
mov eax, dword [esi*4 + 0x438f7c]
mov cl, byte [0x438ee2]
mov dword [0x41a644], eax
test cl, cl
mov dword [0x41a660], ebp
jne 0x4048a0
pop edi
pop esi
pop ebp
mov dword [0x419ff4], eax
pop ebx
add esp, 0x18
ret