Function at 0x180111740
Capabilities:
Reference sql statements

Disassembly:
mov qword [rsp + 8], rbx
mov dword [rsp + 0x18], r8d
mov qword [rsp + 0x10], rdx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x30
mov rbx, qword [rsp + 0x98]
mov r12d, r9d
mov rsi, rcx
and r12d, 8
xor edx, edx
mov r8d, 0x88
mov rcx, rbx
mov r14d, r9d
mov ebp, 1
mov dword [rsp + 0x88], r12d
xor r15d, r15d
call fcn.18012e4b0
mov rax, qword [rsp + 0x90]
mov qword [rbx], rax
cmp qword [rsi + 0x68], r15
jne 0x1801117d2
mov rdx, qword [rsi]
lea rcx, str.SELECT_pgno_FROM__q._q_idx_WHERE_segid__AND_term___ORDER_BY_term_DESC_LIMIT_1
mov r8, qword [rdx + 0x10]
mov rdx, qword [rdx + 8]
call sym.sqlite.dll_sqlite3_mprintf
lea rdx, [rsi + 0x68]
mov rcx, rsi
mov r8, rax
call fcn.18010dd10
mov rax, qword [rsp + 0x90]
mov rdi, qword [rsi + 0x68]
cmp dword [rsi + 0x3c], r15d
jne 0x1801119ba
movsxd r8, dword [rax]
mov edx, ebp
mov rcx, rdi
call sym.sqlite.dll_sqlite3_bind_int64
mov edx, ebp
mov rcx, rdi
call fcn.18003db50
test eax, eax
jne 0x180111861
mov rax, qword [rsp + 0x78]
test rax, rax
je 0x18011184f
mov rcx, qword [rdi + 0x80]
movsxd r8, dword [rsp + 0x80]
xor r9d, r9d
mov rdx, rax
add rcx, 0x38
mov qword [rsp + 0x20], r15
call fcn.180034380
mov r12d, eax
test eax, eax
je 0x180111847
mov rcx, qword [rdi]
mov edx, eax
mov dword [rcx + 0x50], eax
call fcn.18000fb80
mov rcx, qword [rdi]
mov edx, r12d
call fcn.18000c9c0
mov r12d, dword [rsp + 0x88]
mov rax, qword [rdi]
mov rcx, qword [rax + 0x18]
test rcx, rcx
je 0x180111861
call qword [0x1801729b0]
mov rcx, rdi
call sym.sqlite.dll_sqlite3_step
cmp eax, 0x64
jne 0x180111885
xor edx, edx
mov rcx, rdi
call sym.sqlite.dll_sqlite3_column_int
movsxd r15, eax
mov rbp, r15
sar rbp, 1
and r15d, 1
mov rcx, rdi
call sym.sqlite.dll_sqlite3_reset
mov edx, 1
mov rcx, rdi
mov dword [rsi + 0x3c], eax
call fcn.18003db50
test eax, eax
jne 0x1801118b3
mov rax, qword [rdi]
mov rcx, qword [rax + 0x18]
test rcx, rcx
je 0x1801118b3
call qword [0x1801729b0]
mov rax, qword [rsp + 0x90]
mov eax, dword [rax + 4]
cmp ebp, eax
jge 0x1801118c7
mov ebp, eax
xor r15d, r15d
lea eax, [rbp - 1]
mov rdx, rbx
mov rcx, rsi
mov dword [rbx + 0xc], eax
call fcn.18010ffb0
cmp qword [rbx + 0x10], 0
je 0x1801118fd
mov eax, dword [rsp + 0x80]
mov r9, qword [rsp + 0x78]
mov r8, rbx
mov edx, r12d
mov rcx, rsi
mov dword [rsp + 0x20], eax
call fcn.1801111b0
cmp dword [rsi + 0x3c], 0
jne 0x180111963
test r12d, r12d
jne 0x180111963
or dword [rbx + 8], 1
mov rcx, qword [rbx + 0x10]
mov eax, dword [rbx + 8]
test rcx, rcx
je 0x180111963
and r14d, 2
je 0x180111924
or eax, 2
mov dword [rbx + 8], eax
test r15d, r15d
je 0x180111953
mov edx, dword [rbx + 8]
mov rax, qword [rbx]
mov r9d, dword [rbx + 0x40]
mov r8d, dword [rax]
and edx, 2
cmp r9d, dword [rbx + 0xc]
jne 0x180111947
mov eax, dword [rcx + 0xc]
cmp dword [rbx + 0x4c], eax
jl 0x180111953
mov rcx, rsi
call fcn.18010fe50
mov qword [rbx + 0x60], rax
test r14d, r14d
je 0x180111963
mov rdx, rbx
mov rcx, rsi
call fcn.180110f20
test byte [rbx + 8], 2
je 0x180111976
lea rax, [0x180110890]
mov qword [rbx + 0x38], rax
jmp 0x180111993
mov rax, qword [rsi]
lea rdx, [0x180110b50]
lea rcx, [0x180110950]
cmp dword [rax + 0x5c], 1
cmove rdx, rcx
mov qword [rbx + 0x38], rdx
mov rax, qword [rbx]
movsxd rdi, dword [rax + 0x20]
test edi, edi
jle 0x1801119ba
mov rdx, rdi
lea rcx, [rsi + 0x3c]
shl rdx, 4
call fcn.180105e10
test rax, rax
je 0x1801119ba
mov qword [rbx + 0x28], rax
mov dword [rbx + 0x30], edi
mov rbx, qword [rsp + 0x70]
add rsp, 0x30
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret