Function at 0x140058990
Capabilities:
Encode data using xor

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x28
lea rbp, [rsp + 0x20]
xor eax, eax
xor edi, edi
mov rsi, rdx
mov qword [rcx], rax
mov qword [rcx + 8], rax
mov qword [rcx + 0x10], rax
mov qword [rcx + 0x18], rax
mov qword [rcx + 0x20], rax
mov qword [rcx + 0x28], rax
mov qword [rcx + 0x30], rax
mov qword [rcx + 0x38], rax
mov qword [rcx + 0x40], rax
movsxd rdx, dword [rdx + 4]
mov rbx, rcx
mov r15d, edi
mov rcx, rdx
test edx, edx
jle 0x1400589f5
mov rax, qword [rsi + 8]
cmp dword [rax], edi
jle 0x1400589ec
inc r15d
add rax, 4
dec rcx
jne 0x1400589e5
mov dword [rbx + 4], edx
mov dword [rbx + 8], r15d
mov eax, dword [rsi]
mov dword [rbx], eax
test r15d, r15d
jle 0x140058f6b
mov edx, dword [rsi + 4]
mov rcx, qword [rsi + 8]
mov r8d, r15d
call fcn.1400586d0
movsxd r14, r15d
movabs r12, 0xffffffffffffff0
lea rcx, [r14*8]
mov r13, rax
lea rax, [rcx + 0xf]
cmp rax, rcx
ja 0x140058a3c
mov rax, r12
and rax, 0xfffffffffffffff0
call fcn.140029380
sub rsp, rax
lea r10, [rsp + 0x20]
mov qword [rbp + 0x50], r10
test r13, r13
jne 0x140058a66
mov rcx, rbx
call fcn.140058910
or eax, 0xffffffff
jmp 0x140058f6d
mov r9d, edi
mov r8, rdi
test r15d, r15d
jle 0x140058b0e
nop word [rax + rax]
mov ecx, dword [r13 + r8*4]
inc r8
rol ecx, 0x10
mov eax, ecx
mov edx, ecx
shl ecx, 8
shr edx, 8
shl eax, 8
xor edx, eax
and edx, 0xff00ff
xor edx, ecx
mov ecx, edx
mov eax, edx
shl edx, 4
shr ecx, 4
shl eax, 4
xor ecx, eax
and ecx, 0xf0f0f0f
xor ecx, edx
mov edx, ecx
lea eax, [rcx*4]
shr edx, 2
xor edx, eax
lea eax, [rcx*4]
and edx, 0x33333333
xor edx, eax
mov ecx, edx
shr ecx, 1
lea eax, [rdx + rdx]
xor ecx, eax
lea eax, [rdx + rdx]
and ecx, 0x55555555
xor ecx, eax
movsxd rax, r9d
inc r9d
mov dword [r13 + r8*4 - 4], ecx
lea rcx, [rax*4]
add rcx, r13
mov qword [r10 + r8*8 - 8], rcx
cmp r8, r14
jl 0x140058a80
lea r9, [0x1400588f0]
mov r8d, 8
mov rdx, r14
mov rcx, r10
call sub.msvcrt.dll_qsort
lea rcx, [r14*4]
lea rax, [rcx + 0xf]
mov qword [rbp + 0x58], rcx
cmp rax, rcx
ja 0x140058b3e
mov rax, r12
and rax, 0xfffffffffffffff0
call fcn.140029380
sub rsp, rax
lea r12, [rsp + 0x20]
call sub.msvcrt.dll_malloc
mov edx, edi
mov rcx, rdi
mov qword [rbx + 0x20], rax
test r15d, r15d
jle 0x140058bb8
mov r8, qword [rbp + 0x50]
nop word [rax + rax]
mov rax, qword [r8 + rcx*8]
inc rcx
sub rax, r13
sar rax, 2
cdqe
mov dword [r12 + rax*4], edx
inc edx
cmp rcx, r14
jl 0x140058b70
test r15d, r15d
jle 0x140058bb8
mov rdx, r13
mov r9, r12
sub rdx, r12
nop dword [rax]
movsxd r8, dword [r9]
mov eax, dword [rdx + r9]
mov rcx, qword [rbx + 0x20]
mov dword [rcx + r8*4], eax
lea r9, [r9 + 4]
dec r14
jne 0x140058ba0
mov rcx, r13
call sub.msvcrt.dll_free
mov r8, r12
mov edx, r15d
mov rcx, rsi
call fcn.140057e30
mov rcx, qword [rbp + 0x58]
mov qword [rbx + 0x18], rax
call sub.msvcrt.dll_malloc
mov edx, edi
mov qword [rbx + 0x28], rax
mov r10d, edi
cmp dword [rsi + 4], edx
jle 0x140058c16
mov r8, rdi
mov r9, r12
nop
mov rax, qword [rsi + 8]
cmp dword [r8 + rax], edi
jle 0x140058c0b
movsxd rcx, dword [r9]
mov rax, qword [rbx + 0x28]
inc r10d
mov dword [rax + rcx*4], edx
add r9, 4
inc edx
add r8, 4
cmp edx, dword [rsi + 4]
jl 0x140058bf0
movsxd rcx, r10d
call sub.msvcrt.dll_malloc
mov r15d, edi
mov r9d, edi
mov qword [rbx + 0x30], rax
cmp dword [rsi + 4], edi
jle 0x140058c5e
mov r8, rdi
mov rax, qword [rsi + 8]
cmp dword [r8 + rax], edi
jle 0x140058c51
movsxd rdx, dword [r12]
mov rcx, qword [rbx + 0x30]
movzx eax, byte [r8 + rax]
inc r15d
mov byte [rdx + rcx], al
add r12, 4
inc r9d
add r8, 4
cmp r9d, dword [rsi + 4]
jl 0x140058c30
mov eax, dword [rbx + 8]
mov ecx, edi
test eax, eax
je 0x140058c6d
inc ecx
shr eax, 1
jne 0x140058c67
add ecx, 0xfffffffc
mov eax, 5
mov edx, 4
cmp ecx, eax
cmovl ecx, eax
mov eax, 8
cmp ecx, 8
cmovg ecx, eax
mov eax, 1
shl eax, cl
mov dword [rbx + 0x40], ecx
movsxd rcx, eax
mov dword [rbp + 0x58], eax
call sub.msvcrt.dll_calloc
mov dword [rbx + 0x44], edi
mov r9, rdi
movsxd r12, r15d
mov qword [rbx + 0x38], rax
test r15d, r15d
jle 0x140058db7
mov r10d, 1
nop dword [rax + rax]
mov eax, dword [rbx + 0x44]
mov rdx, qword [rbx + 0x30]
mov esi, dword [rbx + 0x40]
movsx ecx, byte [rdx + r9]
cmp eax, ecx
cmovl eax, ecx
mov dword [rbx + 0x44], eax
movsx r14d, byte [rdx + r9]
cmp r14d, esi
jg 0x140058da8
mov rax, qword [rbx + 0x20]
sub esi, r14d
mov r8d, edi
mov ecx, dword [rax + r9*4]
rol ecx, 0x10
mov edx, ecx
mov eax, ecx
shl ecx, 8
shr edx, 8
shl eax, 8
xor edx, eax
and edx, 0xff00ff
xor edx, ecx
mov ecx, edx
mov eax, edx
shl edx, 4
shl eax, 4
shr ecx, 4
xor ecx, eax
and ecx, 0xf0f0f0f
xor ecx, edx
mov edx, ecx
shr edx, 2
lea eax, [rcx*4]
xor edx, eax
lea eax, [rcx*4]
movzx ecx, sil
and edx, 0x33333333
xor edx, eax
mov r11d, edx
shr r11d, 1
lea eax, [rdx + rdx]
xor r11d, eax
lea eax, [rdx + rdx]
and r11d, 0x55555555
xor r11d, eax
mov eax, 1
shl eax, cl
test eax, eax
jle 0x140058da8
nop dword [rax]
mov rax, qword [rbx + 0x30]
movzx ecx, byte [r9 + rax]
mov eax, r8d
inc r8d
shl eax, cl
mov ecx, eax
mov rax, qword [rbx + 0x38]
or rcx, r11
mov dword [rax + rcx*4], r10d
mov rax, qword [rbx + 0x30]
mov ecx, dword [rbx + 0x40]
movsx edx, byte [r9 + rax]
sub ecx, edx
mov edx, 1
shl edx, cl
cmp r8d, edx
jl 0x140058d70
inc r9
inc r10d
cmp r9, r12
jl 0x140058cc0
mov edx, edi
mov ecx, 0x1f
mov r13d, 0xfffffffe
sub ecx, dword [rbx + 0x40]
mov r14d, edi
mov dword [rbp + 0x50], edx
shl r13d, cl
cmp dword [rbp + 0x58], edx
jle 0x140058f6b
mov rsi, rdi
mov r11, rdi
nop
mov r9, qword [rbx + 0x38]
mov r8d, edx
mov ecx, 0x20
sub ecx, dword [rbx + 0x40]
mov qword [rbp + 0x68], r9
shl r8d, cl
mov edx, r8d
rol edx, 0x10
mov ecx, edx
mov eax, edx
mov dword [rbp + 0x60], edx
shr ecx, 8
shl eax, 8
xor ecx, eax
mov eax, edx
and ecx, 0xff00ff
shl eax, 8
xor ecx, eax
mov edx, ecx
mov eax, ecx
shl ecx, 4
shr edx, 4
shl eax, 4
xor edx, eax
and edx, 0xf0f0f0f
xor edx, ecx
mov ecx, edx
lea eax, [rdx*4]
shr ecx, 2
xor ecx, eax
lea eax, [rdx*4]
and ecx, 0x33333333
xor ecx, eax
mov edx, ecx
shr rdx, 1
lea eax, [rcx + rcx]
add ecx, ecx
xor rdx, rax
and edx, 0x55555555
xor rdx, rcx
cmp dword [r9 + rdx*4], 0
jne 0x140058f5a
lea ecx, [rdi + 1]
cmp ecx, r15d
jge 0x140058e96
mov rdx, qword [rbx + 0x20]
add rdx, 4
lea rdx, [rdx + rsi*4]
cmp dword [rdx], r8d
ja 0x140058e96
inc ecx
inc edi
inc rsi
add rdx, 4
cmp ecx, r15d
jl 0x140058e81
cmp r11, r12
jge 0x140058ebc
mov rax, qword [rbx + 0x20]
lea rcx, [rax + r11*4]
mov eax, dword [rcx]
and eax, r13d
cmp r8d, eax
jb 0x140058ebc
inc r11
inc r14d
add rcx, 4
cmp r11, r12
jl 0x140058ea3
mov ecx, dword [rbp + 0x60]
mov eax, 0x7fff
mov r9d, r15d
mov edx, ecx
sub r9d, r14d
cmp edi, eax
mov r10d, edi
cmova r10d, eax
cmp r9d, eax
cmova r9d, eax
mov eax, ecx
shr edx, 8
shl eax, 8
shl ecx, 8
or r10d, 0xffff0000
xor edx, eax
shl r10d, 0xf
and edx, 0xff00ff
or r10d, r9d
xor edx, ecx
mov eax, edx
mov ecx, edx
shl edx, 4
shl eax, 4
shr ecx, 4
xor ecx, eax
and ecx, 0xf0f0f0f
xor ecx, edx
mov r8d, ecx
lea eax, [rcx*4]
shr r8d, 2
xor r8d, eax
lea eax, [rcx*4]
and r8d, 0x33333333
xor r8d, eax
mov edx, r8d
shr rdx, 1
lea eax, [r8 + r8]
lea ecx, [r8 + r8]
xor rdx, rax
mov rax, qword [rbp + 0x68]
and edx, 0x55555555
xor rdx, rcx
mov dword [rax + rdx*4], r10d
mov edx, dword [rbp + 0x50]
inc edx
mov dword [rbp + 0x50], edx
cmp edx, dword [rbp + 0x58]
jl 0x140058de0
xor eax, eax
lea rsp, [rbp + 8]
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret