Function at 0x59d960
Capabilities:
Encode data using xor

Disassembly:
push rbp
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbx
sub rsp, 0x58
lea rbp, [rsp + 0x50]
movaps xmmword [rbp - 0x10], xmm7
movdqa xmmword [rbp - 0x20], xmm6
mov r13, rcx
mov eax, dword [r13 + 0x44]
mov r10d, dword [r13 + 0x9c]
lea ecx, [rax - 0x106]
mov dword [rbp - 0x24], ecx
pxor xmm6, xmm6
movdqa xmm7, xmmword [0x005f42d0]
mov qword [rbp - 0x30], rax
jmp 0x59d9cf
cmp r10d, 0x105
ja 0x59ddf3
mov rax, qword [r13]
cmp dword [rax + 8], 0
je 0x59ddf3
mov eax, dword [r13 + 0x44]
add eax, dword [rbp - 0x24]
mov r15d, dword [r13 + 0x58]
sub r15d, r10d
mov r8d, dword [r13 + 0x94]
sub r15d, r8d
cmp r8d, eax
jb 0x59dc8d
mov rcx, qword [r13 + 0x50]
mov rsi, qword [rbp - 0x30]
mov r8d, esi
sub r8d, r15d
lea rdx, [rcx + rsi]
call sub.msvcrt.dll_memcpy
sub dword [r13 + 0x98], esi
mov r8d, dword [r13 + 0x94]
sub r8d, esi
mov dword [r13 + 0x94], r8d
sub dword [r13 + 0x84], esi
cmp dword [r13 + 0x1708], r8d
jbe 0x59da32
mov dword [r13 + 0x1708], r8d
mov ecx, dword [r13 + 0x44]
mov edi, dword [r13 + 0x74]
mov r10, qword [r13 + 0x68]
lea rdx, [r10 + rdi*2]
lea ebx, [rdi - 1]
lea rax, [rbx + 1]
cmp rax, 8
jae 0x59da60
mov ebx, edi
xor edi, edi
jmp 0x59db44
mov r9d, edi
and r9d, 7
sub rax, r9
neg rbx
lea rbx, [r9 + rbx - 1]
lea rdx, [rdx + rbx*2]
mov ebx, edi
sub ebx, eax
movd xmm0, ecx
pshufd xmm0, xmm0, 0
lea rdi, [r10 + rdi*2 - 0x10]
nop dword [rax + rax]
movdqu xmm1, xmmword [rdi]
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 [rdi], xmm1
add rdi, 0xfffffffffffffff0
add rax, 0xfffffffffffffff8
jne 0x59da90
test r9d, r9d
mov edi, 0
je 0x59db64
add rdx, 0xfffffffffffffffe
nop dword [rax + rax]
movzx eax, word [rdx]
sub eax, ecx
cmovb ax, di
mov word [rdx], ax
add rdx, 0xfffffffffffffffe
dec ebx
jne 0x59db50
mov rdi, qword [r13 + 0x60]
lea rdx, [rdi + rcx*2]
lea ebx, [rcx - 1]
lea rax, [rbx + 1]
cmp rax, 8
jae 0x59db80
mov ebx, ecx
jmp 0x59dc5f
mov r9d, ecx
and r9d, 7
sub rax, r9
neg rbx
lea rbx, [r9 + rbx - 1]
lea rdx, [rdx + rbx*2]
mov ebx, ecx
sub ebx, eax
movd xmm0, ecx
pshufd xmm0, xmm0, 0
lea rdi, [rdi + rcx*2 - 0x10]
nop dword [rax + rax]
movdqu xmm1, xmmword [rdi]
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 [rdi], xmm1
add rdi, 0xfffffffffffffff0
add rax, 0xfffffffffffffff8
jne 0x59dbb0
test r9d, r9d
je 0x59dc89
add rdx, 0xfffffffffffffffe
nop word cs:[rax + rax]
movzx eax, word [rdx]
sub eax, ecx
mov edi, 0
cmovae di, ax
mov word [rdx], di
add rdx, 0xfffffffffffffffe
dec ebx
jne 0x59dc70
add r15d, dword [rbp - 0x30]
mov r12, qword [r13]
mov eax, dword [r12 + 8]
test eax, eax
je 0x59ddf3
mov r10d, dword [r13 + 0x9c]
cmp eax, r15d
cmovbe r15d, eax
test r15d, r15d
je 0x59dd00
mov ebx, r8d
add rbx, qword [r13 + 0x50]
add rbx, r10
sub eax, r15d
mov dword [r12 + 8], eax
mov rdx, qword [r12]
mov r14d, r15d
mov rcx, rbx
mov r8, r14
call sub.msvcrt.dll_memcpy
mov rax, qword [r12 + 0x28]
mov eax, dword [rax + 0x2c]
cmp eax, 2
je 0x59dd10
cmp eax, 1
jne 0x59dd27
lea rdi, [r12 + 0x4c]
mov ecx, dword [r12 + 0x4c]
mov rdx, rbx
mov r8d, r15d
call fcn.005a8640
jmp 0x59dd25
xor r15d, r15d
jmp 0x59dd37
lea rdi, [r12 + 0x4c]
mov ecx, dword [r12 + 0x4c]
mov rdx, rbx
mov r8d, r15d
call fcn.005a8f70
mov dword [rdi], eax
add qword [r12], r14
add dword [r12 + 0xc], r15d
mov r10d, dword [r13 + 0x9c]
add r10d, r15d
mov dword [r13 + 0x9c], r10d
mov eax, dword [r13 + 0x1708]
lea ecx, [rax + r10]
cmp ecx, 3
jb 0x59d9b0
mov ebx, dword [r13 + 0x94]
sub ebx, eax
mov r8, qword [r13 + 0x50]
movzx r9d, byte [r8 + rbx]
mov dword [r13 + 0x70], r9d
mov ecx, dword [r13 + 0x80]
shl r9d, cl
lea edi, [rbx + 1]
movzx edi, byte [r8 + rdi]
xor edi, r9d
mov r9d, dword [r13 + 0x7c]
and edi, r9d
mov dword [r13 + 0x70], edi
test eax, eax
je 0x59d9b0
dec eax
nop word cs:[rax + rax]
shl edi, cl
lea esi, [rbx + 2]
movzx esi, byte [r8 + rsi]
xor esi, edi
mov edi, esi
and edi, r9d
mov dword [r13 + 0x70], edi
mov r11, qword [r13 + 0x60]
mov rdx, qword [r13 + 0x68]
movzx r14d, word [rdx + rdi*2]
mov esi, dword [r13 + 0x4c]
and esi, ebx
mov word [r11 + rsi*2], r14w
mov word [rdx + rdi*2], bx
mov dword [r13 + 0x1708], eax
lea edx, [r10 + rax]
cmp edx, 2
jbe 0x59d9b0
inc ebx
dec eax
cmp eax, 0xffffffff
jne 0x59dda0
jmp 0x59d9b0
mov ecx, dword [r13 + 0x1714]
mov edi, dword [r13 + 0x58]
cmp edi, ecx
jbe 0x59de6d
mov ebx, dword [r13 + 0x9c]
add ebx, dword [r13 + 0x94]
cmp ecx, ebx
jae 0x59de3b
sub edi, ebx
cmp edi, 0x102
mov r14d, 0x102
cmovb r14d, edi
mov ecx, ebx
add rcx, qword [r13 + 0x50]
xor edx, edx
mov r8, r14
call sub.msvcrt.dll_memset
add r14d, ebx
jmp 0x59de66
add ebx, 0x102
cmp ebx, ecx
jbe 0x59de6d
sub ebx, ecx
sub edi, ecx
cmp ebx, edi
cmovbe edi, ebx
add rcx, qword [r13 + 0x50]
xor edx, edx
mov r8, rdi
call sub.msvcrt.dll_memset
add edi, dword [r13 + 0x1714]
mov r14d, edi
mov dword [r13 + 0x1714], r14d
movaps xmm6, xmmword [rbp - 0x20]
movaps xmm7, xmmword [rbp - 0x10]
add rsp, 0x58
pop rbx
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
pop rbp
ret