	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qed_mcp_halt                   ## -- Begin function qed_mcp_halt
	.p2align	4, 0x90
_qed_mcp_halt:                          ## @qed_mcp_halt
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	$0, -56(%rbp)
	movq	$0, -48(%rbp)
	movq	_DRV_MSG_CODE_MCP_HALT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-56(%rbp), %r8
	leaq	-48(%rbp), %r9
	xorl	%ecx, %ecx
	callq	_qed_mcp_cmd
	testl	%eax, %eax
	je	LBB0_1
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_DP_ERR
	jmp	LBB0_8
LBB0_1:
	xorl	%ebx, %ebx
	movq	_MCP_REG_CPU_STATE_SOFT_HALTED@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_QED_MCP_HALT_SLEEP_MS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msleep
	movq	_MCP_REG_CPU_STATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_qed_rd
	movq	%rax, %r12
	testq	%rax, (%r13)
	jne	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movq	_QED_MCP_HALT_MAX_RETRIES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rbx
	jl	LBB0_2
## %bb.5:
	cmpq	%rax, %rbx
	jne	LBB0_7
LBB0_6:
	movq	_MCP_REG_CPU_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_qed_rd
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movq	%rax, %rdx
	movq	%r12, %rcx
	callq	_DP_NOTICE
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_3:
	movq	_QED_MCP_HALT_MAX_RETRIES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rbx
	je	LBB0_6
LBB0_7:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_qed_mcp_cmd_set_blocking
	xorl	%ebx, %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DRV_MSG_CODE_MCP_HALT,4,2      ## @DRV_MSG_CODE_MCP_HALT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MCP response failure, aborting\n"

	.comm	_QED_MCP_HALT_SLEEP_MS,4,2      ## @QED_MCP_HALT_SLEEP_MS
	.comm	_MCP_REG_CPU_STATE,4,2          ## @MCP_REG_CPU_STATE
	.comm	_MCP_REG_CPU_STATE_SOFT_HALTED,8,3 ## @MCP_REG_CPU_STATE_SOFT_HALTED
	.comm	_QED_MCP_HALT_MAX_RETRIES,8,3   ## @QED_MCP_HALT_MAX_RETRIES
L_.str.1:                               ## @.str.1
	.asciz	"Failed to halt the MCP [CPU_MODE = 0x%08x, CPU_STATE = 0x%08x]\n"

	.comm	_MCP_REG_CPU_MODE,4,2           ## @MCP_REG_CPU_MODE
	.comm	_EBUSY,4,2                      ## @EBUSY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qed_mcp_halt                   ; -- Begin function qed_mcp_halt
	.p2align	2
_qed_mcp_halt:                          ; @qed_mcp_halt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x1
	mov	x19, x0
	stp	xzr, xzr, [sp]
Lloh0:
	adrp	x8, _DRV_MSG_CODE_MCP_HALT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DRV_MSG_CODE_MCP_HALT@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	add	x4, sp, #8
	mov	x5, sp
	mov	w3, #0
	bl	_qed_mcp_cmd
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_DP_ERR
	b	LBB0_9
LBB0_2:
	mov	x22, #0
Lloh5:
	adrp	x23, _QED_MCP_HALT_SLEEP_MS@GOTPAGE
Lloh6:
	ldr	x23, [x23, _QED_MCP_HALT_SLEEP_MS@GOTPAGEOFF]
Lloh7:
	adrp	x24, _MCP_REG_CPU_STATE@GOTPAGE
Lloh8:
	ldr	x24, [x24, _MCP_REG_CPU_STATE@GOTPAGEOFF]
Lloh9:
	adrp	x26, _MCP_REG_CPU_STATE_SOFT_HALTED@GOTPAGE
Lloh10:
	ldr	x26, [x26, _MCP_REG_CPU_STATE_SOFT_HALTED@GOTPAGEOFF]
Lloh11:
	adrp	x25, _QED_MCP_HALT_MAX_RETRIES@GOTPAGE
Lloh12:
	ldr	x25, [x25, _QED_MCP_HALT_MAX_RETRIES@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x23]
	bl	_msleep
	ldr	w2, [x24]
	mov	x0, x19
	mov	x1, x20
	bl	_qed_rd
	mov	x21, x0
	ldr	x8, [x26]
	tst	x8, x0
	b.ne	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	ldr	x8, [x25]
	cmp	x22, x8
	b.lt	LBB0_3
; %bb.5:
	cmp	x22, x8
	b.ne	LBB0_8
LBB0_6:
Lloh13:
	adrp	x8, _MCP_REG_CPU_MODE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MCP_REG_CPU_MODE@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_qed_rd
	mov	x2, x0
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x3, x21
	bl	_DP_NOTICE
Lloh18:
	adrp	x8, _EBUSY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_9
LBB0_7:
	ldr	x8, [x25]
	cmp	x22, x8
	b.eq	LBB0_6
LBB0_8:
	mov	x0, x19
	mov	w1, #1
	bl	_qed_mcp_cmd_set_blocking
	mov	w21, #0
LBB0_9:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_DRV_MSG_CODE_MCP_HALT,4,2      ; @DRV_MSG_CODE_MCP_HALT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MCP response failure, aborting\n"

	.comm	_QED_MCP_HALT_SLEEP_MS,4,2      ; @QED_MCP_HALT_SLEEP_MS
	.comm	_MCP_REG_CPU_STATE,4,2          ; @MCP_REG_CPU_STATE
	.comm	_MCP_REG_CPU_STATE_SOFT_HALTED,8,3 ; @MCP_REG_CPU_STATE_SOFT_HALTED
	.comm	_QED_MCP_HALT_MAX_RETRIES,8,3   ; @QED_MCP_HALT_MAX_RETRIES
l_.str.1:                               ; @.str.1
	.asciz	"Failed to halt the MCP [CPU_MODE = 0x%08x, CPU_STATE = 0x%08x]\n"

	.comm	_MCP_REG_CPU_MODE,4,2           ; @MCP_REG_CPU_MODE
	.comm	_EBUSY,4,2                      ; @EBUSY
.subsections_via_symbols
