	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gm12u320_copy_fb_to_blocks
_gm12u320_copy_fb_to_blocks:            ## @gm12u320_copy_fb_to_blocks
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_mutex_lock
	movq	8(%r15), %rbx
	testq	%rbx, %rbx
	je	LBB0_18
## %bb.1:
	movslq	16(%r15), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	20(%r15), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	24(%r15), %r14d
	movl	28(%r15), %r12d
	movq	8(%rbx), %rax
	movq	(%rax), %rdi
	callq	_drm_gem_shmem_vmap
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	%r13, %rdi
	callq	_PTR_ERR
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_GM12U320_ERR
	jmp	LBB0_17
LBB0_3:
	movq	8(%rbx), %rax
	movq	(%rax), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	movl	(%rax), %edi
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_dma_buf_begin_cpu_access
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_15
LBB0_6:
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	cmpl	%r12d, %r14d
	jge	LBB0_12
## %bb.7:
	movq	_GM12U320_REAL_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_GM12U320_USER_WIDTH@GOTPCREL(%rip), %rcx
	movl	%eax, %edx
	subl	(%rcx), %edx
	movslq	%r14d, %rcx
	movl	%edx, %r10d
	shrl	$31, %r10d
	addl	%edx, %r10d
	sarl	%r10d
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	leal	(%r10,%rsi), %r9d
	addl	-48(%rbp), %r10d                ## 4-byte Folded Reload
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rdx
	movslq	(%rdx), %rdx
	imulq	%rcx, %rdx
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	addq	%rdx, %rcx
	leaq	(%rcx,%rsi,4), %rsi
	movl	%r9d, -60(%rbp)                 ## 4-byte Spill
	subl	%r9d, %r10d
	leal	(%r10,%r10,2), %ecx
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	decl	%r12d
	movl	%r12d, -64(%rbp)                ## 4-byte Spill
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r14d, -56(%rbp)                ## 4-byte Spill
	imull	%r14d, %eax
	addl	-60(%rbp), %eax                 ## 4-byte Folded Reload
	leal	(%rax,%rax,2), %eax
	movq	_DATA_BLOCK_CONTENT_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	cltd
	idivl	%r12d
                                        ## kill: def $edx killed $edx def $rdx
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	leal	(%rdx,%rbx), %r14d
	movl	%r12d, %ecx
	subl	%edx, %ecx
	cmpl	%r12d, %r14d
	cmovlel	%ebx, %ecx
	movq	_DATA_BLOCK_HEADER_SIZE@GOTPCREL(%rip), %rbx
	movslq	(%rbx), %rbx
	movslq	%edx, %rdi
	addq	%rbx, %rdi
	movslq	%ecx, %rcx
	imulq	$1431655766, %rcx, %rbx         ## imm = 0x55555556
	movq	%rbx, %rcx
	shrq	$63, %rcx
	shrq	$32, %rbx
	addl	%ecx, %ebx
	movq	32(%r15), %rcx
	movslq	%eax, %r15
	addq	(%rcx,%r15,8), %rdi
	movq	%rsi, %r13
	movl	%ebx, %edx
	callq	_gm12u320_32bpp_to_24bpp_packed
	subl	%r12d, %r14d
	jle	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	_DATA_BLOCK_HEADER_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rdi
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	32(%rax), %rax
	addq	8(%rax,%r15,8), %rdi
	shll	$2, %ebx
	movslq	%ebx, %rax
	leaq	(,%rax,4), %rsi
	addq	%r13, %rsi
	movslq	%r14d, %rax
	imulq	$1431655766, %rax, %rdx         ## imm = 0x55555556
	movq	%rdx, %rax
	shrq	$63, %rax
	shrq	$32, %rdx
	addl	%eax, %edx
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_gm12u320_32bpp_to_24bpp_packed
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	-56(%rbp), %r14d                ## 4-byte Reload
	cmpl	%r14d, -64(%rbp)                ## 4-byte Folded Reload
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%rbx), %rax
	movslq	(%rax), %rax
	movq	%r13, %rsi
	leaq	(,%rax,4), %rsi
	addq	%r13, %rsi
	movq	_GM12U320_REAL_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	incl	%r14d
	jmp	LBB0_8
LBB0_12:
	movq	8(%rbx), %rax
	movq	(%rax), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	je	LBB0_16
## %bb.13:
	movl	(%rax), %edi
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_dma_buf_end_cpu_access
	testl	%eax, %eax
	je	LBB0_16
## %bb.14:
	leaq	L_.str.2(%rip), %rdi
LBB0_15:
	movl	%eax, %esi
	callq	_GM12U320_ERR
LBB0_16:
	movq	8(%rbx), %rax
	movq	(%rax), %rdi
	movq	%r13, %rsi
	callq	_drm_gem_shmem_vunmap
LBB0_17:
	movq	%rbx, %rdi
	callq	_drm_framebuffer_put
	movq	$0, 8(%r15)
LBB0_18:
	movq	%r15, %rdi
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mutex_unlock                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to vmap fb: %ld\n"

	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
L_.str.1:                               ## @.str.1
	.asciz	"dma_buf_begin_cpu_access err: %d\n"

	.comm	_GM12U320_REAL_WIDTH,4,2        ## @GM12U320_REAL_WIDTH
	.comm	_GM12U320_USER_WIDTH,4,2        ## @GM12U320_USER_WIDTH
	.comm	_DATA_BLOCK_CONTENT_SIZE,4,2    ## @DATA_BLOCK_CONTENT_SIZE
	.comm	_DATA_BLOCK_HEADER_SIZE,4,2     ## @DATA_BLOCK_HEADER_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"dma_buf_end_cpu_access err: %d\n"

	.no_dead_strip	_gm12u320_copy_fb_to_blocks
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gm12u320_copy_fb_to_blocks
_gm12u320_copy_fb_to_blocks:            ; @gm12u320_copy_fb_to_blocks
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	bl	_mutex_lock
	ldr	x20, [x19, #8]
	cbz	x20, LBB0_18
; %bb.1:
	ldp	w22, w23, [x19, #16]
                                        ; kill: def $w22 killed $w22 def $x22
	sxtw	x22, w22
	ldp	w24, w21, [x19, #24]
	ldr	x8, [x20, #8]
	ldr	x0, [x8]
	bl	_drm_gem_shmem_vmap
	mov	x25, x0
	bl	_IS_ERR
	cbz	x0, LBB0_3
; %bb.2:
	mov	x0, x25
	bl	_PTR_ERR
	mov	x1, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_GM12U320_ERR
	b	LBB0_17
LBB0_3:
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	ldr	x8, [x8]
Lloh2:
	adrp	x9, _DMA_FROM_DEVICE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DMA_FROM_DEVICE@GOTPAGEOFF]
	cbz	x8, LBB0_6
; %bb.4:
	ldr	w0, [x8]
	ldr	w1, [x9]
	bl	_dma_buf_begin_cpu_access
	cbz	w0, LBB0_6
; %bb.5:
	mov	x1, x0
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_15
LBB0_6:
	str	x25, [sp]                       ; 8-byte Folded Spill
Lloh6:
	adrp	x8, _GM12U320_REAL_WIDTH@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GM12U320_REAL_WIDTH@GOTPAGEOFF]
Lloh8:
	adrp	x9, _GM12U320_USER_WIDTH@GOTPAGE
Lloh9:
	ldr	x9, [x9, _GM12U320_USER_WIDTH@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	ldr	w9, [x9]
	sub	w9, w8, w9
	cmp	w9, #0
	cinc	w9, w9, lt
	cmp	w24, w21
	b.ge	LBB0_12
; %bb.7:
	sxtw	x10, w24
	asr	w9, w9, #1
	add	w13, w9, w22
	ldr	x11, [x20]
	ldrsw	x11, [x11]
	ldr	x12, [sp]                       ; 8-byte Folded Reload
	madd	x10, x11, x10, x12
	add	x22, x10, x22, lsl #2
	add	w9, w9, w23
	str	w13, [sp, #12]                  ; 4-byte Folded Spill
	sub	w9, w9, w13
	add	w28, w9, w9, lsl #1
	sub	w25, w21, #1
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mul	w8, w8, w24
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	add	w8, w8, w9
	add	w8, w8, w8, lsl #1
Lloh12:
	adrp	x9, _DATA_BLOCK_CONTENT_SIZE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _DATA_BLOCK_CONTENT_SIZE@GOTPAGEOFF]
Lloh14:
	ldr	w26, [x9]
	sdiv	w21, w8, w26
	msub	w8, w21, w26, w8
	sub	w9, w26, w8
	add	w27, w8, w28
	cmp	w27, w26
	csel	w9, w9, w28, gt
Lloh15:
	adrp	x10, _DATA_BLOCK_HEADER_SIZE@GOTPAGE
Lloh16:
	ldr	x10, [x10, _DATA_BLOCK_HEADER_SIZE@GOTPAGEOFF]
Lloh17:
	ldrsw	x10, [x10]
	add	x8, x10, w8, sxtw
	mov	w10, #21846
	movk	w10, #21845, lsl #16
	smull	x9, w9, w10
	lsr	x10, x9, #63
	lsr	x9, x9, #32
	add	w23, w9, w10
	ldr	x9, [x19, #32]
	ldr	x9, [x9, w21, sxtw #3]
	add	x0, x9, x8
	mov	x1, x22
	mov	x2, x23
	bl	_gm12u320_32bpp_to_24bpp_packed
	subs	w8, w27, w26
	b.le	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	sxtw	x9, w21
Lloh18:
	adrp	x10, _DATA_BLOCK_HEADER_SIZE@GOTPAGE
Lloh19:
	ldr	x10, [x10, _DATA_BLOCK_HEADER_SIZE@GOTPAGEOFF]
Lloh20:
	ldrsw	x10, [x10]
	ldr	x11, [x19, #32]
	add	x9, x11, x9, lsl #3
	ldr	x9, [x9, #8]
	add	x0, x9, x10
	lsl	w9, w23, #2
	add	x1, x22, w9, sxtw #2
	mov	w9, #21846
	movk	w9, #21845, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	lsr	x8, x8, #32
	add	w2, w8, w9
	bl	_gm12u320_32bpp_to_24bpp_packed
LBB0_10:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	w25, w24
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x20]
	ldrsw	x8, [x8]
	add	x22, x22, x8, lsl #2
Lloh21:
	adrp	x8, _GM12U320_REAL_WIDTH@GOTPAGE
Lloh22:
	ldr	x8, [x8, _GM12U320_REAL_WIDTH@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	add	w24, w24, #1
	b	LBB0_8
LBB0_12:
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	ldr	x8, [x8]
	ldr	x25, [sp]                       ; 8-byte Folded Reload
	cbz	x8, LBB0_16
; %bb.13:
	ldr	w0, [x8]
Lloh24:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	bl	_dma_buf_end_cpu_access
	cbz	w0, LBB0_16
; %bb.14:
	mov	x1, x0
Lloh27:
	adrp	x0, l_.str.2@PAGE
Lloh28:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_15:
	bl	_GM12U320_ERR
LBB0_16:
	ldr	x8, [x20, #8]
	ldr	x0, [x8]
	mov	x1, x25
	bl	_drm_gem_shmem_vunmap
LBB0_17:
	mov	x0, x20
	bl	_drm_framebuffer_put
	str	xzr, [x19, #8]
LBB0_18:
	mov	x0, x19
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_mutex_unlock
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to vmap fb: %ld\n"

	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
l_.str.1:                               ; @.str.1
	.asciz	"dma_buf_begin_cpu_access err: %d\n"

	.comm	_GM12U320_REAL_WIDTH,4,2        ; @GM12U320_REAL_WIDTH
	.comm	_GM12U320_USER_WIDTH,4,2        ; @GM12U320_USER_WIDTH
	.comm	_DATA_BLOCK_CONTENT_SIZE,4,2    ; @DATA_BLOCK_CONTENT_SIZE
	.comm	_DATA_BLOCK_HEADER_SIZE,4,2     ; @DATA_BLOCK_HEADER_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"dma_buf_end_cpu_access err: %d\n"

	.no_dead_strip	_gm12u320_copy_fb_to_blocks
.subsections_via_symbols
