	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function create_kernel_cq
_create_kernel_cq:                      ## @create_kernel_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r13d
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	32(%rdi), %r15
	movq	_HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rdi)
	je	LBB0_3
## %bb.1:
	leaq	8(%r14), %rsi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_hns_roce_alloc_db
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.2:
	movq	8(%r14), %rax
	movq	%rax, 32(%r14)
	movq	$0, (%rax)
	movl	$1, (%r14)
LBB0_3:
	leaq	24(%r14), %rsi
	movq	%rbx, %rdi
	movl	%r13d, %edx
	callq	_hns_roce_ib_alloc_cq_buf
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movl	%eax, %r12d
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
	movq	_HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_6
## %bb.5:
	addq	$8, %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_hns_roce_free_db
	jmp	LBB0_6
LBB0_7:
	movq	8(%rbx), %rax
	addq	16(%rbx), %rax
	movq	_DB_REG_OFFSET@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	movslq	24(%rbx), %rdx
	imulq	%rcx, %rdx
	addq	%rax, %rdx
	movq	%rdx, 16(%r14)
	xorl	%r12d, %r12d
LBB0_6:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HNS_ROCE_CAP_FLAG_RECORD_DB,4,2 ## @HNS_ROCE_CAP_FLAG_RECORD_DB
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to alloc_cq_buf.\n"

	.comm	_DB_REG_OFFSET,4,2              ## @DB_REG_OFFSET
	.no_dead_strip	_create_kernel_cq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function create_kernel_cq
_create_kernel_cq:                      ; @create_kernel_cq
	.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	x23, x2
	mov	x19, x1
	mov	x20, x0
	ldr	x22, [x0, #32]
	ldr	w8, [x0]
Lloh0:
	adrp	x24, _HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPAGE
Lloh1:
	ldr	x24, [x24, _HNS_ROCE_CAP_FLAG_RECORD_DB@GOTPAGEOFF]
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.1:
	add	x1, x19, #8
	mov	w25, #1
	mov	x0, x20
	mov	w2, #1
	bl	_hns_roce_alloc_db
	mov	x21, x0
	cbnz	w0, LBB0_7
; %bb.2:
	ldr	x8, [x19, #8]
	str	x8, [x19, #32]
	str	xzr, [x8]
	str	w25, [x19]
LBB0_3:
	add	x1, x19, #24
	mov	x0, x20
	mov	x2, x23
	bl	_hns_roce_ib_alloc_cq_buf
	mov	x21, x0
	cbz	w0, LBB0_6
; %bb.4:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_dev_err
	ldr	w8, [x20]
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.5:
	add	x1, x19, #8
	mov	x0, x20
	bl	_hns_roce_free_db
	b	LBB0_7
LBB0_6:
	ldp	x9, x8, [x20, #8]
	add	x8, x9, x8
Lloh4:
	adrp	x9, _DB_REG_OFFSET@GOTPAGE
Lloh5:
	ldr	x9, [x9, _DB_REG_OFFSET@GOTPAGEOFF]
Lloh6:
	ldrsw	x9, [x9]
	ldrsw	x10, [x20, #24]
	madd	x8, x10, x9, x8
	str	x8, [x19, #16]
LBB0_7:
	mov	x0, x21
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_HNS_ROCE_CAP_FLAG_RECORD_DB,4,2 ; @HNS_ROCE_CAP_FLAG_RECORD_DB
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to alloc_cq_buf.\n"

	.comm	_DB_REG_OFFSET,4,2              ; @DB_REG_OFFSET
	.no_dead_strip	_create_kernel_cq
.subsections_via_symbols
