	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pci_set_bus_speed
_pci_set_bus_speed:                     ## @pci_set_bus_speed
	.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, %r14
	movq	16(%rdi), %r15
	movq	_PCI_CAP_ID_AGP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_pci_find_capability
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	movq	_PCI_CAP_ID_AGP3@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_pci_find_capability
	testl	%eax, %eax
	je	LBB0_3
LBB0_2:
	movslq	%eax, %rbx
	movq	_PCI_AGP_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	%rbx, %rsi
	leaq	-28(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pci_read_config_dword
	movl	-28(%rbp), %esi
	movl	%esi, %edi
	andl	$8, %edi
	andl	$7, %esi
	callq	_agp_speed
	movl	%eax, (%r14)
	movq	_PCI_AGP_COMMAND@GOTPCREL(%rip), %rax
	addq	(%rax), %rbx
	leaq	-32(%rbp), %rdx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_pci_read_config_dword
	movl	-28(%rbp), %edi
	andl	$8, %edi
	movl	-32(%rbp), %esi
	andl	$7, %esi
	callq	_agp_speed
	movq	%rax, 8(%r14)
LBB0_3:
	movq	_PCI_CAP_ID_PCIX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_pci_find_capability
	testl	%eax, %eax
	je	LBB0_14
## %bb.4:
	movslq	%eax, %rsi
	movq	_PCI_X_BRIDGE_SSTATUS@GOTPCREL(%rip), %rax
	addq	(%rax), %rsi
	leaq	-28(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pci_read_config_word
	movl	-28(%rbp), %eax
	movq	_PCI_X_SSTATUS_533MHZ@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_6
## %bb.5:
	movq	_PCI_SPEED_133MHz_PCIX_533@GOTPCREL(%rip), %rcx
	jmp	LBB0_13
LBB0_14:
	movq	%r15, %rdi
	callq	_pci_is_pcie
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movq	_PCI_EXP_LNKCAP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pcie_capability_read_dword
	movq	_pcie_link_speed@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	-28(%rbp), %ecx
	movq	_PCI_EXP_LNKCAP_SLS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	andl	%ecx, %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, (%r14)
	movq	_PCI_EXP_LNKCAP_DLLLARC@GOTPCREL(%rip), %rax
	xorl	%edx, %edx
	andl	(%rax), %ecx
	setne	%dl
	movl	%edx, (%r15)
	movq	_PCI_EXP_LNKSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-32(%rbp), %rdx
	movq	%r15, %rdi
	callq	_pcie_capability_read_word
	movl	-32(%rbp), %esi
	movq	%r14, %rdi
	callq	_pcie_update_link_speed
	jmp	LBB0_16
LBB0_6:
	movq	_PCI_X_SSTATUS_266MHZ@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.7:
	movq	_PCI_SPEED_133MHz_PCIX_266@GOTPCREL(%rip), %rcx
LBB0_13:
	movl	(%rcx), %ecx
	movl	%ecx, (%r14)
	movq	_pcix_bus_speed@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_PCI_X_SSTATUS_FREQ@GOTPCREL(%rip), %rdx
	andl	(%rdx), %eax
	sarl	$6, %eax
	cltq
	movq	(%rcx,%rax,8), %rax
	movq	%rax, 8(%r14)
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_PCI_X_SSTATUS_133MHZ@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_9
## %bb.10:
	movq	_PCI_X_SSTATUS_VERS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	movq	_PCI_X_SSTATUS_V2@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	jne	LBB0_11
## %bb.12:
	movq	_PCI_SPEED_133MHz_PCIX_ECC@GOTPCREL(%rip), %rcx
	jmp	LBB0_13
LBB0_9:
	movq	_PCI_SPEED_66MHz_PCIX@GOTPCREL(%rip), %rcx
	jmp	LBB0_13
LBB0_11:
	movq	_PCI_SPEED_133MHz_PCIX@GOTPCREL(%rip), %rcx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_CAP_ID_AGP,4,2             ## @PCI_CAP_ID_AGP
	.comm	_PCI_CAP_ID_AGP3,4,2            ## @PCI_CAP_ID_AGP3
	.comm	_PCI_AGP_STATUS,8,3             ## @PCI_AGP_STATUS
	.comm	_PCI_AGP_COMMAND,8,3            ## @PCI_AGP_COMMAND
	.comm	_PCI_CAP_ID_PCIX,4,2            ## @PCI_CAP_ID_PCIX
	.comm	_PCI_X_BRIDGE_SSTATUS,8,3       ## @PCI_X_BRIDGE_SSTATUS
	.comm	_PCI_X_SSTATUS_533MHZ,4,2       ## @PCI_X_SSTATUS_533MHZ
	.comm	_PCI_SPEED_133MHz_PCIX_533,4,2  ## @PCI_SPEED_133MHz_PCIX_533
	.comm	_PCI_X_SSTATUS_266MHZ,4,2       ## @PCI_X_SSTATUS_266MHZ
	.comm	_PCI_SPEED_133MHz_PCIX_266,4,2  ## @PCI_SPEED_133MHz_PCIX_266
	.comm	_PCI_X_SSTATUS_133MHZ,4,2       ## @PCI_X_SSTATUS_133MHZ
	.comm	_PCI_X_SSTATUS_VERS,4,2         ## @PCI_X_SSTATUS_VERS
	.comm	_PCI_X_SSTATUS_V2,4,2           ## @PCI_X_SSTATUS_V2
	.comm	_PCI_SPEED_133MHz_PCIX_ECC,4,2  ## @PCI_SPEED_133MHz_PCIX_ECC
	.comm	_PCI_SPEED_133MHz_PCIX,4,2      ## @PCI_SPEED_133MHz_PCIX
	.comm	_PCI_SPEED_66MHz_PCIX,4,2       ## @PCI_SPEED_66MHz_PCIX
	.comm	_pcix_bus_speed,8,3             ## @pcix_bus_speed
	.comm	_PCI_X_SSTATUS_FREQ,4,2         ## @PCI_X_SSTATUS_FREQ
	.comm	_PCI_EXP_LNKCAP,4,2             ## @PCI_EXP_LNKCAP
	.comm	_pcie_link_speed,8,3            ## @pcie_link_speed
	.comm	_PCI_EXP_LNKCAP_SLS,4,2         ## @PCI_EXP_LNKCAP_SLS
	.comm	_PCI_EXP_LNKCAP_DLLLARC,4,2     ## @PCI_EXP_LNKCAP_DLLLARC
	.comm	_PCI_EXP_LNKSTA,4,2             ## @PCI_EXP_LNKSTA
	.no_dead_strip	_pci_set_bus_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pci_set_bus_speed
_pci_set_bus_speed:                     ; @pci_set_bus_speed
	.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	x19, x0
	ldr	x20, [x0, #16]
Lloh0:
	adrp	x8, _PCI_CAP_ID_AGP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PCI_CAP_ID_AGP@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_pci_find_capability
                                        ; kill: def $w0 killed $w0 def $x0
	cbnz	w0, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _PCI_CAP_ID_AGP3@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PCI_CAP_ID_AGP3@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_pci_find_capability
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_3
LBB0_2:
	sxtw	x21, w0
Lloh6:
	adrp	x8, _PCI_AGP_STATUS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PCI_AGP_STATUS@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	add	x1, x8, x21
	add	x2, sp, #12
	mov	x0, x20
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
	and	w0, w8, #0x8
	and	w1, w8, #0x7
	bl	_agp_speed
	str	w0, [x19]
Lloh9:
	adrp	x8, _PCI_AGP_COMMAND@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PCI_AGP_COMMAND@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	add	x1, x8, x21
	add	x2, sp, #8
	mov	x0, x20
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
	and	w0, w8, #0x8
	ldr	w8, [sp, #8]
	and	w1, w8, #0x7
	bl	_agp_speed
	str	x0, [x19, #8]
LBB0_3:
Lloh12:
	adrp	x8, _PCI_CAP_ID_PCIX@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PCI_CAP_ID_PCIX@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_pci_find_capability
	cbz	w0, LBB0_6
; %bb.4:
Lloh15:
	adrp	x8, _PCI_X_BRIDGE_SSTATUS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PCI_X_BRIDGE_SSTATUS@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	add	x1, x8, w0, sxtw
	add	x2, sp, #12
	mov	x0, x20
	bl	_pci_read_config_word
	ldr	w8, [sp, #12]
Lloh18:
	adrp	x9, _PCI_X_SSTATUS_533MHZ@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PCI_X_SSTATUS_533MHZ@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.5:
Lloh21:
	adrp	x9, _PCI_SPEED_133MHz_PCIX_533@GOTPAGE
Lloh22:
	ldr	x9, [x9, _PCI_SPEED_133MHz_PCIX_533@GOTPAGEOFF]
	b	LBB0_13
LBB0_6:
	mov	x0, x20
	bl	_pci_is_pcie
	cbz	x0, LBB0_14
; %bb.7:
Lloh23:
	adrp	x8, _PCI_EXP_LNKCAP@GOTPAGE
Lloh24:
	ldr	x8, [x8, _PCI_EXP_LNKCAP@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x20
	bl	_pcie_capability_read_dword
Lloh26:
	adrp	x8, _pcie_link_speed@GOTPAGE
Lloh27:
	ldr	x8, [x8, _pcie_link_speed@GOTPAGEOFF]
Lloh28:
	ldr	x8, [x8]
	ldr	w9, [sp, #12]
Lloh29:
	adrp	x10, _PCI_EXP_LNKCAP_SLS@GOTPAGE
Lloh30:
	ldr	x10, [x10, _PCI_EXP_LNKCAP_SLS@GOTPAGEOFF]
Lloh31:
	ldr	w10, [x10]
	and	w10, w10, w9
	ldr	w8, [x8, w10, sxtw #2]
	str	w8, [x19]
Lloh32:
	adrp	x8, _PCI_EXP_LNKCAP_DLLLARC@GOTPAGE
Lloh33:
	ldr	x8, [x8, _PCI_EXP_LNKCAP_DLLLARC@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	tst	w8, w9
	cset	w8, ne
	str	w8, [x20]
Lloh35:
	adrp	x8, _PCI_EXP_LNKSTA@GOTPAGE
Lloh36:
	ldr	x8, [x8, _PCI_EXP_LNKSTA@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x20
	bl	_pcie_capability_read_word
	ldr	w1, [sp, #8]
	mov	x0, x19
	bl	_pcie_update_link_speed
	b	LBB0_14
LBB0_8:
Lloh38:
	adrp	x9, _PCI_X_SSTATUS_266MHZ@GOTPAGE
Lloh39:
	ldr	x9, [x9, _PCI_X_SSTATUS_266MHZ@GOTPAGEOFF]
Lloh40:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.9:
Lloh41:
	adrp	x9, _PCI_SPEED_133MHz_PCIX_266@GOTPAGE
Lloh42:
	ldr	x9, [x9, _PCI_SPEED_133MHz_PCIX_266@GOTPAGEOFF]
	b	LBB0_13
LBB0_10:
Lloh43:
	adrp	x9, _PCI_X_SSTATUS_133MHZ@GOTPAGE
Lloh44:
	ldr	x9, [x9, _PCI_X_SSTATUS_133MHZ@GOTPAGEOFF]
Lloh45:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.11:
Lloh46:
	adrp	x9, _PCI_X_SSTATUS_VERS@GOTPAGE
Lloh47:
	ldr	x9, [x9, _PCI_X_SSTATUS_VERS@GOTPAGEOFF]
Lloh48:
	ldr	w9, [x9]
	and	w9, w9, w8
Lloh49:
	adrp	x10, _PCI_X_SSTATUS_V2@GOTPAGE
Lloh50:
	ldr	x10, [x10, _PCI_X_SSTATUS_V2@GOTPAGEOFF]
Lloh51:
	ldr	w10, [x10]
Lloh52:
	adrp	x11, _PCI_SPEED_133MHz_PCIX@GOTPAGE
Lloh53:
	ldr	x11, [x11, _PCI_SPEED_133MHz_PCIX@GOTPAGEOFF]
Lloh54:
	adrp	x12, _PCI_SPEED_133MHz_PCIX_ECC@GOTPAGE
Lloh55:
	ldr	x12, [x12, _PCI_SPEED_133MHz_PCIX_ECC@GOTPAGEOFF]
	cmp	w9, w10
	csel	x9, x12, x11, eq
	b	LBB0_13
LBB0_12:
Lloh56:
	adrp	x9, _PCI_SPEED_66MHz_PCIX@GOTPAGE
Lloh57:
	ldr	x9, [x9, _PCI_SPEED_66MHz_PCIX@GOTPAGEOFF]
LBB0_13:
	ldr	w9, [x9]
	str	w9, [x19]
Lloh58:
	adrp	x9, _pcix_bus_speed@GOTPAGE
Lloh59:
	ldr	x9, [x9, _pcix_bus_speed@GOTPAGEOFF]
Lloh60:
	ldr	x9, [x9]
Lloh61:
	adrp	x10, _PCI_X_SSTATUS_FREQ@GOTPAGE
Lloh62:
	ldr	x10, [x10, _PCI_X_SSTATUS_FREQ@GOTPAGEOFF]
Lloh63:
	ldr	w10, [x10]
	and	w8, w10, w8
	asr	w8, w8, #6
	ldr	x8, [x9, w8, sxtw #3]
	str	x8, [x19, #8]
LBB0_14:
	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 AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh54, Lloh55
	.loh AdrpLdrGot	Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh56, Lloh57
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.loh AdrpLdrGotLdr	Lloh58, Lloh59, Lloh60
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_CAP_ID_AGP,4,2             ; @PCI_CAP_ID_AGP
	.comm	_PCI_CAP_ID_AGP3,4,2            ; @PCI_CAP_ID_AGP3
	.comm	_PCI_AGP_STATUS,8,3             ; @PCI_AGP_STATUS
	.comm	_PCI_AGP_COMMAND,8,3            ; @PCI_AGP_COMMAND
	.comm	_PCI_CAP_ID_PCIX,4,2            ; @PCI_CAP_ID_PCIX
	.comm	_PCI_X_BRIDGE_SSTATUS,8,3       ; @PCI_X_BRIDGE_SSTATUS
	.comm	_PCI_X_SSTATUS_533MHZ,4,2       ; @PCI_X_SSTATUS_533MHZ
	.comm	_PCI_SPEED_133MHz_PCIX_533,4,2  ; @PCI_SPEED_133MHz_PCIX_533
	.comm	_PCI_X_SSTATUS_266MHZ,4,2       ; @PCI_X_SSTATUS_266MHZ
	.comm	_PCI_SPEED_133MHz_PCIX_266,4,2  ; @PCI_SPEED_133MHz_PCIX_266
	.comm	_PCI_X_SSTATUS_133MHZ,4,2       ; @PCI_X_SSTATUS_133MHZ
	.comm	_PCI_X_SSTATUS_VERS,4,2         ; @PCI_X_SSTATUS_VERS
	.comm	_PCI_X_SSTATUS_V2,4,2           ; @PCI_X_SSTATUS_V2
	.comm	_PCI_SPEED_133MHz_PCIX_ECC,4,2  ; @PCI_SPEED_133MHz_PCIX_ECC
	.comm	_PCI_SPEED_133MHz_PCIX,4,2      ; @PCI_SPEED_133MHz_PCIX
	.comm	_PCI_SPEED_66MHz_PCIX,4,2       ; @PCI_SPEED_66MHz_PCIX
	.comm	_pcix_bus_speed,8,3             ; @pcix_bus_speed
	.comm	_PCI_X_SSTATUS_FREQ,4,2         ; @PCI_X_SSTATUS_FREQ
	.comm	_PCI_EXP_LNKCAP,4,2             ; @PCI_EXP_LNKCAP
	.comm	_pcie_link_speed,8,3            ; @pcie_link_speed
	.comm	_PCI_EXP_LNKCAP_SLS,4,2         ; @PCI_EXP_LNKCAP_SLS
	.comm	_PCI_EXP_LNKCAP_DLLLARC,4,2     ; @PCI_EXP_LNKCAP_DLLLARC
	.comm	_PCI_EXP_LNKSTA,4,2             ; @PCI_EXP_LNKSTA
	.no_dead_strip	_pci_set_bus_speed
.subsections_via_symbols
