	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_mdp_try_crop
_mtk_mdp_try_crop:                      ## @mtk_mdp_try_crop
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	16(%rdi), %rax
	cmpq	$0, (%rdx)
	js	LBB0_2
## %bb.1:
	movq	%rdx, %rbx
	cmpq	$0, 8(%rdx)
	js	LBB0_2
## %bb.3:
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	8(%rax), %r13
	movl	(%rdi), %edx
	leaq	16(%rbx), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	24(%rbx), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	16(%rbx), %r8
	movq	24(%rbx), %r9
	leaq	L_.str.1(%rip), %rsi
	movl	$2, %edi
	movq	%r14, %rcx
	xorl	%eax, %eax
	callq	_mtk_mdp_dbg
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_mtk_mdp_ctx_get_frame
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	8(%r12), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	16(%rbx), %rax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movq	%rax, -56(%rbp)
	movq	24(%rbx), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	%rax, -48(%rbp)
	movq	%r14, %rdi
	callq	_V4L2_TYPE_IS_OUTPUT
	testq	%rax, %rax
	movq	%r14, -120(%rbp)                ## 8-byte Spill
	movq	%rbx, -112(%rbp)                ## 8-byte Spill
	je	LBB0_5
## %bb.4:
	movq	%r15, %rbx
	movl	$32, %r14d
	movl	$64, %r15d
	movl	$1, %ecx
	movl	$1, %r8d
LBB0_9:
	movq	-104(%rbp), %r10                ## 8-byte Reload
	movq	-96(%rbp), %r11                 ## 8-byte Reload
	jmp	LBB0_10
LBB0_2:
	movq	(%rax), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_22
LBB0_5:
	movq	8(%r13), %rax
	movq	(%rax), %rcx
	movq	8(%rax), %r8
	movq	8(%r15), %rax
	movl	(%rax), %eax
	cmpl	$270, %eax                      ## imm = 0x10E
	je	LBB0_7
## %bb.6:
	cmpl	$90, %eax
	jne	LBB0_8
LBB0_7:
	movq	%r15, %rbx
	movq	(%r12), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	8(%r12), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	(%r13), %rax
	movq	(%rax), %r15
	movq	8(%rax), %r14
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r10
	movq	%r10, -56(%rbp)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r11
	movq	%r11, -48(%rbp)
LBB0_10:
	movl	(%rbx), %edx
	subq	$8, %rsp
	leaq	L_.str.2(%rip), %rsi
	movl	$2, %edi
	movq	%rcx, %r12
	movq	%r8, %r13
	movq	%r15, %r9
	xorl	%eax, %eax
	pushq	%r11
	pushq	%r10
	pushq	%r14
	callq	_mtk_mdp_dbg
	addq	$32, %rsp
	leaq	-56(%rbp), %rdi
	leaq	-48(%rbp), %r8
	movq	%r15, %rsi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	movq	%r12, %rcx
	movq	%r14, %r9
	pushq	%r13
	pushq	-80(%rbp)                       ## 8-byte Folded Reload
	callq	_mtk_mdp_bound_align_image
	addq	$16, %rsp
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	callq	_V4L2_TYPE_IS_OUTPUT
	testq	%rax, %rax
	je	LBB0_11
LBB0_14:
	movq	-56(%rbp), %rdi
	movq	-48(%rbp), %rsi
	jmp	LBB0_15
LBB0_11:
	movq	8(%rbx), %rax
	movl	(%rax), %eax
	cmpl	$270, %eax                      ## imm = 0x10E
	je	LBB0_13
## %bb.12:
	cmpl	$90, %eax
	jne	LBB0_14
LBB0_13:
	movq	-48(%rbp), %rdi
	movq	-56(%rbp), %rsi
LBB0_15:
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdx
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rcx
	callq	_mtk_mdp_check_crop_change
	movq	-112(%rbp), %rsi                ## 8-byte Reload
	movq	8(%rsi), %rcx
	movq	-56(%rbp), %rax
	leaq	(%rax,%rcx), %rdx
	movq	-88(%rbp), %r11                 ## 8-byte Reload
	cmpq	%r11, %rdx
	movq	-80(%rbp), %r10                 ## 8-byte Reload
	jle	LBB0_17
## %bb.16:
	movq	%r11, %rcx
	subq	%rax, %rcx
	movq	%rcx, 8(%rsi)
LBB0_17:
	movq	(%rsi), %r8
	movq	-48(%rbp), %rax
	leaq	(%rax,%r8), %rdx
	cmpq	%r10, %rdx
	jle	LBB0_19
## %bb.18:
	movq	%r10, %r8
	subq	%rax, %r8
	movq	%r8, (%rsi)
LBB0_19:
	testb	$1, %cl
	je	LBB0_21
## %bb.20:
	decq	%rcx
	movq	%rcx, 8(%rsi)
LBB0_21:
	movl	(%rbx), %edx
	movq	(%r12), %r9
	subq	$8, %rsp
	leaq	L_.str.3(%rip), %rsi
	xorl	%ebx, %ebx
	movl	$2, %edi
	xorl	%eax, %eax
	pushq	%r10
	pushq	%r11
	pushq	(%r14)
	callq	_mtk_mdp_dbg
	addq	$32, %rsp
LBB0_22:
	movl	%ebx, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	%r15, %rbx
	movq	(%r13), %rax
	movq	16(%rax), %r15
	movq	24(%rax), %r14
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"doesn't support negative values for top & left\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"[%d] type:%d, set wxh:%dx%d"

L_.str.2:                               ## @.str.2
	.asciz	"[%d] align:%dx%d, min:%dx%d, new:%dx%d"

L_.str.3:                               ## @.str.3
	.asciz	"[%d] crop l,t,w,h:%d,%d,%d,%d, max:%dx%d"

	.no_dead_strip	_mtk_mdp_try_crop
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_mdp_try_crop
_mtk_mdp_try_crop:                      ; @mtk_mdp_try_crop
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	ldr	x8, [x0, #16]
	ldr	x9, [x2]
	tbnz	x9, #63, LBB0_4
; %bb.1:
	mov	x20, x2
	ldr	x9, [x2, #8]
	tbnz	x9, #63, LBB0_4
; %bb.2:
	mov	x25, x1
	mov	x19, x0
	ldr	x28, [x8, #8]
	ldr	w2, [x0]
	mov	x21, x20
	ldr	x4, [x21, #16]!
	mov	x22, x21
	ldr	x5, [x22, #8]!
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #2
	mov	x3, x25
	bl	_mtk_mdp_dbg
	mov	x0, x19
	mov	x1, x25
	bl	_mtk_mdp_ctx_get_frame
	mov	x23, x0
	ldr	x9, [x0]
	ldr	x8, [x0, #8]
	stp	x8, x9, [sp, #32]               ; 16-byte Folded Spill
	ldr	x24, [x21]
	ldr	x26, [x22]
	stp	x26, x24, [sp, #48]
	mov	x0, x25
	bl	_V4L2_TYPE_IS_OUTPUT
	cbz	x0, LBB0_5
; %bb.3:
	mov	w23, #32
	mov	w28, #64
	mov	w9, #1
	mov	w27, #1
	b	LBB0_9
LBB0_4:
	ldr	x0, [x8]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_21
LBB0_5:
	ldr	x8, [x28, #8]
	ldp	x9, x27, [x8]
	ldr	x8, [x19, #8]
	ldr	w8, [x8]
	cmp	w8, #270
	b.eq	LBB0_7
; %bb.6:
	cmp	w8, #90
	b.ne	LBB0_8
LBB0_7:
	ldr	x10, [x23, #8]
	ldr	x8, [x23]
	stp	x8, x10, [sp, #32]              ; 16-byte Folded Spill
	ldr	x8, [x28]
	ldp	x28, x23, [x8]
	ldr	x24, [x22]
	ldr	x26, [x21]
	stp	x26, x24, [sp, #48]
	b	LBB0_9
LBB0_8:
	ldr	x8, [x28]
	ldp	x28, x23, [x8, #16]
LBB0_9:
	ldr	w2, [x19]
	stp	x24, x26, [sp, #8]
	str	x23, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #2
	mov	x26, x9
	mov	x3, x9
	mov	x4, x27
	mov	x5, x28
	bl	_mtk_mdp_dbg
	add	x0, sp, #56
	add	x4, sp, #48
	mov	x1, x28
	ldr	x24, [sp, #40]                  ; 8-byte Folded Reload
	mov	x2, x24
	mov	x3, x26
	mov	x5, x23
	ldr	x23, [sp, #32]                  ; 8-byte Folded Reload
	mov	x6, x23
	mov	x7, x27
	bl	_mtk_mdp_bound_align_image
	mov	x0, x25
	bl	_V4L2_TYPE_IS_OUTPUT
	cbz	x0, LBB0_11
LBB0_10:
	ldp	x1, x0, [sp, #48]
	b	LBB0_14
LBB0_11:
	ldr	x8, [x19, #8]
	ldr	w8, [x8]
	cmp	w8, #270
	b.eq	LBB0_13
; %bb.12:
	cmp	w8, #90
	b.ne	LBB0_10
LBB0_13:
	ldp	x0, x1, [sp, #48]
LBB0_14:
	mov	x2, x21
	mov	x3, x22
	bl	_mtk_mdp_check_crop_change
	ldr	x3, [x20, #8]
	ldr	x8, [sp, #56]
	add	x9, x8, x3
	cmp	x9, x24
	b.le	LBB0_16
; %bb.15:
	sub	x3, x24, x8
	str	x3, [x20, #8]
LBB0_16:
	ldr	x4, [x20]
	ldr	x8, [sp, #48]
	add	x9, x8, x4
	cmp	x9, x23
	b.le	LBB0_18
; %bb.17:
	sub	x4, x23, x8
	str	x4, [x20]
LBB0_18:
	tbz	w3, #0, LBB0_20
; %bb.19:
	sub	x3, x3, #1
	str	x3, [x20, #8]
LBB0_20:
	ldr	w2, [x19]
	ldr	x5, [x21]
	ldr	x8, [x22]
	stp	x24, x23, [sp, #8]
	str	x8, [sp]
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #2
	bl	_mtk_mdp_dbg
	mov	w0, #0
LBB0_21:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"doesn't support negative values for top & left\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"[%d] type:%d, set wxh:%dx%d"

l_.str.2:                               ; @.str.2
	.asciz	"[%d] align:%dx%d, min:%dx%d, new:%dx%d"

l_.str.3:                               ; @.str.3
	.asciz	"[%d] crop l,t,w,h:%d,%d,%d,%d, max:%dx%d"

	.no_dead_strip	_mtk_mdp_try_crop
.subsections_via_symbols
