Function at 0x497ff0
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4c8993
mov eax, dword fs:[0]
push eax
sub esp, 0x104
mov eax, dword [0x517b6c]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x10], esp
mov edi, edx
xor eax, eax
mov ebx, ecx
mov dword [ebp - 0x40], edi
mov dword [ebp - 0x3c], eax
mov dword [ebp - 0x70], vtable.CDSOUND.0
mov dword [ebp - 4], eax
lea esi, [ebx + 4]
push esi
mov dword [ebp - 0x50], eax
mov dword [ebp - 0x4c], eax
mov dword [ebp - 0x48], eax
mov dword [ebp - 0x44], eax
mov dword [ebp - 0x38], eax
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x24], eax
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x18], eax
mov byte [ebp - 4], 1
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [ebx + 0x1c], 0
push esi
je 0x498099
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor al, al
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.004acfa0
mov esp, ebp
pop ebp
ret 8
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebx + 0x40]
mov ecx, dword [ebp + 8]
cmp eax, dword [ecx + 8]
lea esi, [ebx + 0x38]
je 0x4980c6
call fcn.0042d290
mov eax, dword [ebp + 8]
mov edx, dword [eax + 4]
mov dword [esi + 4], edx
mov eax, dword [eax + 8]
mov dword [esi + 8], eax
mov esi, edx
add dword [esi], 1
mov eax, dword [edi + 0x150]
mov ecx, dword [ebx + 0x40]
mov edx, dword [ecx]
mov edx, dword [edx + 4]
push eax
mov eax, dword [edi + 0x154]
push eax
add edi, 4
push edi
call edx
test eax, eax
jne 0x4980fb
push 0x4f3a60
lea eax, [ebp - 0x64]
push eax
mov dword [ebp - 0x64], 0x4ec648
call fcn.004ae41b
mov ecx, dword [ebx + 0x40]
mov edx, dword [ecx]
mov edx, dword [edx + 0x14]
lea eax, [ebp - 0x80]
push eax
call edx
mov ecx, dword [eax]
mov dword [ebp - 0x50], ecx
mov edx, dword [eax + 4]
mov dword [ebp - 0x4c], edx
mov ecx, dword [eax + 8]
mov dword [ebp - 0x48], ecx
mov edx, dword [eax + 0xc]
mov ecx, dword [ebx + 0x40]
mov dword [ebp - 0x44], edx
mov eax, dword [ecx]
mov edx, dword [eax + 0x18]
call edx
movzx ecx, word [ebp - 0x44]
mov dword [ebx + 0x64], eax
mov eax, ecx
imul eax, dword [ebp - 0x4c]
add eax, eax
shr eax, 1
mov edx, eax
and edx, 1
je 0x498146
sub ecx, edx
add eax, ecx
lea esi, [eax + eax]
mov eax, dword [ebx + 0x34]
test eax, eax
je 0x49815e
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebx + 0x34], 0
push str.DSNotifyEvent
push 0
push 1
push 0
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov cl, byte [ebp + 0xc]
mov dword [ebx + 0x34], eax
xor eax, eax
mov dword [ebx + 0x44], eax
mov dword [ebx + 0x4c], eax
lea edx, [ebp - 0x50]
mov dword [ebp - 0x28], edx
push 0
mov edi, esi
lea edx, [ebp - 0x3c]
push edx
mov byte [ebx + 0x45], cl
shr edi, 1
mov dword [ebx + 0x48], edi
mov dword [ebx + 0x50], esi
mov eax, dword [0x53c4a8]
lea edx, [ebp - 0x38]
mov dword [ebp - 0x38], 0x24
mov dword [ebp - 0x34], 0x8188
mov dword [ebp - 0x30], esi
mov ecx, dword [eax]
push edx
push eax
mov eax, dword [ecx + 0xc]
call eax
test eax, eax
jge 0x4981d1
push 0x4f3a60
lea ecx, [ebp - 0x68]
push ecx
mov dword [ebp - 0x68], 0x4ec668
call fcn.004ae41b
mov ecx, dword [ebp - 0x3c]
mov edx, dword [ecx]
lea eax, [ebx + 0x1c]
push eax
mov eax, dword [edx]
push 0x4d4448
push ecx
call eax
mov esi, eax
mov eax, dword [ebp - 0x3c]
mov ecx, dword [eax]
mov edx, dword [ecx + 8]
push eax
call edx
test esi, esi
mov dword [ebp - 0x3c], 0
jge 0x498211
push 0x4f3a60
lea eax, [ebp - 0x5c]
push eax
mov dword [ebp - 0x5c], str.DirectSound8
call fcn.004ae41b
mov eax, dword [ebx + 0x20]
test eax, eax
lea esi, [ebx + 0x20]
je 0x498229
mov ecx, dword [eax]
mov edx, dword [ecx + 8]
push eax
call edx
mov dword [esi], 0
mov eax, dword [ebx + 0x1c]
mov ecx, dword [eax]
mov edx, dword [ecx]
push esi
push 0x4d4438
push eax
call edx
test eax, eax
jge 0x498252
push 0x4f3a60
lea eax, [ebp - 0x60]
push eax
mov dword [ebp - 0x60], 0x4ec92c
call fcn.004ae41b
mov ecx, dword [ebx + 0x34]
lea eax, [ebx + 0x24]
mov dword [ebx + 0x28], ecx
mov dword [ebx + 0x30], ecx
mov ecx, dword [esi]
push eax
mov dword [eax], 0
mov dword [ebx + 0x2c], edi
mov edx, dword [ecx]
mov eax, dword [edx + 0xc]
push 2
push ecx
call eax
test eax, eax
jge 0x49828d
push 0x4f3a60
lea ecx, [ebp - 0x54]
push ecx
mov dword [ebp - 0x54], str.DirectSoundNotify
call fcn.004ae41b
lea esi, [ebx + 0x54]
call fcn.00408ea0
mov edi, dword [ebx + 0x48]
call fcn.00408dd0
test eax, eax
je 0x498079
mov edx, dword [ebx + 0x34]
push edx
call dword [sym.imp.KERNEL32.dll_ResetEvent]
push ebx
push 0
push 0x4986d0
call fcn.004ae088
add esp, 0xc
cmp eax, 0xffffffff
jne 0x4982d9
push 0x4f3a60
lea eax, [ebp - 0x58]
push eax
mov dword [ebp - 0x58], 0x4ec964
call fcn.004ae41b
push 0x42
add ebx, 0x68
push 0
push ebx
call fcn.004b2fa0
mov ecx, dword [ebp - 0x40]
add esp, 0xc
add ecx, 0x10c
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
mov al, 1
jmp 0x49807b