;Imports of mac_main:
	extern _Z18Dvar_RegisterFloatPKcffftS0_
	extern _Z16Dvar_RegisterIntPKciiitS0_
	extern _Z19Dvar_RegisterStringPKcS0_tS0_
	extern _Z17Dvar_RegisterBoolPKchtS0_
	extern _Z11IN_Shutdownv
	extern _Z7IN_Initv
	extern _Z11NET_Restartv
	extern _ZN10MacBuilder15QuitModalWindowEP15OpaqueWindowPtrm
	extern _Z13Dvar_SetFloatPK6dvar_sf
	extern _Z11Dvar_SetIntPK6dvar_si
	extern _Z14Dvar_SetStringPK6dvar_sPKc
	extern _Z15Win_LocalizeRefPKc
	extern GetActiveWindow
	extern MessageBoxA
	extern _Z30Sys_InitializeCriticalSectionsv
	extern _Z18Sys_InitMainThreadv
	extern _Z20Win_InitLocalizationv
	extern _Znam
	extern _ZN10MacFolders35GetApplicationSupportFolderItemPathEPKcPci
	extern _Z13Com_InitParsev
	extern _Z9Dvar_Initv
	extern _Z10InitTimingv
	extern _Z15Sys_GetCpuCountv
	extern _Z10Sys_CpuGHzv
	extern _Z18Sys_SystemMemoryMBv
	extern _Z19Sys_DetectVideoCardiPc
	extern _Z15Sys_SupportsSSEv
	extern _Z26Sys_DetectCpuVendorAndNamePcS_
	extern _Z23Sys_SetAutoConfigureGHzP7SysInfo
	extern _Z10I_strncpyzPcPKci
	extern _Z22Sys_CreateSplashWindowv
	extern _Z20Sys_ShowSplashWindowv
	extern _Z21D3DXCompileShaderInitv
	extern _Z16Sys_Millisecondsv
	extern _Z20Sys_InitStreamThreadv
	extern _Z8Com_InitPc
	extern com_dedicated
	extern _getcwd
	extern _Z10Com_PrintfiPKcz
	extern _Z18PbClientInitializePv
	extern _Z18PbServerInitializev
	extern _Z16GetMacGameEnginev
	extern _ZN14CMacGameEngine12SetIsRunningEh
	extern WinSleep
	extern _Z9Com_Framev
	extern _Z21PbServerProcessEventsv
	extern _Z21PbClientProcessEventsv
	extern _Z24Win_ShutdownLocalizationv
	extern _Z12Cbuf_AddTextiPKc
	extern _Z14Com_PrintErroriPKcz
	extern _Z19Com_SetErrorMessagePKc
	extern memcpy
	extern CFURLCreateWithBytes
	extern LSOpenCFURLRef
	extern CFRelease
	extern _Z24Sys_EnterCriticalSection15CriticalSection
	extern _ZN14CMacGameEngine16ProcessAllEventsEv
	extern _Z16Sys_ConsoleInputv
	extern _Z14Com_AllocEventi
	extern _Z24Sys_LeaveCriticalSection15CriticalSection
	extern _Z10Com_Quit_fv
	extern Z_FreeInternal
	extern DeleteFileA
	extern strcmp
	extern GetCurrentScrap
	extern GetScrapFlavorSize
	extern Z_MallocInternal
	extern GetScrapFlavorData
	extern strtok
	extern _Z17R_CheckLostDevicev
	extern UpdateSystemActivity
	extern _Z19AIL_UpdateAllSoundsv
	extern fopen
	extern fread
	extern fclose
	extern fwrite
	extern _ZN10MacBuilder11BuildWindowEPK10__CFStringS2_hPFhP15OpaqueWindowPtrmE
	extern _ZN10MacStrings20TranslateToMacStringEPKc
	extern _ZN10MacBuilder14SetWindowTitleEP15OpaqueWindowPtrPKc
	extern _ZN10MacBuilder14SetControlTextEP15OpaqueWindowPtrlPKc
	extern _ZN10MacBuilder14RunModalWindowEP15OpaqueWindowPtr
	extern _ZN10MacBuilder13ReleaseWindowEP15OpaqueWindowPtr
	extern _Z17Com_ForceSafeModev
	extern exit
	extern _Z11Com_sprintfPciPKcz
	extern clientUIActives
	extern _Z20SCR_UpdateLoadScreenv
	extern timeBeginPeriod
	extern _Z22Cmd_AddCommandInternalPKcPFvvEP14cmd_function_s
	extern timeEndPeriod
	extern _Z12Key_Shutdownv
	extern _Z18Sys_DestroyConsolev
	extern _Z27RefreshQuitOnErrorConditionv
	extern _Z13Dvar_Shutdownv
	extern _Z12Cmd_Shutdownv
	extern _Z12Con_Shutdownv
	extern _Z18Com_ShutdownEventsv
	extern _Z11SL_Shutdownv
	extern _Z20Con_ShutdownChannelsv
	extern _ZN14MacPreferences11SynchronizeEv
	extern _ZN10MacFolders23GetApplicationFolderRefER5FSRef
	extern strstr
	extern _ZN8MacTools15FindApplicationEmRK5FSRefRS0_
	extern _Z2vaPKcz
	extern _Z9Com_Error11errorParm_tPKcz
	extern LSOpenApplication
	extern com_errorEntered
	extern _Z23Sys_SuspendOtherThreadsv
	extern vsnprintf
	extern _Z16Sys_IsMainThreadv
	extern _Z16Sys_SetErrorTextPKc
	extern _Z15Sys_ShowConsolev
	extern _Z17Conbuf_AppendTextPKc
	extern gConsoleRunning
	extern _Z29Conbuf_AppendTextInMainThreadPKc

;Exports of mac_main:
	global sys_cmdline
	global sys_processSemaphoreFile
	global sys_info
	global sys_exitCmdLine
	global sys_configSum
	global sys_gpu
	global sys_sysMB
	global sys_configureGHz
	global _Z21Sys_RegisterInfoDvarsv
	global _Z16Sys_In_Restart_fv
	global _Z17Sys_Net_Restart_fv
	global _ZZ8Sys_InitvE21Sys_Net_Restart_f_VAR
	global _ZZ8Sys_InitvE20Sys_In_Restart_f_VAR
	global _ZZ24Sys_GetSemaphoreFileNamevE18sSemaphoreFileName
	global _Z29Sys_ShouldUpdateForInfoChangev
	global WinMain
	global _Z11Sys_GetInfoP7SysInfo
	global _Z11Sys_OpenURLPKci
	global _Z12Sys_GetEventv
	global _Z12Sys_QueEventi14sysEventType_tiiiPv
	global _Z14Sys_NormalExitv
	global _Z15Sys_ArchiveInfoi
	global _Z18Sys_HasInfoChangedv
	global _Z20Sys_GetClipboardDatav
	global _Z20Sys_LoadingKeepAlivev
	global _Z21Sys_CheckCrashOrRerunv
	global _Z21Sys_DirectXFatalErrorv
	global _Z21Sys_FreeClipboardDataPc
	global _Z23Sys_QuitAndStartProcessPKcS0_
	global _Z25Sys_OutOfMemErrorInternalPKci
	global _Z27Sys_FastFileBlockedCallbackv
	global _Z31Sys_HasConfigureChecksumChangedi
	global _Z8Sys_Initv
	global _Z8Sys_Quitv
	global _Z9Sys_ErrorPKcz
	global _Z9Sys_PrintPKc
	global g_wv
	global eventHead
	global eventQue
	global eventTail
	global sys_SSE


SECTION .text


;Sys_RegisterInfoDvars()
_Z21Sys_RegisterInfoDvarsv:
	push ebp
	mov ebp, esp
	push esi
	push ebx
	sub esp, 0x20
	mov dword [esp+0x14], _cstring_normalized_total
	mov dword [esp+0x10], 0x11
	mov esi, 0x7f7fffff
	mov [esp+0xc], esi
	mov ebx, 0xff7fffff
	mov [esp+0x8], ebx
	mov dword [esp+0x4], 0x0
	mov dword [esp], _cstring_sys_configureghz
	call _Z18Dvar_RegisterFloatPKcffftS0_
	mov [sys_configureGHz], eax
	mov dword [esp+0x14], _cstring_physical_memory_
	mov dword [esp+0x10], 0x11
	mov dword [esp+0xc], 0x7fffffff
	mov dword [esp+0x8], 0x80000000
	mov dword [esp+0x4], 0x0
	mov dword [esp], _cstring_sys_sysmb
	call _Z16Dvar_RegisterIntPKciiitS0_
	mov [sys_sysMB], eax
	mov dword [esp+0xc], _cstring_gpu_description
	mov dword [esp+0x8], 0x11
	mov dword [esp+0x4], _cstring_null
	mov dword [esp], _cstring_sys_gpu
	call _Z19Dvar_RegisterStringPKcS0_tS0_
	mov [sys_gpu], eax
	mov dword [esp+0x14], _cstring_configuration_ch
	mov dword [esp+0x10], 0x11
	mov dword [esp+0xc], 0x7fffffff
	mov dword [esp+0x8], 0x80000000
	mov dword [esp+0x4], 0x0
	mov dword [esp], _cstring_sys_configsum
	call _Z16Dvar_RegisterIntPKciiitS0_
	mov [sys_configSum], eax
	mov dword [esp+0xc], _cstring_operating_system
	mov dword [esp+0x8], 0x40
	movzx eax, byte [sys_info+0x21c]
	mov [esp+0x4], eax
	mov dword [esp], _cstring_sys_sse
	call _Z17Dvar_RegisterBoolPKchtS0_
	mov [sys_SSE], eax
	mov dword [esp+0x14], _cstring_measured_cpu_spe
	mov dword [esp+0x10], 0x40
	mov [esp+0xc], esi
	mov [esp+0x8], ebx
	cvtsd2ss xmm0, [sys_info]
	movss [esp+0x4], xmm0
	mov dword [esp], _cstring_sys_cpughz
	call _Z18Dvar_RegisterFloatPKcffftS0_
	mov dword [esp+0xc], _cstring_cpu_name_descrip
	mov dword [esp+0x8], 0x40
	mov dword [esp+0x4], sys_info+0x22a
	mov dword [esp], _cstring_sys_cpuname
	call _Z19Dvar_RegisterStringPKcS0_tS0_
	add esp, 0x20
	pop ebx
	pop esi
	pop ebp
	ret
	nop


;Sys_In_Restart_f()
_Z16Sys_In_Restart_fv:
	push ebp
	mov ebp, esp
	sub esp, 0x8
	call _Z11IN_Shutdownv
	leave
	jmp _Z7IN_Initv
	nop


;Sys_Net_Restart_f()
_Z17Sys_Net_Restart_fv:
	push ebp
	mov ebp, esp
	pop ebp
	jmp _Z11NET_Restartv
	nop


;BuilderCallback(OpaqueWindowPtr*, unsigned long)
_Z15BuilderCallbackP15OpaqueWindowPtrm:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	mov eax, [ebp+0xc]
	test eax, eax
	jnz _Z15BuilderCallbackP15OpaqueWindowPtrm_10
	leave
	ret
_Z15BuilderCallbackP15OpaqueWindowPtrm_10:
	mov [esp+0x4], eax
	mov eax, [ebp+0x8]
	mov [esp], eax
	call _ZN10MacBuilder15QuitModalWindowEP15OpaqueWindowPtrm
	mov eax, 0x1
	leave
	ret
	nop


;Sys_ShouldUpdateForInfoChange()
_Z29Sys_ShouldUpdateForInfoChangev:
	push ebp
	mov ebp, esp
	push esi
	push ebx
	sub esp, 0x10
	call _Z21Sys_RegisterInfoDvarsv
	cvtsd2ss xmm0, [sys_info+0x8]
	movss [esp+0x4], xmm0
	mov eax, [sys_configureGHz]
	mov [esp], eax
	call _Z13Dvar_SetFloatPK6dvar_sf
	mov eax, [sys_info+0x18]
	mov [esp+0x4], eax
	mov eax, [sys_sysMB]
	mov [esp], eax
	call _Z11Dvar_SetIntPK6dvar_si
	mov dword [esp+0x4], sys_info+0x1c
	mov eax, [sys_gpu]
	mov [esp], eax
	call _Z14Dvar_SetStringPK6dvar_sPKc
	mov dword [esp+0x4], 0x0
	mov eax, [sys_configSum]
	mov [esp], eax
	call _Z11Dvar_SetIntPK6dvar_si
	mov dword [esp], _cstring_win_computer_cha
	call _Z15Win_LocalizeRefPKc
	mov esi, eax
	mov dword [esp], _cstring_win_computer_cha1
	call _Z15Win_LocalizeRefPKc
	mov ebx, eax
	call GetActiveWindow
	mov dword [esp+0xc], 0x44
	mov [esp+0x8], esi
	mov [esp+0x4], ebx
	mov [esp], eax
	call MessageBoxA
	cmp eax, 0x6
	setz al
	movzx eax, al
	add esp, 0x10
	pop ebx
	pop esi
	pop ebp
	ret
	nop


;WinMain
WinMain:
	push ebp
	mov ebp, esp
	push edi
	push esi
	push ebx
	sub esp, 0x11c
	mov esi, [ebp+0x8]
	call _Z30Sys_InitializeCriticalSectionsv
	call _Z18Sys_InitMainThreadv
	call _Z20Win_InitLocalizationv
	mov dword [esp], 0x400
	call _Znam
	mov [sys_processSemaphoreFile], eax
	mov byte [eax], 0x0
	mov dword [esp+0x8], 0x400
	mov [esp+0x4], eax
	mov eax, [_ZZ24Sys_GetSemaphoreFileNamevE18sSemaphoreFileName]
	mov [esp], eax
	call _ZN10MacFolders35GetApplicationSupportFolderItemPathEPKcPci
	call _Z21Sys_CheckCrashOrRerunv
	test eax, eax
	jz WinMain_10
	call _Z13Com_InitParsev
	call _Z9Dvar_Initv
	call _Z10InitTimingv
	call _Z15Sys_GetCpuCountv
	mov [sys_info+0x10], eax
	call _Z10Sys_CpuGHzv
	fstp qword [sys_info]
	call _Z18Sys_SystemMemoryMBv
	mov [sys_info+0x18], eax
	mov dword [esp+0x4], sys_info+0x1c
	mov dword [esp], 0x200
	call _Z19Sys_DetectVideoCardiPc
	call _Z15Sys_SupportsSSEv
	mov [sys_info+0x21c], al
	mov dword [esp+0x4], sys_info+0x22a
	mov dword [esp], sys_info+0x21d
	call _Z26Sys_DetectCpuVendorAndNamePcS_
	mov dword [esp], sys_info
	call _Z23Sys_SetAutoConfigureGHzP7SysInfo
	mov [g_wv+0xc], esi
	mov dword [esp+0x8], 0x400
	mov eax, [ebp+0x10]
	mov [esp+0x4], eax
	mov dword [esp], sys_cmdline
	call _Z10I_strncpyzPcPKci
	call _Z22Sys_CreateSplashWindowv
	call _Z20Sys_ShowSplashWindowv
	call _Z21D3DXCompileShaderInitv
	call _Z16Sys_Millisecondsv
	call _Z20Sys_InitStreamThreadv
	mov dword [esp], sys_cmdline
	call _Z8Com_InitPc
	mov edi, com_dedicated
	mov eax, [edi]
	mov eax, [eax+0xc]
	test eax, eax
	jz WinMain_20
WinMain_110:
	mov dword [esp+0x4], 0x100
	lea ebx, [ebp-0x118]
	mov [esp], ebx
	call _getcwd
	mov [esp+0x8], ebx
	mov dword [esp+0x4], _cstring_working_director
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov eax, [edi]
	test eax, eax
	jz WinMain_30
	mov edi, [eax+0xc]
	test edi, edi
	jnz WinMain_40
WinMain_30:
	mov [esp], esi
	call _Z18PbClientInitializePv
	test al, al
	jz WinMain_50
WinMain_40:
	call _Z18PbServerInitializev
	test al, al
	jz WinMain_60
WinMain_120:
	call _Z16GetMacGameEnginev
	mov dword [esp+0x4], 0x1
	mov [esp], eax
	call _ZN14CMacGameEngine12SetIsRunningEh
	mov ebx, com_dedicated
WinMain_100:
	mov esi, [g_wv+0x14]
	test esi, esi
	jnz WinMain_70
	mov eax, [ebx]
	test eax, eax
	jz WinMain_80
	mov ecx, [eax+0xc]
	test ecx, ecx
	jz WinMain_80
WinMain_70:
	mov dword [esp], 0x5
	call WinSleep
WinMain_80:
	call _Z9Com_Framev
	mov eax, [ebx]
	test eax, eax
	jz WinMain_90
	mov edx, [eax+0xc]
	test edx, edx
	jz WinMain_90
	call _Z21PbServerProcessEventsv
	jmp WinMain_100
WinMain_90:
	call _Z21PbClientProcessEventsv
	call _Z21PbServerProcessEventsv
	jmp WinMain_100
WinMain_10:
	call _Z24Win_ShutdownLocalizationv
	xor eax, eax
	add esp, 0x11c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret
WinMain_20:
	mov dword [esp+0x4], _cstring_readstats
	mov dword [esp], 0x0
	call _Z12Cbuf_AddTextiPKc
	jmp WinMain_110
WinMain_60:
	mov dword [esp+0x4], _cstring_unable_to_initia
	mov dword [esp], 0x10
	call _Z14Com_PrintErroriPKcz
	mov dword [esp], _cstring_mpui_nopunkbuste
	call _Z19Com_SetErrorMessagePKc
	jmp WinMain_120
WinMain_50:
	mov dword [esp], _cstring_mpui_nopunkbuste
	call _Z19Com_SetErrorMessagePKc
	jmp WinMain_40
	nop


;Sys_GetInfo(SysInfo*)
_Z11Sys_GetInfoP7SysInfo:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	mov dword [esp+0x8], 0x25c
	mov dword [esp+0x4], sys_info
	mov eax, [ebp+0x8]
	mov [esp], eax
	call memcpy
	leave
	ret
	nop


;Sys_OpenURL(char const*, int)
_Z11Sys_OpenURLPKci:
	push ebp
	mov ebp, esp
	push edi
	push esi
	push ebx
	sub esp, 0x2c
	mov esi, [ebp+0x8]
	mov ebx, [ebp+0xc]
	mov dword [esp+0x10], 0x0
	mov dword [esp+0xc], 0x0
	cld
	mov ecx, 0xffffffff
	xor eax, eax
	mov edi, esi
	repne scasb
	not ecx
	sub ecx, 0x1
	mov [esp+0x8], ecx
	mov [esp+0x4], esi
	mov dword [esp], 0x0
	call CFURLCreateWithBytes
	mov edi, eax
	test eax, eax
	jz _Z11Sys_OpenURLPKci_10
	mov dword [esp+0x4], 0x0
	mov [esp], eax
	call LSOpenCFURLRef
	test eax, eax
	jz _Z11Sys_OpenURLPKci_20
_Z11Sys_OpenURLPKci_30:
	mov [ebp+0x8], edi
	add esp, 0x2c
	pop ebx
	pop esi
	pop edi
	pop ebp
	jmp CFRelease
_Z11Sys_OpenURLPKci_20:
	test ebx, ebx
	jz _Z11Sys_OpenURLPKci_30
	mov dword [esp+0x4], _cstring_quit
	mov dword [esp], 0x0
	call _Z12Cbuf_AddTextiPKc
	mov [ebp+0x8], edi
	add esp, 0x2c
	pop ebx
	pop esi
	pop edi
	pop ebp
	jmp CFRelease
_Z11Sys_OpenURLPKci_10:
	add esp, 0x2c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret


;Sys_GetEvent()
_Z12Sys_GetEventv:
	push ebp
	mov ebp, esp
	push edi
	push esi
	push ebx
	sub esp, 0x5c
	mov dword [esp], 0x7
	call _Z24Sys_EnterCriticalSection15CriticalSection
	mov edx, [eventTail]
	cmp [eventHead], edx
	jg _Z12Sys_GetEventv_10
	call _ZN14CMacGameEngine16ProcessAllEventsEv
	test al, al
	jnz _Z12Sys_GetEventv_20
	call _Z16Sys_ConsoleInputv
	mov [ebp-0x3c], eax
	test eax, eax
	jz _Z12Sys_GetEventv_30
_Z12Sys_GetEventv_60:
	mov edi, eax
	cld
	mov ecx, 0xffffffff
	xor eax, eax
	repne scasb
	mov ebx, ecx
	not ebx
	lea edi, [ebx-0x1]
	mov [esp], ebx
	call _Z14Com_AllocEventi
	mov esi, eax
	mov [esp+0x8], edi
	mov eax, [ebp-0x3c]
	mov [esp+0x4], eax
	mov [esp], esi
	call _Z10I_strncpyzPcPKci
	mov [esp+0x14], esi
	mov [esp+0x10], ebx
	mov dword [esp+0xc], 0x0
	mov dword [esp+0x8], 0x0
	mov dword [esp+0x4], 0x3
	mov dword [esp], 0x0
	call _Z12Sys_QueEventi14sysEventType_tiiiPv
_Z12Sys_GetEventv_30:
	mov edx, [eventTail]
	cmp [eventHead], edx
	jle _Z12Sys_GetEventv_40
_Z12Sys_GetEventv_10:
	lea eax, [edx+0x1]
	mov [eventTail], eax
	movzx eax, dl
	lea eax, [eax+eax*2]
	shl eax, 0x3
	mov edx, [eax+eventQue]
	mov [ebp-0x30], edx
	mov edx, [eax+eventQue+0x4]
	mov [ebp-0x2c], edx
	mov edx, [eax+eventQue+0x8]
	mov [ebp-0x28], edx
	mov edx, [eax+eventQue+0xc]
	mov [ebp-0x24], edx
	mov edx, [eax+eventQue+0x10]
	mov [ebp-0x20], edx
	mov eax, [eax+eventQue+0x14]
	mov [ebp-0x1c], eax
	mov dword [esp], 0x7
	call _Z24Sys_LeaveCriticalSection15CriticalSection
_Z12Sys_GetEventv_50:
	mov eax, [ebp-0x30]
	mov edx, [ebp+0x8]
	mov [edx], eax
	mov eax, [ebp-0x2c]
	mov [edx+0x4], eax
	mov eax, [ebp-0x28]
	mov [edx+0x8], eax
	mov eax, [ebp-0x24]
	mov [edx+0xc], eax
	mov eax, [ebp-0x20]
	mov [edx+0x10], eax
	mov eax, [ebp-0x1c]
	mov [edx+0x14], eax
	mov eax, edx
	add esp, 0x5c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret 0x4
_Z12Sys_GetEventv_40:
	lea edi, [ebp-0x30]
	cld
	mov ecx, 0x6
	xor eax, eax
	rep stosd
	call _Z16Sys_Millisecondsv
	mov [ebp-0x30], eax
	mov dword [esp], 0x7
	call _Z24Sys_LeaveCriticalSection15CriticalSection
	jmp _Z12Sys_GetEventv_50
_Z12Sys_GetEventv_20:
	call _Z10Com_Quit_fv
	call _Z16Sys_ConsoleInputv
	mov [ebp-0x3c], eax
	test eax, eax
	jnz _Z12Sys_GetEventv_60
	jmp _Z12Sys_GetEventv_30


;Sys_QueEvent(int, sysEventType_t, int, int, int, void*)
_Z12Sys_QueEventi14sysEventType_tiiiPv:
	push ebp
	mov ebp, esp
	push edi
	push esi
	push ebx
	sub esp, 0x2c
	mov esi, [ebp+0x8]
	mov edi, [ebp+0xc]
	mov eax, [ebp+0x10]
	mov [ebp-0x1c], eax
	mov eax, [ebp+0x14]
	mov [ebp-0x20], eax
	mov eax, [ebp+0x18]
	mov [ebp-0x24], eax
	mov eax, [ebp+0x1c]
	mov [ebp-0x28], eax
	mov dword [esp], 0x7
	call _Z24Sys_EnterCriticalSection15CriticalSection
	mov edx, [eventHead]
	movzx eax, dl
	lea eax, [eax+eax*2]
	lea ebx, [eax*8+eventQue]
	mov eax, edx
	sub eax, [eventTail]
	cmp eax, 0xff
	jg _Z12Sys_QueEventi14sysEventType_tiiiPv_10
_Z12Sys_QueEventi14sysEventType_tiiiPv_40:
	lea eax, [edx+0x1]
	mov [eventHead], eax
	test esi, esi
	jnz _Z12Sys_QueEventi14sysEventType_tiiiPv_20
	call _Z16Sys_Millisecondsv
	mov esi, eax
_Z12Sys_QueEventi14sysEventType_tiiiPv_20:
	mov [ebx], esi
	mov [ebx+0x4], edi
	mov eax, [ebp-0x1c]
	mov [ebx+0x8], eax
	mov eax, [ebp-0x20]
	mov [ebx+0xc], eax
	mov eax, [ebp-0x24]
	mov [ebx+0x10], eax
	mov eax, [ebp-0x28]
	mov [ebx+0x14], eax
	mov dword [ebp+0x8], 0x7
	add esp, 0x2c
	pop ebx
	pop esi
	pop edi
	pop ebp
	jmp _Z24Sys_LeaveCriticalSection15CriticalSection
_Z12Sys_QueEventi14sysEventType_tiiiPv_10:
	mov dword [esp+0x4], _cstring_sys_queevent_ove
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov eax, [ebx+0x14]
	test eax, eax
	jz _Z12Sys_QueEventi14sysEventType_tiiiPv_30
	mov [esp], eax
	call Z_FreeInternal
_Z12Sys_QueEventi14sysEventType_tiiiPv_30:
	add dword [eventTail], 0x1
	mov edx, [eventHead]
	jmp _Z12Sys_QueEventi14sysEventType_tiiiPv_40


;Sys_NormalExit()
_Z14Sys_NormalExitv:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	mov eax, [sys_processSemaphoreFile]
	mov [esp], eax
	call DeleteFileA
	leave
	ret
	nop


;Sys_ArchiveInfo(int)
_Z15Sys_ArchiveInfoi:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	call _Z21Sys_RegisterInfoDvarsv
	cvtsd2ss xmm0, [sys_info+0x8]
	movss [esp+0x4], xmm0
	mov eax, [sys_configureGHz]
	mov [esp], eax
	call _Z13Dvar_SetFloatPK6dvar_sf
	mov eax, [sys_info+0x18]
	mov [esp+0x4], eax
	mov eax, [sys_sysMB]
	mov [esp], eax
	call _Z11Dvar_SetIntPK6dvar_si
	mov dword [esp+0x4], sys_info+0x1c
	mov eax, [sys_gpu]
	mov [esp], eax
	call _Z14Dvar_SetStringPK6dvar_sPKc
	mov eax, [ebp+0x8]
	mov [esp+0x4], eax
	mov eax, [sys_configSum]
	mov [esp], eax
	call _Z11Dvar_SetIntPK6dvar_si
	leave
	ret
	nop


;Sys_HasInfoChanged()
_Z18Sys_HasInfoChangedv:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	call _Z21Sys_RegisterInfoDvarsv
	mov eax, [sys_configureGHz]
	cvtss2sd xmm2, [eax+0xc]
	movsd xmm1, qword [sys_info+0x8]
	movapd xmm0, xmm1
	mulsd xmm0, [_double_1_10000002]
	ucomisd xmm2, xmm0
	ja _Z18Sys_HasInfoChangedv_10
	mulsd xmm1, [_double_0_89999998]
	ucomisd xmm1, xmm2
	ja _Z18Sys_HasInfoChangedv_10
	mov eax, [sys_sysMB]
	mov ecx, [eax+0xc]
	mov edx, [sys_info+0x18]
	lea eax, [edx+0x20]
	cmp ecx, eax
	jg _Z18Sys_HasInfoChangedv_10
	lea eax, [edx-0x20]
	cmp ecx, eax
	jge _Z18Sys_HasInfoChangedv_20
_Z18Sys_HasInfoChangedv_10:
	call _Z29Sys_ShouldUpdateForInfoChangev
	movzx eax, al
	leave
	ret
_Z18Sys_HasInfoChangedv_20:
	mov dword [esp+0x4], sys_info+0x1c
	mov eax, [sys_gpu]
	mov eax, [eax+0xc]
	mov [esp], eax
	call strcmp
	test eax, eax
	jnz _Z18Sys_HasInfoChangedv_10
	leave
	ret
	add [eax], al


;Sys_GetClipboardData()
_Z20Sys_GetClipboardDatav:
	push ebp
	mov ebp, esp
	push esi
	push ebx
	sub esp, 0x20
	lea eax, [ebp-0xc]
	mov [esp], eax
	call GetCurrentScrap
	test eax, eax
	jz _Z20Sys_GetClipboardDatav_10
_Z20Sys_GetClipboardDatav_20:
	xor ebx, ebx
_Z20Sys_GetClipboardDatav_40:
	mov eax, ebx
	add esp, 0x20
	pop ebx
	pop esi
	pop ebp
	ret
_Z20Sys_GetClipboardDatav_10:
	lea esi, [ebp-0x10]
	mov [esp+0x8], esi
	mov dword [esp+0x4], 0x54455854
	mov eax, [ebp-0xc]
	mov [esp], eax
	call GetScrapFlavorSize
	test eax, eax
	jnz _Z20Sys_GetClipboardDatav_20
	mov eax, [ebp-0x10]
	test eax, eax
	jle _Z20Sys_GetClipboardDatav_20
	add eax, 0x1
	mov [esp], eax
	call Z_MallocInternal
	mov ebx, eax
	mov [esp+0xc], eax
	mov [esp+0x8], esi
	mov dword [esp+0x4], 0x54455854
	mov eax, [ebp-0xc]
	mov [esp], eax
	call GetScrapFlavorData
	test eax, eax
	jnz _Z20Sys_GetClipboardDatav_30
	mov eax, [ebp-0x10]
	mov byte [ebx+eax], 0x0
	mov dword [esp+0x4], _cstring_
	mov [esp], ebx
	call strtok
	jmp _Z20Sys_GetClipboardDatav_40
_Z20Sys_GetClipboardDatav_30:
	mov [esp], ebx
	call Z_FreeInternal
	xor ebx, ebx
	jmp _Z20Sys_GetClipboardDatav_40


;Sys_LoadingKeepAlive()
_Z20Sys_LoadingKeepAlivev:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	call _Z17R_CheckLostDevicev
	mov dword [esp], 0x0
	call UpdateSystemActivity
	leave
	jmp _Z19AIL_UpdateAllSoundsv
	nop


;Sys_CheckCrashOrRerun()
_Z21Sys_CheckCrashOrRerunv:
	push ebp
	mov ebp, esp
	push edi
	push esi
	push ebx
	sub esp, 0x4c
	mov eax, [sys_processSemaphoreFile]
	test eax, eax
	jz _Z21Sys_CheckCrashOrRerunv_10
	cmp byte [eax], 0x0
	jnz _Z21Sys_CheckCrashOrRerunv_20
_Z21Sys_CheckCrashOrRerunv_10:
	mov eax, 0x1
_Z21Sys_CheckCrashOrRerunv_70:
	add esp, 0x4c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret
_Z21Sys_CheckCrashOrRerunv_20:
	mov dword [esp+0x4], _cstring_rb
	mov [esp], eax
	call fopen
	mov esi, eax
	test eax, eax
	jz _Z21Sys_CheckCrashOrRerunv_30
	mov [esp+0xc], eax
	mov dword [esp+0x8], 0x21
	mov dword [esp+0x4], 0x1
	lea ebx, [ebp-0x39]
	mov [esp], ebx
	call fread
	cmp eax, 0x21
	jz _Z21Sys_CheckCrashOrRerunv_40
	mov [esp], esi
	call fclose
_Z21Sys_CheckCrashOrRerunv_30:
	mov dword [esp+0x4], _cstring_wb
	mov eax, [sys_processSemaphoreFile]
	mov [esp], eax
	call fopen
	mov esi, eax
	test eax, eax
	jz _Z21Sys_CheckCrashOrRerunv_10
	mov [esp+0xc], eax
	mov dword [esp+0x8], 0x21
	mov dword [esp+0x4], 0x1
	mov dword [esp], _cstring_0c65b5a5399d11dc
	call fwrite
	mov [esp], esi
	call fclose
	mov eax, 0x1
	add esp, 0x4c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret
_Z21Sys_CheckCrashOrRerunv_40:
	mov [esp], esi
	call fclose
	mov edi, _cstring_0c65b5a5399d11dc
	mov ecx, 0x21
	cld
	mov esi, ebx
	repe cmpsb
	mov edx, 0x0
	jz _Z21Sys_CheckCrashOrRerunv_50
	movzx edx, byte [esi-0x1]
	movzx ecx, byte [edi-0x1]
	sub edx, ecx
_Z21Sys_CheckCrashOrRerunv_50:
	test edx, edx
	jnz _Z21Sys_CheckCrashOrRerunv_10
	mov dword [esp+0xc], _Z15BuilderCallbackP15OpaqueWindowPtrm
	mov dword [esp+0x8], 0x1
	mov dword [esp+0x4], _cfstring_game
	mov dword [esp], _cfstring_safemode
	call _ZN10MacBuilder11BuildWindowEPK10__CFStringS2_hPFhP15OpaqueWindowPtrmE
	mov esi, eax
	test eax, eax
	jz _Z21Sys_CheckCrashOrRerunv_30
	mov dword [esp], _cstring_win_improper_qui
	call _Z15Win_LocalizeRefPKc
	mov [esp], eax
	call _ZN10MacStrings20TranslateToMacStringEPKc
	mov [esp+0x4], eax
	mov [esp], esi
	call _ZN10MacBuilder14SetWindowTitleEP15OpaqueWindowPtrPKc
	mov dword [esp], _cstring_win_improper_qui1
	call _Z15Win_LocalizeRefPKc
	mov [esp], eax
	call _ZN10MacStrings20TranslateToMacStringEPKc
	mov [esp+0x8], eax
	mov dword [esp+0x4], 0x1
	mov [esp], esi
	call _ZN10MacBuilder14SetControlTextEP15OpaqueWindowPtrlPKc
	mov [esp], esi
	call _ZN10MacBuilder14RunModalWindowEP15OpaqueWindowPtr
	mov ebx, eax
	mov [esp], esi
	call _ZN10MacBuilder13ReleaseWindowEP15OpaqueWindowPtr
	cmp ebx, 0x5965735f
	jz _Z21Sys_CheckCrashOrRerunv_60
	cmp ebx, 0x4e6f5f5f
	jz _Z21Sys_CheckCrashOrRerunv_30
	cmp ebx, 0x51756974
	jnz _Z21Sys_CheckCrashOrRerunv_30
	xor eax, eax
	jmp _Z21Sys_CheckCrashOrRerunv_70
_Z21Sys_CheckCrashOrRerunv_60:
	call _Z17Com_ForceSafeModev
	jmp _Z21Sys_CheckCrashOrRerunv_30
	nop


;Sys_DirectXFatalError()
_Z21Sys_DirectXFatalErrorv:
	push ebp
	mov ebp, esp
	push esi
	push ebx
	sub esp, 0x10
	mov dword [esp], 0x9
	call _Z24Sys_EnterCriticalSection15CriticalSection
	mov dword [esp], _cstring_win_directx_init
	call _Z15Win_LocalizeRefPKc
	mov esi, eax
	mov dword [esp], _cstring_win_directx_init1
	call _Z15Win_LocalizeRefPKc
	mov ebx, eax
	call GetActiveWindow
	mov dword [esp+0xc], 0x10
	mov [esp+0x8], esi
	mov [esp+0x4], ebx
	mov [esp], eax
	call MessageBoxA
	mov dword [esp], 0xffffffff
	call exit
	nop


;Sys_FreeClipboardData(char*)
_Z21Sys_FreeClipboardDataPc:
	push ebp
	mov ebp, esp
	pop ebp
	jmp Z_FreeInternal
	nop
	add [eax], al


;Sys_QuitAndStartProcess(char const*, char const*)
_Z23Sys_QuitAndStartProcessPKcS0_:
	push ebp
	mov ebp, esp
	sub esp, 0x138
	mov byte [ebp-0x10c], 0x0
	mov eax, [ebp+0x8]
	mov [esp+0x10], eax
	lea eax, [ebp-0x10c]
	mov [esp+0xc], eax
	mov dword [esp+0x8], _cstring_ss
	mov dword [esp+0x4], 0x400
	mov dword [esp], sys_exitCmdLine
	call _Z11Com_sprintfPciPKcz
	mov dword [esp+0x4], _cstring_quit
	mov dword [esp], 0x0
	call _Z12Cbuf_AddTextiPKc
	leave
	ret
	nop


;Sys_OutOfMemErrorInternal(char const*, int)
_Z25Sys_OutOfMemErrorInternalPKci:
	push ebp
	mov ebp, esp
	push esi
	push ebx
	sub esp, 0x10
	mov dword [esp], 0x9
	call _Z24Sys_EnterCriticalSection15CriticalSection
	mov eax, [ebp+0xc]
	mov [esp+0xc], eax
	mov eax, [ebp+0x8]
	mov [esp+0x8], eax
	mov dword [esp+0x4], _cstring_out_of_memory_fi
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov dword [esp], _cstring_win_out_of_mem_t
	call _Z15Win_LocalizeRefPKc
	mov esi, eax
	mov dword [esp], _cstring_win_out_of_mem_b
	call _Z15Win_LocalizeRefPKc
	mov ebx, eax
	call GetActiveWindow
	mov dword [esp+0xc], 0x10
	mov [esp+0x8], esi
	mov [esp+0x4], ebx
	mov [esp], eax
	call MessageBoxA
	mov dword [esp], 0xffffffff
	call exit
	nop


;Sys_FastFileBlockedCallback()
_Z27Sys_FastFileBlockedCallbackv:
	push ebp
	mov ebp, esp
	sub esp, 0x18
	mov eax, clientUIActives
	cmp dword [eax+0xc], 0x7
	jz _Z27Sys_FastFileBlockedCallbackv_10
	call _Z17R_CheckLostDevicev
	mov dword [esp], 0x0
	call UpdateSystemActivity
	leave
	jmp _Z19AIL_UpdateAllSoundsv
_Z27Sys_FastFileBlockedCallbackv_10:
	leave
	jmp _Z20SCR_UpdateLoadScreenv


;Sys_HasConfigureChecksumChanged(int)
_Z31Sys_HasConfigureChecksumChangedi:
	push ebp
	mov ebp, esp
	push edi
	push esi
	push ebx
	sub esp, 0x1c
	mov edi, [ebp+0x8]
	call _Z21Sys_RegisterInfoDvarsv
	mov edx, [sys_configSum]
	mov eax, [edx+0xc]
	test eax, eax
	jnz _Z31Sys_HasConfigureChecksumChangedi_10
	xor ebx, ebx
_Z31Sys_HasConfigureChecksumChangedi_40:
	mov [esp+0x4], edi
	mov [esp], edx
	call _Z11Dvar_SetIntPK6dvar_si
_Z31Sys_HasConfigureChecksumChangedi_50:
	mov eax, ebx
	add esp, 0x1c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret
_Z31Sys_HasConfigureChecksumChangedi_10:
	cmp eax, edi
	jz _Z31Sys_HasConfigureChecksumChangedi_20
	mov dword [esp], _cstring_win_configure_up
	call _Z15Win_LocalizeRefPKc
	mov esi, eax
	mov dword [esp], _cstring_win_configure_up1
	call _Z15Win_LocalizeRefPKc
	mov ebx, eax
	call GetActiveWindow
	mov dword [esp+0xc], 0x44
	mov [esp+0x8], esi
	mov [esp+0x4], ebx
	mov [esp], eax
	call MessageBoxA
	cmp eax, 0x6
	setz al
	mov edx, [sys_configSum]
	mov ecx, [edx+0xc]
	test ecx, ecx
	jnz _Z31Sys_HasConfigureChecksumChangedi_30
	movzx ebx, al
	jmp _Z31Sys_HasConfigureChecksumChangedi_40
_Z31Sys_HasConfigureChecksumChangedi_20:
	xor ebx, ebx
	mov eax, ebx
	add esp, 0x1c
	pop ebx
	pop esi
	pop edi
	pop ebp
	ret
_Z31Sys_HasConfigureChecksumChangedi_30:
	movzx ebx, al
	cmp edi, ecx
	jnz _Z31Sys_HasConfigureChecksumChangedi_40
	jmp _Z31Sys_HasConfigureChecksumChangedi_50


;Sys_Init()
_Z8Sys_Initv:
	push ebp
	mov ebp, esp
	push esi
	push ebx
	sub esp, 0x10
	mov dword [esp], 0x1
	call timeBeginPeriod
	mov dword [esp+0x8], _ZZ8Sys_InitvE20Sys_In_Restart_f_VAR
	mov dword [esp+0x4], _Z16Sys_In_Restart_fv
	mov dword [esp], _cstring_in_restart
	call _Z22Cmd_AddCommandInternalPKcPFvvEP14cmd_function_s
	mov dword [esp+0x8], _ZZ8Sys_InitvE21Sys_Net_Restart_f_VAR
	mov dword [esp+0x4], _Z17Sys_Net_Restart_fv
	mov dword [esp], _cstring_net_restart
	call _Z22Cmd_AddCommandInternalPKcPFvvEP14cmd_function_s
	mov dword [esp+0x8], sys_info+0x21d
	mov dword [esp+0x4], _cstring_cpu_vendor_is_s
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov dword [esp+0x8], sys_info+0x22a
	mov dword [esp+0x4], _cstring_cpu_name_is_s
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov edx, [sys_info+0x10]
	mov ebx, _cstring_s
	mov esi, _cstring_null
	cmp edx, 0x1
	mov eax, esi
	cmovnz eax, ebx
	mov [esp+0xc], eax
	mov [esp+0x8], edx
	mov dword [esp+0x4], _cstring_i_logical_cpus_r
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov eax, [sys_info+0x14]
	cmp eax, 0x1
	cmovz ebx, esi
	mov [esp+0xc], ebx
	mov [esp+0x8], eax
	mov dword [esp+0x4], _cstring_i_physical_cpus_
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	movsd xmm0, qword [sys_info]
	movsd [esp+0x8], xmm0
	mov dword [esp+0x4], _cstring_measured_cpu_spe1
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	movsd xmm0, qword [sys_info+0x8]
	movsd [esp+0x8], xmm0
	mov dword [esp+0x4], _cstring_total_cpu_perfor
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov eax, [sys_info+0x18]
	mov [esp+0x8], eax
	mov dword [esp+0x4], _cstring_system_memory_is
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov dword [esp+0x8], sys_info+0x1c
	mov dword [esp+0x4], _cstring_video_card_is_s
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	cmp byte [sys_info+0x21c], 0x0
	mov eax, _cstring_not_
	cmovz esi, eax
	mov [esp+0x8], esi
	mov dword [esp+0x4], _cstring_streaming_simd_e
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	mov dword [esp+0x4], _cstring_1
	mov dword [esp], 0x10
	call _Z10Com_PrintfiPKcz
	add esp, 0x10
	pop ebx
	pop esi
	pop ebp
	jmp _Z7IN_Initv
	add [eax], al


;Sys_Quit()
_Z8Sys_Quitv:
	push ebp
	mov ebp, esp
	push ebx
	sub esp, 0x84
	mov dword [esp], 0x2
	call _Z24Sys_EnterCriticalSection15CriticalSection
	mov dword [esp], 0x1
	call timeEndPeriod
	cmp byte [sys_exitCmdLine], 0x0
	jnz _Z8Sys_Quitv_10
_Z8Sys_Quitv_80:
	call _Z11IN_Shutdownv
	call _Z12Key_Shutdownv
	call _Z18Sys_DestroyConsolev
	mov eax, [sys_processSemaphoreFile]
	mov [esp], eax
	call DeleteFileA
	call _Z24Win_ShutdownLocalizationv
	call _Z27RefreshQuitOnErrorConditionv
	call _Z13Dvar_Shutdownv
	call _Z12Cmd_Shutdownv
	call _Z12Con_Shutdownv
	call _Z18Com_ShutdownEventsv
	mov dword [esp], 0x7
	call _Z24Sys_EnterCriticalSection15CriticalSection
_Z8Sys_Quitv_30:
	mov edx, [eventTail]
	cmp [eventHead], edx
	jle _Z8Sys_Quitv_20
_Z8Sys_Quitv_40:
	lea eax, [edx+0x1]
	mov [eventTail], eax
	movzx eax, dl
	lea eax, [eax+eax*2]
	mov eax, [eax*8+eventQue+0x14]
	test eax, eax
	jz _Z8Sys_Quitv_30
	mov [esp], eax
	call Z_FreeInternal
	mov edx, [eventTail]
	cmp [eventHead], edx
	jg _Z8Sys_Quitv_40
_Z8Sys_Quitv_20:
	mov dword [esp], 0x7
	call _Z24Sys_LeaveCriticalSection15CriticalSection
	call _Z11SL_Shutdownv
	call _Z20Con_ShutdownChannelsv
	call _ZN14MacPreferences11SynchronizeEv
	mov dword [esp], 0x0
	call exit
_Z8Sys_Quitv_10:
	lea ebx, [ebp-0x74]
	mov [esp], ebx
	call _ZN10MacFolders23GetApplicationFolderRefER5FSRef
	test eax, eax
	jnz _Z8Sys_Quitv_50
	mov dword [esp+0x4], _cstring_3sp
	mov dword [esp], sys_exitCmdLine
	call strstr
	test eax, eax
	jz _Z8Sys_Quitv_60
	mov [esp+0x8], ebx
	mov [esp+0x4], ebx
	mov dword [esp], 0x43443453
	call _ZN8MacTools15FindApplicationEmRK5FSRefRS0_
_Z8Sys_Quitv_100:
	test al, al
	jnz _Z8Sys_Quitv_70
_Z8Sys_Quitv_90:
	mov eax, 0xffffffd5
_Z8Sys_Quitv_50:
	mov [esp+0x8], eax
	mov dword [esp+0x4], sys_exitCmdLine
	mov dword [esp], _cstring_exe_err_couldnt_
	call _Z2vaPKcz
	mov [esp+0x4], eax
	mov dword [esp], 0x2
	call _Z9Com_Error11errorParm_tPKcz
	jmp _Z8Sys_Quitv_80
_Z8Sys_Quitv_70:
	mov dword [ebp-0x24], 0x0
	mov dword [ebp-0x20], 0x100
	mov [ebp-0x1c], ebx
	mov dword [ebp-0x18], 0x0
	mov dword [ebp-0x14], 0x0
	mov dword [ebp-0x10], 0x0
	mov dword [ebp-0xc], 0x0
	mov dword [esp+0x4], 0x0
	lea eax, [ebp-0x24]
	mov [esp], eax
	call LSOpenApplication
	test eax, eax
	jnz _Z8Sys_Quitv_50
	jmp _Z8Sys_Quitv_80
_Z8Sys_Quitv_60:
	mov dword [esp+0x4], _cstring_3mp
	mov dword [esp], sys_exitCmdLine
	call strstr
	test eax, eax
	jz _Z8Sys_Quitv_90
	mov [esp+0x8], ebx
	mov [esp+0x4], ebx
	mov dword [esp], 0x4344344d
	call _ZN8MacTools15FindApplicationEmRK5FSRefRS0_
	jmp _Z8Sys_Quitv_100


;Sys_Error(char const*, ...)
_Z9Sys_ErrorPKcz:
	push ebp
	mov ebp, esp
	push ebx
	sub esp, 0x1024
	mov dword [esp], 0x2
	call _Z24Sys_EnterCriticalSection15CriticalSection
	mov eax, com_errorEntered
	mov dword [eax], 0x1
	call _Z23Sys_SuspendOtherThreadsv
	lea eax, [ebp+0xc]
	mov [ebp-0xc], eax
	mov [esp+0xc], eax
	mov eax, [ebp+0x8]
	mov [esp+0x8], eax
	mov dword [esp+0x4], 0x1000
	lea ebx, [ebp-0x100c]
	mov [esp], ebx
	call vsnprintf
	mov eax, com_dedicated
	mov eax, [eax]
	mov eax, [eax+0xc]
	test eax, eax
	jz _Z9Sys_ErrorPKcz_10
	call _Z16Sys_IsMainThreadv
	test al, al
	jnz _Z9Sys_ErrorPKcz_20
_Z9Sys_ErrorPKcz_10:
	mov [esp], ebx
	call _Z16Sys_SetErrorTextPKc
	mov dword [esp], 0x0
	call exit
_Z9Sys_ErrorPKcz_20:
	call _Z15Sys_ShowConsolev
	mov dword [esp], _cstring_2
	call _Z17Conbuf_AppendTextPKc
	mov [esp], ebx
	call _Z17Conbuf_AppendTextPKc
	mov dword [esp], _cstring_1
	call _Z17Conbuf_AppendTextPKc
	mov [esp], ebx
	call _Z16Sys_SetErrorTextPKc
	mov ebx, gConsoleRunning
_Z9Sys_ErrorPKcz_40:
	call _ZN14CMacGameEngine16ProcessAllEventsEv
	test al, al
	jnz _Z9Sys_ErrorPKcz_30
	cmp byte [ebx], 0x0
	jnz _Z9Sys_ErrorPKcz_40
_Z9Sys_ErrorPKcz_30:
	mov dword [esp], 0x0
	call exit
	nop


;Sys_Print(char const*)
_Z9Sys_PrintPKc:
	push ebp
	mov ebp, esp
	pop ebp
	jmp _Z29Conbuf_AppendTextInMainThreadPKc
	nop


;Initialized global or static variables of mac_main:
SECTION .data
_ZZ24Sys_GetSemaphoreFileNamevE18sSemaphoreFileName: dd _cstring_cod4mp, 0x0, 0x0, 0x0, 0x0, 0x0
eventHead: dd 0x0
eventTail: dd 0x0


;Initialized constant data of mac_main:
SECTION .rdata


;Zero initialized global or static variables of mac_main:
SECTION .bss
sys_cmdline: resb 0x400
sys_processSemaphoreFile: resb 0x20
sys_info: resb 0x260
sys_exitCmdLine: resb 0x400
sys_configSum: resb 0x4
sys_gpu: resb 0x4
sys_sysMB: resb 0x4
sys_configureGHz: resb 0x4
_ZZ8Sys_InitvE21Sys_Net_Restart_f_VAR: resb 0x14
_ZZ8Sys_InitvE20Sys_In_Restart_f_VAR: resb 0x5c
g_wv: resb 0x20
eventQue: resb 0x1800
sys_SSE: resb 0x60


;All CFStrings:

STRUC CFString
.isa: RESD 1
.flags: RESD 1
.str: RESD 1
.length: RESD 1
ENDSTRUC

SECTION .rdata
_cfstring_game:		ISTRUCT CFString
AT CFString.isa, dd 0
AT CFString.flags, dd 0x7c8
AT CFString.str dd _cstring_game
AT CFString.length dd 4
IEND

_cfstring_safemode:		ISTRUCT CFString
AT CFString.isa, dd 0
AT CFString.flags, dd 0x7c8
AT CFString.str dd _cstring_safemode
AT CFString.length dd 8
IEND




;All cstrings:
SECTION .rdata
_cstring_normalized_total:		db "Normalized total CPU power, based on cpu type, count, and speed; used in autoconfigure",0
_cstring_sys_configureghz:		db "sys_configureGHz",0
_cstring_physical_memory_:		db "Physical memory in the system",0
_cstring_sys_sysmb:		db "sys_sysMB",0
_cstring_gpu_description:		db "GPU description",0
_cstring_null:		db 0
_cstring_sys_gpu:		db "sys_gpu",0
_cstring_configuration_ch:		db "Configuration checksum",0
_cstring_sys_configsum:		db "sys_configSum",0
_cstring_operating_system:		db "Operating system allows Streaming SIMD Extensions",0
_cstring_sys_sse:		db "sys_SSE",0
_cstring_measured_cpu_spe:		db "Measured CPU speed",0
_cstring_sys_cpughz:		db "sys_cpuGHz",0
_cstring_cpu_name_descrip:		db "CPU name description",0
_cstring_sys_cpuname:		db "sys_cpuName",0
_cstring_win_computer_cha:		db "WIN_COMPUTER_CHANGE_TITLE",0
_cstring_win_computer_cha1:		db "WIN_COMPUTER_CHANGE_BODY",0
_cstring_working_director:		db "Working directory: %s",0ah,0
_cstring_readstats:		db "readStats",0ah,0
_cstring_unable_to_initia:		db "Unable to initialize punkbuster.  Punkbuster is disabled",0ah,0
_cstring_mpui_nopunkbuste:		db "MPUI_NOPUNKBUSTER",0
_cstring_quit:		db "quit",0ah,0
_cstring_sys_queevent_ove:		db "Sys_QueEvent: overflow",0ah,0
_cstring_:		db 0ah,0dh,008h,0
_cstring_rb:		db "rb",0
_cstring_wb:		db "wb",0
_cstring_0c65b5a5399d11dc:		db "0C65B5A5399D11DCA265000A95675086",0
_cstring_win_improper_qui:		db "WIN_IMPROPER_QUIT_TITLE",0
_cstring_win_improper_qui1:		db "WIN_IMPROPER_QUIT_BODY",0
_cstring_win_directx_init:		db "WIN_DIRECTX_INIT_TITLE",0
_cstring_win_directx_init1:		db "WIN_DIRECTX_INIT_BODY",0
_cstring_ss:		db 22h,"%s",5ch,"%s",22h,0
_cstring_out_of_memory_fi:		db "Out of memory: filename ",27h,"%s",27h,", line %d",0ah,0
_cstring_win_out_of_mem_t:		db "WIN_OUT_OF_MEM_TITLE",0
_cstring_win_out_of_mem_b:		db "WIN_OUT_OF_MEM_BODY",0
_cstring_win_configure_up:		db "WIN_CONFIGURE_UPDATED_TITLE",0
_cstring_win_configure_up1:		db "WIN_CONFIGURE_UPDATED_BODY",0
_cstring_in_restart:		db "in_restart",0
_cstring_net_restart:		db "net_restart",0
_cstring_cpu_vendor_is_s:		db "CPU vendor is ",22h,"%s",22h,0ah,0
_cstring_cpu_name_is_s:		db "CPU name is ",22h,"%s",22h,0ah,0
_cstring_s:		db "s",0
_cstring_i_logical_cpus_r:		db "%i logical CPU%s reported",0ah,0
_cstring_i_physical_cpus_:		db "%i physical CPU%s detected",0ah,0
_cstring_measured_cpu_spe1:		db "Measured CPU speed is %.2lf GHz",0ah,0
_cstring_total_cpu_perfor:		db "Total CPU performance is estimated as %.2lf GHz",0ah,0
_cstring_system_memory_is:		db "System memory is %i MB (capped at 1 GB)",0ah,0
_cstring_video_card_is_s:		db "Video card is ",22h,"%s",22h,0ah,0
_cstring_not_:		db "not ",0
_cstring_streaming_simd_e:		db "Streaming SIMD Extensions (SSE) %ssupported",0ah,0
_cstring_1:		db 0ah,0
_cstring_3sp:		db "3sp",0
_cstring_exe_err_couldnt_:		db "EXE_ERR_COULDNT_START_PROCESS",015h,"%s",0ah,"%08x",0
_cstring_3mp:		db "3mp",0
_cstring_2:		db 0ah,0ah,0
_cstring_cod4mp:		db "CoD4-MP",0
_cstring_game:		db "Game",0
_cstring_safemode:		db "SafeMode",0



;All constant floats and doubles:
SECTION .rdata
_double_1_10000002:		dq 0x3ff19999a0000000	; 1.1
_double_0_89999998:		dq 0x3fecccccc0000000	; 0.9

