	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function venus_suspend_3xx
_venus_suspend_3xx:                     ## @venus_suspend_3xx
	.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	%rdi, %rbx
	callq	_to_hfi_priv
	xorl	%r12d, %r12d
	cmpl	$0, 8(%rax)
	je	LBB0_11
## %bb.1:
	movq	%rax, %r13
	cmpl	$0, (%rax)
	je	LBB0_2
LBB0_11:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	(%rbx), %r14
	movq	%r13, %r15
	addq	$4, %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r13, %rdi
	callq	_venus_is_valid_state
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_mutex_unlock
	testl	%ebx, %ebx
	je	LBB0_3
## %bb.4:
	movq	_venus_cpu_and_video_core_idle@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	movl	$1500, %r8d                     ## imm = 0x5DC
	movl	$150000, %r9d                   ## imm = 0x249F0
	callq	_readx_poll_timeout
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_11
## %bb.5:
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_venus_prepare_power_collapse
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r12d
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_11
LBB0_3:
	leaq	L_.str(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_11
LBB0_7:
	movq	_venus_cpu_idle_and_pc_ready@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	movl	$1500, %r8d                     ## imm = 0x5DC
	movl	$150000, %r9d                   ## imm = 0x249F0
	callq	_readx_poll_timeout
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_11
## %bb.8:
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r13, %rdi
	callq	_venus_power_off
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %r12d
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_11
LBB0_10:
	movl	$1, (%r13)
	movq	%r15, %rdi
	callq	_mutex_unlock
	xorl	%r12d, %r12d
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bad state, cannot suspend\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_venus_cpu_and_video_core_idle,4,2 ## @venus_cpu_and_video_core_idle
L_.str.1:                               ## @.str.1
	.asciz	"prepare for power collapse fail (%d)\n"

	.comm	_venus_cpu_idle_and_pc_ready,4,2 ## @venus_cpu_idle_and_pc_ready
L_.str.2:                               ## @.str.2
	.asciz	"venus_power_off (%d)\n"

	.no_dead_strip	_venus_suspend_3xx
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function venus_suspend_3xx
_venus_suspend_3xx:                     ; @venus_suspend_3xx
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	bl	_to_hfi_priv
	ldr	w8, [x0, #8]
	cbz	w8, LBB0_2
; %bb.1:
	mov	x21, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_4
LBB0_2:
	mov	w22, #0
LBB0_3:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_4:
	ldr	x19, [x19]
	add	x20, x21, #4
	mov	x0, x20
	bl	_mutex_lock
	mov	x0, x21
	bl	_venus_is_valid_state
	mov	x22, x0
	mov	x0, x20
	bl	_mutex_unlock
	cbz	w22, LBB0_8
; %bb.5:
Lloh0:
	adrp	x8, _venus_cpu_and_video_core_idle@GOTPAGE
Lloh1:
	ldr	x8, [x8, _venus_cpu_and_video_core_idle@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	x1, x21
	mov	w4, #1500
	mov	w5, #18928
	movk	w5, #2, lsl #16
	bl	_readx_poll_timeout
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.6:
	mov	x0, x21
	mov	w1, #0
	bl	_venus_prepare_power_collapse
	cbz	w0, LBB0_9
; %bb.7:
	mov	x22, x0
	str	x22, [sp]
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	b	LBB0_3
LBB0_8:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_3
LBB0_9:
Lloh10:
	adrp	x8, _venus_cpu_idle_and_pc_ready@GOTPAGE
Lloh11:
	ldr	x8, [x8, _venus_cpu_idle_and_pc_ready@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	mov	x1, x21
	mov	w4, #1500
	mov	w5, #18928
	movk	w5, #2, lsl #16
	bl	_readx_poll_timeout
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.10:
	mov	x0, x20
	bl	_mutex_lock
	mov	x0, x21
	bl	_venus_power_off
	mov	x22, x0
	cbz	w0, LBB0_12
; %bb.11:
	str	x22, [sp]
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	mov	x0, x20
	bl	_mutex_unlock
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	b	LBB0_3
LBB0_12:
	mov	w8, #1
	str	w8, [x21]
	mov	x0, x20
	bl	_mutex_unlock
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bad state, cannot suspend\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_venus_cpu_and_video_core_idle,4,2 ; @venus_cpu_and_video_core_idle
l_.str.1:                               ; @.str.1
	.asciz	"prepare for power collapse fail (%d)\n"

	.comm	_venus_cpu_idle_and_pc_ready,4,2 ; @venus_cpu_idle_and_pc_ready
l_.str.2:                               ; @.str.2
	.asciz	"venus_power_off (%d)\n"

	.no_dead_strip	_venus_suspend_3xx
.subsections_via_symbols
