	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___ps2_command                  ## -- Begin function __ps2_command
	.p2align	4, 0x90
___ps2_command:                         ## @__ps2_command
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r13d
	shrl	$8, %r13d
	andl	$15, %r13d
	cmpl	$9, %r13d
	jae	LBB0_3
## %bb.1:
	movl	%edx, %r12d
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movl	%edx, %r14d
	shrl	$12, %r14d
	andl	$15, %r14d
	testq	%rsi, %rsi
	jne	LBB0_4
## %bb.2:
	testl	%r14d, %r14d
	je	LBB0_4
LBB0_3:
	movl	$1, %edi
	callq	_WARN_ON
	movl	$-1, %r14d
	jmp	LBB0_35
LBB0_4:
	testq	%r15, %r15
	setne	-41(%rbp)                       ## 1-byte Folded Spill
	movl	16(%rbx), %edi
	callq	_serio_pause_rx
	movq	_PS2_CMD_GETID@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	cmpl	%r12d, (%rcx)
	jne	LBB0_6
## %bb.5:
	movq	_PS2_FLAG_WAITID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_6:
	movl	%eax, (%rbx)
	movl	%r13d, 4(%rbx)
	testl	%r13d, %r13d
	setne	%al
	movb	-41(%rbp), %cl                  ## 1-byte Reload
	andb	%al, %cl
	movb	%cl, -41(%rbp)                  ## 1-byte Spill
	cmpb	$1, %cl
	jne	LBB0_13
## %bb.7:
	movl	%r13d, %r8d
	cmpl	$1, %r13d
	jne	LBB0_9
## %bb.8:
	xorl	%ecx, %ecx
	jmp	LBB0_11
LBB0_9:
	movl	%r8d, %edx
	andl	$-2, %edx
	xorl	%ecx, %ecx
	movq	%r8, %rsi
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%r15,%rcx), %eax
	movq	8(%rbx), %rdi
	movb	%al, -1(%rdi,%rsi)
	movzbl	1(%r15,%rcx), %eax
	movq	8(%rbx), %rdi
	movb	%al, -2(%rdi,%rsi)
	addq	$2, %rcx
	addq	$-2, %rsi
	cmpq	%rcx, %rdx
	jne	LBB0_10
LBB0_11:
	testb	$1, %r8b
	je	LBB0_13
## %bb.12:
	movb	(%r15,%rcx), %al
	movq	8(%rbx), %rdx
	notq	%rcx
	addq	%rcx, %r8
	movb	%al, (%rdx,%r8)
LBB0_13:
	movl	16(%rbx), %edi
	callq	_serio_continue_rx
	movq	_PS2_CMD_RESET_BAT@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	movl	$1000, %eax                     ## imm = 0x3E8
	movl	$200, %edx
	cmovel	%eax, %edx
	movzbl	%r12b, %esi
	movq	%rbx, %rdi
	callq	_ps2_sendbyte
	testq	%rax, %rax
	je	LBB0_15
LBB0_14:
	movl	$-1, %r14d
LBB0_34:
	movl	16(%rbx), %edi
	callq	_serio_pause_rx
	movl	$0, (%rbx)
	movl	16(%rbx), %edi
	callq	_serio_continue_rx
LBB0_35:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	testl	%r14d, %r14d
	je	LBB0_19
## %bb.16:
	movl	%r14d, %r14d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%r15,%r12), %esi
	movq	%rbx, %rdi
	movl	$200, %edx
	callq	_ps2_sendbyte
	testq	%rax, %rax
	jne	LBB0_14
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	incq	%r12
	cmpq	%r12, %r14
	jne	LBB0_17
LBB0_19:
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	movq	_PS2_CMD_RESET_BAT@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	movl	$4000, %eax                     ## imm = 0xFA0
	movl	$500, %edi                      ## imm = 0x1F4
	cmovel	%eax, %edi
	callq	_msecs_to_jiffies
	movl	20(%rbx), %edi
	movq	_PS2_FLAG_CMD1@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	xorl	%esi, %esi
	andl	(%rbx), %ecx
	sete	%sil
	movl	%eax, %edx
	callq	_wait_event_timeout
	cmpl	$0, 4(%rbx)
	je	LBB0_22
## %bb.20:
	movl	(%r14), %ecx
	testl	%ecx, (%rbx)
	jne	LBB0_22
## %bb.21:
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%eax, %edx
	callq	_ps2_adjust_timeout
	movl	20(%rbx), %edi
	movq	_PS2_FLAG_CMD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	xorl	%esi, %esi
	andl	(%rbx), %ecx
	sete	%sil
	movl	%eax, %edx
	callq	_wait_event_timeout
LBB0_22:
	cmpb	$0, -41(%rbp)                   ## 1-byte Folded Reload
	movl	$-1, %r14d
	movq	_PS2_CMD_RESET_BAT@GOTPCREL(%rip), %r9
	je	LBB0_30
## %bb.23:
	movl	%r13d, %r8d
	cmpl	$1, %r13d
	jne	LBB0_26
## %bb.24:
	xorl	%ecx, %ecx
	jmp	LBB0_28
LBB0_26:
	movl	%r8d, %edx
	andl	$-2, %edx
	xorl	%ecx, %ecx
	movq	%r8, %rsi
	.p2align	4, 0x90
LBB0_27:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%rbx), %rdi
	movzbl	-1(%rdi,%rsi), %eax
	movb	%al, (%r15,%rcx)
	movq	8(%rbx), %rax
	movzbl	-2(%rax,%rsi), %eax
	movb	%al, 1(%r15,%rcx)
	addq	$2, %rcx
	addq	$-2, %rsi
	cmpq	%rcx, %rdx
	jne	LBB0_27
LBB0_28:
	testb	$1, %r8b
	je	LBB0_30
## %bb.29:
	movq	8(%rbx), %rax
	movq	%rcx, %rdx
	notq	%rdx
	addq	%rdx, %r8
	movb	(%rax,%r8), %al
	movb	%al, (%r15,%rcx)
LBB0_30:
	movl	4(%rbx), %eax
	testl	%eax, %eax
	je	LBB0_33
## %bb.31:
	cmpl	%r12d, (%r9)
	jne	LBB0_34
## %bb.32:
	cmpl	$1, %eax
	jne	LBB0_34
LBB0_33:
	xorl	%r14d, %r14d
	jmp	LBB0_34
	.cfi_endproc
                                        ## -- End function
	.comm	_PS2_CMD_GETID,4,2              ## @PS2_CMD_GETID
	.comm	_PS2_FLAG_WAITID,4,2            ## @PS2_FLAG_WAITID
	.comm	_PS2_CMD_RESET_BAT,4,2          ## @PS2_CMD_RESET_BAT
	.comm	_PS2_FLAG_CMD1,4,2              ## @PS2_FLAG_CMD1
	.comm	_PS2_FLAG_CMD,4,2               ## @PS2_FLAG_CMD
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___ps2_command                  ; -- Begin function __ps2_command
	.p2align	2
___ps2_command:                         ; @__ps2_command
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	ubfx	w22, w2, #8, #4
	cmp	w22, #9
	b.hs	LBB0_3
; %bb.1:
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ubfx	w25, w2, #12, #4
	cbnz	x1, LBB0_4
; %bb.2:
	cbz	w25, LBB0_4
LBB0_3:
	mov	w0, #1
	bl	_WARN_ON
	mov	w20, #-1
	b	LBB0_10
LBB0_4:
	ldr	w0, [x19, #16]
	bl	_serio_pause_rx
Lloh0:
	adrp	x8, _PS2_CMD_GETID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PS2_CMD_GETID@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _PS2_FLAG_WAITID@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PS2_FLAG_WAITID@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w20
	csel	w8, w9, wzr, eq
	cmp	x21, #0
	stp	w8, w22, [x19]
	ccmp	w22, #0, #4, ne
	cset	w23, ne
	b.eq	LBB0_7
; %bb.5:
	sub	x8, x22, #1
	mov	x9, x21
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldrb	w10, [x9], #1
	ldr	x11, [x19, #8]
	strb	w10, [x11, x8]
	sub	x8, x8, #1
	cmn	x8, #1
	b.ne	LBB0_6
LBB0_7:
	ldr	w0, [x19, #16]
	bl	_serio_continue_rx
Lloh6:
	adrp	x24, _PS2_CMD_RESET_BAT@GOTPAGE
Lloh7:
	ldr	x24, [x24, _PS2_CMD_RESET_BAT@GOTPAGEOFF]
	ldr	w8, [x24]
	mov	w9, #200
	mov	w10, #1000
	cmp	w8, w20
	csel	w2, w10, w9, eq
	and	w1, w20, #0xff
	mov	x0, x19
	bl	_ps2_sendbyte
	cbz	x0, LBB0_11
LBB0_8:
	mov	w20, #-1
LBB0_9:
	ldr	w0, [x19, #16]
	bl	_serio_pause_rx
	str	wzr, [x19]
	ldr	w0, [x19, #16]
	bl	_serio_continue_rx
LBB0_10:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_11:
	cbz	w25, LBB0_15
; %bb.12:
	mov	x26, x21
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldrb	w1, [x26]
	mov	x0, x19
	mov	w2, #200
	bl	_ps2_sendbyte
	cbnz	x0, LBB0_8
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	add	x26, x26, #1
	subs	x25, x25, #1
	b.ne	LBB0_13
LBB0_15:
	ldr	w8, [x24]
	mov	w9, #500
	mov	w10, #4000
	cmp	w8, w20
	csel	w0, w10, w9, eq
	bl	_msecs_to_jiffies
	mov	x2, x0
	ldr	w0, [x19, #20]
	ldr	w8, [x19]
Lloh8:
	adrp	x25, _PS2_FLAG_CMD1@GOTPAGE
Lloh9:
	ldr	x25, [x25, _PS2_FLAG_CMD1@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	cset	w1, eq
	bl	_wait_event_timeout
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_18
; %bb.16:
	ldr	w8, [x19]
	ldr	w9, [x25]
	tst	w9, w8
	b.ne	LBB0_18
; %bb.17:
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_ps2_adjust_timeout
	mov	x2, x0
	ldr	w0, [x19, #20]
	ldr	w8, [x19]
Lloh10:
	adrp	x9, _PS2_FLAG_CMD@GOTPAGE
Lloh11:
	ldr	x9, [x9, _PS2_FLAG_CMD@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w1, eq
	bl	_wait_event_timeout
LBB0_18:
	cbz	w23, LBB0_21
; %bb.19:
	sub	x8, x22, #1
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #8]
	ldrb	w9, [x9, x8]
	strb	w9, [x21], #1
	sub	x8, x8, #1
	cmn	x8, #1
	b.ne	LBB0_20
LBB0_21:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_23
; %bb.22:
	ldr	w9, [x24]
	cmp	w9, w20
	ccmp	w8, #1, #0, eq
	b.ne	LBB0_8
LBB0_23:
	mov	w20, #0
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_PS2_CMD_GETID,4,2              ; @PS2_CMD_GETID
	.comm	_PS2_FLAG_WAITID,4,2            ; @PS2_FLAG_WAITID
	.comm	_PS2_CMD_RESET_BAT,4,2          ; @PS2_CMD_RESET_BAT
	.comm	_PS2_FLAG_CMD1,4,2              ; @PS2_FLAG_CMD1
	.comm	_PS2_FLAG_CMD,4,2               ; @PS2_FLAG_CMD
.subsections_via_symbols
