Function at 0x140291010
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 0x14029131c
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 0x1402910e0
test r13, r13
je 0x140291128
cmp qword [r13 + 0x10], 0
je 0x140291100
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 0x140291080
mov rcx, qword [r13]
call qword [sym.imp.kernel32.dll_CloseHandle]
test ebx, ebx
je 0x140291100
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 0x140291325
add edi, 1
cmp edi, ebp
jne 0x140291040
mov edi, r8d
jmp 0x140291128
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 0x1402910ce
imul rsi, rsi, 0x68
lea rsi, [r12 + rsi + 0x60]
cmp ebp, edi
je 0x140291274
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 0x1402912ee
mov qword [r12 + 0x40], rcx
call qword [0x1402b2098]
mov dword [r12 + 0x54], eax
mov eax, dword [0x1402b2060]
mov qword [rsi], 0
test eax, eax
jne 0x140291250
mov ecx, 0x28
call qword [0x1402b2080]
mov rbx, rax
test rbx, rbx
je 0x140291312
cmp byte [0x1402b2064], 0
je 0x1402912a0
mov rax, qword [0x1402b21f0]
test rax, rax
je 0x1402911f9
mov ecx, 0xc8
call rax
test eax, eax
jne 0x1402912a0
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 0x1402912a0
cmp qword [rbx + 0x10], 0
je 0x1402912c7
mov qword [rsi], rbx
xor edx, edx
jmp 0x1402910ce
mov rcx, qword [0x1402b1d00]
test rcx, rcx
je 0x140291262
call qword [0x1402b20e0]
mov ecx, 0x28
call sym.sqlite3Malloc.part.0
mov rbx, rax
jmp 0x1402911c8
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 0x140291240
cmp qword [r12 + 0x40], 0
je 0x1402911a5
movsxd rcx, dword [r12 + 0x54]
call sym.sqlite3Malloc
test rax, rax
mov qword [r12 + 0x40], rax
jne 0x1402911a5
mov edx, 7
jmp 0x1402910ce
xor edi, edi
xor esi, esi
jmp 0x140291131
mov r8d, edi
jmp 0x1402910f4