	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lg_find_vq
_lg_find_vq:                            ## @lg_find_vq
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r13
	movq	%rdx, %r14
	movl	%esi, %r15d
	movq	%rdi, %rbx
	callq	_to_lgdev
	movq	%rax, %r12
	movq	(%rax), %rax
	cmpl	%r15d, (%rax)
	jbe	LBB0_1
## %bb.4:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r13
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%rax, %r14
	addq	$8, %r14
	movq	(%r12), %rdi
	callq	_lg_vq
                                        ## kill: def $eax killed $eax def $rax
	leal	(%rax,%r15), %esi
	movq	%r14, %rdi
	movl	$16, %edx
	callq	_memcpy
	movq	16(%r13), %rdx
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %r12
	movb	(%r12), %cl
	shlq	%cl, %rdx
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	callq	_printk
	movq	16(%r13), %rbx
	movb	(%r12), %cl
	shlq	%cl, %rbx
	movl	12(%r13), %edi
	movq	_LGUEST_VRING_ALIGN@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_vring_size
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_DIV_ROUND_UP
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_lguest_map
	movl	%eax, (%r13)
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movl	12(%r13), %edi
	movl	(%r15), %esi
	movq	_lg_notify@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, (%rsp)
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	movl	%eax, %ecx
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	callq	_vring_new_virtqueue
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %r15
	movl	(%r14), %edi
	callq	_lguest_setup_irq
	movl	(%r14), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	_vring_interrupt@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_IRQF_SHARED@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	%rbx, %rdi
	callq	_dev_name
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%r14d, %esi
	movl	%r12d, %edx
	movl	%eax, %ecx
	movq	%r15, %r8
	callq	_request_irq
	testl	%eax, %eax
	je	LBB0_14
## %bb.11:
	movl	%eax, %r14d
	movq	%r15, %rdi
	callq	_vring_del_virtqueue
	jmp	LBB0_12
LBB0_1:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%edi, %edi
	subl	(%rax), %edi
	jmp	LBB0_3
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_13
LBB0_9:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_12:
	movl	(%r13), %edi
	callq	_lguest_unmap
LBB0_13:
	movq	%r13, %rdi
	callq	_kfree
	movl	%r14d, %edi
LBB0_3:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_14:
	movq	%r13, (%r15)
	movq	%r15, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Mapping virtqueue %i addr %lx\n"

	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	_LGUEST_VRING_ALIGN,4,2         ## @LGUEST_VRING_ALIGN
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_lg_notify,4,2                  ## @lg_notify
	.comm	_vring_interrupt,4,2            ## @vring_interrupt
	.comm	_IRQF_SHARED,4,2                ## @IRQF_SHARED
	.no_dead_strip	_lg_find_vq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lg_find_vq
_lg_find_vq:                            ; @lg_find_vq
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x3
	mov	x22, x2
	mov	x24, x1
	mov	x20, x0
	bl	_to_lgdev
	ldr	x8, [x0]
	ldr	w8, [x8]
	cmp	w8, w24
	b.ls	LBB0_6
; %bb.1:
	mov	x25, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kmalloc
	cbz	x0, LBB0_7
; %bb.2:
	mov	x19, x0
	add	x23, x0, #8
	ldr	x0, [x25]
	bl	_lg_vq
	add	w1, w0, w24
	mov	x0, x23
	mov	w2, #16
	bl	_memcpy
	ldr	x8, [x19, #16]
Lloh3:
	adrp	x25, _PAGE_SHIFT@GOTPAGE
Lloh4:
	ldr	x25, [x25, _PAGE_SHIFT@GOTPAGEOFF]
	ldr	x9, [x25]
	lsl	x2, x8, x9
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x24
	bl	_printk
	ldr	x8, [x19, #16]
	ldr	x9, [x25]
	lsl	x24, x8, x9
	ldr	w0, [x19, #12]
Lloh7:
	adrp	x25, _LGUEST_VRING_ALIGN@GOTPAGE
Lloh8:
	ldr	x25, [x25, _LGUEST_VRING_ALIGN@GOTPAGEOFF]
	ldr	w1, [x25]
	bl	_vring_size
Lloh9:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_DIV_ROUND_UP
	mov	x1, x0
	mov	x0, x24
	bl	_lguest_map
	str	w0, [x19]
	cbz	w0, LBB0_9
; %bb.3:
	mov	x3, x0
	ldr	w0, [x19, #12]
	ldr	w1, [x25]
Lloh12:
	adrp	x8, _lg_notify@GOTPAGE
Lloh13:
	ldr	x8, [x8, _lg_notify@GOTPAGEOFF]
Lloh14:
	ldr	w4, [x8]
	mov	x2, x20
	mov	x5, x22
	mov	x6, x21
	bl	_vring_new_virtqueue
	cbz	x0, LBB0_10
; %bb.4:
	mov	x21, x0
	ldr	w0, [x23]
	bl	_lguest_setup_irq
	ldr	w22, [x23]
Lloh15:
	adrp	x8, _vring_interrupt@GOTPAGE
Lloh16:
	ldr	x8, [x8, _vring_interrupt@GOTPAGEOFF]
Lloh17:
	ldr	w23, [x8]
Lloh18:
	adrp	x8, _IRQF_SHARED@GOTPAGE
Lloh19:
	ldr	x8, [x8, _IRQF_SHARED@GOTPAGEOFF]
Lloh20:
	ldr	w24, [x8]
	mov	x0, x20
	bl	_dev_name
	mov	x3, x0
	mov	x0, x22
	mov	x1, x23
	mov	x2, x24
	mov	x4, x21
	bl	_request_irq
	cbz	w0, LBB0_14
; %bb.5:
	mov	x20, x0
	mov	x0, x21
	bl	_vring_del_virtqueue
	b	LBB0_11
LBB0_6:
Lloh21:
	adrp	x8, _ENOENT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_13
LBB0_9:
Lloh25:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_12
LBB0_10:
Lloh28:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_11:
	ldr	w0, [x19]
	bl	_lguest_unmap
LBB0_12:
	mov	x0, x19
	bl	_kfree
	mov	x0, x20
LBB0_13:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_ERR_PTR
LBB0_14:
	str	x19, [x21]
	mov	x0, x21
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Mapping virtqueue %i addr %lx\n"

	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	_LGUEST_VRING_ALIGN,4,2         ; @LGUEST_VRING_ALIGN
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_lg_notify,4,2                  ; @lg_notify
	.comm	_vring_interrupt,4,2            ; @vring_interrupt
	.comm	_IRQF_SHARED,4,2                ; @IRQF_SHARED
	.no_dead_strip	_lg_find_vq
.subsections_via_symbols
