	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pci_p2pdma_add_resource        ## -- Begin function pci_p2pdma_add_resource
	.p2align	4, 0x90
_pci_p2pdma_add_resource:               ## @pci_p2pdma_add_resource
	.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
	movq	%rcx, %r14
	movq	%rdx, %r13
	movl	%esi, %r12d
	movq	%rdi, %r15
	callq	_pci_resource_flags
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_1
## %bb.3:
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_resource_len
	cmpq	%r14, %rax
	jle	LBB0_1
## %bb.4:
	testq	%r13, %r13
	jne	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_resource_len
	movq	%rax, %r13
	subq	%r14, %r13
LBB0_6:
	leaq	(%r14,%r13), %rbx
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_resource_len
	cmpq	%rax, %rbx
	jbe	LBB0_7
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_17:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	cmpq	$0, 8(%r15)
	je	LBB0_8
LBB0_9:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	$48, %esi
	callq	_devm_kzalloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.11:
	movq	%rax, %rcx
	addq	$16, %rcx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movl	%r12d, %esi
	movq	%rax, %rbx
	callq	_pci_resource_start
	addq	%r14, %rax
	movq	%rax, 24(%rbx)
	addq	%r13, %rax
	decq	%rax
	movq	%rax, 32(%rbx)
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_resource_flags
	movl	%eax, 16(%rbx)
	movq	_MEMORY_DEVICE_PCI_P2PDMA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%rbx)
	movq	%r15, 8(%rbx)
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_bus_address
	movq	%rax, %r13
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_resource_start
	subq	%rax, %r13
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, (%rbx)
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_devm_memremap_pages
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movq	%r13, %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_8:
	movq	%r15, %rdi
	callq	_pci_p2pdma_setup
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_17
	jmp	LBB0_9
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_13:
	movq	8(%r15), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pci_bus_address
	addq	%rax, %r14
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	callq	_resource_size
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_dev_to_node
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	40(%rcx), %r9d
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movq	%r13, %rsi
	movq	%r14, %rdx
	movl	%ebx, %ecx
	movl	%eax, %r8d
	callq	_gen_pool_add_owner
	testl	%eax, %eax
	je	LBB0_14
## %bb.15:
	movl	%eax, %ebx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_devm_memunmap_pages
LBB0_16:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_devm_kfree
	jmp	LBB0_17
LBB0_14:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_pci_info
	xorl	%ebx, %ebx
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_IORESOURCE_MEM,4,2             ## @IORESOURCE_MEM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MEMORY_DEVICE_PCI_P2PDMA,4,2   ## @MEMORY_DEVICE_PCI_P2PDMA
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"added peer-to-peer DMA memory %pR\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pci_p2pdma_add_resource        ; -- Begin function pci_p2pdma_add_resource
	.p2align	2
_pci_p2pdma_add_resource:               ; @pci_p2pdma_add_resource
	.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	x20, x3
	mov	x22, x2
	mov	x21, x1
	mov	x19, x0
	bl	_pci_resource_flags
Lloh0:
	adrp	x8, _IORESOURCE_MEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IORESOURCE_MEM@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_5
; %bb.1:
	mov	x0, x19
	mov	x1, x21
	bl	_pci_resource_len
	cmp	x0, x20
	b.le	LBB0_5
; %bb.2:
	cbnz	x22, LBB0_4
; %bb.3:
	mov	x0, x19
	mov	x1, x21
	bl	_pci_resource_len
	sub	x22, x0, x20
LBB0_4:
	add	x23, x22, x20
	mov	x0, x19
	mov	x1, x21
	bl	_pci_resource_len
	cmp	x23, x0
	b.ls	LBB0_8
LBB0_5:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_7:
	mov	x0, x23
	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
LBB0_8:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_12
LBB0_9:
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #48
	bl	_devm_kzalloc
	cbz	x0, LBB0_13
; %bb.10:
	mov	x23, x0
	mov	x0, x19
	mov	x1, x21
	bl	_pci_resource_start
	add	x8, x0, x20
	add	x9, x22, x8
	sub	x9, x9, #1
	stp	x8, x9, [x23, #24]
	mov	x0, x19
	mov	x1, x21
	bl	_pci_resource_flags
	mov	x22, x23
	str	w0, [x22, #16]!
Lloh8:
	adrp	x8, _MEMORY_DEVICE_PCI_P2PDMA@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MEMORY_DEVICE_PCI_P2PDMA@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	str	w8, [x23, #44]
	str	x19, [x23, #8]
	mov	x0, x19
	mov	x1, x21
	bl	_pci_bus_address
	mov	x24, x0
	mov	x0, x19
	mov	x1, x21
	bl	_pci_resource_start
	sub	x8, x24, x0
	str	x8, [x23]
	mov	x0, x19
	mov	x1, x22
	bl	_devm_memremap_pages
	mov	x24, x0
	bl	_IS_ERR
	cbz	x0, LBB0_14
; %bb.11:
	mov	x0, x24
	bl	_PTR_ERR
	mov	x23, x0
	b	LBB0_16
LBB0_12:
	mov	x0, x19
	bl	_pci_p2pdma_setup
	mov	x23, x0
	cbnz	w0, LBB0_7
	b	LBB0_9
LBB0_13:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
LBB0_14:
	ldr	x8, [x19, #8]
	ldr	w25, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_pci_bus_address
	add	x20, x0, x20
	mov	x0, x22
	bl	_resource_size
	mov	x21, x0
	mov	x0, x19
	bl	_dev_to_node
	mov	x4, x0
	ldr	w5, [x23, #40]
	mov	x0, x25
	mov	x1, x24
	mov	x2, x20
	mov	x3, x21
	bl	_gen_pool_add_owner
	mov	x23, x0
	cbz	w0, LBB0_17
; %bb.15:
	mov	x0, x19
	mov	x1, x22
	bl	_devm_memunmap_pages
LBB0_16:
	mov	x0, x19
	mov	x1, x22
	bl	_devm_kfree
	b	LBB0_7
LBB0_17:
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_pci_info
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_IORESOURCE_MEM,4,2             ; @IORESOURCE_MEM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MEMORY_DEVICE_PCI_P2PDMA,4,2   ; @MEMORY_DEVICE_PCI_P2PDMA
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"added peer-to-peer DMA memory %pR\n"

.subsections_via_symbols
