	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ivtv_s_std_dec                 ## -- Begin function ivtv_s_std_dec
	.p2align	4, 0x90
_ivtv_s_std_dec:                        ## @ivtv_s_std_dec
	.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
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	_wait@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_DEFINE_WAIT
	movl	%r14d, (%rbx)
	movq	_V4L2_STD_525_60@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movl	(%rax), %eax
	andl	%r14d, %eax
	sete	%cl
	setne	%dl
	movl	%edx, 4(%rbx)
	movl	%ecx, 8(%rbx)
	movq	_video@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_s_std_output@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	%r14d, %ecx
	callq	_ivtv_call_all
	leaq	40(%rbx), %r14
	movq	%r14, %rdi
	callq	_mutex_unlock
	leaq	44(%rbx), %r15
	movq	_TASK_UNINTERRUPTIBLE@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_prepare_to_wait
	movq	_IVTV_REG_DEC_LINE_FIELD@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_read_reg
	cmpl	$6553600, %eax                  ## imm = 0x640000
	jl	LBB0_5
## %bb.1:
	movl	$25, %edi
	callq	_msecs_to_jiffies
	movl	%eax, %edi
	callq	_schedule_timeout
	movl	(%r13), %edx
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_prepare_to_wait
	movl	(%r12), %edi
	callq	_read_reg
	cmpl	$6553600, %eax                  ## imm = 0x640000
	jl	LBB0_5
## %bb.2:
	movl	$25, %edi
	callq	_msecs_to_jiffies
	movl	%eax, %edi
	callq	_schedule_timeout
	movl	(%r13), %edx
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_prepare_to_wait
	movl	(%r12), %edi
	callq	_read_reg
	cmpl	$6553600, %eax                  ## imm = 0x640000
	jl	LBB0_5
## %bb.3:
	movl	$25, %edi
	callq	_msecs_to_jiffies
	movl	%eax, %edi
	callq	_schedule_timeout
	movl	(%r13), %edx
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_prepare_to_wait
	movl	(%r12), %edi
	callq	_read_reg
	cmpl	$6553600, %eax                  ## imm = 0x640000
	jge	LBB0_4
LBB0_5:
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_finish_wait
	movq	%r14, %rdi
	callq	_mutex_lock
LBB0_6:
	movq	_CX2341X_DEC_SET_STANDARD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	8(%rbx), %ecx
	movq	%rbx, %rdi
	movl	$1, %edx
	xorl	%eax, %eax
	callq	_ivtv_vapi
	xorps	%xmm0, %xmm0
	movups	%xmm0, 24(%rbx)
	movl	$720, 16(%rbx)                  ## imm = 0x2D0
	cmpl	$0, 8(%rbx)
	movl	$480, %r14d                     ## imm = 0x1E0
	movl	$576, %r8d                      ## imm = 0x240
	cmovel	%r14d, %r8d
	movl	$576, %r15d                     ## imm = 0x240
	movl	%r8d, 20(%rbx)
	movq	_CX2341X_OSD_SET_FRAMEBUFFER_WINDOW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$0, (%rsp)
	movq	%rbx, %rdi
	movl	$4, %edx
	movl	$720, %ecx                      ## imm = 0x2D0
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	callq	_ivtv_vapi
	movups	16(%rbx), %xmm0
	movups	%xmm0, 56(%rbx)
	movq	32(%rbx), %rax
	movq	%rax, 72(%rbx)
	cmpl	$0, 12(%rbx)
	jne	LBB0_8
## %bb.7:
	movl	$720, 48(%rbx)                  ## imm = 0x2D0
	cmpl	$0, 8(%rbx)
	cmovel	%r14d, %r15d
	movl	%r15d, 52(%rbx)
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	$25, %edi
	callq	_msecs_to_jiffies
	movl	%eax, %edi
	callq	_schedule_timeout
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_finish_wait
	movq	%r14, %rdi
	callq	_mutex_lock
	leaq	L_.str(%rip), %rdi
	callq	_IVTV_WARN
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_wait,4,2                       ## @wait
	.comm	_V4L2_STD_525_60,4,2            ## @V4L2_STD_525_60
	.comm	_video,4,2                      ## @video
	.comm	_s_std_output,4,2               ## @s_std_output
	.comm	_TASK_UNINTERRUPTIBLE,4,2       ## @TASK_UNINTERRUPTIBLE
	.comm	_IVTV_REG_DEC_LINE_FIELD,4,2    ## @IVTV_REG_DEC_LINE_FIELD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Mode change failed to sync to decoder\n"

	.comm	_CX2341X_DEC_SET_STANDARD,4,2   ## @CX2341X_DEC_SET_STANDARD
	.comm	_CX2341X_OSD_SET_FRAMEBUFFER_WINDOW,4,2 ## @CX2341X_OSD_SET_FRAMEBUFFER_WINDOW
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ivtv_s_std_dec                 ; -- Begin function ivtv_s_std_dec
	.p2align	2
_ivtv_s_std_dec:                        ; @ivtv_s_std_dec
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
Lloh0:
	adrp	x22, _wait@GOTPAGE
Lloh1:
	ldr	x22, [x22, _wait@GOTPAGEOFF]
	ldr	w0, [x22]
	bl	_DEFINE_WAIT
	str	w20, [x19]
Lloh2:
	adrp	x8, _V4L2_STD_525_60@GOTPAGE
Lloh3:
	ldr	x8, [x8, _V4L2_STD_525_60@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	tst	w8, w20
	cset	w8, eq
	cset	w9, ne
	stp	w9, w8, [x19, #4]
Lloh5:
	adrp	x8, _video@GOTPAGE
Lloh6:
	ldr	x8, [x8, _video@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x8, _s_std_output@GOTPAGE
Lloh9:
	ldr	x8, [x8, _s_std_output@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x3, x20
	bl	_ivtv_call_all
	add	x20, x19, #40
	mov	x0, x20
	bl	_mutex_unlock
	add	x21, x19, #44
Lloh11:
	adrp	x23, _TASK_UNINTERRUPTIBLE@GOTPAGE
Lloh12:
	ldr	x23, [x23, _TASK_UNINTERRUPTIBLE@GOTPAGEOFF]
	ldr	w2, [x23]
	mov	x0, x21
	mov	x1, x22
	bl	_prepare_to_wait
Lloh13:
	adrp	x22, _IVTV_REG_DEC_LINE_FIELD@GOTPAGE
Lloh14:
	ldr	x22, [x22, _IVTV_REG_DEC_LINE_FIELD@GOTPAGEOFF]
	ldr	w0, [x22]
	bl	_read_reg
	cmp	w0, #1600, lsl #12              ; =6553600
	b.lt	LBB0_4
; %bb.1:
	mov	w0, #25
	bl	_msecs_to_jiffies
	bl	_schedule_timeout
	ldr	w2, [x23]
Lloh15:
	adrp	x1, _wait@GOTPAGE
Lloh16:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x21
	bl	_prepare_to_wait
	ldr	w0, [x22]
	bl	_read_reg
	cmp	w0, #1600, lsl #12              ; =6553600
	b.lt	LBB0_4
; %bb.2:
	mov	w0, #25
	bl	_msecs_to_jiffies
	bl	_schedule_timeout
	ldr	w2, [x23]
Lloh17:
	adrp	x1, _wait@GOTPAGE
Lloh18:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x21
	bl	_prepare_to_wait
	ldr	w0, [x22]
	bl	_read_reg
	cmp	w0, #1600, lsl #12              ; =6553600
	b.lt	LBB0_4
; %bb.3:
	mov	w0, #25
	bl	_msecs_to_jiffies
	bl	_schedule_timeout
	ldr	w2, [x23]
Lloh19:
	adrp	x1, _wait@GOTPAGE
Lloh20:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x21
	bl	_prepare_to_wait
	ldr	w0, [x22]
	bl	_read_reg
	cmp	w0, #1600, lsl #12              ; =6553600
	b.ge	LBB0_8
LBB0_4:
Lloh21:
	adrp	x1, _wait@GOTPAGE
Lloh22:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x21
	bl	_finish_wait
	mov	x0, x20
	bl	_mutex_lock
LBB0_5:
Lloh23:
	adrp	x8, _CX2341X_DEC_SET_STANDARD@GOTPAGE
Lloh24:
	ldr	x8, [x8, _CX2341X_DEC_SET_STANDARD@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	ldr	w3, [x19, #8]
	mov	x0, x19
	mov	w2, #1
	bl	_ivtv_vapi
	stp	xzr, xzr, [x19, #24]
	mov	w20, #720
	ldr	w8, [x19, #8]
	mov	w21, #576
	mov	w22, #480
	cmp	w8, #0
	csel	w8, w22, w21, eq
	stp	w20, w8, [x19, #16]
Lloh26:
	adrp	x8, _CX2341X_OSD_SET_FRAMEBUFFER_WINDOW@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CX2341X_OSD_SET_FRAMEBUFFER_WINDOW@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	stp	xzr, xzr, [sp, #8]
	csel	x8, x22, x21, eq
	str	x8, [sp]
	mov	x0, x19
	mov	w2, #4
	mov	w3, #720
	bl	_ivtv_vapi
	ldr	q0, [x19, #16]
	stur	q0, [x19, #56]
	ldr	x8, [x19, #32]
	str	x8, [x19, #72]
	ldr	w8, [x19, #12]
	cbnz	w8, LBB0_7
; %bb.6:
	ldr	w8, [x19, #8]
	cmp	w8, #0
	csel	w8, w22, w21, eq
	stp	w20, w8, [x19, #48]
LBB0_7:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_8:
	mov	w0, #25
	bl	_msecs_to_jiffies
	bl	_schedule_timeout
Lloh29:
	adrp	x1, _wait@GOTPAGE
Lloh30:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x21
	bl	_finish_wait
	mov	x0, x20
	bl	_mutex_lock
Lloh31:
	adrp	x0, l_.str@PAGE
Lloh32:
	add	x0, x0, l_.str@PAGEOFF
	bl	_IVTV_WARN
	b	LBB0_5
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_wait,4,2                       ; @wait
	.comm	_V4L2_STD_525_60,4,2            ; @V4L2_STD_525_60
	.comm	_video,4,2                      ; @video
	.comm	_s_std_output,4,2               ; @s_std_output
	.comm	_TASK_UNINTERRUPTIBLE,4,2       ; @TASK_UNINTERRUPTIBLE
	.comm	_IVTV_REG_DEC_LINE_FIELD,4,2    ; @IVTV_REG_DEC_LINE_FIELD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Mode change failed to sync to decoder\n"

	.comm	_CX2341X_DEC_SET_STANDARD,4,2   ; @CX2341X_DEC_SET_STANDARD
	.comm	_CX2341X_OSD_SET_FRAMEBUFFER_WINDOW,4,2 ; @CX2341X_OSD_SET_FRAMEBUFFER_WINDOW
.subsections_via_symbols
