	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_c4iw_alloc_mr                  ## -- Begin function c4iw_alloc_mr
	.p2align	4, 0x90
_c4iw_alloc_mr:                         ## @c4iw_alloc_mr
	.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, %r14d
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movl	$0, -44(%rbp)
	leal	(,%r14,4), %edi
	movl	$32, %esi
	callq	_roundup
	movl	%eax, %r13d
	movq	%rbx, %rdi
	callq	_to_c4iw_pd
	movq	%rax, %r12
	movq	_IB_MR_TYPE_MEM_REG@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_18
## %bb.1:
	movq	8(%r12), %rbx
	cmpq	$0, 8(%rbx)
	setne	%al
	movq	_use_dsgl@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	setne	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_t4_max_fr_depth
	cmpl	%r14d, %eax
	jge	LBB0_2
LBB0_18:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_2:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$72, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_c4iw_alloc_wr_wait
	movl	%eax, 4(%r15)
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movl	%eax, %edi
	callq	_c4iw_init_wr_wait
	movq	(%rbx), %rdi
	leaq	8(%r15), %rdx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r13d, %esi
	callq	_dma_alloc_coherent
	movl	%eax, 12(%r15)
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movl	%r13d, (%r15)
	movq	%rbx, 16(%r15)
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_alloc_pbl
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.9:
	movl	%r14d, 24(%r15)
	movl	(%r12), %edx
	movl	4(%r15), %r9d
	movl	32(%r15), %r8d
	leaq	-44(%rbp), %rsi
	movq	%rbx, %rdi
	movl	%r14d, %ecx
	callq	_allocate_stag
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_12
## %bb.10:
	movl	(%r12), %eax
	movl	%eax, 52(%r15)
	movq	_FW_RI_STAG_NSMR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%r15)
	movl	-44(%rbp), %r12d
	movl	%r12d, 28(%r15)
	movq	$0, 40(%r15)
	movl	%r12d, 64(%r15)
	movl	%r12d, 60(%r15)
	sarl	$8, %r12d
	leaq	16(%rbx), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r12d, %esi
	movq	%r15, %rdx
	callq	_xa_insert_irq
	testq	%rax, %rax
	je	LBB0_19
## %bb.11:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	movl	-44(%rbp), %esi
	movl	4(%r15), %r9d
	movl	24(%r15), %edx
	movl	32(%r15), %ecx
	movl	56(%r15), %r8d
	movq	%rbx, %rdi
	callq	_dereg_mem
LBB0_12:
	movq	16(%r15), %rdi
	movl	32(%r15), %esi
	movl	24(%r15), %edx
	shll	$3, %edx
	callq	_c4iw_pblpool_free
LBB0_13:
	movq	16(%r15), %rax
	movq	(%rax), %rdi
	movl	12(%r15), %edx
	movl	(%r15), %esi
	movl	8(%r15), %ecx
	callq	_dma_free_coherent
	jmp	LBB0_14
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_16
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_15
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_14:
	movl	4(%r15), %edi
	callq	_c4iw_put_wr_wait
LBB0_15:
	movq	%r15, %rdi
	callq	_kfree
LBB0_16:
	movl	%r13d, %edi
	callq	_ERR_PTR
	movq	%rax, %rbx
LBB0_17:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	movq	%r15, %rbx
	addq	$60, %rbx
	movl	-44(%rbp), %ecx
	leaq	L_.str(%rip), %rdi
	movl	%r12d, %esi
	movq	%r15, %rdx
	callq	_pr_debug
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_IB_MR_TYPE_MEM_REG,4,2         ## @IB_MR_TYPE_MEM_REG
	.comm	_use_dsgl,8,3                   ## @use_dsgl
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_FW_RI_STAG_NSMR,4,2            ## @FW_RI_STAG_NSMR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mmid 0x%x mhp %p stag 0x%x\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_c4iw_alloc_mr                  ; -- Begin function c4iw_alloc_mr
	.p2align	2
_c4iw_alloc_mr:                         ; @c4iw_alloc_mr
	.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	x21, x2
	mov	x19, x1
	mov	x20, x0
	str	wzr, [sp, #12]
	lsl	w0, w2, #2
	mov	w1, #32
	bl	_roundup
	mov	x23, x0
	mov	x0, x20
	bl	_to_c4iw_pd
Lloh0:
	adrp	x8, _IB_MR_TYPE_MEM_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IB_MR_TYPE_MEM_REG@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_2
; %bb.1:
	mov	x22, x0
	ldr	x20, [x0, #8]
	ldr	x8, [x20, #8]
	cmp	x8, #0
Lloh3:
	adrp	x8, _use_dsgl@GOTPAGE
Lloh4:
	ldr	x8, [x8, _use_dsgl@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	ccmp	x8, #0, #4, ne
	cset	w0, ne
	bl	_t4_max_fr_depth
	cmp	w0, w21
	b.ge	LBB0_3
LBB0_2:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	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
	b	_ERR_PTR
LBB0_3:
Lloh9:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	w0, #72
	bl	_kzalloc
	cbz	x0, LBB0_12
; %bb.4:
	mov	x19, x0
	ldr	w0, [x24]
	bl	_c4iw_alloc_wr_wait
	str	w0, [x19, #4]
	cbz	w0, LBB0_13
; %bb.5:
	bl	_c4iw_init_wr_wait
	ldr	x0, [x20]
	add	x2, x19, #8
	ldr	w3, [x24]
	mov	x1, x23
	bl	_dma_alloc_coherent
	str	w0, [x19, #12]
	cbz	w0, LBB0_14
; %bb.6:
	str	w23, [x19]
	str	x20, [x19, #16]
	mov	x0, x19
	mov	x1, x21
	bl	_alloc_pbl
	mov	x23, x0
	cbnz	w0, LBB0_11
; %bb.7:
	str	w21, [x19, #24]
	ldr	w2, [x22]
	ldr	w4, [x19, #32]
	ldr	w5, [x19, #4]
	add	x1, sp, #12
	mov	x0, x20
	mov	x3, x21
	bl	_allocate_stag
	mov	x23, x0
	cbnz	w0, LBB0_10
; %bb.8:
	ldr	w8, [x22]
Lloh11:
	adrp	x9, _FW_RI_STAG_NSMR@GOTPAGE
Lloh12:
	ldr	x9, [x9, _FW_RI_STAG_NSMR@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #48]
	ldr	w8, [sp, #12]
	str	w8, [x19, #28]
	str	xzr, [x19, #40]
	asr	w22, w8, #8
	mov	x21, x19
	str	w8, [x21, #60]!
	str	w8, [x19, #64]
	add	x0, x20, #16
	ldr	w3, [x24]
	mov	x1, x22
	mov	x2, x19
	bl	_xa_insert_irq
	cbz	x0, LBB0_19
; %bb.9:
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w23, w8
	ldr	w1, [sp, #12]
	ldr	w2, [x19, #24]
	ldr	w3, [x19, #32]
	ldr	w4, [x19, #56]
	ldr	w5, [x19, #4]
	mov	x0, x20
	bl	_dereg_mem
LBB0_10:
	ldr	x0, [x19, #16]
	ldr	w1, [x19, #32]
	ldr	w8, [x19, #24]
	lsl	w2, w8, #3
	bl	_c4iw_pblpool_free
LBB0_11:
	ldr	x8, [x19, #16]
	ldr	x0, [x8]
	ldr	w1, [x19]
	ldp	w3, w2, [x19, #8]
	bl	_dma_free_coherent
	b	LBB0_15
LBB0_12:
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_17
LBB0_13:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_16
LBB0_14:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_15:
	ldr	w0, [x19, #4]
	bl	_c4iw_put_wr_wait
LBB0_16:
	mov	x0, x19
	bl	_kfree
LBB0_17:
	mov	x0, x23
	bl	_ERR_PTR
	mov	x21, x0
LBB0_18:
	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
	add	sp, sp, #80
	ret
LBB0_19:
	ldr	w3, [sp, #12]
Lloh26:
	adrp	x0, l_.str@PAGE
Lloh27:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	mov	x2, x19
	bl	_pr_debug
	b	LBB0_18
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_IB_MR_TYPE_MEM_REG,4,2         ; @IB_MR_TYPE_MEM_REG
	.comm	_use_dsgl,8,3                   ; @use_dsgl
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_FW_RI_STAG_NSMR,4,2            ; @FW_RI_STAG_NSMR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mmid 0x%x mhp %p stag 0x%x\n"

.subsections_via_symbols
