	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mthca_resize_cq
_mthca_resize_cq:                       ## @mthca_resize_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, %r13
	movl	%esi, %ebx
	movq	%rdi, %r12
	movl	4(%rdi), %edi
	callq	_to_mdev
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	_to_mcq
	testl	%ebx, %ebx
	jle	LBB0_2
## %bb.1:
	cmpl	%ebx, (%r15)
	jge	LBB0_3
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_21
LBB0_3:
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_mutex_lock
	incl	%ebx
	movl	%ebx, %edi
	callq	_roundup_pow_of_two
	movl	(%r12), %ecx
	incl	%ecx
	xorl	%ebx, %ebx
	cmpl	%ecx, %eax
	je	LBB0_20
## %bb.4:
	cmpq	$0, 24(%r14)
	je	LBB0_7
## %bb.5:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%eax, %r13d
	movl	%eax, %edx
	callq	_mthca_alloc_resize_buf
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_20
## %bb.6:
	movq	8(%r14), %rax
	movl	16(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jmp	LBB0_10
LBB0_7:
	movl	%eax, %ebx
	leaq	-56(%rbp), %rdi
	movq	%r13, %rsi
	movl	$4, %edx
	callq	_ib_copy_from_udata
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_9:
	movl	-56(%rbp), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	%ebx, %r13d
LBB0_10:
	movl	32(%r14), %ebx
	movl	%r13d, %edi
	callq	_ilog2
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	%eax, %ecx
	callq	_mthca_RESIZE_CQ
	testl	%eax, %eax
	je	LBB0_13
## %bb.11:
	movl	%eax, %ebx
	movq	8(%r14), %rsi
	testq	%rsi, %rsi
	je	LBB0_20
## %bb.12:
	movl	(%rsi), %edx
	addq	$16, %rsi
	movq	%r15, %rdi
	callq	_mthca_free_cq_buf
	movq	8(%r14), %rdi
	callq	_kfree
	movq	%r14, %r15
	addq	$4, %r15
	movq	%r15, %rdi
	callq	_spin_lock_irq
	movq	$0, 8(%r14)
	movq	%r15, %rdi
	callq	_spin_unlock_irq
	jmp	LBB0_20
LBB0_13:
	cmpq	$0, 24(%r14)
	je	LBB0_18
## %bb.14:
	movq	%r14, %rbx
	addq	$4, %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irq
	movq	8(%r14), %rdi
	movq	8(%rdi), %rax
	movq	_CQ_RESIZE_READY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_16
## %bb.15:
	movq	%r14, %rdi
	callq	_mthca_cq_resize_copy_cqes
	movl	20(%r14), %eax
	movl	%eax, -48(%rbp)
	movl	16(%r14), %r12d
	movq	8(%r14), %rdi
	movl	16(%rdi), %eax
	movl	%eax, 20(%r14)
	movl	(%rdi), %eax
	movl	%eax, 16(%r14)
	jmp	LBB0_17
LBB0_18:
	decl	%r13d
	movl	%r13d, (%r12)
	jmp	LBB0_19
LBB0_16:
	movl	16(%rdi), %eax
	movl	%eax, -48(%rbp)
	movl	(%rdi), %r12d
LBB0_17:
	callq	_kfree
	movq	$0, 8(%r14)
	movq	%rbx, %rdi
	callq	_spin_unlock_irq
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movl	%r12d, %edx
	callq	_mthca_free_cq_buf
LBB0_19:
	xorl	%ebx, %ebx
LBB0_20:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_21:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_CQ_RESIZE_READY,8,3            ## @CQ_RESIZE_READY
	.no_dead_strip	_mthca_resize_cq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mthca_resize_cq
_mthca_resize_cq:                       ; @mthca_resize_cq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x2
	mov	x23, x1
	mov	x21, x0
	ldr	w0, [x0, #4]
	bl	_to_mdev
	mov	x20, x0
	mov	x0, x21
	bl	_to_mcq
	cmp	w23, #1
	b.lt	LBB0_2
; %bb.1:
	ldr	w8, [x20]
	cmp	w8, w23
	b.ge	LBB0_3
LBB0_2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_19
LBB0_3:
	mov	x19, x0
	bl	_mutex_lock
	add	w0, w23, #1
	bl	_roundup_pow_of_two
	ldr	w8, [x21]
	add	w8, w8, #1
	cmp	w0, w8
	b.ne	LBB0_5
LBB0_4:
	mov	w22, #0
	b	LBB0_18
LBB0_5:
	mov	x23, x0
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_8
; %bb.6:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	_mthca_alloc_resize_buf
	mov	x22, x0
	cbnz	w0, LBB0_18
; %bb.7:
	ldr	x8, [x19, #8]
	ldr	w22, [x8, #16]
	b	LBB0_11
LBB0_8:
	add	x0, sp, #8
	mov	x1, x22
	mov	w2, #4
	bl	_ib_copy_from_udata
	cbz	x0, LBB0_10
; %bb.9:
Lloh3:
	adrp	x8, _EFAULT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_18
LBB0_10:
	ldr	w22, [sp, #8]
LBB0_11:
	ldr	w24, [x19, #32]
	mov	x0, x23
	bl	_ilog2
	mov	x3, x0
	mov	x0, x20
	mov	x1, x24
	mov	x2, x22
	bl	_mthca_RESIZE_CQ
	cbz	w0, LBB0_14
; %bb.12:
	mov	x22, x0
	ldr	x1, [x19, #8]
	cbz	x1, LBB0_18
; %bb.13:
	ldr	w2, [x1], #16
	mov	x0, x20
	bl	_mthca_free_cq_buf
	ldr	x0, [x19, #8]
	bl	_kfree
	add	x20, x19, #4
	mov	x0, x20
	bl	_spin_lock_irq
	str	xzr, [x19, #8]
	mov	x0, x20
	bl	_spin_unlock_irq
	b	LBB0_18
LBB0_14:
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_17
; %bb.15:
	add	x21, x19, #4
	mov	x0, x21
	bl	_spin_lock_irq
	ldr	x0, [x19, #8]
	ldr	x8, [x0, #8]
Lloh6:
	adrp	x9, _CQ_RESIZE_READY@GOTPAGE
Lloh7:
	ldr	x9, [x9, _CQ_RESIZE_READY@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_20
; %bb.16:
	mov	x0, x19
	bl	_mthca_cq_resize_copy_cqes
	ldp	w22, w8, [x19, #16]
	str	w8, [sp]
	ldr	x0, [x19, #8]
	ldr	w8, [x0, #16]
	str	w8, [x19, #20]
	ldr	w8, [x0]
	str	w8, [x19, #16]
	b	LBB0_21
LBB0_17:
	mov	w22, #0
	sub	w8, w23, #1
	str	w8, [x21]
LBB0_18:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_19:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_20:
	ldr	w8, [x0, #16]
	str	w8, [sp]
	ldr	w22, [x0]
LBB0_21:
	bl	_kfree
	str	xzr, [x19, #8]
	mov	x0, x21
	bl	_spin_unlock_irq
	mov	x1, sp
	mov	x0, x20
	mov	x2, x22
	bl	_mthca_free_cq_buf
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_CQ_RESIZE_READY,8,3            ; @CQ_RESIZE_READY
	.no_dead_strip	_mthca_resize_cq
.subsections_via_symbols
