	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mg_wait
_mg_wait:                               ## @mg_wait
	.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
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	16(%rdi), %rax
	movq	(%rax), %r13
	movq	_MG_ERR_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rdi)
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, %edi
	callq	_msecs_to_jiffies
	movq	%rax, %r12
	cmpq	$0, (%r13)
	je	LBB0_2
## %bb.1:
	movq	_MG_REG_STATUS@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	addq	8(%r15), %rdi
	callq	_inb
	movq	(%r13), %rdi
	addq	8(%r15), %rdi
	callq	_inb
LBB0_2:
	addq	%r14, %r12
	movq	_MG_REG_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r15), %rdi
	callq	_inb
	movl	%eax, %r14d
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	_ATA_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%r14d, %eax
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	%ebx, %eax
	jne	LBB0_11
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_ATA_ERR@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_MG_STAT_READY@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%r14d, %edi
	callq	_MG_READY_OK
	testq	%rax, %rax
	jne	LBB0_14
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_ATA_DRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%ebx, %eax
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	andl	%r14d, %eax
	jne	LBB0_14
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_MG_REG_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r15), %rdi
	callq	_inb
	movl	%eax, %r14d
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_time_before
	testq	%rax, %rax
	jne	LBB0_3
	jmp	LBB0_14
LBB0_12:
	leaq	L_.str.1(%rip), %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movq	%r15, %rdx
	callq	_mg_dump_status
	movq	_MG_ERR_INV_STAT@GOTPCREL(%rip), %r15
	jmp	LBB0_17
LBB0_6:
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	movq	%r15, %rdx
	callq	_mg_dump_status
LBB0_14:
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_time_after_eq
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_17
## %bb.15:
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:
	movq	_MG_ERR_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r15)
LBB0_17:
	movl	(%r15), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MG_ERR_NONE,4,2                ## @MG_ERR_NONE
	.comm	_jiffies,8,3                    ## @jiffies
	.comm	_MG_REG_STATUS,8,3              ## @MG_REG_STATUS
	.comm	_ATA_BUSY,4,2                   ## @ATA_BUSY
	.comm	_ATA_ERR,4,2                    ## @ATA_ERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mg_wait"

	.comm	_MG_STAT_READY,4,2              ## @MG_STAT_READY
	.comm	_ATA_DRQ,4,2                    ## @ATA_DRQ
L_.str.1:                               ## @.str.1
	.asciz	"not ready"

	.comm	_MG_ERR_INV_STAT,4,2            ## @MG_ERR_INV_STAT
	.comm	_MG_ERR_TIMEOUT,4,2             ## @MG_ERR_TIMEOUT
	.no_dead_strip	_mg_wait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mg_wait
_mg_wait:                               ; @mg_wait
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x0, #16]
Lloh0:
	adrp	x9, _MG_ERR_NONE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MG_ERR_NONE@GOTPAGEOFF]
	ldr	x23, [x8]
Lloh2:
	ldr	w8, [x9]
	str	w8, [x0]
Lloh3:
	adrp	x26, _jiffies@GOTPAGE
Lloh4:
	ldr	x26, [x26, _jiffies@GOTPAGEOFF]
	ldr	x22, [x26]
	mov	x0, x2
	bl	_msecs_to_jiffies
	add	x22, x0, x22
	ldr	x8, [x23]
Lloh5:
	adrp	x27, _MG_REG_STATUS@GOTPAGE
Lloh6:
	ldr	x27, [x27, _MG_REG_STATUS@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	x8, [x19, #8]
	ldr	x9, [x27]
	add	x0, x9, x8
	bl	_inb
	ldr	x8, [x19, #8]
	ldr	x9, [x27]
	add	x0, x9, x8
	bl	_inb
LBB0_2:
	ldr	x8, [x19, #8]
	ldr	x9, [x27]
	add	x0, x9, x8
	bl	_inb
	mov	x25, x0
Lloh7:
	adrp	x28, _ATA_BUSY@GOTPAGE
Lloh8:
	ldr	x28, [x28, _ATA_BUSY@GOTPAGEOFF]
Lloh9:
	adrp	x23, _ATA_ERR@GOTPAGE
Lloh10:
	ldr	x23, [x23, _ATA_ERR@GOTPAGEOFF]
	str	w0, [sp, #12]                   ; 4-byte Folded Spill
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x24, [x26]
	ldr	w8, [x28]
	tst	w8, w25
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w8, w21
	b.ne	LBB0_9
	b	LBB0_13
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x23]
	tst	w8, w25
	b.ne	LBB0_12
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh11:
	adrp	x8, _MG_STAT_READY@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MG_STAT_READY@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x25
	bl	_MG_READY_OK
	cbnz	x0, LBB0_13
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
Lloh14:
	adrp	x8, _ATA_DRQ@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ATA_DRQ@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	and	w9, w8, w25
	cmp	w8, w21
	ccmp	w9, #0, #4, eq
	b.ne	LBB0_13
LBB0_9:                                 ;   in Loop: Header=BB0_3 Depth=1
	cbz	w20, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x19, #8]
	ldr	x9, [x27]
	add	x0, x9, x8
	bl	_inb
	mov	x25, x0
	mov	x0, x24
	mov	x1, x22
	bl	_time_before
	cbnz	x0, LBB0_3
	b	LBB0_13
LBB0_11:
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
	ldr	w1, [sp, #12]                   ; 4-byte Folded Reload
	mov	x2, x19
	bl	_mg_dump_status
Lloh19:
	adrp	x19, _MG_ERR_INV_STAT@GOTPAGE
Lloh20:
	ldr	x19, [x19, _MG_ERR_INV_STAT@GOTPAGEOFF]
	b	LBB0_16
LBB0_12:
Lloh21:
	adrp	x0, l_.str@PAGE
Lloh22:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x25
	mov	x2, x19
	bl	_mg_dump_status
LBB0_13:
	mov	x0, x24
	mov	x1, x22
	bl	_time_after_eq
	cbz	w20, LBB0_16
; %bb.14:
	cbz	x0, LBB0_16
; %bb.15:
Lloh23:
	adrp	x8, _MG_ERR_TIMEOUT@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MG_ERR_TIMEOUT@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_16:
	ldr	w0, [x19]
	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	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_MG_ERR_NONE,4,2                ; @MG_ERR_NONE
	.comm	_jiffies,8,3                    ; @jiffies
	.comm	_MG_REG_STATUS,8,3              ; @MG_REG_STATUS
	.comm	_ATA_BUSY,4,2                   ; @ATA_BUSY
	.comm	_ATA_ERR,4,2                    ; @ATA_ERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mg_wait"

	.comm	_MG_STAT_READY,4,2              ; @MG_STAT_READY
	.comm	_ATA_DRQ,4,2                    ; @ATA_DRQ
l_.str.1:                               ; @.str.1
	.asciz	"not ready"

	.comm	_MG_ERR_INV_STAT,4,2            ; @MG_ERR_INV_STAT
	.comm	_MG_ERR_TIMEOUT,4,2             ; @MG_ERR_TIMEOUT
	.no_dead_strip	_mg_wait
.subsections_via_symbols
