	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vbi_open
_vbi_open:                              ## @vbi_open
	.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	%rsi, %r14
	movq	%rdi, %r15
	movq	(%rsi), %r12
	movq	8(%r12), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_PCI_BT_V1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saa7146_read
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	xorl	%r13d, %r13d
	movq	%r15, %rsi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	_DEB_VBI
	movq	_RESOURCE_DMA3_BRS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_saa7146_res_get
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	andl	$-2031617, %ebx                 ## imm = 0xFFE0FFFF
	orl	$1900544, %ebx                  ## imm = 0x1D0000
	movq	_PCI_BT_V1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_saa7146_write
	movq	_MC2@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_MASK_04@GOTPCREL(%rip), %rax
	movq	_MASK_20@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	%r15, %rdi
	callq	_saa7146_write
	movq	16(%r15), %rdx
	leaq	12(%r15), %rcx
	movq	_V4L2_BUF_TYPE_VBI_CAPTURE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	_V4L2_FIELD_SEQ_TB@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	leaq	8(%r15), %rax
	subq	$8, %rsp
	movq	_vbi_qops@GOTPCREL(%rip), %rsi
	movq	%r12, %rdi
	pushq	%rax
	pushq	%r14
	pushq	$4
	callq	_videobuf_queue_sg_init
	addq	$32, %rsp
	movq	_vbi_read_timeout@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, 8(%rcx)
	movq	%r14, (%rcx)
	movq	_SAA7146_USE_PORT_B_FOR_VBI@GOTPCREL(%rip), %rax
	movq	(%r15), %rcx
	movl	(%rcx), %ecx
	movq	_BRS_CTRL@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	testl	%ecx, (%rax)
	je	LBB0_4
## %bb.3:
	movq	_MASK_30@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_MASK_29@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	orl	$3670016, %edx                  ## imm = 0x380000
	movq	%r15, %rdi
	callq	_saa7146_write
	jmp	LBB0_6
LBB0_1:
	leaq	L_.str.1(%rip), %rdi
	callq	_DEB_S
	movq	_EBUSY@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	jmp	LBB0_7
LBB0_4:
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_saa7146_write
	movq	%r15, %rdi
	callq	_vbi_workaround
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_DEB_VBI
LBB0_6:
	movl	(%rbx), %esi
	movq	_MASK_08@GOTPCREL(%rip), %rax
	movq	_MASK_24@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	%r15, %rdi
	callq	_saa7146_write
	xorl	%r13d, %r13d
LBB0_7:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_BT_V1,4,2                  ## @PCI_BT_V1
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dev:%p, fh:%p\n"

	.comm	_RESOURCE_DMA3_BRS,4,2          ## @RESOURCE_DMA3_BRS
L_.str.1:                               ## @.str.1
	.asciz	"cannot get vbi RESOURCE_DMA3_BRS resource\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_MC2,4,2                        ## @MC2
	.comm	_MASK_04,4,2                    ## @MASK_04
	.comm	_MASK_20,4,2                    ## @MASK_20
	.comm	_vbi_qops,4,2                   ## @vbi_qops
	.comm	_V4L2_BUF_TYPE_VBI_CAPTURE,4,2  ## @V4L2_BUF_TYPE_VBI_CAPTURE
	.comm	_V4L2_FIELD_SEQ_TB,4,2          ## @V4L2_FIELD_SEQ_TB
	.comm	_vbi_read_timeout,4,2           ## @vbi_read_timeout
	.comm	_SAA7146_USE_PORT_B_FOR_VBI,4,2 ## @SAA7146_USE_PORT_B_FOR_VBI
	.comm	_BRS_CTRL,4,2                   ## @BRS_CTRL
	.comm	_MASK_30,4,2                    ## @MASK_30
	.comm	_MASK_29,4,2                    ## @MASK_29
L_.str.2:                               ## @.str.2
	.asciz	"vbi workaround failed!\n"

	.comm	_MASK_08,4,2                    ## @MASK_08
	.comm	_MASK_24,4,2                    ## @MASK_24
	.no_dead_strip	_vbi_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vbi_open
_vbi_open:                              ; @vbi_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x1]
	ldr	x8, [x21, #8]
	ldr	x23, [x8]
Lloh0:
	adrp	x24, _PCI_BT_V1@GOTPAGE
Lloh1:
	ldr	x24, [x24, _PCI_BT_V1@GOTPAGEOFF]
	ldr	w1, [x24]
	bl	_saa7146_read
	mov	x22, x0
	stp	x19, x21, [sp]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DEB_VBI
Lloh4:
	adrp	x8, _RESOURCE_DMA3_BRS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _RESOURCE_DMA3_BRS@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_saa7146_res_get
	cbz	w0, LBB0_3
; %bb.1:
	mov	w8, #29
	bfi	w22, w8, #16, #5
	ldr	w1, [x24]
	mov	x0, x19
	mov	x2, x22
	bl	_saa7146_write
Lloh7:
	adrp	x22, _MC2@GOTPAGE
Lloh8:
	ldr	x22, [x22, _MC2@GOTPAGEOFF]
Lloh9:
	adrp	x8, _MASK_04@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MASK_04@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _MASK_20@GOTPAGE
Lloh13:
	ldr	x9, [x9, _MASK_20@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_saa7146_write
	ldr	x2, [x19, #16]
Lloh15:
	adrp	x8, _V4L2_BUF_TYPE_VBI_CAPTURE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _V4L2_BUF_TYPE_VBI_CAPTURE@GOTPAGEOFF]
	add	x3, x19, #12
Lloh17:
	ldr	w4, [x8]
Lloh18:
	adrp	x8, _V4L2_FIELD_SEQ_TB@GOTPAGE
Lloh19:
	ldr	x8, [x8, _V4L2_FIELD_SEQ_TB@GOTPAGEOFF]
Lloh20:
	ldr	w5, [x8]
	add	x8, x19, #8
	str	x8, [sp]
Lloh21:
	adrp	x1, _vbi_qops@GOTPAGE
Lloh22:
	ldr	x1, [x1, _vbi_qops@GOTPAGEOFF]
	mov	x0, x21
	mov	w6, #4
	mov	x7, x20
	bl	_videobuf_queue_sg_init
Lloh23:
	adrp	x8, _vbi_read_timeout@GOTPAGE
Lloh24:
	ldr	x8, [x8, _vbi_read_timeout@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	str	w8, [x23, #8]
	str	x20, [x23]
Lloh26:
	adrp	x8, _SAA7146_USE_PORT_B_FOR_VBI@GOTPAGE
Lloh27:
	ldr	x8, [x8, _SAA7146_USE_PORT_B_FOR_VBI@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	ldr	x9, [x19]
	ldr	w9, [x9]
Lloh29:
	adrp	x10, _BRS_CTRL@GOTPAGE
Lloh30:
	ldr	x10, [x10, _BRS_CTRL@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x10]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.2:
Lloh32:
	adrp	x8, _MASK_30@GOTPAGE
Lloh33:
	ldr	x8, [x8, _MASK_30@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
Lloh35:
	adrp	x9, _MASK_29@GOTPAGE
Lloh36:
	ldr	x9, [x9, _MASK_29@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	orr	w8, w8, w9
	orr	w2, w8, #0x380000
	mov	x0, x19
	bl	_saa7146_write
	b	LBB0_6
LBB0_3:
Lloh38:
	adrp	x0, l_.str.1@PAGE
Lloh39:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DEB_S
Lloh40:
	adrp	x8, _EBUSY@GOTPAGE
Lloh41:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_7
LBB0_4:
	mov	x0, x19
	mov	w2, #1
	bl	_saa7146_write
	mov	x0, x19
	bl	_vbi_workaround
	cbz	w0, LBB0_6
; %bb.5:
Lloh43:
	adrp	x0, l_.str.2@PAGE
Lloh44:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DEB_VBI
LBB0_6:
Lloh45:
	adrp	x8, _MASK_08@GOTPAGE
Lloh46:
	ldr	x8, [x8, _MASK_08@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh47:
	ldr	w8, [x8]
Lloh48:
	adrp	x9, _MASK_24@GOTPAGE
Lloh49:
	ldr	x9, [x9, _MASK_24@GOTPAGEOFF]
Lloh50:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_saa7146_write
	mov	w0, #0
LBB0_7:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_BT_V1,4,2                  ; @PCI_BT_V1
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dev:%p, fh:%p\n"

	.comm	_RESOURCE_DMA3_BRS,4,2          ; @RESOURCE_DMA3_BRS
l_.str.1:                               ; @.str.1
	.asciz	"cannot get vbi RESOURCE_DMA3_BRS resource\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_MC2,4,2                        ; @MC2
	.comm	_MASK_04,4,2                    ; @MASK_04
	.comm	_MASK_20,4,2                    ; @MASK_20
	.comm	_vbi_qops,4,2                   ; @vbi_qops
	.comm	_V4L2_BUF_TYPE_VBI_CAPTURE,4,2  ; @V4L2_BUF_TYPE_VBI_CAPTURE
	.comm	_V4L2_FIELD_SEQ_TB,4,2          ; @V4L2_FIELD_SEQ_TB
	.comm	_vbi_read_timeout,4,2           ; @vbi_read_timeout
	.comm	_SAA7146_USE_PORT_B_FOR_VBI,4,2 ; @SAA7146_USE_PORT_B_FOR_VBI
	.comm	_BRS_CTRL,4,2                   ; @BRS_CTRL
	.comm	_MASK_30,4,2                    ; @MASK_30
	.comm	_MASK_29,4,2                    ; @MASK_29
l_.str.2:                               ; @.str.2
	.asciz	"vbi workaround failed!\n"

	.comm	_MASK_08,4,2                    ; @MASK_08
	.comm	_MASK_24,4,2                    ; @MASK_24
	.no_dead_strip	_vbi_open
.subsections_via_symbols
