	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_jpeg_adjust_fmt_mplane
_mtk_jpeg_adjust_fmt_mplane:            ## @mtk_jpeg_adjust_fmt_mplane
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rsi, %rbx
	movl	(%rsi), %esi
	callq	_mtk_jpeg_get_q_data
	movl	28(%rax), %ecx
	movl	%ecx, 32(%rbx)
	movl	24(%rax), %ecx
	movl	%ecx, 28(%rbx)
	movq	16(%rax), %rcx
	movl	4(%rcx), %edx
	movl	%edx, 24(%rbx)
	movl	(%rcx), %r9d
	movl	%r9d, 8(%rbx)
	testl	%r9d, %r9d
	jle	LBB0_16
## %bb.1:
	movq	(%rax), %rdx
	movq	8(%rax), %rax
	movq	16(%rbx), %rsi
	cmpl	$4, %r9d
	jae	LBB0_3
## %bb.2:
	xorl	%edi, %edi
LBB0_12:
	movq	%rdi, %rcx
	notq	%rcx
	testb	$1, %r9b
	je	LBB0_14
## %bb.13:
	movl	(%rax,%rdi,4), %ebx
	movl	%ebx, 4(%rsi,%rdi,8)
	movl	(%rdx,%rdi,4), %ebx
	movl	%ebx, (%rsi,%rdi,8)
	orq	$1, %rdi
LBB0_14:
	addq	%r9, %rcx
	je	LBB0_16
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rax,%rdi,4), %ecx
	movl	%ecx, 4(%rsi,%rdi,8)
	movl	(%rdx,%rdi,4), %ecx
	movl	%ecx, (%rsi,%rdi,8)
	movl	4(%rax,%rdi,4), %ecx
	movl	%ecx, 12(%rsi,%rdi,8)
	movl	4(%rdx,%rdi,4), %ecx
	movl	%ecx, 8(%rsi,%rdi,8)
	addq	$2, %rdi
	cmpq	%rdi, %r9
	jne	LBB0_15
	jmp	LBB0_16
LBB0_3:
	leaq	(%rsi,%r9,8), %rdi
	leaq	(%rax,%r9,4), %rcx
	leaq	(%rdx,%r9,4), %rbx
	cmpq	%rcx, %rsi
	setb	%r8b
	cmpq	%rdi, %rax
	setb	%r10b
	cmpq	%rbx, %rsi
	setb	%cl
	cmpq	%rdi, %rdx
	setb	%bl
	xorl	%edi, %edi
	testb	%r10b, %r8b
	jne	LBB0_12
## %bb.4:
	andb	%bl, %cl
	jne	LBB0_12
## %bb.5:
	movl	%r9d, %edi
	andl	$-4, %edi
	leaq	-4(%rdi), %rcx
	movq	%rcx, %r8
	shrq	$2, %r8
	incq	%r8
	testq	%rcx, %rcx
	je	LBB0_6
## %bb.7:
	movq	%r8, %rcx
	andq	$-2, %rcx
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movsd	(%rax,%rbx,4), %xmm0            ## xmm0 = mem[0],zero
	movsd	8(%rax,%rbx,4), %xmm1           ## xmm1 = mem[0],zero
	movsd	(%rdx,%rbx,4), %xmm2            ## xmm2 = mem[0],zero
	unpcklps	%xmm0, %xmm2                    ## xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
	movsd	8(%rdx,%rbx,4), %xmm0           ## xmm0 = mem[0],zero
	unpcklps	%xmm1, %xmm0                    ## xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
	movups	%xmm2, (%rsi,%rbx,8)
	movups	%xmm0, 16(%rsi,%rbx,8)
	movsd	16(%rax,%rbx,4), %xmm0          ## xmm0 = mem[0],zero
	movsd	24(%rax,%rbx,4), %xmm1          ## xmm1 = mem[0],zero
	movsd	16(%rdx,%rbx,4), %xmm2          ## xmm2 = mem[0],zero
	unpcklps	%xmm0, %xmm2                    ## xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
	movsd	24(%rdx,%rbx,4), %xmm0          ## xmm0 = mem[0],zero
	unpcklps	%xmm1, %xmm0                    ## xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
	movups	%xmm2, 32(%rsi,%rbx,8)
	movups	%xmm0, 48(%rsi,%rbx,8)
	addq	$8, %rbx
	addq	$-2, %rcx
	jne	LBB0_8
## %bb.9:
	testb	$1, %r8b
	je	LBB0_11
LBB0_10:
	movsd	(%rax,%rbx,4), %xmm0            ## xmm0 = mem[0],zero
	movsd	8(%rax,%rbx,4), %xmm1           ## xmm1 = mem[0],zero
	movsd	(%rdx,%rbx,4), %xmm2            ## xmm2 = mem[0],zero
	unpcklps	%xmm0, %xmm2                    ## xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
	movsd	8(%rdx,%rbx,4), %xmm0           ## xmm0 = mem[0],zero
	unpcklps	%xmm1, %xmm0                    ## xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
	leaq	(,%rbx,8), %rcx
	orq	$16, %rcx
	movups	%xmm2, (%rsi,%rbx,8)
	movups	%xmm0, (%rsi,%rcx)
LBB0_11:
	cmpq	%r9, %rdi
	jne	LBB0_12
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_6:
	xorl	%ebx, %ebx
	testb	$1, %r8b
	jne	LBB0_10
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_mtk_jpeg_adjust_fmt_mplane
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_jpeg_adjust_fmt_mplane
_mtk_jpeg_adjust_fmt_mplane:            ; @mtk_jpeg_adjust_fmt_mplane
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x1
	ldr	w1, [x1]
	bl	_mtk_jpeg_get_q_data
	ldr	d0, [x0, #24]
	stur	d0, [x19, #28]
	ldr	x8, [x0, #16]
	ldp	w8, w9, [x8]
	str	w9, [x19, #24]
	str	w8, [x19, #8]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.1:
	ldr	x9, [x19, #16]
	ldp	x11, x10, [x0]
	cmp	w8, #8
	b.hs	LBB0_3
; %bb.2:
	mov	x12, #0
	b	LBB0_8
LBB0_3:
	mov	x12, #0
	add	x14, x9, x8, lsl #3
	lsl	x13, x8, #2
	add	x15, x10, x13
	add	x13, x11, x13
	cmp	x9, x13
	ccmp	x11, x14, #2, lo
	cset	w13, lo
	cmp	x10, x14
	ccmp	x9, x15, #2, lo
	b.lo	LBB0_8
; %bb.4:
	tbnz	w13, #0, LBB0_8
; %bb.5:
	and	x12, x8, #0xfffffff8
	add	x13, x9, #32
	add	x14, x10, #16
	add	x15, x11, #16
	mov	x16, x12
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q1, q3, [x14, #-16]
	ldp	q0, q2, [x15, #-16]
	sub	x17, x13, #32
	st2.4s	{ v0, v1 }, [x17]
	st2.4s	{ v2, v3 }, [x13]
	add	x13, x13, #64
	add	x14, x14, #32
	add	x15, x15, #32
	subs	x16, x16, #8
	b.ne	LBB0_6
; %bb.7:
	cmp	x12, x8
	b.eq	LBB0_10
LBB0_8:
	lsl	x13, x12, #2
	add	x11, x11, x13
	add	x10, x10, x13
	add	x9, x9, x12, lsl #3
	add	x9, x9, #4
	sub	x8, x8, x12
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x10], #4
	str	w12, [x9]
	ldr	w12, [x11], #4
	stur	w12, [x9, #-4]
	add	x9, x9, #8
	subs	x8, x8, #1
	b.ne	LBB0_9
LBB0_10:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_mtk_jpeg_adjust_fmt_mplane
.subsections_via_symbols
