	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tw686x_set_standard
_tw686x_set_standard:                   ## @tw686x_set_standard
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	_V4L2_STD_NTSC@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	movl	$0, %edx
	testl	%esi, (%rax)
	jne	LBB0_8
## %bb.1:
	movq	_V4L2_STD_PAL@GOTPCREL(%rip), %rax
	movl	$1, %edx
	testl	%r15d, (%rax)
	jne	LBB0_8
## %bb.2:
	movq	_V4L2_STD_SECAM@GOTPCREL(%rip), %rax
	movl	$2, %edx
	testl	%r15d, (%rax)
	jne	LBB0_8
## %bb.3:
	movq	_V4L2_STD_NTSC_443@GOTPCREL(%rip), %rax
	movl	$3, %edx
	testl	%r15d, (%rax)
	jne	LBB0_8
## %bb.4:
	movq	_V4L2_STD_PAL_M@GOTPCREL(%rip), %rax
	movl	$4, %edx
	testl	%r15d, (%rax)
	jne	LBB0_8
## %bb.5:
	movq	_V4L2_STD_PAL_Nc@GOTPCREL(%rip), %rax
	movl	$5, %edx
	testl	%r15d, (%rax)
	jne	LBB0_8
## %bb.6:
	movq	_V4L2_STD_PAL_60@GOTPCREL(%rip), %rax
	movl	$6, %edx
	testl	%r15d, (%rax)
	je	LBB0_7
LBB0_8:
	movl	%r15d, (%rbx)
	movl	16(%rbx), %edi
	movq	_SDT@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	8(%rbx), %rcx
	movl	(%rax,%rcx,4), %esi
	callq	_reg_write
	movl	16(%rbx), %edi
	movq	_VIDEO_CONTROL1@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_reg_read
	movq	_V4L2_STD_525_60@GOTPCREL(%rip), %rcx
	andl	(%rcx), %r15d
	movq	_SYS_MODE_DMA_SHIFT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	addl	8(%rbx), %ecx
	movl	%eax, %edx
	btrl	%ecx, %edx
	btsl	%ecx, %eax
	testl	%r15d, %r15d
	cmovel	%eax, %edx
	movl	16(%rbx), %edi
	movl	(%r12), %esi
	callq	_reg_write
LBB0_9:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_STD_NTSC,4,2              ## @V4L2_STD_NTSC
	.comm	_V4L2_STD_PAL,4,2               ## @V4L2_STD_PAL
	.comm	_V4L2_STD_SECAM,4,2             ## @V4L2_STD_SECAM
	.comm	_V4L2_STD_NTSC_443,4,2          ## @V4L2_STD_NTSC_443
	.comm	_V4L2_STD_PAL_M,4,2             ## @V4L2_STD_PAL_M
	.comm	_V4L2_STD_PAL_Nc,4,2            ## @V4L2_STD_PAL_Nc
	.comm	_V4L2_STD_PAL_60,4,2            ## @V4L2_STD_PAL_60
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SDT,8,3                        ## @SDT
	.comm	_VIDEO_CONTROL1,4,2             ## @VIDEO_CONTROL1
	.comm	_V4L2_STD_525_60,4,2            ## @V4L2_STD_525_60
	.comm	_SYS_MODE_DMA_SHIFT,4,2         ## @SYS_MODE_DMA_SHIFT
	.no_dead_strip	_tw686x_set_standard
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tw686x_set_standard
_tw686x_set_standard:                   ; @tw686x_set_standard
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _V4L2_STD_NTSC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _V4L2_STD_NTSC@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w1
	b.eq	LBB0_2
; %bb.1:
	mov	w2, #0
	b	LBB0_14
LBB0_2:
Lloh3:
	adrp	x8, _V4L2_STD_PAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _V4L2_STD_PAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_4
; %bb.3:
	mov	w2, #1
	b	LBB0_14
LBB0_4:
Lloh6:
	adrp	x8, _V4L2_STD_SECAM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _V4L2_STD_SECAM@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_6
; %bb.5:
	mov	w2, #2
	b	LBB0_14
LBB0_6:
Lloh9:
	adrp	x8, _V4L2_STD_NTSC_443@GOTPAGE
Lloh10:
	ldr	x8, [x8, _V4L2_STD_NTSC_443@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_8
; %bb.7:
	mov	w2, #3
	b	LBB0_14
LBB0_8:
Lloh12:
	adrp	x8, _V4L2_STD_PAL_M@GOTPAGE
Lloh13:
	ldr	x8, [x8, _V4L2_STD_PAL_M@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_10
; %bb.9:
	mov	w2, #4
	b	LBB0_14
LBB0_10:
Lloh15:
	adrp	x8, _V4L2_STD_PAL_Nc@GOTPAGE
Lloh16:
	ldr	x8, [x8, _V4L2_STD_PAL_Nc@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_12
; %bb.11:
	mov	w2, #5
	b	LBB0_14
LBB0_12:
Lloh18:
	adrp	x8, _V4L2_STD_PAL_60@GOTPAGE
Lloh19:
	ldr	x8, [x8, _V4L2_STD_PAL_60@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_16
; %bb.13:
	mov	w2, #6
LBB0_14:
	str	w20, [x19]
	ldr	w0, [x19, #16]
Lloh21:
	adrp	x8, _SDT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SDT@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	ldr	x9, [x19, #8]
	ldr	w1, [x8, x9, lsl #2]
	bl	_reg_write
	ldr	w0, [x19, #16]
Lloh24:
	adrp	x21, _VIDEO_CONTROL1@GOTPAGE
Lloh25:
	ldr	x21, [x21, _VIDEO_CONTROL1@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_reg_read
Lloh26:
	adrp	x8, _V4L2_STD_525_60@GOTPAGE
Lloh27:
	ldr	x8, [x8, _V4L2_STD_525_60@GOTPAGEOFF]
Lloh28:
	adrp	x9, _SYS_MODE_DMA_SHIFT@GOTPAGE
Lloh29:
	ldr	x9, [x9, _SYS_MODE_DMA_SHIFT@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
Lloh31:
	ldr	w9, [x9]
	ldr	w10, [x19, #8]
	add	w9, w9, w10
	mov	w10, #1
	lsl	w9, w10, w9
	bic	w10, w0, w9
	orr	w9, w9, w0
	tst	w8, w20
	csel	w2, w9, w10, eq
	ldr	w0, [x19, #16]
	ldr	w1, [x21]
	bl	_reg_write
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_16:
Lloh32:
	adrp	x8, _EINVAL@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh30
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_STD_NTSC,4,2              ; @V4L2_STD_NTSC
	.comm	_V4L2_STD_PAL,4,2               ; @V4L2_STD_PAL
	.comm	_V4L2_STD_SECAM,4,2             ; @V4L2_STD_SECAM
	.comm	_V4L2_STD_NTSC_443,4,2          ; @V4L2_STD_NTSC_443
	.comm	_V4L2_STD_PAL_M,4,2             ; @V4L2_STD_PAL_M
	.comm	_V4L2_STD_PAL_Nc,4,2            ; @V4L2_STD_PAL_Nc
	.comm	_V4L2_STD_PAL_60,4,2            ; @V4L2_STD_PAL_60
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SDT,8,3                        ; @SDT
	.comm	_VIDEO_CONTROL1,4,2             ; @VIDEO_CONTROL1
	.comm	_V4L2_STD_525_60,4,2            ; @V4L2_STD_525_60
	.comm	_SYS_MODE_DMA_SHIFT,4,2         ; @SYS_MODE_DMA_SHIFT
	.no_dead_strip	_tw686x_set_standard
.subsections_via_symbols
