Function at 0x1402982e0
Capabilities:
Create thread

Disassembly:
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x30
movzx ebp, byte [rcx + 0x5b]
sub ebp, 1
mov r12, rcx
mov byte [rcx + 0x58], 1
test ebp, ebp
jle 0x1402985ec
movzx ecx, byte [rcx + 0x5a]
mov r8d, ebp
xor edi, edi
add ecx, 1
lea eax, [rcx + rdi]
cdq
idiv ebp
movsxd rsi, edx
imul rax, rsi, 0x68
add rax, r12
mov edx, dword [rax + 0x68]
mov r13, qword [rax + 0x60]
test edx, edx
je 0x1402983b0
test r13, r13
je 0x1402983f8
cmp qword [r13 + 0x10], 0
je 0x1402983d0
mov r14, qword [r13]
nop word [rax + rax]
mov r8d, 1
mov edx, 0xffffffff
mov rcx, r14
call qword [sym.WaitForSingleObjectEx]
cmp eax, 0xc0
mov ebx, eax
je 0x140298350
mov rcx, qword [r13]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
test ebx, ebx
je 0x1402983d0
imul rsi, rsi, 0x68
mov rcx, r13
call sym.sqlite3_free
mov edx, 1
add rsi, r12
mov dword [rsi + 0x68], 0
mov qword [rsi + 0x60], 0
mov eax, edx
add rsp, 0x30
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
ret
test r13, r13
je 0x1402985f5
add edi, 1
cmp edi, ebp
jne 0x140298310
mov edi, r8d
jmp 0x1402983f8
mov rcx, r13
mov rbx, qword [r13 + 0x20]
call sym.sqlite3_free
imul rax, rsi, 0x68
mov edx, ebx
add rax, r12
test ebx, ebx
mov dword [rax + 0x68], 0
mov qword [rax + 0x60], 0
jne 0x14029839e
imul rsi, rsi, 0x68
lea rsi, [r12 + rsi + 0x60]
cmp ebp, edi
je 0x140298544
lea rdx, [r12 + 0x60]
mov rax, rsi
mov rcx, qword [rsi + 0x28]
sub rax, rdx
movabs rdx, 0x4ec4ec4ec4ec4ec5
sar rax, 3
imul rax, rdx
test rcx, rcx
mov byte [r12 + 0x5a], al
mov rax, qword [r12 + 0x38]
mov qword [rsi + 0x20], rax
mov rax, qword [r12 + 0x40]
mov qword [rsi + 0x28], rax
mov rax, qword [r12 + 0x48]
mov qword [rsi + 0x30], rax
mov qword [r12 + 0x38], 0
mov dword [r12 + 0x48], 0
je 0x1402985be
mov qword [r12 + 0x40], rcx
call qword [0x1402b90d8]
mov dword [r12 + 0x54], eax
mov eax, dword [0x1402b90a0]
mov qword [rsi], 0
test eax, eax
jne 0x140298520
mov ecx, 0x28
call qword [0x1402b90c0]
mov rbx, rax
test rbx, rbx
je 0x1402985e2
cmp byte [0x1402b90a4], 0
je 0x140298570
mov rax, qword [0x1402b9230]
test rax, rax
je 0x1402984c9
mov ecx, 0xc8
call rax
test eax, eax
jne 0x140298570
lea rax, [sym.vdbeSorterFlushThread]
mov qword [rbx + 0x18], rsi
xor edx, edx
xor ecx, ecx
mov qword [rbx + 0x10], rax
lea rax, [rbx + 8]
mov r9, rbx
mov qword [rsp + 0x28], rax
lea r8, [sym.sqlite3ThreadProc]
mov dword [rsp + 0x20], 0
call qword [sym.imp.msvcrt.dll__beginthreadex]
test rax, rax
mov qword [rbx], rax
je 0x140298570
cmp qword [rbx + 0x10], 0
je 0x140298597
mov qword [rsi], rbx
xor edx, edx
jmp 0x14029839e
mov rcx, qword [0x1402b8d40]
test rcx, rcx
je 0x140298532
call qword [0x1402b9120]
mov ecx, 0x28
call sym.sqlite3Malloc.part.0
mov rbx, rax
jmp 0x140298498
lea rdx, [r12 + 0x38]
movsxd rax, ebp
imul rax, rax, 0x68
lea rcx, [r12 + rax + 0x60]
add rsp, 0x30
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
jmp sym.vdbeSorterListToPMA
mov qword [rbx], 0
mov qword [rbx + 8], 0
mov qword [rbx + 0x10], 0
mov qword [rbx + 0x18], 0
mov qword [rbx + 0x20], 0
call qword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
lea rdx, [rsi + 0x20]
mov rcx, rsi
mov dword [rbx + 8], eax
call sym.vdbeSorterListToPMA
mov dword [rsi + 8], 1
cdqe
mov qword [rbx + 0x20], rax
jmp 0x140298510
cmp qword [r12 + 0x40], 0
je 0x140298475
movsxd rcx, dword [r12 + 0x54]
call sym.sqlite3Malloc
test rax, rax
mov qword [r12 + 0x40], rax
jne 0x140298475
mov edx, 7
jmp 0x14029839e
xor edi, edi
xor esi, esi
jmp 0x140298401
mov r8d, edi
jmp 0x1402983c4