	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_check_dinput_hooks             ## -- Begin function check_dinput_hooks
	.p2align	4, 0x90
_check_dinput_hooks:                    ## @check_dinput_hooks
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	callq	_impl_from_IDirectInputDevice8W
	movq	%rax, %rbx
	movq	_dinput_hook_crit@GOTPCREL(%rip), %rdi
	callq	_EnterCriticalSection
	movq	_DISCL_FOREGROUND@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_1
## %bb.2:
	movq	_check_dinput_hooks.foreground_cnt(%rip), %rax
	testq	%r14, %r14
	je	LBB0_4
## %bb.3:
	incq	%rax
	jmp	LBB0_5
LBB0_1:
	movq	_check_dinput_hooks.foreground_cnt(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	decq	%rax
LBB0_5:
	movq	%rax, _check_dinput_hooks.foreground_cnt(%rip)
LBB0_6:
	movq	_check_dinput_hooks.callwndproc_hook(%rip), %rdi
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	testq	%rdi, %rdi
	jne	LBB0_9
## %bb.8:
	movq	_WH_CALLWNDPROC@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_callwndproc_proc@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_DINPUT_instance@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	xorl	%eax, %eax
	callq	_GetCurrentThreadId
	movl	%r14d, %edi
	movl	%r15d, %esi
	movl	%ebx, %edx
	movl	%eax, %ecx
	callq	_SetWindowsHookExW
	jmp	LBB0_12
LBB0_9:
	testq	%rax, %rax
	jne	LBB0_13
## %bb.10:
	testq	%rdi, %rdi
	je	LBB0_13
## %bb.11:
	callq	_UnhookWindowsHookEx
	xorl	%eax, %eax
LBB0_12:
	movq	%rax, _check_dinput_hooks.callwndproc_hook(%rip)
LBB0_13:
	movq	_hook_thread_event@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_15
## %bb.14:
	movq	_INFINITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WaitForSingleObject
	movq	(%rbx), %rdi
	callq	_CloseHandle
	movq	$0, (%rbx)
LBB0_15:
	movq	_hook_thread_id@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_WM_USER@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	$16, %rsi
	movl	$1, %edx
	xorl	%ecx, %ecx
	callq	_PostThreadMessageW
	movq	_dinput_hook_crit@GOTPCREL(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_LeaveCriticalSection           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_check_dinput_hooks.callwndproc_hook,8,3 ## @check_dinput_hooks.callwndproc_hook
.zerofill __DATA,__bss,_check_dinput_hooks.foreground_cnt,8,3 ## @check_dinput_hooks.foreground_cnt
	.comm	_dinput_hook_crit,4,2           ## @dinput_hook_crit
	.comm	_DISCL_FOREGROUND,4,2           ## @DISCL_FOREGROUND
	.comm	_WH_CALLWNDPROC,4,2             ## @WH_CALLWNDPROC
	.comm	_callwndproc_proc,4,2           ## @callwndproc_proc
	.comm	_DINPUT_instance,4,2            ## @DINPUT_instance
	.comm	_hook_thread_event,8,3          ## @hook_thread_event
	.comm	_INFINITE,4,2                   ## @INFINITE
	.comm	_hook_thread_id,4,2             ## @hook_thread_id
	.comm	_WM_USER,8,3                    ## @WM_USER
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_check_dinput_hooks             ; -- Begin function check_dinput_hooks
	.p2align	2
_check_dinput_hooks:                    ; @check_dinput_hooks
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x1
	bl	_impl_from_IDirectInputDevice8W
	mov	x20, x0
Lloh0:
	adrp	x0, _dinput_hook_crit@GOTPAGE
Lloh1:
	ldr	x0, [x0, _dinput_hook_crit@GOTPAGEOFF]
	bl	_EnterCriticalSection
	ldr	w8, [x20]
Lloh2:
	adrp	x9, _DISCL_FOREGROUND@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DISCL_FOREGROUND@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.1:
	adrp	x9, _check_dinput_hooks.foreground_cnt@PAGE
	ldr	x8, [x9, _check_dinput_hooks.foreground_cnt@PAGEOFF]
	cbz	x19, LBB0_4
; %bb.2:
	add	x8, x8, #1
	b	LBB0_5
LBB0_3:
Lloh5:
	adrp	x8, _check_dinput_hooks.foreground_cnt@PAGE
Lloh6:
	ldr	x8, [x8, _check_dinput_hooks.foreground_cnt@PAGEOFF]
	b	LBB0_6
LBB0_4:
	sub	x8, x8, #1
LBB0_5:
	str	x8, [x9, _check_dinput_hooks.foreground_cnt@PAGEOFF]
LBB0_6:
	adrp	x22, _check_dinput_hooks.callwndproc_hook@PAGE
	ldr	x0, [x22, _check_dinput_hooks.callwndproc_hook@PAGEOFF]
	cmp	x8, #0
	ccmp	x0, #0, #0, ne
	b.eq	LBB0_10
; %bb.7:
	cbnz	x8, LBB0_12
; %bb.8:
	cbz	x0, LBB0_12
; %bb.9:
	bl	_UnhookWindowsHookEx
	mov	x0, #0
	b	LBB0_11
LBB0_10:
Lloh7:
	adrp	x8, _WH_CALLWNDPROC@GOTPAGE
Lloh8:
	ldr	x8, [x8, _WH_CALLWNDPROC@GOTPAGEOFF]
Lloh9:
	ldr	w19, [x8]
Lloh10:
	adrp	x8, _callwndproc_proc@GOTPAGE
Lloh11:
	ldr	x8, [x8, _callwndproc_proc@GOTPAGEOFF]
Lloh12:
	ldr	w20, [x8]
Lloh13:
	adrp	x8, _DINPUT_instance@GOTPAGE
Lloh14:
	ldr	x8, [x8, _DINPUT_instance@GOTPAGEOFF]
Lloh15:
	ldr	w21, [x8]
	bl	_GetCurrentThreadId
	mov	x3, x0
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_SetWindowsHookExW
LBB0_11:
	str	x0, [x22, _check_dinput_hooks.callwndproc_hook@PAGEOFF]
LBB0_12:
Lloh16:
	adrp	x19, _hook_thread_event@GOTPAGE
Lloh17:
	ldr	x19, [x19, _hook_thread_event@GOTPAGEOFF]
	ldr	x0, [x19]
	cbz	x0, LBB0_14
; %bb.13:
Lloh18:
	adrp	x8, _INFINITE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _INFINITE@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	bl	_WaitForSingleObject
	ldr	x0, [x19]
	bl	_CloseHandle
	str	xzr, [x19]
LBB0_14:
Lloh21:
	adrp	x8, _hook_thread_id@GOTPAGE
Lloh22:
	ldr	x8, [x8, _hook_thread_id@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
Lloh24:
	adrp	x8, _WM_USER@GOTPAGE
Lloh25:
	ldr	x8, [x8, _WM_USER@GOTPAGEOFF]
Lloh26:
	ldr	x8, [x8]
	add	x1, x8, #16
	mov	w2, #1
	mov	w3, #0
	bl	_PostThreadMessageW
Lloh27:
	adrp	x0, _dinput_hook_crit@GOTPAGE
Lloh28:
	ldr	x0, [x0, _dinput_hook_crit@GOTPAGEOFF]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_LeaveCriticalSection
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdr	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_check_dinput_hooks.callwndproc_hook,8,3 ; @check_dinput_hooks.callwndproc_hook
.zerofill __DATA,__bss,_check_dinput_hooks.foreground_cnt,8,3 ; @check_dinput_hooks.foreground_cnt
	.comm	_dinput_hook_crit,4,2           ; @dinput_hook_crit
	.comm	_DISCL_FOREGROUND,4,2           ; @DISCL_FOREGROUND
	.comm	_WH_CALLWNDPROC,4,2             ; @WH_CALLWNDPROC
	.comm	_callwndproc_proc,4,2           ; @callwndproc_proc
	.comm	_DINPUT_instance,4,2            ; @DINPUT_instance
	.comm	_hook_thread_event,8,3          ; @hook_thread_event
	.comm	_INFINITE,4,2                   ; @INFINITE
	.comm	_hook_thread_id,4,2             ; @hook_thread_id
	.comm	_WM_USER,8,3                    ; @WM_USER
.subsections_via_symbols
