	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_roce_alloc_mw              ## -- Begin function hns_roce_alloc_mw
	.p2align	4, 0x90
_hns_roce_alloc_mw:                     ## @hns_roce_alloc_mw
	.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	%esi, %r12d
	movq	%rdi, %r15
	movl	(%rdi), %edi
	callq	_to_hr_dev
	movq	%rax, %r14
	movq	$0, -48(%rbp)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$28, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.1:
	movq	%rax, %rbx
	leaq	12(%r14), %rdi
	leaq	-48(%rbp), %rsi
	callq	_hns_roce_bitmap_alloc
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_4
## %bb.2:
	movq	-48(%rbp), %rdi
	callq	_hw_index_to_key
	movl	%eax, 24(%rbx)
	movl	%eax, 4(%rbx)
	movl	%r12d, (%rbx)
	movq	%r15, %rdi
	callq	_to_hr_pd
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movl	8(%r14), %eax
	movl	%eax, 16(%rbx)
	movl	4(%r14), %eax
	movl	%eax, 12(%rbx)
	movl	(%r14), %eax
	movl	%eax, 8(%rbx)
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_hns_roce_mw_enable
	testl	%eax, %eax
	je	LBB0_5
## %bb.3:
	movl	%eax, %r13d
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_hns_roce_mw_free
LBB0_4:
	movq	%rbx, %rdi
	callq	_kfree
	movl	%r13d, %edi
	callq	_ERR_PTR
	movq	%rax, %rbx
LBB0_5:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_ENOMEM@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
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hns_roce_alloc_mw              ; -- Begin function hns_roce_alloc_mw
	.p2align	2
_hns_roce_alloc_mw:                     ; @hns_roce_alloc_mw
	.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, x1
	mov	x21, x0
	ldr	w0, [x0]
	bl	_to_hr_dev
	mov	x20, x0
	str	xzr, [sp, #8]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #28
	bl	_kmalloc
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x0
	add	x0, x20, #12
	add	x1, sp, #8
	bl	_hns_roce_bitmap_alloc
	mov	x23, x0
	cbnz	w0, LBB0_4
; %bb.2:
	ldr	x0, [sp, #8]
	bl	_hw_index_to_key
	str	w0, [x19, #24]
	stp	w22, w0, [x19]
	mov	x0, x21
	bl	_to_hr_pd
	ldr	w8, [x0]
	ldr	w9, [x20, #8]
	stp	w9, w8, [x19, #16]
	ldr	d0, [x20]
	str	d0, [x19, #8]
	mov	x0, x20
	mov	x1, x19
	bl	_hns_roce_mw_enable
	cbz	w0, LBB0_5
; %bb.3:
	mov	x23, x0
	mov	x0, x20
	mov	x1, x19
	bl	_hns_roce_mw_free
LBB0_4:
	mov	x0, x19
	bl	_kfree
	mov	x0, x23
	bl	_ERR_PTR
	mov	x19, x0
LBB0_5:
	mov	x0, x19
	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_6:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh5:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
.subsections_via_symbols
