	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mg_suspend
_mg_suspend:                            ## @mg_suspend
	.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	(%rdi), %r14
	movq	8(%r14), %rbx
	movq	_MG_STAT_READY@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_MG_TMAX_CONF_TO_CMD@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%rbx, %rdi
	callq	_mg_wait
	testq	%rax, %rax
	je	LBB0_1
LBB0_7:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	cmpl	$0, (%r14)
	jne	LBB0_3
## %bb.2:
	movq	_ATA_NIEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_MG_REG_DRV_CTRL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_outb
LBB0_3:
	movq	_MG_CMD_SLEEP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_MG_REG_COMMAND@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_outb
	movl	$1, %edi
	callq	_msleep
	movl	(%r15), %esi
	movl	(%r12), %edx
	movq	%rbx, %rdi
	callq	_mg_wait
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	cmpl	$0, (%r14)
	jne	LBB0_7
## %bb.6:
	movq	_MG_REG_DRV_CTRL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	xorl	%edi, %edi
	callq	_outb
	jmp	LBB0_7
LBB0_4:
	xorl	%eax, %eax
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_MG_STAT_READY,4,2              ## @MG_STAT_READY
	.comm	_MG_TMAX_CONF_TO_CMD,4,2        ## @MG_TMAX_CONF_TO_CMD
	.comm	_EIO,4,2                        ## @EIO
	.comm	_ATA_NIEN,4,2                   ## @ATA_NIEN
	.comm	_MG_REG_DRV_CTRL,8,3            ## @MG_REG_DRV_CTRL
	.comm	_MG_CMD_SLEEP,4,2               ## @MG_CMD_SLEEP
	.comm	_MG_REG_COMMAND,8,3             ## @MG_REG_COMMAND
	.no_dead_strip	_mg_suspend
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mg_suspend
_mg_suspend:                            ; @mg_suspend
	.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
	ldr	x20, [x0]
	ldr	x19, [x20, #8]
Lloh0:
	adrp	x21, _MG_STAT_READY@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MG_STAT_READY@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh2:
	adrp	x22, _MG_TMAX_CONF_TO_CMD@GOTPAGE
Lloh3:
	ldr	x22, [x22, _MG_TMAX_CONF_TO_CMD@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x0, x19
	bl	_mg_wait
	cbz	x0, LBB0_3
LBB0_1:
Lloh4:
	adrp	x8, _EIO@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_2:
	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
LBB0_3:
	ldr	w8, [x20]
	cbnz	w8, LBB0_5
; %bb.4:
Lloh7:
	adrp	x8, _ATA_NIEN@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ATA_NIEN@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	ldr	x8, [x19]
Lloh10:
	adrp	x9, _MG_REG_DRV_CTRL@GOTPAGE
Lloh11:
	ldr	x9, [x9, _MG_REG_DRV_CTRL@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_outb
LBB0_5:
Lloh13:
	adrp	x8, _MG_CMD_SLEEP@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MG_CMD_SLEEP@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	ldr	x8, [x19]
Lloh16:
	adrp	x9, _MG_REG_COMMAND@GOTPAGE
Lloh17:
	ldr	x9, [x9, _MG_REG_COMMAND@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_outb
	mov	w0, #1
	bl	_msleep
	ldr	w1, [x21]
	ldr	w2, [x22]
	mov	x0, x19
	bl	_mg_wait
	cbz	x0, LBB0_2
; %bb.6:
	ldr	w8, [x20]
	cbnz	w8, LBB0_1
; %bb.7:
	ldr	x8, [x19]
Lloh19:
	adrp	x9, _MG_REG_DRV_CTRL@GOTPAGE
Lloh20:
	ldr	x9, [x9, _MG_REG_DRV_CTRL@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_outb
	b	LBB0_1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_MG_STAT_READY,4,2              ; @MG_STAT_READY
	.comm	_MG_TMAX_CONF_TO_CMD,4,2        ; @MG_TMAX_CONF_TO_CMD
	.comm	_EIO,4,2                        ; @EIO
	.comm	_ATA_NIEN,4,2                   ; @ATA_NIEN
	.comm	_MG_REG_DRV_CTRL,8,3            ; @MG_REG_DRV_CTRL
	.comm	_MG_CMD_SLEEP,4,2               ; @MG_CMD_SLEEP
	.comm	_MG_REG_COMMAND,8,3             ; @MG_REG_COMMAND
	.no_dead_strip	_mg_suspend
.subsections_via_symbols
