	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sun4i_ps2_open
_sun4i_ps2_open:                        ## @sun4i_ps2_open
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_PS2_LCTL_STOPERREN@GOTPCREL(%rip), %rcx
	movq	_PS2_LCTL_ACKERREN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%rcx), %eax
	movq	_PS2_LCTL_PARERREN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	(%rdi), %r14
	movq	_PS2_LCTL_RXDTOEN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_PS2_REG_LCTL@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	8(%r14), %rsi
	movl	%eax, %edi
	callq	_writel
	movq	_PS2_FCTL_TXRST@GOTPCREL(%rip), %rax
	movq	_PS2_FCTL_RXRST@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movq	_PS2_FCTL_TXUFIEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_PS2_FCTL_TXOFIEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_PS2_FCTL_RXUFIEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_PS2_FCTL_RXOFIEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_PS2_FCTL_RXRDYIEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_PS2_REG_FCTL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movl	16(%r14), %edi
	callq	_clk_get_rate
	movq	_PS2_SAMPLE_CLK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cltd
	idivl	%ecx
	movl	%eax, %edi
	movq	_PS2_SCLK@GOTPCREL(%rip), %rsi
	movl	%ecx, %eax
	cltd
	idivl	(%rsi)
                                        ## kill: def $eax killed $eax def $rax
	decl	%eax
	shll	$8, %edi
	addl	$-256, %edi
	orl	%eax, %edi
	movq	_PS2_REG_CLKDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_writel
	movq	_PS2_GCTL_RESET@GOTPCREL(%rip), %rax
	movq	_PS2_GCTL_INTEN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	orl	(%rax), %ebx
	movq	_PS2_GCTL_MASTER@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_PS2_GCTL_BUSEN@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	_PS2_REG_GCTL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	movl	%ebx, %edi
	callq	_writel
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PS2_LCTL_STOPERREN,4,2         ## @PS2_LCTL_STOPERREN
	.comm	_PS2_LCTL_ACKERREN,4,2          ## @PS2_LCTL_ACKERREN
	.comm	_PS2_LCTL_PARERREN,4,2          ## @PS2_LCTL_PARERREN
	.comm	_PS2_LCTL_RXDTOEN,4,2           ## @PS2_LCTL_RXDTOEN
	.comm	_PS2_REG_LCTL,8,3               ## @PS2_REG_LCTL
	.comm	_PS2_FCTL_TXRST,4,2             ## @PS2_FCTL_TXRST
	.comm	_PS2_FCTL_RXRST,4,2             ## @PS2_FCTL_RXRST
	.comm	_PS2_FCTL_TXUFIEN,4,2           ## @PS2_FCTL_TXUFIEN
	.comm	_PS2_FCTL_TXOFIEN,4,2           ## @PS2_FCTL_TXOFIEN
	.comm	_PS2_FCTL_RXUFIEN,4,2           ## @PS2_FCTL_RXUFIEN
	.comm	_PS2_FCTL_RXOFIEN,4,2           ## @PS2_FCTL_RXOFIEN
	.comm	_PS2_FCTL_RXRDYIEN,4,2          ## @PS2_FCTL_RXRDYIEN
	.comm	_PS2_REG_FCTL,8,3               ## @PS2_REG_FCTL
	.comm	_PS2_SAMPLE_CLK,4,2             ## @PS2_SAMPLE_CLK
	.comm	_PS2_SCLK,4,2                   ## @PS2_SCLK
	.comm	_PS2_REG_CLKDR,8,3              ## @PS2_REG_CLKDR
	.comm	_PS2_GCTL_RESET,4,2             ## @PS2_GCTL_RESET
	.comm	_PS2_GCTL_INTEN,4,2             ## @PS2_GCTL_INTEN
	.comm	_PS2_GCTL_MASTER,4,2            ## @PS2_GCTL_MASTER
	.comm	_PS2_GCTL_BUSEN,4,2             ## @PS2_GCTL_BUSEN
	.comm	_PS2_REG_GCTL,8,3               ## @PS2_REG_GCTL
	.no_dead_strip	_sun4i_ps2_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sun4i_ps2_open
_sun4i_ps2_open:                        ; @sun4i_ps2_open
	.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
	ldr	x19, [x0]
Lloh0:
	adrp	x8, _PS2_LCTL_STOPERREN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PS2_LCTL_STOPERREN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _PS2_LCTL_ACKERREN@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PS2_LCTL_ACKERREN@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _PS2_LCTL_PARERREN@GOTPAGE
Lloh7:
	ldr	x10, [x10, _PS2_LCTL_PARERREN@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh8:
	ldr	w9, [x10]
	orr	w8, w8, w9
Lloh9:
	adrp	x9, _PS2_LCTL_RXDTOEN@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PS2_LCTL_RXDTOEN@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x19, #8]
Lloh12:
	adrp	x9, _PS2_REG_LCTL@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PS2_REG_LCTL@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh15:
	adrp	x8, _PS2_FCTL_TXRST@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PS2_FCTL_TXRST@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _PS2_FCTL_RXRST@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PS2_FCTL_RXRST@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
Lloh21:
	adrp	x10, _PS2_FCTL_TXUFIEN@GOTPAGE
Lloh22:
	ldr	x10, [x10, _PS2_FCTL_TXUFIEN@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh23:
	ldr	w9, [x10]
	orr	w8, w8, w9
Lloh24:
	adrp	x9, _PS2_FCTL_TXOFIEN@GOTPAGE
Lloh25:
	ldr	x9, [x9, _PS2_FCTL_TXOFIEN@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh27:
	adrp	x9, _PS2_FCTL_RXUFIEN@GOTPAGE
Lloh28:
	ldr	x9, [x9, _PS2_FCTL_RXUFIEN@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
Lloh30:
	adrp	x10, _PS2_FCTL_RXOFIEN@GOTPAGE
Lloh31:
	ldr	x10, [x10, _PS2_FCTL_RXOFIEN@GOTPAGEOFF]
	orr	w8, w8, w9
Lloh32:
	ldr	w9, [x10]
	orr	w8, w8, w9
Lloh33:
	adrp	x9, _PS2_FCTL_RXRDYIEN@GOTPAGE
Lloh34:
	ldr	x9, [x9, _PS2_FCTL_RXRDYIEN@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x19, #8]
Lloh36:
	adrp	x9, _PS2_REG_FCTL@GOTPAGE
Lloh37:
	ldr	x9, [x9, _PS2_REG_FCTL@GOTPAGEOFF]
Lloh38:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x19, #16]
	bl	_clk_get_rate
Lloh39:
	adrp	x8, _PS2_SAMPLE_CLK@GOTPAGE
Lloh40:
	ldr	x8, [x8, _PS2_SAMPLE_CLK@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
Lloh42:
	adrp	x9, _PS2_SCLK@GOTPAGE
Lloh43:
	ldr	x9, [x9, _PS2_SCLK@GOTPAGEOFF]
	sdiv	w10, w0, w8
Lloh44:
	ldr	w9, [x9]
	sdiv	w8, w8, w9
	sub	w8, w8, #1
	lsl	w9, w10, #8
	sub	w9, w9, #256
	orr	w0, w8, w9
	ldr	x8, [x19, #8]
Lloh45:
	adrp	x9, _PS2_REG_CLKDR@GOTPAGE
Lloh46:
	ldr	x9, [x9, _PS2_REG_CLKDR@GOTPAGEOFF]
Lloh47:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh48:
	adrp	x8, _PS2_GCTL_RESET@GOTPAGE
Lloh49:
	ldr	x8, [x8, _PS2_GCTL_RESET@GOTPAGEOFF]
Lloh50:
	ldr	w8, [x8]
Lloh51:
	adrp	x9, _PS2_GCTL_INTEN@GOTPAGE
Lloh52:
	ldr	x9, [x9, _PS2_GCTL_INTEN@GOTPAGEOFF]
Lloh53:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh54:
	adrp	x9, _PS2_GCTL_MASTER@GOTPAGE
Lloh55:
	ldr	x9, [x9, _PS2_GCTL_MASTER@GOTPAGEOFF]
Lloh56:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh57:
	adrp	x9, _PS2_GCTL_BUSEN@GOTPAGE
Lloh58:
	ldr	x9, [x9, _PS2_GCTL_BUSEN@GOTPAGEOFF]
Lloh59:
	ldr	w9, [x9]
	orr	w20, w8, w9
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	x8, [x19, #8]
Lloh60:
	adrp	x9, _PS2_REG_GCTL@GOTPAGE
Lloh61:
	ldr	x9, [x9, _PS2_REG_GCTL@GOTPAGEOFF]
Lloh62:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x20
	bl	_writel
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	mov	w0, #0
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh60, Lloh61, Lloh62
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_PS2_LCTL_STOPERREN,4,2         ; @PS2_LCTL_STOPERREN
	.comm	_PS2_LCTL_ACKERREN,4,2          ; @PS2_LCTL_ACKERREN
	.comm	_PS2_LCTL_PARERREN,4,2          ; @PS2_LCTL_PARERREN
	.comm	_PS2_LCTL_RXDTOEN,4,2           ; @PS2_LCTL_RXDTOEN
	.comm	_PS2_REG_LCTL,8,3               ; @PS2_REG_LCTL
	.comm	_PS2_FCTL_TXRST,4,2             ; @PS2_FCTL_TXRST
	.comm	_PS2_FCTL_RXRST,4,2             ; @PS2_FCTL_RXRST
	.comm	_PS2_FCTL_TXUFIEN,4,2           ; @PS2_FCTL_TXUFIEN
	.comm	_PS2_FCTL_TXOFIEN,4,2           ; @PS2_FCTL_TXOFIEN
	.comm	_PS2_FCTL_RXUFIEN,4,2           ; @PS2_FCTL_RXUFIEN
	.comm	_PS2_FCTL_RXOFIEN,4,2           ; @PS2_FCTL_RXOFIEN
	.comm	_PS2_FCTL_RXRDYIEN,4,2          ; @PS2_FCTL_RXRDYIEN
	.comm	_PS2_REG_FCTL,8,3               ; @PS2_REG_FCTL
	.comm	_PS2_SAMPLE_CLK,4,2             ; @PS2_SAMPLE_CLK
	.comm	_PS2_SCLK,4,2                   ; @PS2_SCLK
	.comm	_PS2_REG_CLKDR,8,3              ; @PS2_REG_CLKDR
	.comm	_PS2_GCTL_RESET,4,2             ; @PS2_GCTL_RESET
	.comm	_PS2_GCTL_INTEN,4,2             ; @PS2_GCTL_INTEN
	.comm	_PS2_GCTL_MASTER,4,2            ; @PS2_GCTL_MASTER
	.comm	_PS2_GCTL_BUSEN,4,2             ; @PS2_GCTL_BUSEN
	.comm	_PS2_REG_GCTL,8,3               ; @PS2_REG_GCTL
	.no_dead_strip	_sun4i_ps2_open
.subsections_via_symbols
