	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dmar_qi_emit_wait_seq
_dmar_qi_emit_wait_seq:                 ## @dmar_qi_emit_wait_seq
	.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
	movl	%edx, %r14d
	movq	%rsi, %r15
	movq	%rdi, %rbx
	xorl	%edi, %edi
	testq	%rsi, %rsi
	setne	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	movq	%rbx, %rdi
	callq	_DMAR_ASSERT_LOCKED
	movl	(%rbx), %r12d
	movl	4(%rbx), %eax
	cmpl	$-1, %r12d
	jne	LBB0_5
## %bb.1:
	movl	%eax, -44(%rbp)
	movl	$-1, -48(%rbp)
	movl	$1, %r12d
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_dmar_qi_ensure
	movq	%rbx, %rdi
	movl	$-1, %esi
	xorl	%edx, %edx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_dmar_qi_emit_wait_descr
	movq	%rbx, %rdi
	callq	_dmar_qi_advance_tail
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_dmar_qi_seq_processed
	testl	%eax, %eax
	jne	LBB0_4
## %bb.2:
	leaq	-48(%rbp), %r13
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_cpu_spinwait
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_dmar_qi_seq_processed
	testl	%eax, %eax
	je	LBB0_3
LBB0_4:
	movl	4(%rbx), %eax
	incl	%eax
	movl	%eax, 4(%rbx)
LBB0_5:
	leal	1(%r12), %ecx
	movl	%ecx, (%rbx)
	movl	%eax, 4(%r15)
	movl	%r12d, (%r15)
	testl	%r14d, %r14d
	je	LBB0_7
## %bb.6:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_dmar_qi_ensure
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	$1, %edx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_dmar_qi_emit_wait_descr
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wait descriptor with no place for seq"

	.no_dead_strip	_dmar_qi_emit_wait_seq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dmar_qi_emit_wait_seq
_dmar_qi_emit_wait_seq:                 ; @dmar_qi_emit_wait_seq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	cmp	x1, #0
	cset	w0, ne
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
	mov	x0, x19
	bl	_DMAR_ASSERT_LOCKED
	ldp	w22, w8, [x19]
	cmn	w22, #1
	b.ne	LBB0_5
; %bb.1:
	mov	w9, #-1
	stp	w9, w8, [sp, #8]
	mov	x0, x19
	mov	w1, #1
	bl	_dmar_qi_ensure
	mov	x0, x19
	mov	w1, #-1
	mov	w2, #0
	mov	w3, #1
	mov	w4, #0
	bl	_dmar_qi_emit_wait_descr
	mov	x0, x19
	bl	_dmar_qi_advance_tail
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	add	x1, sp, #8
	mov	x0, x19
	bl	_dmar_qi_seq_processed
	cbnz	w0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	bl	_cpu_spinwait
	b	LBB0_2
LBB0_4:
	ldr	w8, [x19, #4]
	add	w8, w8, #1
	str	w8, [x19, #4]
	mov	w22, #1
LBB0_5:
	add	w9, w22, #1
	str	w9, [x19]
	stp	w22, w8, [x21]
	cbz	w20, LBB0_7
; %bb.6:
	mov	x0, x19
	mov	w1, #1
	bl	_dmar_qi_ensure
	mov	x0, x19
	mov	x1, x22
	mov	w2, #1
	mov	w3, #1
	mov	w4, #0
	bl	_dmar_qi_emit_wait_descr
LBB0_7:
	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
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wait descriptor with no place for seq"

	.no_dead_strip	_dmar_qi_emit_wait_seq
.subsections_via_symbols
