	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kbd_connect
_kbd_connect:                           ## @kbd_connect
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	_KEY_RESERVED@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_BTN_MISC@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %eax
	cmpl	%eax, %ebx
	jge	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	4(%r15), %esi
	movl	%ebx, %edi
	callq	_test_bit
	testq	%rax, %rax
	jne	LBB0_3
## %bb.16:                              ##   in Loop: Header=BB0_1 Depth=1
	incl	%ebx
	jmp	LBB0_1
LBB0_3:
	movl	(%r12), %eax
LBB0_4:
	cmpl	%eax, %ebx
	jne	LBB0_8
## %bb.5:
	movq	_EV_SND@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r15), %esi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_6
LBB0_8:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %rbx
	movq	%r15, 16(%rax)
	movq	%r14, 8(%rax)
	leaq	L_.str(%rip), %rax
	movq	%rax, (%rbx)
	movq	%rbx, %rdi
	callq	_input_register_handle
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.11:
	movq	%rbx, %rdi
	callq	_input_open_device
	testl	%eax, %eax
	je	LBB0_12
## %bb.13:
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_input_unregister_handle
LBB0_14:
	movq	%rbx, %rdi
	callq	_kfree
	jmp	LBB0_15
LBB0_9:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_6:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_7:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_15:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	xorl	%r14d, %r14d
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_KEY_RESERVED,4,2               ## @KEY_RESERVED
	.comm	_BTN_MISC,4,2                   ## @BTN_MISC
	.comm	_EV_SND,4,2                     ## @EV_SND
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kbd"

	.no_dead_strip	_kbd_connect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kbd_connect
_kbd_connect:                           ; @kbd_connect
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _KEY_RESERVED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KEY_RESERVED@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
Lloh3:
	adrp	x22, _BTN_MISC@GOTPAGE
Lloh4:
	ldr	x22, [x22, _BTN_MISC@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x22]
	cmp	w21, w8
	b.ge	LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w1, [x20, #4]
	mov	x0, x21
	bl	_test_bit
	cbnz	x0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	add	w21, w21, #1
	b	LBB0_1
LBB0_4:
	ldr	w8, [x22]
LBB0_5:
	cmp	w21, w8
	b.ne	LBB0_7
; %bb.6:
Lloh5:
	adrp	x8, _EV_SND@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EV_SND@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	ldr	w1, [x20]
	bl	_test_bit
	cbz	x0, LBB0_13
LBB0_7:
Lloh8:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kzalloc
	cbz	x0, LBB0_12
; %bb.8:
	mov	x21, x0
	stp	x19, x20, [x0, #8]
Lloh11:
	adrp	x8, l_.str@PAGE
Lloh12:
	add	x8, x8, l_.str@PAGEOFF
	str	x8, [x0]
	bl	_input_register_handle
	mov	x19, x0
	cbnz	w0, LBB0_11
; %bb.9:
	mov	x0, x21
	bl	_input_open_device
	mov	x19, x0
	cbz	w0, LBB0_15
; %bb.10:
	mov	x0, x21
	bl	_input_unregister_handle
LBB0_11:
	mov	x0, x21
	bl	_kfree
	b	LBB0_15
LBB0_12:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_14
LBB0_13:
Lloh15:
	adrp	x8, _ENODEV@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_14:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_15:
	mov	x0, x19
	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
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_KEY_RESERVED,4,2               ; @KEY_RESERVED
	.comm	_BTN_MISC,4,2                   ; @BTN_MISC
	.comm	_EV_SND,4,2                     ; @EV_SND
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kbd"

	.no_dead_strip	_kbd_connect
.subsections_via_symbols
