	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gsc_m2m_s_selection
_gsc_m2m_s_selection:                   ## @gsc_m2m_s_selection
	.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	%r12
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %rdi
	callq	_fh_to_ctx
	movq	%rax, %r15
	movq	32(%rax), %rax
	movq	(%rax), %r14
	movq	16(%rbx), %rax
	movq	%rax, -48(%rbp)
	movups	(%rbx), %xmm0
	movaps	%xmm0, -64(%rbp)
	movq	(%rbx), %rax
	movq	_V4L2_BUF_TYPE_VIDEO_CAPTURE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_4
## %bb.1:
	movq	_V4L2_BUF_TYPE_VIDEO_OUTPUT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_4
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_3:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_22
LBB0_4:
	leaq	-64(%rbp), %rsi
	movq	%r15, %rdi
	callq	_gsc_try_selection
	testl	%eax, %eax
	je	LBB0_5
LBB0_22:
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	8(%rbx), %eax
	movq	_V4L2_SEL_FLAG_LE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_8
## %bb.6:
	leaq	-48(%rbp), %rdi
	leaq	16(%rbx), %rsi
	callq	_is_rectangle_enclosed
	testl	%eax, %eax
	je	LBB0_10
## %bb.7:
	movl	8(%rbx), %eax
LBB0_8:
	movq	_V4L2_SEL_FLAG_GE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.9:
	leaq	16(%rbx), %rdi
	leaq	-48(%rbp), %rsi
	callq	_is_rectangle_enclosed
	testl	%eax, %eax
	je	LBB0_10
LBB0_11:
	movq	-48(%rbp), %rax
	movq	%rax, 16(%rbx)
	movl	12(%rbx), %eax
	leal	-128(%rax), %ecx
	cmpl	$3, %ecx
	jb	LBB0_14
## %bb.12:
	addl	$-131, %eax
	cmpl	$2, %eax
	ja	LBB0_2
## %bb.13:
	movq	%r15, %r12
	addq	$16, %r12
	jmp	LBB0_15
LBB0_10:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_14:
	movq	%r15, %r12
	addq	$24, %r12
LBB0_15:
	movq	_GSC_DST_FMT@GOTPCREL(%rip), %rax
	movq	_GSC_SRC_FMT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movq	%r15, %rsi
	callq	_gsc_ctx_state_is_set
	testq	%rax, %rax
	je	LBB0_21
## %bb.16:
	movq	(%rbx), %rax
	movq	_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.17:
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %esi
	movl	28(%r15), %ecx
	movl	24(%r15), %r8d
	jmp	LBB0_19
LBB0_18:
	movl	20(%r15), %esi
	movl	16(%r15), %edx
	movl	-48(%rbp), %r8d
	movl	-44(%rbp), %ecx
LBB0_19:
	movq	8(%r15), %rax
	movl	(%rax), %r9d
	movl	(%r15), %eax
	movl	%eax, (%rsp)
	movq	%r14, %rdi
	callq	_gsc_check_scaler_ratio
	testl	%eax, %eax
	je	LBB0_21
## %bb.20:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_2
LBB0_21:
	movq	-48(%rbp), %rax
	movq	%rax, (%r12)
	movq	_GSC_PARAMS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_gsc_ctx_state_lock_set
	xorl	%eax, %eax
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_BUF_TYPE_VIDEO_CAPTURE,8,3 ## @V4L2_BUF_TYPE_VIDEO_CAPTURE
	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT,8,3 ## @V4L2_BUF_TYPE_VIDEO_OUTPUT
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_V4L2_SEL_FLAG_LE,4,2           ## @V4L2_SEL_FLAG_LE
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_V4L2_SEL_FLAG_GE,4,2           ## @V4L2_SEL_FLAG_GE
	.comm	_GSC_DST_FMT,4,2                ## @GSC_DST_FMT
	.comm	_GSC_SRC_FMT,4,2                ## @GSC_SRC_FMT
	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,8,3 ## @V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Out of scaler range"

	.comm	_GSC_PARAMS,4,2                 ## @GSC_PARAMS
	.no_dead_strip	_gsc_m2m_s_selection
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gsc_m2m_s_selection
_gsc_m2m_s_selection:                   ; @gsc_m2m_s_selection
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x21, x2
	mov	x0, x1
	bl	_fh_to_ctx
	ldr	x8, [x0, #32]
	ldr	x20, [x8]
	ldr	q0, [x21]
	str	q0, [sp]
	ldr	x8, [x21, #16]
	str	x8, [sp, #16]
	ldr	x8, [x21]
Lloh0:
	adrp	x9, _V4L2_BUF_TYPE_VIDEO_CAPTURE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _V4L2_BUF_TYPE_VIDEO_CAPTURE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _V4L2_BUF_TYPE_VIDEO_OUTPUT@GOTPAGE
Lloh4:
	ldr	x10, [x10, _V4L2_BUF_TYPE_VIDEO_OUTPUT@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_18
; %bb.1:
	mov	x19, x0
	mov	x1, sp
	bl	_gsc_try_selection
	cbnz	w0, LBB0_20
; %bb.2:
	ldr	w8, [x21, #8]
Lloh6:
	adrp	x9, _V4L2_SEL_FLAG_LE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _V4L2_SEL_FLAG_LE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.3:
	mov	x8, sp
	add	x0, x8, #16
	add	x1, x21, #16
	bl	_is_rectangle_enclosed
	cbz	w0, LBB0_10
; %bb.4:
	ldr	w8, [x21, #8]
LBB0_5:
Lloh9:
	adrp	x9, _V4L2_SEL_FLAG_GE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _V4L2_SEL_FLAG_GE@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.6:
	add	x0, x21, #16
	mov	x8, sp
	add	x1, x8, #16
	bl	_is_rectangle_enclosed
	cbz	w0, LBB0_10
LBB0_7:
	ldr	x8, [sp, #16]
	str	x8, [x21, #16]
	ldr	w8, [x21, #12]
	sub	w9, w8, #128
	cmp	w9, #3
	b.lo	LBB0_11
; %bb.8:
	sub	w8, w8, #131
	cmp	w8, #2
	b.hi	LBB0_18
; %bb.9:
	add	x22, x19, #16
	b	LBB0_12
LBB0_10:
Lloh12:
	adrp	x8, _ERANGE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
	b	LBB0_19
LBB0_11:
	add	x22, x19, #24
LBB0_12:
Lloh14:
	adrp	x8, _GSC_DST_FMT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _GSC_DST_FMT@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x9, _GSC_SRC_FMT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _GSC_SRC_FMT@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w0, w9, w8
	mov	x1, x19
	bl	_gsc_ctx_state_is_set
	cbz	x0, LBB0_21
; %bb.13:
	ldr	x8, [x21]
Lloh20:
	adrp	x9, _V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE@GOTPAGE
Lloh21:
	ldr	x9, [x9, _V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.14:
	ldp	w2, w1, [sp, #16]
	ldp	w4, w3, [x19, #24]
	b	LBB0_16
LBB0_15:
	ldp	w2, w1, [x19, #16]
	ldp	w4, w3, [sp, #16]
LBB0_16:
	ldr	x8, [x19, #8]
	ldr	w5, [x8]
	ldr	w6, [x19]
	mov	x0, x20
	bl	_gsc_check_scaler_ratio
	cbz	w0, LBB0_21
; %bb.17:
Lloh23:
	adrp	x0, l_.str@PAGE
Lloh24:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
LBB0_18:
Lloh25:
	adrp	x8, _EINVAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_20:
	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
	add	sp, sp, #80
	ret
LBB0_21:
	ldr	x8, [sp, #16]
	str	x8, [x22]
Lloh27:
	adrp	x8, _GSC_PARAMS@GOTPAGE
Lloh28:
	ldr	x8, [x8, _GSC_PARAMS@GOTPAGEOFF]
Lloh29:
	ldr	w0, [x8]
	mov	x1, x19
	bl	_gsc_ctx_state_lock_set
	mov	w0, #0
	b	LBB0_20
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_BUF_TYPE_VIDEO_CAPTURE,8,3 ; @V4L2_BUF_TYPE_VIDEO_CAPTURE
	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT,8,3 ; @V4L2_BUF_TYPE_VIDEO_OUTPUT
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_V4L2_SEL_FLAG_LE,4,2           ; @V4L2_SEL_FLAG_LE
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_V4L2_SEL_FLAG_GE,4,2           ; @V4L2_SEL_FLAG_GE
	.comm	_GSC_DST_FMT,4,2                ; @GSC_DST_FMT
	.comm	_GSC_SRC_FMT,4,2                ; @GSC_SRC_FMT
	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,8,3 ; @V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Out of scaler range"

	.comm	_GSC_PARAMS,4,2                 ; @GSC_PARAMS
	.no_dead_strip	_gsc_m2m_s_selection
.subsections_via_symbols
