Function at 0x585b40
Capabilities:
Encode data using xor

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbp
push rbx
sub rsp, 0x58
movaps xmmword [rsp + 0x40], xmm7
movdqa xmmword [rsp + 0x30], xmm6
mov r15, rcx
mov r12d, dword [r15 + 0x44]
mov r10d, dword [r15 + 0x9c]
lea eax, [r12 - 0x106]
mov dword [rsp + 0x24], eax
xor r13d, r13d
pxor xmm6, xmm6
movdqa xmm7, xmmword [0x0083ac00]
mov eax, r12d
mov qword [rsp + 0x28], r12
jmp 0x585bae
cmp r10d, 0x105
ja 0x585fc2
mov rax, qword [r15]
cmp dword [rax + 8], 0
je 0x585fc2
mov eax, dword [r15 + 0x44]
add eax, dword [rsp + 0x24]
mov edi, dword [r15 + 0x58]
sub edi, r10d
mov r9d, dword [r15 + 0x94]
sub edi, r9d
cmp r9d, eax
jb 0x585e6c
mov rcx, qword [r15 + 0x50]
mov r8d, r12d
sub r8d, edi
lea rdx, [rcx + r12]
call sub.msvcrt.dll_memcpy
sub dword [r15 + 0x98], r12d
mov r9d, dword [r15 + 0x94]
sub r9d, r12d
mov dword [r15 + 0x94], r9d
sub dword [r15 + 0x84], r12d
mov ecx, dword [r15 + 0x44]
mov eax, dword [r15 + 0x74]
mov r10, qword [r15 + 0x68]
lea rdx, [r10 + rax*2]
lea ebx, [rax - 1]
lea rbp, [rbx + 1]
cmp rbp, 8
jae 0x585c30
mov ebx, eax
jmp 0x585d0f
mov r8d, eax
and r8d, 7
sub rbp, r8
neg rbx
lea rbx, [r8 + rbx - 1]
lea rdx, [rdx + rbx*2]
mov ebx, eax
sub ebx, ebp
movd xmm0, ecx
pshufd xmm0, xmm0, 0
lea rax, [r10 + rax*2 - 0x10]
nop dword [rax + rax]
movdqu xmm1, xmmword [rax]
pshufd xmm1, xmm1, 0x4e
pshuflw xmm1, xmm1, 0x1b
pshufhw xmm2, xmm1, 0x1b
movdqa xmm1, xmm2
punpcklwd xmm1, xmm6
punpckhwd xmm2, xmm6
movdqa xmm3, xmm0
pxor xmm3, xmm7
movdqa xmm4, xmm2
pxor xmm4, xmm7
movdqa xmm5, xmm3
pcmpgtd xmm5, xmm4
pshuflw xmm4, xmm5, 0xe8
pshufhw xmm4, xmm4, 0xe8
pshufd xmm4, xmm4, 0xe8
movdqa xmm5, xmm1
pxor xmm5, xmm7
pcmpgtd xmm3, xmm5
pshuflw xmm3, xmm3, 0xe8
pshufhw xmm3, xmm3, 0xe8
pshufd xmm3, xmm3, 0xe8
punpcklqdq xmm3, xmm4
psubd xmm1, xmm0
psubd xmm2, xmm0
pslld xmm2, 0x10
psrad xmm2, 0x10
pslld xmm1, 0x10
psrad xmm1, 0x10
packssdw xmm1, xmm2
pandn xmm3, xmm1
pshufd xmm1, xmm3, 0x4e
pshuflw xmm1, xmm1, 0x1b
pshufhw xmm1, xmm1, 0x1b
movdqu xmmword [rax], xmm1
add rax, 0xfffffffffffffff0
add rbp, 0xfffffffffffffff8
jne 0x585c60
test r8d, r8d
je 0x585d35
add rdx, 0xfffffffffffffffe
nop word cs:[rax + rax]
movzx eax, word [rdx]
sub eax, ecx
cmovb ax, r13w
mov word [rdx], ax
add rdx, 0xfffffffffffffffe
dec ebx
jne 0x585d20
mov rax, qword [r15 + 0x60]
lea rdx, [rax + rcx*2]
lea ebx, [rcx - 1]
lea rbp, [rbx + 1]
cmp rbp, 8
jae 0x585d60
mov ebx, ecx
jmp 0x585e3f
mov r8d, ecx
and r8d, 7
sub rbp, r8
neg rbx
lea rbx, [r8 + rbx - 1]
lea rdx, [rdx + rbx*2]
mov ebx, ecx
sub ebx, ebp
movd xmm0, ecx
pshufd xmm0, xmm0, 0
lea rax, [rax + rcx*2 - 0x10]
nop dword [rax + rax]
movdqu xmm1, xmmword [rax]
pshufd xmm1, xmm1, 0x4e
pshuflw xmm1, xmm1, 0x1b
pshufhw xmm2, xmm1, 0x1b
movdqa xmm1, xmm2
punpcklwd xmm1, xmm6
punpckhwd xmm2, xmm6
movdqa xmm3, xmm0
pxor xmm3, xmm7
movdqa xmm4, xmm2
pxor xmm4, xmm7
movdqa xmm5, xmm3
pcmpgtd xmm5, xmm4
pshuflw xmm4, xmm5, 0xe8
pshufhw xmm4, xmm4, 0xe8
pshufd xmm4, xmm4, 0xe8
movdqa xmm5, xmm1
pxor xmm5, xmm7
pcmpgtd xmm3, xmm5
pshuflw xmm3, xmm3, 0xe8
pshufhw xmm3, xmm3, 0xe8
pshufd xmm3, xmm3, 0xe8
punpcklqdq xmm3, xmm4
psubd xmm1, xmm0
psubd xmm2, xmm0
pslld xmm2, 0x10
psrad xmm2, 0x10
pslld xmm1, 0x10
psrad xmm1, 0x10
packssdw xmm1, xmm2
pandn xmm3, xmm1
pshufd xmm1, xmm3, 0x4e
pshuflw xmm1, xmm1, 0x1b
pshufhw xmm1, xmm1, 0x1b
movdqu xmmword [rax], xmm1
add rax, 0xfffffffffffffff0
add rbp, 0xfffffffffffffff8
jne 0x585d90
test r8d, r8d
je 0x585e69
add rdx, 0xfffffffffffffffe
nop word cs:[rax + rax]
movzx eax, word [rdx]
sub eax, ecx
mov ebp, 0
cmovae bp, ax
mov word [rdx], bp
add rdx, 0xfffffffffffffffe
dec ebx
jne 0x585e50
add edi, r12d
mov rbp, qword [r15]
mov eax, dword [rbp + 8]
test eax, eax
je 0x585fc2
mov r10d, dword [r15 + 0x9c]
cmp eax, edi
cmovbe edi, eax
test edi, edi
je 0x585ed0
mov ebx, r9d
add rbx, qword [r15 + 0x50]
add rbx, r10
sub eax, edi
mov dword [rbp + 8], eax
mov rdx, qword [rbp]
mov r14d, edi
mov rcx, rbx
mov r8, r14
call sub.msvcrt.dll_memcpy
mov rax, qword [rbp + 0x28]
mov eax, dword [rax + 0x2c]
cmp eax, 2
je 0x585ee0
cmp eax, 1
jne 0x585efb
lea r12, [rbp + 0x4c]
mov ecx, dword [rbp + 0x4c]
mov rdx, rbx
mov r8d, edi
call fcn.005906a0
jmp 0x585ef2
xor edi, edi
jmp 0x585f09
lea r12, [rbp + 0x4c]
mov ecx, dword [rbp + 0x4c]
mov rdx, rbx
mov r8d, edi
call fcn.00590b70
mov dword [r12], eax
mov r12, qword [rsp + 0x28]
add qword [rbp], r14
add dword [rbp + 0xc], edi
mov r10d, dword [r15 + 0x9c]
add r10d, edi
mov dword [r15 + 0x9c], r10d
mov eax, dword [r15 + 0x170c]
lea ecx, [rax + r10]
cmp ecx, 3
jb 0x585b90
mov ebp, dword [r15 + 0x94]
sub ebp, eax
mov r8, qword [r15 + 0x50]
movzx ebx, byte [r8 + rbp]
mov dword [r15 + 0x70], ebx
mov ecx, dword [r15 + 0x80]
shl ebx, cl
lea edi, [rbp + 1]
movzx edi, byte [r8 + rdi]
xor edi, ebx
mov r9d, dword [r15 + 0x7c]
and edi, r9d
mov dword [r15 + 0x70], edi
test eax, eax
je 0x585b90
dec eax
nop word cs:[rax + rax]
shl edi, cl
lea ebx, [rbp + 2]
movzx ebx, byte [r8 + rbx]
xor ebx, edi
mov edi, ebx
and edi, r9d
mov dword [r15 + 0x70], edi
mov r11, qword [r15 + 0x60]
mov rsi, qword [r15 + 0x68]
movzx edx, word [rsi + rdi*2]
mov ebx, dword [r15 + 0x4c]
and ebx, ebp
mov word [r11 + rbx*2], dx
mov word [rsi + rdi*2], bp
mov dword [r15 + 0x170c], eax
lea edx, [r10 + rax]
cmp edx, 2
jbe 0x585b90
inc ebp
dec eax
cmp eax, 0xffffffff
jne 0x585f70
jmp 0x585b90
mov ecx, dword [r15 + 0x1718]
mov edi, dword [r15 + 0x58]
cmp edi, ecx
jbe 0x586038
mov ebp, dword [r15 + 0x9c]
add ebp, dword [r15 + 0x94]
cmp ecx, ebp
jae 0x586007
sub edi, ebp
cmp edi, 0x102
mov ebx, 0x102
cmovb ebx, edi
mov ecx, ebp
add rcx, qword [r15 + 0x50]
xor edx, edx
mov r8, rbx
call sub.msvcrt.dll_memset
add ebx, ebp
jmp 0x586031
add ebp, 0x102
cmp ebp, ecx
jbe 0x586038
sub ebp, ecx
sub edi, ecx
cmp ebp, edi
cmovbe edi, ebp
add rcx, qword [r15 + 0x50]
xor edx, edx
mov r8, rdi
call sub.msvcrt.dll_memset
add edi, dword [r15 + 0x1718]
mov ebx, edi
mov dword [r15 + 0x1718], ebx
movaps xmm6, xmmword [rsp + 0x30]
movaps xmm7, xmmword [rsp + 0x40]
add rsp, 0x58
pop rbx
pop rbp
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret