	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lpddr2_nvm_write
_lpddr2_nvm_write:                      ## @lpddr2_nvm_write
	.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	%r8, -72(%rbp)                  ## 8-byte Spill
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r12
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	8(%rdi), %r15
	movq	(%r15), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_lpdd2_nvm_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_ow_enable
	xorl	%r13d, %r13d
	testq	%r12, %r12
	je	LBB0_10
## %bb.1:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%r14, %r15
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %rdi
	subq	%r13, %rdi
	movq	(%rbx), %rsi
	callq	_min
	movq	%r12, %r14
	movq	%rax, %r12
	movq	_LPDDR2_NVM_BUF_OVERWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r13,4), %r9
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%edx, %edx
	movq	%r15, %rcx
	movq	%r12, %r8
	callq	_lpddr2_nvm_do_op
	movq	%r15, %rcx
	testl	%eax, %eax
	jne	LBB0_6
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	addq	%r12, %rcx
	addq	%r12, %r13
	cmpq	%r14, %r13
	movq	%r14, %r12
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	%rcx, %r15
	jae	LBB0_10
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rsi
	movq	%r15, %rdi
	callq	_IS_ALIGNED
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx,%r13,4), %eax
	movl	4(%rcx,%r13,4), %edx
	shll	$8, %edx
	addq	%rax, %rdx
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	cmpl	$4, (%rax)
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	8(%rcx,%r13,4), %eax
	movl	12(%rcx,%r13,4), %ecx
	shll	$16, %eax
	addq	%rax, %rdx
	shll	$24, %ecx
	addq	%rcx, %rdx
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_LPDDR2_NVM_SW_OVERWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	movq	%r15, %rbx
	movq	%r15, %rcx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_lpddr2_nvm_do_op
	testl	%eax, %eax
	jne	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %r14
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movslq	(%rax), %r12
	movq	%rbx, %rcx
	jmp	LBB0_9
LBB0_10:
	xorl	%r15d, %r15d
	jmp	LBB0_11
LBB0_6:
	movl	%eax, %r15d
LBB0_11:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%r13, (%rax)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_ow_disable
	movq	_lpdd2_nvm_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_lpdd2_nvm_mutex,4,2            ## @lpdd2_nvm_mutex
	.comm	_LPDDR2_NVM_SW_OVERWRITE,4,2    ## @LPDDR2_NVM_SW_OVERWRITE
	.comm	_LPDDR2_NVM_BUF_OVERWRITE,4,2   ## @LPDDR2_NVM_BUF_OVERWRITE
	.no_dead_strip	_lpddr2_nvm_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lpddr2_nvm_write
_lpddr2_nvm_write:                      ; @lpddr2_nvm_write
	.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	x21, x4
	mov	x19, x3
	mov	x22, x2
	mov	x23, x1
	mov	x24, x0
	ldr	x20, [x0, #8]
	ldr	x28, [x20]
Lloh0:
	adrp	x0, _lpdd2_nvm_mutex@GOTPAGE
Lloh1:
	ldr	x0, [x0, _lpdd2_nvm_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	mov	x0, x20
	bl	_ow_enable
	cbz	x22, LBB0_9
; %bb.1:
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	mov	x27, #0
Lloh2:
	adrp	x19, _LPDDR2_NVM_BUF_OVERWRITE@GOTPAGE
Lloh3:
	ldr	x19, [x19, _LPDDR2_NVM_BUF_OVERWRITE@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	sub	x0, x22, x27
	ldr	x1, [x24]
	bl	_min
	mov	x26, x0
	ldr	w1, [x19]
	add	x5, x21, x27, lsl #2
	mov	x0, x20
	mov	w2, #0
	mov	x3, x23
	mov	x4, x26
	bl	_lpddr2_nvm_do_op
	cbnz	w0, LBB0_11
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x23, x26, x23
	add	x27, x26, x27
	cmp	x27, x22
	b.hs	LBB0_10
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x24]
	mov	x0, x23
	bl	_IS_ALIGNED
	cbnz	w0, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x8, x21, x27, lsl #2
	ldp	w9, w10, [x8]
	lsl	w10, w10, #8
	add	x2, x10, x9
	ldr	w9, [x28]
	cmp	w9, #4
	b.ne	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldp	w9, w8, [x8, #8]
	lsl	w9, w9, #16
	lsl	w8, w8, #24
	add	x9, x2, x9
	add	x2, x9, x8
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
Lloh4:
	adrp	x8, _LPDDR2_NVM_SW_OVERWRITE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _LPDDR2_NVM_SW_OVERWRITE@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x20
                                        ; kill: def $w2 killed $w2 killed $x2
	mov	x3, x23
	mov	x4, #0
	mov	x5, #0
	bl	_lpddr2_nvm_do_op
	cbnz	w0, LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	ldrsw	x26, [x28]
	b	LBB0_3
LBB0_9:
	mov	x27, #0
	mov	w25, #0
	b	LBB0_13
LBB0_10:
	mov	w25, #0
	b	LBB0_12
LBB0_11:
	mov	x25, x0
LBB0_12:
	ldr	x19, [sp, #8]                   ; 8-byte Folded Reload
LBB0_13:
	str	x27, [x19]
	mov	x0, x20
	bl	_ow_disable
Lloh7:
	adrp	x0, _lpdd2_nvm_mutex@GOTPAGE
Lloh8:
	ldr	x0, [x0, _lpdd2_nvm_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	mov	x0, x25
	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	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_lpdd2_nvm_mutex,4,2            ; @lpdd2_nvm_mutex
	.comm	_LPDDR2_NVM_SW_OVERWRITE,4,2    ; @LPDDR2_NVM_SW_OVERWRITE
	.comm	_LPDDR2_NVM_BUF_OVERWRITE,4,2   ; @LPDDR2_NVM_BUF_OVERWRITE
	.no_dead_strip	_lpddr2_nvm_write
.subsections_via_symbols
