	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_alloc_srq                ## -- Begin function mthca_alloc_srq
	.p2align	4, 0x90
_mthca_alloc_srq:                       ## @mthca_alloc_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdx), %rax
	cmpq	16(%rdi), %rax
	jg	LBB0_2
## %bb.1:
	movq	%rcx, %r14
	movq	%rdx, %r12
	movq	%rdi, %r13
	movl	8(%rdx), %ecx
	cmpl	24(%rdi), %ecx
	jle	LBB0_4
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_38:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	%r8, %r15
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, (%r14)
	movl	%ecx, 8(%r14)
	movq	$0, 64(%r14)
	movq	%r13, %rdi
	callq	_mthca_is_memfree
	movq	%rax, %rcx
	movq	(%r14), %rax
	testq	%rcx, %rcx
	je	LBB0_6
## %bb.5:
	incl	%eax
	movl	%eax, %edi
	callq	_roundup_pow_of_two
	jmp	LBB0_7
LBB0_6:
	incq	%rax
LBB0_7:
	movq	%rax, (%r14)
	movl	8(%r14), %eax
	leal	4(,%rax,4), %edi
	callq	_roundup_pow_of_two
	movl	$64, %edi
	movq	%rax, %rsi
	callq	_max
	movl	%eax, %ebx
	movq	%r13, %rdi
	callq	_mthca_is_memfree
	testq	%rax, %rax
	jne	LBB0_9
## %bb.8:
	cmpl	28(%r13), %ebx
	jg	LBB0_2
LBB0_9:
	movl	%ebx, %edi
	callq	_ilog2
	movl	%eax, 56(%r14)
	movq	%r13, %rdi
	callq	_mthca_alloc
	movl	%eax, 12(%r14)
	cmpl	$-1, %eax
	je	LBB0_10
## %bb.11:
	movq	%r13, %rdi
	callq	_mthca_is_memfree
	testq	%rax, %rax
	je	LBB0_16
## %bb.12:
	movq	%r15, %rbx
	movl	4(%r13), %esi
	movl	12(%r14), %edx
	movq	%r13, %rdi
	callq	_mthca_table_get
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_37
## %bb.13:
	movq	%rbx, %r15
	testq	%rbx, %rbx
	jne	LBB0_16
## %bb.14:
	movq	_MTHCA_DB_TYPE_SRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	12(%r14), %edx
	leaq	52(%r14), %rcx
	movq	%r13, %rdi
	callq	_mthca_alloc_db
	movq	%rax, 16(%r14)
	testq	%rax, %rax
	js	LBB0_15
LBB0_16:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_mthca_alloc_mailbox
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_18
## %bb.17:
	movq	%rbx, %rdi
	callq	_PTR_ERR
	movl	%eax, %r15d
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	jne	LBB0_36
	jmp	LBB0_34
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_18:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
	movq	%r15, %rcx
	callq	_mthca_alloc_srq_buf
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_32
## %bb.19:
	leaq	48(%r14), %rdi
	callq	_spin_lock_init
	movl	$1, 24(%r14)
	leaq	44(%r14), %rdi
	callq	_init_waitqueue_head
	leaq	40(%r14), %rdi
	callq	_mutex_init
	movq	%r13, %rdi
	callq	_mthca_is_memfree
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movl	(%r15), %ecx
	movq	%r13, %rdi
	testq	%rax, %rax
	je	LBB0_21
## %bb.20:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	callq	_mthca_arbel_init_srq_context
	jmp	LBB0_22
LBB0_15:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_36
LBB0_21:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	callq	_mthca_tavor_init_srq_context
LBB0_22:
	movl	12(%r14), %edx
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_mthca_SW2HW_SRQ
	testl	%eax, %eax
	je	LBB0_24
## %bb.23:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rsi
LBB0_29:
	movq	%r13, %rdi
	movl	%r15d, %edx
	callq	_mthca_warn
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	jne	LBB0_32
LBB0_31:
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_mthca_free_srq_buf
LBB0_32:
	movq	%r13, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_mthca_free_mailbox
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	jne	LBB0_36
LBB0_34:
	movq	%r13, %rdi
	callq	_mthca_is_memfree
	testq	%rax, %rax
	je	LBB0_36
## %bb.35:
	movq	_MTHCA_DB_TYPE_SRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	16(%r14), %rdx
	movq	%r13, %rdi
	callq	_mthca_free_db
LBB0_36:
	movl	4(%r13), %esi
	movl	12(%r14), %edx
	movq	%r13, %rdi
	callq	_mthca_table_put
LBB0_37:
	movl	12(%r14), %esi
	movq	%r13, %rdi
	callq	_mthca_free
	jmp	LBB0_38
LBB0_24:
	leaq	8(%r13), %r15
	movq	%r15, %rdi
	callq	_spin_lock_irq
	leaq	12(%r13), %rdi
	movl	32(%r13), %esi
	decl	%esi
	andl	12(%r14), %esi
	movq	%r14, %rdx
	callq	_mthca_array_set
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	_spin_unlock_irq
	testq	%rbx, %rbx
	je	LBB0_27
## %bb.25:
	movl	12(%r14), %edx
	movq	%r13, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_mthca_HW2SW_SRQ
	testl	%eax, %eax
	je	LBB0_26
## %bb.28:
	movl	%eax, %r15d
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_29
LBB0_27:
	movq	%r13, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_mthca_free_mailbox
	movq	$0, 32(%r14)
	movq	(%r14), %rax
	leal	-1(%rax), %ecx
	movl	%ecx, 28(%r14)
	decq	%rax
	movq	%rax, (%r12)
	movl	8(%r14), %eax
	movl	%eax, 8(%r12)
	xorl	%r15d, %r15d
	jmp	LBB0_38
LBB0_26:
	xorl	%r15d, %r15d
	cmpq	$0, -56(%rbp)                   ## 8-byte Folded Reload
	jne	LBB0_32
	jmp	LBB0_31
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MTHCA_DB_TYPE_SRQ,4,2          ## @MTHCA_DB_TYPE_SRQ
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SW2HW_SRQ failed (%d)\n"

L_.str.1:                               ## @.str.1
	.asciz	"HW2SW_SRQ failed (%d)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_alloc_srq                ; -- Begin function mthca_alloc_srq
	.p2align	2
_mthca_alloc_srq:                       ; @mthca_alloc_srq
	.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
	ldr	x8, [x2]
	ldr	x9, [x0, #16]
	cmp	x8, x9
	b.gt	LBB0_2
; %bb.1:
	mov	x22, x2
	mov	x20, x0
	ldr	w9, [x2, #8]
	ldr	w10, [x0, #24]
	cmp	w9, w10
	b.le	LBB0_5
LBB0_2:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w25, w8
LBB0_4:
	mov	x0, x25
	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_5:
	mov	x21, x4
	mov	x19, x3
	mov	x23, x1
	str	x8, [x3]
	str	w9, [x3, #8]
	str	xzr, [x3, #64]
	mov	x0, x20
	bl	_mthca_is_memfree
	ldr	x8, [x19]
	cbz	x0, LBB0_7
; %bb.6:
	add	w0, w8, #1
	bl	_roundup_pow_of_two
	b	LBB0_8
LBB0_7:
	add	x0, x8, #1
LBB0_8:
	str	x0, [x19]
	ldr	w8, [x19, #8]
	lsl	w8, w8, #2
	add	w0, w8, #4
	bl	_roundup_pow_of_two
	mov	x1, x0
	mov	w0, #64
	bl	_max
	mov	x24, x0
	mov	x0, x20
	bl	_mthca_is_memfree
	cbnz	x0, LBB0_10
; %bb.9:
	ldr	w8, [x20, #28]
	cmp	w24, w8
	b.gt	LBB0_2
LBB0_10:
	mov	x0, x24
	bl	_ilog2
	str	w0, [x19, #56]
	mov	x0, x20
	bl	_mthca_alloc
	str	w0, [x19, #12]
	cmn	w0, #1
	b.eq	LBB0_17
; %bb.11:
	mov	x0, x20
	bl	_mthca_is_memfree
	cbz	x0, LBB0_15
; %bb.12:
	ldr	w1, [x20, #4]
	ldr	w2, [x19, #12]
	mov	x0, x20
	bl	_mthca_table_get
	mov	x25, x0
	cbnz	w0, LBB0_32
; %bb.13:
	cbnz	x21, LBB0_15
; %bb.14:
Lloh2:
	adrp	x8, _MTHCA_DB_TYPE_SRQ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MTHCA_DB_TYPE_SRQ@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	ldr	w2, [x19, #12]
	add	x3, x19, #52
	mov	x0, x20
	bl	_mthca_alloc_db
	str	x0, [x19, #16]
	tbnz	x0, #63, LBB0_21
LBB0_15:
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_mthca_alloc_mailbox
	mov	x24, x0
	bl	_IS_ERR
	cbz	x0, LBB0_18
; %bb.16:
	mov	x0, x24
	bl	_PTR_ERR
	mov	x25, x0
	cbnz	x21, LBB0_31
	b	LBB0_29
LBB0_17:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_3
LBB0_18:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	mov	x3, x21
	bl	_mthca_alloc_srq_buf
	mov	x25, x0
	cbnz	w0, LBB0_28
; %bb.19:
	add	x0, x19, #48
	bl	_spin_lock_init
	mov	w8, #1
	str	w8, [x19, #24]
	add	x0, x19, #44
	bl	_init_waitqueue_head
	add	x0, x19, #40
	bl	_mutex_init
	mov	x0, x20
	bl	_mthca_is_memfree
	ldr	w3, [x24]
	cbz	x0, LBB0_22
; %bb.20:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	mov	x4, x21
	bl	_mthca_arbel_init_srq_context
	b	LBB0_23
LBB0_21:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w25, w8
	b	LBB0_31
LBB0_22:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	mov	x4, x21
	bl	_mthca_tavor_init_srq_context
LBB0_23:
	ldr	w2, [x19, #12]
	mov	x0, x20
	mov	x1, x24
	bl	_mthca_SW2HW_SRQ
	cbz	w0, LBB0_33
; %bb.24:
	mov	x25, x0
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
LBB0_25:
	mov	x0, x20
	mov	x2, x25
	bl	_mthca_warn
LBB0_26:
	cbnz	x21, LBB0_28
; %bb.27:
	mov	x0, x20
	mov	x1, x19
	bl	_mthca_free_srq_buf
LBB0_28:
	mov	x0, x20
	mov	x1, x24
	bl	_mthca_free_mailbox
	cbnz	x21, LBB0_31
LBB0_29:
	mov	x0, x20
	bl	_mthca_is_memfree
	cbz	x0, LBB0_31
; %bb.30:
Lloh15:
	adrp	x8, _MTHCA_DB_TYPE_SRQ@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MTHCA_DB_TYPE_SRQ@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	ldr	x2, [x19, #16]
	mov	x0, x20
	bl	_mthca_free_db
LBB0_31:
	ldr	w1, [x20, #4]
	ldr	w2, [x19, #12]
	mov	x0, x20
	bl	_mthca_table_put
LBB0_32:
	ldr	w1, [x19, #12]
	mov	x0, x20
	bl	_mthca_free
	b	LBB0_4
LBB0_33:
	add	x23, x20, #8
	mov	x0, x23
	bl	_spin_lock_irq
	add	x0, x20, #12
	ldr	w8, [x19, #12]
	ldr	w9, [x20, #32]
	sub	w9, w9, #1
	and	w1, w9, w8
	mov	x2, x19
	bl	_mthca_array_set
	mov	x25, x0
	mov	x0, x23
	bl	_spin_unlock_irq
	cbz	x25, LBB0_36
; %bb.34:
	ldr	w2, [x19, #12]
	mov	x0, x20
	mov	x1, x24
	bl	_mthca_HW2SW_SRQ
	mov	x25, x0
	cbz	w0, LBB0_26
; %bb.35:
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_25
LBB0_36:
	mov	x0, x20
	mov	x1, x24
	bl	_mthca_free_mailbox
	str	xzr, [x19, #32]
	ldr	x8, [x19]
	sub	w9, w8, #1
	str	w9, [x19, #28]
	sub	x8, x8, #1
	str	x8, [x22]
	ldr	w8, [x19, #8]
	str	w8, [x22, #8]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MTHCA_DB_TYPE_SRQ,4,2          ; @MTHCA_DB_TYPE_SRQ
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SW2HW_SRQ failed (%d)\n"

l_.str.1:                               ; @.str.1
	.asciz	"HW2SW_SRQ failed (%d)\n"

.subsections_via_symbols
