	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_KEYBOARD_Deinit                ## -- Begin function KEYBOARD_Deinit
	.p2align	4, 0x90
_KEYBOARD_Deinit:                       ## @KEYBOARD_Deinit
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	__kbd_thread_running@GOTPCREL(%rip), %r14
	cmpl	$0, (%r14)
	je	LBB0_6
## %bb.1:
	movq	__kbd_thread_quit@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	__kbd_thread@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_LWP_THREAD_NULL@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rdi
	je	LBB0_3
## %bb.2:
	xorl	%esi, %esi
	callq	_LWP_JoinThread
	movq	(%rbx), %rdi
LBB0_3:
	movq	__kbd_buf_thread@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rdi, %rax
	je	LBB0_5
## %bb.4:
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	_LWP_JoinThread
LBB0_5:
	movl	$0, (%r14)
LBB0_6:
	xorl	%eax, %eax
	callq	_USBKeyboard_Close
	xorl	%eax, %eax
	callq	_KEYBOARD_FlushEvents
	xorl	%eax, %eax
	callq	_USBKeyboard_Deinitialize
	movq	__sc_map@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:
	callq	_free
	movq	$0, (%rbx)
	movq	__sc_maplen@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
LBB0_8:
	movl	$1, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	__kbd_thread_running,4,2        ## @_kbd_thread_running
	.comm	__kbd_thread_quit,4,2           ## @_kbd_thread_quit
	.comm	__kbd_thread,8,3                ## @_kbd_thread
	.comm	_LWP_THREAD_NULL,8,3            ## @LWP_THREAD_NULL
	.comm	__kbd_buf_thread,8,3            ## @_kbd_buf_thread
	.comm	__sc_map,8,3                    ## @_sc_map
	.comm	__sc_maplen,8,3                 ## @_sc_maplen
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_KEYBOARD_Deinit                ; -- Begin function KEYBOARD_Deinit
	.p2align	2
_KEYBOARD_Deinit:                       ; @KEYBOARD_Deinit
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x19, __kbd_thread_running@GOTPAGE
Lloh1:
	ldr	x19, [x19, __kbd_thread_running@GOTPAGEOFF]
	ldr	w8, [x19]
	cbz	w8, LBB0_6
; %bb.1:
Lloh2:
	adrp	x8, __kbd_thread_quit@GOTPAGE
Lloh3:
	ldr	x8, [x8, __kbd_thread_quit@GOTPAGEOFF]
	mov	w9, #1
Lloh4:
	adrp	x10, __kbd_thread@GOTPAGE
Lloh5:
	ldr	x10, [x10, __kbd_thread@GOTPAGEOFF]
Lloh6:
	str	w9, [x8]
Lloh7:
	ldr	x0, [x10]
Lloh8:
	adrp	x20, _LWP_THREAD_NULL@GOTPAGE
Lloh9:
	ldr	x20, [x20, _LWP_THREAD_NULL@GOTPAGEOFF]
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_3
; %bb.2:
	mov	x1, #0
	bl	_LWP_JoinThread
	ldr	x0, [x20]
LBB0_3:
Lloh10:
	adrp	x8, __kbd_buf_thread@GOTPAGE
Lloh11:
	ldr	x8, [x8, __kbd_buf_thread@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	cmp	x8, x0
	b.eq	LBB0_5
; %bb.4:
	mov	x0, x8
	mov	x1, #0
	bl	_LWP_JoinThread
LBB0_5:
	str	wzr, [x19]
LBB0_6:
	bl	_USBKeyboard_Close
	bl	_KEYBOARD_FlushEvents
	bl	_USBKeyboard_Deinitialize
Lloh13:
	adrp	x19, __sc_map@GOTPAGE
Lloh14:
	ldr	x19, [x19, __sc_map@GOTPAGEOFF]
	ldr	x0, [x19]
	cbz	x0, LBB0_8
; %bb.7:
	bl	_free
	str	xzr, [x19]
Lloh15:
	adrp	x8, __sc_maplen@GOTPAGE
Lloh16:
	ldr	x8, [x8, __sc_maplen@GOTPAGEOFF]
Lloh17:
	str	xzr, [x8]
LBB0_8:
	mov	w0, #1
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh7
	.loh AdrpLdrGotStr	Lloh2, Lloh3, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotStr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	__kbd_thread_running,4,2        ; @_kbd_thread_running
	.comm	__kbd_thread_quit,4,2           ; @_kbd_thread_quit
	.comm	__kbd_thread,8,3                ; @_kbd_thread
	.comm	_LWP_THREAD_NULL,8,3            ; @LWP_THREAD_NULL
	.comm	__kbd_buf_thread,8,3            ; @_kbd_buf_thread
	.comm	__sc_map,8,3                    ; @_sc_map
	.comm	__sc_maplen,8,3                 ; @_sc_maplen
.subsections_via_symbols
