Function at 0x140003d50
Capabilities:
Encode data using xor
Generate random numbers using the delphi lcg

Disassembly:
push rbx
push r12
push r13
sub rsp, 0x30
xor r13d, r13d
mov rbx, rcx
mov r12d, r13d
test rcx, rcx
je 0x14000421a
mov rax, qword [rcx + 0x140]
test rax, rax
je 0x14000421a
cmp qword [rax], r12
jne 0x140003d90
mov eax, 0xffffff9c
add rsp, 0x30
pop r13
pop r12
pop rbx
ret
test r8d, r8d
jne 0x140003da1
xor eax, eax
add rsp, 0x30
pop r13
pop r12
pop rbx
ret
mov qword [rax + 0x18], rdx
mov rax, qword [rcx + 0x140]
mov edx, r8d
mov dword [rax + 0x20], r8d
mov rcx, qword [rcx + 0x140]
cmp dword [rcx + 0x128], r12d
je 0x140003ddd
mov r8d, dword [rcx + 0x10]
mov r9, qword [rcx + 0x98]
lea rax, [r9 + r8]
cmp rdx, rax
jbe 0x140003dec
lea eax, [r8 + r9]
jmp 0x140003de9
mov rax, qword [rcx + 0xa0]
cmp rdx, rax
jbe 0x140003dec
mov dword [rcx + 0x20], eax
mov rax, qword [rbx + 0x140]
mov qword [rsp + 0x50], rbp
mov qword [rsp + 0x58], rsi
mov qword [rsp + 0x60], rdi
cmp dword [rax + 0x20], r12d
mov qword [rsp + 0x28], r14
mov qword [rsp + 0x20], r15
jbe 0x140004212
mov edi, 0xfffffffd
cmp dword [rax + 0x10], r13d
jne 0x140004066
mov rdx, qword [rax + 8]
mov ebp, r13d
mov edi, r13d
test rdx, rdx
je 0x140003e3e
mov ebp, dword [rax]
sub ebp, edx
add ebp, 0x10000
mov esi, 0x10000
sub esi, ebp
test ebp, ebp
je 0x140003e54
mov rcx, qword [rax]
mov r8d, ebp
call sub.VCRUNTIME140.dll_memcpy
mov rax, qword [rbx + 0x140]
mov rcx, qword [rax + 0x98]
mov eax, esi
cmp rcx, rax
cmovb esi, ecx
test esi, esi
je 0x140003f62
mov r10, qword [rbx + 0x140]
mov r8, qword [r10 + 0x120]
add r8, qword [r10 + 0x60]
mov rax, qword [r10 + 0xd0]
mov rdx, qword [r10 + 0x110]
test rax, rax
je 0x140003ea5
mov rcx, qword [r10 + 0xe8]
xor r9d, r9d
call rax
jmp 0x140003ec2
mov eax, r8d
cmp rax, r8
jne 0x140004208
mov rcx, qword [r10 + 0xe8]
xor r9d, r9d
call qword [r10 + pe_nt_image_headers64]
test eax, eax
jne 0x140004208
mov r10, qword [rbx + 0x140]
mov r9d, esi
mov eax, ebp
sub r9d, edi
mov r8d, edi
add r8, rax
add r8, qword [r10]
mov rdx, qword [r10 + 0x110]
mov rcx, qword [r10 + 0xe8]
call qword [r10 + 0xb8]
mov rcx, qword [rbx + 0x140]
add edi, eax
mov edx, eax
add qword [rcx + 0x60], rdx
test eax, eax
jne 0x140003f5a
mov rax, qword [rbx + 0x140]
mov rdx, qword [rax + 0x110]
mov rcx, qword [rax + 0xe8]
call qword [rax + 0xe0]
test eax, eax
jne 0x140004208
mov rcx, rbx
call fcn.140002e00
test eax, eax
jne 0x140004116
mov rax, qword [rbx + 0x140]
mov qword [rax + 0x60], r13
mov rcx, qword [rbx + 0x140]
mov rax, qword [rbx + 0x68]
mov qword [rcx + 0x110], rax
cmp edi, esi
jne 0x140003e72
test byte [rbx + 0xd0], 1
je 0x140004036
cmp qword [rbx + 0x158], r13
je 0x140004036
test edi, edi
je 0x140004036
mov r10, r13
mov r11d, edi
nop word [rax + rax]
mov edx, dword [rbx + 0x154]
lea r10, [r10 + 1]
mov rax, qword [rbx + 0x140]
and edx, 0xfffd
or edx, 2
mov rcx, qword [rax]
mov eax, edx
xor eax, 1
imul eax, edx
shr eax, 8
xor al, byte [rcx + r10 - 1]
movzx r9d, al
mov byte [rcx + r10 - 1], r9b
mov eax, r9d
mov r8, qword [rbx + 0x158]
mov edx, dword [rbx + 0x14c]
xor rax, rdx
movzx ecx, al
shr edx, 8
xor edx, dword [r8 + rcx*4]
mov ecx, dword [rbx + 0x154]
mov dword [rbx + 0x14c], edx
movzx eax, dl
add eax, dword [rbx + 0x150]
imul edx, eax, 0x8088405
movzx eax, cl
shr ecx, 8
inc edx
mov dword [rbx + 0x150], edx
shr rdx, 0x18
xor rax, rdx
xor ecx, dword [r8 + rax*4]
mov dword [rbx + 0x154], ecx
mov rax, qword [rbx + 0x140]
mov rcx, qword [rax]
mov byte [r10 + rcx - 1], r9b
sub r11, 1
jne 0x140003f90
mov rcx, qword [rbx + 0x140]
mov eax, edi
sub qword [rcx + 0x98], rax
mov rcx, qword [rbx + 0x140]
mov rax, qword [rcx]
mov qword [rcx + 8], rax
lea ecx, [rdi + rbp]
mov rax, qword [rbx + 0x140]
mov edi, 0xfffffffd
mov dword [rax + 0x10], ecx
mov rax, qword [rbx + 0x140]
mov ecx, dword [rax + 0x118]
test ecx, ecx
je 0x140004139
cmp dword [rax + 0x128], r13d
jne 0x140004139
cmp ecx, 0xc
je 0x1400041f8
mov r14d, dword [rax + 0x24]
lea rcx, [rax + 8]
mov r15, qword [rax + 0x18]
mov edx, 2
call fcn.140012c20
mov ebp, eax
test eax, eax
js 0x1400040bb
mov rax, qword [rbx + 0x140]
cmp qword [rax + 0x28], r13
cmovne ebp, edi
mov rax, qword [rbx + 0x140]
mov rdx, r15
mov esi, dword [rax + 0x24]
mov ecx, esi
sub rcx, r14
add qword [rax + 0x88], rcx
mov rax, qword [rbx + 0x140]
mov r8d, ecx
sub qword [rax + 0xa0], rcx
mov rdi, qword [rbx + 0x140]
mov ecx, dword [rdi + 0x90]
call fcn.14000ee10
sub esi, r14d
mov dword [rdi + 0x90], eax
add r12d, esi
cmp ebp, 1
je 0x140004212
test ebp, ebp
je 0x1400041f8
mov eax, ebp
mov r14, qword [rsp + 0x28]
mov rdi, qword [rsp + 0x60]
mov rsi, qword [rsp + 0x58]
mov rbp, qword [rsp + 0x50]
mov r15, qword [rsp + 0x20]
add rsp, 0x30
pop r13
pop r12
pop rbx
ret
mov ebp, dword [rax + 0x10]
test ebp, ebp
jne 0x14000414d
cmp qword [rax + 0x98], r13
je 0x140004212
cmp dword [rax + 0x20], ebp
cmovb ebp, dword [rax + 0x20]
test ebp, ebp
je 0x140004184
mov r8, r13
mov r9d, ebp
nop
mov rax, qword [rbx + 0x140]
lea r8, [r8 + 1]
mov rcx, qword [rax + 8]
mov rdx, qword [rax + 0x18]
movzx eax, byte [r8 + rcx - 1]
mov byte [r8 + rdx - 1], al
sub r9, 1
jne 0x140004160
mov rax, qword [rbx + 0x140]
mov esi, ebp
mov r8d, ebp
add qword [rax + 0x88], rsi
mov rax, qword [rbx + 0x140]
sub qword [rax + 0xa0], rsi
mov rdi, qword [rbx + 0x140]
mov rdx, qword [rdi + 0x18]
mov ecx, dword [rdi + 0x90]
call fcn.14000ee10
mov dword [rdi + 0x90], eax
mov rax, qword [rbx + 0x140]
sub dword [rax + 0x10], ebp
mov rax, qword [rbx + 0x140]
sub dword [rax + 0x20], ebp
mov rax, qword [rbx + 0x140]
add qword [rax + 0x18], rsi
mov rax, qword [rbx + 0x140]
add qword [rax + 8], rsi
mov rax, qword [rbx + 0x140]
add dword [rax + 0x24], ebp
add r12d, ebp
mov rax, qword [rbx + 0x140]
cmp dword [rax + 0x20], r13d
jmp 0x140003e10
mov eax, 0xffffffff
jmp 0x140004116
mov eax, r12d
jmp 0x140004116
mov eax, 0xffffff9a
add rsp, 0x30
pop r13
pop r12
pop rbx
ret