	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rockchip_gem_alloc_iommu
_rockchip_gem_alloc_iommu:              ## @rockchip_gem_alloc_iommu
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	callq	_rockchip_gem_get_pages
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	%r14, %rdi
	callq	_rockchip_gem_iommu_map
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	xorl	%ebx, %ebx
	testl	%r15d, %r15d
	je	LBB0_8
## %bb.5:
	movl	4(%r14), %r15d
	movl	8(%r14), %r12d
	movq	_VM_MAP@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	_PAGE_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_pgprot_writecombine
	movl	%r12d, %edi
	movl	%r15d, %esi
	movl	%r13d, %edx
	movl	%eax, %ecx
	callq	_vmap
	movl	%eax, (%r14)
	testl	%eax, %eax
	jne	LBB0_8
## %bb.6:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	%r14, %rdi
	callq	_rockchip_gem_iommu_unmap
	jmp	LBB0_7
LBB0_1:
	movl	%eax, %ebx
	jmp	LBB0_8
LBB0_3:
	movl	%eax, %ebx
LBB0_7:
	movq	%r14, %rdi
	callq	_rockchip_gem_put_pages
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VM_MAP,4,2                     ## @VM_MAP
	.comm	_PAGE_KERNEL,4,2                ## @PAGE_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to vmap() buffer\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_rockchip_gem_alloc_iommu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rockchip_gem_alloc_iommu
_rockchip_gem_alloc_iommu:              ; @rockchip_gem_alloc_iommu
	.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	x21, x1
	mov	x19, x0
	bl	_rockchip_gem_get_pages
	tbnz	w0, #31, LBB0_5
; %bb.1:
	mov	x0, x19
	bl	_rockchip_gem_iommu_map
	tbnz	w0, #31, LBB0_6
; %bb.2:
	cbz	w21, LBB0_4
; %bb.3:
	ldp	w21, w20, [x19, #4]
Lloh0:
	adrp	x8, _VM_MAP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VM_MAP@GOTPAGEOFF]
Lloh2:
	ldr	w22, [x8]
Lloh3:
	adrp	x8, _PAGE_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PAGE_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_pgprot_writecombine
	mov	x3, x0
	mov	x0, x20
	mov	x1, x21
	mov	x2, x22
	bl	_vmap
	str	w0, [x19]
	cbz	w0, LBB0_7
LBB0_4:
	mov	w20, #0
	b	LBB0_9
LBB0_5:
	mov	x20, x0
	b	LBB0_9
LBB0_6:
	mov	x20, x0
	b	LBB0_8
LBB0_7:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w20, w8
	mov	x0, x19
	bl	_rockchip_gem_iommu_unmap
LBB0_8:
	mov	x0, x19
	bl	_rockchip_gem_put_pages
LBB0_9:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_VM_MAP,4,2                     ; @VM_MAP
	.comm	_PAGE_KERNEL,4,2                ; @PAGE_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to vmap() buffer\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_rockchip_gem_alloc_iommu
.subsections_via_symbols
