// File: /workspace/github_c_makefile_star2_O1/calmopyrin[P]tedplay/SIDSoundLib.cpp
// Function: SIDSoundLib::connect()
bool SIDSoundLib::connect()
{
	if (!detected) {
#ifdef _DEBUG
		m_hDll = LOAD_LIBRARY(LIBNAME_DEBUG);
#else
		m_hDll = LOAD_LIBRARY(LIBNAME);
#endif
		//HRESULT r = GetLastError();
		if (m_hDll) {
			sidCreate = (_sidCreate)LOAD_FUNCTION(m_hDll, "sidCreate");
			sidDestroy = (_sidDestroy)LOAD_FUNCTION(m_hDll, "sidDestroy");
			sidSetSampleRate = (_sidSetSampleRate)LOAD_FUNCTION(m_hDll, "sidSetSampleRate");
			sidSetModel = (_sidSetSampleRate)LOAD_FUNCTION(m_hDll, "sidSetModel");
			sidReset = (_sidReset)LOAD_FUNCTION(m_hDll, "sidReset");
			sidPause = (_sidPause)LOAD_FUNCTION(m_hDll, "sidPause");
			sidWriteReg = (_sidWriteReg)LOAD_FUNCTION(m_hDll, "sidWriteReg");
			sidReadReg = (_sidReadReg)LOAD_FUNCTION(m_hDll, "sidReadReg");
			sidCalcSamples = (_sidCalcSamples)LOAD_FUNCTION(m_hDll, "sidCalcSamples");
			sidGetLibVersion = (_sidGetLibVersion)LOAD_FUNCTION(m_hDll, "sidGetLibVersion");
			if (!(sidCreate && sidDestroy && sidSetSampleRate && sidSetModel && sidReset && sidPause
				&& sidWriteReg && sidReadReg && sidCalcSamples && sidGetLibVersion))
				return false;
		} else
			return false;
	}
	detected = true;
	return detected;
}

// Assembly:
pushq %rbx
cmpb $0x0, 0x1bd68(%rip)     # 0x25418
jne 0x985c
leaq 0x6c94(%rip), %rdi      # 0x10351
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x32b0
movq %rax, 0x1bd53(%rip)     # 0x25420
testq %rax, %rax
je 0x9865
leaq 0x6c7b(%rip), %rsi      # 0x10358
movq %rax, %rdi
callq 0x31f0
movq %rax, 0x1bd3c(%rip)     # 0x25428
movq 0x1bd2d(%rip), %rdi     # 0x25420
leaq 0x6c68(%rip), %rsi      # 0x10362
callq 0x31f0
movq %rax, 0x1bd2a(%rip)     # 0x25430
movq 0x1bd13(%rip), %rdi     # 0x25420
leaq 0x6c59(%rip), %rsi      # 0x1036d
callq 0x31f0
movq %rax, 0x1bd18(%rip)     # 0x25438
movq 0x1bcf9(%rip), %rdi     # 0x25420
leaq 0x6c50(%rip), %rsi      # 0x1037e
callq 0x31f0
movq %rax, 0x1bd06(%rip)     # 0x25440
movq 0x1bcdf(%rip), %rdi     # 0x25420
leaq 0x6c42(%rip), %rsi      # 0x1038a
callq 0x31f0
movq %rax, 0x1bcf4(%rip)     # 0x25448
movq 0x1bcc5(%rip), %rdi     # 0x25420
leaq 0x6c31(%rip), %rsi      # 0x10393
callq 0x31f0
movq %rax, 0x1bce2(%rip)     # 0x25450
movq 0x1bcab(%rip), %rdi     # 0x25420
leaq 0x6c20(%rip), %rsi      # 0x1039c
callq 0x31f0
movq %rax, 0x1bcd0(%rip)     # 0x25458
movq 0x1bc91(%rip), %rdi     # 0x25420
leaq 0x6c12(%rip), %rsi      # 0x103a8
callq 0x31f0
movq %rax, 0x1bcbe(%rip)     # 0x25460
movq 0x1bc77(%rip), %rdi     # 0x25420
leaq 0x6c03(%rip), %rsi      # 0x103b3
callq 0x31f0
movq %rax, 0x1bcac(%rip)     # 0x25468
movq 0x1bc5d(%rip), %rdi     # 0x25420
leaq 0x6bf8(%rip), %rsi      # 0x103c2
callq 0x31f0
cmpq $0x0, 0x1bc51(%rip)     # 0x25428
setne %cl
cmpq $0x0, 0x1bc4e(%rip)     # 0x25430
setne %dl
andb %cl, %dl
cmpq $0x0, 0x1bc49(%rip)     # 0x25438
setne %cl
cmpq $0x0, 0x1bc46(%rip)     # 0x25440
setne %sil
andb %cl, %sil
andb %dl, %sil
cmpq $0x0, 0x1bc3c(%rip)     # 0x25448
setne %cl
cmpq $0x0, 0x1bc39(%rip)     # 0x25450
setne %dl
andb %cl, %dl
cmpq $0x0, 0x1bc34(%rip)     # 0x25458
setne %cl
andb %dl, %cl
andb %sil, %cl
cmpq $0x0, 0x1bc2c(%rip)     # 0x25460
setne %dl
cmpq $0x0, 0x1bc29(%rip)     # 0x25468
movq %rax, 0x1bc2a(%rip)     # 0x25470
setne %sil
andb %dl, %sil
testq %rax, %rax
setne %al
andb %sil, %al
andb %cl, %al
cmpb $0x1, %al
jne 0x9869
movb $0x1, 0x1bbb5(%rip)     # 0x25418
movb $0x1, %bl
movl %ebx, %eax
popq %rbx
retq
xorl %ebx, %ebx
jmp 0x9865
nop