	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_jpeg_buf_queue
_mtk_jpeg_buf_queue:                    ## @mtk_jpeg_buf_queue
	.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, %r12
	movq	(%rdi), %rdi
	callq	_vb2_get_drv_priv
	movq	%rax, %r14
	movq	16(%rax), %r15
	movq	_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%r12), %rax
	movl	(%rax), %r8d
	movl	8(%r12), %r9d
	movq	%r12, (%rsp)
	leaq	L_.str(%rip), %rcx
	movl	$2, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_v4l2_dbg
	movq	(%r12), %rax
	movl	(%rax), %eax
	movq	_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_9
## %bb.1:
	movq	%r12, %rdi
	callq	_mtk_jpeg_vb2_to_srcbuf
	movq	%rax, %r13
	leaq	4(%rax), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	movq	_MTK_JPEG_BUF_FLAGS_LAST_FRAME@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r13)
	je	LBB0_3
## %bb.2:
	movq	_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rcx
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_v4l2_dbg
LBB0_9:
	movl	8(%r14), %ebx
	movq	%r12, %rdi
	callq	_to_vb2_v4l2_buffer
	movl	%ebx, %edi
	movl	%eax, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_v4l2_m2m_buf_queue             ## TAILCALL
LBB0_3:
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_plane_vaddr
	movq	%rax, %r13
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_get_plane_payload
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_mtk_jpeg_parse
	testl	%eax, %eax
	je	LBB0_10
## %bb.4:
	movq	(%r14), %rax
	movq	_MTK_JPEG_INIT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.5:
	movl	8(%r14), %edi
	movq	_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_v4l2_m2m_get_vq
	movq	%rax, %r15
	movq	%r14, %rdi
	callq	_mtk_jpeg_queue_src_chg_event
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_mtk_jpeg_set_queue_data
	movq	%r15, %rdi
	callq	_vb2_is_streaming
	testq	%rax, %rax
	jne	LBB0_6
## %bb.7:
	movq	_MTK_JPEG_RUNNING@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_10:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_v4l2_err
	movq	_VB2_BUF_STATE_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_vb2_buffer_done                ## TAILCALL
LBB0_6:
	movq	_MTK_JPEG_SOURCE_CHANGE@GOTPCREL(%rip), %rax
LBB0_8:
	movq	(%rax), %rax
	movq	%rax, (%r14)
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_debug,4,2                      ## @debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%d) buf_q id=%d, vb=%p\n"

	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,4,2 ## @V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
	.comm	_MTK_JPEG_BUF_FLAGS_LAST_FRAME,4,2 ## @MTK_JPEG_BUF_FLAGS_LAST_FRAME
L_.str.1:                               ## @.str.1
	.asciz	"Got eos\n"

L_.str.2:                               ## @.str.2
	.asciz	"Header invalid.\n"

	.comm	_VB2_BUF_STATE_ERROR,4,2        ## @VB2_BUF_STATE_ERROR
	.comm	_MTK_JPEG_INIT,8,3              ## @MTK_JPEG_INIT
	.comm	_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,4,2 ## @V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
	.comm	_MTK_JPEG_SOURCE_CHANGE,8,3     ## @MTK_JPEG_SOURCE_CHANGE
	.comm	_MTK_JPEG_RUNNING,8,3           ## @MTK_JPEG_RUNNING
	.no_dead_strip	_mtk_jpeg_buf_queue
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_jpeg_buf_queue
_mtk_jpeg_buf_queue:                    ; @mtk_jpeg_buf_queue
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x0
	ldr	x0, [x0]
	bl	_vb2_get_drv_priv
	mov	x20, x0
	ldr	x21, [x0, #16]
Lloh0:
	adrp	x24, _debug@GOTPAGE
Lloh1:
	ldr	x24, [x24, _debug@GOTPAGEOFF]
	ldr	w1, [x24]
	ldr	x8, [x19]
	ldr	w8, [x8]
	ldr	w9, [x19, #8]
	stp	x9, x19, [sp, #8]
	str	x8, [sp]
Lloh2:
	adrp	x3, l_.str@PAGE
Lloh3:
	add	x3, x3, l_.str@PAGEOFF
	mov	w0, #2
	mov	x2, x21
	bl	_v4l2_dbg
	ldr	x8, [x19]
	ldr	w8, [x8]
Lloh4:
	adrp	x9, _V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE@GOTPAGE
Lloh5:
	ldr	x9, [x9, _V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_mtk_jpeg_vb2_to_srcbuf
	mov	x23, x0
	add	x22, x0, #4
	mov	x0, x22
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	ldr	w8, [x23]
Lloh7:
	adrp	x9, _MTK_JPEG_BUF_FLAGS_LAST_FRAME@GOTPAGE
Lloh8:
	ldr	x9, [x9, _MTK_JPEG_BUF_FLAGS_LAST_FRAME@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.2:
	ldr	w1, [x24]
Lloh10:
	adrp	x3, l_.str.1@PAGE
Lloh11:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	w0, #1
	mov	x2, x21
	bl	_v4l2_dbg
LBB0_3:
	ldr	w20, [x20, #8]
	mov	x0, x19
	bl	_to_vb2_v4l2_buffer
	mov	x1, x0
	mov	x0, x20
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_v4l2_m2m_buf_queue
LBB0_4:
	mov	x0, x19
	mov	w1, #0
	bl	_vb2_plane_vaddr
	mov	x23, x0
	mov	x0, x19
	mov	w1, #0
	bl	_vb2_get_plane_payload
	mov	x2, x0
	mov	x0, x22
	mov	x1, x23
	bl	_mtk_jpeg_parse
	cbz	w0, LBB0_7
; %bb.5:
	ldr	x8, [x20]
Lloh12:
	adrp	x9, _MTK_JPEG_INIT@GOTPAGE
Lloh13:
	ldr	x9, [x9, _MTK_JPEG_INIT@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.6:
	ldr	w0, [x20, #8]
Lloh15:
	adrp	x8, _V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	bl	_v4l2_m2m_get_vq
	mov	x21, x0
	mov	x0, x20
	bl	_mtk_jpeg_queue_src_chg_event
	mov	x0, x20
	mov	x1, x22
	bl	_mtk_jpeg_set_queue_data
	mov	x0, x21
	bl	_vb2_is_streaming
Lloh18:
	adrp	x8, _MTK_JPEG_SOURCE_CHANGE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MTK_JPEG_SOURCE_CHANGE@GOTPAGEOFF]
Lloh20:
	adrp	x9, _MTK_JPEG_RUNNING@GOTPAGE
Lloh21:
	ldr	x9, [x9, _MTK_JPEG_RUNNING@GOTPAGEOFF]
	cmp	x0, #0
	csel	x8, x9, x8, eq
	ldr	x8, [x8]
	str	x8, [x20]
	b	LBB0_3
LBB0_7:
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_v4l2_err
Lloh24:
	adrp	x8, _VB2_BUF_STATE_ERROR@GOTPAGE
Lloh25:
	ldr	x8, [x8, _VB2_BUF_STATE_ERROR@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_vb2_buffer_done
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_debug,4,2                      ; @debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%d) buf_q id=%d, vb=%p\n"

	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,4,2 ; @V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
	.comm	_MTK_JPEG_BUF_FLAGS_LAST_FRAME,4,2 ; @MTK_JPEG_BUF_FLAGS_LAST_FRAME
l_.str.1:                               ; @.str.1
	.asciz	"Got eos\n"

l_.str.2:                               ; @.str.2
	.asciz	"Header invalid.\n"

	.comm	_VB2_BUF_STATE_ERROR,4,2        ; @VB2_BUF_STATE_ERROR
	.comm	_MTK_JPEG_INIT,8,3              ; @MTK_JPEG_INIT
	.comm	_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,4,2 ; @V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
	.comm	_MTK_JPEG_SOURCE_CHANGE,8,3     ; @MTK_JPEG_SOURCE_CHANGE
	.comm	_MTK_JPEG_RUNNING,8,3           ; @MTK_JPEG_RUNNING
	.no_dead_strip	_mtk_jpeg_buf_queue
.subsections_via_symbols
