	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sata_bug_6320_workaround
_sata_bug_6320_workaround:              ## @sata_bug_6320_workaround
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_SATA_DM_DBG1@GOTPCREL(%rip), %rcx
	testl	%edi, %edi
	movq	_SATA_CORE_PORT1_DATA_DIR@GOTPCREL(%rip), %rdx
	cmoveq	_SATA_CORE_PORT0_DATA_DIR@GOTPCREL(%rip), %rdx
	movq	_SATA_DATACOUNT_PORT1@GOTPCREL(%rip), %rax
	cmoveq	_SATA_DATACOUNT_PORT0@GOTPCREL(%rip), %rax
	movq	(%rcx), %rcx
	movq	(%rdx), %rdx
	testq	%rdx, (%rcx)
	jne	LBB0_6
## %bb.1:
	movq	%rsi, %r14
	movq	(%rax), %rax
	movl	(%rax), %esi
	movl	%esi, %eax
	andl	$127, %eax
	cmpl	$126, %eax
	jne	LBB0_6
## %bb.2:
	movl	%edi, %ebx
	leaq	L_.str(%rip), %rdi
	movl	$2, %edx
	movl	%ebx, %ecx
	callq	_debug
	movq	_ATA_SECT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%ebx, %ebx
	jne	LBB0_3
## %bb.4:
	movq	_SATA_DATA_MUX_RAM0@GOTPCREL(%rip), %rcx
	jmp	LBB0_5
LBB0_3:
	movq	_SATA_DATA_MUX_RAM1@GOTPCREL(%rip), %rcx
LBB0_5:
	movq	(%rcx), %rcx
	leal	-8(%rax), %edx
	leal	2039(%rax), %esi
	testl	%edx, %edx
	cmovnsl	%edx, %esi
	andl	$-2048, %esi                    ## imm = 0xF800
	negl	%esi
	addl	%esi, %eax
	addl	$-8, %eax
	cltq
	movl	(%rcx,%rax), %edx
	movl	%edx, (%r14)
	movl	4(%rcx,%rax), %eax
	movl	%eax, 4(%r14)
LBB0_6:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SATA_DM_DBG1,8,3               ## @SATA_DM_DBG1
	.comm	_SATA_CORE_PORT1_DATA_DIR,8,3   ## @SATA_CORE_PORT1_DATA_DIR
	.comm	_SATA_CORE_PORT0_DATA_DIR,8,3   ## @SATA_CORE_PORT0_DATA_DIR
	.comm	_SATA_DATACOUNT_PORT1,8,3       ## @SATA_DATACOUNT_PORT1
	.comm	_SATA_DATACOUNT_PORT0,8,3       ## @SATA_DATACOUNT_PORT0
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SATA read fixup, only transfered %d quads, sector_quads_remaining %d, port %d\n"

	.comm	_ATA_SECT_SIZE,4,2              ## @ATA_SECT_SIZE
	.comm	_SATA_DATA_MUX_RAM1,8,3         ## @SATA_DATA_MUX_RAM1
	.comm	_SATA_DATA_MUX_RAM0,8,3         ## @SATA_DATA_MUX_RAM0
	.no_dead_strip	_sata_bug_6320_workaround
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sata_bug_6320_workaround
_sata_bug_6320_workaround:              ; @sata_bug_6320_workaround
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x8, _SATA_DM_DBG1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SATA_DM_DBG1@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _SATA_CORE_PORT1_DATA_DIR@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SATA_CORE_PORT1_DATA_DIR@GOTPAGEOFF]
	ldr	x10, [x8]
Lloh5:
	adrp	x8, _SATA_CORE_PORT0_DATA_DIR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SATA_CORE_PORT0_DATA_DIR@GOTPAGEOFF]
	cmp	w0, #0
	csel	x8, x8, x9, eq
	ldr	x9, [x8]
Lloh7:
	adrp	x8, _SATA_DATACOUNT_PORT1@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SATA_DATACOUNT_PORT1@GOTPAGEOFF]
Lloh9:
	adrp	x11, _SATA_DATACOUNT_PORT0@GOTPAGE
Lloh10:
	ldr	x11, [x11, _SATA_DATACOUNT_PORT0@GOTPAGEOFF]
	csel	x8, x11, x8, eq
	and	x9, x9, x10
	cbnz	x9, LBB0_3
; %bb.1:
	mov	x19, x1
	ldr	x8, [x8]
	ldr	w1, [x8]
	and	w8, w1, #0x7f
	cmp	w8, #126
	b.ne	LBB0_3
; %bb.2:
	mov	x20, x0
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
	mov	w2, #2
	mov	x3, x20
	bl	_debug
Lloh13:
	adrp	x8, _ATA_SECT_SIZE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ATA_SECT_SIZE@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, _SATA_DATA_MUX_RAM1@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SATA_DATA_MUX_RAM1@GOTPAGEOFF]
Lloh18:
	adrp	x10, _SATA_DATA_MUX_RAM0@GOTPAGE
Lloh19:
	ldr	x10, [x10, _SATA_DATA_MUX_RAM0@GOTPAGEOFF]
	cmp	w20, #0
	csel	x9, x10, x9, eq
	ldr	x9, [x9]
	sub	w8, w8, #8
	negs	w10, w8
	and	w10, w10, #0x7ff
	and	w8, w8, #0x7ff
	csneg	w8, w8, w10, mi
	add	x8, x9, w8, sxtw
	ldr	w9, [x8]
	str	w9, [x19]
	ldr	w8, [x8, #4]
	str	w8, [x19, #4]
LBB0_3:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_SATA_DM_DBG1,8,3               ; @SATA_DM_DBG1
	.comm	_SATA_CORE_PORT1_DATA_DIR,8,3   ; @SATA_CORE_PORT1_DATA_DIR
	.comm	_SATA_CORE_PORT0_DATA_DIR,8,3   ; @SATA_CORE_PORT0_DATA_DIR
	.comm	_SATA_DATACOUNT_PORT1,8,3       ; @SATA_DATACOUNT_PORT1
	.comm	_SATA_DATACOUNT_PORT0,8,3       ; @SATA_DATACOUNT_PORT0
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SATA read fixup, only transfered %d quads, sector_quads_remaining %d, port %d\n"

	.comm	_ATA_SECT_SIZE,4,2              ; @ATA_SECT_SIZE
	.comm	_SATA_DATA_MUX_RAM1,8,3         ; @SATA_DATA_MUX_RAM1
	.comm	_SATA_DATA_MUX_RAM0,8,3         ; @SATA_DATA_MUX_RAM0
	.no_dead_strip	_sata_bug_6320_workaround
.subsections_via_symbols
