	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function run_rsa
_run_rsa:                               ## @run_rsa
	.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
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	_MISC_CFG_RSA_SIGNATURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_KEY_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_write_rsa_data
	movq	_MISC_CFG_RSA_CMD@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_RSA_CMD_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_write_csr
	movq	_MISC_CFG_FW_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_csr
	movq	_MISC_CFG_FW_CTRL_RSA_STATUS_SMASK@GOTPCREL(%rip), %rdx
	andl	(%rdx), %eax
	movq	_MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT@GOTPCREL(%rip), %r12
	movb	(%r12), %cl
	sarl	%cl, %eax
	movq	_RSA_STATUS_IDLE@GOTPCREL(%rip), %r14
	cmpl	(%r14), %eax
	jne	LBB0_1
## %bb.2:
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %esi
	movq	_RSA_CMD_START@GOTPCREL(%rip), %rax
	movq	%rdx, %r13
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_write_csr
	movq	_RSA_ENGINE_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	movq	%rax, %rbx
	movq	_jiffies@GOTPCREL(%rip), %rax
	addq	(%rax), %rbx
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	_MISC_CFG_FW_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_csr
	andl	(%r13), %eax
	movzbl	(%r12), %ecx
	sarl	%cl, %eax
	cmpl	(%r14), %eax
	je	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_RSA_STATUS_DONE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_7
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_RSA_STATUS_FAILED@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	%rbx, %rsi
	callq	_time_after
	testq	%rax, %rax
	jne	LBB0_14
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	$20, %edi
	callq	_msleep
	jmp	LBB0_3
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movq	%r13, %rdx
	callq	_dd_dev_err
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_19
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_dd_dev_err
LBB0_11:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_12:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_8:
	movq	_MISC_ERR_CLEAR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK@GOTPCREL(%rip), %r13
	movq	_MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	orl	(%r13), %edx
	movq	%r15, %rdi
	callq	_write_csr
	movq	_MISC_ERR_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_csr
	testl	%ebx, %ebx
	je	LBB0_9
## %bb.15:
	movl	%eax, %r12d
	testl	%eax, (%r13)
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	je	LBB0_17
## %bb.16:
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	movq	%r13, %rdx
	callq	_dd_dev_warn
LBB0_17:
	testl	%r12d, (%r14)
	je	LBB0_19
## %bb.18:
	leaq	L_.str.4(%rip), %rsi
	movq	%r15, %rdi
	movq	%r13, %rdx
	callq	_dd_dev_warn
	jmp	LBB0_19
LBB0_9:
	xorl	%ebx, %ebx
LBB0_19:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_14:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_dd_dev_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_MISC_CFG_RSA_SIGNATURE,4,2     ## @MISC_CFG_RSA_SIGNATURE
	.comm	_KEY_SIZE,4,2                   ## @KEY_SIZE
	.comm	_MISC_CFG_RSA_CMD,4,2           ## @MISC_CFG_RSA_CMD
	.comm	_RSA_CMD_INIT,4,2               ## @RSA_CMD_INIT
	.comm	_MISC_CFG_FW_CTRL,4,2           ## @MISC_CFG_FW_CTRL
	.comm	_MISC_CFG_FW_CTRL_RSA_STATUS_SMASK,4,2 ## @MISC_CFG_FW_CTRL_RSA_STATUS_SMASK
	.comm	_MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT,4,2 ## @MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT
	.comm	_RSA_STATUS_IDLE,4,2            ## @RSA_STATUS_IDLE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s security engine not idle - giving up\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_RSA_CMD_START,4,2              ## @RSA_CMD_START
	.comm	_RSA_ENGINE_TIMEOUT,4,2         ## @RSA_ENGINE_TIMEOUT
	.comm	_jiffies,8,3                    ## @jiffies
L_.str.1:                               ## @.str.1
	.asciz	"%s firmware security bad idle state\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RSA_STATUS_DONE,4,2            ## @RSA_STATUS_DONE
	.comm	_RSA_STATUS_FAILED,4,2          ## @RSA_STATUS_FAILED
L_.str.2:                               ## @.str.2
	.asciz	"%s firmware security time out\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_MISC_ERR_CLEAR,4,2             ## @MISC_ERR_CLEAR
	.comm	_MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK,4,2 ## @MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK
	.comm	_MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK,4,2 ## @MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK
	.comm	_MISC_ERR_STATUS,4,2            ## @MISC_ERR_STATUS
L_.str.3:                               ## @.str.3
	.asciz	"%s firmware authorization failed\n"

L_.str.4:                               ## @.str.4
	.asciz	"%s firmware key mismatch\n"

	.no_dead_strip	_run_rsa
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function run_rsa
_run_rsa:                               ; @run_rsa
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _MISC_CFG_RSA_SIGNATURE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MISC_CFG_RSA_SIGNATURE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _KEY_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _KEY_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	bl	_write_rsa_data
Lloh6:
	adrp	x21, _MISC_CFG_RSA_CMD@GOTPAGE
Lloh7:
	ldr	x21, [x21, _MISC_CFG_RSA_CMD@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh8:
	adrp	x8, _RSA_CMD_INIT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _RSA_CMD_INIT@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_write_csr
Lloh11:
	adrp	x22, _MISC_CFG_FW_CTRL@GOTPAGE
Lloh12:
	ldr	x22, [x22, _MISC_CFG_FW_CTRL@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x20
	bl	_read_csr
Lloh13:
	adrp	x23, _MISC_CFG_FW_CTRL_RSA_STATUS_SMASK@GOTPAGE
Lloh14:
	ldr	x23, [x23, _MISC_CFG_FW_CTRL_RSA_STATUS_SMASK@GOTPAGEOFF]
	ldr	w8, [x23]
	and	w8, w8, w0
Lloh15:
	adrp	x24, _MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT@GOTPAGE
Lloh16:
	ldr	x24, [x24, _MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT@GOTPAGEOFF]
	ldr	w9, [x24]
	asr	w8, w8, w9
Lloh17:
	adrp	x25, _RSA_STATUS_IDLE@GOTPAGE
Lloh18:
	ldr	x25, [x25, _RSA_STATUS_IDLE@GOTPAGEOFF]
	ldr	w9, [x25]
	cmp	w8, w9
	b.ne	LBB0_10
; %bb.1:
	ldr	w1, [x21]
Lloh19:
	adrp	x8, _RSA_CMD_START@GOTPAGE
Lloh20:
	ldr	x8, [x8, _RSA_CMD_START@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_write_csr
Lloh22:
	adrp	x8, _RSA_ENGINE_TIMEOUT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _RSA_ENGINE_TIMEOUT@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	bl	_msecs_to_jiffies
	mov	x21, x0
Lloh25:
	adrp	x26, _jiffies@GOTPAGE
Lloh26:
	ldr	x26, [x26, _jiffies@GOTPAGEOFF]
	ldr	x27, [x26]
	ldr	w1, [x22]
	mov	x0, x20
	bl	_read_csr
	ldr	w8, [x23]
	and	w8, w8, w0
	ldr	w9, [x24]
	asr	w8, w8, w9
	ldr	w9, [x25]
	cmp	w8, w9
	b.ne	LBB0_12
LBB0_2:
Lloh27:
	adrp	x1, l_.str.1@PAGE
Lloh28:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_err
LBB0_3:
Lloh29:
	adrp	x8, _EINVAL@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_5:
Lloh31:
	adrp	x8, _MISC_ERR_CLEAR@GOTPAGE
Lloh32:
	ldr	x8, [x8, _MISC_ERR_CLEAR@GOTPAGEOFF]
Lloh33:
	adrp	x24, _MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK@GOTPAGE
Lloh34:
	ldr	x24, [x24, _MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	ldr	w8, [x24]
Lloh36:
	adrp	x23, _MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK@GOTPAGE
Lloh37:
	ldr	x23, [x23, _MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK@GOTPAGEOFF]
	ldr	w9, [x23]
	orr	w2, w9, w8
	mov	x0, x20
	bl	_write_csr
Lloh38:
	adrp	x8, _MISC_ERR_STATUS@GOTPAGE
Lloh39:
	ldr	x8, [x8, _MISC_ERR_STATUS@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_read_csr
	cbz	w21, LBB0_11
; %bb.6:
	mov	x22, x0
	ldr	w8, [x24]
	tst	w8, w0
	b.eq	LBB0_8
; %bb.7:
Lloh41:
	adrp	x1, l_.str.3@PAGE
Lloh42:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_warn
LBB0_8:
	ldr	w8, [x23]
	tst	w8, w22
	b.eq	LBB0_11
; %bb.9:
Lloh43:
	adrp	x1, l_.str.4@PAGE
Lloh44:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_warn
	b	LBB0_11
LBB0_10:
Lloh45:
	adrp	x1, l_.str@PAGE
Lloh46:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_err
Lloh47:
	adrp	x8, _EBUSY@GOTPAGE
Lloh48:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh49:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_11:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
	add	x21, x27, x21
Lloh50:
	adrp	x27, _RSA_STATUS_DONE@GOTPAGE
Lloh51:
	ldr	x27, [x27, _RSA_STATUS_DONE@GOTPAGEOFF]
Lloh52:
	adrp	x28, _RSA_STATUS_FAILED@GOTPAGE
Lloh53:
	ldr	x28, [x28, _RSA_STATUS_FAILED@GOTPAGEOFF]
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_17
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w9, [x28]
	cmp	w8, w9
	b.eq	LBB0_3
; %bb.15:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	x0, [x26]
	mov	x1, x21
	bl	_time_after
	cbnz	x0, LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_13 Depth=1
	mov	w0, #20
	bl	_msleep
	ldr	w1, [x22]
	mov	x0, x20
	bl	_read_csr
	ldr	w8, [x23]
	and	w8, w8, w0
	ldr	w9, [x24]
	asr	w8, w8, w9
	ldr	w9, [x25]
	cmp	w8, w9
	b.ne	LBB0_13
	b	LBB0_2
LBB0_17:
	mov	w21, #0
	b	LBB0_5
LBB0_18:
Lloh54:
	adrp	x1, l_.str.2@PAGE
Lloh55:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_err
Lloh56:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh57:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh35
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpLdrGot	Lloh52, Lloh53
	.loh AdrpLdrGot	Lloh50, Lloh51
	.loh AdrpLdrGot	Lloh56, Lloh57
	.loh AdrpAdd	Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_MISC_CFG_RSA_SIGNATURE,4,2     ; @MISC_CFG_RSA_SIGNATURE
	.comm	_KEY_SIZE,4,2                   ; @KEY_SIZE
	.comm	_MISC_CFG_RSA_CMD,4,2           ; @MISC_CFG_RSA_CMD
	.comm	_RSA_CMD_INIT,4,2               ; @RSA_CMD_INIT
	.comm	_MISC_CFG_FW_CTRL,4,2           ; @MISC_CFG_FW_CTRL
	.comm	_MISC_CFG_FW_CTRL_RSA_STATUS_SMASK,4,2 ; @MISC_CFG_FW_CTRL_RSA_STATUS_SMASK
	.comm	_MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT,4,2 ; @MISC_CFG_FW_CTRL_RSA_STATUS_SHIFT
	.comm	_RSA_STATUS_IDLE,4,2            ; @RSA_STATUS_IDLE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s security engine not idle - giving up\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_RSA_CMD_START,4,2              ; @RSA_CMD_START
	.comm	_RSA_ENGINE_TIMEOUT,4,2         ; @RSA_ENGINE_TIMEOUT
	.comm	_jiffies,8,3                    ; @jiffies
l_.str.1:                               ; @.str.1
	.asciz	"%s firmware security bad idle state\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RSA_STATUS_DONE,4,2            ; @RSA_STATUS_DONE
	.comm	_RSA_STATUS_FAILED,4,2          ; @RSA_STATUS_FAILED
l_.str.2:                               ; @.str.2
	.asciz	"%s firmware security time out\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_MISC_ERR_CLEAR,4,2             ; @MISC_ERR_CLEAR
	.comm	_MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK,4,2 ; @MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK
	.comm	_MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK,4,2 ; @MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK
	.comm	_MISC_ERR_STATUS,4,2            ; @MISC_ERR_STATUS
l_.str.3:                               ; @.str.3
	.asciz	"%s firmware authorization failed\n"

l_.str.4:                               ; @.str.4
	.asciz	"%s firmware key mismatch\n"

	.no_dead_strip	_run_rsa
.subsections_via_symbols
