	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function g2d_userptr_put_dma_addr
_g2d_userptr_put_dma_addr:              ## @g2d_userptr_put_dma_addr
	.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
	testq	%rsi, %rsi
	je	LBB0_11
## %bb.1:
	movq	%rsi, %r12
	movq	%rdi, %r14
	testl	%edx, %edx
	je	LBB0_2
LBB0_4:
	movl	(%r14), %edi
	callq	_to_dma_dev
	movq	(%r12), %rcx
	movl	20(%rcx), %edx
	movl	24(%rcx), %esi
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%eax, %edi
	callq	_dma_unmap_sg
	movl	16(%r12), %edi
	callq	_frame_vector_pages
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_IS_ERR
	testl	%eax, %eax
	jne	LBB0_8
## %bb.5:
	movl	16(%r12), %edi
	callq	_frame_vector_count
	testl	%eax, %eax
	jle	LBB0_8
## %bb.6:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14,%rbx,8), %rdi
	callq	_set_page_dirty_lock
	incq	%rbx
	movl	16(%r12), %edi
	callq	_frame_vector_count
	cltq
	cmpq	%rax, %rbx
	jl	LBB0_7
LBB0_8:
	movl	16(%r12), %edi
	callq	_put_vaddr_frames
	movl	16(%r12), %edi
	callq	_frame_vector_destroy
	cmpl	$0, 12(%r12)
	jne	LBB0_10
## %bb.9:
	leaq	8(%r12), %rdi
	callq	_list_del_init
LBB0_10:
	movq	(%r12), %rdi
	callq	_sg_free_table
	movq	(%r12), %rdi
	callq	_kfree
	movq	%r12, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_kfree                          ## TAILCALL
LBB0_2:
	leaq	40(%r12), %r15
	movq	%r15, %rdi
	callq	_atomic_dec
	movq	%r15, %rdi
	callq	_atomic_read
	testq	%rax, %rax
	jg	LBB0_11
## %bb.3:
	cmpq	$0, 32(%r12)
	je	LBB0_4
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.no_dead_strip	_g2d_userptr_put_dma_addr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function g2d_userptr_put_dma_addr
_g2d_userptr_put_dma_addr:              ; @g2d_userptr_put_dma_addr
	.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
	cbz	x1, LBB0_11
; %bb.1:
	mov	x19, x1
	mov	x20, x0
	cbz	w2, LBB0_9
LBB0_2:
	ldr	w0, [x20]
	bl	_to_dma_dev
	ldr	x8, [x19]
	ldp	w2, w1, [x8, #20]
Lloh0:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	bl	_dma_unmap_sg
	ldr	w0, [x19, #16]
	bl	_frame_vector_pages
	mov	x20, x0
	bl	_IS_ERR
	cbnz	w0, LBB0_6
; %bb.3:
	ldr	w0, [x19, #16]
	bl	_frame_vector_count
	cmp	w0, #1
	b.lt	LBB0_6
; %bb.4:
	mov	x21, #0
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x20, x21, lsl #3]
	bl	_set_page_dirty_lock
	add	x21, x21, #1
	ldr	w0, [x19, #16]
	bl	_frame_vector_count
	cmp	x21, w0, sxtw
	b.lt	LBB0_5
LBB0_6:
	ldr	w0, [x19, #16]
	bl	_put_vaddr_frames
	ldr	w0, [x19, #16]
	bl	_frame_vector_destroy
	ldr	w8, [x19, #12]
	cbnz	w8, LBB0_8
; %bb.7:
	add	x0, x19, #8
	bl	_list_del_init
LBB0_8:
	ldr	x0, [x19]
	bl	_sg_free_table
	ldr	x0, [x19]
	bl	_kfree
	mov	x0, x19
	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
	b	_kfree
LBB0_9:
	add	x21, x19, #40
	mov	x0, x21
	bl	_atomic_dec
	mov	x0, x21
	bl	_atomic_read
	cmp	x0, #0
	b.gt	LBB0_11
; %bb.10:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_2
LBB0_11:
	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	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.no_dead_strip	_g2d_userptr_put_dma_addr
.subsections_via_symbols
