	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ps2_handle_ack                 ## -- Begin function ps2_handle_ack
	.p2align	4, 0x90
_ps2_handle_ack:                        ## @ps2_handle_ack
	.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
	movl	%esi, %r14d
	movq	%rdi, %r15
	cmpl	$127, %esi
	jg	LBB0_5
## %bb.1:
	cmpl	$4, %r14d
	ja	LBB0_4
## %bb.2:
	movl	$25, %eax
	btl	%r14d, %eax
	jae	LBB0_4
LBB0_3:
	movq	_PS2_FLAG_WAITID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%r15)
	jne	LBB0_12
	jmp	LBB0_4
LBB0_5:
	cmpl	$130, %r14d
	je	LBB0_12
## %bb.6:
	cmpl	$129, %r14d
	je	LBB0_9
## %bb.7:
	cmpl	$128, %r14d
	jne	LBB0_4
## %bb.8:
	movq	_PS2_FLAG_NAK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%r15)
	jmp	LBB0_11
LBB0_12:
	movl	$0, (%r15)
	movq	_PS2_FLAG_NAK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	4(%r15), %eax
	cmpq	$0, 16(%r15)
	je	LBB0_14
## %bb.13:
	movq	_PS2_FLAG_CMD@GOTPCREL(%rip), %rcx
	movq	_PS2_FLAG_CMD1@GOTPCREL(%rip), %rdx
	orl	(%rcx), %eax
	orl	(%rdx), %eax
	jmp	LBB0_14
LBB0_4:
	movq	24(%r15), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_dbg
	movq	_PS2_FLAG_WAITID@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	notl	%ebx
	andl	4(%r15), %ebx
	movl	%ebx, 4(%r15)
	movq	_PS2_FLAG_ACK_CMD@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	jmp	LBB0_16
LBB0_9:
	movl	4(%r15), %eax
	movq	_PS2_FLAG_NAK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_3
## %bb.10:
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, 4(%r15)
LBB0_11:
	movl	%r14d, (%r15)
	movl	4(%r15), %eax
LBB0_14:
	movq	_PS2_FLAG_ACK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%eax, %ecx
	movl	%ecx, 4(%r15)
	leaq	8(%r15), %rdi
	callq	_wake_up
	movl	$1, %ebx
	cmpl	$130, %r14d
	je	LBB0_16
## %bb.15:
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_ps2_handle_response
LBB0_16:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PS2_FLAG_NAK,4,2               ## @PS2_FLAG_NAK
	.comm	_PS2_FLAG_WAITID,4,2            ## @PS2_FLAG_WAITID
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unexpected %#02x\n"

	.comm	_PS2_FLAG_ACK_CMD,4,2           ## @PS2_FLAG_ACK_CMD
	.comm	_PS2_FLAG_CMD,4,2               ## @PS2_FLAG_CMD
	.comm	_PS2_FLAG_CMD1,4,2              ## @PS2_FLAG_CMD1
	.comm	_PS2_FLAG_ACK,4,2               ## @PS2_FLAG_ACK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ps2_handle_ack                 ; -- Begin function ps2_handle_ack
	.p2align	2
_ps2_handle_ack:                        ; @ps2_handle_ack
	.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	x20, x1
	mov	x19, x0
	cmp	w1, #127
	b.gt	LBB0_4
; %bb.1:
	cmp	w20, #4
	b.hi	LBB0_10
; %bb.2:
	mov	w8, #1
	lsl	w8, w8, w20
	mov	w9, #25
	tst	w8, w9
	b.eq	LBB0_10
LBB0_3:
	ldr	w8, [x19, #4]
Lloh0:
	adrp	x9, _PS2_FLAG_WAITID@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PS2_FLAG_WAITID@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_8
	b	LBB0_10
LBB0_4:
	cmp	w20, #130
	b.eq	LBB0_8
; %bb.5:
	cmp	w20, #129
	b.eq	LBB0_11
; %bb.6:
	cmp	w20, #128
	b.ne	LBB0_10
; %bb.7:
Lloh3:
	adrp	x8, _PS2_FLAG_NAK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PS2_FLAG_NAK@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x19, #4]
	orr	w8, w9, w8
	b	LBB0_13
LBB0_8:
	str	wzr, [x19]
Lloh6:
	adrp	x8, _PS2_FLAG_NAK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PS2_FLAG_NAK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x19, #4]
	bic	w8, w9, w8
	ldr	x9, [x19, #16]
	cbz	x9, LBB0_14
; %bb.9:
Lloh9:
	adrp	x9, _PS2_FLAG_CMD@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PS2_FLAG_CMD@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
Lloh12:
	adrp	x10, _PS2_FLAG_CMD1@GOTPAGE
Lloh13:
	ldr	x10, [x10, _PS2_FLAG_CMD1@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	orr	w8, w9, w8
	orr	w8, w8, w10
	b	LBB0_14
LBB0_10:
	ldr	x0, [x19, #24]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
Lloh17:
	adrp	x8, _PS2_FLAG_WAITID@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PS2_FLAG_WAITID@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	ldr	w9, [x19, #4]
	bic	w8, w9, w8
	str	w8, [x19, #4]
Lloh20:
	adrp	x9, _PS2_FLAG_ACK_CMD@GOTPAGE
Lloh21:
	ldr	x9, [x9, _PS2_FLAG_ACK_CMD@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	and	w0, w9, w8
	b	LBB0_17
LBB0_11:
	ldr	w8, [x19, #4]
Lloh23:
	adrp	x9, _PS2_FLAG_NAK@GOTPAGE
Lloh24:
	ldr	x9, [x9, _PS2_FLAG_NAK@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.12:
	bic	w8, w8, w9
LBB0_13:
	stp	w20, w8, [x19]
	mov	w8, w8
LBB0_14:
Lloh26:
	adrp	x9, _PS2_FLAG_ACK@GOTPAGE
Lloh27:
	ldr	x9, [x9, _PS2_FLAG_ACK@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	bic	w8, w8, w9
	str	w8, [x19, #4]
	add	x0, x19, #8
	bl	_wake_up
	cmp	w20, #130
	b.eq	LBB0_16
; %bb.15:
	mov	x0, x19
	mov	x1, x20
	bl	_ps2_handle_response
LBB0_16:
	mov	w0, #1
LBB0_17:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_PS2_FLAG_NAK,4,2               ; @PS2_FLAG_NAK
	.comm	_PS2_FLAG_WAITID,4,2            ; @PS2_FLAG_WAITID
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unexpected %#02x\n"

	.comm	_PS2_FLAG_ACK_CMD,4,2           ; @PS2_FLAG_ACK_CMD
	.comm	_PS2_FLAG_CMD,4,2               ; @PS2_FLAG_CMD
	.comm	_PS2_FLAG_CMD1,4,2              ; @PS2_FLAG_CMD1
	.comm	_PS2_FLAG_ACK,4,2               ; @PS2_FLAG_ACK
.subsections_via_symbols
