	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bttv_s_crop
_bttv_s_crop:                           ## @bttv_s_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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r12
	movq	%rsi, %r14
	movq	24(%rsi), %r13
	movq	(%rdx), %rax
	movq	_V4L2_BUF_TYPE_VIDEO_CAPTURE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.1:
	movq	_V4L2_BUF_TYPE_VIDEO_OVERLAY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_3:
	leaq	36(%r13), %rdi
	movl	32(%r14), %esi
	callq	_v4l2_prio_check
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.4:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	24(%r14), %rdi
	movq	_VIDEO_RESOURCES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_locked_btres
	testq	%rax, %rax
	jne	LBB0_13
## %bb.5:
	movq	_bttv_tvnorms@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %rcx
	shlq	$4, %rcx
	movl	(%rax,%rcx), %edx
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movl	4(%rax,%rcx), %edx
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movl	8(%rax,%rcx), %edi
	movl	12(%rax,%rcx), %r15d
	addl	%edi, %r15d
	movl	32(%r13), %esi
	callq	_max
                                        ## kill: def $eax killed $eax def $rax
	leal	32(%rax), %ecx
	cmpl	%r15d, %ecx
	jge	LBB0_13
## %bb.6:
	movl	20(%r12), %edi
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%ecx, %ebx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	addl	%esi, %ebx
	leal	(%rcx,%rsi), %edx
	addl	$-48, %edx
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_clamp
	movq	_MAX_HDELAY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_min
	movl	%eax, -80(%rbp)
	movl	16(%r12), %edi
	subl	%eax, %ebx
	movl	$48, %esi
	movl	%ebx, %edx
	callq	_clamp
	movq	%rax, -64(%rbp)
	movl	12(%r12), %edi
	leal	-32(%r15), %edx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_clamp
	incl	%eax
	andl	$-2, %eax
	movl	%eax, -76(%rbp)
	movl	8(%r12), %edi
	subl	%eax, %r15d
	movl	$32, %esi
	movl	%r15d, %edx
	callq	_clamp
	incl	%eax
	andl	$-2, %eax
	movl	%eax, -72(%rbp)
	leaq	-112(%rbp), %rdi
	callq	_bttv_crop_calc_limits
	movq	24(%r13), %rax
	movq	-64(%rbp), %rcx
	movq	%rcx, 104(%rax)
	movups	-112(%rbp), %xmm0
	movups	-96(%rbp), %xmm1
	movups	-80(%rbp), %xmm2
	movups	%xmm2, 88(%rax)
	movups	%xmm1, 72(%rax)
	movups	%xmm0, 56(%rax)
	movl	$1, (%r14)
	movq	8(%r14), %rcx
	movq	-112(%rbp), %rax
	cmpq	%rax, %rcx
	jl	LBB0_8
## %bb.7:
	movq	-104(%rbp), %rax
	cmpq	%rax, %rcx
	jle	LBB0_9
LBB0_8:
	movq	%rax, 8(%r14)
	movq	%rax, 8(%r13)
LBB0_9:
	movq	16(%r14), %rax
	movq	-96(%rbp), %rcx
	cmpq	%rcx, %rax
	jge	LBB0_11
## %bb.10:
	movq	%rcx, 16(%r14)
	movq	%rcx, 16(%r13)
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_11:
	movq	-88(%rbp), %rcx
	xorl	%ebx, %ebx
	cmpq	%rcx, %rax
	jle	LBB0_13
## %bb.12:
	movq	%rcx, 16(%r14)
	movq	%rcx, 16(%r13)
LBB0_13:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_BUF_TYPE_VIDEO_CAPTURE,8,3 ## @V4L2_BUF_TYPE_VIDEO_CAPTURE
	.comm	_V4L2_BUF_TYPE_VIDEO_OVERLAY,8,3 ## @V4L2_BUF_TYPE_VIDEO_OVERLAY
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_VIDEO_RESOURCES,4,2            ## @VIDEO_RESOURCES
	.comm	_bttv_tvnorms,8,3               ## @bttv_tvnorms
	.comm	_MAX_HDELAY,8,3                 ## @MAX_HDELAY
	.no_dead_strip	_bttv_s_crop
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bttv_s_crop
_bttv_s_crop:                           ; @bttv_s_crop
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	ldr	x8, [x2]
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_OVERLAY@GOTPAGE
Lloh4:
	ldr	x10, [x10, _V4L2_BUF_TYPE_VIDEO_OVERLAY@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_10
; %bb.1:
	mov	x20, x2
	mov	x19, x1
	ldr	x24, [x1, #24]
	add	x0, x24, #36
	ldr	w1, [x1, #32]
	bl	_v4l2_prio_check
	mov	x21, x0
	cbnz	w0, LBB0_11
; %bb.2:
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w21, w8
	ldr	x0, [x19, #24]
Lloh9:
	adrp	x8, _VIDEO_RESOURCES@GOTPAGE
Lloh10:
	ldr	x8, [x8, _VIDEO_RESOURCES@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_locked_btres
	cbnz	x0, LBB0_11
; %bb.3:
Lloh12:
	adrp	x8, _bttv_tvnorms@GOTPAGE
Lloh13:
	ldr	x8, [x8, _bttv_tvnorms@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	ldr	x9, [x24]
	add	x8, x8, x9, lsl #4
	ldp	w23, w26, [x8]
	ldp	w0, w8, [x8, #8]
	add	w25, w8, w0
	ldr	w1, [x24, #32]
	bl	_max
	add	w8, w0, #32
	cmp	w8, w25
	b.ge	LBB0_11
; %bb.4:
	mov	x22, x0
	add	w21, w26, w23
	ldr	w0, [x20, #20]
	sub	w2, w21, #48
	mov	x1, x23
	bl	_clamp
Lloh15:
	adrp	x8, _MAX_HDELAY@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MAX_HDELAY@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_min
	str	w0, [sp, #40]
	ldr	w8, [x20, #16]
	sub	w2, w21, w0
	mov	x0, x8
	mov	w1, #48
	bl	_clamp
	str	x0, [sp, #56]
	ldr	w0, [x20, #12]
	sub	w2, w25, #32
	mov	x1, x22
	bl	_clamp
	add	w8, w0, #1
	and	w8, w8, #0xfffffffe
	str	w8, [sp, #44]
	ldr	w0, [x20, #8]
	sub	w2, w25, w8
	mov	w1, #32
	bl	_clamp
	add	w8, w0, #1
	and	w8, w8, #0xfffffffe
	str	w8, [sp, #48]
	add	x0, sp, #8
	bl	_bttv_crop_calc_limits
	ldr	x8, [x24, #24]
	ldr	x9, [sp, #56]
	str	x9, [x8, #104]
	ldur	q0, [sp, #40]
	ldur	q1, [sp, #24]
	stur	q0, [x8, #88]
	stur	q1, [x8, #72]
	ldur	q0, [sp, #8]
	stur	q0, [x8, #56]
	mov	w8, #1
	str	w8, [x19]
	ldr	x9, [x19, #8]
	ldr	x8, [sp, #8]
	cmp	x9, x8
	b.lt	LBB0_6
; %bb.5:
	ldr	x8, [sp, #16]
	cmp	x9, x8
	b.le	LBB0_7
LBB0_6:
	str	x8, [x19, #8]
	str	x8, [x24, #8]
LBB0_7:
	ldr	x9, [x19, #16]
	ldr	x8, [sp, #24]
	cmp	x9, x8
	b.lt	LBB0_9
; %bb.8:
	ldr	x8, [sp, #32]
	cmp	x9, x8
	b.le	LBB0_12
LBB0_9:
	mov	w21, #0
	str	x8, [x19, #16]
	str	x8, [x24, #16]
	b	LBB0_11
LBB0_10:
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_11:
	mov	x0, x21
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_12:
	mov	w21, #0
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_BUF_TYPE_VIDEO_CAPTURE,8,3 ; @V4L2_BUF_TYPE_VIDEO_CAPTURE
	.comm	_V4L2_BUF_TYPE_VIDEO_OVERLAY,8,3 ; @V4L2_BUF_TYPE_VIDEO_OVERLAY
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_VIDEO_RESOURCES,4,2            ; @VIDEO_RESOURCES
	.comm	_bttv_tvnorms,8,3               ; @bttv_tvnorms
	.comm	_MAX_HDELAY,8,3                 ; @MAX_HDELAY
	.no_dead_strip	_bttv_s_crop
.subsections_via_symbols
