	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_roce_ib_create_cq          ## -- Begin function hns_roce_ib_create_cq
	.p2align	4, 0x90
_hns_roce_ib_create_cq:                 ## @hns_roce_ib_create_cq
	.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	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	(%rdi), %edi
	callq	_to_hr_dev
	movq	%rax, %r13
	movq	16(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$0, -48(%rbp)
	movq	%rbx, %rdi
	callq	_to_hr_cq
	movl	4(%r12), %edx
	movl	(%r13), %ecx
	testl	%edx, %edx
	jle	LBB0_7
## %bb.1:
	cmpl	%ecx, %edx
	jg	LBB0_7
## %bb.2:
	movq	%rax, %r14
	movl	(%r12), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	8(%r13), %rsi
	testq	%rsi, %rsi
	je	LBB0_4
## %bb.3:
	movl	%edx, %edi
	callq	_max
	movl	%eax, %edx
LBB0_4:
	movl	%edx, %edi
	callq	_roundup_pow_of_two
	movl	%eax, %r12d
	decl	%eax
	movl	%eax, 32(%r14)
	leaq	28(%r14), %rdi
	callq	_spin_lock_init
	testq	%r15, %r15
	je	LBB0_8
## %bb.5:
	leaq	-48(%rbp), %rcx
	movq	%r13, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movl	%r12d, %r8d
	callq	_create_user_cq
	testl	%eax, %eax
	je	LBB0_11
## %bb.6:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_10
LBB0_7:
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_22
LBB0_8:
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%r12d, %edx
	callq	_create_kernel_cq
	testl	%eax, %eax
	je	LBB0_13
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
LBB0_10:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_22
LBB0_11:
	movq	%r14, %rdx
	addq	$24, %rdx
	movq	%r13, %rdi
	movl	%r12d, %esi
	movq	%r14, %rcx
	movl	-60(%rbp), %r8d                 ## 4-byte Reload
	callq	_hns_roce_cq_alloc
	testl	%eax, %eax
	je	LBB0_15
## %bb.12:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_17
LBB0_13:
	movq	%r14, %rdx
	addq	$24, %rdx
	movq	%r13, %rdi
	movl	%r12d, %esi
	movq	%r14, %rcx
	movl	-60(%rbp), %r8d                 ## 4-byte Reload
	callq	_hns_roce_cq_alloc
	testl	%eax, %eax
	je	LBB0_18
## %bb.14:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_destroy_kernel_cq
	jmp	LBB0_22
LBB0_15:
	movq	_hns_roce_ib_cq_comp@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r14)
	movq	_hns_roce_ib_cq_event@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	movl	%r12d, (%r14)
	movl	4(%r14), %eax
	movl	%eax, -48(%rbp)
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movl	$4, %edx
	callq	_ib_copy_to_udata
	testl	%eax, %eax
	je	LBB0_21
## %bb.16:
	movl	%eax, %ebx
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_hns_roce_free_cq
LBB0_17:
	leaq	-48(%rbp), %rcx
	movq	%r13, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	callq	_destroy_user_cq
	jmp	LBB0_22
LBB0_18:
	movq	16(%r14), %rax
	testq	%rax, %rax
	je	LBB0_20
## %bb.19:
	movq	$0, (%rax)
LBB0_20:
	movq	_hns_roce_ib_cq_comp@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r14)
	movq	_hns_roce_ib_cq_event@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	movl	%r12d, (%r14)
LBB0_21:
	xorl	%ebx, %ebx
LBB0_22:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Creat CQ failed. entries=%d, max=%d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Create cq failed in user mode!\n"

L_.str.2:                               ## @.str.2
	.asciz	"Create cq failed in kernel mode!\n"

L_.str.3:                               ## @.str.3
	.asciz	"Creat CQ .Failed to cq_alloc.\n"

	.comm	_hns_roce_ib_cq_comp,4,2        ## @hns_roce_ib_cq_comp
	.comm	_hns_roce_ib_cq_event,4,2       ## @hns_roce_ib_cq_event
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_roce_ib_create_cq          ; -- Begin function hns_roce_ib_create_cq
	.p2align	2
_hns_roce_ib_create_cq:                 ; @hns_roce_ib_create_cq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x21, x2
	mov	x23, x1
	mov	x19, x0
	ldr	w0, [x0]
	bl	_to_hr_dev
	mov	x20, x0
	ldr	x22, [x0, #16]
	str	wzr, [sp, #24]
	mov	x0, x19
	bl	_to_hr_cq
	mov	x19, x0
	ldr	w0, [x23, #4]
	ldr	w8, [x20]
	cmp	w0, #1
	ccmp	w0, w8, #0, ge
	b.le	LBB0_2
; %bb.1:
	stp	x0, x8, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_dev_err
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_20
LBB0_2:
	ldr	w25, [x23]
	ldr	x1, [x20, #8]
	cbz	x1, LBB0_4
; %bb.3:
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_max
                                        ; kill: def $w0 killed $w0 def $x0
LBB0_4:
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_roundup_pow_of_two
	mov	x24, x0
	sub	w8, w0, #1
	str	w8, [x19, #32]
	add	x0, x19, #28
	bl	_spin_lock_init
	cbz	x21, LBB0_7
; %bb.5:
	add	x3, sp, #24
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	mov	x4, x24
	bl	_create_user_cq
	cbz	w0, LBB0_10
; %bb.6:
	mov	x23, x0
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_9
LBB0_7:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x24
	bl	_create_kernel_cq
	cbz	w0, LBB0_12
; %bb.8:
	mov	x23, x0
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_9:
	mov	x0, x22
	bl	_dev_err
	b	LBB0_20
LBB0_10:
	add	x2, x19, #24
	mov	x0, x20
	mov	x1, x24
	mov	x3, x19
	mov	x4, x25
	bl	_hns_roce_cq_alloc
	cbz	w0, LBB0_14
; %bb.11:
	mov	x23, x0
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x22
	bl	_dev_err
	b	LBB0_16
LBB0_12:
	add	x2, x19, #24
	mov	x0, x20
	mov	x1, x24
	mov	x3, x19
	mov	x4, x25
	bl	_hns_roce_cq_alloc
	cbz	w0, LBB0_17
; %bb.13:
	mov	x23, x0
Lloh11:
	adrp	x1, l_.str.3@PAGE
Lloh12:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x22
	bl	_dev_err
	mov	x0, x20
	mov	x1, x19
	bl	_destroy_kernel_cq
	b	LBB0_20
LBB0_14:
Lloh13:
	adrp	x8, _hns_roce_ib_cq_comp@GOTPAGE
Lloh14:
	ldr	x8, [x8, _hns_roce_ib_cq_comp@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, _hns_roce_ib_cq_event@GOTPAGE
Lloh17:
	ldr	x9, [x9, _hns_roce_ib_cq_event@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #8]
	str	w24, [x19]
	ldr	w8, [x19, #4]
	str	w8, [sp, #24]
	add	x1, sp, #24
	mov	x0, x21
	mov	w2, #4
	bl	_ib_copy_to_udata
	mov	x23, x0
	cbz	w0, LBB0_20
; %bb.15:
	mov	x0, x20
	mov	x1, x19
	bl	_hns_roce_free_cq
LBB0_16:
	add	x3, sp, #24
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	bl	_destroy_user_cq
	b	LBB0_20
LBB0_17:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_19
; %bb.18:
	str	xzr, [x8]
LBB0_19:
	mov	w23, #0
Lloh19:
	adrp	x8, _hns_roce_ib_cq_comp@GOTPAGE
Lloh20:
	ldr	x8, [x8, _hns_roce_ib_cq_comp@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x9, _hns_roce_ib_cq_event@GOTPAGE
Lloh23:
	ldr	x9, [x9, _hns_roce_ib_cq_event@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #8]
	str	w24, [x19]
LBB0_20:
	mov	x0, x23
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Creat CQ failed. entries=%d, max=%d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Create cq failed in user mode!\n"

l_.str.2:                               ; @.str.2
	.asciz	"Create cq failed in kernel mode!\n"

l_.str.3:                               ; @.str.3
	.asciz	"Creat CQ .Failed to cq_alloc.\n"

	.comm	_hns_roce_ib_cq_comp,4,2        ; @hns_roce_ib_cq_comp
	.comm	_hns_roce_ib_cq_event,4,2       ; @hns_roce_ib_cq_event
.subsections_via_symbols
