	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sunkbd_initialize
_sunkbd_initialize:                     ## @sunkbd_initialize
	.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	%rdi, %rbx
	movl	$-2, (%rdi)
	movl	16(%rdi), %edi
	movq	_SUNKBD_CMD_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_serio_write
	movl	(%rbx), %esi
	movl	12(%rbx), %edi
	notl	%esi
	shrl	$31, %esi
	movq	_HZ@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	callq	_wait_event_interruptible_timeout
	movl	(%rbx), %eax
	movl	$-1, %r14d
	testl	%eax, %eax
	js	LBB0_6
## %bb.1:
	movl	%eax, 4(%rbx)
	cmpl	$4, %eax
	jne	LBB0_5
## %bb.2:
	movl	$-2, 8(%rbx)
	movl	16(%rbx), %edi
	movq	_SUNKBD_CMD_LAYOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_serio_write
	movl	8(%rbx), %esi
	movl	12(%rbx), %edi
	notl	%esi
	shrl	$31, %esi
	movl	(%r15), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	sarl	$2, %edx
	callq	_wait_event_interruptible_timeout
	movl	8(%rbx), %eax
	testl	%eax, %eax
	js	LBB0_6
## %bb.3:
	movq	_SUNKBD_LAYOUT_5_MASK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_5
## %bb.4:
	movl	$5, 4(%rbx)
LBB0_5:
	xorl	%r14d, %r14d
LBB0_6:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SUNKBD_CMD_RESET,4,2           ## @SUNKBD_CMD_RESET
	.comm	_HZ,4,2                         ## @HZ
	.comm	_SUNKBD_CMD_LAYOUT,4,2          ## @SUNKBD_CMD_LAYOUT
	.comm	_SUNKBD_LAYOUT_5_MASK,4,2       ## @SUNKBD_LAYOUT_5_MASK
	.no_dead_strip	_sunkbd_initialize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sunkbd_initialize
_sunkbd_initialize:                     ; @sunkbd_initialize
	.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
	mov	x19, x0
	mov	w8, #-2
	str	w8, [x0]
	ldr	w0, [x0, #16]
Lloh0:
	adrp	x8, _SUNKBD_CMD_RESET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SUNKBD_CMD_RESET@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_serio_write
	ldr	w0, [x19, #12]
	ldr	w8, [x19]
	mvn	w8, w8
	lsr	w1, w8, #31
Lloh3:
	adrp	x20, _HZ@GOTPAGE
Lloh4:
	ldr	x20, [x20, _HZ@GOTPAGEOFF]
	ldr	w2, [x20]
	bl	_wait_event_interruptible_timeout
	ldr	w8, [x19]
	tbnz	w8, #31, LBB0_5
; %bb.1:
	str	w8, [x19, #4]
	cmp	w8, #4
	b.ne	LBB0_6
; %bb.2:
	mov	w8, #-2
	str	w8, [x19, #8]
	ldr	w0, [x19, #16]
Lloh5:
	adrp	x8, _SUNKBD_CMD_LAYOUT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SUNKBD_CMD_LAYOUT@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_serio_write
	ldp	w8, w0, [x19, #8]
	mvn	w8, w8
	lsr	w1, w8, #31
	ldr	w8, [x20]
	add	w9, w8, #3
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w2, w8, #2
	bl	_wait_event_interruptible_timeout
	ldr	w8, [x19, #8]
	tbnz	w8, #31, LBB0_5
; %bb.3:
Lloh8:
	adrp	x9, _SUNKBD_LAYOUT_5_MASK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _SUNKBD_LAYOUT_5_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	mov	w0, #0
	mov	w8, #5
	str	w8, [x19, #4]
	b	LBB0_7
LBB0_5:
	mov	w0, #-1
	b	LBB0_7
LBB0_6:
	mov	w0, #0
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_SUNKBD_CMD_RESET,4,2           ; @SUNKBD_CMD_RESET
	.comm	_HZ,4,2                         ; @HZ
	.comm	_SUNKBD_CMD_LAYOUT,4,2          ; @SUNKBD_CMD_LAYOUT
	.comm	_SUNKBD_LAYOUT_5_MASK,4,2       ; @SUNKBD_LAYOUT_5_MASK
	.no_dead_strip	_sunkbd_initialize
.subsections_via_symbols
