	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vivid_update_quality           ## -- Begin function vivid_update_quality
	.p2align	4, 0x90
_vivid_update_quality:                  ## @vivid_update_quality
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	cmpq	$0, 32(%rdi)
	je	LBB0_4
## %bb.1:
	movq	%rbx, %rdi
	callq	_vivid_is_svid_cap
	testq	%rax, %rax
	jne	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	callq	_vivid_is_hdmi_cap
	testq	%rax, %rax
	jne	LBB0_3
LBB0_4:
	movq	%rbx, %rdi
	callq	_vivid_is_hdmi_cap
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	(%rbx), %rax
	movq	24(%rbx), %rcx
	movl	(%rcx,%rax,4), %edi
	callq	_VIVID_INVALID_SIGNAL
	testq	%rax, %rax
	jne	LBB0_3
LBB0_6:
	movq	%rbx, %rdi
	callq	_vivid_is_sdtv_cap
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	(%rbx), %rax
	movq	16(%rbx), %rcx
	movl	(%rcx,%rax,4), %edi
	callq	_VIVID_INVALID_SIGNAL
	testq	%rax, %rax
	je	LBB0_8
LBB0_3:
	addq	$12, %rbx
	movq	_TPG_QUAL_NOISE@GOTPCREL(%rip), %rax
LBB0_15:
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
LBB0_16:
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_tpg_s_quality                  ## TAILCALL
LBB0_8:
	movq	%rbx, %rdi
	callq	_vivid_is_tv_cap
	testl	%eax, %eax
	je	LBB0_9
## %bb.11:
	movl	8(%rbx), %edi
	leal	-676(%rdi), %eax
	cltq
	imulq	$715827883, %rax, %rax          ## imm = 0x2AAAAAAB
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$36, %rax
	addl	%ecx, %eax
	shll	$5, %eax
	leal	(%rax,%rax,2), %eax
	negl	%eax
	addl	%edi, %eax
	addl	$-676, %eax                     ## imm = 0xFD5C
	cmpl	$33, %eax
	jb	LBB0_13
## %bb.12:
	addq	$12, %rbx
	movq	_TPG_QUAL_NOISE@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	xorl	$85, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_next_pseudo_random32
	andl	$63, %eax
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	jmp	LBB0_16
LBB0_9:
	addq	$12, %rbx
	jmp	LBB0_10
LBB0_13:
	addl	$-21, %eax
	addq	$12, %rbx
	cmpl	$-10, %eax
	ja	LBB0_10
## %bb.14:
	movq	_TPG_QUAL_GRAY@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_10:
	movq	_TPG_QUAL_COLOR@GOTPCREL(%rip), %rax
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_TPG_QUAL_NOISE,4,2             ## @TPG_QUAL_NOISE
	.comm	_TPG_QUAL_COLOR,4,2             ## @TPG_QUAL_COLOR
	.comm	_TPG_QUAL_GRAY,4,2              ## @TPG_QUAL_GRAY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vivid_update_quality           ; -- Begin function vivid_update_quality
	.p2align	2
_vivid_update_quality:                  ; @vivid_update_quality
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0, #32]
	cbz	x8, LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_vivid_is_svid_cap
	cbnz	x0, LBB0_7
; %bb.2:
	mov	x0, x19
	bl	_vivid_is_hdmi_cap
	cbnz	x0, LBB0_7
LBB0_3:
	mov	x0, x19
	bl	_vivid_is_hdmi_cap
	cbz	x0, LBB0_5
; %bb.4:
	ldr	x8, [x19, #24]
	ldr	x9, [x19]
	ldr	w0, [x8, x9, lsl #2]
	bl	_VIVID_INVALID_SIGNAL
	cbnz	x0, LBB0_7
LBB0_5:
	mov	x0, x19
	bl	_vivid_is_sdtv_cap
	cbz	x0, LBB0_10
; %bb.6:
	ldr	x8, [x19, #16]
	ldr	x9, [x19]
	ldr	w0, [x8, x9, lsl #2]
	bl	_VIVID_INVALID_SIGNAL
	cbz	x0, LBB0_10
LBB0_7:
	add	x0, x19, #12
Lloh0:
	adrp	x8, _TPG_QUAL_NOISE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TPG_QUAL_NOISE@GOTPAGEOFF]
LBB0_8:
	ldr	w1, [x8]
	mov	w2, #0
LBB0_9:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_tpg_s_quality
LBB0_10:
	mov	x0, x19
	bl	_vivid_is_tv_cap
	cbz	w0, LBB0_13
; %bb.11:
	ldr	w8, [x19, #8]
	sub	w9, w8, #676
	mov	w10, #43691
	movk	w10, #10922, lsl #16
	smull	x10, w9, w10
	lsr	x11, x10, #63
	asr	x10, x10, #36
	add	w10, w10, w11
	mov	w11, #96
	msub	w9, w10, w11, w9
	cmp	w9, #33
	b.lo	LBB0_14
; %bb.12:
	add	x19, x19, #12
Lloh2:
	adrp	x9, _TPG_QUAL_NOISE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _TPG_QUAL_NOISE@GOTPAGEOFF]
Lloh4:
	ldr	w20, [x9]
	mov	w9, #85
	eor	w0, w8, w9
	bl	_next_pseudo_random32
	and	w2, w0, #0x3f
	mov	x0, x19
	mov	x1, x20
	b	LBB0_9
LBB0_13:
	add	x0, x19, #12
	b	LBB0_16
LBB0_14:
	sub	w8, w9, #21
	add	x0, x19, #12
	cmn	w8, #10
	b.hi	LBB0_16
; %bb.15:
Lloh5:
	adrp	x8, _TPG_QUAL_GRAY@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TPG_QUAL_GRAY@GOTPAGEOFF]
	b	LBB0_8
LBB0_16:
Lloh7:
	adrp	x8, _TPG_QUAL_COLOR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _TPG_QUAL_COLOR@GOTPAGEOFF]
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_TPG_QUAL_NOISE,4,2             ; @TPG_QUAL_NOISE
	.comm	_TPG_QUAL_COLOR,4,2             ; @TPG_QUAL_COLOR
	.comm	_TPG_QUAL_GRAY,4,2              ; @TPG_QUAL_GRAY
.subsections_via_symbols
