Function at 0x404170
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
mov ebx, eax
sub esp, 0x9c
fld xword [esp + 0xb0]
fxam
wait
fnstsw ax
and ax, 0x4500
cmp ax, 0x100
je 0x4044b0
fld st(0)
fstp xword [esp + 0x50]
movzx edx, word [esp + 0x58]
test dx, dx
js 0x404380
fxam
wait
fnstsw ax
and ax, 0x4500
cmp ax, 0x500
je 0x404688
and dx, 0x7fff
fstp xword [esp + 0x40]
mov edi, dword [esp + 0x40]
mov ebp, dword [esp + 0x44]
mov word [esp + 0x30], dx
jne 0x404390
mov edx, ebp
or edx, edi
jne 0x404548
mov esi, dword [ebx + 0xc]
cmp esi, 0xe
jbe 0x4043b8
mov eax, dword [ebx + 4]
mov dword [esp + 0x38], eax
lea eax, [esp + 0x78]
mov dword [esp + 0x2c], eax
mov edx, dword [ebx + 0xc]
test edx, edx
jle 0x404728
mov byte [esp + 0x78], 0x2e
lea eax, [esp + 0x79]
mov byte [eax], 0x30
lea esi, [eax + 1]
mov eax, dword [ebx + 8]
mov dword [esp + 0x34], eax
test eax, eax
jle 0x40464a
mov edx, dword [ebx + 0xc]
mov eax, esi
sub eax, dword [esp + 0x2c]
movsx edi, word [esp + 0x30]
test edx, edx
lea ecx, [eax + edx]
mov edx, dword [esp + 0x38]
cmovg eax, ecx
mov dword [esp + 0x28], edi
and edx, 0x1c0
cmp edx, 1
mov edx, 0x66666667
sbb eax, 0xfffffffa
mov ebp, eax
mov eax, edi
imul edx
mov eax, edi
mov edi, ebp
sar eax, 0x1f
sar edx, 2
mov ecx, edx
sub ecx, eax
je 0x40473f
mov dword [esp + 0x30], esi
lea esi, [esi]
mov eax, 0x66666667
add edi, 1
imul ecx
mov eax, ecx
lea esi, [edi + 2]
sar eax, 0x1f
sub esi, ebp
sar edx, 2
mov ecx, edx
sub ecx, eax
jne 0x404278
movsx ebp, si
mov esi, dword [esp + 0x30]
mov eax, dword [esp + 0x34]
cmp eax, edi
jle 0x404678
sub eax, edi
test dword [esp + 0x38], 0x600
je 0x4046e0
mov dword [ebx + 8], eax
test byte [esp + 0x38], 0x80
jne 0x404663
test dword [esp + 0x38], 0x100
jne 0x4046b0
test byte [esp + 0x38], 0x40
jne 0x4046c8
mov edx, ebx
mov eax, 0x30
call fcn.00402aa0
mov eax, dword [ebx + 4]
mov edx, ebx
and eax, 0x20
or eax, 0x58
call fcn.00402aa0
mov eax, dword [ebx + 8]
test eax, eax
jle 0x404329
test byte [ebx + 5], 2
je 0x404329
sub eax, 1
mov dword [ebx + 8], eax
nop
mov edx, ebx
mov eax, 0x30
call fcn.00402aa0
mov eax, dword [ebx + 8]
lea edx, [eax - 1]
mov dword [ebx + 8], edx
test eax, eax
jg 0x404310
mov edi, dword [esp + 0x2c]
cmp esi, dword [esp + 0x2c]
ja 0x40435a
jmp 0x4044dc
movzx eax, word [ebx + 0x1c]
mov word [esp + 0x68], ax
test ax, ax
jne 0x404610
cmp esi, edi
je 0x4044dc
movsx eax, byte [esi - 1]
sub esi, 1
cmp eax, 0x2e
je 0x404590
cmp eax, 0x2c
je 0x404340
mov edx, ebx
call fcn.00402aa0
jmp 0x404352
or dword [ebx + 4], 0x80
jmp 0x4041aa
mov esi, dword [ebx + 0xc]
sub word [esp + 0x30], 0x3fff
cmp esi, 0xe
jbe 0x4043be
mov eax, dword [ebx + 4]
mov edx, edi
or edx, ebp
mov dword [esp + 0x38], eax
jne 0x40441a
jmp 0x4041f6
shld ebp, edi, 1
add edi, edi
test ebp, ebp
jns 0x4043b8
mov ecx, 0xe
mov eax, 4
xor edx, edx
sub ecx, esi
shl ecx, 2
shld edx, eax, cl
shl eax, cl
test cl, 0x20
je 0x4043e1
mov edx, eax
xor eax, eax
shrd edi, ebp, 1
shr ebp, 1
add eax, edi
adc edx, ebp
test edx, edx
js 0x404580
shld edx, eax, 1
add eax, eax
mov ecx, 0xf
sub ecx, esi
xor esi, esi
shl ecx, 2
shrd eax, edx, cl
shr edx, cl
and ecx, 0x20
cmovne eax, edx
cmovne edx, esi
mov edi, eax
mov ebp, edx
mov eax, dword [ebx + 4]
lea ecx, [esp + 0x78]
mov dword [esp + 0x38], eax
mov dword [esp + 0x2c], ecx
mov esi, ecx
mov ecx, eax
and eax, 0x20
and ecx, 0x800
mov byte [esp + 0x34], al
mov dword [esp + 0x3c], ecx
movzx ecx, word [esp + 0x30]
mov dword [esp + 0x28], ebx
jmp 0x404473
cmp esi, dword [esp + 0x2c]
ja 0x404461
mov ebx, dword [esp + 0x28]
mov ebx, dword [ebx + 0xc]
test ebx, ebx
js 0x404469
add eax, 0x30
mov byte [esi], al
add esi, 1
mov eax, edi
or eax, ebp
je 0x404628
mov edx, edi
mov eax, edi
and edx, 0xfffffff0
and eax, 0xf
or edx, ebp
je 0x4045a0
mov ebx, dword [esp + 0x28]
shrd edi, ebp, 4
shr ebp, 4
mov edx, dword [ebx + 0xc]
test edx, edx
jle 0x40449d
sub edx, 1
mov dword [ebx + 0xc], edx
test eax, eax
je 0x404450
cmp eax, 9
jbe 0x404461
add eax, 0x37
or al, byte [esp + 0x34]
jmp 0x404464
fstp st(0)
add esp, 0x9c
mov ecx, ebx
mov edx, 0x40b323
xor eax, eax
pop ebx
pop esi
pop edi
pop ebp
jmp fcn.00402e10
mov edx, ebx
mov eax, 0x30
call fcn.00402aa0
mov eax, dword [ebx + 0xc]
lea edx, [eax - 1]
mov dword [ebx + 0xc], edx
test eax, eax
jg 0x4044d0
mov eax, dword [ebx + 4]
mov edx, ebx
and eax, 0x20
or eax, 0x50
call fcn.00402aa0
mov eax, dword [esp + 0x28]
add dword [ebx + 8], ebp
or dword [ebx + 4], 0x1c0
cdq
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], edx
mov ecx, edx
mov dword [esp], eax
mov eax, dword [esp + 0x6c]
sar ecx, 0x1f
mov dword [esp + 0x10], ebx
mov dword [esp + 0x70], ecx
mov dword [esp + 0x74], ecx
mov dword [esp + 4], eax
mov dword [esp + 8], ecx
mov dword [esp + 0xc], ecx
call fcn.00403440
add esp, 0x9c
pop ebx
pop esi
pop edi
pop ebp
ret
test ebp, ebp
js 0x404749
mov eax, 0xffffc001
lea esi, [esi]
shld ebp, edi, 1
mov edx, eax
add edi, edi
sub eax, 1
test ebp, ebp
jns 0x404558
mov word [esp + 0x30], dx
mov esi, dword [ebx + 0xc]
cmp esi, 0xe
ja 0x404417
jmp 0x4043c2
add word [esp + 0x30], 1
jmp 0x4043f9
mov eax, ebx
call fcn.00403860
jmp 0x404352
cmp esi, dword [esp + 0x2c]
ja 0x4045c0
mov ebx, dword [esp + 0x3c]
test ebx, ebx
jne 0x4045c0
mov ebx, dword [esp + 0x28]
mov edx, dword [ebx + 0xc]
test edx, edx
jle 0x4045c6
lea esi, [esi]
mov byte [esi], 0x2e
add esi, 1
mov ebx, edi
mov edx, ebp
xor ebx, 1
mov dword [esp + 0x30], ebx
or edx, dword [esp + 0x30]
lea ebx, [ecx - 1]
je 0x404718
mov dword [esp + 0x30], eax
lea esi, [esi]
shrd edi, ebp, 1
shr ebp, 1
mov ecx, ebx
mov eax, edi
mov edx, ebp
lea ebx, [ecx - 1]
xor eax, 1
or edx, eax
jne 0x4045e8
mov eax, dword [esp + 0x30]
xor edi, edi
xor ebp, ebp
jmp 0x40449d
mov ecx, ebx
mov edx, 1
lea eax, [esp + 0x68]
call fcn.00402b00
jmp 0x404352
mov word [esp + 0x30], cx
mov ebx, dword [esp + 0x28]
cmp esi, dword [esp + 0x2c]
je 0x4041fe
mov eax, dword [ebx + 8]
mov dword [esp + 0x34], eax
test eax, eax
jg 0x404227
movsx eax, word [esp + 0x30]
mov ebp, 2
mov dword [esp + 0x28], eax
test byte [esp + 0x38], 0x80
je 0x4042c6
mov edx, ebx
mov eax, 0x2d
call fcn.00402aa0
jmp 0x4042df
mov dword [ebx + 8], 0xffffffff
jmp 0x4042bb
fstp st(0)
add esp, 0x9c
mov eax, edx
mov ecx, ebx
mov edx, 0x40b327
pop ebx
and eax, 0x8000
pop esi
pop edi
pop ebp
jmp fcn.00402e10
mov edx, ebx
mov eax, 0x2b
call fcn.00402aa0
jmp 0x4042df
mov edx, ebx
mov eax, 0x20
call fcn.00402aa0
jmp 0x4042df
lea edx, [eax - 1]
mov dword [ebx + 8], edx
test eax, eax
jle 0x4042bb
nop
mov edx, ebx
mov eax, 0x20
call fcn.00402aa0
mov eax, dword [ebx + 8]
lea edx, [eax - 1]
mov dword [ebx + 8], edx
test eax, eax
jg 0x4046f0
mov eax, dword [ebx + 4]
mov dword [esp + 0x38], eax
jmp 0x4042bb
xor edi, edi
xor ebp, ebp
jmp 0x40449d
mov eax, dword [esp + 0x2c]
test dword [esp + 0x38], 0x800
je 0x404212
jmp 0x404209
mov ebp, 2
jmp 0x40429c
mov eax, 0xffffc002
mov word [esp + 0x30], ax
jmp 0x40456c