	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ofw_pcibus_enum_bus
_ofw_pcibus_enum_bus:                   ## @ofw_pcibus_enum_bus
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	movl	%edi, -48(%rbp)                 ## 4-byte Spill
	callq	_device_get_parent
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %edi
	callq	_PCIB_MAXSLOTS
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	js	LBB0_14
## %bb.1:
	xorl	%r13d, %r13d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	leal	1(%r13), %eax
	cmpl	-56(%rbp), %r13d                ## 4-byte Folded Reload
	movl	%eax, %r13d
	je	LBB0_14
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	movl	$1, %edi
	callq	_DELAY
	movq	_PCIR_HDRTYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %esi
	movl	%r13d, %edx
	xorl	%ecx, %ecx
	movl	$1, %r9d
	callq	_PCIB_READ_CONFIG
	movl	%eax, %r12d
	movq	_PCIM_HDRTYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r12d, %eax
	movq	_PCI_MAXHDRTYPE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jg	LBB0_13
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_PCIM_MFDEV@GOTPCREL(%rip), %rax
	andl	(%rax), %r12d
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_PCI_FUNCMAX@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	testl	%r12d, %r12d
	js	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	incl	%r12d
	xorl	%r15d, %r15d
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=2
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movq	%r14, %rsi
	callq	_pci_add_child
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=2
	incl	%r15d
	cmpl	%r15d, %r12d
	je	LBB0_13
LBB0_7:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %esi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	callq	_pci_find_dbsf
	testq	%rax, %rax
	jne	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	%ebx, %ecx
	movl	%r13d, %r8d
	movl	%r15d, %r9d
	callq	_pci_read_device
	testq	%rax, %rax
	je	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=2
	movq	%rax, %r14
	movq	$0, 48(%rax)
	movl	$-1, 8(%rax)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rax)
	movups	%xmm0, 32(%rax)
	cmpq	$0, (%rax)
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=2
	movq	_PCI_INVALID_IRQ@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rax
	movq	%rax, (%r14)
	movq	_PCIR_INTLINE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	(%rcx), %r9
	movl	$1, (%rsp)
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %esi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	callq	_PCIB_WRITE_CONFIG
	jmp	LBB0_11
LBB0_14:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCIR_HDRTYPE,4,2               ## @PCIR_HDRTYPE
	.comm	_PCIM_HDRTYPE,4,2               ## @PCIM_HDRTYPE
	.comm	_PCI_MAXHDRTYPE,4,2             ## @PCI_MAXHDRTYPE
	.comm	_PCIM_MFDEV,4,2                 ## @PCIM_MFDEV
	.comm	_PCI_FUNCMAX,4,2                ## @PCI_FUNCMAX
	.comm	_PCI_INVALID_IRQ,8,3            ## @PCI_INVALID_IRQ
	.comm	_PCIR_INTLINE,4,2               ## @PCIR_INTLINE
	.no_dead_strip	_ofw_pcibus_enum_bus
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ofw_pcibus_enum_bus
_ofw_pcibus_enum_bus:                   ; @ofw_pcibus_enum_bus
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	bl	_device_get_parent
	mov	x22, x0
	bl	_PCIB_MAXSLOTS
	tbnz	w0, #31, LBB0_12
; %bb.1:
	mov	x23, x0
	mov	w24, #0
	mov	w28, #-1
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w8, w24, #1
	cmp	w24, w23
	mov	x24, x8
	b.eq	LBB0_12
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	mov	w0, #1
	bl	_DELAY
Lloh0:
	adrp	x8, _PCIR_HDRTYPE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PCIR_HDRTYPE@GOTPAGEOFF]
Lloh2:
	ldr	w4, [x8]
	mov	x0, x22
	mov	x1, x19
	mov	x2, x24
	mov	w3, #0
	mov	w5, #1
	bl	_PCIB_READ_CONFIG
Lloh3:
	adrp	x8, _PCIM_HDRTYPE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PCIM_HDRTYPE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh6:
	adrp	x9, _PCI_MAXHDRTYPE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _PCI_MAXHDRTYPE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	cmp	w8, w9
	b.gt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh9:
	adrp	x8, _PCIM_MFDEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PCIM_MFDEV@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _PCI_FUNCMAX@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PCI_FUNCMAX@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w8, w0
	csel	w8, wzr, w9, eq
	tbnz	w8, #31, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w25, #0
	add	w27, w8, #1
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=2
	mov	x0, x21
	mov	x1, x26
	bl	_pci_add_child
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=2
	add	w25, w25, #1
	cmp	w27, w25
	b.eq	LBB0_2
LBB0_8:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	mov	x1, x19
	mov	x2, x24
	mov	x3, x25
	bl	_pci_find_dbsf
	cbnz	x0, LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	mov	x3, x19
	mov	x4, x24
	mov	x5, x25
	bl	_pci_read_device
	cbz	x0, LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=2
	mov	x26, x0
	str	xzr, [x0, #48]
	str	w28, [x0, #8]
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [x0, #16]
	ldr	x8, [x0]
	cbnz	x8, LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=2
Lloh15:
	adrp	x9, _PCI_INVALID_IRQ@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PCI_INVALID_IRQ@GOTPAGEOFF]
	ldr	x8, [x9]
	str	x8, [x26]
Lloh17:
	adrp	x8, _PCIR_INTLINE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PCIR_INTLINE@GOTPAGEOFF]
Lloh19:
	ldr	w4, [x8]
	ldr	x5, [x9]
	mov	x0, x22
	mov	x1, x19
	mov	x2, x24
	mov	x3, x25
	mov	w6, #1
	bl	_PCIB_WRITE_CONFIG
	b	LBB0_6
LBB0_12:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_PCIR_HDRTYPE,4,2               ; @PCIR_HDRTYPE
	.comm	_PCIM_HDRTYPE,4,2               ; @PCIM_HDRTYPE
	.comm	_PCI_MAXHDRTYPE,4,2             ; @PCI_MAXHDRTYPE
	.comm	_PCIM_MFDEV,4,2                 ; @PCIM_MFDEV
	.comm	_PCI_FUNCMAX,4,2                ; @PCI_FUNCMAX
	.comm	_PCI_INVALID_IRQ,8,3            ; @PCI_INVALID_IRQ
	.comm	_PCIR_INTLINE,4,2               ; @PCIR_INTLINE
	.no_dead_strip	_ofw_pcibus_enum_bus
.subsections_via_symbols
