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

Disassembly:
sub esp, 0x1a8
push ebp
push esi
xor esi, esi
mov dword [esp + 8], esi
call dword [sym.imp.WINMM.dll_mixerGetNumDevs]
xor ebp, ebp
mov dword [esp + 0x2c], eax
test eax, eax
mov dword [esp + 0x24], ebp
jle 0x495a43
push ebx
push edi
lea eax, [esi + esi*2]
lea eax, [eax + eax*8]
lea ecx, [esi + eax*8]
xor eax, eax
push eax
push eax
lea ebx, [ecx*4 + 0x676e58]
mov ecx, 0xd9
mov edi, ebx
push eax
push ebp
push ebx
rep stosd dword es:[edi], eax
call dword [sym.imp.WINMM.dll_mixerOpen]
test eax, eax
jne 0x495a21
mov eax, dword [ebx]
lea edx, [ebx + 4]
push 0x30
push edx
push eax
call dword [sym.imp.WINMM.dll_mixerGetDevCapsA]
test eax, eax
jne 0x495a21
mov eax, dword [ebx + 0x30]
xor ebp, ebp
test eax, eax
mov dword [esp + 0x24], ebp
jbe 0x495a1d
mov edx, dword [ebx]
mov ecx, 0x2a
xor eax, eax
lea edi, [esp + 0x110]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x110]
push DirectSoundCreate
push ecx
push edx
mov dword [esp + 0x11c], 0xa8
mov dword [esp + 0x120], ebp
mov dword [esp + 0x124], eax
call dword [sym.imp.WINMM.dll_mixerGetLineInfoA]
test eax, eax
jne 0x495a0d
mov eax, dword [esp + 0x188]
cmp eax, 1
je 0x49571a
cmp eax, 5
jne 0x495a0d
mov eax, dword [esp + 0x130]
lea edi, [ebx + 0x34]
mov ecx, 0x2a
lea esi, [esp + 0x110]
xor edx, edx
test eax, eax
rep movsd dword es:[edi], dword [esi]
mov dword [esp + 0x30], edx
jbe 0x4959f1
mov ecx, 0x2a
xor eax, eax
lea edi, [esp + 0x68]
push reloc.DSOUND.dll_DirectSoundCreate
rep stosd dword es:[edi], eax
mov ecx, dword [ebx]
lea eax, [esp + 0x6c]
push eax
push ecx
mov dword [esp + 0x74], 0xa8
mov dword [esp + 0x78], ebp
mov dword [esp + 0x7c], edx
call dword [sym.imp.WINMM.dll_mixerGetLineInfoA]
test eax, eax
jne 0x4959d5
mov ecx, dword [esp + 0x80]
xor ebp, ebp
cmp ecx, 0x1008
mov dword [esp + 0x14], ebp
mov dword [esp + 0x18], ebp
mov dword [esp + 0x20], ebp
je 0x4957ce
mov edi, str.Wave
lea esi, [esp + 0xa0]
mov dl, byte [esi]
mov al, dl
cmp dl, byte [edi]
jne 0x4957c5
test al, al
je 0x4957c1
mov dl, byte [esi + 1]
mov al, dl
cmp dl, byte [edi + 1]
jne 0x4957c5
add esi, 2
add edi, 2
test al, al
jne 0x4957a1
xor eax, eax
jmp 0x4957ca
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
jne 0x4957f2
lea eax, [ebx + 0xdc]
lea edx, [ebx + 0x354]
mov dword [esp + 0x14], eax
lea eax, [ebx + 0x358]
lea ebp, [ebx + 0x22c]
mov dword [esp + 0x18], edx
mov dword [esp + 0x20], eax
cmp ecx, 0x1009
je 0x49583f
cmp ecx, 0x1005
je 0x49583f
mov edi, str.CD_Audio
lea esi, [esp + 0xa0]
mov cl, byte [esi]
mov dl, byte [edi]
mov al, cl
cmp cl, dl
jne 0x495836
test al, al
je 0x495832
mov dl, byte [esi + 1]
mov cl, byte [edi + 1]
mov al, dl
cmp dl, cl
jne 0x495836
add esi, 2
add edi, 2
test al, al
jne 0x49580e
xor eax, eax
jmp 0x49583b
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
jne 0x49586c
mov al, byte [0x6840e8]
test al, al
je 0x49586c
lea eax, [ebx + 0x184]
lea ecx, [ebx + 0x35c]
lea edx, [ebx + 0x360]
mov dword [esp + 0x14], eax
lea ebp, [ebx + 0x2c0]
mov dword [esp + 0x18], ecx
mov dword [esp + 0x20], edx
test ebp, ebp
je 0x4959d5
mov eax, dword [esp + 0x74]
push 4
mov dword [esp + 0x40], eax
mov eax, dword [esp + 0x90]
mov dword [esp + 0x3c], 0x18
mov dword [esp + 0x48], eax
lea ecx, [eax + eax*8]
mov dword [esp + 0x4c], 0x94
lea edx, [eax + ecx*4]
shl edx, 2
push edx
call fcn.004b0c60
mov ecx, dword [ebx]
add esp, 8
mov dword [esp + 0x4c], eax
lea eax, [esp + 0x38]
push DirectSoundCreate
push eax
push ecx
call dword [sym.imp.WINMM.dll_mixerGetLineControlsA]
test eax, eax
jne 0x4959d5
mov eax, dword [esp + 0x44]
xor esi, esi
cmp eax, esi
mov dword [esp + 0x28], esi
jbe 0x4959c4
mov dword [esp + 0x1c], esi
mov edx, dword [esp + 0x4c]
mov eax, dword [esp + 0x1c]
add eax, edx
cmp dword [eax + 8], 0x50030001
jne 0x49599f
mov edi, dword [esp + 0x14]
mov ecx, 0x2a
lea esi, [esp + 0x68]
push 4
rep movsd dword es:[edi], dword [esi]
mov ecx, 0x25
mov esi, eax
mov edi, ebp
rep movsd dword es:[edi], dword [esi]
mov esi, dword [esp + 0x18]
mov ecx, dword [ebp + 4]
mov edx, dword [ebp + 0x10]
mov dword [esp + 0x54], 0x18
mov eax, dword [esi + 0x1c]
mov dword [esp + 0x58], ecx
mov dword [esp + 0x5c], eax
mov dword [esp + 0x60], edx
shl eax, 2
push eax
mov dword [esp + 0x68], 4
call fcn.004b0c60
mov edx, dword [ebx]
add esp, 8
lea ecx, [esp + 0x50]
mov dword [esp + 0x64], eax
push DirectSoundCreate
push ecx
push edx
call dword [sym.imp.WINMM.dll_mixerGetControlDetailsA]
test eax, eax
mov eax, dword [esp + 0x64]
jne 0x495985
mov ecx, dword [esi + 0x1c]
test ecx, ecx
jbe 0x495976
mov edx, dword [esp + 0x18]
mov ecx, dword [eax]
mov dword [edx], ecx
cmp dword [esi + 0x1c], 1
jbe 0x495985
mov edx, dword [esp + 0x20]
mov ecx, dword [eax + 4]
mov dword [edx], ecx
push eax
call fcn.004b0d10
mov eax, dword [esp + 0x14]
add esp, 4
inc eax
mov dword [esp + 0x64], 0
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x1c]
mov ecx, dword [esp + 0x44]
inc eax
add edx, 0x94
cmp eax, ecx
mov dword [esp + 0x28], eax
mov dword [esp + 0x1c], edx
jb 0x4958e0
xor esi, esi
mov eax, dword [esp + 0x4c]
push eax
call fcn.004b0d10
add esp, 4
mov dword [esp + 0x4c], esi
mov edx, dword [esp + 0x30]
mov eax, dword [esp + 0x130]
mov ebp, dword [esp + 0x24]
inc edx
cmp edx, eax
mov dword [esp + 0x30], edx
jb 0x495740
mov eax, dword [ebx + 0x22c]
test eax, eax
je 0x495a09
mov eax, dword [ebx + 0x2c0]
test eax, eax
je 0x495a09
inc dword [esp + 0x10]
mov esi, dword [esp + 0x10]
mov eax, dword [ebx + 0x30]
inc ebp
cmp ebp, eax
mov dword [esp + 0x24], ebp
jb 0x4956be
mov ebp, dword [esp + 0x2c]
mov eax, dword [esp + 0x34]
inc ebp
cmp ebp, eax
mov dword [esp + 0x2c], ebp
jl 0x495668
pop edi
mov dword [0x5ca150], esi
pop ebx
pop esi
pop ebp
add esp, 0x1a8
ret
mov dword [0x5ca150], esi
pop esi
pop ebp
add esp, 0x1a8
ret