	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function exynos_drm_alloc_buf
_exynos_drm_alloc_buf:                  ## @exynos_drm_alloc_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	40(%rdi), %r15
	xorl	%r14d, %r14d
	cmpq	$0, 24(%rdi)
	je	LBB0_2
## %bb.1:
	movq	%r15, %rdi
	callq	_to_dma_dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_DRM_DEV_DEBUG_KMS
	jmp	LBB0_17
LBB0_2:
	movq	%rdi, %r13
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	movq	$0, (%rdi)
	movl	8(%rdi), %ecx
	movq	_EXYNOS_BO_NONCONTIG@GOTPCREL(%rip), %rax
	testl	%ecx, (%rax)
	je	LBB0_4
## %bb.3:
	xorl	%eax, %eax
	jmp	LBB0_5
LBB0_4:
	movq	_DMA_ATTR_FORCE_CONTIGUOUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r13)
LBB0_5:
	movq	_EXYNOS_BO_WC@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	andl	%ecx, %esi
	movq	_EXYNOS_BO_CACHABLE@GOTPCREL(%rip), %rbx
	movq	_DMA_ATTR_WRITE_COMBINE@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, %rdi
	andl	(%rbx), %ecx
	je	LBB0_7
## %bb.6:
	movq	_DMA_ATTR_NON_CONSISTENT@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
LBB0_7:
	testl	%esi, %esi
	cmoveq	%rdi, %rdx
	orq	%rax, %rdx
	movq	%rdx, (%r13)
	movq	_DMA_ATTR_NO_KERNEL_MAPPING@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	movq	%rdx, (%r13)
	movl	12(%r13), %r12d
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shrl	%cl, %r12d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rcx
	movq	___GFP_ZERO@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	(%rcx), %edx
	movl	%r12d, %edi
	movl	$8, %esi
	callq	_kvmalloc_array
	movl	%eax, %ebx
	movl	%eax, 16(%r13)
	movq	%r15, %rdi
	callq	_to_dma_dev
	testl	%ebx, %ebx
	je	LBB0_8
## %bb.9:
	leaq	24(%r13), %rdx
	movl	12(%r13), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	(%r13), %r8
	movl	%eax, %edi
	callq	_dma_alloc_attrs
	movl	%eax, %ebx
	movl	%eax, 32(%r13)
	movq	%r15, %rdi
	callq	_to_dma_dev
	movl	%eax, %edi
	testl	%ebx, %ebx
	je	LBB0_10
## %bb.11:
	movl	32(%r13), %edx
	movq	24(%r13), %rcx
	movl	12(%r13), %r8d
	movq	(%r13), %r9
	leaq	-48(%rbp), %rsi
	callq	_dma_get_sgtable_attrs
	testl	%eax, %eax
	js	LBB0_12
## %bb.13:
	movl	16(%r13), %esi
	xorl	%r14d, %r14d
	leaq	-48(%rbp), %rdi
	xorl	%edx, %edx
	movl	%r12d, %ecx
	callq	_drm_prime_sg_to_page_addr_arrays
	testq	%rax, %rax
	je	LBB0_18
## %bb.14:
	movq	%r15, %rdi
	callq	_to_dma_dev
	leaq	L_.str.4(%rip), %rsi
	movl	%eax, %edi
	callq	_DRM_DEV_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	leaq	-48(%rbp), %rdi
	callq	_sg_free_table
	jmp	LBB0_15
LBB0_8:
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edi
	callq	_DRM_DEV_ERROR
	xorl	%r14d, %r14d
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_17
LBB0_10:
	leaq	L_.str.2(%rip), %rsi
	callq	_DRM_DEV_ERROR
	jmp	LBB0_16
LBB0_12:
	movl	%eax, %r14d
	movq	%r15, %rdi
	callq	_to_dma_dev
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	callq	_DRM_DEV_ERROR
LBB0_15:
	movq	%r15, %rdi
	callq	_to_dma_dev
	movl	12(%r13), %esi
	movl	32(%r13), %edx
	movq	24(%r13), %rcx
	movq	(%r13), %r8
	movl	%eax, %edi
	callq	_dma_free_attrs
LBB0_16:
	movl	16(%r13), %edi
	callq	_kvfree
LBB0_17:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	leaq	-48(%rbp), %rdi
	callq	_sg_free_table
	movq	%r15, %rdi
	callq	_to_dma_dev
	movq	24(%r13), %rdx
	movl	12(%r13), %ecx
	leaq	L_.str.5(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_DRM_DEV_DEBUG_KMS
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"already allocated.\n"

	.comm	_EXYNOS_BO_NONCONTIG,4,2        ## @EXYNOS_BO_NONCONTIG
	.comm	_DMA_ATTR_FORCE_CONTIGUOUS,8,3  ## @DMA_ATTR_FORCE_CONTIGUOUS
	.comm	_EXYNOS_BO_WC,4,2               ## @EXYNOS_BO_WC
	.comm	_EXYNOS_BO_CACHABLE,4,2         ## @EXYNOS_BO_CACHABLE
	.comm	_DMA_ATTR_WRITE_COMBINE,8,3     ## @DMA_ATTR_WRITE_COMBINE
	.comm	_DMA_ATTR_NON_CONSISTENT,8,3    ## @DMA_ATTR_NON_CONSISTENT
	.comm	_DMA_ATTR_NO_KERNEL_MAPPING,8,3 ## @DMA_ATTR_NO_KERNEL_MAPPING
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
L_.str.1:                               ## @.str.1
	.asciz	"failed to allocate pages.\n"

L_.str.2:                               ## @.str.2
	.asciz	"failed to allocate buffer.\n"

L_.str.3:                               ## @.str.3
	.asciz	"failed to get sgtable.\n"

L_.str.4:                               ## @.str.4
	.asciz	"invalid sgtable.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.5:                               ## @.str.5
	.asciz	"dma_addr(0x%lx), size(0x%lx)\n"

	.no_dead_strip	_exynos_drm_alloc_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function exynos_drm_alloc_buf
_exynos_drm_alloc_buf:                  ; @exynos_drm_alloc_buf
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	ldr	x20, [x0, #40]
	mov	x21, x0
	ldr	x8, [x21, #24]!
	cbz	x8, LBB0_3
; %bb.1:
	mov	x0, x20
	bl	_to_dma_dev
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	bl	_DRM_DEV_DEBUG_KMS
	mov	w21, #0
	b	LBB0_15
LBB0_3:
	mov	x19, x0
Lloh2:
	adrp	x25, _ENOMEM@GOTPAGE
Lloh3:
	ldr	x25, [x25, _ENOMEM@GOTPAGEOFF]
	ldr	w24, [x25]
	str	xzr, [x0]
	ldr	w9, [x0, #8]
Lloh4:
	adrp	x10, _EXYNOS_BO_NONCONTIG@GOTPAGE
Lloh5:
	ldr	x10, [x10, _EXYNOS_BO_NONCONTIG@GOTPAGEOFF]
Lloh6:
	ldr	w10, [x10]
	tst	w10, w9
	b.ne	LBB0_5
; %bb.4:
Lloh7:
	adrp	x8, _DMA_ATTR_FORCE_CONTIGUOUS@GOTPAGE
Lloh8:
	ldr	x8, [x8, _DMA_ATTR_FORCE_CONTIGUOUS@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	str	x8, [x19]
LBB0_5:
Lloh10:
	adrp	x10, _EXYNOS_BO_WC@GOTPAGE
Lloh11:
	ldr	x10, [x10, _EXYNOS_BO_WC@GOTPAGEOFF]
Lloh12:
	ldr	w10, [x10]
Lloh13:
	adrp	x11, _EXYNOS_BO_CACHABLE@GOTPAGE
Lloh14:
	ldr	x11, [x11, _EXYNOS_BO_CACHABLE@GOTPAGEOFF]
Lloh15:
	ldr	w11, [x11]
Lloh16:
	adrp	x12, _DMA_ATTR_WRITE_COMBINE@GOTPAGE
Lloh17:
	ldr	x12, [x12, _DMA_ATTR_WRITE_COMBINE@GOTPAGEOFF]
Lloh18:
	ldr	x12, [x12]
Lloh19:
	adrp	x13, _DMA_ATTR_NON_CONSISTENT@GOTPAGE
Lloh20:
	ldr	x13, [x13, _DMA_ATTR_NON_CONSISTENT@GOTPAGEOFF]
Lloh21:
	ldr	x13, [x13]
	tst	w11, w9
	csel	x11, x12, x13, eq
	tst	w10, w9
	csel	x9, x11, x12, eq
	orr	x8, x9, x8
	str	x8, [x19]
Lloh22:
	adrp	x9, _DMA_ATTR_NO_KERNEL_MAPPING@GOTPAGE
Lloh23:
	ldr	x9, [x9, _DMA_ATTR_NO_KERNEL_MAPPING@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	orr	x8, x8, x9
	str	x8, [x19]
	ldr	w8, [x19, #12]
Lloh25:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh26:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
Lloh28:
	adrp	x26, _GFP_KERNEL@GOTPAGE
Lloh29:
	ldr	x26, [x26, _GFP_KERNEL@GOTPAGEOFF]
	lsr	w22, w8, w9
	ldr	w8, [x26]
Lloh30:
	adrp	x9, ___GFP_ZERO@GOTPAGE
Lloh31:
	ldr	x9, [x9, ___GFP_ZERO@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x22
	mov	w1, #8
	bl	_kvmalloc_array
	mov	x23, x0
	str	w0, [x19, #16]
	mov	x0, x20
	bl	_to_dma_dev
	cbz	w23, LBB0_10
; %bb.6:
	ldr	w1, [x19, #12]
	ldr	w3, [x26]
	ldr	x4, [x19]
	mov	x2, x21
	bl	_dma_alloc_attrs
	mov	x21, x0
	str	w0, [x19, #32]
	mov	x0, x20
	bl	_to_dma_dev
	cbz	w21, LBB0_11
; %bb.7:
	ldr	w2, [x19, #32]
	ldr	x3, [x19, #24]
	ldr	w4, [x19, #12]
	ldr	x5, [x19]
	add	x1, sp, #24
	bl	_dma_get_sgtable_attrs
	tbnz	w0, #31, LBB0_12
; %bb.8:
	ldr	w1, [x19, #16]
	add	x0, sp, #24
	mov	x2, #0
	mov	x3, x22
	bl	_drm_prime_sg_to_page_addr_arrays
	cbz	x0, LBB0_16
; %bb.9:
	mov	x0, x20
	bl	_to_dma_dev
Lloh33:
	adrp	x1, l_.str.4@PAGE
Lloh34:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_DRM_DEV_ERROR
Lloh35:
	adrp	x8, _EINVAL@GOTPAGE
Lloh36:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	neg	w21, w8
	add	x0, sp, #24
	bl	_sg_free_table
	b	LBB0_13
LBB0_10:
Lloh38:
	adrp	x1, l_.str.1@PAGE
Lloh39:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_DRM_DEV_ERROR
	ldr	w8, [x25]
	neg	w21, w8
	b	LBB0_15
LBB0_11:
	neg	w21, w24
Lloh40:
	adrp	x1, l_.str.2@PAGE
Lloh41:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_DRM_DEV_ERROR
	b	LBB0_14
LBB0_12:
	mov	x21, x0
	mov	x0, x20
	bl	_to_dma_dev
Lloh42:
	adrp	x1, l_.str.3@PAGE
Lloh43:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_DRM_DEV_ERROR
LBB0_13:
	mov	x0, x20
	bl	_to_dma_dev
	ldr	w1, [x19, #12]
	ldr	w2, [x19, #32]
	ldr	x3, [x19, #24]
	ldr	x4, [x19]
	bl	_dma_free_attrs
LBB0_14:
	ldr	w0, [x19, #16]
	bl	_kvfree
LBB0_15:
	mov	x0, x21
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_16:
	add	x0, sp, #24
	bl	_sg_free_table
	mov	x0, x20
	bl	_to_dma_dev
	ldr	x8, [x19, #24]
	ldr	w9, [x19, #12]
	stp	x8, x9, [sp]
Lloh44:
	adrp	x1, l_.str.5@PAGE
Lloh45:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_2
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpAdd	Lloh44, Lloh45
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"already allocated.\n"

	.comm	_EXYNOS_BO_NONCONTIG,4,2        ; @EXYNOS_BO_NONCONTIG
	.comm	_DMA_ATTR_FORCE_CONTIGUOUS,8,3  ; @DMA_ATTR_FORCE_CONTIGUOUS
	.comm	_EXYNOS_BO_WC,4,2               ; @EXYNOS_BO_WC
	.comm	_EXYNOS_BO_CACHABLE,4,2         ; @EXYNOS_BO_CACHABLE
	.comm	_DMA_ATTR_WRITE_COMBINE,8,3     ; @DMA_ATTR_WRITE_COMBINE
	.comm	_DMA_ATTR_NON_CONSISTENT,8,3    ; @DMA_ATTR_NON_CONSISTENT
	.comm	_DMA_ATTR_NO_KERNEL_MAPPING,8,3 ; @DMA_ATTR_NO_KERNEL_MAPPING
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
l_.str.1:                               ; @.str.1
	.asciz	"failed to allocate pages.\n"

l_.str.2:                               ; @.str.2
	.asciz	"failed to allocate buffer.\n"

l_.str.3:                               ; @.str.3
	.asciz	"failed to get sgtable.\n"

l_.str.4:                               ; @.str.4
	.asciz	"invalid sgtable.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.5:                               ; @.str.5
	.asciz	"dma_addr(0x%lx), size(0x%lx)\n"

	.no_dead_strip	_exynos_drm_alloc_buf
.subsections_via_symbols
