	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bttv_buffer_activate_vbi       ## -- Begin function bttv_buffer_activate_vbi
	.p2align	4, 0x90
_bttv_buffer_activate_vbi:              ## @bttv_buffer_activate_vbi
	.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, %r14
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.2:
	movq	%rsi, %r15
	movq	_VIDEOBUF_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leaq	20(%rsi), %rdi
	movl	%eax, 24(%rsi)
	callq	_list_del
	movq	_BT848_E_CROP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_btread
	movl	%eax, %r12d
	movq	_BT848_E_VDELAY_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_btread
                                        ## kill: def $eax killed $eax def $rax
	movl	%r12d, %ecx
	andl	$192, %ecx
	leal	(%rax,%rcx,4), %eax
	movl	16(%r15), %ebx
	cmpl	%eax, %ebx
	jbe	LBB0_4
## %bb.3:
	movl	%ebx, %r13d
	andl	$254, %r13d
	andl	$63, %r12d
	shrl	$2, %ebx
	andl	$192, %ebx
	orl	%r12d, %ebx
	movq	_BT848_E_VDELAY_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r13d, %edi
	callq	_btwrite
	movq	_BT848_E_CROP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_btwrite
	movq	_BT848_O_VDELAY_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r13d, %edi
	callq	_btwrite
	movq	_BT848_O_CROP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_btwrite
LBB0_4:
	movq	(%r15), %rax
	leaq	12(%r15), %rdx
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	cmpq	$0, (%rax)
	cmovleq	%rsi, %rdx
	setg	%cl
	shll	$2, %ecx
	addq	$8, %r15
	xorl	%ebx, %ebx
	cmpq	$0, 8(%rax)
	cmovleq	%rsi, %r15
	setg	%bl
	cmovgl	%esi, %ecx
	shll	$2, %ebx
	jmp	LBB0_5
LBB0_1:
	xorl	%edx, %edx
	xorl	%r15d, %r15d
	xorl	%ecx, %ecx
	xorl	%ebx, %ebx
LBB0_5:
	movq	_RISC_SLOT_O_VBI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_bttv_risc_hook
	movq	_RISC_SLOT_E_VBI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movq	%r15, %rdx
	movl	%ebx, %ecx
	callq	_bttv_risc_hook
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VIDEOBUF_ACTIVE,4,2            ## @VIDEOBUF_ACTIVE
	.comm	_BT848_E_CROP,4,2               ## @BT848_E_CROP
	.comm	_BT848_E_VDELAY_LO,4,2          ## @BT848_E_VDELAY_LO
	.comm	_BT848_O_VDELAY_LO,4,2          ## @BT848_O_VDELAY_LO
	.comm	_BT848_O_CROP,4,2               ## @BT848_O_CROP
	.comm	_RISC_SLOT_O_VBI,4,2            ## @RISC_SLOT_O_VBI
	.comm	_RISC_SLOT_E_VBI,4,2            ## @RISC_SLOT_E_VBI
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bttv_buffer_activate_vbi       ; -- Begin function bttv_buffer_activate_vbi
	.p2align	2
_bttv_buffer_activate_vbi:              ; @bttv_buffer_activate_vbi
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	mov	x19, x0
	cbz	x1, LBB0_4
; %bb.1:
Lloh0:
	adrp	x8, _VIDEOBUF_ACTIVE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VIDEOBUF_ACTIVE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	add	x0, x20, #20
	str	w8, [x20, #24]
	bl	_list_del
Lloh3:
	adrp	x24, _BT848_E_CROP@GOTPAGE
Lloh4:
	ldr	x24, [x24, _BT848_E_CROP@GOTPAGEOFF]
	ldr	w0, [x24]
	bl	_btread
	mov	x21, x0
Lloh5:
	adrp	x25, _BT848_E_VDELAY_LO@GOTPAGE
Lloh6:
	ldr	x25, [x25, _BT848_E_VDELAY_LO@GOTPAGEOFF]
	ldr	w0, [x25]
	bl	_btread
	lsl	w8, w21, #2
	and	w9, w8, #0x300
	ldr	w8, [x20, #16]
	add	w9, w0, w9
	cmp	w8, w9
	b.ls	LBB0_3
; %bb.2:
	and	w22, w8, #0xfe
	lsr	w8, w8, #2
	and	w23, w8, #0xc0
	bfxil	w23, w21, #0, #6
	ldr	w1, [x25]
	mov	x0, x22
	bl	_btwrite
	ldr	w1, [x24]
	mov	x0, x23
	bl	_btwrite
Lloh7:
	adrp	x8, _BT848_O_VDELAY_LO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _BT848_O_VDELAY_LO@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_btwrite
Lloh10:
	adrp	x8, _BT848_O_CROP@GOTPAGE
Lloh11:
	ldr	x8, [x8, _BT848_O_CROP@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_btwrite
LBB0_3:
	add	x8, x20, #12
	ldr	x9, [x20], #8
	ldp	x10, x9, [x9]
	cmp	x10, #0
	csel	x2, x8, xzr, gt
	cset	w8, gt
	lsl	w8, w8, #2
	cmp	x9, #0
	csel	x20, x20, xzr, gt
	cset	w9, gt
	csel	w3, wzr, w8, gt
	lsl	w21, w9, #2
	b	LBB0_5
LBB0_4:
	mov	x2, #0
	mov	w3, #0
	mov	w21, #0
LBB0_5:
Lloh13:
	adrp	x8, _RISC_SLOT_O_VBI@GOTPAGE
Lloh14:
	ldr	x8, [x8, _RISC_SLOT_O_VBI@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bttv_risc_hook
Lloh16:
	adrp	x8, _RISC_SLOT_E_VBI@GOTPAGE
Lloh17:
	ldr	x8, [x8, _RISC_SLOT_E_VBI@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	mov	x3, x21
	bl	_bttv_risc_hook
	mov	w0, #0
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_VIDEOBUF_ACTIVE,4,2            ; @VIDEOBUF_ACTIVE
	.comm	_BT848_E_CROP,4,2               ; @BT848_E_CROP
	.comm	_BT848_E_VDELAY_LO,4,2          ; @BT848_E_VDELAY_LO
	.comm	_BT848_O_VDELAY_LO,4,2          ; @BT848_O_VDELAY_LO
	.comm	_BT848_O_CROP,4,2               ; @BT848_O_CROP
	.comm	_RISC_SLOT_O_VBI,4,2            ; @RISC_SLOT_O_VBI
	.comm	_RISC_SLOT_E_VBI,4,2            ; @RISC_SLOT_E_VBI
.subsections_via_symbols
