	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocxl_link_add_pe               ## -- Begin function ocxl_link_add_pe
	.p2align	4, 0x90
_ocxl_link_add_pe:                      ## @ocxl_link_add_pe
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r13
	movl	%r8d, -60(%rbp)                 ## 4-byte Spill
	movl	%ecx, %r14d
	movl	%edx, %r15d
	movl	%esi, %r12d
	movq	(%rdi), %rbx
	movl	$1, %edi
	callq	_BUILD_BUG_ON
	movq	_SPA_PASID_MAX@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_2:
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	_SPA_PE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	andl	%r12d, %r14d
	movslq	%r14d, %rax
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	8(%rbx), %r13
	leaq	(%rax,%rax,2), %r15
	shlq	$4, %r15
	cmpq	$0, (%r13,%r15)
	je	LBB0_5
## %bb.3:
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_4:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_11
LBB0_5:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	24(%rbp), %rdx
	movq	16(%rbp), %rcx
	leaq	(%r15,%r13), %rdi
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%rsi, 16(%rax)
	movq	%rcx, (%rax)
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rdx, 8(%rax)
	xorl	%esi, %esi
	movl	$48, %edx
	callq	_memset
	xorl	%edi, %edi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	testl	%ebx, %ebx
	sete	%dil
	callq	_calculate_cfg_state
	movl	%eax, %edi
	callq	_cpu_to_be64
	movq	%rax, 40(%r13,%r15)
	movq	_SPRN_LPID@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_mfspr
	movl	%eax, %edi
	callq	_cpu_to_be32
	movq	%rax, 32(%r13,%r15)
	movl	%ebx, %edi
	callq	_cpu_to_be32
	movq	%rax, 24(%r13,%r15)
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	callq	_cpu_to_be32
	movq	%rax, 16(%r13,%r15)
	movl	-60(%rbp), %edi                 ## 4-byte Reload
	callq	_cpu_to_be64
	movq	%rax, 8(%r13,%r15)
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	_SPA_PE_VALID@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_cpu_to_be32
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	testq	%rbx, %rbx
	je	LBB0_9
## %bb.8:
	movq	%rbx, %rdi
	callq	_mm_context_add_copro
	xorl	%eax, %eax
	callq	_mb
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	leaq	16(%r15), %rdi
	movl	%r14d, %esi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	callq	_radix_tree_insert
	movq	%rbx, %rdi
	callq	_mmgrab
	jmp	LBB0_10
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_9:
	xorl	%eax, %eax
	callq	_mb
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	leaq	16(%r15), %rdi
	movl	%r14d, %esi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	callq	_radix_tree_insert
LBB0_10:
	movq	_current@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	movq	8(%r15), %rsi
	movl	%r12d, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	-48(%rbp), %r8d                 ## 4-byte Reload
	callq	_trace_ocxl_context_add
	xorl	%ebx, %ebx
LBB0_11:
	movq	%r15, %rdi
	callq	_mutex_unlock
LBB0_12:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SPA_PASID_MAX,4,2              ## @SPA_PASID_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SPA_PE_MASK,4,2                ## @SPA_PE_MASK
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SPRN_LPID,4,2                  ## @SPRN_LPID
	.comm	_SPA_PE_VALID,4,2               ## @SPA_PE_VALID
	.comm	_current,8,3                    ## @current
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocxl_link_add_pe               ; -- Begin function ocxl_link_add_pe
	.p2align	2
_ocxl_link_add_pe:                      ; @ocxl_link_add_pe
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x28, x7
	mov	x26, x6
	mov	x23, x5
	mov	x24, x4
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	ldr	x19, [x0]
	mov	w0, #1
	bl	_BUILD_BUG_ON
Lloh0:
	adrp	x8, _SPA_PASID_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SPA_PASID_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_12
LBB0_2:
	str	w20, [sp, #12]                  ; 4-byte Folded Spill
	mov	x0, x19
	bl	_mutex_lock
Lloh6:
	adrp	x8, _SPA_PE_MASK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SPA_PE_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	and	w25, w8, w22
	ldr	x20, [x19, #8]
	mov	w8, #48
	smaddl	x27, w25, w8, x20
	ldr	x8, [x27]
	cbz	x8, LBB0_5
; %bb.3:
Lloh9:
	adrp	x8, _EBUSY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_11
LBB0_5:
Lloh11:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kmalloc
	cbz	x0, LBB0_8
; %bb.6:
	stp	x28, x23, [x0, #8]
	sxtw	x8, w25
	str	x26, [x0]
	mov	x26, x0
	mov	x28, x8
	mov	w25, #48
	mov	x0, x27
	mov	w1, #0
	mov	w2, #48
	bl	_memset
	cmp	w21, #0
	cset	w0, eq
	bl	_calculate_cfg_state
	bl	_cpu_to_be64
	madd	x20, x28, x25, x20
	str	x0, [x20, #40]
Lloh14:
	adrp	x8, _SPRN_LPID@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SPRN_LPID@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	bl	_mfspr
	bl	_cpu_to_be32
	str	x0, [x20, #32]
	mov	x0, x21
	bl	_cpu_to_be32
	str	x0, [x20, #24]
	ldr	w25, [sp, #12]                  ; 4-byte Folded Reload
	mov	x0, x25
	bl	_cpu_to_be32
	str	x0, [x20, #16]
	mov	x0, x24
	bl	_cpu_to_be64
	str	x0, [x20, #8]
Lloh17:
	adrp	x8, _SPA_PE_VALID@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SPA_PE_VALID@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	bl	_cpu_to_be32
	str	x0, [x27]
	cbz	x23, LBB0_9
; %bb.7:
	mov	x0, x23
	bl	_mm_context_add_copro
	bl	_mb
	add	x0, x19, #16
	mov	x1, x28
	mov	x2, x26
	bl	_radix_tree_insert
	mov	x0, x23
	bl	_mmgrab
	b	LBB0_10
LBB0_8:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_4
LBB0_9:
	bl	_mb
	add	x0, x19, #16
	mov	x1, x28
	mov	x2, x26
	bl	_radix_tree_insert
LBB0_10:
Lloh22:
	adrp	x8, _current@GOTPAGE
Lloh23:
	ldr	x8, [x8, _current@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	ldr	w0, [x8]
	ldr	x1, [x19, #8]
	mov	x2, x22
	mov	x3, x21
	mov	x4, x25
	bl	_trace_ocxl_context_add
	mov	w20, #0
LBB0_11:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_12:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_SPA_PASID_MAX,4,2              ; @SPA_PASID_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SPA_PE_MASK,4,2                ; @SPA_PE_MASK
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SPRN_LPID,4,2                  ; @SPRN_LPID
	.comm	_SPA_PE_VALID,4,2               ; @SPA_PE_VALID
	.comm	_current,8,3                    ; @current
.subsections_via_symbols
