	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_mdp_m2m_open
_mtk_mdp_m2m_open:                      ## @mtk_mdp_m2m_open
	.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, %rbx
	callq	_video_drvdata
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_video_devdata
	movq	%rax, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$56, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	%r14, %rdi
	callq	_mutex_lock_interruptible
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_4
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_17
LBB0_5:
	leaq	48(%r12), %rdi
	callq	_mutex_init
	movslq	28(%r14), %rax
	leal	1(%rax), %ecx
	movl	%ecx, 28(%r14)
	movq	%rax, 24(%r12)
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_v4l2_fh_init
	movq	%r12, (%rbx)
	movq	%r12, %rdi
	callq	_mtk_mdp_ctrls_create
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_9
## %bb.6:
	leaq	16(%r12), %r15
	movq	%r15, 8(%r12)
	movq	%r12, %rdi
	callq	_v4l2_fh_add
	leaq	32(%r12), %r13
	movq	%r13, %rdi
	callq	_INIT_LIST_HEAD
	movq	%r14, 40(%r12)
	movq	%r12, %rdi
	callq	_mtk_mdp_set_default_params
	movq	%r12, %rdi
	addq	$36, %rdi
	movq	_mtk_mdp_m2m_worker@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_INIT_WORK
	movl	24(%r14), %edi
	movq	_mtk_mdp_m2m_queue_init@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rsi
	callq	_v4l2_m2m_ctx_init
	movl	%eax, 20(%r12)
	movl	%eax, %edi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_10
## %bb.7:
	movq	8(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movl	20(%r12), %edi
	callq	_PTR_ERR
	movl	%eax, %ebx
LBB0_8:
	movq	%r15, %rdi
	callq	_v4l2_ctrl_handler_free
LBB0_9:
	movq	%r12, %rdi
	callq	_v4l2_fh_del
	movq	%r12, %rdi
	callq	_v4l2_fh_exit
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_4:
	movq	%r12, %rdi
	callq	_kfree
LBB0_17:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	20(%r12), %eax
	movl	%eax, (%r12)
	movl	4(%r14), %eax
	leal	1(%rax), %ecx
	movl	%ecx, 4(%r14)
	testl	%eax, %eax
	je	LBB0_11
LBB0_16:
	movq	%r14, %rsi
	addq	$16, %rsi
	movq	%r13, %rdi
	callq	_list_add
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	8(%r14), %rdi
	callq	_dev_name
	movq	24(%r12), %rcx
	leaq	L_.str.3(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	movl	%eax, %edx
	callq	_mtk_mdp_dbg
	jmp	LBB0_17
LBB0_11:
	movl	20(%r14), %edi
	callq	_vpu_load_firmware
	movq	8(%r14), %rdi
	testl	%eax, %eax
	js	LBB0_12
## %bb.14:
	callq	_mtk_mdp_vpu_register
	testl	%eax, %eax
	jns	LBB0_16
## %bb.15:
	movl	%eax, %ebx
	movq	8(%r14), %rdi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_13
LBB0_12:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
LBB0_13:
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	decl	4(%r14)
	movl	20(%r12), %edi
	callq	_v4l2_m2m_ctx_release
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
	.comm	_mtk_mdp_m2m_worker,4,2         ## @mtk_mdp_m2m_worker
	.comm	_mtk_mdp_m2m_queue_init,4,2     ## @mtk_mdp_m2m_queue_init
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to initialize m2m context"

L_.str.1:                               ## @.str.1
	.asciz	"vpu_load_firmware failed %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"mdp_vpu register failed %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"%s [%d]"

	.no_dead_strip	_mtk_mdp_m2m_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_mdp_m2m_open
_mtk_mdp_m2m_open:                      ; @mtk_mdp_m2m_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x21, x0
	bl	_video_drvdata
	mov	x20, x0
	mov	x0, x21
	bl	_video_devdata
	mov	x22, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #56
	bl	_kzalloc
	cbz	x0, LBB0_3
; %bb.1:
	mov	x19, x0
	mov	x0, x20
	bl	_mutex_lock_interruptible
	cbz	x0, LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _ERESTARTSYS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ERESTARTSYS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_9
LBB0_3:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_10
LBB0_4:
	add	x0, x19, #48
	bl	_mutex_init
	ldrsw	x8, [x20, #28]
	add	w9, w8, #1
	str	w9, [x20, #28]
	str	x8, [x19, #24]
	mov	x0, x19
	mov	x1, x22
	bl	_v4l2_fh_init
	str	x19, [x21]
	mov	x0, x19
	bl	_mtk_mdp_ctrls_create
	mov	x22, x0
	cbnz	w0, LBB0_8
; %bb.5:
	add	x21, x19, #16
	str	x21, [x19, #8]
	mov	x0, x19
	bl	_v4l2_fh_add
	add	x23, x19, #32
	mov	x0, x23
	bl	_INIT_LIST_HEAD
	str	x20, [x19, #40]
	mov	x0, x19
	bl	_mtk_mdp_set_default_params
	add	x0, x19, #36
Lloh9:
	adrp	x8, _mtk_mdp_m2m_worker@GOTPAGE
Lloh10:
	ldr	x8, [x8, _mtk_mdp_m2m_worker@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_INIT_WORK
	ldr	w0, [x20, #24]
Lloh12:
	adrp	x8, _mtk_mdp_m2m_queue_init@GOTPAGE
Lloh13:
	ldr	x8, [x8, _mtk_mdp_m2m_queue_init@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x1, x19
	bl	_v4l2_m2m_ctx_init
	str	w0, [x19, #20]
	bl	_IS_ERR
	cbz	x0, LBB0_11
; %bb.6:
	ldr	x0, [x20, #8]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	ldr	w0, [x19, #20]
	bl	_PTR_ERR
	mov	x22, x0
LBB0_7:
	mov	x0, x21
	bl	_v4l2_ctrl_handler_free
LBB0_8:
	mov	x0, x19
	bl	_v4l2_fh_del
	mov	x0, x19
	bl	_v4l2_fh_exit
	mov	x0, x20
	bl	_mutex_unlock
LBB0_9:
	mov	x0, x19
	bl	_kfree
LBB0_10:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_11:
	ldr	w8, [x19, #20]
	str	w8, [x19]
	ldr	w8, [x20, #4]
	add	w9, w8, #1
	str	w9, [x20, #4]
	cbz	w8, LBB0_13
LBB0_12:
	add	x1, x20, #16
	mov	x0, x23
	bl	_list_add
	mov	x0, x20
	bl	_mutex_unlock
	ldr	x0, [x20, #8]
	bl	_dev_name
	mov	x2, x0
	ldr	x3, [x19, #24]
Lloh17:
	adrp	x1, l_.str.3@PAGE
Lloh18:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #0
	bl	_mtk_mdp_dbg
	mov	w22, #0
	b	LBB0_10
LBB0_13:
	ldr	w0, [x20, #20]
	bl	_vpu_load_firmware
	mov	x22, x0
	ldr	x0, [x20, #8]
	tbnz	w22, #31, LBB0_16
; %bb.14:
	bl	_mtk_mdp_vpu_register
	tbz	w0, #31, LBB0_12
; %bb.15:
	mov	x22, x0
	ldr	x0, [x20, #8]
	str	x22, [sp]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	b	LBB0_17
LBB0_16:
	str	x22, [sp]
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
LBB0_17:
	ldr	w8, [x20, #4]
	sub	w8, w8, #1
	str	w8, [x20, #4]
	ldr	w0, [x19, #20]
	bl	_v4l2_m2m_ctx_release
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
	.comm	_mtk_mdp_m2m_worker,4,2         ; @mtk_mdp_m2m_worker
	.comm	_mtk_mdp_m2m_queue_init,4,2     ; @mtk_mdp_m2m_queue_init
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to initialize m2m context"

l_.str.1:                               ; @.str.1
	.asciz	"vpu_load_firmware failed %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"mdp_vpu register failed %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"%s [%d]"

	.no_dead_strip	_mtk_mdp_m2m_open
.subsections_via_symbols
