	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_iommu_domain_alloc
_mtk_iommu_domain_alloc:                ## @mtk_iommu_domain_alloc
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	_IOMMU_DOMAIN_DMA@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jne	LBB0_7
## %bb.1:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.2:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_iommu_get_dma_cookie
	testq	%rax, %rax
	jne	LBB0_6
## %bb.3:
	movq	%rbx, %rdi
	callq	_mtk_iommu_domain_finalise
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rbx, %rdi
	callq	_iommu_put_dma_cookie
LBB0_6:
	movq	%rbx, %rdi
	callq	_kfree
LBB0_7:
	xorl	%ebx, %ebx
LBB0_8:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_4:
	movq	$0, 8(%rbx)
	movl	$32, %edi
	callq	_DMA_BIT_MASK
	movl	%eax, 4(%rbx)
	movl	$1, (%rbx)
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_IOMMU_DOMAIN_DMA,4,2           ## @IOMMU_DOMAIN_DMA
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.no_dead_strip	_mtk_iommu_domain_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_iommu_domain_alloc
_mtk_iommu_domain_alloc:                ; @mtk_iommu_domain_alloc
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x8, _IOMMU_DOMAIN_DMA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IOMMU_DOMAIN_DMA@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ne	LBB0_6
; %bb.1:
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	mov	x19, x0
	cbz	x0, LBB0_7
; %bb.2:
	mov	x0, x19
	bl	_iommu_get_dma_cookie
	cbnz	x0, LBB0_5
; %bb.3:
	mov	x0, x19
	bl	_mtk_iommu_domain_finalise
	cbz	x0, LBB0_8
; %bb.4:
	mov	x0, x19
	bl	_iommu_put_dma_cookie
LBB0_5:
	mov	x0, x19
	bl	_kfree
LBB0_6:
	mov	x19, #0
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_8:
	str	xzr, [x19, #8]
	mov	w0, #32
	bl	_DMA_BIT_MASK
	mov	w8, #1
	stp	w8, w0, [x19]
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_IOMMU_DOMAIN_DMA,4,2           ; @IOMMU_DOMAIN_DMA
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.no_dead_strip	_mtk_iommu_domain_alloc
.subsections_via_symbols
