	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hpt3xx_cable_detect
_hpt3xx_cable_detect:                   ## @hpt3xx_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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	16(%rdi), %edi
	callq	_to_pci_dev
	movq	%rax, %r14
	movl	16(%rbx), %edi
	callq	_hpt3xx_get_info
	movq	(%rax), %r12
	movq	$0, -48(%rbp)
	movq	8(%rbx), %r15
	movq	_HPT374@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	jne	LBB0_3
## %bb.1:
	movl	(%r14), %edi
	callq	_PCI_FUNC
	testb	$1, %al
	jne	LBB0_2
LBB0_3:
	movq	_HPT370@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	jge	LBB0_4
## %bb.5:
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	movl	$90, %esi
	callq	_pci_read_config_byte
	jmp	LBB0_6
LBB0_4:
	movq	$0, -40(%rbp)
	leaq	-40(%rbp), %rdx
	movq	%r14, %rdi
	movl	$91, %esi
	callq	_pci_read_config_byte
	movq	-40(%rbp), %rdx
	andq	$-2, %rdx
	movq	%r14, %rdi
	movl	$91, %esi
	callq	_pci_write_config_byte
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	movl	$90, %esi
	callq	_pci_read_config_byte
	movq	-40(%rbp), %rdx
	movq	%r14, %rdi
	movl	$91, %esi
	callq	_pci_write_config_byte
	jmp	LBB0_6
LBB0_2:
	movq	(%rbx), %rbx
	addq	$2, %rbx
	leaq	-40(%rbp), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_pci_read_config_word
	movl	$32768, %edx                    ## imm = 0x8000
	orl	-40(%rbp), %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_pci_write_config_word
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	movl	$90, %esi
	callq	_pci_read_config_byte
	movl	-40(%rbp), %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_pci_write_config_word
LBB0_6:
	xorl	%eax, %eax
	cmpq	$1, %r15
	adcl	$1, %eax
	andl	-48(%rbp), %eax
	jne	LBB0_7
## %bb.8:
	movq	_ATA_CBL_PATA80@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_7:
	movq	_ATA_CBL_PATA40@GOTPCREL(%rip), %rax
LBB0_9:
	movq	(%rax), %rax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HPT374,8,3                     ## @HPT374
	.comm	_HPT370,8,3                     ## @HPT370
	.comm	_ATA_CBL_PATA40,8,3             ## @ATA_CBL_PATA40
	.comm	_ATA_CBL_PATA80,8,3             ## @ATA_CBL_PATA80
	.no_dead_strip	_hpt3xx_cable_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hpt3xx_cable_detect
_hpt3xx_cable_detect:                   ; @hpt3xx_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, #16]
	bl	_to_pci_dev
	mov	x19, x0
	ldr	w0, [x20, #16]
	bl	_hpt3xx_get_info
	ldr	x22, [x0]
	str	xzr, [sp, #8]
	ldr	x21, [x20, #8]
Lloh0:
	adrp	x8, _HPT374@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HPT374@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x22, x8
	b.ne	LBB0_2
; %bb.1:
	ldr	w0, [x19]
	bl	_PCI_FUNC
	tbnz	w0, #0, LBB0_5
LBB0_2:
Lloh3:
	adrp	x8, _HPT370@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HPT370@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x22, x8
	b.ge	LBB0_4
; %bb.3:
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #90
	bl	_pci_read_config_byte
	b	LBB0_6
LBB0_4:
	str	xzr, [sp]
	mov	x2, sp
	mov	x0, x19
	mov	w1, #91
	bl	_pci_read_config_byte
	ldr	x8, [sp]
	and	x2, x8, #0xfffffffffffffffe
	mov	x0, x19
	mov	w1, #91
	bl	_pci_write_config_byte
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #90
	bl	_pci_read_config_byte
	ldr	x2, [sp]
	mov	x0, x19
	mov	w1, #91
	bl	_pci_write_config_byte
	b	LBB0_6
LBB0_5:
	ldr	x8, [x20]
	add	x20, x8, #2
	mov	x2, sp
	mov	x0, x19
	mov	x1, x20
	bl	_pci_read_config_word
	ldr	w8, [sp]
	orr	w2, w8, #0x8000
	mov	x0, x19
	mov	x1, x20
	bl	_pci_write_config_word
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #90
	bl	_pci_read_config_byte
	ldr	w2, [sp]
	mov	x0, x19
	mov	x1, x20
	bl	_pci_write_config_word
LBB0_6:
	cmp	x21, #0
	mov	w8, #1
	cinc	x8, x8, eq
	ldr	x9, [sp, #8]
Lloh6:
	adrp	x10, _ATA_CBL_PATA40@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ATA_CBL_PATA40@GOTPAGEOFF]
Lloh8:
	adrp	x11, _ATA_CBL_PATA80@GOTPAGE
Lloh9:
	ldr	x11, [x11, _ATA_CBL_PATA80@GOTPAGEOFF]
	tst	x9, x8
	csel	x8, x11, x10, eq
	ldr	x0, [x8]
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_HPT374,8,3                     ; @HPT374
	.comm	_HPT370,8,3                     ; @HPT370
	.comm	_ATA_CBL_PATA40,8,3             ; @ATA_CBL_PATA40
	.comm	_ATA_CBL_PATA80,8,3             ; @ATA_CBL_PATA80
	.no_dead_strip	_hpt3xx_cable_detect
.subsections_via_symbols
