	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tvp514x_querystd
_tvp514x_querystd:                      ## @tvp514x_querystd
	.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, %r13
	callq	_to_decoder
	testq	%r14, %r14
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	cmpl	$0, 16(%rax)
	jne	LBB0_4
## %bb.3:
	movq	%r13, %rdi
	movl	$1, %esi
	callq	_tvp514x_s_stream
	movq	_LOCK_RETRY_DELAY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msleep
LBB0_4:
	movq	%r13, %rdi
	callq	_tvp514x_query_current_std
	movl	%eax, %r12d
	movq	_STD_INVALID@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_5
## %bb.6:
	movl	(%r15), %eax
	leal	-128(%rax), %ecx
	cmpl	$12, %ecx
	jae	LBB0_7
## %bb.9:
	movq	_STATUS_VIRT_SYNC_LOCK_BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_STATUS_HORZ_SYNC_LOCK_BIT@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_7:
	addl	$-140, %eax
	cmpl	$9, %eax
	ja	LBB0_1
## %bb.8:
	movq	_STATUS_CLR_SUBCAR_LOCK_BIT@GOTPCREL(%rip), %rax
	movq	_STATUS_HORZ_SYNC_LOCK_BIT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	orl	(%rax), %ebx
	movq	_STATUS_VIRT_SYNC_LOCK_BIT@GOTPCREL(%rip), %rax
LBB0_10:
	orl	(%rax), %ebx
	movq	_REG_STATUS1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_tvp514x_read_reg
	notl	%eax
	testl	%eax, %ebx
	jne	LBB0_5
## %bb.11:
	movq	8(%r15), %rax
	movl	%r12d, %ecx
	movl	4(%rax,%rcx,8), %edx
	andl	%edx, (%r14)
	movq	_debug@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	movl	(%rax,%rcx,8), %r8d
	leaq	L_.str(%rip), %rcx
	movl	$1, %edi
	movq	%r13, %rdx
	callq	_v4l2_dbg
	jmp	LBB0_12
LBB0_5:
	movq	_V4L2_STD_UNKNOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
LBB0_12:
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_LOCK_RETRY_DELAY,4,2           ## @LOCK_RETRY_DELAY
	.comm	_STD_INVALID,4,2                ## @STD_INVALID
	.comm	_V4L2_STD_UNKNOWN,4,2           ## @V4L2_STD_UNKNOWN
	.comm	_STATUS_CLR_SUBCAR_LOCK_BIT,4,2 ## @STATUS_CLR_SUBCAR_LOCK_BIT
	.comm	_STATUS_HORZ_SYNC_LOCK_BIT,4,2  ## @STATUS_HORZ_SYNC_LOCK_BIT
	.comm	_STATUS_VIRT_SYNC_LOCK_BIT,4,2  ## @STATUS_VIRT_SYNC_LOCK_BIT
	.comm	_REG_STATUS1,4,2                ## @REG_STATUS1
	.comm	_debug,4,2                      ## @debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Current STD: %s\n"

	.no_dead_strip	_tvp514x_querystd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tvp514x_querystd
_tvp514x_querystd:                      ; @tvp514x_querystd
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	bl	_to_decoder
	cbz	x20, LBB0_11
; %bb.1:
	mov	x21, x0
	ldr	w8, [x0, #16]
	cbnz	w8, LBB0_3
; %bb.2:
	mov	x0, x19
	mov	w1, #1
	bl	_tvp514x_s_stream
Lloh0:
	adrp	x8, _LOCK_RETRY_DELAY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LOCK_RETRY_DELAY@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_msleep
LBB0_3:
	mov	x0, x19
	bl	_tvp514x_query_current_std
Lloh3:
	adrp	x8, _STD_INVALID@GOTPAGE
Lloh4:
	ldr	x8, [x8, _STD_INVALID@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w0, w8
	b.eq	LBB0_10
; %bb.4:
	mov	x22, x0
	ldr	w8, [x21]
	sub	w9, w8, #128
	cmp	w9, #12
	b.hs	LBB0_6
; %bb.5:
Lloh6:
	adrp	x8, _STATUS_VIRT_SYNC_LOCK_BIT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _STATUS_VIRT_SYNC_LOCK_BIT@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _STATUS_HORZ_SYNC_LOCK_BIT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _STATUS_HORZ_SYNC_LOCK_BIT@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:
	sub	w8, w8, #140
	cmp	w8, #9
	b.hi	LBB0_11
; %bb.7:
Lloh11:
	adrp	x8, _STATUS_CLR_SUBCAR_LOCK_BIT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _STATUS_CLR_SUBCAR_LOCK_BIT@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _STATUS_HORZ_SYNC_LOCK_BIT@GOTPAGE
Lloh15:
	ldr	x9, [x9, _STATUS_HORZ_SYNC_LOCK_BIT@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh17:
	adrp	x9, _STATUS_VIRT_SYNC_LOCK_BIT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _STATUS_VIRT_SYNC_LOCK_BIT@GOTPAGEOFF]
LBB0_8:
	ldr	w9, [x9]
	orr	w23, w8, w9
Lloh19:
	adrp	x8, _REG_STATUS1@GOTPAGE
Lloh20:
	ldr	x8, [x8, _REG_STATUS1@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_tvp514x_read_reg
	bics	wzr, w23, w0
	b.ne	LBB0_10
; %bb.9:
	ldr	x8, [x21, #8]
	add	x8, x8, w22, uxtw #3
	ldr	w9, [x8, #4]
	ldr	w10, [x20]
	and	w9, w10, w9
	str	w9, [x20]
Lloh22:
	adrp	x9, _debug@GOTPAGE
Lloh23:
	ldr	x9, [x9, _debug@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x9]
	ldr	w4, [x8]
Lloh25:
	adrp	x3, l_.str@PAGE
Lloh26:
	add	x3, x3, l_.str@PAGEOFF
	mov	w0, #1
	mov	x2, x19
	bl	_v4l2_dbg
	mov	w0, #0
	b	LBB0_12
LBB0_10:
	mov	w0, #0
Lloh27:
	adrp	x8, _V4L2_STD_UNKNOWN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _V4L2_STD_UNKNOWN@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	str	w8, [x20]
	b	LBB0_12
LBB0_11:
Lloh30:
	adrp	x8, _EINVAL@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_12:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_LOCK_RETRY_DELAY,4,2           ; @LOCK_RETRY_DELAY
	.comm	_STD_INVALID,4,2                ; @STD_INVALID
	.comm	_V4L2_STD_UNKNOWN,4,2           ; @V4L2_STD_UNKNOWN
	.comm	_STATUS_CLR_SUBCAR_LOCK_BIT,4,2 ; @STATUS_CLR_SUBCAR_LOCK_BIT
	.comm	_STATUS_HORZ_SYNC_LOCK_BIT,4,2  ; @STATUS_HORZ_SYNC_LOCK_BIT
	.comm	_STATUS_VIRT_SYNC_LOCK_BIT,4,2  ; @STATUS_VIRT_SYNC_LOCK_BIT
	.comm	_REG_STATUS1,4,2                ; @REG_STATUS1
	.comm	_debug,4,2                      ; @debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Current STD: %s\n"

	.no_dead_strip	_tvp514x_querystd
.subsections_via_symbols
