Function at 0x406670
Capabilities:
Check for time delay via gettickcount

Disassembly:
sub esp, 0xc
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x20]
xor ebx, ebx
xor eax, eax
xor esi, esi
cmp edi, ebx
mov ebp, ecx
mov dword [esp + 0x10], eax
je 0x406b12
cmp dword [esp + 0x24], ebx
je 0x406b12
jmp 0x4066a3
mov eax, dword [esp + 0x10]
mov edi, dword [esp + 0x20]
cmp esi, 6
ja case.default.0x4066ac
jmp dword [esi*4 + 0x406b24]
mov dword [ebp + 0x37c4], ebx
mov dword [ebp + 0x37c8], ebx
mov dword [ebp + 0x37e4], ebx
mov dword [ebp + 0x37e8], ebx
mov dword [esp + 0x14], ebx
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov edi, dword [ebp + 0x37f0]
mov dword [esp + 0x18], eax
cmp edi, ebx
je 0x406853
cmp dword [ebp + 0x37f8], ebx
je 0x406853
mov ecx, dword [ebp + 0x37f4]
xor eax, eax
mov edx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov ecx, dword [ebp + 0x37fc]
mov edi, dword [ebp + 0x37f8]
mov edx, ecx
xor eax, eax
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
cmp dword [ebp + 0x37e0], ebx
je 0x4067dd
cmp dword [ebp + 0x29a8], 1
jne 0x4067dd
mov eax, dword [ebp + 0x37d0]
mov ecx, dword [ebp + 0x37d4]
lea edi, [ebp + 0x37d0]
lea esi, [ebp + 0x37d4]
push eax
mov eax, dword [ebp + 0x37a0]
lea edx, [ebp + 0x10a0]
push ecx
push edx
push str._s:_call_sp_replcmds___d___d__r_n
push eax
call fcn.00401c50
add esp, 0x14
mov ecx, dword [ebp + 0x1098]
push ebx
push ebx
push esi
push ebx
push ebx
push 4
push 0xfffffffffffffff0
push 1
push 1
push ecx
call sub.ODBC32.dll_SQLBindParameter
and al, 0xfe
test ax, ax
je 0x4067a4
mov ecx, ebp
call fcn.004043d0
mov esi, 5
jmp case.default.0x4066ac
mov edx, dword [ebp + 0x1098]
push ebx
push ebx
push edi
push ebx
push ebx
push 4
push 0xfffffffffffffff0
push 1
push 2
push edx
call sub.ODBC32.dll_SQLBindParameter
and al, 0xfe
test ax, ax
je 0x4067d5
mov ecx, ebp
call fcn.004043d0
mov esi, 5
jmp case.default.0x4066ac
push ebx
push str.call_sp_replcmds______
jmp 0x40683c
mov eax, dword [ebp + 0x37d4]
mov edx, dword [ebp + 0x37a0]
lea esi, [ebp + 0x37d4]
lea ecx, [ebp + 0x10a0]
push eax
push ecx
push str._s:_call_sp_replcmds___d__r_n
push edx
call fcn.00401c50
add esp, 0x10
mov eax, dword [ebp + 0x1098]
push ebx
push ebx
push esi
push ebx
push ebx
push 4
push 0xfffffffffffffff0
push 1
push 1
push eax
call sub.ODBC32.dll_SQLBindParameter
and al, 0xfe
test ax, ax
je 0x406836
mov ecx, ebp
call fcn.004043d0
mov esi, 5
jmp case.default.0x4066ac
push ebx
push str.call_sp_replcmds____
mov ecx, ebp
call fcn.00404940
mov esi, eax
dec esi
neg esi
sbb esi, esi
and esi, 4
inc esi
jmp case.default.0x4066ac
mov ecx, dword [esp + 0x24]
push 0x29d
push str.r:SPHINXSQLREPLlogreadSRCpublish.cpp
call fcn.004074a0
mov dword [ebp + 0xa0c], ebx
mov esi, 6
jmp case.default.0x4066ac
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov esi, dword [esp + 0x20]
lea edx, [esp + 0x10]
push edx
push esi
mov ecx, dword [esi]
mov edi, eax
call dword [ecx + 0x10]
test eax, eax
je 0x4069d5
cmp dword [esp + 0x10], ebx
je 0x4069d5
mov esi, 2
jmp 0x4069f1
push eax
mov ecx, ebp
call fcn.00406b40
cmp eax, 1
jne 0x4069a6
mov esi, dword [esp + 0x10]
cmp byte [esi + 0x1c], bl
jne 0x4068c9
inc dword [ebp + 0x37c8]
mov eax, dword [ebp + 0x37c8]
dec eax
cmp eax, ebx
je 0x40692a
cdq
idiv dword [ebp + 0x37cc]
test edx, edx
jne 0x40692a
push 0x4e53
push ebp
call fcn.00401210
mov eax, dword [ebp + 0x37c8]
mov ecx, dword [ebp + 0x37cc]
add esp, 8
dec eax
cmp eax, ecx
lea esi, [ebp + 8]
jne 0x406909
mov ecx, dword [ebp + 4]
push ebx
push esi
push ecx
jmp 0x406910
mov edx, dword [ebp + 4]
push 1
push esi
push edx
mov ecx, dword [esp + 0x30]
push 0x416978
push 2
push ebx
push 4
call fcn.00407990
mov word [esi], bx
mov esi, dword [esp + 0x10]
cmp dword [esi + 0x20], 1
jne 0x40699c
mov eax, dword [ebp + 0x37c4]
xor ecx, ecx
inc eax
mov dword [ebp + 0x37c4], eax
mov cl, byte [esi + 0xc]
mov edi, dword [esi + 0x10]
mov esi, dword [ebp + 0x37f8]
xor eax, eax
repe cmpsb byte [esi], byte es:[edi]
je 0x406956
sbb eax, eax
sbb eax, 0xffffffff
cmp eax, ebx
jge 0x40699c
mov ecx, dword [ebp + 0x37f4]
mov eax, dword [esp + 0x10]
mov edi, dword [ebp + 0x37f0]
mov edx, ecx
mov esi, dword [eax + 8]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp + 0x37fc]
mov eax, dword [esp + 0x10]
mov edi, dword [ebp + 0x37f8]
mov edx, ecx
mov esi, dword [eax + 0x10]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov esi, 3
jmp case.default.0x4066ac
xor ecx, ecx
cmp eax, 2
setne cl
add ecx, 4
mov esi, ecx
jmp case.default.0x4066ac
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov esi, dword [esp + 0x20]
mov edi, eax
mov eax, dword [esp + 0x10]
push 1
mov edx, dword [esi]
push eax
push esi
call dword [edx + 0x14]
test eax, eax
jne 0x4069ec
mov ecx, dword [esp + 0x24]
push esi
call fcn.00407360
mov dword [ebp + 0xa0c], ebx
mov esi, 6
jmp 0x4069f1
mov esi, 1
call dword [sym.imp.KERNEL32.dll_GetTickCount]
cmp eax, edi
jb 0x406a0c
mov ecx, dword [esp + 0x14]
sub eax, edi
add ecx, eax
mov dword [esp + 0x14], ecx
jmp case.default.0x4066ac
mov ecx, dword [esp + 0x14]
sub eax, edi
dec eax
add ecx, eax
mov dword [esp + 0x14], ecx
jmp case.default.0x4066ac
mov ecx, dword [edi]
push ebx
push eax
push edi
call dword [ecx + 0x14]
test eax, eax
jne 0x406a3a
mov ecx, dword [esp + 0x24]
push edi
call fcn.00407360
mov dword [ebp + 0xa0c], ebx
cmp dword [ebp + 0x37c8], ebx
je 0x406a6c
mov edx, dword [edi]
push edi
call dword [edx + 0x18]
test eax, eax
jne 0x406a66
mov ecx, dword [esp + 0x24]
push edi
call fcn.00407360
mov dword [ebp + 0xa0c], ebx
mov esi, 6
jmp case.default.0x4066ac
inc dword [ebp + 0x37e4]
mov esi, 6
jmp case.default.0x4066ac
cmp dword [ebp + 0xa0c], 3
je 0x406aa3
lea eax, [ebp + 0x16ac]
push eax
push str.sp_replcmds
push 0x4e2b
push ebp
call fcn.00401210
mov ecx, dword [esp + 0x34]
add esp, 0x10
push ebp
call fcn.00407850
mov eax, dword [ebp + 0xa0c]
mov esi, 6
cmp eax, 1
jne case.default.0x4066ac
mov dword [ebp + 0xa0c], ebx
jmp case.default.0x4066ac
mov ecx, dword [ebp + 0x1098]
push ecx
call sub.ODBC32.dll_SQLCancel
mov edx, dword [ebp + 0x1098]
push 3
push edx
call sub.ODBC32.dll_SQLFreeStmt
mov esi, 7
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov ecx, dword [esp + 0x18]
cmp eax, ecx
jb 0x406aec
sub eax, ecx
jmp 0x406aef
sub eax, ecx
dec eax
sub eax, dword [esp + 0x14]
mov dword [ebp + 0x37e8], eax
cmp esi, 7
jne 0x40669b
mov eax, dword [ebp + 0xa0c]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret 8
pop edi
mov dword [ebp + 0xa0c], ebx
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0xc
ret 8