	.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, %rbx
	xorl	%r15d, %r15d
	testb	%r14b, %r14b
	jns	LBB0_6
## %bb.1:
	cmpb	$-128, %r14b
	je	LBB0_11
## %bb.2:
	cmpb	$-127, %r14b
	je	LBB0_9
## %bb.3:
	cmpb	$-126, %r14b
	je	LBB0_4
	jmp	LBB0_15
LBB0_6:
	cmpb	$4, %r14b
	ja	LBB0_15
## %bb.7:
	movzbl	%r14b, %eax
	movl	$25, %ecx
	btl	%eax, %ecx
	jae	LBB0_15
LBB0_8:
	movq	_PS2_FLAG_WAITID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rbx)
	je	LBB0_15
LBB0_4:
	movl	$0, (%rbx)
	movq	_PS2_FLAG_NAK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	4(%rbx), %eax
	cmpq	$0, 16(%rbx)
	je	LBB0_13
## %bb.5:
	movq	_PS2_FLAG_CMD@GOTPCREL(%rip), %rcx
	movq	_PS2_FLAG_CMD1@GOTPCREL(%rip), %rdx
	orl	(%rcx), %eax
	orl	(%rdx), %eax
	jmp	LBB0_13
LBB0_11:
	movq	_PS2_FLAG_NAK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%rbx)
	movl	$128, %eax
	jmp	LBB0_12
LBB0_9:
	movl	4(%rbx), %eax
	movq	_PS2_FLAG_NAK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_8
## %bb.10:
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, 4(%rbx)
	movl	$129, %eax
LBB0_12:
	movl	%eax, (%rbx)
	movl	4(%rbx), %eax
LBB0_13:
	movq	_PS2_FLAG_ACK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%eax, %ecx
	movl	%ecx, 4(%rbx)
	leaq	8(%rbx), %rdi
	callq	_wake_up
	movl	$1, %r15d
	cmpb	$-126, %r14b
	je	LBB0_15
## %bb.14:
	movzbl	%r14b, %esi
	movq	%rbx, %rdi
	callq	_ps2_handle_response
LBB0_15:
	movl	%r15d, %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
	.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	x19, x1
	mov	x20, x0
	mov	w0, #0
	cmp	w1, #127
	b.gt	LBB0_5
; %bb.1:
	cmp	w19, #4
	b.hi	LBB0_17
; %bb.2:
	mov	w8, #1
	lsl	w8, w8, w19
	mov	w9, #25
	tst	w8, w9
	b.eq	LBB0_17
LBB0_3:
	ldr	w8, [x20, #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_9
; %bb.4:
	mov	w0, #0
	b	LBB0_17
LBB0_5:
	cmp	w19, #130
	b.eq	LBB0_9
; %bb.6:
	cmp	w19, #129
	b.eq	LBB0_11
; %bb.7:
	cmp	w19, #128
	b.ne	LBB0_17
; %bb.8:
Lloh3:
	adrp	x8, _PS2_FLAG_NAK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PS2_FLAG_NAK@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x20, #4]
	orr	w8, w9, w8
	str	w8, [x20, #4]
	mov	w8, #128
	b	LBB0_13
LBB0_9:
	str	wzr, [x20]
Lloh6:
	adrp	x8, _PS2_FLAG_NAK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PS2_FLAG_NAK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x20, #4]
	bic	w8, w9, w8
	ldr	x9, [x20, #16]
	cbz	x9, LBB0_14
; %bb.10:
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_11:
	ldr	w8, [x20, #4]
Lloh15:
	adrp	x9, _PS2_FLAG_NAK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PS2_FLAG_NAK@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.12:
	bic	w8, w8, w9
	str	w8, [x20, #4]
	mov	w8, #129
LBB0_13:
	str	w8, [x20]
	ldr	w8, [x20, #4]
LBB0_14:
Lloh18:
	adrp	x9, _PS2_FLAG_ACK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PS2_FLAG_ACK@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	bic	w8, w8, w9
	str	w8, [x20, #4]
	add	x0, x20, #8
	bl	_wake_up
	cmp	w19, #130
	b.eq	LBB0_16
; %bb.15:
	mov	x0, x20
	mov	x1, x19
	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	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_PS2_FLAG_NAK,4,2               ; @PS2_FLAG_NAK
	.comm	_PS2_FLAG_WAITID,4,2            ; @PS2_FLAG_WAITID
	.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
