Function at 0x581560
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
mov ebx, eax
sub esp, 0x7c
fld xword [esp + 0x90]
fld st(0)
fstp xword [esp + 0x48]
fxam
wait
fnstsw ax
and ax, 0x4500
cmp ax, 0x100
je 0x581a51
fld st(0)
fstp xword [esp + 0x30]
movzx edx, word [esp + 0x38]
test dx, dx
jns 0x5815a0
or dword [ebx + 4], 0x80
fxam
wait
fnstsw ax
and ax, 0x4500
cmp ax, 0x500
je 0x581a81
and dx, 0x7fff
mov word [esp + 0x18], dx
jne 0x581620
fstp xword [esp + 0x20]
mov ebp, dword [esp + 0x24]
mov edi, dword [esp + 0x20]
mov edx, ebp
mov dword [esp], edi
mov dword [esp + 4], ebp
or edx, edi
je 0x581770
test ebp, ebp
js 0x581b4a
mov esi, edi
mov eax, 0xffffc001
mov edi, ebp
lea esi, [esi]
shld edi, esi, 1
mov edx, eax
add esi, esi
sub eax, 1
test edi, edi
jns 0x5815f0
mov dword [esp], esi
mov dword [esp + 4], edi
mov word [esp + 0x18], dx
mov ebp, dword [ebx + 0xc]
cmp ebp, 0xe
ja 0x5816c2
jmp 0x581661
fstp st(0)
mov ebp, dword [ebx + 0xc]
mov eax, dword [esp + 0x48]
mov edx, dword [esp + 0x4c]
sub word [esp + 0x18], 0x3fff
cmp ebp, 0xe
mov dword [esp], eax
mov dword [esp + 4], edx
ja 0x581790
test edx, edx
js 0x581661
mov esi, eax
mov edi, edx
lea esi, [esi]
shld edi, esi, 1
add esi, esi
test edi, edi
jns 0x581650
mov dword [esp], esi
mov dword [esp + 4], edi
mov ecx, 0xe
mov eax, 4
xor edx, edx
sub ecx, ebp
xor esi, esi
mov edi, dword [esp + 4]
shl ecx, 2
shld edx, eax, cl
shl eax, cl
test cl, 0x20
cmovne edx, eax
cmovne eax, esi
mov esi, dword [esp]
shrd esi, edi, 1
shr edi, 1
add esi, eax
adc edi, edx
test edi, edi
js 0x581aa0
shld edi, esi, 1
add esi, esi
mov ecx, 0xf
xor eax, eax
sub ecx, ebp
shl ecx, 2
shrd esi, edi, cl
shr edi, cl
test cl, 0x20
cmovne esi, edi
cmovne edi, eax
mov dword [esp], esi
mov dword [esp + 4], edi
mov eax, dword [ebx + 4]
mov dword [esp + 0x14], eax
lea eax, [esp + 0x58]
mov esi, dword [esp]
mov dword [esp], ebx
mov dword [esp + 0x10], eax
mov ebp, eax
mov eax, dword [esp + 0x14]
mov edi, eax
and eax, 0x20
and edi, 0x800
mov byte [esp + 0x1b], al
mov dword [esp + 0x1c], edi
mov edi, dword [esp + 4]
jmp 0x581725
xor eax, eax
cmp ebp, dword [esp + 0x10]
ja 0x581712
mov ebx, dword [esp]
mov ecx, dword [ebx + 0xc]
test ecx, ecx
js 0x58171b
lea ecx, [eax + 0x30]
mov byte [ebp], cl
add ebp, 1
mov edx, edi
or edx, esi
je 0x581a00
mov ecx, esi
mov dword [esp + 0xc], 0
and ecx, 0xf
mov ebx, ecx
mov dword [esp + 8], ecx
xor ebx, esi
mov eax, ebx
or eax, edi
je 0x581970
mov edx, dword [esp]
shrd esi, edi, 4
shr edi, 4
mov eax, dword [edx + 0xc]
test eax, eax
jle 0x58175b
sub eax, 1
mov dword [edx + 0xc], eax
test ecx, ecx
je 0x581700
cmp ecx, 9
mov eax, ecx
jbe 0x581712
add ecx, 0x37
or cl, byte [esp + 0x1b]
jmp 0x581715
mov ebp, dword [ebx + 0xc]
cmp ebp, 0xe
ja 0x581b10
mov esi, dword [esp]
mov edi, dword [esp + 4]
jmp 0x581650
mov ebp, dword [esp + 4]
mov edi, dword [esp]
mov eax, dword [ebx + 4]
mov edx, ebp
or edx, edi
mov dword [esp + 0x14], eax
jne 0x5816c9
lea eax, [esp + 0x58]
mov dword [esp + 0x10], eax
mov edx, dword [ebx + 0xc]
test edx, edx
jle 0x581b20
lea eax, [esp + 0x59]
mov byte [esp + 0x58], 0x2e
lea ebp, [eax + 1]
mov byte [eax], 0x30
mov eax, dword [ebx + 8]
test eax, eax
mov dword [esp + 8], eax
jle 0x581a1c
mov eax, ebp
sub eax, dword [esp + 0x10]
mov edx, dword [ebx + 0xc]
movsx esi, word [esp + 0x18]
test edx, edx
lea ecx, [eax + edx]
mov dword [esp], esi
cmovg eax, ecx
xor edx, edx
test dword [esp + 0x14], 0x1c0
mov ecx, 0x66666667
setne dl
lea edi, [eax + edx + 5]
mov eax, esi
imul ecx
mov eax, esi
sar eax, 0x1f
mov ecx, edx
sar ecx, 2
sub ecx, eax
je 0x581b40
mov esi, 2
mov eax, 0x66666667
add edi, 1
add esi, 1
imul ecx
sar ecx, 0x1f
sar edx, 2
sub edx, ecx
mov ecx, edx
jne 0x581823
movsx esi, si
mov eax, dword [esp + 8]
cmp eax, edi
jle 0x581a45
sub eax, edi
test dword [esp + 0x14], 0x600
je 0x581ac0
mov dword [ebx + 8], eax
test byte [esp + 0x14], 0x80
jne 0x581a34
test dword [esp + 0x14], 0x100
jne 0x581a70
test byte [esp + 0x14], 0x40
jne 0x581af5
mov edx, ebx
mov eax, 0x30
call fcn.00580370
mov eax, dword [ebx + 4]
mov edx, ebx
and eax, 0x20
or eax, 0x58
call fcn.00580370
mov eax, dword [ebx + 8]
test eax, eax
jle 0x5818ca
test byte [ebx + 5], 2
je 0x5818ca
sub eax, 1
mov dword [ebx + 8], eax
mov edx, ebx
mov eax, 0x30
call fcn.00580370
mov eax, dword [ebx + 8]
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 8], edx
jg 0x5818b1
cmp ebp, dword [esp + 0x10]
mov edi, dword [esp + 0x10]
ja 0x581904
jmp 0x58192e
movzx eax, word [ebx + 0x1c]
test ax, ax
mov word [esp + 0x46], ax
je 0x581900
lea eax, [esp + 0x46]
mov ecx, ebx
mov edx, 1
call fcn.005803d0
nop
cmp ebp, edi
je 0x58192e
sub ebp, 1
movsx eax, byte [ebp]
cmp eax, 0x2e
je 0x5819f0
cmp eax, 0x2c
je 0x5818e0
mov edx, ebx
call fcn.00580370
jmp 0x581900
mov edx, ebx
mov eax, 0x30
call fcn.00580370
mov eax, dword [ebx + 0xc]
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 0xc], edx
jg 0x581922
mov eax, dword [ebx + 4]
mov edx, ebx
and eax, 0x20
or eax, 0x50
call fcn.00580370
add dword [ebx + 8], esi
mov eax, dword [esp]
mov ecx, ebx
or dword [ebx + 4], 0x1c0
cdq
call fcn.00580bd0
add esp, 0x7c
pop ebx
pop esi
pop edi
pop ebp
ret
cmp ebp, dword [esp + 0x10]
ja 0x581990
mov eax, dword [esp + 0x1c]
test eax, eax
jne 0x581990
mov eax, dword [esp]
mov eax, dword [eax + 0xc]
test eax, eax
jle 0x581997
nop
lea esi, [esi]
mov byte [ebp], 0x2e
add ebp, 1
mov eax, esi
mov esi, edi
movzx edi, word [esp + 0x18]
xor eax, 1
or eax, esi
lea ebx, [edi - 1]
je 0x581ab0
mov dword [esp + 8], ebp
mov eax, ecx
xor edx, edx
mov ebp, ecx
nop
lea esi, [esi]
shrd eax, edx, 1
shr edx, 1
mov esi, ebx
mov edi, eax
mov ecx, edx
lea ebx, [esi - 1]
xor edi, 1
or ecx, edi
jne 0x5819c0
mov ecx, ebp
mov word [esp + 0x18], si
mov ebp, dword [esp + 8]
xor esi, esi
xor edi, edi
jmp 0x58175b
mov eax, ebx
call fcn.005806b0
jmp 0x581900
cmp ebp, dword [esp + 0x10]
mov ebx, dword [esp]
je 0x5817b0
mov eax, dword [ebx + 8]
test eax, eax
mov dword [esp + 8], eax
jg 0x5817d9
movsx eax, word [esp + 0x18]
test byte [esp + 0x14], 0x80
mov esi, 2
mov dword [esp], eax
je 0x581869
mov edx, ebx
mov eax, 0x2d
call fcn.00580370
jmp 0x581882
mov dword [ebx + 8], 0xffffffff
jmp 0x58185e
fstp st(0)
mov ecx, ebx
mov edx, 0x6fe77f
xor eax, eax
call fcn.00580610
add esp, 0x7c
pop ebx
pop esi
pop edi
pop ebp
ret
mov edx, ebx
mov eax, 0x2b
call fcn.00580370
jmp 0x581882
fstp st(0)
mov eax, edx
mov ecx, ebx
mov edx, 0x6fe783
and eax, 0x8000
call fcn.00580610
add esp, 0x7c
pop ebx
pop esi
pop edi
pop ebp
ret
add word [esp + 0x18], 1
jmp 0x5816a1
xor esi, esi
xor edi, edi
jmp 0x58175b
sub eax, 1
mov dword [ebx + 8], eax
lea esi, [esi]
lea edi, [edi]
mov edx, ebx
mov eax, 0x20
call fcn.00580370
mov eax, dword [ebx + 8]
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 8], edx
jg 0x581ad0
mov eax, dword [ebx + 4]
mov dword [esp + 0x14], eax
jmp 0x58185e
mov edx, ebx
mov eax, 0x20
call fcn.00580370
jmp 0x581882
mov eax, dword [ebx + 4]
mov dword [esp + 0x14], eax
jmp 0x5817a8
test dword [esp + 0x14], 0x800
mov eax, dword [esp + 0x10]
je 0x5817c4
jmp 0x5817bb
mov esi, 2
jmp 0x58183f
mov eax, 0xffffc002
mov word [esp + 0x18], ax
jmp 0x58160b