	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __viommu_add_req
___viommu_add_req:                      ## @__viommu_add_req
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	-80(%rbp), %rax
	movq	%rax, -64(%rbp)
	leaq	-72(%rbp), %rax
	movq	%rax, -56(%rbp)
	movq	8(%rdi), %rax
	movq	_VIOMMU_REQUEST_VQ@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rax,%rcx,8), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	addq	$4, %rdi
	callq	_assert_spin_locked
	movq	%r15, %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_viommu_get_write_desc_offset
	testq	%rax, %rax
	jle	LBB0_1
## %bb.3:
	movq	%rax, %r14
	movl	%r12d, -84(%rbp)                ## 4-byte Spill
	leal	40(%rbx), %edi
	movq	_GFP_ATOMIC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %r12
	movq	%rbx, (%rax)
	cmpl	$0, -84(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_7
## %bb.6:
	leaq	(%r14,%r13), %rax
	movq	%rax, 32(%r12)
	movq	%r14, 24(%r12)
LBB0_7:
	leaq	8(%r12), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_memcpy
	movq	8(%r12), %rsi
	leaq	-80(%rbp), %rdi
	movq	%r14, %rdx
	callq	_sg_init_one
	movq	8(%r12), %rsi
	addq	%r14, %rsi
	subq	%r14, %rbx
	leaq	-72(%rbp), %rdi
	movq	%rbx, %rdx
	callq	_sg_init_one
	movq	_GFP_ATOMIC@GOTPCREL(%rip), %r13
	movl	(%r13), %r9d
	leaq	-64(%rbp), %rsi
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	$1, %edx
	movl	$1, %ecx
	movq	%r12, %r8
	callq	_virtqueue_add_sgs
	movl	%eax, %ebx
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	movl	%ebx, %ecx
	addl	(%rax), %ecx
	jne	LBB0_10
## %bb.8:
	movq	%r15, %rdi
	callq	___viommu_sync_req
	testl	%eax, %eax
	je	LBB0_9
LBB0_10:
	testl	%ebx, %ebx
	je	LBB0_11
LBB0_12:
	movq	%r12, %rdi
	callq	_kfree
	jmp	LBB0_13
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_13:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_15
## %bb.14:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movl	(%r13), %r9d
	leaq	-64(%rbp), %rsi
	movq	%r14, %rdi
	movl	$1, %edx
	movl	$1, %ecx
	movq	%r12, %r8
	callq	_virtqueue_add_sgs
	movl	%eax, %ebx
	testl	%ebx, %ebx
	jne	LBB0_12
LBB0_11:
	addq	$16, %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_list_add_tail
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_15:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_VIOMMU_REQUEST_VQ,8,3          ## @VIOMMU_REQUEST_VQ
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_ATOMIC,4,2                 ## @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.no_dead_strip	___viommu_add_req
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __viommu_add_req
___viommu_add_req:                      ; @__viommu_add_req
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x24, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	add	x8, sp, #16
	add	x9, sp, #8
	stp	x8, x9, [sp, #24]
	ldr	x8, [x0, #8]
Lloh3:
	adrp	x9, _VIOMMU_REQUEST_VQ@GOTPAGE
Lloh4:
	ldr	x9, [x9, _VIOMMU_REQUEST_VQ@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	ldr	x20, [x8, x9, lsl #3]
	add	x0, x0, #4
	bl	_assert_spin_locked
	mov	x0, x19
	mov	x1, x23
	mov	x2, x22
	bl	_viommu_get_write_desc_offset
	cmp	x0, #0
	b.le	LBB0_8
; %bb.1:
	mov	x25, x0
	add	w0, w22, #40
Lloh6:
	adrp	x26, _GFP_ATOMIC@GOTPAGE
Lloh7:
	ldr	x26, [x26, _GFP_ATOMIC@GOTPAGEOFF]
	ldr	w1, [x26]
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.2:
	mov	x21, x0
	str	x22, [x0]
	cbz	w24, LBB0_4
; %bb.3:
	add	x8, x23, x25
	stp	x25, x8, [x21, #24]
LBB0_4:
	add	x0, x21, #8
	mov	x1, x23
	mov	x2, x25
	bl	_memcpy
	ldr	x1, [x21, #8]
	add	x0, sp, #16
	mov	x2, x25
	bl	_sg_init_one
	ldr	x8, [x21, #8]
	add	x1, x8, x25
	sub	x2, x22, x25
	add	x0, sp, #8
	bl	_sg_init_one
	ldr	w5, [x26]
	add	x1, sp, #24
	mov	x0, x20
	mov	w2, #1
	mov	w3, #1
	mov	x4, x21
	bl	_virtqueue_add_sgs
	mov	x22, x0
Lloh8:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x19
	bl	___viommu_sync_req
	cbz	w0, LBB0_13
LBB0_6:
	cbz	w22, LBB0_14
LBB0_7:
	mov	x0, x21
	bl	_kfree
	b	LBB0_11
LBB0_8:
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_11:
	ldr	x8, [sp, #40]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.12:
	mov	x0, x22
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_13:
	ldr	w5, [x26]
	add	x1, sp, #24
	mov	x0, x20
	mov	w2, #1
	mov	w3, #1
	mov	x4, x21
	bl	_virtqueue_add_sgs
	mov	x22, x0
	cbnz	w22, LBB0_7
LBB0_14:
	add	x0, x21, #16
	mov	x1, x19
	bl	_list_add_tail
	b	LBB0_11
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_VIOMMU_REQUEST_VQ,8,3          ; @VIOMMU_REQUEST_VQ
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_ATOMIC,4,2                 ; @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.no_dead_strip	___viommu_add_req
.subsections_via_symbols
