	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_roce_create_srq            ## -- Begin function hns_roce_create_srq
	.p2align	4, 0x90
_hns_roce_create_srq:                   ## @hns_roce_create_srq
	.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	%rdx, %r12
	movq	%rsi, %r15
	movq	%rdi, %r13
	movl	4(%rdi), %edi
	callq	_to_hr_dev
	movq	%rax, %rbx
	movl	$0, -48(%rbp)
	movq	%r13, %rdi
	callq	_to_hr_srq
	movq	8(%r15), %rcx
	cmpq	16(%rbx), %rcx
	jge	LBB0_2
## %bb.1:
	movq	16(%r15), %rcx
	cmpq	24(%rbx), %rcx
	jle	LBB0_3
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_19:
	movl	%r12d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rbx
	leaq	52(%rax), %rdi
	movq	%rax, %r14
	callq	_mutex_init
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	leaq	48(%r14), %rdi
	callq	_spin_lock_init
	movq	8(%r15), %rdi
	incq	%rdi
	callq	_roundup_pow_of_two
	movl	%eax, (%rbx)
	movl	16(%r15), %esi
	movl	%esi, 4(%rbx)
	shll	$4, %esi
	movl	$16, %edi
	callq	_max
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_ilog2
	movl	%eax, 44(%rbx)
	movl	(%rbx), %eax
	imull	%eax, %r14d
	movq	_HNS_ROCE_IDX_QUE_ENTRY_SZ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 32(%rbx)
	imull	%eax, %ecx
	movl	%ecx, 36(%rbx)
	movq	_MTT_TYPE_SRQWQE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
	movq	_MTT_TYPE_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%rbx)
	testq	%r12, %r12
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	je	LBB0_6
## %bb.4:
	movq	%r12, %rsi
	movl	%r14d, %edx
	callq	_create_user_srq
	testl	%eax, %eax
	je	LBB0_8
## %bb.5:
	movl	%eax, %r12d
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_19
LBB0_6:
	movl	%r14d, %esi
	callq	_create_kernel_srq
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %r12d
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_19
LBB0_8:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	%r14d, -68(%rbp)                ## 4-byte Spill
	addq	$16, -88(%rbp)                  ## 8-byte Folded Spill
	movl	4(%r15), %edi
	callq	_ib_srq_has_cq
	testq	%rax, %rax
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_9
## %bb.10:
	movl	(%r15), %edi
	callq	_to_hr_cq
	movl	(%rax), %r15d
	jmp	LBB0_11
LBB0_9:
	xorl	%r15d, %r15d
LBB0_11:
	movq	_SRQ_DB_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addq	(%r14), %rax
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rax, 24(%rbx)
	movl	(%r13), %edi
	callq	_to_hr_pd
	movl	(%rax), %esi
	movq	%rbx, (%rsp)
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	movl	%r15d, %edx
	xorl	%ecx, %ecx
	movq	-88(%rbp), %r8                  ## 8-byte Reload
	xorl	%r9d, %r9d
	callq	_hns_roce_srq_alloc
	testl	%eax, %eax
	je	LBB0_12
## %bb.15:
	movl	%eax, %r15d
	cmpq	$0, -80(%rbp)                   ## 8-byte Folded Reload
	jne	LBB0_16
## %bb.17:
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	-68(%rbp), %edx                 ## 4-byte Reload
	callq	_destroy_kernel_srq
	jmp	LBB0_18
LBB0_12:
	movq	_hns_roce_ib_srq_event@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rbx)
	movl	8(%rbx), %eax
	movl	%eax, -48(%rbp)
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	testq	%r15, %r15
	je	LBB0_19
## %bb.13:
	movl	(%r15), %edi
	movl	$4, %esi
	callq	_min
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_ib_copy_to_udata
	testq	%rax, %rax
	je	LBB0_19
## %bb.14:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_hns_roce_srq_free
LBB0_16:
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_destroy_user_srq
LBB0_18:
	movl	%r15d, %r12d
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_HNS_ROCE_IDX_QUE_ENTRY_SZ,4,2  ## @HNS_ROCE_IDX_QUE_ENTRY_SZ
	.comm	_MTT_TYPE_SRQWQE,4,2            ## @MTT_TYPE_SRQWQE
	.comm	_MTT_TYPE_IDX,4,2               ## @MTT_TYPE_IDX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Create user srq failed\n"

L_.str.1:                               ## @.str.1
	.asciz	"Create kernel srq failed\n"

	.comm	_SRQ_DB_REG,8,3                 ## @SRQ_DB_REG
	.comm	_hns_roce_ib_srq_event,4,2      ## @hns_roce_ib_srq_event
	.comm	_EFAULT,4,2                     ## @EFAULT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_roce_create_srq            ; -- Begin function hns_roce_create_srq
	.p2align	2
_hns_roce_create_srq:                   ; @hns_roce_create_srq
	.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	x21, x2
	mov	x23, x1
	mov	x22, x0
	ldr	w0, [x0, #4]
	bl	_to_hr_dev
	mov	x19, x0
	str	wzr, [sp, #8]
	mov	x0, x22
	bl	_to_hr_srq
	ldr	x8, [x23, #8]
	ldr	x9, [x19, #16]
	cmp	x8, x9
	b.ge	LBB0_2
; %bb.1:
	ldr	x8, [x23, #16]
	ldr	x9, [x19, #24]
	cmp	x8, x9
	b.le	LBB0_4
LBB0_2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w25, w8
LBB0_3:
	mov	x0, x25
	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
LBB0_4:
	mov	x20, x0
	add	x0, x0, #52
	bl	_mutex_init
	add	x0, x20, #48
	bl	_spin_lock_init
	ldr	x8, [x23, #8]
	add	x0, x8, #1
	bl	_roundup_pow_of_two
	ldr	w8, [x23, #16]
	stp	w0, w8, [x20]
	lsl	w1, w8, #4
	mov	w0, #16
	bl	_max
	mov	x24, x0
	bl	_ilog2
	ldr	w8, [x20]
Lloh3:
	adrp	x9, _MTT_TYPE_SRQWQE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MTT_TYPE_SRQWQE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	mov	x26, x20
	str	w9, [x26, #16]!
	mul	w24, w8, w24
Lloh6:
	adrp	x9, _HNS_ROCE_IDX_QUE_ENTRY_SZ@GOTPAGE
Lloh7:
	ldr	x9, [x9, _HNS_ROCE_IDX_QUE_ENTRY_SZ@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	mul	w8, w9, w8
	stp	w9, w8, [x20, #32]
Lloh9:
	adrp	x8, _MTT_TYPE_IDX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MTT_TYPE_IDX@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	stp	w8, w0, [x20, #40]
	mov	x0, x20
	cbz	x21, LBB0_7
; %bb.5:
	mov	x1, x21
	mov	x2, x24
	bl	_create_user_srq
	cbz	w0, LBB0_9
; %bb.6:
	mov	x25, x0
	ldr	w0, [x19, #8]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_3
LBB0_7:
	mov	x1, x24
	bl	_create_kernel_srq
	cbz	w0, LBB0_9
; %bb.8:
	mov	x25, x0
	ldr	w0, [x19, #8]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_3
LBB0_9:
	ldr	w0, [x23, #4]
	bl	_ib_srq_has_cq
	cbz	x0, LBB0_11
; %bb.10:
	ldr	w0, [x23]
	bl	_to_hr_cq
	ldr	w23, [x0]
	b	LBB0_12
LBB0_11:
	mov	w23, #0
LBB0_12:
	ldr	x8, [x19]
Lloh16:
	adrp	x9, _SRQ_DB_REG@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SRQ_DB_REG@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	add	x8, x9, x8
	str	x8, [x20, #24]
	ldr	w0, [x22]
	bl	_to_hr_pd
	ldr	w1, [x0]
	mov	x0, x19
	mov	x2, x23
	mov	w3, #0
	mov	x4, x26
	mov	w5, #0
	mov	x6, x20
	bl	_hns_roce_srq_alloc
	cbz	w0, LBB0_15
; %bb.13:
	mov	x25, x0
	cbnz	x21, LBB0_18
; %bb.14:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x24
	bl	_destroy_kernel_srq
	b	LBB0_3
LBB0_15:
Lloh19:
	adrp	x8, _hns_roce_ib_srq_event@GOTPAGE
Lloh20:
	ldr	x8, [x8, _hns_roce_ib_srq_event@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	str	w8, [x20, #12]
	ldr	w8, [x20, #8]
	str	w8, [sp, #8]
	cbz	x21, LBB0_19
; %bb.16:
	ldr	w0, [x21]
	mov	w1, #4
	bl	_min
	mov	x2, x0
	add	x1, sp, #8
	mov	x0, x21
	bl	_ib_copy_to_udata
	cbz	x0, LBB0_19
; %bb.17:
Lloh22:
	adrp	x8, _EFAULT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w25, w8
	mov	x0, x19
	mov	x1, x20
	bl	_hns_roce_srq_free
LBB0_18:
	mov	x0, x19
	mov	x1, x20
	bl	_destroy_user_srq
	b	LBB0_3
LBB0_19:
	mov	w25, #0
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_HNS_ROCE_IDX_QUE_ENTRY_SZ,4,2  ; @HNS_ROCE_IDX_QUE_ENTRY_SZ
	.comm	_MTT_TYPE_SRQWQE,4,2            ; @MTT_TYPE_SRQWQE
	.comm	_MTT_TYPE_IDX,4,2               ; @MTT_TYPE_IDX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Create user srq failed\n"

l_.str.1:                               ; @.str.1
	.asciz	"Create kernel srq failed\n"

	.comm	_SRQ_DB_REG,8,3                 ; @SRQ_DB_REG
	.comm	_hns_roce_ib_srq_event,4,2      ; @hns_roce_ib_srq_event
	.comm	_EFAULT,4,2                     ; @EFAULT
.subsections_via_symbols
