Function at 0x521740
Capabilities:
Reference sql statements

Disassembly:
sub esp, 0x2c
cmp byte [esi + 0x47], 0
mov dword [esp + 0xc], 0
jne 0x52176e
mov eax, dword [esp + 0x30]
push str.cannot_VACUUM_from_within_a_transaction
push eax
mov eax, esi
call fcn.004c3a70
add esp, 8
mov eax, 1
add esp, 0x2c
ret
cmp dword [esi + 0xa4], 1
jle 0x521794
mov ecx, dword [esp + 0x30]
push str.cannot_VACUUM___SQL_statements_in_progress
push ecx
mov eax, esi
call fcn.004c3a70
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.005215c0
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x521a5a
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.0050af90
mov eax, ebp
call fcn.004bf8b0
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.004bf7c0
push edi
mov eax, ebp
call fcn.004bf810
push eax
mov eax, ebx
call fcn.004bf810
push 0x21
mov eax, ebx
call fcn.004bf860
mov edx, dword [esp + 0x4c]
push str.BEGIN
push edx
push esi
call fcn.005215c0
mov edi, eax
add esp, 0x1c
test edi, edi
jne 0x521a5a
push eax
push 2
push ebp
call fcn.00505340
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x521a5a
mov eax, dword [ebp + 4]
mov ecx, dword [eax]
cmp byte [ecx + 5], 5
jne 0x5218a9
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.004ffdc0
add esp, 0xc
test eax, eax
jne 0x521a55
cmp dword [esp + 0x20], eax
jne 0x5218e7
push eax
mov eax, dword [esi + 0x54]
push edi
push eax
mov eax, ebx
call fcn.004ffdc0
add esp, 0xc
test eax, eax
jne 0x521a55
cmp byte [esi + 0x49], 0
jne 0x521a55
mov al, byte [esi + 0x4c]
test al, al
jl 0x5218fd
movsx eax, al
jmp 0x521904
mov eax, ebp
call fcn.004bfa30
push eax
mov eax, ebx
call fcn.004bf9b0
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.005216b0
mov edi, eax
add esp, 0x10
test edi, edi
jne 0x521a5a
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.005216b0
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x521a5a
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.005216b0
and dword [esi + 0x18], 0xfffffffb
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x521a5a
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.005216b0
mov edi, eax
add esp, 0xc
test edi, edi
jne 0x521a5a
mov dword [esp + 0x10], edi
jmp 0x5219c4
mov edi, dword [esp + 0x10]
movzx edx, byte [edi + 0x5ec81c]
lea ecx, [esp + 0x24]
push ecx
push edx
mov eax, ebp
call fcn.004bfba0
movzx eax, byte [edi + 0x5ec81d]
add eax, dword [esp + 0x2c]
movzx ecx, byte [edi + 0x5ec81c]
push eax
push ecx
mov eax, ebx
call fcn.004c5150
mov edi, eax
add esp, 0x10
test edi, edi
jne 0x521a5a
mov eax, dword [esp + 0x10]
add eax, 2
cmp eax, 0xa
mov dword [esp + 0x10], eax
jl 0x5219c0
push ebp
mov eax, ebx
call fcn.005120c0
mov edi, eax
add esp, 4
test edi, edi
jne 0x521a5a
mov eax, ebx
call fcn.0050af90
mov edi, eax
test edi, edi
jne 0x521a5a
mov eax, ebx
call fcn.004bfa30
push eax
mov eax, ebp
call fcn.004bf9b0
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.004ffdc0
add esp, 0x10
mov edi, eax
jmp 0x521a5a
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.004ffdc0
mov ebx, dword [esp + 0x24]
xor ebp, ebp
add esp, 0xc
mov byte [esi + 0x47], 1
cmp ebx, ebp
je 0x521ab1
mov eax, dword [ebx + 4]
call fcn.0050fca0
mov dword [ebx + 4], ebp
mov dword [ebx + 0xc], ebp
mov eax, esi
call fcn.004d8010
mov eax, edi
pop edi
pop ebp
pop ebx
add esp, 0x2c
ret