	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __afu_open
___afu_open:                            ## @__afu_open
	.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, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movl	4(%rdi), %edi
	callq	_CXL_DEVT_ADAPTER
	movl	%eax, %r13d
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	4(%rbx), %edi
	callq	_CXL_DEVT_AFU
	movl	%eax, %r14d
	movq	_ENODEV@GOTPCREL(%rip), %rbx
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
	subl	(%rbx), %r12d
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_pr_devel
	movl	%r13d, %edi
	callq	_get_cxl_adapter
	testq	%rax, %rax
	je	LBB0_8
## %bb.1:
	movq	%rax, %r13
	cmpl	(%rax), %r14d
	jg	LBB0_14
## %bb.2:
	leaq	8(%r13), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock
	movq	16(%r13), %rax
	movslq	%r14d, %rcx
	movq	(%rax,%rcx,8), %r14
	testq	%r14, %r14
	je	LBB0_9
## %bb.3:
	movq	%r14, %rdi
	callq	_cxl_afu_get
	movq	%rbx, %rdi
	callq	_spin_unlock
	cmpl	$0, (%r14)
	je	LBB0_13
## %bb.4:
	movq	_cxl_ops@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	*(%rax)
	testl	%eax, %eax
	je	LBB0_10
## %bb.5:
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_cxl_context_alloc
	testq	%rax, %rax
	je	LBB0_11
## %bb.6:
	movq	%rax, %rbx
	movq	%rax, %rdi
	movq	%r14, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_cxl_context_init
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.7:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_cxl_context_set_mapping
	movl	(%rbx), %esi
	leaq	L_.str.1(%rip), %rdi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_pr_devel
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	%rbx, (%rax)
	jmp	LBB0_13
LBB0_8:
	subl	(%rbx), %r15d
	movl	%r15d, %r12d
	jmp	LBB0_15
LBB0_9:
	movq	%rbx, %rdi
	callq	_spin_unlock
	jmp	LBB0_14
LBB0_10:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	jmp	LBB0_12
LBB0_11:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_12:
	subl	(%rax), %r12d
LBB0_13:
	movq	%r14, %rdi
	callq	_cxl_afu_put
LBB0_14:
	addq	$4, %r13
	movq	%r13, %rdi
	callq	_put_device
LBB0_15:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"afu_open afu%i.%i\n"

	.comm	_cxl_ops,8,3                    ## @cxl_ops
	.comm	_EIO,4,2                        ## @EIO
	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"afu_open pe: %i\n"

	.no_dead_strip	___afu_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __afu_open
___afu_open:                            ; @__afu_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x22, x2
	mov	x20, x1
	mov	x21, x0
	ldr	w0, [x0, #4]
	bl	_CXL_DEVT_ADAPTER
	mov	x19, x0
	ldr	w0, [x21, #4]
	bl	_CXL_DEVT_AFU
	mov	x23, x0
Lloh0:
	adrp	x24, _ENODEV@GOTPAGE
Lloh1:
	ldr	x24, [x24, _ENODEV@GOTPAGEOFF]
	ldr	w25, [x24]
	str	x19, [sp]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x23
	bl	_pr_devel
	mov	x0, x19
	bl	_get_cxl_adapter
	cbz	x0, LBB0_8
; %bb.1:
	mov	x19, x0
	neg	w24, w25
	ldr	w8, [x0]
	cmp	w23, w8
	b.gt	LBB0_14
; %bb.2:
	add	x25, x19, #8
	mov	x0, x25
	bl	_spin_lock
	ldr	x8, [x19, #16]
	ldr	x23, [x8, w23, sxtw #3]
	cbz	x23, LBB0_9
; %bb.3:
	mov	x0, x23
	bl	_cxl_afu_get
	mov	x0, x25
	bl	_spin_unlock
	ldr	w8, [x23]
	cbz	w8, LBB0_13
; %bb.4:
Lloh4:
	adrp	x8, _cxl_ops@GOTPAGE
Lloh5:
	ldr	x8, [x8, _cxl_ops@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x19
	mov	x1, x23
	blr	x8
	cbz	w0, LBB0_10
; %bb.5:
	bl	_cxl_context_alloc
	cbz	x0, LBB0_11
; %bb.6:
	mov	x25, x0
	mov	x1, x23
	mov	x2, x22
	bl	_cxl_context_init
	mov	x24, x0
	cbnz	w0, LBB0_13
; %bb.7:
	ldr	w1, [x21]
	mov	x0, x25
	bl	_cxl_context_set_mapping
	ldr	w1, [x25]
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_devel
	str	x25, [x20]
	b	LBB0_13
LBB0_8:
	ldr	w8, [x24]
	neg	w24, w8
	b	LBB0_15
LBB0_9:
	mov	x0, x25
	bl	_spin_unlock
	b	LBB0_14
LBB0_10:
Lloh9:
	adrp	x8, _EIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_13:
	mov	x0, x23
	bl	_cxl_afu_put
LBB0_14:
	add	x0, x19, #4
	bl	_put_device
LBB0_15:
	mov	x0, x24
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"afu_open afu%i.%i\n"

	.comm	_cxl_ops,8,3                    ; @cxl_ops
	.comm	_EIO,4,2                        ; @EIO
	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"afu_open pe: %i\n"

	.no_dead_strip	___afu_open
.subsections_via_symbols
