Function at 0x4877db
Capabilities:
Resolve function by parsing pe exports

Disassembly:
mov eax, 0x4c05bb
call fcn.004bf97c
sub esp, 0x6c
push ebx
push ebp
push esi
push str.CSound::ReadThreadProc
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
call fcn.00403fcf
mov eax, dword [edi + 0x18]
mov esi, dword [eax + 8]
pop ecx
pop ecx
mov ecx, dword [edi + 0x90]
push 0xa
xor edx, edx
lea eax, [ecx + ecx*8]
pop ebx
div ebx
cmp ecx, esi
mov dword [esp + 0x20], esi
mov dword [esp + 0x28], eax
mov eax, ecx
jb 0x487824
mov eax, esi
shr eax, 1
mov dword [esp + 0x1c], eax
push 0xa
xor edx, edx
mov eax, ecx
shl eax, 3
pop ebx
div ebx
push 0x64
xor edx, edx
and dword [esp + 0x10], 0
or ebp, 0xffffffff
mov dword [esp + 0x28], eax
mov eax, ecx
pop ecx
div ecx
push ebx
xor edx, edx
mov ecx, eax
mov eax, esi
pop esi
div esi
mov dword [esp + 0x18], ecx
cmp ecx, eax
ja 0x487861
mov dword [esp + 0x18], eax
mov eax, dword [edi + 0xe8]
mov dword [esp + 0x2c], eax
mov eax, dword [edi + 0xd8]
mov dword [esp + 0x30], eax
xor eax, eax
mov dword [esp + 0x40], eax
mov dword [esp + 0x3c], eax
mov dword [esp + 0x44], eax
mov dword [esp + 0x48], eax
mov dword [esp + 0x10], eax
push ebp
push dword [edi + 0xd8]
mov ebp, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
call ebp
test eax, eax
jne 0x487e0f
cmp dword [esp + 0xc], 8
jne 0x4878b0
mov esi, edi
call fcn.00487210
mov ebx, dword [edi + 0xec]
xor esi, esi
inc esi
cmp ebx, 3
mov dword [esp + 0xc], ebx
jne 0x487abf
mov edx, dword [edi + 0x5c]
xor ebx, ebx
cmp dword [edx + 0x98], 2
sete bl
test ebx, ebx
jne 0x4878eb
mov ecx, dword [edi + 0xcc]
call fcn.0048d6aa
mov ebp, eax
jmp 0x487a07
push 2
push 1
mov esi, edi
call fcn.004876d0
mov eax, reloc.ttpcomm.dll_Ordinal_10
call fcn.00487173
lea eax, [esp + 0x4c]
xor ebp, ebp
call fcn.00485abf
and dword [esp + 0x80], ebp
mov eax, dword [edi + 0x5c]
push 0xea60
push dword [edi + 0xcc]
lea esi, [esp + 0x54]
call fcn.00485aff
mov eax, dword [edi + 0xd8]
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x50]
mov dword [esp + 0x38], eax
push 0xffffffffffffffff
push 0
lea eax, [esp + 0x3c]
push eax
push 2
call dword [sym.imp.KERNEL32.dll_WaitForMultipleObjects]
test eax, eax
jne 0x48797b
mov eax, dword [edi + 0xec]
cmp eax, 4
je 0x48796b
cmp eax, 5
je 0x48796b
xor eax, eax
mov esi, edi
call fcn.00487173
jmp 0x487977
lea esi, [esp + 0x4c]
call fcn.00485b30
xor ebp, ebp
inc ebp
test ebp, ebp
je 0x48793b
test ebp, ebp
je 0x4879bb
or dword [esp + 0x80], 0xffffffff
lea ecx, [esp + 0x4c]
xor ebp, ebp
mov dword [esp + 0x4c], 0x4ceb6c
call fcn.00403e55
cmp dword [esp + 0x54], ebp
mov dword [esp + 0x4c], 0x4caeb0
je 0x48788b
push dword [esp + 0x54]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x48788b
mov ebp, dword [esp + 0x68]
xor eax, eax
cmp dword [edi + 0xc8], eax
mov esi, edi
setne al
inc eax
push eax
push 0
call fcn.004876d0
or dword [esp + 0x80], 0xffffffff
lea ecx, [esp + 0x4c]
mov dword [esp + 0x4c], 0x4ceb6c
call fcn.00403e55
cmp dword [esp + 0x54], 0
mov dword [esp + 0x4c], 0x4caeb0
je 0x487a07
push dword [esp + 0x54]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test ebp, ebp
jl 0x487a97
mov eax, dword [edi + 0x50]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x1c]
mov ebp, eax
test ebp, ebp
jge 0x487a2d
test ebx, ebx
jne 0x487d13
mov eax, ebp
jmp 0x487da9
mov esi, dword [edi + 0x60]
test esi, esi
je 0x487a39
call fcn.0048602f
push dword [edi + 0xcc]
mov esi, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
lea eax, [edi + 0x8c]
push eax
call esi
push 0
lea eax, [edi + 0x88]
push eax
call esi
push 0
lea eax, [edi + 0x98]
push eax
call esi
push 0
lea eax, [edi + 0x9c]
push eax
call esi
push dword [edi + 0x90]
lea eax, [edi + 0xa0]
push eax
call esi
lea esi, [edi + 0x20]
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
and dword [edi + 0x74], 0
and dword [edi + 0x78], 0
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [edi + 0xc8], 0
je 0x487a1e
mov ebp, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
xor eax, eax
test ebx, ebx
sete al
mov dword [esp + 0xc], 1
mov ebx, dword [esp + 0xc]
mov esi, eax
cmp ebx, 1
jne 0x487c3a
mov ecx, dword [edi + 0x64]
test ecx, ecx
je 0x487add
cmp dword [edi + 0xb0], 0
jne 0x487add
call fcn.00488218
xor ecx, ecx
cmp dword [edi + 0x64], ecx
je 0x487b75
test byte [edi + 0xa8], 1
je 0x487b75
cmp dword [edi + 0xa4], ecx
mov dword [esp + 0x14], 1
jg 0x487b0b
mov ecx, dword [edi + 0xa4]
mov eax, dword [edi + 0x50]
mov edx, dword [eax]
push ecx
push eax
call dword [edx + 0x20]
mov eax, edi
call fcn.00487192
test esi, esi
mov ebp, eax
je 0x487b29
mov esi, edi
call fcn.00487173
test ebp, ebp
jge 0x487b34
push 4
pop ebx
mov dword [esp + 0xc], ebx
push dword [edi + 0xe4]
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov dword [esp + 0x10], 1
xor ebp, ebp
push 0x64
push 0
lea eax, [esp + 0x34]
push eax
push 2
call dword [sym.imp.KERNEL32.dll_WaitForMultipleObjects]
cmp eax, 0x102
jne 0x487b7b
cmp dword [edi + 8], 3
je 0x487bab
push 2
push 1
mov esi, edi
call fcn.004876d0
jmp 0x487bab
mov dword [esp + 0x14], ecx
jmp 0x487b05
test eax, eax
je 0x487bb1
cmp eax, 1
jne 0x487bab
mov ebx, dword [edi + 0xec]
cmp ebx, 2
mov dword [esp + 0xc], ebx
je 0x487ba8
cmp ebx, 4
je 0x487ba8
cmp ebx, 5
je 0x487ba8
xor eax, eax
mov esi, edi
call fcn.00487173
jmp 0x487bab
xor ebp, ebp
inc ebp
test ebp, ebp
je 0x487b4a
jmp 0x487bb6
and dword [esp + 0x10], 0
test ebp, ebp
jne 0x487bd2
cmp dword [edi + 0x88], ebp
jne 0x487bd2
mov eax, dword [edi + 0x98]
cmp eax, dword [esp + 0x1c]
jb 0x487b34
cmp dword [edi + 8], 3
jne 0x487be3
push 2
push 0
mov esi, edi
call fcn.004876d0
test ebp, ebp
je 0x487bee
xor ebp, ebp
jmp 0x48788b
mov eax, dword [edi + 0x50]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x14]
cmp dword [esp + 0x14], 0
je 0x487e13
cmp dword [edi + 0xb0], 0
push 6
pop ebx
mov dword [esp + 0xc], ebx
je 0x487c1a
mov ecx, dword [edi + 0xbc]
jmp 0x487c20
mov ecx, dword [edi + 0xb4]
push 0xa
pop esi
mov eax, ecx
xor edx, edx
div esi
lea esi, [esp + 0x3c]
push eax
mov eax, ecx
call fcn.0042a053
jmp 0x487e13
cmp ebx, 2
jne 0x487d1b
cmp dword [esp + 0x10], 0
je 0x487c60
push 0xffffffffffffffff
push dword [edi + 0xe8]
mov dword [edi + 8], 3
call ebp
and dword [esp + 0x10], 0
cmp dword [edi + 0x64], 0
je 0x487cf7
test byte [edi + 0xa8], 2
je 0x487cf7
lea eax, [edi + 8]
cmp dword [eax], 2
jne 0x487cf7
push 1
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
xor eax, eax
mov esi, edi
call fcn.00487173
mov eax, dword [edi + 0x18]
mov esi, dword [edi + 0x90]
mov ebx, dword [sym.imp.KERNEL32.dll_MulDiv]
sub esi, dword [edi + 0xa0]
push 0xa
pop ebp
push 0x3e8
push dword [edi + 0xb8]
mov dword [esp + 0x14], 7
push dword [eax + 8]
call ebx
cmp eax, esi
jae 0x487cda
mov eax, dword [edi + 0x18]
push 0x3e8
push dword [edi + 0xb8]
push dword [eax + 8]
call ebx
jmp 0x487cdc
mov eax, esi
mov ebx, dword [edi + 0x64]
push 0x10
push 0
push dword [edi + 0xa4]
push eax
mov eax, dword [edi + 0x50]
call fcn.004881a2
jmp 0x48788b
mov eax, edi
call fcn.004871e4
mov esi, edi
mov ebp, eax
call fcn.00487173
test ebp, ebp
jge 0x487d13
mov dword [esp + 0xc], 4
or ebp, 0xffffffff
jmp 0x48788b
cmp ebx, 4
jne 0x487db5
cmp dword [esp + 0x10], 0
jne 0x487d88
cmp dword [edi + 0x64], 0
je 0x487d88
test byte [edi + 0xa8], 8
je 0x487d88
lea eax, [edi + 8]
cmp dword [eax], 2
jne 0x487d88
push 0
push eax
mov dword [edi + 0x84], 1
call dword [sym.imp.KERNEL32.dll_InterlockedExchange]
xor eax, eax
mov esi, edi
call fcn.00487173
mov ecx, dword [edi + 0xc0]
push 0xa
pop ebp
mov eax, ecx
xor edx, edx
mov esi, ebp
div esi
lea esi, [esp + 0x3c]
mov dword [esp + 0xc], 8
push eax
mov eax, ecx
call fcn.0042a053
jmp 0x48788b
mov esi, edi
call fcn.00487210
cmp dword [esp + 0x10], 0
mov esi, eax
je 0x487da7
push 0xffffffffffffffff
push dword [edi + 0xe8]
call ebp
and dword [esp + 0x10], 0
mov eax, esi
mov esi, edi
call fcn.00487173
jmp 0x487d13
cmp ebx, 5
jne 0x487e13
xor esi, esi
cmp dword [edi + 8], esi
je 0x487df3
mov eax, dword [edi + 0x50]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x18]
mov esi, eax
mov eax, dword [edi + 0x5c]
mov eax, dword [eax + 4]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x34]
cmp dword [esp + 0x10], 0
mov dword [edi + 0x84], 1
je 0x487df3
push 0xffffffffffffffff
push dword [edi + 0xe8]
call ebp
mov eax, esi
mov esi, edi
call fcn.00487173
mov ecx, dword [esp + 0x78]
pop esi
xor eax, eax
pop ebp
inc eax
pop ebx
mov dword fs:[0], ecx
leave
ret
mov ebx, dword [esp + 0xc]
cmp ebx, 1
je 0x487e7d
cmp ebx, 6
je 0x487e7d
cmp ebx, 8
je 0x487e7d
cmp ebx, 7
jne 0x487d13
mov eax, dword [edi + 0x64]
test eax, eax
je 0x487d13
cmp dword [eax + 4], 0
je 0x487e44
push 0xa
pop ebp
jmp 0x48788b
mov eax, edi
call fcn.004871e4
push dword [edi + 0xa4]
xor ecx, ecx
test eax, eax
mov eax, dword [edi + 0x50]
setl cl
push eax
lea ecx, [ecx + ecx + 2]
mov dword [esp + 0x14], ecx
mov ecx, dword [eax]
call dword [ecx + 0x20]
push 0x20001
mov eax, edi
or ebp, 0xffffffff
call fcn.00485d9c
jmp 0x48788b
push 0x14
pop ebp
push dword [edi + 0xe4]
call dword [sym.imp.KERNEL32.dll_SetEvent]
xor esi, esi
inc esi
mov dword [esp + 0x10], esi
xor ebx, ebx
jmp 0x487e9a
xor esi, esi
inc esi
push ebp
push 0
lea eax, [esp + 0x34]
push eax
push 2
call dword [sym.imp.KERNEL32.dll_WaitForMultipleObjects]
cmp eax, 0x102
jne 0x487f18
cmp dword [edi + 8], 3
je 0x487f86
lea ebp, [edi + 0x38]
push ebp
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [edi + 0x50]
mov ecx, dword [eax]
lea esi, [edi + 0xa0]
push esi
push eax
call dword [ecx + 0x30]
push ebp
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov esi, dword [esi]
test esi, esi
jbe 0x487f04
mov eax, dword [edi + 0x90]
sub eax, esi
cmp eax, dword [esp + 0x18]
jae 0x487f04
mov eax, dword [edi + 0x50]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x18]
push 2
push 1
mov esi, edi
call fcn.004876d0
xor eax, eax
cmp dword [edi + 8], 3
setne al
dec eax
and eax, 0x1e
add eax, 0x14
mov ebp, eax
jmp 0x487f86
test eax, eax
jne 0x487f5c
and dword [esp + 0x10], eax
cmp dword [edi + 8], 3
jne 0x487fb5
cmp dword [edi + 0x88], eax
jne 0x487f90
mov eax, dword [edi + 0xa0]
mov ecx, dword [edi + 0x90]
sub ecx, eax
cmp ecx, dword [esp + 0x24]
ja 0x487f90
test eax, eax
jbe 0x487fa4
push dword [edi + 0xe4]
mov dword [esp + 0x14], esi
call dword [sym.imp.KERNEL32.dll_SetEvent]
jmp 0x487f86
cmp eax, esi
jne 0x487f86
mov eax, dword [edi + 0xec]
cmp eax, 2
mov dword [esp + 0xc], eax
je 0x487f84
cmp eax, 4
je 0x487f84
cmp eax, 5
je 0x487f84
xor eax, eax
mov esi, edi
call fcn.00487173
jmp 0x487f86
mov ebx, esi
test ebx, ebx
je 0x487e97
jmp 0x487fa4
mov eax, dword [edi + 0x50]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x14]
push 2
push 0
mov esi, edi
call fcn.004876d0
cmp dword [edi + 8], 3
jne 0x487fb5
push 2
push 0
mov esi, edi
call fcn.004876d0
test ebx, ebx
jne 0x487be7
mov eax, dword [edi + 0x90]
sub eax, dword [edi + 0xa0]
cmp eax, dword [esp + 0x28]
jbe 0x487ff5
mov eax, dword [edi + 0x9c]
imul eax, eax, 0x1f4
xor edx, edx
div dword [esp + 0x20]
push 0xa
pop ebp
cmp eax, ebp
ja 0x488025
cmp eax, 5
jb 0x48801e
cmp eax, ebp
ja 0x488025
mov ebp, eax
jmp 0x488025
cmp eax, dword [esp + 0x1c]
jbe 0x488023
mov eax, dword [edi + 0x9c]
imul eax, eax, 0xc8
xor edx, edx
div dword [esp + 0x20]
cmp eax, 5
ja 0x48801e
xor ebp, ebp
inc ebp
cmp eax, ebp
jb 0x488025
cmp eax, 5
jbe 0x487ff1
push 5
pop ebp
jmp 0x488025
xor ebp, ebp
cmp dword [edi + 0x9c], 0
jne 0x488036
cmp ebp, 5
jae 0x488036
push 5
pop ebp
cmp dword [esp + 0xc], 6
jne 0x4880af
push 0
lea esi, [esp + 0x40]
call fcn.0042a080
mov edx, eax
cmp edx, 0x64
jge 0x488083
mov ecx, dword [edi + 0xa4]
test ecx, ecx
jle 0x488060
mov eax, ecx
imul eax, edx
jmp 0x4880da
xor eax, eax
test ecx, ecx
jle 0x488068
mov ecx, eax
mov eax, dword [edi + 0x50]
mov edx, dword [eax]
push ecx
push eax
call dword [edx + 0x20]
cmp ebp, 0xa
jb 0x488107
push 0xa
pop ebp
jmp 0x488107
mov eax, dword [edi + 0x50]
push dword [edi + 0xa4]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x20]
push 0x10001
mov eax, edi
call fcn.00485d9c
and dword [edi + 0xb0], 0
mov dword [esp + 0xc], 1
jmp 0x488107
cmp dword [esp + 0xc], 8
jne 0x488107
push 0
lea esi, [esp + 0x40]
call fcn.0042a080
mov edx, eax
cmp edx, 0x64
jge 0x4880e2
mov ecx, dword [edi + 0xa4]
test ecx, ecx
jle 0x488060
push 0x64
pop eax
sub eax, edx
imul eax, ecx
push 0x64
cdq
pop esi
idiv esi
jmp 0x488062
mov esi, edi
call fcn.00487210
mov eax, dword [edi + 0x50]
push dword [edi + 0xa4]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x20]
push 0x80001
mov eax, edi
call fcn.00485d9c
or ebp, 0xffffffff
cmp dword [edi + 0x88], 0
je 0x48788b
mov eax, dword [edi]
push edi
call dword [eax + 0x38]
cmp eax, dword [edi + 0x14]
jb 0x48788b
mov esi, edi
call fcn.00487210
mov dword [esp + 0xc], 4
push 0
jmp 0x487e6e