Function at 0x589440
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
mov edx, dword [ebp + 0x10]
mov eax, edx
sar eax, 1
mov ecx, edx
sar ecx, 2
push ebx
mov dword [ebp - 0x10], ecx
mov ebx, edx
lea ecx, [eax*4]
mov dword [ebp - 0x28], eax
push esi
mov esi, dword [ebp + 8]
lea eax, [ecx - 1]
sar ebx, 3
mov dword [ebp - 0xc], ebx
mov dword [ebp - 0x24], ecx
push edi
cmp eax, 0x7ffffff7
ja 0x5894ae
mov edx, dword [esi + 0x5c]
lea eax, [ecx + 7]
and eax, 0xfffffff8
add dword [esi + 8], eax
test edx, edx
je 0x58949c
mov edi, dword [esi + 0x64]
add eax, edi
cmp eax, dword [esi + 0x68]
jg 0x5894ae
mov dword [esi + 0x64], eax
lea eax, [edx + edi]
jmp 0x5894b0
test eax, eax
je 0x5894ae
push eax
call sym.BZDPatcher.exe_SDL_malloc
mov ecx, dword [ebp - 0x24]
add esp, 4
jmp 0x5894b0
xor eax, eax
mov edi, dword [ebp + 0xc]
mov dword [esi + edi*4 + 0x3c0], eax
lea eax, [ecx - 1]
cmp eax, 0x7ffffff7
ja 0x5894f5
lea eax, [ecx + 7]
mov ecx, dword [esi + 0x5c]
and eax, 0xfffffff8
add dword [esi + 8], eax
test ecx, ecx
je 0x5894e6
mov edx, dword [esi + 0x64]
add eax, edx
cmp eax, dword [esi + 0x68]
jg 0x5894f5
mov dword [esi + 0x64], eax
lea eax, [ecx + edx]
jmp 0x5894f7
test eax, eax
je 0x5894f5
push eax
call sym.BZDPatcher.exe_SDL_malloc
add esp, 4
jmp 0x5894f7
xor eax, eax
mov ecx, dword [ebp - 0x10]
mov dword [esi + edi*4 + 0x3c8], eax
lea eax, [ecx*4 - 1]
cmp eax, 0x7ffffff7
ja 0x589548
mov edx, dword [esi + 0x5c]
lea eax, [ecx*4 + 7]
and eax, 0xfffffff8
add dword [esi + 8], eax
test edx, edx
je 0x589534
mov edi, dword [esi + 0x64]
add eax, edi
cmp eax, dword [esi + 0x68]
jg 0x589548
mov dword [esi + 0x64], eax
add edi, edx
jmp 0x58954a
test eax, eax
je 0x589548
push eax
call sym.BZDPatcher.exe_SDL_malloc
mov ecx, dword [ebp - 0x10]
add esp, 4
mov edi, eax
jmp 0x58954a
xor edi, edi
mov eax, dword [ebp + 0xc]
mov dword [ebp - 4], edi
mov edx, dword [esi + eax*4 + 0x3c0]
mov dword [esi + eax*4 + 0x3d0], edi
test edx, edx
je 0x589841
mov eax, dword [esi + eax*4 + 0x3c8]
test eax, eax
je 0x589841
test edi, edi
je 0x589841
fld qword [0x6258a0]
test ecx, ecx
jle 0x589670
fild dword [ebp + 0x10]
mov ebx, dword [ebp - 0x10]
lea ecx, [eax + 4]
mov dword [ebp - 8], ecx
mov esi, edx
mov ecx, esi
mov dword [ebp - 0x20], 1
sub ecx, eax
mov dword [ebp - 0x18], 0
fstp qword [ebp - 0x38]
fld qword [ebp - 0x38]
mov edi, ecx
fst qword [ebp - 0x38]
fild dword [ebp - 0x18]
sub esp, 8
fstp qword [ebp - 0x30]
fld qword [ebp - 0x30]
fmulp st(2)
fdivp st(1)
fst qword [ebp - 0x30]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_cos
fstp dword [esi]
fld qword [ebp - 0x30]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_sin
mov eax, dword [ebp - 8]
fchs
fstp dword [edi + eax]
fild dword [ebp - 0x20]
fstp qword [ebp - 0x30]
fld qword [ebp - 0x30]
fmul qword [0x6258a0]
fdiv qword [ebp - 0x38]
fmul qword [0x605240]
fst qword [ebp - 0x14]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_cos
mov eax, dword [ebp - 8]
fstp dword [ebp - 0x2c]
fld dword [ebp - 0x2c]
fmul qword [0x605240]
fstp dword [eax - 4]
fld qword [ebp - 0x14]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_sin
mov eax, dword [ebp - 8]
add esp, 8
add dword [ebp - 0x18], 4
add esi, 8
add dword [ebp - 0x20], 2
fstp dword [ebp - 0x2c]
fld dword [ebp - 0x2c]
fmul qword [0x605240]
fstp dword [eax]
fld qword [0x6258a0]
add eax, 8
fld qword [ebp - 0x38]
mov dword [ebp - 8], eax
sub ebx, 1
jne 0x5895b6
mov esi, dword [ebp + 8]
fstp st(1)
mov edi, dword [ebp - 4]
fstp st(0)
fld qword [0x6258a0]
mov ebx, dword [ebp - 0xc]
test ebx, ebx
jle 0x5896da
fild dword [ebp + 0x10]
mov esi, dword [ebp - 0xc]
mov ebx, 2
mov dword [ebp - 0x20], ebx
fstp qword [ebp - 0x38]
fld qword [ebp - 0x38]
fst qword [ebp - 0x30]
fild dword [ebp - 0x20]
sub esp, 8
fstp qword [ebp - 0x38]
fld qword [ebp - 0x38]
fmulp st(2)
fdivp st(1)
fst qword [ebp - 0x38]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_cos
fstp dword [edi]
fld qword [ebp - 0x38]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_sin
fchs
add ebx, 4
fstp dword [edi + 4]
fld qword [0x6258a0]
add esp, 8
fld qword [ebp - 0x30]
add edi, 8
mov dword [ebp - 0x20], ebx
sub esi, 1
jne 0x58968b
mov esi, dword [ebp + 8]
fstp st(1)
mov ebx, dword [ebp - 0xc]
push dword [ebp - 0x24]
fstp st(0)
push esi
call fcn.0058aba0
mov ecx, eax
add esp, 8
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x20], ecx
mov dword [esi + eax*4 + 0x3d8], ecx
test ecx, ecx
je 0x589841
mov eax, dword [ebp - 0x28]
xor edi, edi
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x24], edi
test eax, eax
jle 0x58977b
fild dword [ebp - 0x2c]
mov esi, eax
mov ebx, ecx
fstp qword [ebp - 0x38]
fld qword [ebp - 0x38]
fst qword [ebp - 0x1c]
fild dword [ebp - 0x24]
sub esp, 8
fstp qword [ebp - 0x38]
fld qword [ebp - 0x38]
fld qword [0x605240]
fadd st(1), st(0)
fxch st(1)
fdivrp st(2)
fmulp st(1)
fmul qword [0x6258a0]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_sin
fstp dword [ebp - 0x2c]
fld dword [ebp - 0x2c]
fmul st(0), st(0)
fstp dword [ebp - 0x2c]
fld dword [ebp - 0x2c]
fmul qword [0x6258f0]
fstp qword [esp]
call sym.BZDPatcher.exe_SDL_sin
fstp dword [ebx + edi*4]
fld qword [ebp - 0x1c]
inc edi
add esp, 8
mov dword [ebp - 0x24], edi
cmp edi, esi
jl 0x58971e
mov esi, dword [ebp + 8]
fstp st(0)
mov ebx, dword [ebp - 0xc]
lea eax, [ebx + ebx]
push eax
push esi
call fcn.0058aba0
mov ecx, dword [ebp + 0xc]
add esp, 8
mov dword [ebp + 8], eax
mov dword [esi + ecx*4 + 0x3e0], eax
test eax, eax
je 0x589841
push dword [ebp + 0x10]
call fcn.00588c20
add esp, 4
xor esi, esi
test ebx, ebx
jle 0x589835
mov edi, 0x24
sub edi, eax
lea esp, [esp]
mov ecx, esi
lea eax, [esi + esi]
shr ecx, 1
xor ecx, eax
lea eax, [esi + esi]
and ecx, 0x55555555
xor ecx, eax
mov edx, ecx
shr edx, 2
lea eax, [ecx*4]
xor edx, eax
lea eax, [ecx*4]
and edx, 0x33333333
xor edx, eax
mov ecx, edx
mov eax, edx
shr ecx, 4
shl edx, 4
shl eax, 4
xor ecx, eax
and ecx, 0xf0f0f0f
xor ecx, edx
mov edx, ecx
mov eax, ecx
shr edx, 8
shl eax, 8
xor edx, eax
shl ecx, 8
mov eax, dword [ebp + 8]
and edx, 0xff00ff
xor edx, ecx
mov ecx, edi
rol edx, 0x10
shr edx, cl
shl edx, 2
mov word [eax + esi*2], dx
inc esi
cmp esi, ebx
jl 0x5897c0
pop edi
pop esi
mov eax, 1
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
mov dword [esi + 0x70], 3
xor eax, eax
pop esi
pop ebx
mov esp, ebp
pop ebp
ret