	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehea_reg_kernel_mr             ## -- Begin function ehea_reg_kernel_mr
	.p2align	4, 0x90
_ehea_reg_kernel_mr:                    ## @ehea_reg_kernel_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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r13
	movq	_EHEA_MR_ACC_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_get_zeroed_page
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	_EHEA_BUSMAP_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ehea_mr_len@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%r13), %edi
	movl	4(%r13), %r8d
	leaq	12(%r15), %rbx
	leaq	16(%r15), %rax
	movq	%rax, (%rsp)
	movl	%r12d, %ecx
	movq	%rbx, %r9
	callq	_ehea_h_alloc_resource_mr
	movq	_H_SUCCESS@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_3
## %bb.6:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	_ehea_bmap@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	testq	%rsi, %rsi
	je	LBB0_19
## %bb.7:
	movq	_EHEA_MAP_ENTRIES@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	testq	%rdx, %rdx
	je	LBB0_17
## %bb.8:
	xorl	%ebx, %ebx
	movq	%rax, %rcx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rsi), %rsi
	cmpl	$0, (%rsi,%rbx,4)
	je	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movq	%r15, %rcx
	callq	_ehea_reg_mr_dir_sections
	movq	%rax, %rcx
	movq	(%r12), %rax
	movq	_H_PAGE_REGISTERED@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpq	%rax, %rcx
	jne	LBB0_15
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=1
	movq	_EHEA_MAP_ENTRIES@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=1
	incq	%rbx
	cmpq	%rdx, %rbx
	jae	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	_ehea_bmap@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	jmp	LBB0_9
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_4
LBB0_19:
	movl	(%r13), %edi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %esi
	movq	_FORCE_FREE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_ehea_h_free_resource
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_4
LBB0_15:
	cmpq	%rax, %rcx
	jne	LBB0_16
LBB0_17:
	movq	_EHEA_BUSMAP_START@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r15)
	movq	%r13, (%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_18
LBB0_16:
	movl	(%r13), %edi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %esi
	movq	_FORCE_FREE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_ehea_h_free_resource
	leaq	L_.str.3(%rip), %rdi
LBB0_4:
	callq	_pr_err
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movq	%r14, %rdi
	callq	_free_page
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EHEA_MR_ACC_CTRL,4,2           ## @EHEA_MR_ACC_CTRL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no mem\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EHEA_BUSMAP_START,4,2          ## @EHEA_BUSMAP_START
	.comm	_ehea_mr_len,4,2                ## @ehea_mr_len
	.comm	_H_SUCCESS,8,3                  ## @H_SUCCESS
L_.str.1:                               ## @.str.1
	.asciz	"alloc_resource_mr failed\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_ehea_bmap,8,3                  ## @ehea_bmap
	.comm	_FORCE_FREE,4,2                 ## @FORCE_FREE
L_.str.2:                               ## @.str.2
	.asciz	"no busmap available\n"

	.comm	_EHEA_MAP_ENTRIES,8,3           ## @EHEA_MAP_ENTRIES
	.comm	_H_PAGE_REGISTERED,8,3          ## @H_PAGE_REGISTERED
L_.str.3:                               ## @.str.3
	.asciz	"registering mr failed\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehea_reg_kernel_mr             ; -- Begin function ehea_reg_kernel_mr
	.p2align	2
_ehea_reg_kernel_mr:                    ; @ehea_reg_kernel_mr
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _EHEA_MR_ACC_CTRL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EHEA_MR_ACC_CTRL@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_get_zeroed_page
	mov	x19, x0
	cbz	x0, LBB0_10
; %bb.1:
Lloh6:
	adrp	x24, _EHEA_BUSMAP_START@GOTPAGE
Lloh7:
	ldr	x24, [x24, _EHEA_BUSMAP_START@GOTPAGEOFF]
Lloh8:
	adrp	x8, _ehea_mr_len@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ehea_mr_len@GOTPAGEOFF]
	ldr	w1, [x24]
Lloh10:
	ldr	w2, [x8]
	ldp	w0, w4, [x20]
	add	x22, x21, #12
	add	x6, x21, #16
	mov	x3, x23
	mov	x5, x22
	bl	_ehea_h_alloc_resource_mr
Lloh11:
	adrp	x25, _H_SUCCESS@GOTPAGE
Lloh12:
	ldr	x25, [x25, _H_SUCCESS@GOTPAGEOFF]
	ldr	x8, [x25]
	cmp	x0, x8
	b.ne	LBB0_11
; %bb.2:
Lloh13:
	adrp	x26, _ehea_bmap@GOTPAGE
Lloh14:
	ldr	x26, [x26, _ehea_bmap@GOTPAGEOFF]
	ldr	x10, [x26]
	cbz	x10, LBB0_12
; %bb.3:
Lloh15:
	adrp	x27, _EHEA_MAP_ENTRIES@GOTPAGE
Lloh16:
	ldr	x27, [x27, _EHEA_MAP_ENTRIES@GOTPAGEOFF]
	ldr	x9, [x27]
	cbz	x9, LBB0_14
; %bb.4:
	mov	x23, #0
Lloh17:
	adrp	x28, _H_PAGE_REGISTERED@GOTPAGE
Lloh18:
	ldr	x28, [x28, _H_PAGE_REGISTERED@GOTPAGEOFF]
	mov	x8, x0
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x10]
	ldr	w10, [x10, x23, lsl #2]
	cbz	w10, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x23
	mov	x1, x19
	mov	x2, x20
	mov	x3, x21
	bl	_ehea_reg_mr_dir_sections
	mov	x8, x0
	ldr	x9, [x28]
	ldr	x0, [x25]
	cmp	x8, x9
	ccmp	x8, x0, #4, ne
	b.ne	LBB0_13
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x9, [x27]
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x23, x23, #1
	cmp	x23, x9
	b.hs	LBB0_13
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x10, [x26]
	b	LBB0_5
LBB0_10:
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh21:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_17
LBB0_11:
Lloh23:
	adrp	x0, l_.str.1@PAGE
Lloh24:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_16
LBB0_12:
	ldr	w0, [x20]
	ldr	w1, [x22]
Lloh25:
	adrp	x8, _FORCE_FREE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _FORCE_FREE@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	bl	_ehea_h_free_resource
Lloh28:
	adrp	x0, l_.str.2@PAGE
Lloh29:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_16
LBB0_13:
	cmp	x8, x0
	b.ne	LBB0_15
LBB0_14:
	mov	w22, #0
	ldr	w8, [x24]
	str	w8, [x21, #8]
	str	x20, [x21]
	b	LBB0_18
LBB0_15:
	ldr	w0, [x20]
	ldr	w1, [x22]
Lloh30:
	adrp	x8, _FORCE_FREE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _FORCE_FREE@GOTPAGEOFF]
Lloh32:
	ldr	w2, [x8]
	bl	_ehea_h_free_resource
Lloh33:
	adrp	x0, l_.str.3@PAGE
Lloh34:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_16:
	bl	_pr_err
Lloh35:
	adrp	x8, _EIO@GOTPAGE
Lloh36:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_17:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_18:
	mov	x0, x19
	bl	_free_page
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_EHEA_MR_ACC_CTRL,4,2           ; @EHEA_MR_ACC_CTRL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no mem\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EHEA_BUSMAP_START,4,2          ; @EHEA_BUSMAP_START
	.comm	_ehea_mr_len,4,2                ; @ehea_mr_len
	.comm	_H_SUCCESS,8,3                  ; @H_SUCCESS
l_.str.1:                               ; @.str.1
	.asciz	"alloc_resource_mr failed\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_ehea_bmap,8,3                  ; @ehea_bmap
	.comm	_FORCE_FREE,4,2                 ; @FORCE_FREE
l_.str.2:                               ; @.str.2
	.asciz	"no busmap available\n"

	.comm	_EHEA_MAP_ENTRIES,8,3           ; @EHEA_MAP_ENTRIES
	.comm	_H_PAGE_REGISTERED,8,3          ; @H_PAGE_REGISTERED
l_.str.3:                               ; @.str.3
	.asciz	"registering mr failed\n"

.subsections_via_symbols
