	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function iommu_dma_alloc
_iommu_dma_alloc:                       ## @iommu_dma_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	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movl	%ecx, %ebx
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %r13
	callq	_dev_is_dma_coherent
	movl	%eax, %r12d
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r12d, %esi
	movq	%r15, %rdx
	callq	_dma_info_to_prot
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	$0, -48(%rbp)
	movq	___GFP_ZERO@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_CONFIG_DMA_REMAP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_IS_ENABLED
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movl	%ebx, %edi
	callq	_gfpflags_allow_blocking
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_DMA_ATTR_FORCE_CONTIGUOUS@GOTPCREL(%rip), %rax
	testq	%r15, (%rax)
	je	LBB0_13
LBB0_3:
	movq	_CONFIG_DMA_DIRECT_REMAP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_IS_ENABLED
	testq	%rax, %rax
	je	LBB0_7
## %bb.4:
	movl	%ebx, %edi
	callq	_gfpflags_allow_blocking
	testl	%r12d, %r12d
	jne	LBB0_7
## %bb.5:
	testq	%rax, %rax
	jne	LBB0_7
## %bb.6:
	movq	%r14, %rdi
	callq	_PAGE_ALIGN
	leaq	-48(%rbp), %rsi
	movl	%eax, %edi
	movl	%ebx, %edx
	callq	_dma_alloc_from_pool
	jmp	LBB0_8
LBB0_7:
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%ebx, %ecx
	movq	%r15, %r8
	callq	_iommu_dma_alloc_pages
LBB0_8:
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_11
## %bb.9:
	movq	-48(%rbp), %rdi
	callq	_page_to_phys
	movq	%r13, %rdi
	movl	%eax, %esi
	movq	%r14, %rdx
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	callq	___iommu_dma_map
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movq	_DMA_MAPPING_ERROR@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_12
## %bb.10:
	movq	%r13, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	___iommu_dma_free
LBB0_11:
	xorl	%ebx, %ebx
LBB0_12:
	movq	%rbx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	%r13, %rdi
	movq	%r14, %rsi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	%ebx, %ecx
	movq	%r15, %r8
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_iommu_dma_alloc_remap          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
	.comm	_CONFIG_DMA_REMAP,4,2           ## @CONFIG_DMA_REMAP
	.comm	_DMA_ATTR_FORCE_CONTIGUOUS,8,3  ## @DMA_ATTR_FORCE_CONTIGUOUS
	.comm	_CONFIG_DMA_DIRECT_REMAP,4,2    ## @CONFIG_DMA_DIRECT_REMAP
	.comm	_DMA_MAPPING_ERROR,4,2          ## @DMA_MAPPING_ERROR
	.no_dead_strip	_iommu_dma_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function iommu_dma_alloc
_iommu_dma_alloc:                       ; @iommu_dma_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x23, x4
	mov	x24, x3
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	bl	_dev_is_dma_coherent
	mov	x25, x0
Lloh0:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	x1, x25
	mov	x2, x23
	bl	_dma_info_to_prot
	mov	x22, x0
Lloh3:
	adrp	x8, ___GFP_ZERO@GOTPAGE
Lloh4:
	ldr	x8, [x8, ___GFP_ZERO@GOTPAGEOFF]
	str	xzr, [sp, #8]
Lloh5:
	ldr	w8, [x8]
	orr	w24, w8, w24
Lloh6:
	adrp	x8, _CONFIG_DMA_REMAP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CONFIG_DMA_REMAP@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_IS_ENABLED
	cbz	x0, LBB0_3
; %bb.1:
	mov	x0, x24
	bl	_gfpflags_allow_blocking
	cbz	x0, LBB0_3
; %bb.2:
Lloh9:
	adrp	x8, _DMA_ATTR_FORCE_CONTIGUOUS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DMA_ATTR_FORCE_CONTIGUOUS@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	tst	x8, x23
	b.eq	LBB0_11
LBB0_3:
Lloh12:
	adrp	x8, _CONFIG_DMA_DIRECT_REMAP@GOTPAGE
Lloh13:
	ldr	x8, [x8, _CONFIG_DMA_DIRECT_REMAP@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	bl	_IS_ENABLED
	cbz	x0, LBB0_7
; %bb.4:
	mov	x0, x24
	bl	_gfpflags_allow_blocking
	cbnz	w25, LBB0_7
; %bb.5:
	cbnz	x0, LBB0_7
; %bb.6:
	mov	x0, x19
	bl	_PAGE_ALIGN
	add	x1, sp, #8
	mov	x2, x24
	bl	_dma_alloc_from_pool
	mov	x23, x0
	cbnz	x0, LBB0_8
	b	LBB0_10
LBB0_7:
	add	x2, sp, #8
	mov	x0, x20
	mov	x1, x19
	mov	x3, x24
	mov	x4, x23
	bl	_iommu_dma_alloc_pages
	mov	x23, x0
	cbz	x0, LBB0_10
LBB0_8:
	ldr	x0, [sp, #8]
	bl	_page_to_phys
	mov	x1, x0
	mov	x0, x20
	mov	x2, x19
	mov	x3, x22
	bl	___iommu_dma_map
	str	w0, [x21]
Lloh15:
	adrp	x8, _DMA_MAPPING_ERROR@GOTPAGE
Lloh16:
	ldr	x8, [x8, _DMA_MAPPING_ERROR@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_10
; %bb.9:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	___iommu_dma_free
	mov	x23, #0
LBB0_10:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_11:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	mov	x3, x24
	mov	x4, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_iommu_dma_alloc_remap
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
	.comm	_CONFIG_DMA_REMAP,4,2           ; @CONFIG_DMA_REMAP
	.comm	_DMA_ATTR_FORCE_CONTIGUOUS,8,3  ; @DMA_ATTR_FORCE_CONTIGUOUS
	.comm	_CONFIG_DMA_DIRECT_REMAP,4,2    ; @CONFIG_DMA_DIRECT_REMAP
	.comm	_DMA_MAPPING_ERROR,4,2          ; @DMA_MAPPING_ERROR
	.no_dead_strip	_iommu_dma_alloc
.subsections_via_symbols
