	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rockchip_gem_iommu_map
_rockchip_gem_iommu_map:                ## @rockchip_gem_iommu_map
	.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	%rdi, %rbx
	movq	16(%rdi), %rax
	movq	(%rax), %r15
	movq	_IOMMU_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_IOMMU_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	%r15, %rdi
	callq	_mutex_lock
	leaq	8(%r15), %rdi
	leaq	4(%rbx), %rsi
	movl	8(%rbx), %edx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_drm_mm_insert_node_generic
	movl	%eax, %r12d
	movq	%r15, %rdi
	callq	_mutex_unlock
	testl	%r12d, %r12d
	js	LBB0_1
## %bb.2:
	orl	%r14d, %r13d
	movl	4(%rbx), %esi
	movl	%esi, 32(%rbx)
	movl	4(%r15), %edi
	movq	24(%rbx), %rax
	movl	(%rax), %ecx
	movl	4(%rax), %edx
	movl	%r13d, %r8d
	callq	_iommu_map_sg
	movl	8(%rbx), %edx
	cmpl	%edx, %eax
	jge	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r12d, %r12d
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_drm_mm_remove_node
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_5
LBB0_1:
	leaq	L_.str(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_5
LBB0_4:
	movl	%eax, (%rbx)
	xorl	%r12d, %r12d
LBB0_5:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IOMMU_READ,4,2                 ## @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ## @IOMMU_WRITE
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of I/O virtual memory: %zd\n"

L_.str.1:                               ## @.str.1
	.asciz	"failed to map buffer: size=%zd request_size=%zd\n"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rockchip_gem_iommu_map
_rockchip_gem_iommu_map:                ; @rockchip_gem_iommu_map
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x0
	ldr	x8, [x0, #16]
	ldr	x19, [x8]
Lloh0:
	adrp	x8, _IOMMU_READ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IOMMU_READ@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
Lloh3:
	adrp	x8, _IOMMU_WRITE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IOMMU_WRITE@GOTPAGEOFF]
Lloh5:
	ldr	w24, [x8]
	mov	x0, x19
	bl	_mutex_lock
	add	x0, x19, #8
	add	x20, x21, #4
	ldr	w2, [x21, #8]
Lloh6:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	x1, x20
	mov	w4, #0
	mov	w5, #0
	bl	_drm_mm_insert_node_generic
	mov	x22, x0
	mov	x0, x19
	bl	_mutex_unlock
	tbnz	w22, #31, LBB0_3
; %bb.1:
	orr	w4, w24, w23
	ldr	w1, [x21, #4]
	str	w1, [x21, #32]
	ldr	w0, [x19, #4]
	ldr	x8, [x21, #24]
	ldp	w3, w2, [x8]
	bl	_iommu_map_sg
	mov	x1, x0
	ldr	w8, [x21, #8]
	cmp	w0, w8
	b.ge	LBB0_4
; %bb.2:
	str	x8, [sp]
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w22, w8
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x20
	bl	_drm_mm_remove_node
	mov	x0, x19
	bl	_mutex_unlock
	b	LBB0_5
LBB0_3:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	bl	_DRM_ERROR
	b	LBB0_5
LBB0_4:
	mov	w22, #0
	str	w1, [x21]
LBB0_5:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_IOMMU_READ,4,2                 ; @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ; @IOMMU_WRITE
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of I/O virtual memory: %zd\n"

l_.str.1:                               ; @.str.1
	.asciz	"failed to map buffer: size=%zd request_size=%zd\n"

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