	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function shadow_workload_ring_buffer
_shadow_workload_ring_buffer:           ## @shadow_workload_ring_buffer
	.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
	movq	%rdi, %rbx
	movq	56(%rdi), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movslq	(%rdi), %r15
	movl	48(%rdi), %edi
	callq	__RING_CTL_BUF_SIZE
	movq	%rax, %r13
	movq	16(%rbx), %rcx
	movq	24(%rbx), %r12
	addq	%rcx, %rax
	subq	%r12, %rax
	movq	%rax, %rdx
	orq	%r13, %rdx
	shrq	$32, %rdx
	je	LBB0_1
## %bb.2:
	xorl	%edx, %edx
	divq	%r13
	jmp	LBB0_3
LBB0_1:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r13d
                                        ## kill: def $edx killed $edx def $rdx
LBB0_3:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%rdx, 8(%rbx)
	movq	32(%rbx), %r14
	movq	8(%rdi), %rax
	cmpq	(%rax,%r15,8), %rdx
	jbe	LBB0_7
## %bb.4:
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	16(%rdi), %rax
	movq	(%rax,%r15,8), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rdx, %rsi
	movl	%eax, %edx
	callq	_krealloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	16(%rdi), %rcx
	movq	%rax, (%rcx,%r15,8)
	movq	8(%rbx), %rax
	movq	8(%rdi), %rcx
	movq	%rax, (%rcx,%r15,8)
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
LBB0_7:
	addq	%r14, %r12
	addq	%r14, %rcx
	movq	16(%rdi), %rax
	movq	(%rax,%r15,8), %r15
	movq	%r15, 40(%rbx)
	cmpq	%rcx, %r12
	jbe	LBB0_11
## %bb.8:
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	addq	%r13, %r14
	movl	(%rdi), %esi
	movq	%r12, %rdx
	movq	%r14, %rcx
	movq	%r15, %r8
	callq	_copy_gma_to_hva
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:
	movl	%r14d, %eax
	addq	%rax, %r15
	movq	32(%rbx), %r12
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
LBB0_11:
	movl	(%rdi), %esi
	movq	%r12, %rdx
	movq	%r15, %r8
	callq	_copy_gma_to_hva
	xorl	%r14d, %r14d
	testl	%eax, %eax
	jns	LBB0_13
## %bb.12:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	callq	_gvt_vgpu_err
	movl	%ebx, %r14d
	jmp	LBB0_13
LBB0_5:
	leaq	L_.str(%rip), %rdi
	callq	_gvt_vgpu_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_13
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	callq	_gvt_vgpu_err
LBB0_13:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fail to re-alloc ring scan buffer\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"fail to copy guest ring buffer\n"

	.no_dead_strip	_shadow_workload_ring_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function shadow_workload_ring_buffer
_shadow_workload_ring_buffer:           ; @shadow_workload_ring_buffer
	.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	x20, x0
	ldr	x19, [x0, #56]
	ldrsw	x22, [x0]
	ldr	w0, [x0, #48]
	bl	__RING_CTL_BUF_SIZE
	mov	x21, x0
	ldp	x23, x25, [x20, #16]
	add	x8, x23, x0
	sub	x8, x8, x25
	udiv	x9, x8, x0
	msub	x1, x9, x0, x8
	str	x1, [x20, #8]
	ldr	x24, [x20, #32]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x22, lsl #3]
	cmp	x1, x8
	b.ls	LBB0_3
; %bb.1:
	ldr	x8, [x19, #16]
	ldr	x0, [x8, x22, lsl #3]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	bl	_krealloc
	cbz	x0, LBB0_10
; %bb.2:
	ldr	x8, [x19, #16]
	lsl	x9, x22, #3
	str	x0, [x8, x9]
	ldr	x8, [x20, #8]
	ldr	x10, [x19, #8]
	str	x8, [x10, x9]
LBB0_3:
	add	x2, x24, x25
	ldr	x8, [x19, #16]
	ldr	x22, [x8, x22, lsl #3]
	str	x22, [x20, #40]
	add	x23, x24, x23
	cmp	x2, x23
	b.ls	LBB0_6
; %bb.4:
	add	x3, x24, x21
	ldr	w1, [x19]
	mov	x0, x19
	mov	x4, x22
	bl	_copy_gma_to_hva
	mov	x21, x0
	tbnz	w0, #31, LBB0_9
; %bb.5:
	add	x22, x22, w21, uxtw
	ldr	x2, [x20, #32]
LBB0_6:
	ldr	w1, [x19]
	mov	x0, x19
	mov	x3, x23
	mov	x4, x22
	bl	_copy_gma_to_hva
	tbnz	w0, #31, LBB0_8
; %bb.7:
	mov	w21, #0
	b	LBB0_11
LBB0_8:
	mov	x21, x0
LBB0_9:
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_gvt_vgpu_err
	b	LBB0_11
LBB0_10:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_gvt_vgpu_err
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_11:
	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 AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fail to re-alloc ring scan buffer\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"fail to copy guest ring buffer\n"

	.no_dead_strip	_shadow_workload_ring_buffer
.subsections_via_symbols
