	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcma_find_pci_capability
_bcma_find_pci_capability:              ## @bcma_find_pci_capability
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -72(%rbp)                  ## 8-byte Spill
	movq	%r8, %r13
	movl	%ecx, -64(%rbp)                 ## 4-byte Spill
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %r12
	movl	$0, -44(%rbp)
	movq	_PCI_HEADER_TYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%ebx, %ebx
	leaq	-48(%rbp), %r8
	movl	$4, %r9d
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	movl	-48(%rbp), %eax
	andl	$127, %eax
	movq	_PCI_HEADER_TYPE_NORMAL@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_14
## %bb.1:
	movq	_PCI_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%ebx, %ebx
	leaq	-48(%rbp), %r8
	movl	$4, %r9d
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	movq	_PCI_STATUS_CAP_LIST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -48(%rbp)
	je	LBB0_14
## %bb.2:
	movq	_PCI_CAPABILITY_LIST@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%ebx, %ebx
	leaq	-44(%rbp), %r8
	movl	$4, %r9d
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	movl	-44(%rbp), %ecx
	testl	%ecx, %ecx
	je	LBB0_14
## %bb.3:
	leaq	-52(%rbp), %r8
	movl	$4, %r9d
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	movl	-64(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, -52(%rbp)
	je	LBB0_7
## %bb.4:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	-44(%rbp), %ecx
	incl	%ecx
	movl	$4, %r9d
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	leaq	-44(%rbp), %r8
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	movl	-44(%rbp), %ecx
	testl	%ecx, %ecx
	je	LBB0_14
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$4, %r9d
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	leaq	-52(%rbp), %r8
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	movl	-64(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, -52(%rbp)
	jne	LBB0_5
LBB0_7:
	testq	%r13, %r13
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	je	LBB0_13
## %bb.8:
	testq	%rsi, %rsi
	je	LBB0_13
## %bb.9:
	movq	(%rsi), %rax
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	movq	$0, (%rsi)
	movslq	-44(%rbp), %rbx
	leaq	(%rax,%rbx), %rdi
	addq	$2, %rdi
	addq	$2, %rbx
	movq	_PCI_CONFIG_SPACE_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, %rdx
	subq	%rbx, %rdx
	cmpq	%rcx, %rdi
	cmovleq	%rax, %rdx
	movq	%rdx, (%rsi)
	testq	%rdx, %rdx
	je	LBB0_13
## %bb.11:
	movq	%rdi, %r8
	cmpq	%rdi, %rcx
	cmovlq	%rcx, %r8
	movq	%r8, -64(%rbp)                  ## 8-byte Spill
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	$4, %r9d
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	movl	%ebx, %ecx
	movq	%r13, %r8
	xorl	%eax, %eax
	callq	_bcma_extpci_read_config
	incq	%r13
	incq	%rbx
	cmpq	%rbx, -64(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_12
LBB0_13:
	movl	-44(%rbp), %ebx
LBB0_14:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_HEADER_TYPE,4,2            ## @PCI_HEADER_TYPE
	.comm	_PCI_HEADER_TYPE_NORMAL,4,2     ## @PCI_HEADER_TYPE_NORMAL
	.comm	_PCI_STATUS,4,2                 ## @PCI_STATUS
	.comm	_PCI_STATUS_CAP_LIST,4,2        ## @PCI_STATUS_CAP_LIST
	.comm	_PCI_CAPABILITY_LIST,4,2        ## @PCI_CAPABILITY_LIST
	.comm	_PCI_CONFIG_SPACE_SIZE,8,3      ## @PCI_CONFIG_SPACE_SIZE
	.no_dead_strip	_bcma_find_pci_capability
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcma_find_pci_capability
_bcma_find_pci_capability:              ; @bcma_find_pci_capability
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x23, x5
	mov	x19, x4
	mov	x24, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
	str	wzr, [sp, #24]
Lloh0:
	adrp	x8, _PCI_HEADER_TYPE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PCI_HEADER_TYPE@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	w8, #4
	add	x25, sp, #20
	stp	x25, x8, [sp]
	bl	_bcma_extpci_read_config
	mov	w0, #0
	ldr	w8, [sp, #20]
	and	w8, w8, #0x7f
Lloh3:
	adrp	x9, _PCI_HEADER_TYPE_NORMAL@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PCI_HEADER_TYPE_NORMAL@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_15
; %bb.1:
Lloh6:
	adrp	x8, _PCI_STATUS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PCI_STATUS@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	w8, #4
	stp	x25, x8, [sp]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	bl	_bcma_extpci_read_config
	ldr	w8, [sp, #20]
Lloh9:
	adrp	x9, _PCI_STATUS_CAP_LIST@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PCI_STATUS_CAP_LIST@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.2:
Lloh12:
	adrp	x8, _PCI_CAPABILITY_LIST@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PCI_CAPABILITY_LIST@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x8]
	mov	w8, #4
	add	x9, sp, #24
	stp	x9, x8, [sp]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	bl	_bcma_extpci_read_config
	ldr	w3, [sp, #24]
	cbz	w3, LBB0_14
; %bb.3:
	mov	w8, #4
	add	x25, sp, #28
	stp	x25, x8, [sp]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	bl	_bcma_extpci_read_config
	ldr	w8, [sp, #28]
	cmp	w8, w24
	b.eq	LBB0_7
; %bb.4:
	mov	w26, #4
	add	x27, sp, #24
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [sp, #24]
	add	w3, w8, #1
	stp	x27, x26, [sp]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	bl	_bcma_extpci_read_config
	ldr	w3, [sp, #24]
	cbz	w3, LBB0_14
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	stp	x25, x26, [sp]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	bl	_bcma_extpci_read_config
	ldr	w8, [sp, #28]
	cmp	w8, w24
	b.ne	LBB0_5
LBB0_7:
	cbz	x19, LBB0_13
; %bb.8:
	cbz	x23, LBB0_13
; %bb.9:
	ldr	x8, [x23]
	cbz	x8, LBB0_13
; %bb.10:
	str	xzr, [x23]
	ldrsw	x9, [sp, #24]
	add	x24, x9, #2
Lloh15:
	adrp	x9, _PCI_CONFIG_SPACE_SIZE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PCI_CONFIG_SPACE_SIZE@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	sub	x11, x9, x24
	add	x10, x8, x24
	cmp	x10, x9
	csel	x8, x11, x8, gt
	str	x8, [x23]
	cbz	x8, LBB0_13
; %bb.11:
	cmp	x9, x10
	csel	x23, x9, x10, lt
	mov	w25, #4
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	stp	x19, x25, [sp]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	mov	x3, x24
	bl	_bcma_extpci_read_config
	add	x19, x19, #1
	add	x24, x24, #1
	cmp	x23, x24
	b.ne	LBB0_12
LBB0_13:
	ldr	w0, [sp, #24]
	b	LBB0_15
LBB0_14:
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_HEADER_TYPE,4,2            ; @PCI_HEADER_TYPE
	.comm	_PCI_HEADER_TYPE_NORMAL,4,2     ; @PCI_HEADER_TYPE_NORMAL
	.comm	_PCI_STATUS,4,2                 ; @PCI_STATUS
	.comm	_PCI_STATUS_CAP_LIST,4,2        ; @PCI_STATUS_CAP_LIST
	.comm	_PCI_CAPABILITY_LIST,4,2        ; @PCI_CAPABILITY_LIST
	.comm	_PCI_CONFIG_SPACE_SIZE,8,3      ; @PCI_CONFIG_SPACE_SIZE
	.no_dead_strip	_bcma_find_pci_capability
.subsections_via_symbols
