	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function smiapp_read_nvm
_smiapp_read_nvm:                       ## @smiapp_read_nvm
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movl	(%rdi), %eax
	movq	_SMIAPP_NVM_PAGE_SIZE@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	testl	%eax, %eax
	jle	LBB0_14
## %bb.1:
	movl	%eax, %ebx
	xorl	%edx, %edx
	movq	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT@GOTPCREL(%rip), %rax
	movq	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL@GOTPCREL(%rip), %r14
	leaq	-52(%rbp), %r13
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
                                        ##     Child Loop BB0_10 Depth 2
	movl	(%rax), %esi
	movq	%r12, %rdi
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_smiapp_write
	testl	%eax, %eax
	jne	LBB0_19
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r14), %esi
	movq	_SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r12, %rdi
	callq	_smiapp_write
	testl	%eax, %eax
	jne	LBB0_19
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$1001, %ebx                     ## imm = 0x3E9
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r12, %rdi
	movq	%r13, %rdx
	callq	_smiapp_read
	testl	%eax, %eax
	jne	LBB0_19
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=2
	movq	_SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -52(%rbp)
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=2
	decl	%ebx
	cmpl	$1, %ebx
	ja	LBB0_5
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_SMIAPP_NVM_PAGE_SIZE@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_13
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r14, %rbx
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	%r14, %rsi
	movq	%r12, %rdi
	leaq	-48(%rbp), %rdx
	callq	_smiapp_read
	testl	%eax, %eax
	jne	LBB0_17
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=2
	movzbl	-48(%rbp), %eax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movb	%al, (%rcx,%r14)
	incq	%r14
	movq	_SMIAPP_NVM_PAGE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %r14
	jl	LBB0_10
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	addq	%r14, -72(%rbp)                 ## 8-byte Folded Spill
	movq	%rbx, %r14
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT@GOTPCREL(%rip), %rax
	incl	%edx
	cmpl	%ebx, %edx
	jne	LBB0_2
LBB0_14:
	movq	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_smiapp_write
	jmp	LBB0_21
LBB0_19:
	movl	%eax, %r15d
	jmp	LBB0_20
LBB0_16:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_20
LBB0_17:
	movl	%eax, %r15d
	movq	%rbx, %r14
LBB0_20:
	movl	(%r14), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_smiapp_write
	testl	%r15d, %r15d
	cmovsl	%r15d, %eax
LBB0_21:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SMIAPP_NVM_PAGE_SIZE,4,2       ## @SMIAPP_NVM_PAGE_SIZE
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT,4,2 ## @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL,4,2 ## @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL
	.comm	_SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN,4,2 ## @SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN
	.comm	_SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN,4,2 ## @SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS,8,3 ## @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS
	.comm	_SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY,4,2 ## @SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0,8,3 ## @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0
	.no_dead_strip	_smiapp_read_nvm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function smiapp_read_nvm
_smiapp_read_nvm:                       ; @smiapp_read_nvm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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, x0
Lloh0:
	adrp	x24, _SMIAPP_NVM_PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _SMIAPP_NVM_PAGE_SIZE@GOTPAGEOFF]
	ldr	w8, [x0]
	ldr	w9, [x24]
	sdiv	w25, w8, w9
Lloh2:
	adrp	x26, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL@GOTPAGE
Lloh3:
	ldr	x26, [x26, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL@GOTPAGEOFF]
	cmp	w25, #1
	b.lt	LBB0_14
; %bb.1:
	mov	x20, x1
	mov	w21, #0
Lloh4:
	adrp	x8, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT@GOTPAGEOFF]
Lloh6:
	adrp	x23, _SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN@GOTPAGE
Lloh7:
	ldr	x23, [x23, _SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN@GOTPAGEOFF]
Lloh8:
	adrp	x27, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS@GOTPAGE
Lloh9:
	ldr	x27, [x27, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS@GOTPAGEOFF]
Lloh10:
	adrp	x28, _SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY@GOTPAGE
Lloh11:
	ldr	x28, [x28, _SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY@GOTPAGEOFF]
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
                                        ;     Child Loop BB0_10 Depth 2
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_smiapp_write
	cbnz	w0, LBB0_15
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x26]
	ldr	w8, [x23]
Lloh12:
	adrp	x9, _SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN@GOTPAGE
Lloh13:
	ldr	x9, [x9, _SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_smiapp_write
	cbnz	w0, LBB0_15
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w23, #1001
LBB0_5:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x1, [x27]
	add	x2, sp, #12
	mov	x0, x19
	bl	_smiapp_read
	cbnz	w0, LBB0_15
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	ldr	w8, [sp, #12]
	ldr	w9, [x28]
	tst	w9, w8
	b.ne	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=2
	sub	w23, w23, #1
	cmp	w23, #1
	b.hi	LBB0_5
	b	LBB0_16
LBB0_8:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.9:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x23, #0
LBB0_10:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
Lloh15:
	adrp	x8, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	add	x1, x23, x8
	add	x2, sp, #8
	mov	x0, x19
	bl	_smiapp_read
	cbnz	w0, LBB0_15
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	ldr	w8, [sp, #8]
	strb	w8, [x20, x23]
	add	x23, x23, #1
	ldrsw	x8, [x24]
	cmp	x23, x8
	b.lt	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_2 Depth=1
	add	x20, x20, x23
LBB0_13:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh18:
	adrp	x8, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT@GOTPAGEOFF]
Lloh20:
	adrp	x23, _SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN@GOTPAGE
Lloh21:
	ldr	x23, [x23, _SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN@GOTPAGEOFF]
	add	w21, w21, #1
	cmp	w21, w25
	b.ne	LBB0_2
LBB0_14:
	ldr	w1, [x26]
	mov	x0, x19
	mov	w2, #0
	bl	_smiapp_write
	b	LBB0_18
LBB0_15:
	mov	x22, x0
	b	LBB0_17
LBB0_16:
Lloh22:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_17:
	ldr	w1, [x26]
	mov	x0, x19
	mov	w2, #0
	bl	_smiapp_write
	cmp	w22, #0
	csel	w0, w22, w0, lt
LBB0_18:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_SMIAPP_NVM_PAGE_SIZE,4,2       ; @SMIAPP_NVM_PAGE_SIZE
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT,4,2 ; @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_PAGE_SELECT
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL,4,2 ; @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_CTRL
	.comm	_SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN,4,2 ; @SMIAPP_DATA_TRANSFER_IF_1_CTRL_EN
	.comm	_SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN,4,2 ; @SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS,8,3 ; @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS
	.comm	_SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY,4,2 ; @SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0,8,3 ; @SMIAPP_REG_U8_DATA_TRANSFER_IF_1_DATA_0
	.no_dead_strip	_smiapp_read_nvm
.subsections_via_symbols
