	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rockchip_gem_dma_map_sg
_rockchip_gem_dma_map_sg:               ## @rockchip_gem_dma_map_sg
	.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	%rcx, %r14
	movq	%rdx, %rbx
	movq	%rsi, %r12
	movq	%rdi, %r15
	movl	(%rdi), %edi
	movl	(%rdx), %esi
	movl	4(%rdx), %edx
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	callq	_dma_map_sg
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_rockchip_sg_get_contiguous_size
	movq	(%r12), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	movl	(%r15), %edi
	movl	(%rbx), %esi
	movl	4(%rbx), %edx
	movl	(%r13), %ecx
	callq	_dma_unmap_sg
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_5
LBB0_4:
	movl	(%rbx), %edi
	callq	_sg_dma_address
	movl	%eax, 8(%r14)
	movq	%rbx, (%r14)
	xorl	%eax, %eax
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to map sg_table to contiguous linear address.\n"

	.no_dead_strip	_rockchip_gem_dma_map_sg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rockchip_gem_dma_map_sg
_rockchip_gem_dma_map_sg:               ; @rockchip_gem_dma_map_sg
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x3
	mov	x19, x2
	mov	x22, x1
	mov	x21, x0
	ldr	w0, [x0]
	ldp	w1, w2, [x2]
Lloh0:
	adrp	x23, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh1:
	ldr	x23, [x23, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
	ldr	w3, [x23]
	bl	_dma_map_sg
	cbz	w0, LBB0_3
; %bb.1:
	mov	x1, x0
	mov	x0, x19
	bl	_rockchip_sg_get_contiguous_size
	ldr	x8, [x22]
	ldr	x8, [x8]
	cmp	x0, x8
	b.ge	LBB0_4
; %bb.2:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	ldr	w0, [x21]
	ldp	w1, w2, [x19]
	ldr	w3, [x23]
	bl	_dma_unmap_sg
LBB0_3:
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_5
LBB0_4:
	ldr	w0, [x19]
	bl	_sg_dma_address
	mov	x8, x0
	mov	w0, #0
	str	w8, [x20, #8]
	str	x19, [x20]
LBB0_5:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to map sg_table to contiguous linear address.\n"

	.no_dead_strip	_rockchip_gem_dma_map_sg
.subsections_via_symbols
