	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_db8500_prcmu_config_esram0_deep_sleep ## -- Begin function db8500_prcmu_config_esram0_deep_sleep
	.p2align	4, 0x90
_db8500_prcmu_config_esram0_deep_sleep: ## @db8500_prcmu_config_esram0_deep_sleep
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_ESRAM0_DEEP_SLEEP_STATE_RET@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jl	LBB0_2
## %bb.1:
	movl	%edi, %r15d
	movq	_ESRAM0_DEEP_SLEEP_STATE_OFF@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jg	LBB0_2
## %bb.3:
	movq	_mb4_transfer@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	_PRCM_MBOX_CPU_VAL@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %edi
	callq	_readl
	movl	%eax, %ebx
	movl	$4, %edi
	callq	_MBOX_BIT
	testl	%ebx, %eax
	je	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%eax, %eax
	callq	_cpu_relax
	jmp	LBB0_5
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_7
LBB0_6:
	movq	_MB4H_MEM_ST@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_tcdm_base@GOTPCREL(%rip), %r12
	movq	_PRCM_MBOX_HEADER_REQ_MB4@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r12), %rsi
	callq	_writeb
	movq	_DDR_PWR_STATE_OFFHIGHLAT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shll	$4, %edi
	movq	_DDR_PWR_STATE_ON@GOTPCREL(%rip), %rbx
	orl	(%rbx), %edi
	movq	_PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r12), %rsi
	callq	_writeb
	movl	(%rbx), %edi
	movq	_PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r12), %rsi
	callq	_writeb
	movq	_PRCM_REQ_MB4_ESRAM0_ST@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r12), %rsi
	movl	%r15d, %edi
	callq	_writeb
	movl	$4, %edi
	callq	_MBOX_BIT
	movq	_PRCM_MBOX_CPU_SET@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_writel
	leaq	4(%r14), %rdi
	callq	_wait_for_completion
	movq	%r14, %rdi
	callq	_mutex_unlock
	xorl	%eax, %eax
LBB0_7:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ESRAM0_DEEP_SLEEP_STATE_RET,4,2 ## @ESRAM0_DEEP_SLEEP_STATE_RET
	.comm	_ESRAM0_DEEP_SLEEP_STATE_OFF,4,2 ## @ESRAM0_DEEP_SLEEP_STATE_OFF
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_mb4_transfer,8,2               ## @mb4_transfer
	.comm	_PRCM_MBOX_CPU_VAL,4,2          ## @PRCM_MBOX_CPU_VAL
	.comm	_MB4H_MEM_ST,4,2                ## @MB4H_MEM_ST
	.comm	_tcdm_base,8,3                  ## @tcdm_base
	.comm	_PRCM_MBOX_HEADER_REQ_MB4,8,3   ## @PRCM_MBOX_HEADER_REQ_MB4
	.comm	_DDR_PWR_STATE_OFFHIGHLAT,4,2   ## @DDR_PWR_STATE_OFFHIGHLAT
	.comm	_DDR_PWR_STATE_ON,4,2           ## @DDR_PWR_STATE_ON
	.comm	_PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE,8,3 ## @PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE
	.comm	_PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE,8,3 ## @PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE
	.comm	_PRCM_REQ_MB4_ESRAM0_ST,8,3     ## @PRCM_REQ_MB4_ESRAM0_ST
	.comm	_PRCM_MBOX_CPU_SET,4,2          ## @PRCM_MBOX_CPU_SET
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_db8500_prcmu_config_esram0_deep_sleep ; -- Begin function db8500_prcmu_config_esram0_deep_sleep
	.p2align	2
_db8500_prcmu_config_esram0_deep_sleep: ; @db8500_prcmu_config_esram0_deep_sleep
	.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
Lloh0:
	adrp	x8, _ESRAM0_DEEP_SLEEP_STATE_RET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ESRAM0_DEEP_SLEEP_STATE_RET@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _ESRAM0_DEEP_SLEEP_STATE_OFF@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ESRAM0_DEEP_SLEEP_STATE_OFF@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w0
	ccmp	w9, w0, #0, ge
	b.le	LBB0_2
; %bb.1:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
LBB0_2:
	mov	x20, x0
Lloh9:
	adrp	x19, _mb4_transfer@GOTPAGE
Lloh10:
	ldr	x19, [x19, _mb4_transfer@GOTPAGEOFF]
	mov	x0, x19
	bl	_mutex_lock
Lloh11:
	adrp	x22, _PRCM_MBOX_CPU_VAL@GOTPAGE
Lloh12:
	ldr	x22, [x22, _PRCM_MBOX_CPU_VAL@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x22]
	bl	_readl
	mov	x21, x0
	mov	w0, #4
	bl	_MBOX_BIT
	tst	w0, w21
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_cpu_relax
	b	LBB0_3
LBB0_5:
Lloh13:
	adrp	x8, _MB4H_MEM_ST@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MB4H_MEM_ST@GOTPAGEOFF]
Lloh15:
	adrp	x21, _tcdm_base@GOTPAGE
Lloh16:
	ldr	x21, [x21, _tcdm_base@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	ldr	x8, [x21]
Lloh18:
	adrp	x9, _PRCM_MBOX_HEADER_REQ_MB4@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PRCM_MBOX_HEADER_REQ_MB4@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writeb
Lloh21:
	adrp	x8, _DDR_PWR_STATE_OFFHIGHLAT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _DDR_PWR_STATE_OFFHIGHLAT@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x22, _DDR_PWR_STATE_ON@GOTPAGE
Lloh25:
	ldr	x22, [x22, _DDR_PWR_STATE_ON@GOTPAGEOFF]
	ldr	w9, [x22]
	orr	w0, w9, w8, lsl #4
	ldr	x8, [x21]
Lloh26:
	adrp	x9, _PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE@GOTPAGE
Lloh27:
	ldr	x9, [x9, _PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writeb
	ldr	w0, [x22]
	ldr	x8, [x21]
Lloh29:
	adrp	x9, _PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE@GOTPAGE
Lloh30:
	ldr	x9, [x9, _PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE@GOTPAGEOFF]
Lloh31:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writeb
	ldr	x8, [x21]
Lloh32:
	adrp	x9, _PRCM_REQ_MB4_ESRAM0_ST@GOTPAGE
Lloh33:
	ldr	x9, [x9, _PRCM_REQ_MB4_ESRAM0_ST@GOTPAGEOFF]
Lloh34:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x20
	bl	_writeb
	mov	w0, #4
	bl	_MBOX_BIT
Lloh35:
	adrp	x8, _PRCM_MBOX_CPU_SET@GOTPAGE
Lloh36:
	ldr	x8, [x8, _PRCM_MBOX_CPU_SET@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	bl	_writel
	add	x0, x19, #4
	bl	_wait_for_completion
	mov	x0, x19
	bl	_mutex_unlock
	mov	w0, #0
LBB0_6:
	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	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_ESRAM0_DEEP_SLEEP_STATE_RET,4,2 ; @ESRAM0_DEEP_SLEEP_STATE_RET
	.comm	_ESRAM0_DEEP_SLEEP_STATE_OFF,4,2 ; @ESRAM0_DEEP_SLEEP_STATE_OFF
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_mb4_transfer,8,2               ; @mb4_transfer
	.comm	_PRCM_MBOX_CPU_VAL,4,2          ; @PRCM_MBOX_CPU_VAL
	.comm	_MB4H_MEM_ST,4,2                ; @MB4H_MEM_ST
	.comm	_tcdm_base,8,3                  ; @tcdm_base
	.comm	_PRCM_MBOX_HEADER_REQ_MB4,8,3   ; @PRCM_MBOX_HEADER_REQ_MB4
	.comm	_DDR_PWR_STATE_OFFHIGHLAT,4,2   ; @DDR_PWR_STATE_OFFHIGHLAT
	.comm	_DDR_PWR_STATE_ON,4,2           ; @DDR_PWR_STATE_ON
	.comm	_PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE,8,3 ; @PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE
	.comm	_PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE,8,3 ; @PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE
	.comm	_PRCM_REQ_MB4_ESRAM0_ST,8,3     ; @PRCM_REQ_MB4_ESRAM0_ST
	.comm	_PRCM_MBOX_CPU_SET,4,2          ; @PRCM_MBOX_CPU_SET
.subsections_via_symbols
