	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function evtchnl_alloc
_evtchnl_alloc:                         ## @evtchnl_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
	movl	%ecx, %r13d
	movq	%rdx, %rbx
	movl	%esi, %r12d
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	movq	%rdx, %rdi
	xorl	%esi, %esi
	movl	$64, %edx
	callq	_memset
	movl	%r13d, (%rbx)
	movl	%r12d, 4(%rbx)
	movq	%r14, 56(%rbx)
	movq	_EVTCHNL_STATE_DISCONNECTED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%rbx)
	movq	_GRANT_INVALID_REF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	_GFP_NOIO@GOTPCREL(%rip), %rax
	movq	___GFP_HIGH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	callq	_get_zeroed_page
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	_EVTCHNL_TYPE_REQ@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jne	LBB0_6
## %bb.3:
	leaq	32(%rbx), %r13
	leaq	44(%rbx), %rdi
	callq	_init_completion
	leaq	40(%rbx), %rdi
	callq	_mutex_init
	movq	%r12, %rdi
	callq	_SHARED_RING_INIT
	movq	_XEN_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_FRONT_RING_INIT
	leaq	-44(%rbp), %rcx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	_xenbus_grant_ring
	testl	%eax, %eax
	js	LBB0_5
## %bb.4:
	movq	_evtchnl_interrupt_ctrl@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %r15d
	jmp	LBB0_10
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_8
LBB0_6:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	4(%rax), %r14d
	movq	%r12, %rdi
	callq	_virt_to_gfn
	movl	%r14d, %edi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_gnttab_grant_foreign_access
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_7
## %bb.9:
	movq	%r12, 24(%rbx)
	movl	%r15d, -44(%rbp)
	movq	_evtchnl_interrupt_evt@GOTPCREL(%rip), %rax
	movq	-56(%rbp), %r14                 ## 8-byte Reload
LBB0_10:
	movl	(%rax), %r12d
	movl	%r15d, 8(%rbx)
	leaq	16(%rbx), %rsi
	movq	%r14, %rdi
	callq	_xenbus_alloc_evtchn
	testl	%eax, %eax
	js	LBB0_11
## %bb.12:
	movl	16(%rbx), %edi
	movl	(%r14), %ecx
	xorl	%r14d, %r14d
	movl	%r12d, %esi
	xorl	%edx, %edx
	movq	%rbx, %r8
	callq	_bind_evtchn_to_irqhandler
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_8
## %bb.13:
	movl	%r15d, 12(%rbx)
	jmp	LBB0_14
LBB0_11:
	movl	%eax, %r15d
	jmp	LBB0_8
LBB0_5:
	movl	%eax, %r15d
	movq	$0, (%r13)
LBB0_7:
	movq	%r12, %rdi
	callq	_free_page
LBB0_8:
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	callq	_DRM_ERROR
	movl	%r15d, %r14d
LBB0_14:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EVTCHNL_STATE_DISCONNECTED,4,2 ## @EVTCHNL_STATE_DISCONNECTED
	.comm	_GRANT_INVALID_REF,4,2          ## @GRANT_INVALID_REF
	.comm	_GFP_NOIO,4,2                   ## @GFP_NOIO
	.comm	___GFP_HIGH,4,2                 ## @__GFP_HIGH
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EVTCHNL_TYPE_REQ,4,2           ## @EVTCHNL_TYPE_REQ
	.comm	_XEN_PAGE_SIZE,4,2              ## @XEN_PAGE_SIZE
	.comm	_evtchnl_interrupt_ctrl,4,2     ## @evtchnl_interrupt_ctrl
	.comm	_evtchnl_interrupt_evt,4,2      ## @evtchnl_interrupt_evt
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to allocate ring: %d\n"

	.no_dead_strip	_evtchnl_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function evtchnl_alloc
_evtchnl_alloc:                         ; @evtchnl_alloc
	.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, x3
	mov	x19, x2
	mov	x21, x1
	mov	x23, x0
	ldr	x20, [x0]
	mov	x0, x2
	mov	w1, #0
	mov	w2, #64
	bl	_memset
	stp	w22, w21, [x19]
	str	x23, [x19, #56]
Lloh0:
	adrp	x8, _EVTCHNL_STATE_DISCONNECTED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EVTCHNL_STATE_DISCONNECTED@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19, #48]
Lloh3:
	adrp	x8, _GRANT_INVALID_REF@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GRANT_INVALID_REF@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _GFP_NOIO@GOTPAGE
Lloh7:
	ldr	x9, [x9, _GFP_NOIO@GOTPAGEOFF]
	str	w8, [x19, #8]
Lloh8:
	ldr	w8, [x9]
Lloh9:
	adrp	x9, ___GFP_HIGH@GOTPAGE
Lloh10:
	ldr	x9, [x9, ___GFP_HIGH@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w0, w9, w8
	bl	_get_zeroed_page
	cbz	x0, LBB0_4
; %bb.1:
	mov	x21, x0
Lloh12:
	adrp	x8, _EVTCHNL_TYPE_REQ@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EVTCHNL_TYPE_REQ@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_5
; %bb.2:
	add	x23, x19, #32
	add	x0, x19, #44
	bl	_init_completion
	add	x0, x19, #40
	bl	_mutex_init
	mov	x0, x21
	bl	_SHARED_RING_INIT
Lloh15:
	adrp	x8, _XEN_PAGE_SIZE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _XEN_PAGE_SIZE@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x23
	mov	x1, x21
	bl	_FRONT_RING_INIT
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x21
	mov	w2, #1
	bl	_xenbus_grant_ring
	tbnz	w0, #31, LBB0_11
; %bb.3:
Lloh18:
	adrp	x8, _evtchnl_interrupt_ctrl@GOTPAGE
Lloh19:
	ldr	x8, [x8, _evtchnl_interrupt_ctrl@GOTPAGEOFF]
	ldr	w22, [sp, #12]
	b	LBB0_7
LBB0_4:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_13
LBB0_5:
	ldr	w22, [x20, #4]
	mov	x0, x21
	bl	_virt_to_gfn
	mov	x1, x0
	mov	x0, x22
	mov	w2, #0
	bl	_gnttab_grant_foreign_access
	mov	x22, x0
	tbnz	w0, #31, LBB0_12
; %bb.6:
	str	x21, [x19, #24]
	str	w22, [sp, #12]
Lloh23:
	adrp	x8, _evtchnl_interrupt_evt@GOTPAGE
Lloh24:
	ldr	x8, [x8, _evtchnl_interrupt_evt@GOTPAGEOFF]
LBB0_7:
	ldr	w21, [x8]
	str	w22, [x19, #8]
	add	x1, x19, #16
	mov	x0, x20
	bl	_xenbus_alloc_evtchn
	tbnz	w0, #31, LBB0_10
; %bb.8:
	ldr	w0, [x19, #16]
	ldr	w3, [x20]
	mov	x1, x21
	mov	w2, #0
	mov	x4, x19
	bl	_bind_evtchn_to_irqhandler
	mov	x22, x0
	tbnz	w0, #31, LBB0_13
; %bb.9:
	str	w22, [x19, #12]
	mov	w22, #0
	b	LBB0_14
LBB0_10:
	mov	x22, x0
	b	LBB0_13
LBB0_11:
	mov	x22, x0
	str	xzr, [x23]
LBB0_12:
	mov	x0, x21
	bl	_free_page
LBB0_13:
Lloh25:
	adrp	x0, l_.str@PAGE
Lloh26:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	bl	_DRM_ERROR
LBB0_14:
	mov	x0, 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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_EVTCHNL_STATE_DISCONNECTED,4,2 ; @EVTCHNL_STATE_DISCONNECTED
	.comm	_GRANT_INVALID_REF,4,2          ; @GRANT_INVALID_REF
	.comm	_GFP_NOIO,4,2                   ; @GFP_NOIO
	.comm	___GFP_HIGH,4,2                 ; @__GFP_HIGH
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EVTCHNL_TYPE_REQ,4,2           ; @EVTCHNL_TYPE_REQ
	.comm	_XEN_PAGE_SIZE,4,2              ; @XEN_PAGE_SIZE
	.comm	_evtchnl_interrupt_ctrl,4,2     ; @evtchnl_interrupt_ctrl
	.comm	_evtchnl_interrupt_evt,4,2      ; @evtchnl_interrupt_evt
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to allocate ring: %d\n"

	.no_dead_strip	_evtchnl_alloc
.subsections_via_symbols
