	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function s3an_nor_setup
_s3an_nor_setup:                        ## @s3an_nor_setup
	.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	%rdi, %rbx
	movq	(%rdi), %rsi
	callq	_spi_nor_xread_sr
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	_SPINOR_OP_XSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 52(%rbx)
	movq	_SPINOR_OP_XPP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%rbx)
	movq	_SPINOR_OP_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%rbx)
	movq	_SNOR_F_NO_OP_CHIP_ERASE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 40(%rbx)
	movq	(%rbx), %rax
	movq	_XSR_PAGESIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_4
## %bb.3:
	xorl	%eax, %eax
	cmpl	$264, 8(%rbx)                   ## imm = 0x108
	setne	%al
	shll	$8, %eax
	leal	256(%rax), %ecx
	movl	%ecx, 8(%rbx)
	movl	%ecx, 24(%rbx)
	leal	2048(,%rax,8), %eax
	movq	16(%rbx), %rcx
	movl	(%rcx), %ecx
	imull	%eax, %ecx
	movl	%ecx, 28(%rbx)
	jmp	LBB0_5
LBB0_1:
	movl	%eax, %r14d
	movl	56(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_6
LBB0_4:
	movq	_s3an_convert_addr@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%rbx)
	movq	16(%rbx), %rax
	movl	4(%rax), %eax
LBB0_5:
	movl	%eax, 32(%rbx)
	xorl	%r14d, %r14d
LBB0_6:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error %d reading XRDSR\n"

	.comm	_SPINOR_OP_XSE,4,2              ## @SPINOR_OP_XSE
	.comm	_SPINOR_OP_XPP,4,2              ## @SPINOR_OP_XPP
	.comm	_SPINOR_OP_READ,4,2             ## @SPINOR_OP_READ
	.comm	_SNOR_F_NO_OP_CHIP_ERASE,4,2    ## @SNOR_F_NO_OP_CHIP_ERASE
	.comm	_XSR_PAGESIZE,4,2               ## @XSR_PAGESIZE
	.comm	_s3an_convert_addr,4,2          ## @s3an_convert_addr
	.no_dead_strip	_s3an_nor_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function s3an_nor_setup
_s3an_nor_setup:                        ; @s3an_nor_setup
	.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, x0
	ldr	x1, [x0]
	bl	_spi_nor_xread_sr
	tbnz	w0, #31, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _SPINOR_OP_XSE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SPINOR_OP_XSE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _SPINOR_OP_XPP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SPINOR_OP_XPP@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #48]
Lloh6:
	adrp	x8, _SNOR_F_NO_OP_CHIP_ERASE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SNOR_F_NO_OP_CHIP_ERASE@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x19, #40]
	orr	w8, w9, w8
Lloh9:
	adrp	x9, _SPINOR_OP_READ@GOTPAGE
Lloh10:
	ldr	x9, [x9, _SPINOR_OP_READ@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	stp	w8, w9, [x19, #40]
	ldr	x8, [x19]
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _XSR_PAGESIZE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _XSR_PAGESIZE@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.2:
	mov	w20, #0
	ldr	w8, [x19, #8]
	mov	w9, #512
	mov	w10, #256
	cmp	w8, #264
	csel	w8, w10, w9, eq
	str	w8, [x19, #8]
	lsl	w9, w8, #3
	ldr	x10, [x19, #16]
	ldr	w10, [x10]
	mul	w10, w10, w9
	stp	w8, w10, [x19, #24]
	b	LBB0_5
LBB0_3:
	mov	x20, x0
	ldr	w0, [x19, #56]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_err
	b	LBB0_6
LBB0_4:
	mov	w20, #0
Lloh17:
	adrp	x8, _s3an_convert_addr@GOTPAGE
Lloh18:
	ldr	x8, [x8, _s3an_convert_addr@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	ldr	x9, [x19, #16]
	ldr	w9, [x9, #4]
	str	w8, [x19, #36]
LBB0_5:
	str	w9, [x19, #32]
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.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
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error %d reading XRDSR\n"

	.comm	_SPINOR_OP_XSE,4,2              ; @SPINOR_OP_XSE
	.comm	_SPINOR_OP_XPP,4,2              ; @SPINOR_OP_XPP
	.comm	_SPINOR_OP_READ,4,2             ; @SPINOR_OP_READ
	.comm	_SNOR_F_NO_OP_CHIP_ERASE,4,2    ; @SNOR_F_NO_OP_CHIP_ERASE
	.comm	_XSR_PAGESIZE,4,2               ; @XSR_PAGESIZE
	.comm	_s3an_convert_addr,4,2          ; @s3an_convert_addr
	.no_dead_strip	_s3an_nor_setup
.subsections_via_symbols
