	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tegra_bo_iommu_map
_tegra_bo_iommu_map:                    ## @tegra_bo_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, (%rsi)
	je	LBB0_3
## %bb.1:
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	_IOMMU_READ@GOTPCREL(%rip), %rax
	movq	_IOMMU_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	orl	(%rax), %r12d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edi
	callq	_kzalloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%r14, %rdi
	callq	_mutex_lock
	leaq	20(%r14), %rdi
	movq	(%r15), %rsi
	movl	28(%r15), %edx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_drm_mm_insert_node_generic
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	movq	(%r15), %rax
	movq	16(%r15), %rdx
	movl	(%rax), %esi
	movl	%esi, 24(%r15)
	movl	16(%r14), %edi
	movl	(%rdx), %ecx
	movl	4(%rdx), %edx
	movl	%r12d, %r8d
	callq	_iommu_map_sg
	movl	%eax, 8(%r15)
	testl	%eax, %eax
	je	LBB0_8
## %bb.11:
	movq	%r14, %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_6:
	movl	%eax, %ebx
	movq	8(%r14), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_9
LBB0_8:
	movq	8(%r14), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movq	(%r15), %rdi
	callq	_drm_mm_remove_node
LBB0_9:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	(%r15), %rdi
	callq	_kfree
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_IOMMU_READ,4,2                 ## @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ## @IOMMU_WRITE
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of I/O virtual memory: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"failed to map buffer\n"

	.no_dead_strip	_tegra_bo_iommu_map
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tegra_bo_iommu_map
_tegra_bo_iommu_map:                    ; @tegra_bo_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
	ldr	x8, [x1]
	cbz	x8, LBB0_4
; %bb.1:
Lloh0:
	adrp	x8, _EBUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_3:
	mov	x0, x21
	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
LBB0_4:
	mov	x19, x1
	mov	x20, x0
Lloh2:
	adrp	x8, _IOMMU_READ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _IOMMU_READ@GOTPAGEOFF]
Lloh4:
	ldr	w22, [x8]
Lloh5:
	adrp	x8, _IOMMU_WRITE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _IOMMU_WRITE@GOTPAGEOFF]
Lloh7:
	ldr	w23, [x8]
Lloh8:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w0, #4
	bl	_kzalloc
	str	x0, [x19]
	cbz	x0, LBB0_8
; %bb.5:
	mov	x0, x20
	bl	_mutex_lock
	add	x0, x20, #20
	ldr	x1, [x19]
	ldr	w2, [x19, #28]
Lloh11:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	mov	w4, #0
	mov	w5, #0
	bl	_drm_mm_insert_node_generic
	tbnz	w0, #31, LBB0_9
; %bb.6:
	orr	w4, w23, w22
	ldr	x8, [x19]
	ldr	w1, [x8]
	str	w1, [x19, #24]
	ldr	w0, [x20, #16]
	ldr	x8, [x19, #16]
	ldp	w3, w2, [x8]
	bl	_iommu_map_sg
	str	w0, [x19, #8]
	cbz	w0, LBB0_10
; %bb.7:
	mov	x0, x20
	bl	_mutex_unlock
	mov	w21, #0
	b	LBB0_3
LBB0_8:
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_9:
	mov	x21, x0
	ldr	x8, [x20, #8]
	ldr	w0, [x8]
	str	x21, [sp]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_11
LBB0_10:
	ldr	x8, [x20, #8]
	ldr	w0, [x8]
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w21, w8
	ldr	x0, [x19]
	bl	_drm_mm_remove_node
LBB0_11:
	mov	x0, x20
	bl	_mutex_unlock
	ldr	x0, [x19]
	bl	_kfree
	b	LBB0_3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_IOMMU_READ,4,2                 ; @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ; @IOMMU_WRITE
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of I/O virtual memory: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"failed to map buffer\n"

	.no_dead_strip	_tegra_bo_iommu_map
.subsections_via_symbols
