	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setup_blkring
_setup_blkring:                         ## @setup_blkring
	.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, %r15
	movq	%rdi, %r14
	movq	_GRANT_INVALID_REF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsi)
	movq	_GFP_NOIO@GOTPCREL(%rip), %rax
	movq	___GFP_HIGH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	callq	___get_free_page
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_SHARED_RING_INIT
	leaq	16(%r15), %r13
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_FRONT_RING_INIT
	movl	24(%r15), %edi
	movq	_BLKIF_MAX_SEGMENTS_PER_REQUEST@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_sg_init_table
	movq	16(%r15), %rdi
	callq	_virt_to_mfn
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_xenbus_grant_ring
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	%ebx, (%r15)
	leaq	8(%r15), %rsi
	movq	%r14, %rdi
	callq	_xenbus_alloc_evtchn
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:
	movl	8(%r15), %edi
	movq	_blkif_interrupt@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_IRQF_SAMPLE_RANDOM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.1(%rip), %rcx
	movq	%r15, %r8
	callq	_bind_evtchn_to_irqhandler
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_6
## %bb.9:
	movl	%ebx, 4(%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %r15
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	subl	(%r15), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	callq	_xenbus_dev_fatal
	subl	(%r15), %ebx
	jmp	LBB0_8
LBB0_3:
	movq	%r12, %rdi
	callq	_free_page
	movq	$0, (%r13)
	jmp	LBB0_7
LBB0_6:
	leaq	L_.str.2(%rip), %rdx
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_xenbus_dev_fatal
LBB0_7:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_blkif_free
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.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
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"allocating shared ring"

	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_BLKIF_MAX_SEGMENTS_PER_REQUEST,4,2 ## @BLKIF_MAX_SEGMENTS_PER_REQUEST
	.comm	_blkif_interrupt,4,2            ## @blkif_interrupt
	.comm	_IRQF_SAMPLE_RANDOM,4,2         ## @IRQF_SAMPLE_RANDOM
L_.str.1:                               ## @.str.1
	.asciz	"blkif"

L_.str.2:                               ## @.str.2
	.asciz	"bind_evtchn_to_irqhandler failed"

	.no_dead_strip	_setup_blkring
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setup_blkring
_setup_blkring:                         ; @setup_blkring
	.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	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _GRANT_INVALID_REF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GRANT_INVALID_REF@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _GFP_NOIO@GOTPAGE
Lloh4:
	ldr	x9, [x9, _GFP_NOIO@GOTPAGEOFF]
	str	w8, [x1]
Lloh5:
	ldr	w8, [x9]
Lloh6:
	adrp	x9, ___GFP_HIGH@GOTPAGE
Lloh7:
	ldr	x9, [x9, ___GFP_HIGH@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w0, w9, w8
	bl	___get_free_page
	cbz	x0, LBB0_5
; %bb.1:
	mov	x22, x0
	bl	_SHARED_RING_INIT
	add	x23, x19, #16
Lloh9:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x23
	mov	x1, x22
	bl	_FRONT_RING_INIT
	ldr	w0, [x19, #24]
Lloh12:
	adrp	x8, _BLKIF_MAX_SEGMENTS_PER_REQUEST@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BLKIF_MAX_SEGMENTS_PER_REQUEST@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	bl	_sg_init_table
	ldr	x0, [x19, #16]
	bl	_virt_to_mfn
	mov	x1, x0
	mov	x0, x20
	bl	_xenbus_grant_ring
	mov	x21, x0
	tbnz	w0, #31, LBB0_6
; %bb.2:
	mov	x1, x19
	str	w21, [x1], #8
	mov	x0, x20
	bl	_xenbus_alloc_evtchn
	mov	x21, x0
	cbnz	w0, LBB0_8
; %bb.3:
	ldr	w0, [x19, #8]
Lloh15:
	adrp	x8, _blkif_interrupt@GOTPAGE
Lloh16:
	ldr	x8, [x8, _blkif_interrupt@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x8, _IRQF_SAMPLE_RANDOM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _IRQF_SAMPLE_RANDOM@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
Lloh21:
	adrp	x3, l_.str.1@PAGE
Lloh22:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	x4, x19
	bl	_bind_evtchn_to_irqhandler
	mov	x21, x0
	cmp	w0, #0
	b.le	LBB0_7
; %bb.4:
	str	w21, [x19, #4]
	mov	w21, #0
	b	LBB0_9
LBB0_5:
Lloh23:
	adrp	x19, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x19, [x19, _ENOMEM@GOTPAGEOFF]
	ldr	w8, [x19]
	neg	w1, w8
Lloh25:
	adrp	x2, l_.str@PAGE
Lloh26:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	bl	_xenbus_dev_fatal
	ldr	w8, [x19]
	neg	w21, w8
	b	LBB0_9
LBB0_6:
	mov	x0, x22
	bl	_free_page
	str	xzr, [x23]
	b	LBB0_8
LBB0_7:
Lloh27:
	adrp	x2, l_.str.2@PAGE
Lloh28:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x20
	mov	x1, x21
	bl	_xenbus_dev_fatal
LBB0_8:
	mov	x0, x19
	mov	w1, #0
	bl	_blkif_free
LBB0_9:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.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
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"allocating shared ring"

	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_BLKIF_MAX_SEGMENTS_PER_REQUEST,4,2 ; @BLKIF_MAX_SEGMENTS_PER_REQUEST
	.comm	_blkif_interrupt,4,2            ; @blkif_interrupt
	.comm	_IRQF_SAMPLE_RANDOM,4,2         ; @IRQF_SAMPLE_RANDOM
l_.str.1:                               ; @.str.1
	.asciz	"blkif"

l_.str.2:                               ; @.str.2
	.asciz	"bind_evtchn_to_irqhandler failed"

	.no_dead_strip	_setup_blkring
.subsections_via_symbols
