Function at 0x14018e130
Capabilities:
Reference sql statements
Resolve function by parsing pe exports

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0xc8
xor ebx, ebx
mov rax, qword [rsp + 0x130]
cmp dword [rcx + 0x34], 0
movsxd rsi, dword [rsp + 0x140]
mov qword [rsp + 0x38], rax
mov r13, rdx
mov rbp, rcx
mov rdi, r9
mov eax, dword [rsp + 0x138]
mov dword [rsp + 0x50], r8d
mov edx, dword [rsp + 0x148]
mov dword [rsp + 0x40], eax
mov rax, qword [rsp + 0x150]
mov qword [rsp + 0x70], rax
jne 0x14018e1b2
test esi, esi
jns 0x14018e1a1
xor ebx, ebx
cmp qword [rcx + 0x18], 0
setne bl
add ebx, dword [r13 + 0x10]
jmp 0x14018e1b2
movsxd rax, esi
shl rax, 4
mov ebx, dword [rax + r13 + 0x1c]
cmp edx, ebx
cmovle ebx, edx
mov edx, ebx
mov rcx, rbp
call sym.fts5MultiIterAlloc
mov r12, rax
mov rax, qword [rsp + 0x70]
test r12, r12
mov qword [rax], r12
je 0x14018ecca
mov eax, dword [rsp + 0x50]
mov qword [r12 + 0x30], rdi
and eax, 2
mov dword [rsp + 0x5c], eax
setne al
movzx eax, al
mov dword [r12 + 0x44], eax
mov eax, dword [rsp + 0x50]
shr eax, 4
and eax, 1
test byte [rsp + 0x50], 0x20
mov byte [r12 + 0x48], al
jne 0x14018e20d
lea rcx, [rbp + 0x34]
mov rdx, r12
call sym.fts5IterSetOutputCb
mov eax, dword [rbp + 0x34]
test eax, eax
mov dword [rsp + 0x44], eax
jne 0x14018ec97
test esi, esi
jns 0x14018eb80
movsxd rax, dword [r13 + 0x14]
mov r14, qword [rbp + 0x18]
shl rax, 4
lea rax, [r13 + rax + 0x18]
test r14, r14
mov qword [rsp + 0x80], rax
je 0x14018e4ac
lea rax, [r12 + 0x60]
xor esi, esi
xor edi, edi
cmp qword [rsp + 0x38], 0
mov qword [rsp + 0x48], rax
mov dword [rsp + 0xac], esi
mov qword [rsp + 0xb0], rdi
je 0x14018e278
mov esi, dword [rsp + 0x50]
and esi, 8
je 0x14018e305
mov r8d, dword [rsp + 0x40]
lea r9, [r14 + 0x18]
xor ebx, ebx
mov rcx, r14
mov rdx, qword [rsp + 0x38]
mov qword [rsp + 0xb8], rbx
call sym.fts5HashEntrySort
mov rcx, qword [rbp + 0x18]
lea rdx, [rsp + 0xb0]
mov dword [rbp + 0x34], eax
lea r9, [rsp + 0xac]
lea r8, [rsp + 0xb8]
call sym.sqlite3Fts5HashScanEntry
mov rcx, qword [rsp + 0xb0]
test rcx, rcx
je 0x14018e2d2
call sym.strlen
mov dword [rsp + 0x44], eax
mov rsi, qword [rsp + 0xb8]
test rsi, rsi
je 0x14018e497
lea rcx, [rbp + 0x34]
mov edx, 0x10
call sym.sqlite3Fts5MallocZero
test rax, rax
mov rbx, rax
je 0x14018e497
mov qword [rax], rsi
jmp 0x14018e41b
mov eax, dword [rsp + 0x40]
mov ecx, dword [r14 + 0x14]
lea edx, [rax - 1]
mov eax, 0xd
movsxd rdx, edx
test edx, edx
js 0x14018e339
mov rdi, qword [rsp + 0x38]
lea r8d, [rax*8]
xor eax, r8d
movzx r8d, byte [rdi + rdx]
dec rdx
xor eax, r8d
jmp 0x14018e318
xor edx, edx
movsxd rdi, dword [rsp + 0x40]
div ecx
mov rax, qword [r14 + 0x20]
mov r15, qword [rax + rdx*8]
test r15, r15
je 0x14018e376
mov ebx, dword [r15 + 0x1c]
lea eax, [rbx + 1]
cmp dword [rsp + 0x40], eax
jne 0x14018e371
mov rdx, qword [rsp + 0x38]
lea rcx, [r15 + 0x30]
mov r8, rdi
call sub.msvcrt.dll_memcmp
test eax, eax
je 0x14018e37a
mov r15, qword [r15]
jmp 0x14018e34a
xor ebx, ebx
jmp 0x14018e3e8
mov eax, dword [r15 + 0x18]
lea edx, [rbx + 0x32]
mov esi, 7
mov dword [rsp + 0x54], edx
sub eax, edx
lea ecx, [rax + 0x1a]
mov dword [rsp + 0x44], eax
movsxd rcx, ecx
call sym.sqlite3_malloc64
test rax, rax
mov rbx, rax
je 0x14018e3e8
movsxd rsi, dword [rsp + 0x54]
lea rax, [rax + 0x10]
mov r8d, 0x10
movsxd rcx, dword [rsp + 0x44]
mov rdi, rax
mov rdx, rsi
add rsi, r15
rep movsb byte [rdi], byte [rsi]
sub r8d, edx
mov rcx, r14
mov rdx, r15
movsxd r8, r8d
xor esi, esi
add r8, rbx
call sym.fts5HashAddPoslistSize
mov edi, dword [rsp + 0x44]
lea r15d, [rdi + rax]
mov dword [rsp + 0xac], r15d
test rbx, rbx
mov dword [rbp + 0x34], esi
je 0x14018e3f7
lea rax, [rbx + 0x10]
mov qword [rbx], rax
mov rax, qword [rsp + 0x38]
or dword [r12 + 0x68], 1
test rbx, rbx
mov qword [rsp + 0xb0], rax
je 0x14018e497
mov eax, dword [rsp + 0x40]
mov dword [rsp + 0x44], eax
mov r9, qword [rsp + 0xb0]
lea rdx, [r12 + 0xb8]
mov r8d, dword [rsp + 0x44]
lea rcx, [rbp + 0x34]
call sym.sqlite3Fts5BufferSet
mov rcx, qword [rbx]
lea rdx, [r12 + 0xc8]
mov esi, dword [rsp + 0xac]
mov dword [rbx + 0xc], esi
mov dword [rbx + 8], esi
mov qword [r12 + 0x70], rbx
call sym.sqlite3Fts5GetVarint
cmp dword [rsp + 0x5c], 0
mov dword [r12 + 0x9c], esi
movzx eax, al
mov qword [r12 + 0x80], rax
je 0x14018e48a
or dword [r12 + 0x68], 2
mov rcx, rbp
mov rdx, qword [rsp + 0x48]
call sym.fts5SegIterReverseInitPage
jmp 0x14018e497
mov rdx, qword [rsp + 0x48]
mov rcx, rbp
call sym.fts5SegIterLoadNPos
mov rdx, qword [rsp + 0x48]
mov rcx, rbp
call sym.fts5SegIterSetNext
mov dword [rsp + 0x44], 1
lea rax, [r13 + 0x18]
mov qword [rsp + 0x48], rax
mov rdi, qword [rsp + 0x80]
cmp qword [rsp + 0x48], rdi
jae 0x14018eb99
mov rax, qword [rsp + 0x48]
mov eax, dword [rax + 4]
mov dword [rsp + 0x60], eax
dec eax
mov dword [rsp + 0x64], eax
movsxd rax, dword [rsp + 0x44]
imul rax, rax, 0x78
lea rbx, [r12 + rax + 0x60]
movsxd rax, dword [rsp + 0x64]
imul rax, rax, 0xc
mov qword [rsp + 0x68], rax
mov eax, dword [rsp + 0x50]
and eax, 8
mov dword [rsp + 0x58], eax
lea rax, [rsp + 0xb0]
mov qword [rsp + 0x98], rax
cmp dword [rsp + 0x64], 0
js 0x14018eb65
mov rax, qword [rsp + 0x48]
mov rsi, qword [rsp + 0x68]
add rsi, qword [rax + 8]
cmp qword [rsp + 0x38], 0
jne 0x14018e54f
cmp dword [rsi + 4], 0
je 0x14018eb52
mov r8, rbx
mov rdx, rsi
mov rcx, rbp
call sym.fts5SegIterInit.part.0
jmp 0x14018eb52
lea rdx, [rbx + 8]
xor eax, eax
mov ecx, 0x1c
mov rdi, rdx
rep stosd dword [rdi], eax
mov qword [rbx], rsi
cmp qword [rbp + 0x60], 0
jne 0x14018e590
mov rax, qword [rbp]
lea rcx, str.SELECT_pgno_FROM__q._q_idx_WHERE_segid__AND_term___ORDER_BY_term_DESC_LIMIT_1
mov rdx, qword [rax + 8]
mov r8, qword [rax + 0x10]
call sym.sqlite3_mprintf
lea rdx, [rbp + 0x60]
mov rcx, rbp
mov r8, rax
call sym.fts5IndexPrepareStmt
mov eax, dword [rbp + 0x34]
mov rdi, qword [rbp + 0x60]
test eax, eax
mov dword [rsp + 0x54], eax
jne 0x14018eb52
mov r8d, dword [rsi]
mov edx, 1
mov rcx, rdi
call sym.sqlite3_bind_int
mov r9d, dword [rsp + 0x40]
xor r11d, r11d
mov rcx, rdi
mov r8, qword [rsp + 0x38]
mov qword [rsp + 0x20], r11
mov edx, 2
call sym.sqlite3_bind_blob
mov rcx, rdi
call sym.sqlite3_step
cmp eax, 0x64
jne 0x14018e5f8
xor edx, edx
mov rcx, rdi
call sym.sqlite3_column_int
movsxd r13, eax
mov r14, r13
sar r13, 1
and r14d, 1
jmp 0x14018e601
xor r14d, r14d
mov r13d, 1
mov rcx, rdi
call sym.sqlite3_reset
mov edx, 2
mov rcx, rdi
mov dword [rbp + 0x34], eax
call sym.sqlite3_bind_null
mov eax, dword [rsi + 4]
cmp eax, r13d
jg 0x14018e629
mov dword [rsp + 0x54], r14d
mov eax, r13d
dec eax
mov rdx, rbx
mov rcx, rbp
mov dword [rbx + 0xc], eax
call sym.fts5SegIterNextPage
mov r14, qword [rbx + 0x10]
test r14, r14
je 0x14018e985
mov ecx, dword [r14 + 0xc]
xor r10d, r10d
mov rdi, qword [r14]
mov dword [rsp + 0xa8], r10d
mov rdx, qword [rsp + 0x98]
mov dword [rsp + 0xac], r10d
mov r13d, dword [r14 + 8]
mov rsi, rcx
add rcx, rdi
call sym.sqlite3Fts5GetVarint32
mov edx, dword [rsp + 0xb0]
cmp r13d, edx
mov dword [rsp + 0xa4], edx
jb 0x14018e7ae
add esi, eax
xor r8d, r8d
lea rax, [rsp + 0xac]
mov qword [rsp + 0x90], rax
lea rax, [rsp + 0xa8]
mov qword [rsp + 0x78], rax
jmp 0x14018e6d8
lea eax, [r8 + 1]
mov ecx, r8d
add rcx, rdi
mov dword [rsp + 0xa4], eax
movzx edx, byte [rcx]
test dl, dl
mov dword [rsp + 0xa8], edx
js 0x14018e7ff
mov r8d, r15d
mov ecx, dword [rsp + 0xa4]
lea eax, [rcx + 1]
mov r15, rcx
add rcx, rdi
movzx edx, byte [rcx]
mov dword [rsp + 0xa4], eax
test dl, dl
mov dword [rsp + 0xac], edx
jns 0x14018e724
mov rdx, qword [rsp + 0x90]
mov dword [rsp + 0x88], r8d
call sym.sqlite3Fts5GetVarint32
mov r8d, dword [rsp + 0x88]
add eax, r15d
mov dword [rsp + 0xa4], eax
cmp dword [rsp + 0xa8], r8d
jb 0x14018ecab
mov r15d, r8d
jne 0x14018e773
mov ecx, dword [rsp + 0x40]
mov edx, dword [rsp + 0xac]
mov r10d, dword [rsp + 0xa4]
sub ecx, r8d
cmp ecx, edx
cmova ecx, edx
xor eax, eax
mov dword [rsp + 0x88], ecx
cmp dword [rsp + 0x88], eax
lea r15d, [r8 + rax]
jne 0x14018e7ba
cmp dword [rsp + 0x40], r15d
je 0x14018e7d4
cmp eax, edx
jb 0x14018e7e1
cmp esi, r13d
jae 0x14018e828
mov rdx, qword [rsp + 0x78]
mov ecx, esi
add rcx, rdi
call sym.sqlite3Fts5GetVarint32
mov r8d, dword [rsp + 0xa8]
add r8d, dword [rsp + 0xb0]
add esi, eax
cmp r8d, r13d
mov dword [rsp + 0xb0], r8d
jb 0x14018e6b2
mov dword [rbp + 0x34], 0x10b
jmp 0x14018e985
mov rcx, qword [rsp + 0x38]
lea r9d, [r10 + rax]
mov r11d, r15d
mov cl, byte [rcx + r11]
cmp byte [rdi + r9], cl
jne 0x14018e768
inc eax
jmp 0x14018e75b
cmp edx, eax
jne 0x14018ecab
jmp 0x14018e8bc
mov rcx, qword [rsp + 0x38]
add eax, r10d
mov edx, r15d
mov eax, eax
mov al, byte [rdi + rax]
cmp byte [rcx + rdx], al
jae 0x14018e773
jmp 0x14018ecab
mov rdx, qword [rsp + 0x78]
mov dword [rsp + 0x88], r8d
call sym.sqlite3Fts5GetVarint32
mov r8d, dword [rsp + 0x88]
add eax, r8d
mov dword [rsp + 0xa4], eax
jmp 0x14018e6d5
cmp dword [rsp + 0x58], 0
je 0x14018ecb6
mov rdx, rbx
mov rcx, rbp
call sym.fts5SegIterNextPage
mov rax, qword [rbx + 0x10]
test rax, rax
je 0x14018e985
mov esi, dword [rax + 0xc]
mov r13d, dword [rax + 8]
mov rdi, qword [rax]
cmp esi, r13d
jge 0x14018e833
lea rdx, [rsp + 0xa4]
mov ecx, esi
add rcx, rdi
call sym.sqlite3Fts5GetVarint32
mov r14d, dword [rsp + 0xa4]
cmp r14d, 3
jbe 0x14018e7ae
mov ecx, r14d
movsxd rdx, esi
cmp rcx, rdx
jge 0x14018e7ae
xor r8d, r8d
add rcx, rdi
add esi, eax
mov dword [rsp + 0xb0], r14d
lea rdx, [rsp + 0xac]
mov dword [rsp + 0xa8], r8d
call sym.sqlite3Fts5GetVarint32
add eax, r14d
mov dword [rsp + 0xa4], eax
mov ecx, dword [rsp + 0xac]
mov r8d, r13d
mov r14d, dword [rsp + 0xa4]
mov r15, rcx
add rcx, r14
cmp rcx, r8
jg 0x14018e7ae
test r15d, r15d
je 0x14018e7ae
mov edx, dword [rbx + 0xc]
lea eax, [r14 + r15]
mov r9, qword [rsp + 0x38]
lea rcx, [rbp + 0x34]
mov qword [rbx + 0x20], rax
mov r8d, dword [rsp + 0xa8]
mov dword [rbx + 0x34], eax
mov qword [rsp + 0x78], rcx
mov dword [rbx + 0x30], edx
lea rdx, [rbx + 0x58]
mov qword [rsp + 0x88], rdx
call sym.sqlite3Fts5BufferSet
mov rdx, qword [rsp + 0x88]
lea r9, [rdi + r14]
mov r8d, r15d
mov rcx, qword [rsp + 0x78]
call sym.sqlite3Fts5BufferAppendBlob
cmp esi, r13d
jb 0x14018e947
mov rax, qword [rbx + 0x10]
mov eax, dword [rax + 8]
inc eax
jmp 0x14018e969
lea rdx, [rsp + 0xb8]
mov ecx, esi
add rcx, rdi
call sym.sqlite3Fts5GetVarint32
add esi, eax
mov eax, dword [rsp + 0xb8]
add eax, dword [rsp + 0xb0]
mov rdx, rbx
mov rcx, rbp
mov dword [rbx + 0x3c], eax
mov dword [rbx + 0x38], esi
call sym.fts5SegIterLoadRowid
mov rdx, rbx
mov rcx, rbp
call sym.fts5SegIterLoadNPos
mov edi, dword [rsp + 0x58]
or edi, dword [rbp + 0x34]
jne 0x14018eb47
mov eax, dword [rbx + 8]
mov rcx, qword [rbx + 0x10]
mov edx, eax
or edx, 1
test rcx, rcx
mov dword [rbx + 8], edx
je 0x14018eb47
cmp dword [rsp + 0x5c], 0
je 0x14018e9eb
or eax, 3
cmp dword [rsp + 0x54], 0
mov dword [rbx + 8], eax
jne 0x14018e9f6
mov r15, qword [rbx + 0x50]
test r15, r15
je 0x14018ea2d
mov rax, qword [rbx]
mov rcx, rbp
mov edi, dword [r15 + 0x1c]
movsxd rdx, dword [rax]
movsxd rax, edi
shl rdx, 0x25
add rdx, rax
call sym.fts5LeafRead
mov r15, rax
jmp 0x14018eada
cmp dword [rsp + 0x54], 0
je 0x14018eb47
mov edx, dword [rbx + 8]
mov rax, qword [rbx]
mov r9d, dword [rbx + 0x30]
and edx, 2
cmp r9d, dword [rbx + 0xc]
mov r8d, dword [rax]
jne 0x14018ea14
mov eax, dword [rcx + 0xc]
cmp dword [rbx + 0x3c], eax
jl 0x14018ea20
mov rcx, rbp
call sym.fts5DlidxIterInit
mov qword [rbx + 0x50], rax
cmp dword [rsp + 0x5c], 0
je 0x14018eb47
jmp 0x14018e9be
mov esi, dword [rbx + 0xc]
mov eax, 4
cmp dword [rbx + 0x30], esi
mov r9, qword [rbx + 0x10]
jne 0x14018ea41
mov eax, dword [rbx + 0x34]
mov r13, qword [r9]
lea r11d, [rax + 9]
inc eax
cdqe
mov cl, byte [r13 + rax - 1]
mov rdx, rax
shr cl, 7
cmp r11d, eax
setg r10b
inc rax
test cl, r10b
jne 0x14018ea4c
mov eax, dword [r9 + 0xc]
movsxd rdx, edx
cmp dword [rbx + 0x3c], eax
mov qword [rbx + 0x20], rdx
jl 0x14018eb3c
mov r14, qword [rbx]
inc esi
movsxd r13, esi
cmp dword [rbp + 0x34], 0
jne 0x14018eada
cmp esi, dword [r14 + 8]
jg 0x14018eada
movsxd rdx, dword [r14]
mov rcx, rbp
shl rdx, 0x25
add rdx, r13
call sym.fts5LeafRead
test rax, rax
mov rcx, rax
je 0x14018ead3
mov rdx, qword [rcx]
mov eax, dword [rax + 0xc]
cmp word [rdx], 0
mov dword [rsp + 0x54], eax
mov eax, dword [rcx + 8]
je 0x14018eac0
mov edi, esi
xchg r15, rcx
mov dword [rsp + 0x78], eax
call sym.sqlite3_free
mov eax, dword [rsp + 0x78]
cmp dword [rsp + 0x54], eax
jl 0x14018eada
inc esi
inc r13
jmp 0x14018ea82
test r15, r15
je 0x14018eb3c
mov rcx, qword [rbx + 0x10]
call sym.sqlite3_free
mov rcx, qword [r15]
mov dword [rbx + 0xc], edi
mov qword [rbx + 0x10], r15
mov esi, dword [r15 + 0xc]
mov ax, word [rcx]
xchg al, ah
movzx edi, ax
cmp edi, esi
jle 0x14018eb0b
mov dword [rbp + 0x34], 0x10b
jmp 0x14018eb47
lea rdx, [rbx + 0x68]
movzx eax, ax
add rcx, rax
call sym.sqlite3Fts5GetVarint
movzx eax, al
add eax, edi
cdqe
mov qword [rbx + 0x20], rax
mov eax, dword [r15 + 8]
cmp esi, eax
jl 0x14018eb31
inc eax
jmp 0x14018eb39
mov rcx, r15
call sym.fts5LeafFirstTermOff
mov dword [rbx + 0x3c], eax
mov rdx, rbx
mov rcx, rbp
call sym.fts5SegIterReverseInitPage
mov rdx, rbx
mov rcx, rbp
call sym.fts5SegIterSetNext
dec dword [rsp + 0x64]
add rbx, 0x78
sub qword [rsp + 0x68], 0xc
jmp 0x14018e511
xor eax, eax
cmp dword [rsp + 0x60], 0
cmovns eax, dword [rsp + 0x60]
add qword [rsp + 0x48], 0x10
add dword [rsp + 0x44], eax
jmp 0x14018e4b5
lea r14, [r12 + 0x60]
dec ebx
inc rsi
movsxd rdi, ebx
shl rsi, 4
imul rdi, rdi, 0xc
test ebx, ebx
jns 0x14018ebad
cmp dword [rbp + 0x34], 0
jne 0x14018ec97
mov eax, dword [r12 + 0x40]
lea ebx, [rax - 1]
jmp 0x14018ebe4
mov rdx, qword [r13 + rsi + 0x10]
add rdx, rdi
cmp dword [rdx + 4], 0
je 0x14018ebc6
mov r8, r14
mov rcx, rbp
call sym.fts5SegIterInit.part.0
dec ebx
sub rdi, 0xc
add r14, 0x78
jmp 0x14018eb95
mov edx, ebx
mov rcx, r12
call sym.fts5MultiIterDoCompare
test eax, eax
mov esi, eax
jne 0x14018ebea
dec ebx
test ebx, ebx
jg 0x14018ebd2
jmp 0x14018ec1c
cmp dword [rbp + 0x34], 0
jne 0x14018ec09
cdqe
xor r8d, r8d
mov rcx, rbp
imul rax, rax, 0x78
lea rdx, [r12 + rax + 0x60]
call qword [r12 + rax + 0x88]
mov r9d, ebx
mov r8d, esi
mov rdx, r12
mov rcx, rbp
call sym.fts5MultiIterAdvanced
jmp 0x14018ebe2
mov rcx, r12
call sym.fts5MultiIterSetEof
cmp byte [r12 + 0x48], 0
je 0x14018ec5f
mov ecx, dword [rbp + 0x34]
mov rdx, r12
call sym.fts5MultiIterIsEmpty.isra.0
test eax, eax
je 0x14018ec5f
xor r9d, r9d
xor r8d, r8d
mov rdx, r12
mov rcx, rbp
add rsp, 0xc8
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.fts5MultiIterNext
cmp byte [r12 + 0x14], 0
jne 0x14018ecca
mov rax, qword [r12 + 0x58]
mov rcx, r12
movzx eax, word [rax + 4]
imul rax, rax, 0x78
lea rdx, [r12 + rax + 0x60]
mov rax, qword [r12 + 0x38]
add rsp, 0xc8
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp rax
mov rcx, r12
call sym.fts5MultiIterFree
mov rax, qword [rsp + 0x70]
xor edx, edx
mov qword [rax], rdx
jmp 0x14018ecca
cmp dword [rsp + 0x58], 0
jne 0x14018e8bc
mov rcx, r14
call sym.sqlite3_free
xor r9d, r9d
mov qword [rbx + 0x10], r9
jmp 0x14018e985
add rsp, 0xc8
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret