	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hns_roce_mhop_alloc
_hns_roce_mhop_alloc:                   ## @hns_roce_mhop_alloc
	.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, %r14
	movq	%rdi, %r13
	movq	(%rdx), %rax
	movq	_MR_TYPE_FRMR@GOTPCREL(%rip), %rcx
	movl	$1, %ebx
	movl	$1, %r12d
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	movl	(%r13), %r12d
LBB0_2:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	addl	4(%r13), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %ebx
	movq	_HNS_ROCE_HOP_NUM_0@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	cmpl	(%rcx), %r12d
	je	LBB0_16
## %bb.3:
	cmpl	$1, %r12d
	jne	LBB0_4
## %bb.17:
	movq	%r13, %rdi
	movq	%r14, %rdx
	movl	%ebx, %ecx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_pbl_1hop_alloc                 ## TAILCALL
LBB0_4:
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	leal	7(%rbx), %r15d
	testl	%ebx, %ebx
	cmovnsl	%ebx, %r15d
	movq	16(%r13), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	sarl	$3, %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r15d, %edi
	movl	$4, %esi
	callq	_kcalloc
	movq	%rax, 24(%r14)
	testq	%rax, %rax
	je	LBB0_15
## %bb.5:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r15d, %edi
	movl	$4, %esi
	callq	_kcalloc
	movq	%rax, 32(%r14)
	testq	%rax, %rax
	je	LBB0_14
## %bb.6:
	leaq	44(%r14), %rdx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	callq	_dma_alloc_coherent
	movl	%eax, 52(%r14)
	testl	%eax, %eax
	movl	-44(%rbp), %r15d                ## 4-byte Reload
	je	LBB0_13
## %bb.7:
	cmpl	$3, %r12d
	je	LBB0_10
## %bb.8:
	cmpl	$2, %r12d
	jne	LBB0_12
## %bb.9:
	movq	%r13, %rdi
	movl	%r15d, %esi
	movq	%r14, %rdx
	movl	%ebx, %ecx
	callq	_pbl_2hop_alloc
	jmp	LBB0_11
LBB0_10:
	movq	%r13, %rdi
	movl	%r15d, %esi
	movq	%r14, %rdx
	movl	%ebx, %ecx
	callq	_pbl_3hop_alloc
LBB0_11:
	testq	%rax, %rax
	je	LBB0_12
LBB0_13:
	movq	32(%r14), %rdi
	callq	_kfree
	movq	$0, 32(%r14)
LBB0_14:
	movq	24(%r14), %rdi
	callq	_kfree
	movq	$0, 24(%r14)
LBB0_15:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movl	%r15d, 8(%r14)
	movl	44(%r14), %eax
	movl	%eax, 48(%r14)
	movl	(%r13), %eax
	movl	%eax, 12(%r14)
	movl	4(%r13), %eax
	movl	%eax, 16(%r14)
	movl	8(%r13), %eax
	movl	%eax, 40(%r14)
	xorl	%eax, %eax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_MR_TYPE_FRMR,8,3               ## @MR_TYPE_FRMR
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_HNS_ROCE_HOP_NUM_0,4,2         ## @HNS_ROCE_HOP_NUM_0
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_hns_roce_mhop_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hns_roce_mhop_alloc
_hns_roce_mhop_alloc:                   ; @hns_roce_mhop_alloc
	.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	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldr	x9, [x2]
Lloh0:
	adrp	x8, _MR_TYPE_FRMR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MR_TYPE_FRMR@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x8]
	mov	w8, #1
	mov	w25, #1
	cmp	x9, x10
	b.eq	LBB0_2
; %bb.1:
	ldr	w25, [x20]
LBB0_2:
Lloh3:
	adrp	x9, _HNS_ROCE_HOP_NUM_0@GOTPAGE
Lloh4:
	ldr	x9, [x9, _HNS_ROCE_HOP_NUM_0@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w25, w9
	b.ne	LBB0_4
; %bb.3:
	mov	w0, #0
	b	LBB0_15
LBB0_4:
	ldr	w9, [x20, #4]
Lloh6:
	adrp	x10, _PAGE_SHIFT@GOTPAGE
Lloh7:
	ldr	x10, [x10, _PAGE_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	add	w9, w10, w9
	lsl	w22, w8, w9
	cmp	w25, #1
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	mov	x3, 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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_pbl_1hop_alloc
LBB0_6:
	ldr	x23, [x20, #16]
	add	w8, w22, #7
	cmp	w22, #0
	csel	w8, w8, w22, lt
	asr	w24, w8, #3
Lloh9:
	adrp	x26, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x26, [x26, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x26]
	mov	x0, x24
	mov	w1, #4
	bl	_kcalloc
	str	x0, [x19, #24]
	cbz	x0, LBB0_14
; %bb.7:
	ldr	w2, [x26]
	mov	x0, x24
	mov	w1, #4
	bl	_kcalloc
	str	x0, [x19, #32]
	cbz	x0, LBB0_13
; %bb.8:
	add	x2, x19, #44
	ldr	w3, [x26]
	mov	x0, x23
	mov	x1, x22
	bl	_dma_alloc_coherent
	str	w0, [x19, #52]
	cbz	w0, LBB0_12
; %bb.9:
	cmp	w25, #3
	b.eq	LBB0_16
; %bb.10:
	cmp	w25, #2
	b.ne	LBB0_17
; %bb.11:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	mov	x3, x22
	bl	_pbl_2hop_alloc
	cbz	x0, LBB0_17
LBB0_12:
	ldr	x0, [x19, #32]
	bl	_kfree
	str	xzr, [x19, #32]
LBB0_13:
	ldr	x0, [x19, #24]
	bl	_kfree
	str	xzr, [x19, #24]
LBB0_14:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	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_16:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	mov	x3, x22
	bl	_pbl_3hop_alloc
	cbnz	x0, LBB0_12
LBB0_17:
	mov	w0, #0
	str	w21, [x19, #8]
	ldr	w8, [x19, #44]
	str	w8, [x19, #48]
	ldr	d0, [x20]
	stur	d0, [x19, #12]
	ldr	w8, [x20, #8]
	str	w8, [x19, #40]
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_MR_TYPE_FRMR,8,3               ; @MR_TYPE_FRMR
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_HNS_ROCE_HOP_NUM_0,4,2         ; @HNS_ROCE_HOP_NUM_0
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_hns_roce_mhop_alloc
.subsections_via_symbols
