	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function udl_map_dma_buf
_udl_map_dma_buf:                       ## @udl_map_dma_buf
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	(%rdi), %r12
	movq	16(%rdi), %rax
	movl	4(%rax), %edi
	callq	_to_udl_bo
	movq	%rax, %rbx
	movq	24(%rax), %rax
	movq	(%rax), %r15
	movl	8(%r13), %edi
	callq	_dev_name
	movq	16(%r13), %rcx
	movl	(%rcx), %edx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%r14d, %ecx
	callq	_DRM_DEBUG_PRIME
	cmpl	%r14d, (%r12)
	jne	LBB0_3
## %bb.1:
	cmpl	$0, 4(%r12)
	je	LBB0_3
## %bb.2:
	addq	$8, %r12
LBB0_21:
	movq	%r12, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movl	8(%rbx), %edi
	testl	%edi, %edi
	je	LBB0_4
LBB0_6:
	movl	16(%rbx), %eax
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, %esi
	callq	_drm_prime_pages_to_sg
	movq	%rax, (%rbx)
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_10
## %bb.7:
	leaq	L_.str.2(%rip), %rdi
	callq	_DRM_ERROR
	movq	(%rbx), %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_CAST                       ## TAILCALL
LBB0_4:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_udl_gem_get_pages
	testl	%eax, %eax
	je	LBB0_5
## %bb.8:
	movl	%eax, %r14d
	leaq	L_.str.1(%rip), %rdi
	callq	_DRM_ERROR
	movl	%r14d, %edi
	jmp	LBB0_9
LBB0_10:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	leaq	8(%r12), %r15
	movq	(%rbx), %rax
	movl	8(%rax), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_sg_alloc_table
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	leaq	L_.str.3(%rip), %rdi
	callq	_DRM_ERROR
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
LBB0_9:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_5:
	movl	8(%rbx), %edi
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	jmp	LBB0_6
LBB0_12:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_lock
	cmpl	$0, 8(%r12)
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	je	LBB0_13
## %bb.14:
	movq	16(%r12), %r14
	movq	(%rbx), %rax
	movq	(%rax), %rbx
	xorl	%r15d, %r15d
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_sg_page
	movl	(%rbx), %ecx
	movl	4(%rbx), %edx
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_sg_set_page
	movq	%rbx, %rdi
	callq	_sg_next
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_sg_next
	movq	%rax, %r14
	incl	%r15d
	movl	(%r12), %edx
	cmpl	%edx, %r15d
	jb	LBB0_15
	jmp	LBB0_16
LBB0_13:
	xorl	%edx, %edx
LBB0_16:
	movq	_DMA_NONE@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	cmpl	%r14d, (%rax)
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_19
## %bb.17:
	movl	8(%r13), %edi
	movq	16(%rbx), %rsi
	movl	%r14d, %ecx
	callq	_dma_map_sg
	testl	%eax, %eax
	je	LBB0_18
LBB0_19:
	movl	$1, 4(%rbx)
	movl	%r14d, (%rbx)
	movq	%rbx, (%r13)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_20
LBB0_18:
	leaq	L_.str.4(%rip), %rdi
	callq	_DRM_ERROR
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_sg_free_table
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
	callq	_ERR_PTR
	movq	%rax, %r12
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
LBB0_20:
	callq	_mutex_unlock
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"[DEV:%s] size:%zd dir=%d\n"

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

	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"failed to allocate sgt.\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"failed to alloc sgt.\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DMA_NONE,4,2                   ## @DMA_NONE
L_.str.4:                               ## @.str.4
	.asciz	"failed to map sgl with iommu.\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_udl_map_dma_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function udl_map_dma_buf
_udl_map_dma_buf:                       ; @udl_map_dma_buf
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x1
	mov	x20, x0
	ldr	x25, [x0]
	ldr	x8, [x0, #16]
	ldr	w0, [x8, #4]
	bl	_to_udl_bo
	mov	x23, x0
	ldr	x8, [x0, #24]
	ldr	x19, [x8]
	ldr	w0, [x20, #8]
	bl	_dev_name
	mov	x1, x0
	ldr	x8, [x20, #16]
	ldr	w2, [x8]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x3, x21
	bl	_DRM_DEBUG_PRIME
	ldr	w8, [x25]
	cmp	w8, w21
	b.ne	LBB0_4
; %bb.1:
	ldr	w8, [x25, #4]
	cbz	w8, LBB0_4
; %bb.2:
	add	x22, x25, #8
LBB0_3:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_4:
	ldr	w0, [x23, #8]
	cbz	w0, LBB0_7
LBB0_5:
	ldr	w8, [x23, #16]
Lloh2:
	adrp	x9, _PAGE_SIZE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _PAGE_SIZE@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	sdiv	w1, w8, w9
	bl	_drm_prime_pages_to_sg
	str	x0, [x23]
	bl	_IS_ERR
	cbz	x0, LBB0_9
; %bb.6:
Lloh5:
	adrp	x0, l_.str.2@PAGE
Lloh6:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_ERROR
	ldr	x0, [x23]
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_ERR_CAST
LBB0_7:
	mov	x0, x23
	bl	_udl_gem_get_pages
	cbz	w0, LBB0_12
; %bb.8:
	mov	x22, x0
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
	mov	x0, x22
	b	LBB0_11
LBB0_9:
	add	x22, x25, #8
	ldr	x8, [x23]
	ldr	w1, [x8, #8]
Lloh9:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_sg_alloc_table
	cbz	w0, LBB0_13
; %bb.10:
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_ERROR
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_ERR_PTR
LBB0_12:
	ldr	w0, [x23, #8]
	b	LBB0_5
LBB0_13:
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x25, #8]
	cbz	w8, LBB0_16
; %bb.14:
	mov	w26, #0
	ldr	x24, [x25, #16]
	ldr	x8, [x23]
	ldr	x23, [x8]
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x23
	bl	_sg_page
	mov	x1, x0
	ldp	w3, w2, [x23]
	mov	x0, x24
	bl	_sg_set_page
	mov	x0, x23
	bl	_sg_next
	mov	x23, x0
	mov	x0, x24
	bl	_sg_next
	mov	x24, x0
	add	w26, w26, #1
	ldr	w2, [x22]
	cmp	w26, w2
	b.lo	LBB0_15
	b	LBB0_17
LBB0_16:
	mov	w2, #0
LBB0_17:
Lloh17:
	adrp	x8, _DMA_NONE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _DMA_NONE@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	cmp	w8, w21
	b.eq	LBB0_19
; %bb.18:
	ldr	w0, [x20, #8]
	ldr	x1, [x25, #16]
	mov	x3, x21
	bl	_dma_map_sg
	cbz	w0, LBB0_20
LBB0_19:
	mov	w8, #1
	stp	w21, w8, [x25]
	str	x25, [x20]
	b	LBB0_21
LBB0_20:
Lloh20:
	adrp	x0, l_.str.4@PAGE
Lloh21:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DRM_ERROR
	mov	x0, x22
	bl	_sg_free_table
Lloh22:
	adrp	x8, _EIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w0, w8
	bl	_ERR_PTR
	mov	x22, x0
LBB0_21:
	mov	x0, x19
	bl	_mutex_unlock
	b	LBB0_3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"[DEV:%s] size:%zd dir=%d\n"

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

	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"failed to allocate sgt.\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"failed to alloc sgt.\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DMA_NONE,4,2                   ; @DMA_NONE
l_.str.4:                               ; @.str.4
	.asciz	"failed to map sgl with iommu.\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_udl_map_dma_buf
.subsections_via_symbols
