Function at 0x40be20
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
mov ebx, eax
sub esp, 0x5c
fld xword [esp + 0x70]
fld st(0)
fstp xword [esp + 0x28]
fxam
wait
fnstsw ax
and ax, 0x4500
cmp ax, 0x100
je 0x40c324
movzx edi, word [esp + 0x30]
mov esi, edi
and esi, 0x8000
jne 0x40bf90
fxam
wait
fnstsw ax
fstp st(0)
and ax, 0x4500
cmp ax, 0x500
je 0x40c339
and di, 0x7fff
mov ecx, edi
je 0x40bfa0
mov ebp, dword [ebx + 0xc]
lea eax, [ecx - 0x3fff]
mov esi, dword [esp + 0x28]
mov edi, dword [esp + 0x2c]
mov word [esp + 0x16], ax
cmp ebp, 0xe
jbe 0x40c0f1
mov eax, edi
or eax, esi
je 0x40c2bb
mov eax, dword [ebx + 4]
lea ecx, [esp + 0x38]
movzx edx, word [esp + 0x16]
mov dword [esp + 8], ebx
mov ebp, ecx
mov dword [esp + 0xc], ecx
mov ecx, eax
mov dword [esp + 0x18], eax
and eax, 0x20
and ecx, 0x800
mov byte [esp + 0x10], al
mov dword [esp + 0x1c], ecx
mov ecx, ebp
jmp 0x40bf17
mov ebx, dword [esp + 8]
mov ebx, dword [ebx + 0xc]
test ebx, ebx
jle 0x40beea
mov ebp, dword [esp + 8]
sub ebx, 1
mov dword [ebp + 0xc], ebx
shrd esi, edi, 4
shr edi, 4
test eax, eax
mov ebp, ecx
je 0x40bf6f
cmp eax, 9
lea ecx, [ebp + 1]
jle 0x40bf87
add eax, 0x37
or al, byte [esp + 0x10]
mov byte [ebp], al
mov eax, edi
or eax, esi
je 0x40bff0
mov eax, esi
and eax, 0xf
cmp eax, esi
jne 0x40bed5
cmp ecx, dword [esp + 0xc]
ja 0x40bf40
mov ebp, dword [esp + 0x1c]
test ebp, ebp
jne 0x40bf40
mov ebx, dword [esp + 8]
mov ebp, ecx
mov ebx, dword [ebx + 0xc]
test ebx, ebx
jle 0x40bf46
nop
lea esi, [esi]
lea ebp, [ecx + 1]
mov byte [ecx], 0x2e
cmp edi, 0
ja 0x40bf50
cmp esi, 1
jbe 0x40bf67
lea ecx, [edx - 1]
shrd esi, edi, 1
shr edi, 1
mov edx, ecx
mov ebx, esi
lea ecx, [edx - 1]
xor ebx, 1
or ebx, edi
jne 0x40bf53
xor esi, esi
xor edi, edi
test eax, eax
jne 0x40bef7
cmp ebp, dword [esp + 0xc]
ja 0x40bf84
mov ecx, dword [esp + 8]
mov ecx, dword [ecx + 0xc]
test ecx, ecx
js 0x40c170
lea ecx, [ebp + 1]
add eax, 0x30
jmp 0x40bf0a
or dword [ebx + 4], 0x80
jmp 0x40be59
mov edx, dword [esp + 0x2c]
mov eax, dword [esp + 0x28]
mov edi, edx
or edi, eax
je 0x40c2ac
test edx, edx
js 0x40c35e
mov ecx, 0xffffc001
nop
shld edx, eax, 1
mov edi, ecx
add eax, eax
sub ecx, 1
test edx, edx
jns 0x40bfc0
mov word [esp + 0x16], di
mov esi, eax
mov edi, edx
mov ebp, dword [ebx + 0xc]
cmp ebp, 0xe
jbe 0x40c10f
jmp 0x40bea4
cmp ecx, dword [esp + 0xc]
mov word [esp + 0x16], dx
mov ebp, ecx
mov ebx, dword [esp + 8]
je 0x40c356
mov eax, dword [ebx + 8]
test eax, eax
mov dword [esp + 8], eax
jle 0x40c299
mov eax, ebp
sub eax, dword [esp + 0xc]
mov edx, dword [ebx + 0xc]
movsx edi, word [esp + 0x16]
test edx, edx
lea ecx, [eax + edx]
mov edx, dword [esp + 0x18]
mov dword [esp + 0x10], edi
cmovg eax, ecx
mov ecx, 0x66666667
and edx, 0x1c0
cmp edx, 1
sbb edx, edx
lea esi, [eax + edx + 6]
mov eax, edi
imul ecx
mov eax, edi
sar eax, 0x1f
mov ecx, edx
sar ecx, 2
sub ecx, eax
je 0x40c34c
mov edi, 2
mov eax, 0x66666667
add esi, 1
add edi, 1
imul ecx
sar ecx, 0x1f
sar edx, 2
sub edx, ecx
mov ecx, edx
jne 0x40c061
movsx edi, di
cmp dword [esp + 8], esi
jle 0x40c180
mov eax, dword [esp + 8]
sub eax, esi
test dword [esp + 0x18], 0x600
jne 0x40c2e6
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 8], edx
jle 0x40c187
lea esi, [esi]
mov edx, ebx
mov eax, 0x20
call fcn.0040abd0
mov eax, dword [ebx + 8]
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 8], edx
jg 0x40c0b0
mov eax, dword [ebx + 4]
mov dword [esp + 0x18], eax
test byte [esp + 0x18], 0x80
je 0x40c192
nop
lea esi, [esi]
mov edx, ebx
mov eax, 0x2d
call fcn.0040abd0
jmp 0x40c1ab
test edi, edi
js 0x40c10f
mov ecx, eax
mov esi, esi
lea edi, [edi]
shld edi, esi, 1
add esi, esi
test edi, edi
jns 0x40c100
mov word [esp + 0x16], cx
mov ecx, 0xe
mov eax, 4
xor edx, edx
sub ecx, ebp
shl ecx, 2
shrd esi, edi, 1
shld edx, eax, cl
shr edi, 1
shl eax, cl
test cl, 0x20
je 0x40c134
mov edx, eax
xor eax, eax
add eax, esi
adc edx, edi
test edx, edx
js 0x40c319
shld edx, eax, 1
add eax, eax
mov ecx, 0xf
xor esi, esi
sub ecx, ebp
shl ecx, 2
shrd eax, edx, cl
shr edx, cl
test cl, 0x20
cmovne eax, edx
cmovne edx, esi
mov edi, edx
mov esi, eax
jmp 0x40bea4
mov ecx, ebp
jmp 0x40bf0d
mov dword [ebx + 8], 0xffffffff
test byte [esp + 0x18], 0x80
jne 0x40c0e0
test dword [esp + 0x18], 0x100
jne 0x40c2f7
test byte [esp + 0x18], 0x40
jne 0x40c308
mov edx, ebx
mov eax, 0x30
call fcn.0040abd0
mov eax, dword [ebx + 4]
mov edx, ebx
and eax, 0x20
or eax, 0x58
call fcn.0040abd0
mov eax, dword [ebx + 8]
test eax, eax
jle 0x40c1f9
test byte [ebx + 5], 2
je 0x40c1f9
sub eax, 1
mov dword [ebx + 8], eax
lea esi, [esi]
mov edx, ebx
mov eax, 0x30
call fcn.0040abd0
mov eax, dword [ebx + 8]
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 8], edx
jg 0x40c1e0
cmp ebp, dword [esp + 0xc]
mov esi, dword [esp + 0xc]
ja 0x40c227
jmp 0x40c24d
movzx eax, word [ebx + 0x1c]
test ax, ax
mov word [esp + 0x26], ax
je 0x40c223
lea eax, [esp + 0x26]
mov ecx, ebx
mov edx, 1
call fcn.0040ac30
cmp ebp, esi
je 0x40c24d
sub ebp, 1
movsx eax, byte [ebp]
cmp eax, 0x2e
je 0x40c290
cmp eax, 0x2c
je 0x40c205
mov edx, ebx
call fcn.0040abd0
jmp 0x40c223
mov edx, ebx
mov eax, 0x30
call fcn.0040abd0
mov eax, dword [ebx + 0xc]
lea edx, [eax - 1]
test eax, eax
mov dword [ebx + 0xc], edx
jg 0x40c241
mov eax, dword [ebx + 4]
mov edx, ebx
and eax, 0x20
or eax, 0x50
call fcn.0040abd0
mov eax, dword [esp + 0x10]
add dword [ebx + 8], edi
mov ecx, ebx
or dword [ebx + 4], 0x1c0
cdq
call fcn.0040b400
add esp, 0x5c
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, ebx
call fcn.0040aef0
jmp 0x40c223
movsx eax, word [esp + 0x16]
mov edi, 2
mov dword [esp + 0x10], eax
jmp 0x40c187
mov ebp, dword [ebx + 0xc]
cmp ebp, 0xe
jbe 0x40c2ee
xor edx, edx
mov word [esp + 0x16], dx
mov eax, dword [ebx + 4]
mov dword [esp + 0x18], eax
lea eax, [esp + 0x38]
mov dword [esp + 0xc], eax
test ebp, ebp
jle 0x40c371
lea eax, [esp + 0x39]
mov byte [esp + 0x38], 0x2e
lea ebp, [eax + 1]
mov byte [eax], 0x30
jmp 0x40c005
mov dword [ebx + 8], eax
jmp 0x40c187
xor esi, esi
xor edi, edi
jmp 0x40c100
mov edx, ebx
mov eax, 0x2b
call fcn.0040abd0
jmp 0x40c1ab
mov edx, ebx
mov eax, 0x20
call fcn.0040abd0
jmp 0x40c1ab
add word [esp + 0x16], 1
jmp 0x40c146
fstp st(0)
mov ecx, ebx
mov edx, 0x426d93
xor eax, eax
call fcn.0040ae50
jmp 0x40c280
mov ecx, ebx
mov edx, 0x426d97
mov eax, esi
call fcn.0040ae50
jmp 0x40c280
mov edi, 2
jmp 0x40c07d
mov ebp, dword [ebx + 0xc]
jmp 0x40c2ca
mov esi, eax
mov eax, 0xffffc002
mov edi, edx
mov word [esp + 0x16], ax
jmp 0x40bfd8
test dword [esp + 0x18], 0x800
mov eax, dword [esp + 0xc]
je 0x40c2db
jmp 0x40c2d2