	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tegra_smmu_as_prepare
_tegra_smmu_as_prepare:                 ## @tegra_smmu_as_prepare
	.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	(%rsi), %rax
	testq	%rax, %rax
	jle	LBB0_2
## %bb.1:
	incq	%rax
	movq	%rax, (%rbx)
	xorl	%r15d, %r15d
	jmp	LBB0_9
LBB0_2:
	movq	%rdi, %r14
	movl	(%rdi), %edi
	movl	28(%rbx), %esi
	movq	_SMMU_SIZE_PD@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %r13
	movl	(%r13), %r8d
	xorl	%r15d, %r15d
	xorl	%edx, %edx
	callq	_dma_map_page
	movl	%eax, 12(%rbx)
	movl	(%r14), %edi
	movl	%eax, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_9
LBB0_4:
	movl	12(%rbx), %esi
	movq	%r14, %rdi
	callq	_smmu_dma_addr_valid
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	leaq	8(%rbx), %rsi
	movq	%r14, %rdi
	callq	_tegra_smmu_alloc_asid
	testl	%eax, %eax
	js	LBB0_7
## %bb.10:
	movl	12(%rbx), %esi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_smmu_flush_ptc
	movl	8(%rbx), %esi
	movq	%r14, %rdi
	callq	_smmu_flush_tlb_asid
	movl	8(%rbx), %esi
	andl	$127, %esi
	movq	_SMMU_PTB_ASID@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_smmu_writel
	movl	12(%rbx), %edi
	movl	24(%rbx), %esi
	callq	_SMMU_PTB_DATA_VALUE
	movq	_SMMU_PTB_DATA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_smmu_writel
	movq	%r14, %rdi
	callq	_smmu_flush
	movq	%r14, 16(%rbx)
	incq	(%rbx)
	jmp	LBB0_9
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_8
LBB0_7:
	movl	%eax, %r15d
LBB0_8:
	movl	(%r14), %edi
	movl	12(%rbx), %esi
	movl	(%r12), %edx
	movl	(%r13), %ecx
	callq	_dma_unmap_page
LBB0_9:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SMMU_SIZE_PD,4,2               ## @SMMU_SIZE_PD
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SMMU_PTB_ASID,4,2              ## @SMMU_PTB_ASID
	.comm	_SMMU_PTB_DATA,4,2              ## @SMMU_PTB_DATA
	.no_dead_strip	_tegra_smmu_as_prepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tegra_smmu_as_prepare
_tegra_smmu_as_prepare:                 ; @tegra_smmu_as_prepare
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	ldr	x8, [x1]
	cmp	x8, #1
	b.lt	LBB0_3
; %bb.1:
	mov	w21, #0
LBB0_2:
	add	x8, x8, #1
	str	x8, [x19]
	b	LBB0_11
LBB0_3:
	mov	x20, x0
	ldr	w0, [x0]
	ldr	w1, [x19, #28]
Lloh0:
	adrp	x22, _SMMU_SIZE_PD@GOTPAGE
Lloh1:
	ldr	x22, [x22, _SMMU_SIZE_PD@GOTPAGEOFF]
	ldr	w3, [x22]
Lloh2:
	adrp	x23, _DMA_TO_DEVICE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _DMA_TO_DEVICE@GOTPAGEOFF]
	ldr	w4, [x23]
	mov	w2, #0
	bl	_dma_map_page
	mov	x1, x0
	str	w0, [x19, #12]
	ldr	w0, [x20]
	bl	_dma_mapping_error
	cbz	x0, LBB0_5
; %bb.4:
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_11
LBB0_5:
	ldr	w1, [x19, #12]
	mov	x0, x20
	bl	_smmu_dma_addr_valid
	cbz	w0, LBB0_8
; %bb.6:
	add	x1, x19, #8
	mov	x0, x20
	bl	_tegra_smmu_alloc_asid
	tbnz	w0, #31, LBB0_9
; %bb.7:
	ldr	w1, [x19, #12]
	mov	x0, x20
	mov	w2, #0
	bl	_smmu_flush_ptc
	ldr	w1, [x19, #8]
	mov	x0, x20
	bl	_smmu_flush_tlb_asid
	ldr	w8, [x19, #8]
	and	w1, w8, #0x7f
Lloh7:
	adrp	x8, _SMMU_PTB_ASID@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SMMU_PTB_ASID@GOTPAGEOFF]
Lloh9:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_smmu_writel
	ldr	w0, [x19, #12]
	ldr	w1, [x19, #24]
	bl	_SMMU_PTB_DATA_VALUE
	mov	x1, x0
Lloh10:
	adrp	x8, _SMMU_PTB_DATA@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SMMU_PTB_DATA@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_smmu_writel
	mov	x0, x20
	bl	_smmu_flush
	mov	w21, #0
	str	x20, [x19, #16]
	ldr	x8, [x19]
	b	LBB0_2
LBB0_8:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_10
LBB0_9:
	mov	x21, x0
LBB0_10:
	ldr	w0, [x20]
	ldr	w1, [x19, #12]
	ldr	w2, [x22]
	ldr	w3, [x23]
	bl	_dma_unmap_page
LBB0_11:
	mov	x0, x21
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_SMMU_SIZE_PD,4,2               ; @SMMU_SIZE_PD
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SMMU_PTB_ASID,4,2              ; @SMMU_PTB_ASID
	.comm	_SMMU_PTB_DATA,4,2              ; @SMMU_PTB_DATA
	.no_dead_strip	_tegra_smmu_as_prepare
.subsections_via_symbols
