	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nspire_keypad_chip_init
_nspire_keypad_chip_init:               ## @nspire_keypad_chip_init
	.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, %r14
	movl	32(%rdi), %edi
	callq	_clk_get_rate
                                        ## kill: def $eax killed $eax def $rax
	leal	999999(%rax), %edx
	movl	$1, %ecx
	cmpl	$1999999, %edx                  ## imm = 0x1E847F
	jb	LBB0_2
## %bb.1:
	cltq
	imulq	$1125899907, %rax, %rcx         ## imm = 0x431BDE83
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$50, %rcx
	addl	%eax, %ecx
LBB0_2:
	movslq	%ecx, %rbx
	movq	(%r14), %r15
	imulq	%rbx, %r15
	xorl	%edi, %edi
	cmpq	$65536, %r15                    ## imm = 0x10000
	setae	%dil
	callq	_WARN_ON
	imulq	8(%r14), %rbx
	xorl	%edi, %edi
	cmpq	$16384, %rbx                    ## imm = 0x4000
	setae	%dil
	callq	_WARN_ON
	andl	$16383, %ebx                    ## imm = 0x3FFF
	shll	$16, %r15d
	leaq	(%r15,%rbx,4), %rdi
	addq	$3, %rdi
	movq	_KEYPAD_SCAN_MODE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r14), %rsi
	callq	_writel
	movq	_KEYPAD_BITMASK_ROWS@GOTPCREL(%rip), %rax
	movzbl	(%rax), %eax
	movq	_KEYPAD_BITMASK_COLS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	shll	$8, %ecx
	movzwl	%cx, %edi
	orq	%rax, %rdi
	movq	_KEYPAD_CNTL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r14), %rsi
	callq	_writel
	movl	$2, 16(%r14)
	movq	_KEYPAD_INTMSK@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r14), %rsi
	movl	$2, %edi
	callq	_writel
	movq	_KEYPAD_UNKNOWN_INT@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r14), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	_KEYPAD_UNKNOWN_INT_STS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r14), %rsi
	movq	$-1, %rdi
	callq	_writel
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KEYPAD_SCAN_MODE,8,3           ## @KEYPAD_SCAN_MODE
	.comm	_KEYPAD_BITMASK_ROWS,4,2        ## @KEYPAD_BITMASK_ROWS
	.comm	_KEYPAD_BITMASK_COLS,4,2        ## @KEYPAD_BITMASK_COLS
	.comm	_KEYPAD_CNTL,8,3                ## @KEYPAD_CNTL
	.comm	_KEYPAD_INTMSK,8,3              ## @KEYPAD_INTMSK
	.comm	_KEYPAD_UNKNOWN_INT,8,3         ## @KEYPAD_UNKNOWN_INT
	.comm	_KEYPAD_UNKNOWN_INT_STS,8,3     ## @KEYPAD_UNKNOWN_INT_STS
	.no_dead_strip	_nspire_keypad_chip_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nspire_keypad_chip_init
_nspire_keypad_chip_init:               ; @nspire_keypad_chip_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	w0, [x0, #32]
	bl	_clk_get_rate
	mov	w8, #16959
	movk	w8, #15, lsl #16
	add	w9, w8, #1
	sdiv	w9, w0, w9
	mov	w10, #33919
	movk	w10, #30, lsl #16
	add	w8, w0, w8
	cmp	w8, w10
	csinc	w8, w9, wzr, hs
	sxtw	x20, w8
	ldr	x8, [x19]
	mul	x21, x8, x20
	tst	x21, #0xffffffffffff0000
	cset	w0, ne
	bl	_WARN_ON
	ldr	x8, [x19, #8]
	mul	x20, x8, x20
	tst	x20, #0xffffffffffffc000
	cset	w0, ne
	bl	_WARN_ON
	lsl	w8, w20, #2
	and	x8, x8, #0xfffc
	lsl	w9, w21, #16
	orr	x8, x9, x8
	orr	x0, x8, #0x3
	ldr	x8, [x19, #24]
Lloh0:
	adrp	x9, _KEYPAD_SCAN_MODE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KEYPAD_SCAN_MODE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh3:
	adrp	x8, _KEYPAD_BITMASK_ROWS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _KEYPAD_BITMASK_ROWS@GOTPAGEOFF]
	ldrb	w8, [x8]
Lloh5:
	adrp	x9, _KEYPAD_BITMASK_COLS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _KEYPAD_BITMASK_COLS@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	lsl	w9, w9, #8
	and	x9, x9, #0xff00
	orr	x0, x9, x8
	ldr	x8, [x19, #24]
Lloh8:
	adrp	x9, _KEYPAD_CNTL@GOTPAGE
Lloh9:
	ldr	x9, [x9, _KEYPAD_CNTL@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	w8, #2
	str	w8, [x19, #16]
	ldr	x8, [x19, #24]
Lloh11:
	adrp	x9, _KEYPAD_INTMSK@GOTPAGE
Lloh12:
	ldr	x9, [x9, _KEYPAD_INTMSK@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #2
	bl	_writel
	ldr	x8, [x19, #24]
Lloh14:
	adrp	x9, _KEYPAD_UNKNOWN_INT@GOTPAGE
Lloh15:
	ldr	x9, [x9, _KEYPAD_UNKNOWN_INT@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, #0
	bl	_writel
	ldr	x8, [x19, #24]
Lloh17:
	adrp	x9, _KEYPAD_UNKNOWN_INT_STS@GOTPAGE
Lloh18:
	ldr	x9, [x9, _KEYPAD_UNKNOWN_INT_STS@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, #-1
	bl	_writel
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_KEYPAD_SCAN_MODE,8,3           ; @KEYPAD_SCAN_MODE
	.comm	_KEYPAD_BITMASK_ROWS,4,2        ; @KEYPAD_BITMASK_ROWS
	.comm	_KEYPAD_BITMASK_COLS,4,2        ; @KEYPAD_BITMASK_COLS
	.comm	_KEYPAD_CNTL,8,3                ; @KEYPAD_CNTL
	.comm	_KEYPAD_INTMSK,8,3              ; @KEYPAD_INTMSK
	.comm	_KEYPAD_UNKNOWN_INT,8,3         ; @KEYPAD_UNKNOWN_INT
	.comm	_KEYPAD_UNKNOWN_INT_STS,8,3     ; @KEYPAD_UNKNOWN_INT_STS
	.no_dead_strip	_nspire_keypad_chip_init
.subsections_via_symbols
