	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function viommu_add_device
_viommu_add_device:                     ## @viommu_add_device
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	callq	_dev_iommu_fwspec_get
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rax, %rbx
	movq	16(%rax), %rax
	cmpq	_viommu_ops@GOTPCREL(%rip), %rax
	je	LBB0_4
LBB0_2:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_13:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	8(%rbx), %edi
	callq	_viommu_get_by_fwnode
	testq	%rax, %rax
	je	LBB0_2
## %bb.5:
	movq	%rax, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	%rax, %r14
	movq	%r12, 16(%rax)
	movq	%r15, 8(%rax)
	movq	%rax, %rdi
	callq	_INIT_LIST_HEAD
	movq	%r14, (%rbx)
	cmpq	$0, 8(%r15)
	je	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_viommu_probe_endpoint
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
LBB0_9:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_iommu_device_link
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.10:
	movq	%r12, %rdi
	callq	_iommu_group_get_for_dev
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_14
## %bb.11:
	movq	%rbx, %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_iommu_device_unlink
LBB0_12:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_viommu_put_resv_regions
	movq	%r14, %rdi
	callq	_kfree
	jmp	LBB0_13
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_14:
	movq	%rbx, %rdi
	callq	_iommu_group_put
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR_OR_ZERO                ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_viommu_ops,4,2                 ## @viommu_ops
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_viommu_add_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function viommu_add_device
_viommu_add_device:                     ; @viommu_add_device
	.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	x19, x0
	bl	_dev_iommu_fwspec_get
	cbz	x0, LBB0_2
; %bb.1:
	mov	x22, x0
	ldr	x8, [x0, #16]
Lloh0:
	adrp	x9, _viommu_ops@GOTPAGE
Lloh1:
	ldr	x9, [x9, _viommu_ops@GOTPAGEOFF]
	cmp	x8, x9
	b.eq	LBB0_5
LBB0_2:
Lloh2:
	adrp	x8, _ENODEV@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_4:
	mov	x0, x22
	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
LBB0_5:
	ldr	w0, [x22, #8]
	bl	_viommu_get_by_fwnode
	cbz	x0, LBB0_2
; %bb.6:
	mov	x21, x0
Lloh4:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kzalloc
	cbz	x0, LBB0_13
; %bb.7:
	mov	x20, x0
	stp	x21, x19, [x0, #8]
	bl	_INIT_LIST_HEAD
	str	x20, [x22]
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_9
; %bb.8:
	mov	x0, x21
	mov	x1, x19
	bl	_viommu_probe_endpoint
	mov	x22, x0
	cbnz	w0, LBB0_12
LBB0_9:
	mov	x0, x21
	mov	x1, x19
	bl	_iommu_device_link
	mov	x22, x0
	cbnz	w0, LBB0_12
; %bb.10:
	mov	x0, x19
	bl	_iommu_group_get_for_dev
	mov	x22, x0
	bl	_IS_ERR
	cbz	x0, LBB0_14
; %bb.11:
	mov	x0, x22
	bl	_PTR_ERR
	mov	x22, x0
	mov	x0, x21
	mov	x1, x19
	bl	_iommu_device_unlink
LBB0_12:
	mov	x0, x19
	mov	x1, x20
	bl	_viommu_put_resv_regions
	mov	x0, x20
	bl	_kfree
	b	LBB0_4
LBB0_13:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_3
LBB0_14:
	mov	x0, x22
	bl	_iommu_group_put
	mov	x0, x22
	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
	b	_PTR_ERR_OR_ZERO
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_viommu_ops,4,2                 ; @viommu_ops
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_viommu_add_device
.subsections_via_symbols
