Function at 0x10027e10
Capabilities:
Reference sql statements

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x14
mov eax, dword [ebp + 0xc]
push ebx
push esi
mov esi, dword [ebp + 0x14]
push edi
push 0x58
and eax, 8
push 0
push esi
mov dword [esp + 0x20], edx
mov edi, ecx
mov dword [esp + 0x1c], 1
mov dword [esp + 0x24], eax
mov dword [esp + 0x18], 0
call fcn.10003750
mov eax, dword [ebp + 0x10]
add esp, 0xc
mov dword [esi], eax
cmp dword [edi + 0x3c], 0
jne 0x10027e7d
mov eax, dword [edi]
push dword [eax + 8]
push dword [eax + 4]
push str.SELECT_pgno_FROM__q._q_idx_WHERE_segid__AND_term___ORDER_BY_term_DESC_LIMIT_1
call sym.SQLite.Interop.dll_sqlite3_mprintf
add esp, 0xc
lea edx, [edi + 0x3c]
push eax
mov ecx, edi
call fcn.1002a720
mov eax, dword [ebp + 0x10]
add esp, 4
cmp dword [edi + 0x24], 0
mov ebx, dword [edi + 0x3c]
jne 0x1002800f
mov eax, dword [eax]
cdq
push edx
push eax
push 1
push ebx
call sym.SQLite.Interop.dll_sqlite3_bind_int64
add esp, 0x10
cmp dword [ebp + 8], 0
jge 0x10027ec0
push 0x1010288c
push 0x131b7
push str.misuse
push str._s_at_line__d_of___.10s_
push 0x15
call sym.SQLite.Interop.dll_sqlite3_log
add esp, 0x14
jmp 0x10027f2d
mov edx, 2
mov ecx, ebx
call fcn.100c2070
test eax, eax
jne 0x10027f2d
mov eax, dword [esp + 0x14]
test eax, eax
je 0x10027f1a
mov ecx, dword [ebx + 0x74]
push 0
push 0
push dword [ebp + 8]
add ecx, 0x28
mov edx, eax
call fcn.100ca6d0
add esp, 0xc
mov dword [esp + 0x1c], eax
test eax, eax
je 0x10027f1a
mov ecx, dword [ebx]
mov edx, eax
mov dword [ecx + 0x38], eax
call fcn.100e9bf0
mov ecx, dword [ebx]
cmp byte [ecx + 0x49], 0
jne 0x10027f15
cmp dword [esp + 0x1c], 0xc0a
jne 0x10027f1a
call fcn.100ec420
mov eax, dword [ebx]
mov eax, dword [eax + 0xc]
test eax, eax
je 0x10027f2d
push eax
call dword [0x10127324]
add esp, 4
push ebx
call sym.SQLite.Interop.dll_sqlite3_step
add esp, 4
cmp eax, 0x64
jne 0x10027f5a
push 0
push ebx
call sym.SQLite.Interop.dll_sqlite3_column_int
cdq
mov ecx, eax
shrd eax, edx, 1
add esp, 8
sar edx, 1
and ecx, 1
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], ecx
push ebx
call sym.SQLite.Interop.dll_sqlite3_reset
mov ecx, dword [ebp + 0x10]
mov dword [edi + 0x24], eax
mov ecx, dword [ecx + 4]
mov eax, dword [esp + 0x14]
add esp, 4
cmp eax, ecx
jge 0x10027f7e
mov eax, ecx
mov dword [esp + 0xc], 0
dec eax
mov edx, esi
mov ecx, edi
mov dword [esi + 8], eax
call fcn.100291a0
cmp dword [esi + 0xc], 0
mov ebx, dword [esp + 0x18]
je 0x10027fa9
push dword [ebp + 8]
mov edx, ebx
push dword [esp + 0x18]
mov ecx, edi
push esi
call fcn.10028060
add esp, 0xc
cmp dword [edi + 0x24], 0
jne 0x10027fe5
test ebx, ebx
jne 0x10027fe5
or dword [esi + 4], 1
cmp dword [esi + 0xc], ebx
je 0x10027fe5
mov ebx, dword [ebp + 0xc]
and ebx, 2
je 0x10027fc8
or dword [esi + 4], 2
cmp dword [esp + 0xc], 0
je 0x10027fd8
mov edx, esi
mov ecx, edi
call fcn.10028480
test ebx, ebx
je 0x10027fe5
mov edx, esi
mov ecx, edi
call fcn.100284d0
test byte [esi + 4], 2
je 0x10027ff9
mov dword [esi + 0x18], 0x10028af0
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [edi]
mov ecx, 0x10028680
cmp dword [eax + 0x30], 1
mov edx, 0x10028940
cmove ecx, edx
mov dword [esi + 0x18], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret