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

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbp
push rbx
sub rsp, 0x38
mov r12d, 0xffffff9a
test rcx, rcx
je 0x140112b45
mov r13, rcx
mov rbp, qword [rcx + 0x110]
test rbp, rbp
je 0x140112b45
cmp qword [rbp], 0
je 0x140112b3f
xor r12d, r12d
test r8d, r8d
je 0x140112b45
mov qword [rbp + 0x18], rdx
mov dword [rbp + 0x20], r8d
mov ecx, r8d
mov rax, qword [rbp + 0x98]
mov r14d, dword [rbp + 0x10]
mov rdx, r14
add rdx, rax
cmp rdx, rcx
jae 0x1401128bf
cmp dword [rbp + 0x118], 0
je 0x1401128bf
add eax, r14d
mov dword [rbp + 0x20], eax
je 0x140112b45
lea rax, [rbp + 8]
mov qword [rsp + 0x28], rax
lea r12, [rbp + 0xa8]
xor esi, esi
mov r15d, 0xff
test r14d, r14d
je 0x140112939
mov eax, dword [rbp + 0x108]
test eax, eax
je 0x1401128f3
cmp dword [rbp + 0x118], 0
je 0x140112ac3
test r14d, r14d
jne 0x140112906
cmp qword [rbp + 0x98], 0
je 0x140112b5e
mov eax, dword [rbp + 0x20]
cmp eax, r14d
cmovb r14d, eax
test r14d, r14d
je 0x140112a71
mov ebx, r14d
xor eax, eax
mov rcx, qword [rbp + 8]
mov rdx, qword [rbp + 0x18]
mov cl, byte [rcx + rax]
mov byte [rdx + rax], cl
inc rax
cmp rbx, rax
jne 0x14011291e
jmp 0x140112a73
mov r14, qword [rbp + 0x98]
test r14, r14
je 0x140112b37
mov eax, 0x4000
cmp r14, rax
cmovae r14, rax
mov rdx, qword [rbp + 0x100]
mov r8, qword [rbp + 0x110]
add r8, qword [rbp + 0x60]
mov rcx, r12
xor r9d, r9d
call fcn.1401218c0
mov ebx, 0xffffffff
test eax, eax
jne 0x140112b60
mov r8, qword [rbp]
mov rax, qword [rbp + 0xb0]
mov rdx, qword [rbp + 0x100]
mov rcx, qword [rbp + 0xe0]
mov r9d, r14d
call qword [0x140177010]
cmp eax, r14d
jne 0x140112b60
mov r8, rsi
cmp dword [r13 + 0x118], 0
mov r9d, 0xfffd
je 0x140112a52
xor eax, eax
mov ecx, dword [r13 + 0x128]
and ecx, r9d
lea edx, [rcx + 2]
xor ecx, 3
imul ecx, edx
shr ecx, 8
mov rdx, qword [rbp]
xor cl, byte [rdx + rax]
mov byte [rdx + rax], cl
movzx ecx, cl
mov rdx, qword [r13 + 0x130]
mov ebx, dword [r13 + 0x120]
mov edi, dword [r13 + 0x128]
mov esi, ebx
and esi, r15d
xor esi, ecx
shr ebx, 8
xor ebx, dword [rdx + rsi*4]
mov dword [r13 + 0x120], ebx
and ebx, r15d
add ebx, dword [r13 + 0x124]
imul ebx, ebx, 0x8088405
inc ebx
mov dword [r13 + 0x124], ebx
shr ebx, 0x18
mov esi, edi
and esi, r15d
xor esi, ebx
shr edi, 8
xor edi, dword [rdx + rsi*4]
mov dword [r13 + 0x128], edi
mov rdx, qword [rbp]
mov byte [rdx + rax], cl
inc rax
cmp r14, rax
jne 0x1401129c3
add qword [rbp + 0x60], r14
sub qword [rbp + 0x98], r14
mov rax, qword [rbp]
mov qword [rbp + 8], rax
mov dword [rbp + 0x10], r14d
mov rsi, r8
jmp 0x1401128dc
xor ebx, ebx
add qword [rbp + 0x88], rbx
mov rdx, qword [rbp + 0x18]
mov ecx, dword [rbp + 0x90]
mov r8d, r14d
call fcn.1400710b0
mov dword [rbp + 0x90], eax
sub qword [rbp + 0xa0], rbx
sub dword [rbp + 0x10], r14d
sub dword [rbp + 0x20], r14d
add qword [rbp + 0x18], rbx
add qword [rbp + 8], rbx
add dword [rbp + 0x24], r14d
add esi, r14d
cmp dword [rbp + 0x20], 0
je 0x140112b59
mov r14d, dword [rbp + 0x10]
jmp 0x1401128d7
cmp eax, 0xc
je 0x140112ab0
mov r14, r12
mov edi, dword [rbp + 0x24]
mov rax, qword [rbp + 0x18]
mov qword [rsp + 0x30], rax
mov rcx, qword [rsp + 0x28]
mov edx, 2
call fcn.1400663e0
mov r12d, eax
test eax, eax
js 0x140112afb
cmp qword [rbp + 0x28], 0
mov eax, 0xfffffffd
cmovne r12d, eax
mov ebx, dword [rbp + 0x24]
mov ecx, dword [rbp + 0x90]
sub rbx, rdi
add qword [rbp + 0x88], rbx
mov rdx, qword [rsp + 0x30]
mov r8d, ebx
call fcn.1400710b0
mov dword [rbp + 0x90], eax
sub qword [rbp + 0xa0], rbx
add esi, ebx
test r12d, r12d
jne 0x140112b65
mov r12, r14
jmp 0x140112ab0
xor r14d, r14d
jmp 0x1401128dc
mov r12d, 0xffffff9c
mov eax, r12d
add rsp, 0x38
pop rbx
pop rbp
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret
mov r12d, esi
jmp 0x140112b45
mov ebx, esi
mov r12d, ebx
jmp 0x140112b45
mov ebx, esi
cmp r12d, 1
jne 0x140112b45
jmp 0x140112b60