	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ali_cable_detect
_ali_cable_detect:                      ## @ali_cable_detect
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	4(%rdi), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	movq	_ATA_CBL_PATA40@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	callq	_local_irq_save
	movq	_m5229_revision@GOTPCREL(%rip), %rax
	cmpl	$194, (%rax)
	jl	LBB0_6
## %bb.1:
	movq	%r15, %rdi
	callq	_ali_cable_override
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_ATA_CBL_PATA40_SHORT@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	leaq	-28(%rbp), %rdx
	movq	%r15, %rdi
	movl	$74, %esi
	callq	_pci_read_config_byte
	movl	-28(%rbp), %eax
	movl	(%rbx), %ecx
	btl	%ecx, %eax
	jb	LBB0_6
## %bb.4:
	movq	_ATA_CBL_PATA80@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %r14d
LBB0_6:
	callq	_local_irq_restore
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_CBL_PATA40,4,2             ## @ATA_CBL_PATA40
	.comm	_m5229_revision,4,2             ## @m5229_revision
	.comm	_ATA_CBL_PATA40_SHORT,4,2       ## @ATA_CBL_PATA40_SHORT
	.comm	_ATA_CBL_PATA80,4,2             ## @ATA_CBL_PATA80
	.no_dead_strip	_ali_cable_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ali_cable_detect
_ali_cable_detect:                      ; @ali_cable_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x0
	ldr	w0, [x0, #4]
	bl	_to_pci_dev
	mov	x21, x0
Lloh0:
	adrp	x8, _ATA_CBL_PATA40@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATA_CBL_PATA40@GOTPAGEOFF]
Lloh2:
	ldr	w19, [x8]
	bl	_local_irq_save
Lloh3:
	adrp	x8, _m5229_revision@GOTPAGE
Lloh4:
	ldr	x8, [x8, _m5229_revision@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, #194
	b.lt	LBB0_4
; %bb.1:
	mov	x0, x21
	bl	_ali_cable_override
	cbz	x0, LBB0_3
; %bb.2:
Lloh6:
	adrp	x8, _ATA_CBL_PATA40_SHORT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATA_CBL_PATA40_SHORT@GOTPAGEOFF]
Lloh8:
	ldr	w19, [x8]
	b	LBB0_4
LBB0_3:
	add	x2, sp, #12
	mov	x0, x21
	mov	w1, #74
	bl	_pci_read_config_byte
	ldr	w8, [sp, #12]
	ldr	w9, [x20]
Lloh9:
	adrp	x10, _ATA_CBL_PATA80@GOTPAGE
Lloh10:
	ldr	x10, [x10, _ATA_CBL_PATA80@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	lsr	w8, w8, w9
	tst	w8, #0x1
	csel	w19, w10, w19, eq
LBB0_4:
	bl	_local_irq_restore
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_CBL_PATA40,4,2             ; @ATA_CBL_PATA40
	.comm	_m5229_revision,4,2             ; @m5229_revision
	.comm	_ATA_CBL_PATA40_SHORT,4,2       ; @ATA_CBL_PATA40_SHORT
	.comm	_ATA_CBL_PATA80,4,2             ; @ATA_CBL_PATA80
	.no_dead_strip	_ali_cable_detect
.subsections_via_symbols
