	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function exynos_iommu_domain_alloc
_exynos_iommu_domain_alloc:             ## @exynos_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	%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	_PG_ENT_SHIFT@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	sets	%al
	movq	_dma_dev@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	movl	%edi, %r14d
	sete	%cl
	orb	%al, %cl
	movzbl	%cl, %edi
	callq	_BUG_ON
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	$56, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_16
## %bb.1:
	movq	%rax, %rbx
	movq	_IOMMU_DOMAIN_DMA@GOTPCREL(%rip), %r12
	cmpl	%r14d, (%r12)
	jne	LBB0_3
## %bb.2:
	leaq	8(%rbx), %rdi
	callq	_iommu_get_dma_cookie
	testq	%rax, %rax
	jne	LBB0_15
	jmp	LBB0_4
LBB0_3:
	movq	_IOMMU_DOMAIN_UNMANAGED@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_15
LBB0_4:
	movl	(%r15), %edi
	movl	$2, %esi
	callq	___get_free_pages
	movq	%rax, 32(%rbx)
	testq	%rax, %rax
	je	LBB0_13
## %bb.5:
	movq	___GFP_ZERO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	orl	(%r15), %edi
	movl	$1, %esi
	callq	___get_free_pages
	movq	%rax, (%rbx)
	testq	%rax, %rax
	je	LBB0_12
## %bb.6:
	movq	_NUM_LV1ENTRIES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	movq	32(%rbx), %rsi
	jle	LBB0_9
## %bb.7:
	xorl	%ecx, %ecx
	movq	_ZERO_LV2LINK@GOTPCREL(%rip), %rdx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rdx), %edi
	movl	%edi, (%rsi,%rcx,4)
	incq	%rcx
	movslq	(%rax), %rdi
	cmpq	%rdi, %rcx
	jl	LBB0_8
LBB0_9:
	movl	(%r13), %edi
	movq	_LV1TABLE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_dma_map_single
	movq	%rax, %r15
	movq	32(%rbx), %rdi
	callq	_virt_to_phys
	xorl	%edi, %edi
	cmpq	%rax, %r15
	setne	%dil
	callq	_BUG_ON
	movl	(%r13), %edi
	movq	%r15, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_10
## %bb.11:
	movq	(%rbx), %rdi
	movl	$1, %esi
	callq	_free_pages
LBB0_12:
	movq	32(%rbx), %rdi
	movl	$2, %esi
	callq	_free_pages
LBB0_13:
	cmpl	%r14d, (%r12)
	jne	LBB0_15
## %bb.14:
	movq	%rbx, %rdi
	addq	$8, %rdi
	callq	_iommu_put_dma_cookie
LBB0_15:
	movq	%rbx, %rdi
	callq	_kfree
LBB0_16:
	xorl	%eax, %eax
LBB0_17:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	leaq	48(%rbx), %rdi
	callq	_spin_lock_init
	leaq	44(%rbx), %rdi
	callq	_spin_lock_init
	leaq	40(%rbx), %rdi
	callq	_INIT_LIST_HEAD
	movq	%rbx, %rax
	addq	$8, %rax
	movq	$0, 24(%rbx)
	movq	$-1, 8(%rbx)
	movl	$1, 16(%rbx)
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_PG_ENT_SHIFT,8,3               ## @PG_ENT_SHIFT
	.comm	_dma_dev,4,2                    ## @dma_dev
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_IOMMU_DOMAIN_DMA,4,2           ## @IOMMU_DOMAIN_DMA
	.comm	_IOMMU_DOMAIN_UNMANAGED,4,2     ## @IOMMU_DOMAIN_UNMANAGED
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
	.comm	_NUM_LV1ENTRIES,4,2             ## @NUM_LV1ENTRIES
	.comm	_ZERO_LV2LINK,4,2               ## @ZERO_LV2LINK
	.comm	_LV1TABLE_SIZE,4,2              ## @LV1TABLE_SIZE
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.no_dead_strip	_exynos_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 exynos_iommu_domain_alloc
_exynos_iommu_domain_alloc:             ; @exynos_iommu_domain_alloc
	.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	x20, x0
Lloh0:
	adrp	x8, _PG_ENT_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PG_ENT_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, #0
Lloh3:
	adrp	x23, _dma_dev@GOTPAGE
Lloh4:
	ldr	x23, [x23, _dma_dev@GOTPAGEOFF]
	ldr	w8, [x23]
	ccmp	w8, #0, #4, ge
	cset	w0, eq
	bl	_BUG_ON
Lloh5:
	adrp	x21, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x21, [x21, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	w0, #56
	bl	_kzalloc
	mov	x19, x0
	cbz	x0, LBB0_15
; %bb.1:
Lloh7:
	adrp	x22, _IOMMU_DOMAIN_DMA@GOTPAGE
Lloh8:
	ldr	x22, [x22, _IOMMU_DOMAIN_DMA@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, w20
	b.ne	LBB0_3
; %bb.2:
	add	x0, x19, #8
	bl	_iommu_get_dma_cookie
	cbnz	x0, LBB0_14
	b	LBB0_4
LBB0_3:
Lloh9:
	adrp	x8, _IOMMU_DOMAIN_UNMANAGED@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IOMMU_DOMAIN_UNMANAGED@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w8, w20
	b.ne	LBB0_14
LBB0_4:
	ldr	w0, [x21]
	mov	w1, #2
	bl	___get_free_pages
	str	x0, [x19, #32]
	cbz	x0, LBB0_12
; %bb.5:
	ldr	w8, [x21]
Lloh12:
	adrp	x9, ___GFP_ZERO@GOTPAGE
Lloh13:
	ldr	x9, [x9, ___GFP_ZERO@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w0, w9, w8
	mov	w1, #1
	bl	___get_free_pages
	str	x0, [x19]
	cbz	x0, LBB0_11
; %bb.6:
Lloh15:
	adrp	x8, _NUM_LV1ENTRIES@GOTPAGE
Lloh16:
	ldr	x8, [x8, _NUM_LV1ENTRIES@GOTPAGEOFF]
	ldr	w9, [x8]
	ldr	x1, [x19, #32]
	cmp	w9, #1
	b.lt	LBB0_9
; %bb.7:
	mov	x9, #0
Lloh17:
	adrp	x10, _ZERO_LV2LINK@GOTPAGE
Lloh18:
	ldr	x10, [x10, _ZERO_LV2LINK@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10]
	str	w11, [x1, x9, lsl #2]
	add	x9, x9, #1
	ldrsw	x11, [x8]
	cmp	x9, x11
	b.lt	LBB0_8
LBB0_9:
	ldr	w0, [x23]
Lloh19:
	adrp	x8, _LV1TABLE_SIZE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _LV1TABLE_SIZE@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
Lloh22:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh23:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh24:
	ldr	w3, [x8]
	bl	_dma_map_single
	mov	x21, x0
	ldr	x0, [x19, #32]
	bl	_virt_to_phys
	cmp	x21, x0
	cset	w0, ne
	bl	_BUG_ON
	ldr	w0, [x23]
	mov	x1, x21
	bl	_dma_mapping_error
	cbz	x0, LBB0_16
; %bb.10:
	ldr	x0, [x19]
	mov	w1, #1
	bl	_free_pages
LBB0_11:
	ldr	x0, [x19, #32]
	mov	w1, #2
	bl	_free_pages
LBB0_12:
	ldr	w8, [x22]
	cmp	w8, w20
	b.ne	LBB0_14
; %bb.13:
	add	x0, x19, #8
	bl	_iommu_put_dma_cookie
LBB0_14:
	mov	x0, x19
	bl	_kfree
	mov	x19, #0
LBB0_15:
	mov	x0, x19
	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
LBB0_16:
	add	x0, x19, #48
	bl	_spin_lock_init
	add	x0, x19, #44
	bl	_spin_lock_init
	add	x0, x19, #40
	bl	_INIT_LIST_HEAD
	mov	x8, #-1
	str	x8, [x19, #8]!
	str	xzr, [x19, #16]
	mov	w8, #1
	str	w8, [x19, #8]
	b	LBB0_15
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_PG_ENT_SHIFT,8,3               ; @PG_ENT_SHIFT
	.comm	_dma_dev,4,2                    ; @dma_dev
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_IOMMU_DOMAIN_DMA,4,2           ; @IOMMU_DOMAIN_DMA
	.comm	_IOMMU_DOMAIN_UNMANAGED,4,2     ; @IOMMU_DOMAIN_UNMANAGED
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
	.comm	_NUM_LV1ENTRIES,4,2             ; @NUM_LV1ENTRIES
	.comm	_ZERO_LV2LINK,4,2               ; @ZERO_LV2LINK
	.comm	_LV1TABLE_SIZE,4,2              ; @LV1TABLE_SIZE
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.no_dead_strip	_exynos_iommu_domain_alloc
.subsections_via_symbols
