	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hns_roce_alloc_ucontext
_hns_roce_alloc_ucontext:               ## @hns_roce_alloc_ucontext
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	callq	_to_hr_ucontext
	movq	%rax, %r15
	movl	(%rbx), %edi
	callq	_to_hr_dev
	cmpl	$0, 8(%rax)
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movl	4(%rax), %eax
	movl	%eax, -40(%rbp)
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_hns_roce_uar_alloc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
## %bb.3:
	movq	_HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_5
## %bb.4:
	leaq	8(%r15), %rdi
	callq	_INIT_LIST_HEAD
	movq	%r15, %rdi
	addq	$4, %rdi
	callq	_mutex_init
LBB0_5:
	leaq	-40(%rbp), %rsi
	movq	%r14, %rdi
	movl	$4, %edx
	callq	_ib_copy_to_udata
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	%eax, %ebx
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_hns_roce_uar_free
	jmp	LBB0_8
LBB0_1:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_6:
	xorl	%ebx, %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_HNS_ROCE_CAP_FLAG_RECORD_DB,4,2 ## @HNS_ROCE_CAP_FLAG_RECORD_DB
	.no_dead_strip	_hns_roce_alloc_ucontext
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hns_roce_alloc_ucontext
_hns_roce_alloc_ucontext:               ; @hns_roce_alloc_ucontext
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x1
	mov	x21, x0
	bl	_to_hr_ucontext
	mov	x19, x0
	ldr	w0, [x21]
	bl	_to_hr_dev
	ldr	w8, [x0, #8]
	cbz	w8, LBB0_6
; %bb.1:
	mov	x21, x0
	ldr	w8, [x0, #4]
	str	w8, [sp, #8]
	mov	x1, x19
	bl	_hns_roce_uar_alloc
	mov	x22, x0
	cbnz	w0, LBB0_7
; %bb.2:
	ldr	w8, [x21]
Lloh0:
	adrp	x9, _HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
	add	x0, x19, #8
	bl	_INIT_LIST_HEAD
	add	x0, x19, #4
	bl	_mutex_init
LBB0_4:
	add	x1, sp, #8
	mov	x0, x20
	mov	w2, #4
	bl	_ib_copy_to_udata
	mov	x22, x0
	cbz	w0, LBB0_7
; %bb.5:
	mov	x0, x21
	mov	x1, x19
	bl	_hns_roce_uar_free
	b	LBB0_7
LBB0_6:
Lloh3:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_7:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_HNS_ROCE_CAP_FLAG_RECORD_DB,4,2 ; @HNS_ROCE_CAP_FLAG_RECORD_DB
	.no_dead_strip	_hns_roce_alloc_ucontext
.subsections_via_symbols
