	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_drm_crtc_atomic_flush
_mtk_drm_crtc_atomic_flush:             ## @mtk_drm_crtc_atomic_flush
	.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	%rdi, %r14
	callq	_to_mtk_crtc
	movq	%rax, %r15
	movq	8(%r14), %rax
	movq	(%rax), %r12
	cmpq	$0, 40(%r15)
	je	LBB0_2
## %bb.1:
	movl	$1, (%r15)
LBB0_2:
	cmpl	$0, 4(%r15)
	jle	LBB0_9
## %bb.3:
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	movabsq	$4294967296, %r13               ## imm = 0x100000000
	xorl	%r12d, %r12d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	incq	%rbx
	movslq	4(%r15), %rax
	cmpq	%rax, %rbx
	jge	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	32(%r15), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_to_mtk_plane_state
	cmpl	$0, (%rax)
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r13, (%rax)
	movl	%ebx, %edi
	callq	_BIT
	orl	%eax, %r12d
	jmp	LBB0_6
LBB0_7:
	testl	%r12d, %r12d
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_9
## %bb.8:
	movl	$1, 8(%r15)
LBB0_9:
	movq	(%r14), %rsi
	cmpq	$0, (%rsi)
	je	LBB0_14
## %bb.10:
	cmpl	$0, 12(%r15)
	jle	LBB0_14
## %bb.11:
	movq	24(%r15), %rax
	movl	(%rax), %edi
	callq	_mtk_ddp_gamma_set
	cmpl	$2, 12(%r15)
	jl	LBB0_14
## %bb.12:
	movl	$1, %ebx
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rsi
	movq	24(%r15), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_mtk_ddp_gamma_set
	incq	%rbx
	movslq	12(%r15), %rax
	cmpq	%rax, %rbx
	jl	LBB0_13
LBB0_14:
	movq	(%r12), %rax
	cmpq	$0, (%rax)
	je	LBB0_15
## %bb.16:
	movl	16(%r15), %edi
	callq	_mtk_disp_mutex_acquire
	movq	%r14, %rdi
	callq	_mtk_crtc_ddp_config
	movl	16(%r15), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mtk_disp_mutex_release         ## TAILCALL
LBB0_15:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_mtk_drm_crtc_atomic_flush
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function mtk_drm_crtc_atomic_flush
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_mtk_drm_crtc_atomic_flush:             ; @mtk_drm_crtc_atomic_flush
	.cfi_startproc
; %bb.0:
	stp	d9, d8, [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 b8, -72
	.cfi_offset b9, -80
	mov	x19, x0
	bl	_to_mtk_crtc
	mov	x20, x0
	ldr	x8, [x19, #8]
	ldr	x22, [x8]
	ldr	x8, [x0, #40]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w8, #1
	str	w8, [x20]
LBB0_2:
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.3:
	mov	x21, #0
	mov	w23, #0
Lloh0:
	adrp	x8, lCPI0_0@PAGE
Lloh1:
	ldr	d8, [x8, lCPI0_0@PAGEOFF]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x21, x21, #1
	ldrsw	x8, [x20, #4]
	cmp	x21, x8
	b.ge	LBB0_7
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #32]
	ldr	w0, [x8, x21, lsl #2]
	bl	_to_mtk_plane_state
	ldr	w8, [x0]
	cbz	w8, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	str	d8, [x0]
	mov	x0, x21
	bl	_BIT
	orr	w23, w0, w23
	b	LBB0_4
LBB0_7:
	cbz	w23, LBB0_9
; %bb.8:
	mov	w8, #1
	str	w8, [x20, #8]
LBB0_9:
	ldr	x1, [x19]
	ldr	x8, [x1]
	cbz	x8, LBB0_14
; %bb.10:
	ldr	w8, [x20, #12]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.11:
	ldr	x8, [x20, #24]
	ldr	w0, [x8]
	bl	_mtk_ddp_gamma_set
	ldr	w8, [x20, #12]
	cmp	w8, #2
	b.lt	LBB0_14
; %bb.12:
	mov	w21, #1
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x19]
	ldr	x8, [x20, #24]
	ldr	w0, [x8, x21, lsl #2]
	bl	_mtk_ddp_gamma_set
	add	x21, x21, #1
	ldrsw	x8, [x20, #12]
	cmp	x21, x8
	b.lt	LBB0_13
LBB0_14:
	ldr	x8, [x22]
	ldr	x8, [x8]
	cbz	x8, LBB0_16
; %bb.15:
	ldr	w0, [x20, #16]
	bl	_mtk_disp_mutex_acquire
	mov	x0, x19
	bl	_mtk_crtc_ddp_config
	ldr	w0, [x20, #16]
	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	d9, d8, [sp], #80               ; 16-byte Folded Reload
	b	_mtk_disp_mutex_release
LBB0_16:
	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	d9, d8, [sp], #80               ; 16-byte Folded Reload
	ret
	.loh AdrpLdr	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_mtk_drm_crtc_atomic_flush
.subsections_via_symbols
