	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function svc_create_memory_pool
_svc_create_memory_pool:                ## @svc_create_memory_pool
	.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
	movq	%rsi, %rbx
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r14
	movl	(%r14), %r13d
	movq	8(%rsi), %rdi
	movl	%r13d, %esi
	callq	_roundup
	movq	%rax, %r15
	movslq	(%rbx), %rdi
	addq	8(%rbx), %rdi
	movl	(%r14), %esi
	callq	_rounddown
	movq	%rax, %r14
	subq	%r15, %r14
	movq	_MEMREMAP_WC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_memremap
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movslq	%r13d, %rbx
	decq	%rbx
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdi
	movq	%rax, %rdx
	movl	%r15d, %ecx
	movl	%r14d, %r8d
	callq	_dev_dbg
	testq	%rbx, %r12
	jne	LBB0_5
## %bb.3:
	movq	%r15, %rax
	andq	%rbx, %rax
	jne	LBB0_5
## %bb.4:
	andq	%r14, %rbx
	jne	LBB0_5
## %bb.8:
	movl	$3, %edi
	movl	$-1, %esi
	callq	_gen_pool_create
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %r13
	movq	_gen_pool_best_fit@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	xorl	%edx, %edx
	callq	_gen_pool_set_algo
	movq	%r13, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	movq	%r14, %rcx
	movl	$-1, %r8d
	callq	_gen_pool_add_virt
	testl	%eax, %eax
	je	LBB0_13
## %bb.11:
	movl	%eax, %ebx
	leaq	L_.str.4(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	%r13, %rdi
	callq	_gen_pool_destroy
	jmp	LBB0_12
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_6
LBB0_5:
	leaq	L_.str.2(%rip), %rsi
	movq	%r13, %rdi
LBB0_6:
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_7:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_9:
	leaq	L_.str.3(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_13:
	movq	%r13, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_MEMREMAP_WC,4,2                ## @MEMREMAP_WC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fail to remap shared memory\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"reserved memory vaddr: %p, paddr: 0x%16x size: 0x%8x\n"

L_.str.2:                               ## @.str.2
	.asciz	"page is not aligned\n"

L_.str.3:                               ## @.str.3
	.asciz	"fail to create genpool\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_gen_pool_best_fit,4,2          ## @gen_pool_best_fit
L_.str.4:                               ## @.str.4
	.asciz	"fail to add memory chunk to the pool\n"

	.no_dead_strip	_svc_create_memory_pool
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function svc_create_memory_pool
_svc_create_memory_pool:                ; @svc_create_memory_pool
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x1
	mov	x19, x0
Lloh0:
	adrp	x22, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w23, [x22]
	ldr	x0, [x1, #8]
	mov	x1, x23
	bl	_roundup
	mov	x20, x0
	ldr	x8, [x21, #8]
	ldrsw	x9, [x21]
	add	x0, x8, x9
	ldr	w1, [x22]
	bl	_rounddown
	sub	x21, x0, x20
Lloh2:
	adrp	x8, _MEMREMAP_WC@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MEMREMAP_WC@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x21
	bl	_memremap
	cbz	x0, LBB0_3
; %bb.1:
	mov	x22, x0
	sxtw	x8, w23
	sub	x23, x8, #1
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	mov	x3, x20
	mov	x4, x21
	bl	_dev_dbg
	and	x8, x22, x23
	and	x9, x20, x23
	and	x10, x21, x23
	cmp	x8, #0
	ccmp	x9, #0, #0, eq
	ccmp	x10, #0, #0, eq
	b.eq	LBB0_7
; %bb.2:
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_4
LBB0_3:
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
LBB0_4:
	mov	x0, x19
	bl	_dev_err
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_ERR_PTR
LBB0_7:
	mov	w0, #3
	mov	w1, #-1
	bl	_gen_pool_create
	cbz	x0, LBB0_10
; %bb.8:
	mov	x23, x0
Lloh13:
	adrp	x8, _gen_pool_best_fit@GOTPAGE
Lloh14:
	ldr	x8, [x8, _gen_pool_best_fit@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x2, #0
	bl	_gen_pool_set_algo
	mov	x0, x23
	mov	x1, x22
	mov	x2, x20
	mov	x3, x21
	mov	w4, #-1
	bl	_gen_pool_add_virt
	cbz	w0, LBB0_11
; %bb.9:
	mov	x20, x0
Lloh16:
	adrp	x1, l_.str.4@PAGE
Lloh17:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	mov	x0, x23
	bl	_gen_pool_destroy
	b	LBB0_6
LBB0_10:
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_11:
	mov	x0, x23
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_MEMREMAP_WC,4,2                ; @MEMREMAP_WC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fail to remap shared memory\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"reserved memory vaddr: %p, paddr: 0x%16x size: 0x%8x\n"

l_.str.2:                               ; @.str.2
	.asciz	"page is not aligned\n"

l_.str.3:                               ; @.str.3
	.asciz	"fail to create genpool\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_gen_pool_best_fit,4,2          ; @gen_pool_best_fit
l_.str.4:                               ; @.str.4
	.asciz	"fail to add memory chunk to the pool\n"

	.no_dead_strip	_svc_create_memory_pool
.subsections_via_symbols
