	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mg_read
_mg_read:                               ## @mg_read
	.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, %r14
	movq	8(%rdi), %rax
	movq	(%rax), %rbx
	callq	_blk_rq_pos
	movl	%eax, %r15d
	movq	%r14, %rdi
	callq	_blk_rq_sectors
	movq	_MG_CMD_RD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	xorl	%r8d, %r8d
	callq	_mg_out
	movq	_MG_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_mg_bad_rw_intr
LBB0_2:
	movq	%r14, %rdi
	callq	_blk_rq_sectors
	movl	%eax, %r15d
	movq	%r14, %rdi
	callq	_blk_rq_pos
	movl	(%r14), %ecx
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_MG_DBG
	movq	_MG_TMAX_WAIT_RD_DRQ@GOTPCREL(%rip), %r13
	movq	_MG_REG_COMMAND@GOTPCREL(%rip), %r12
	movq	_MG_SECTOR_SIZE@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	_ATA_DRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	movq	%rbx, %rdi
	callq	_mg_wait
	movq	_MG_ERR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_mg_read_one
	movq	_MG_CMD_RD_CONF@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r12), %rsi
	addq	(%rbx), %rsi
	callq	_outb
	movl	(%r15), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_mg_end_request
	testq	%rax, %rax
	jne	LBB0_3
## %bb.5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mg_bad_rw_intr                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MG_CMD_RD,4,2                  ## @MG_CMD_RD
	.comm	_MG_ERR_NONE,8,3                ## @MG_ERR_NONE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"requested %d sects (from %ld), buffer=0x%p\n"

	.comm	_ATA_DRQ,4,2                    ## @ATA_DRQ
	.comm	_MG_TMAX_WAIT_RD_DRQ,4,2        ## @MG_TMAX_WAIT_RD_DRQ
	.comm	_MG_CMD_RD_CONF,4,2             ## @MG_CMD_RD_CONF
	.comm	_MG_REG_COMMAND,8,3             ## @MG_REG_COMMAND
	.comm	_MG_SECTOR_SIZE,4,2             ## @MG_SECTOR_SIZE
	.no_dead_strip	_mg_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mg_read
_mg_read:                               ; @mg_read
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x19, x0
	ldr	x8, [x0, #8]
	ldr	x20, [x8]
	bl	_blk_rq_pos
	mov	x21, x0
	mov	x0, x19
	bl	_blk_rq_sectors
	mov	x2, x0
Lloh0:
	adrp	x8, _MG_CMD_RD@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MG_CMD_RD@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x1, x21
	mov	x4, #0
	bl	_mg_out
Lloh3:
	adrp	x22, _MG_ERR_NONE@GOTPAGE
Lloh4:
	ldr	x22, [x22, _MG_ERR_NONE@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_2
; %bb.1:
	mov	x0, x20
	bl	_mg_bad_rw_intr
LBB0_2:
	mov	x0, x19
	bl	_blk_rq_sectors
	mov	x21, x0
	mov	x0, x19
	bl	_blk_rq_pos
	mov	x2, x0
	ldr	w3, [x19]
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_MG_DBG
Lloh7:
	adrp	x21, _ATA_DRQ@GOTPAGE
Lloh8:
	ldr	x21, [x21, _ATA_DRQ@GOTPAGEOFF]
Lloh9:
	adrp	x23, _MG_TMAX_WAIT_RD_DRQ@GOTPAGE
Lloh10:
	ldr	x23, [x23, _MG_TMAX_WAIT_RD_DRQ@GOTPAGEOFF]
Lloh11:
	adrp	x24, _MG_CMD_RD_CONF@GOTPAGE
Lloh12:
	ldr	x24, [x24, _MG_CMD_RD_CONF@GOTPAGEOFF]
Lloh13:
	adrp	x25, _MG_REG_COMMAND@GOTPAGE
Lloh14:
	ldr	x25, [x25, _MG_REG_COMMAND@GOTPAGEOFF]
Lloh15:
	adrp	x26, _MG_SECTOR_SIZE@GOTPAGE
Lloh16:
	ldr	x26, [x26, _MG_SECTOR_SIZE@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x21]
	ldr	w2, [x23]
	mov	x0, x20
	bl	_mg_wait
	ldr	x8, [x22]
	cmp	x0, x8
	b.ne	LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_mg_read_one
	ldr	w0, [x24]
	ldr	x8, [x20]
	ldr	x9, [x25]
	add	x1, x9, x8
	bl	_outb
	ldr	w2, [x26]
	mov	x0, x20
	mov	w1, #0
	bl	_mg_end_request
	cbnz	x0, LBB0_3
; %bb.5:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_mg_bad_rw_intr
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_MG_CMD_RD,4,2                  ; @MG_CMD_RD
	.comm	_MG_ERR_NONE,8,3                ; @MG_ERR_NONE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"requested %d sects (from %ld), buffer=0x%p\n"

	.comm	_ATA_DRQ,4,2                    ; @ATA_DRQ
	.comm	_MG_TMAX_WAIT_RD_DRQ,4,2        ; @MG_TMAX_WAIT_RD_DRQ
	.comm	_MG_CMD_RD_CONF,4,2             ; @MG_CMD_RD_CONF
	.comm	_MG_REG_COMMAND,8,3             ; @MG_REG_COMMAND
	.comm	_MG_SECTOR_SIZE,4,2             ; @MG_SECTOR_SIZE
	.no_dead_strip	_mg_read
.subsections_via_symbols
