	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pci_emul_add_capability
_pci_emul_add_capability:               ## @pci_emul_add_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	$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
	movq	%rsi, %r14
	movq	%rdi, %r15
	xorl	%edi, %edi
	testl	%edx, %edx
	setg	%dil
	callq	_assert
	movl	%ebx, %edi
	movl	$4, %esi
	callq	_roundup2
	movl	%eax, %r13d
	movq	_PCIR_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_pci_get_cfgdata16
	movq	_PCIM_STATUS_CAPPRESENT@GOTPCREL(%rip), %rsi
	testl	%eax, (%rsi)
	je	LBB0_1
## %bb.3:
	movl	(%r15), %edx
	addl	%edx, %r13d
	incl	%r13d
	movq	_PCI_REGMAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	incl	%eax
	movl	$-1, %r12d
	cmpl	%eax, %r13d
	jg	LBB0_9
## %bb.4:
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	incl	%edx
	movl	4(%r15), %esi
	incl	%esi
	movq	%r15, %rdi
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_pci_set_cfgdata8
	testl	%ebx, %ebx
	jg	LBB0_6
	jmp	LBB0_8
LBB0_1:
	movq	_CAP_START_OFFSET@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	addl	%edx, %r13d
	movq	_PCI_REGMAX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	incl	%ecx
	movl	$-1, %r12d
	cmpl	%ecx, %r13d
	jg	LBB0_9
## %bb.2:
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	_PCIR_CAP_PTR@GOTPCREL(%rip), %rcx
	movq	%rsi, %r13
	movl	(%rcx), %esi
	movq	%r15, %rdi
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
                                        ## kill: def $edx killed $edx killed $rdx
	movl	%eax, %r12d
	callq	_pci_set_cfgdata8
	movq	_PCIR_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	orl	(%r13), %r12d
	movq	%r15, %rdi
	movl	%r12d, %edx
	callq	_pci_set_cfgdata16
	testl	%ebx, %ebx
	jle	LBB0_8
LBB0_6:
	movl	%ebx, %r12d
	movl	-48(%rbp), %r13d                ## 4-byte Reload
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14,%rbx,4), %edx
	leal	(%rbx,%r13), %esi
	movq	%r15, %rdi
	callq	_pci_set_cfgdata8
	incq	%rbx
	cmpq	%rbx, %r12
	jne	LBB0_7
LBB0_8:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	leal	1(%rbx), %esi
	xorl	%r12d, %r12d
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_pci_set_cfgdata8
	movl	%ebx, 4(%r15)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	decl	%eax
	movl	%eax, (%r15)
LBB0_9:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCIR_STATUS,4,2                ## @PCIR_STATUS
	.comm	_PCIM_STATUS_CAPPRESENT,4,2     ## @PCIM_STATUS_CAPPRESENT
	.comm	_CAP_START_OFFSET,4,2           ## @CAP_START_OFFSET
	.comm	_PCI_REGMAX,4,2                 ## @PCI_REGMAX
	.comm	_PCIR_CAP_PTR,4,2               ## @PCIR_CAP_PTR
	.no_dead_strip	_pci_emul_add_capability
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pci_emul_add_capability
_pci_emul_add_capability:               ; @pci_emul_add_capability
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
	cmp	w2, #0
	cset	w0, gt
	bl	_assert
	mov	x0, x22
	mov	w1, #4
	bl	_roundup2
	mov	x24, x0
Lloh0:
	adrp	x25, _PCIR_STATUS@GOTPAGE
Lloh1:
	ldr	x25, [x25, _PCIR_STATUS@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x19
	bl	_pci_get_cfgdata16
Lloh2:
	adrp	x26, _PCIM_STATUS_CAPPRESENT@GOTPAGE
Lloh3:
	ldr	x26, [x26, _PCIM_STATUS_CAPPRESENT@GOTPAGEOFF]
	ldr	w8, [x26]
	tst	w8, w0
	b.eq	LBB0_3
; %bb.1:
	ldr	w8, [x19]
	add	w21, w8, #1
Lloh4:
	adrp	x8, _PCI_REGMAX@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PCI_REGMAX@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	add	w8, w8, #1
	add	w24, w21, w24
	cmp	w24, w8
	b.gt	LBB0_4
; %bb.2:
	ldr	w8, [x19, #4]
	add	w1, w8, #1
	mov	x0, x19
	mov	x2, x21
	bl	_pci_set_cfgdata8
	cmp	w22, #1
	b.ge	LBB0_6
	b	LBB0_8
LBB0_3:
Lloh7:
	adrp	x8, _CAP_START_OFFSET@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CAP_START_OFFSET@GOTPAGEOFF]
Lloh9:
	ldr	w21, [x8]
Lloh10:
	adrp	x8, _PCI_REGMAX@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PCI_REGMAX@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	add	w8, w8, #1
	add	w24, w21, w24
	cmp	w24, w8
	b.le	LBB0_5
LBB0_4:
	mov	w0, #-1
	b	LBB0_9
LBB0_5:
	mov	x23, x0
Lloh13:
	adrp	x8, _PCIR_CAP_PTR@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PCIR_CAP_PTR@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_pci_set_cfgdata8
	ldr	w1, [x25]
	ldr	w8, [x26]
	orr	w2, w8, w23
	mov	x0, x19
	bl	_pci_set_cfgdata16
	cmp	w22, #1
	b.lt	LBB0_8
LBB0_6:
	mov	w23, w22
	mov	x22, x21
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x20], #4
	mov	x0, x19
	mov	x1, x22
	bl	_pci_set_cfgdata8
	add	w22, w22, #1
	subs	x23, x23, #1
	b.ne	LBB0_7
LBB0_8:
	add	w1, w21, #1
	mov	x0, x19
	mov	w2, #0
	bl	_pci_set_cfgdata8
	mov	w0, #0
	sub	w8, w24, #1
	stp	w8, w21, [x19]
LBB0_9:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_PCIR_STATUS,4,2                ; @PCIR_STATUS
	.comm	_PCIM_STATUS_CAPPRESENT,4,2     ; @PCIM_STATUS_CAPPRESENT
	.comm	_CAP_START_OFFSET,4,2           ; @CAP_START_OFFSET
	.comm	_PCI_REGMAX,4,2                 ; @PCI_REGMAX
	.comm	_PCIR_CAP_PTR,4,2               ; @PCIR_CAP_PTR
	.no_dead_strip	_pci_emul_add_capability
.subsections_via_symbols
