Function at 0x521570
Capabilities:
Reference sql statements

Disassembly:
sub esp, 0x2c
cmp byte [esi + 0x47], 0
mov dword [esp + 0xc], 0
jne 0x52159e
mov eax, dword [esp + 0x30]
push str.cannot_VACUUM_from_within_a_transaction
push eax
mov eax, esi
call fcn.004c38c0
add esp, 8
mov eax, 1
add esp, 0x2c
ret
cmp dword [esi + 0xa4], 1
jle 0x5215c4
mov ecx, dword [esp + 0x30]
push str.cannot_VACUUM___SQL_statements_in_progress
push ecx
mov eax, esi
call fcn.004c38c0
add esp, 8
mov eax, 1
add esp, 0x2c
ret
movzx edx, word [esi + 0x18]
mov ecx, dword [esi + 0x1c]
or dword [esi + 0x18], 6
mov dword [esp + 0x20], ecx
mov dword [esp + 0x1c], edx
mov edx, dword [esi + 0x5c]
and ecx, 0xffffaf7f
mov dword [esp + 0x24], edx
mov edx, dword [esi + 0x60]
or ecx, 0x201
mov dword [esi + 0x1c], ecx
mov ecx, dword [esi + 0x10]
shl eax, 4
push ebx
mov ebx, dword [esi + 0x14]
mov dword [esp + 0x2c], edx
mov dl, byte [esi + 0x50]
mov byte [esi + 0x50], 0
mov dword [esp + 0x14], eax
add eax, ecx
push ebp
mov ebp, dword [eax + 4]
mov byte [esp + 0xb], dl
mov edx, dword [eax]
mov eax, dword [ebp + 4]
mov ecx, dword [eax]
mov eax, dword [esp + 0x38]
push edi
mov dword [esp + 0x10], edx
movzx edx, byte [ecx + 0xc]
push str.ATTACHAS_vacuum_db
push eax
push esi
mov dword [esp + 0x2c], edx
mov dword [esp + 0x30], ebx
call fcn.005213f0
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x52188a
mov eax, ebx
shl eax, 4
add eax, dword [esi + 0x10]
mov ebx, dword [eax + 4]
mov dword [esp + 0x18], eax
mov eax, ebx
call fcn.0050adc0
mov eax, ebp
call fcn.004bf700
mov ecx, dword [esi + 0x10]
mov edx, dword [esp + 0x1c]
mov dword [esp + 0x14], eax
mov eax, dword [edx + ecx + 0xc]
mov ecx, dword [eax + 0x50]
push ecx
mov eax, ebx
call fcn.004bf610
push edi
mov eax, ebp
call fcn.004bf660
push eax
mov eax, ebx
call fcn.004bf660
push 0x21
mov eax, ebx
call fcn.004bf6b0
mov edx, dword [esp + 0x4c]
push str.BEGIN
push edx
push esi
call fcn.005213f0
mov edi, eax
add esp, 0x1c
test edi, edi
jne 0x52188a
push eax
push 2
push ebp
call fcn.00505170
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x52188a
mov eax, dword [ebp + 4]
mov ecx, dword [eax]
cmp byte [ecx + 5], 5
jne 0x5216d9
mov dword [esi + 0x54], edi
mov edx, dword [ebp + 4]
mov eax, dword [edx + 0x20]
mov edi, dword [esp + 0x14]
push 0
push edi
push eax
mov eax, ebx
call fcn.004ffbf0
add esp, 0xc
test eax, eax
jne 0x521885
cmp dword [esp + 0x20], eax
jne 0x521717
push eax
mov eax, dword [esi + 0x54]
push edi
push eax
mov eax, ebx
call fcn.004ffbf0
add esp, 0xc
test eax, eax
jne 0x521885
cmp byte [esi + 0x49], 0
jne 0x521885
mov al, byte [esi + 0x4c]
test al, al
jl 0x52172d
movsx eax, al
jmp 0x521734
mov eax, ebp
call fcn.004bf880
push eax
mov eax, ebx
call fcn.004bf800
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x40]
mov cl, byte [esp + 0x28]
push edx
push str.SELECT_sql_FROM___w_.sqlite_master_WHERE_typetableAND_name__sqlite_sequence_AND_coalesce_rootpage_1__0
push eax
mov eax, esi
mov byte [esi + 0x9c], cl
call fcn.005214e0
mov edi, eax
add esp, 0x10
test edi, edi
jne 0x52188a
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x3c]
push ecx
push str.SELECT_sql_FROM___w_.sqlite_master_WHERE_typeindex
push edx
mov eax, esi
call fcn.005214e0
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x52188a
mov ecx, dword [esp + 0x3c]
mov byte [esi + 0x9c], al
mov eax, dword [esp + 0x10]
push eax
push str.SELECTINSERT_INTO_vacuum_db.quote_name__SELECTFROM__w_.quote_name_FROM_vacuum_db.sqlite_master_WHERE_typetableAND_coalesce_rootpage_1__0
push ecx
mov eax, esi
call fcn.005214e0
and dword [esi + 0x18], 0xfffffffb
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x52188a
mov edx, dword [esp + 0x10]
mov eax, dword [esp + 0x3c]
push edx
push str.INSERT_INTO_vacuum_db.sqlite_master_SELECTFROM___w_.sqlite_master_WHERE_type_IN_view_trigger__OR_typetableAND_rootpage0_
push eax
mov eax, esi
call fcn.005214e0
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x52188a
mov dword [esp + 0x10], edi
jmp 0x5217f4
mov edi, dword [esp + 0x10]
movzx edx, byte [edi + 0x5ec8dc]
lea ecx, [esp + 0x24]
push ecx
push edx
mov eax, ebp
call fcn.004bf9f0
movzx eax, byte [edi + 0x5ec8dd]
add eax, dword [esp + 0x2c]
movzx ecx, byte [edi + 0x5ec8dc]
push eax
push ecx
mov eax, ebx
call fcn.004c4fa0
mov edi, eax
add esp, 0x10
test edi, edi
jne 0x52188a
mov eax, dword [esp + 0x10]
add eax, 2
cmp eax, 0xa
mov dword [esp + 0x10], eax
jl 0x5217f0
push ebp
mov eax, ebx
call fcn.00511ef0
mov edi, eax
add esp, 4
test edi, edi
jne 0x52188a
mov eax, ebx
call fcn.0050adc0
mov edi, eax
test edi, edi
jne 0x52188a
mov eax, ebx
call fcn.004bf880
push eax
mov eax, ebp
call fcn.004bf800
mov edx, dword [ebx + 4]
mov ecx, dword [esp + 0x18]
mov eax, dword [edx + 0x20]
push 1
push ecx
push eax
mov eax, ebp
call fcn.004ffbf0
add esp, 0x10
mov edi, eax
jmp 0x52188a
mov edi, 7
mov eax, dword [esp + 0x2c]
movzx edx, word [esp + 0x28]
mov ecx, dword [esp + 0x30]
mov dword [esi + 0x1c], eax
mov al, byte [esp + 0xf]
push 1
mov dword [esi + 0x18], edx
mov edx, dword [esp + 0x38]
mov byte [esi + 0x50], al
push 0xffffffffffffffff
push 0xffffffffffffffff
mov eax, ebp
mov byte [esi + 0x9c], 0
mov dword [esi + 0x5c], ecx
mov dword [esi + 0x60], edx
call fcn.004ffbf0
mov ebx, dword [esp + 0x24]
xor ebp, ebp
add esp, 0xc
mov byte [esi + 0x47], 1
cmp ebx, ebp
je 0x5218e1
mov eax, dword [ebx + 4]
call fcn.0050fad0
mov dword [ebx + 4], ebp
mov dword [ebx + 0xc], ebp
mov eax, esi
call fcn.004d7e50
mov eax, edi
pop edi
pop ebp
pop ebx
add esp, 0x2c
ret