	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function domain_attach_iommu
_domain_attach_iommu:                   ## @domain_attach_iommu
	.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, %rbx
	movq	%rdi, %r14
	movq	_device_domain_lock@GOTPCREL(%rip), %rdi
	callq	_assert_spin_locked
	leaq	24(%rbx), %rdi
	callq	_assert_spin_locked
	movq	(%r14), %rax
	movq	(%rbx), %rcx
	incl	(%rax,%rcx,4)
	incl	8(%r14)
	xorl	%r15d, %r15d
	cmpl	$1, (%rax,%rcx,4)
	jne	LBB0_4
## %bb.1:
	movl	20(%rbx), %edi
	callq	_cap_ndoms
	movq	%rax, %r13
	movl	12(%rbx), %edi
	movq	%rax, %rsi
	callq	_find_first_zero_bit
	movl	%eax, %r12d
	cltq
	cmpq	%rax, %r13
	jbe	LBB0_2
## %bb.3:
	movl	12(%rbx), %esi
	movl	%r12d, %edi
	callq	_set_bit
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movq	%r14, %rdx
	callq	_set_iommu_domain
	movq	16(%r14), %rax
	movq	(%rbx), %rcx
	movl	%r12d, (%rax,%rcx,4)
	movl	8(%rbx), %eax
	movl	%eax, 24(%r14)
	movq	%r14, %rdi
	callq	_domain_update_iommu_cap
	jmp	LBB0_4
LBB0_2:
	movl	16(%rbx), %esi
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	(%r14), %rax
	movq	(%rbx), %rcx
	decl	(%rax,%rcx,4)
	decl	8(%r14)
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_4:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_device_domain_lock,4,2         ## @device_domain_lock
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: No free domain ids\n"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.no_dead_strip	_domain_attach_iommu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function domain_attach_iommu
_domain_attach_iommu:                   ; @domain_attach_iommu
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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, x1
	mov	x19, x0
Lloh0:
	adrp	x0, _device_domain_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _device_domain_lock@GOTPAGEOFF]
	bl	_assert_spin_locked
	add	x0, x20, #24
	bl	_assert_spin_locked
	ldr	x8, [x19]
	ldr	x9, [x20]
	lsl	x9, x9, #2
	ldr	w10, [x8, x9]
	add	w10, w10, #1
	str	w10, [x8, x9]
	ldr	w10, [x19, #8]
	add	w10, w10, #1
	str	w10, [x19, #8]
	ldr	w8, [x8, x9]
	cmp	w8, #1
	b.ne	LBB0_3
; %bb.1:
	ldr	w0, [x20, #20]
	bl	_cap_ndoms
	mov	x22, x0
	ldr	w0, [x20, #12]
	mov	x1, x22
	bl	_find_first_zero_bit
	cmp	x22, w0, sxtw
	b.ls	LBB0_4
; %bb.2:
	mov	x21, x0
	ldr	w1, [x20, #12]
	bl	_set_bit
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_set_iommu_domain
	ldr	x8, [x19, #16]
	ldr	x9, [x20]
	str	w21, [x8, x9, lsl #2]
	ldr	w8, [x20, #8]
	str	w8, [x19, #24]
	mov	x0, x19
	bl	_domain_update_iommu_cap
LBB0_3:
	mov	w0, #0
	b	LBB0_5
LBB0_4:
	ldr	w1, [x20, #16]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	ldr	x8, [x19]
	ldr	x9, [x20]
	lsl	x9, x9, #2
	ldr	w10, [x8, x9]
	sub	w10, w10, #1
	str	w10, [x8, x9]
	ldr	w8, [x19, #8]
	sub	w8, w8, #1
	str	w8, [x19, #8]
Lloh4:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_device_domain_lock,4,2         ; @device_domain_lock
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: No free domain ids\n"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.no_dead_strip	_domain_attach_iommu
.subsections_via_symbols
