Function at 0x10021800
Capabilities:
Reference sql statements

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
push ebx
push esi
xor eax, eax
push edi
mov edi, edx
mov dword [ebp - 4], eax
mov eax, dword [edi + 4]
mov esi, dword [edi + 8]
mov ebx, ecx
lea edx, [eax - 1]
mov ecx, dword [ebx]
mov dword [ebp - 0x20], edi
mov dword [ebp - 0x28], edx
test eax, eax
je 0x10021b9b
push dword [edi]
push dword [ecx + 8]
push dword [ecx + 4]
push str.SELECT_segid__term___pgno__1____pgno1__FROM__Q._q_idx_WHERE_segid_d
call sym.SQLite.Interop.dll_sqlite3_mprintf
add esp, 0x10
cmp dword [ebx + 0x24], 0
mov edi, eax
jne 0x10021875
test edi, edi
je 0x1002186e
mov ecx, dword [ebx]
push 0
mov ecx, dword [ecx]
lea eax, [ebp - 4]
push eax
push 0
push 0x81
push 0xffffffffffffffff
mov edx, edi
call fcn.1008e180
add esp, 0x14
mov dword [ebx + 0x24], eax
jmp 0x10021875
mov dword [ebx + 0x24], 7
push edi
call sym.SQLite.Interop.dll_sqlite3_free
add esp, 4
cmp dword [ebx + 0x24], 0
jne 0x10021b86
mov dword [ebp - 0x24], 0x100
nop
mov edi, dword [ebp - 4]
push edi
call sym.SQLite.Interop.dll_sqlite3_step
add esp, 4
cmp eax, 0x64
jne 0x10021b89
push 1
push edi
call sym.SQLite.Interop.dll_sqlite3_column_bytes
push 1
push edi
mov dword [ebp - 0x18], eax
call sym.SQLite.Interop.dll_sqlite3_column_text
push 2
push edi
mov dword [ebp - 8], eax
call sym.SQLite.Interop.dll_sqlite3_column_int
mov edi, eax
mov eax, dword [ebp - 4]
push 3
push eax
mov dword [ebp - 0xc], edi
call sym.SQLite.Interop.dll_sqlite3_column_int
mov dword [ebp - 0x30], eax
mov eax, dword [ebp - 0x20]
add esp, 0x20
cmp edi, dword [eax + 4]
jl 0x10021b6a
mov eax, dword [eax]
cdq
mov ecx, eax
mov eax, dword [ebp - 0xc]
cdq
shl ecx, 5
xor edi, edi
add edi, eax
adc ecx, edx
push ecx
push edi
mov ecx, ebx
call fcn.1002a7d0
add esp, 8
mov dword [ebp - 0x1c], eax
test eax, eax
je 0x10021b86
mov ecx, dword [eax + 8]
mov edx, dword [eax + 4]
cmp ecx, edx
jg 0x10021b76
cmp edx, ecx
jg 0x1002192c
mov dword [ebx + 0x24], 0x10b
jmp 0x100219f0
mov edi, dword [eax]
add ecx, edi
lea edx, [ebp - 0x10]
mov dword [ebp - 0x2c], edi
call fcn.10018490
movzx ecx, byte [edi]
mov eax, 0x100
imul cx, ax
movzx eax, byte [edi + 1]
add cx, ax
movzx eax, cx
mov ecx, dword [ebp - 0x10]
cmp eax, ecx
jge 0x100219dc
add ecx, edi
lea edx, [ebp - 0x14]
call fcn.10018490
mov ecx, dword [ebp - 0x18]
add eax, dword [ebp - 0x10]
cmp dword [ebp - 0x14], ecx
mov edx, dword [ebp - 8]
mov edi, ecx
cmovl edi, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x2c]
add ecx, eax
sub edi, 4
jb 0x10021993
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x10021998
add ecx, 4
add edx, 4
sub edi, 4
jae 0x10021982
cmp edi, 0xfffffffc
je 0x100219cc
mov al, byte [ecx]
cmp al, byte [edx]
jne 0x100219c5
cmp edi, 0xfffffffd
je 0x100219cc
mov al, byte [ecx + 1]
cmp al, byte [edx + 1]
jne 0x100219c5
cmp edi, 0xfffffffe
je 0x100219cc
mov al, byte [ecx + 2]
cmp al, byte [edx + 2]
jne 0x100219c5
cmp edi, 0xffffffff
je 0x100219cc
mov al, byte [ecx + 3]
cmp al, byte [edx + 3]
je 0x100219cc
sbb eax, eax
or eax, 1
jmp 0x100219ce
xor eax, eax
test eax, eax
jne 0x100219da
mov eax, dword [ebp - 0x14]
sub eax, dword [ebp - 0x18]
test eax, eax
jns 0x100219e3
mov dword [ebx + 0x24], 0x10b
mov edx, dword [ebp - 0x1c]
mov ecx, ebx
call fcn.10021bb0
mov eax, dword [ebp - 0x1c]
push eax
call sym.SQLite.Interop.dll_sqlite3_free
add esp, 4
cmp dword [ebx + 0x24], 0
jne 0x10021b86
mov edi, dword [ebp - 0xc]
inc esi
lea eax, [edi - 1]
push eax
mov eax, dword [ebp - 0x28]
push esi
mov esi, dword [ebp - 0x20]
inc eax
push eax
mov edx, esi
mov ecx, ebx
call fcn.10021e60
add esp, 0xc
cmp dword [ebx + 0x24], 0
jne 0x10021b86
cmp dword [ebp - 0x30], 0
je 0x10021b64
mov eax, dword [esi]
push edi
push eax
xor edx, edx
mov ecx, ebx
mov dword [ebp - 0x1c], edi
mov dword [ebp - 0x30], eax
xor esi, esi
call fcn.10029280
mov edi, eax
add esp, 8
mov edx, edi
mov ecx, ebx
call fcn.10029740
test eax, eax
jne 0x10021b58
mov eax, dword [ebp - 0x30]
cdq
mov ecx, eax
shl ecx, 5
mov dword [ebp - 8], ecx
jmp 0x10021a70
mov esi, dword [ebp - 0x1c]
inc esi
cmp esi, dword [edi + 0x18]
jge 0x10021ac4
lea esp, [esp]
mov eax, esi
cdq
add eax, 0
adc edx, ecx
push edx
push eax
mov ecx, ebx
call fcn.1002a7d0
add esp, 8
test eax, eax
je 0x10021abb
mov ecx, dword [eax]
movzx edx, byte [ecx]
imul dx, word [ebp - 0x24]
movzx ecx, byte [ecx + 1]
add dx, cx
je 0x10021ab2
mov dword [ebx + 0x24], 0x10b
push eax
call sym.SQLite.Interop.dll_sqlite3_free
add esp, 4
mov ecx, dword [ebp - 8]
inc esi
cmp esi, dword [edi + 0x18]
jl 0x10021a80
mov eax, dword [edi + 0x18]
mov dword [ebp - 0x1c], eax
cdq
add eax, 0
adc edx, ecx
push edx
push eax
mov ecx, ebx
call fcn.1002a7d0
add esp, 8
mov dword [ebp - 0x18], eax
test eax, eax
je 0x10021b36
mov ecx, dword [eax]
mov dword [ebp - 0x30], ecx
movzx edx, byte [ecx]
imul dx, word [ebp - 0x24]
movzx ecx, byte [ecx + 1]
add dx, cx
movzx ecx, dx
cmp ecx, dword [eax + 8]
jl 0x10021b08
mov dword [ebx + 0x24], 0x10b
jmp 0x10021b2d
add ecx, dword [ebp - 0x30]
lea edx, [ebp - 0x38]
call fcn.10018310
mov eax, dword [ebp - 0x38]
cmp eax, dword [edi + 0x20]
jne 0x10021b23
mov eax, dword [ebp - 0x34]
cmp eax, dword [edi + 0x24]
je 0x10021b2a
mov dword [ebx + 0x24], 0x10b
mov eax, dword [ebp - 0x18]
push eax
call sym.SQLite.Interop.dll_sqlite3_free
add esp, 4
push 0
mov edx, edi
mov ecx, ebx
call fcn.10029840
add esp, 4
mov edx, edi
mov ecx, ebx
call fcn.10029740
mov ecx, dword [ebp - 8]
test eax, eax
je 0x10021a70
mov ecx, edi
call fcn.100293d0
mov edi, dword [ebp - 0xc]
jmp 0x10021b67
mov esi, dword [esi + 8]
mov dword [ebp - 0x28], edi
cmp dword [ebx + 0x24], 0
je 0x10021890
jmp 0x10021b86
push eax
mov dword [ebx + 0x24], 0x10b
call sym.SQLite.Interop.dll_sqlite3_free
add esp, 4
mov edi, dword [ebp - 4]
push edi
call sym.SQLite.Interop.dll_sqlite3_finalize
add esp, 4
cmp dword [ebx + 0x24], 0
jne 0x10021b9b
mov dword [ebx + 0x24], eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret