	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gem_create
_gem_create:                            ## @gem_create
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rax
	movq	%rdi, %rbx
	movq	(%rdi), %r12
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%rax, %rdi
	callq	_round_up
	movq	%rax, %r14
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_gem_create_obj
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR_OR_NULL
	testq	%rax, %rax
	je	LBB0_1
LBB0_10:
	movq	%rbx, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	(%r12), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.2:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_gem_alloc_pages_array
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	20(%rbx), %edi
	movq	8(%rbx), %rsi
	callq	_alloc_xenballooned_pages
	testl	%eax, %eax
	js	LBB0_5
## %bb.9:
	movl	$1, (%rbx)
	jmp	LBB0_10
LBB0_6:
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_DIV_ROUND_UP
	movl	%eax, 20(%rbx)
	movq	%rbx, %rdi
	addq	$16, %rdi
	callq	_drm_gem_get_pages
	movq	%rax, 8(%rbx)
	movq	%rax, %rdi
	callq	_IS_ERR_OR_NULL
	testq	%rax, %rax
	je	LBB0_10
## %bb.7:
	movq	8(%rbx), %rdi
	callq	_PTR_ERR
	movl	%eax, %r15d
	movq	$0, 8(%rbx)
	jmp	LBB0_8
LBB0_3:
	movl	%eax, %r15d
	jmp	LBB0_8
LBB0_5:
	movl	%eax, %r15d
	movslq	20(%rbx), %rsi
	leaq	L_.str(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	%rbx, %rdi
	callq	_gem_free_pages_array
LBB0_8:
	leaq	L_.str.1(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movl	%r15d, %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot allocate %zu ballooned pages: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to allocate buffer with size %zu\n"

	.no_dead_strip	_gem_create
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gem_create
_gem_create:                            ; @gem_create
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x8, x1
	mov	x20, x0
	ldr	x22, [x0]
Lloh0:
	adrp	x21, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x8
	bl	_round_up
	mov	x19, x0
	mov	x0, x20
	mov	x1, x19
	bl	_gem_create_obj
	mov	x20, x0
	bl	_IS_ERR_OR_NULL
	cbz	x0, LBB0_2
LBB0_1:
	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
	add	sp, sp, #64
	ret
LBB0_2:
	ldr	x8, [x22]
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.3:
	mov	x0, x20
	mov	x1, x19
	bl	_gem_alloc_pages_array
	tbnz	w0, #31, LBB0_8
; %bb.4:
	ldr	w0, [x20, #20]
	ldr	x1, [x20, #8]
	bl	_alloc_xenballooned_pages
	tbnz	w0, #31, LBB0_9
; %bb.5:
	mov	w8, #1
	str	w8, [x20]
	b	LBB0_1
LBB0_6:
	ldr	w1, [x21]
	mov	x0, x19
	bl	_DIV_ROUND_UP
	str	w0, [x20, #20]
	add	x0, x20, #16
	bl	_drm_gem_get_pages
	str	x0, [x20, #8]
	bl	_IS_ERR_OR_NULL
	cbz	x0, LBB0_1
; %bb.7:
	ldr	x0, [x20, #8]
	bl	_PTR_ERR
	mov	x21, x0
	str	xzr, [x20, #8]
	b	LBB0_10
LBB0_8:
	mov	x21, x0
	b	LBB0_10
LBB0_9:
	mov	x21, x0
	ldrsw	x1, [x20, #20]
	str	x21, [sp]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	mov	x0, x20
	bl	_gem_free_pages_array
LBB0_10:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_DRM_ERROR
	mov	x0, x21
	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
	add	sp, sp, #64
	b	_ERR_PTR
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot allocate %zu ballooned pages: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to allocate buffer with size %zu\n"

	.no_dead_strip	_gem_create
.subsections_via_symbols
