	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mthca_alloc_qp_common
_mthca_alloc_qp_common:                 ## @mthca_alloc_qp_common
	.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	%r9, %rbx
	movl	%r8d, %r14d
	movq	%rsi, %r12
	movq	%rdi, %r15
	movl	$1, (%r9)
	leaq	104(%r9), %rdi
	callq	_init_waitqueue_head
	leaq	100(%rbx), %rdi
	callq	_mutex_init
	movq	_IB_QPS_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 96(%rbx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 80(%rbx)
	movl	%r14d, 4(%rbx)
	leaq	48(%rbx), %rdi
	callq	_mthca_wq_reset
	leaq	16(%rbx), %rdi
	callq	_mthca_wq_reset
	leaq	72(%rbx), %rdi
	callq	_spin_lock_init
	leaq	40(%rbx), %rdi
	callq	_spin_lock_init
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mthca_map_memfree
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.1:
	movq	16(%rbp), %r13
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	movq	%r13, %rcx
	callq	_mthca_alloc_wqe_buf
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %r14d
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mthca_unmap_memfree
	jmp	LBB0_19
LBB0_3:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	callq	_mthca_adjust_qp_caps
	xorl	%r14d, %r14d
	testq	%r13, %r13
	jne	LBB0_19
## %bb.4:
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mthca_alloc_memfree
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %r12d
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mthca_free_wqe_buf
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mthca_unmap_memfree
	movl	%r12d, %r14d
	jmp	LBB0_19
LBB0_6:
	movq	%r15, %rdi
	callq	_mthca_is_memfree
	testq	%rax, %rax
	je	LBB0_7
## %bb.10:
	cmpl	$0, 20(%rbx)
	jle	LBB0_15
## %bb.11:
	movslq	16(%rbx), %rax
	leaq	16(,%rax,8), %rax
	shrq	$4, %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	movq	_MTHCA_INVAL_LKEY@GOTPCREL(%rip), %r15
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_12 Depth=1
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	cmpl	20(%rbx), %r12d
	jge	LBB0_15
LBB0_12:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_13 Depth 2
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_get_recv_wqe
	movq	%rax, %r13
	incl	%r12d
	movl	20(%rbx), %edi
	movl	$2147483647, %eax               ## imm = 0x7FFFFFFF
	addl	%eax, %edi
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	andl	%r12d, %edi
	movb	24(%rbx), %cl
	shll	%cl, %edi
	callq	_cpu_to_be32
	movq	%rax, (%r13)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_cpu_to_be32
	movq	%rax, 8(%r13)
	movb	24(%rbx), %cl
	movl	$1, %eax
	shll	%cl, %eax
	leaq	16(%r13), %r12
	.p2align	4, 0x90
LBB0_13:                                ##   Parent Loop BB0_12 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cltq
	addq	%r13, %rax
	cmpq	%r12, %rax
	jbe	LBB0_14
## %bb.20:                              ##   in Loop: Header=BB0_13 Depth=2
	movl	(%r15), %edi
	callq	_cpu_to_be32
	movq	%rax, (%r12)
	movzbl	24(%rbx), %ecx
	movl	$1, %eax
	shll	%cl, %eax
	addq	$8, %r12
	jmp	LBB0_13
LBB0_15:
	cmpl	$0, 52(%rbx)
	jle	LBB0_18
## %bb.16:
	xorl	%r15d, %r15d
	movl	$2147483647, %r13d              ## imm = 0x7FFFFFFF
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_get_send_wqe
	incl	%r15d
	movl	52(%rbx), %edi
	addl	%r13d, %edi
	andl	%r15d, %edi
	movzbl	56(%rbx), %ecx
	shll	%cl, %edi
	movq	%rax, %r12
	addl	8(%rbx), %edi
	callq	_cpu_to_be32
	movq	%rax, (%r12)
	cmpl	52(%rbx), %r15d
	jl	LBB0_17
	jmp	LBB0_18
LBB0_7:
	cmpl	$0, 20(%rbx)
	jle	LBB0_18
## %bb.8:
	xorl	%r15d, %r15d
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_get_recv_wqe
	movq	%rax, %r12
	incl	%r15d
	movl	%r15d, %eax
	cltd
	idivl	20(%rbx)
	movl	%edx, %edi
	movzbl	24(%rbx), %ecx
	shll	%cl, %edi
	orl	$1, %edi
	callq	_htonl
	movq	%rax, (%r12)
	cmpl	20(%rbx), %r15d
	jl	LBB0_9
LBB0_18:
	movl	52(%rbx), %esi
	decl	%esi
	movq	%rbx, %rdi
	callq	_get_send_wqe
	movq	%rax, 64(%rbx)
	movl	20(%rbx), %esi
	decl	%esi
	movq	%rbx, %rdi
	callq	_get_recv_wqe
	movq	%rax, 32(%rbx)
LBB0_19:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IB_QPS_RESET,4,2               ## @IB_QPS_RESET
	.comm	_MTHCA_INVAL_LKEY,4,2           ## @MTHCA_INVAL_LKEY
	.no_dead_strip	_mthca_alloc_qp_common
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mthca_alloc_qp_common
_mthca_alloc_qp_common:                 ; @mthca_alloc_qp_common
	.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	x21, x6
	mov	x19, x5
	mov	x23, x4
	mov	x22, x1
	mov	x20, x0
	mov	w8, #1
	str	w8, [x5]
	add	x0, x5, #104
	bl	_init_waitqueue_head
	add	x0, x19, #100
	bl	_mutex_init
Lloh0:
	adrp	x8, _IB_QPS_RESET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IB_QPS_RESET@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19, #96]
	stp	xzr, xzr, [x19, #80]
	str	w23, [x19, #4]
	add	x0, x19, #48
	bl	_mthca_wq_reset
	add	x0, x19, #16
	bl	_mthca_wq_reset
	add	x0, x19, #72
	bl	_spin_lock_init
	add	x0, x19, #40
	bl	_spin_lock_init
	mov	x0, x20
	mov	x1, x19
	bl	_mthca_map_memfree
	mov	x23, x0
	cbnz	w0, LBB0_6
; %bb.1:
	mov	x0, x20
	mov	x1, x22
	mov	x2, x19
	mov	x3, x21
	bl	_mthca_alloc_wqe_buf
	cbz	w0, LBB0_4
; %bb.2:
	mov	x23, x0
LBB0_3:
	mov	x0, x20
	mov	x1, x19
	bl	_mthca_unmap_memfree
	b	LBB0_6
LBB0_4:
	mov	x0, x20
	mov	x1, x22
	mov	x2, x19
	bl	_mthca_adjust_qp_caps
	cbz	x21, LBB0_7
; %bb.5:
	mov	w23, #0
LBB0_6:
	mov	x0, x23
	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
LBB0_7:
	mov	x0, x20
	mov	x1, x19
	bl	_mthca_alloc_memfree
	cbz	w0, LBB0_9
; %bb.8:
	mov	x23, x0
	mov	x0, x20
	mov	x1, x19
	bl	_mthca_free_wqe_buf
	b	LBB0_3
LBB0_9:
	mov	x0, x20
	bl	_mthca_is_memfree
	cbz	x0, LBB0_19
; %bb.10:
	ldr	w8, [x19, #20]
	cmp	w8, #1
	b.lt	LBB0_16
; %bb.11:
	mov	w20, #0
	ldrsw	x8, [x19, #16]
	lsl	x8, x8, #3
	add	x8, x8, #16
	lsr	x21, x8, #4
	mov	w23, #2147483647
	mov	w24, #1
Lloh3:
	adrp	x25, _MTHCA_INVAL_LKEY@GOTPAGE
Lloh4:
	ldr	x25, [x25, _MTHCA_INVAL_LKEY@GOTPAGEOFF]
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=1
	ldr	w8, [x19, #20]
	cmp	w20, w8
	b.ge	LBB0_16
LBB0_13:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
	mov	x0, x19
	mov	x1, x20
	bl	_get_recv_wqe
	mov	x22, x0
	add	w20, w20, #1
	ldp	w8, w9, [x19, #20]
	add	w8, w8, w23
	and	w8, w8, w20
	lsl	w0, w8, w9
	bl	_cpu_to_be32
	str	x0, [x22]
	mov	x0, x21
	bl	_cpu_to_be32
	str	x0, [x22, #8]
	add	x26, x22, #16
LBB0_14:                                ;   Parent Loop BB0_13 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x19, #24]
	lsl	w8, w24, w8
	add	x8, x22, w8, sxtw
	cmp	x8, x26
	b.ls	LBB0_12
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	ldr	w0, [x25]
	bl	_cpu_to_be32
	str	x0, [x26], #8
	b	LBB0_14
LBB0_16:
	ldr	w8, [x19, #52]
	cmp	w8, #1
	b.lt	LBB0_22
; %bb.17:
	mov	w20, #0
	mov	w22, #2147483647
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_get_send_wqe
	mov	x21, x0
	add	w20, w20, #1
	ldp	w8, w9, [x19, #52]
	add	w8, w8, w22
	and	w8, w8, w20
	lsl	w8, w8, w9
	ldr	w9, [x19, #8]
	add	w0, w8, w9
	bl	_cpu_to_be32
	str	x0, [x21]
	ldr	w8, [x19, #52]
	cmp	w20, w8
	b.lt	LBB0_18
	b	LBB0_22
LBB0_19:
	ldr	w8, [x19, #20]
	cmp	w8, #1
	b.lt	LBB0_22
; %bb.20:
	mov	w20, #0
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_get_recv_wqe
	mov	x21, x0
	add	w20, w20, #1
	ldp	w8, w9, [x19, #20]
	sdiv	w10, w20, w8
	msub	w8, w10, w8, w20
	lsl	w8, w8, w9
	orr	w0, w8, #0x1
	bl	_htonl
	str	x0, [x21]
	ldr	w8, [x19, #20]
	cmp	w20, w8
	b.lt	LBB0_21
LBB0_22:
	ldr	w8, [x19, #52]
	sub	w1, w8, #1
	mov	x0, x19
	bl	_get_send_wqe
	str	x0, [x19, #64]
	ldr	w8, [x19, #20]
	sub	w1, w8, #1
	mov	x0, x19
	bl	_get_recv_wqe
	mov	w23, #0
	str	x0, [x19, #32]
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_IB_QPS_RESET,4,2               ; @IB_QPS_RESET
	.comm	_MTHCA_INVAL_LKEY,4,2           ; @MTHCA_INVAL_LKEY
	.no_dead_strip	_mthca_alloc_qp_common
.subsections_via_symbols
