	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bttv_irq_switch_video
_bttv_irq_switch_video:                 ## @bttv_irq_switch_video
	.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	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	16(%rdi), %r14
	movq	%r14, %rdi
	callq	_spin_lock
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_bttv_irq_next_video
	movq	_BT848_RISC_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_btread
	movl	%eax, %r15d
	movq	32(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	movl	%r15d, %esi
	callq	_is_active
	testq	%rax, %rax
	jne	LBB0_4
LBB0_2:
	leaq	24(%rbx), %r12
	movq	(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.3:
	movl	%r15d, %esi
	callq	_is_active
	testq	%rax, %rax
	je	LBB0_6
LBB0_4:
	incl	40(%rbx)
	movq	_debug_latency@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.5:
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_bttv_irq_debug_low_latency
	jmp	LBB0_9
LBB0_6:
	movups	(%r12), %xmm0
	movaps	%xmm0, -64(%rbp)
	movups	-48(%rbp), %xmm0
	movups	%xmm0, (%r12)
	andb	$-2, (%rbx)
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_bttv_buffer_activate_video
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_bttv_set_dma
	movq	_UNSET@GOTPCREL(%rip), %r15
	movq	8(%rbx), %rsi
	cmpq	%rsi, (%r15)
	je	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	callq	_video_mux
	movq	(%r15), %rax
	movq	%rax, 8(%rbx)
LBB0_8:
	movq	_VIDEOBUF_DONE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-64(%rbp), %rsi
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_bttv_irq_wakeup_video
LBB0_9:
	movq	%r14, %rdi
	callq	_spin_unlock
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BT848_RISC_COUNT,4,2           ## @BT848_RISC_COUNT
	.comm	_debug_latency,8,3              ## @debug_latency
	.comm	_UNSET,8,3                      ## @UNSET
	.comm	_VIDEOBUF_DONE,4,2              ## @VIDEOBUF_DONE
	.no_dead_strip	_bttv_irq_switch_video
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bttv_irq_switch_video
_bttv_irq_switch_video:                 ; @bttv_irq_switch_video
	.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	x20, x0
	add	x19, x0, #16
	mov	x0, x19
	bl	_spin_lock
	add	x1, sp, #16
	mov	x0, x20
	bl	_bttv_irq_next_video
Lloh0:
	adrp	x8, _BT848_RISC_COUNT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BT848_RISC_COUNT@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_btread
	mov	x21, x0
	ldr	x0, [x20, #32]
	cbz	x0, LBB0_2
; %bb.1:
	mov	x1, x21
	bl	_is_active
	cbnz	x0, LBB0_4
LBB0_2:
	add	x22, x20, #24
	ldr	x0, [x22]
	cbz	x0, LBB0_6
; %bb.3:
	mov	x1, x21
	bl	_is_active
	cbz	x0, LBB0_6
LBB0_4:
	ldr	w8, [x20, #40]
	add	w8, w8, #1
	str	w8, [x20, #40]
Lloh3:
	adrp	x8, _debug_latency@GOTPAGE
Lloh4:
	ldr	x8, [x8, _debug_latency@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cbz	x8, LBB0_9
; %bb.5:
	mov	x0, x20
	mov	x1, x21
	bl	_bttv_irq_debug_low_latency
	b	LBB0_9
LBB0_6:
	ldr	q0, [x22]
	str	q0, [sp]
	ldr	q0, [sp, #16]
	str	q0, [x22]
	ldr	w8, [x20]
	and	w8, w8, #0xfffffffe
	str	w8, [x20]
	add	x1, sp, #16
	mov	x0, x20
	bl	_bttv_buffer_activate_video
	mov	x0, x20
	mov	w1, #0
	bl	_bttv_set_dma
Lloh6:
	adrp	x21, _UNSET@GOTPAGE
Lloh7:
	ldr	x21, [x21, _UNSET@GOTPAGEOFF]
	ldr	x8, [x21]
	ldr	x1, [x20, #8]
	cmp	x8, x1
	b.eq	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_video_mux
	ldr	x8, [x21]
	str	x8, [x20, #8]
LBB0_8:
Lloh8:
	adrp	x8, _VIDEOBUF_DONE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VIDEOBUF_DONE@GOTPAGEOFF]
Lloh10:
	ldr	w3, [x8]
	mov	x1, sp
	add	x2, sp, #16
	mov	x0, x20
	bl	_bttv_irq_wakeup_video
LBB0_9:
	mov	x0, x19
	bl	_spin_unlock
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_BT848_RISC_COUNT,4,2           ; @BT848_RISC_COUNT
	.comm	_debug_latency,8,3              ; @debug_latency
	.comm	_UNSET,8,3                      ; @UNSET
	.comm	_VIDEOBUF_DONE,4,2              ; @VIDEOBUF_DONE
	.no_dead_strip	_bttv_irq_switch_video
.subsections_via_symbols
