Function at 0x180111d70
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.18012e4c0
mov rax, qword [rsp + 0x90]
mov qword [rbx], rax
cmp qword [rsi + 0x68], r15
jne 0x180111e02
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.18010e340
mov rax, qword [rsp + 0x90]
mov rdi, qword [rsi + 0x68]
cmp dword [rsi + 0x3c], r15d
jne 0x180111fea
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 0x180111e91
mov rax, qword [rsp + 0x78]
test rax, rax
je 0x180111e7f
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 0x180111e77
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 0x180111e91
call qword [0x1801729b0]
mov rcx, rdi
call sym.sqlite.dll_sqlite3_step
cmp eax, 0x64
jne 0x180111eb5
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 0x180111ee3
mov rax, qword [rdi]
mov rcx, qword [rax + 0x18]
test rcx, rcx
je 0x180111ee3
call qword [0x1801729b0]
mov rax, qword [rsp + 0x90]
mov eax, dword [rax + 4]
cmp ebp, eax
jge 0x180111ef7
mov ebp, eax
xor r15d, r15d
lea eax, [rbp - 1]
mov rdx, rbx
mov rcx, rsi
mov dword [rbx + 0xc], eax
call fcn.1801105e0
cmp qword [rbx + 0x10], 0
je 0x180111f2d
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.1801117e0
cmp dword [rsi + 0x3c], 0
jne 0x180111f93
test r12d, r12d
jne 0x180111f93
or dword [rbx + 8], 1
mov rcx, qword [rbx + 0x10]
mov eax, dword [rbx + 8]
test rcx, rcx
je 0x180111f93
and r14d, 2
je 0x180111f54
or eax, 2
mov dword [rbx + 8], eax
test r15d, r15d
je 0x180111f83
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 0x180111f77
mov eax, dword [rcx + 0xc]
cmp dword [rbx + 0x4c], eax
jl 0x180111f83
mov rcx, rsi
call fcn.180110480
mov qword [rbx + 0x60], rax
test r14d, r14d
je 0x180111f93
mov rdx, rbx
mov rcx, rsi
call fcn.180111550
test byte [rbx + 8], 2
je 0x180111fa6
lea rax, [0x180110ec0]
mov qword [rbx + 0x38], rax
jmp 0x180111fc3
mov rax, qword [rsi]
lea rdx, [0x180111180]
lea rcx, [0x180110f80]
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 0x180111fea
mov rdx, rdi
lea rcx, [rsi + 0x3c]
shl rdx, 4
call fcn.180106440
test rax, rax
je 0x180111fea
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