	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vivid_get_quality
_vivid_get_quality:                     ## @vivid_get_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	testq	%rsi, %rsi
	je	LBB0_2
## %bb.1:
	movl	$0, (%r15)
LBB0_2:
	leaq	4(%r14), %rbx
	movq	%rbx, %rdi
	callq	_tpg_g_quality
	cltq
	movq	_TPG_QUAL_COLOR@GOTPCREL(%rip), %rcx
	cmpq	%rax, (%rcx)
	je	LBB0_7
## %bb.3:
	movq	%rbx, %rdi
	callq	_tpg_g_quality
	cltq
	movq	_TPG_QUAL_NOISE@GOTPCREL(%rip), %rcx
	cmpq	%rax, (%rcx)
	jne	LBB0_4
LBB0_7:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_tpg_g_quality                  ## TAILCALL
LBB0_4:
	testq	%r15, %r15
	je	LBB0_6
## %bb.5:
	movl	(%r14), %eax
	leal	-676(%rax), %ecx
	movslq	%ecx, %rcx
	imulq	$715827883, %rcx, %rcx          ## imm = 0x2AAAAAAB
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$36, %rcx
	addl	%edx, %ecx
	shll	$5, %ecx
	leal	(%rcx,%rcx,2), %ecx
	negl	%ecx
	addl	%ecx, %eax
	addl	$-692, %eax                     ## imm = 0xFD4C
	movl	%eax, (%r15)
LBB0_6:
	movq	_TPG_QUAL_GRAY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TPG_QUAL_COLOR,8,3             ## @TPG_QUAL_COLOR
	.comm	_TPG_QUAL_NOISE,8,3             ## @TPG_QUAL_NOISE
	.comm	_TPG_QUAL_GRAY,4,2              ## @TPG_QUAL_GRAY
	.no_dead_strip	_vivid_get_quality
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vivid_get_quality
_vivid_get_quality:                     ; @vivid_get_quality
	.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	x19, x1
	mov	x20, x0
	cbz	x1, LBB0_2
; %bb.1:
	str	wzr, [x19]
LBB0_2:
	add	x21, x20, #4
	mov	x0, x21
	bl	_tpg_g_quality
Lloh0:
	adrp	x8, _TPG_QUAL_COLOR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TPG_QUAL_COLOR@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, w0, sxtw
	b.eq	LBB0_4
; %bb.3:
	mov	x0, x21
	bl	_tpg_g_quality
Lloh3:
	adrp	x8, _TPG_QUAL_NOISE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TPG_QUAL_NOISE@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x8, w0, sxtw
	b.ne	LBB0_5
LBB0_4:
	mov	x0, x21
	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
	b	_tpg_g_quality
LBB0_5:
	cbz	x19, LBB0_7
; %bb.6:
	ldr	w8, [x20]
	sub	w8, w8, #676
	mov	w9, #43691
	movk	w9, #10922, lsl #16
	smull	x9, w8, w9
	lsr	x10, x9, #63
	asr	x9, x9, #36
	add	w9, w9, w10
	mov	w10, #96
	msub	w8, w9, w10, w8
	sub	w8, w8, #16
	str	w8, [x19]
LBB0_7:
Lloh6:
	adrp	x8, _TPG_QUAL_GRAY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _TPG_QUAL_GRAY@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_TPG_QUAL_COLOR,8,3             ; @TPG_QUAL_COLOR
	.comm	_TPG_QUAL_NOISE,8,3             ; @TPG_QUAL_NOISE
	.comm	_TPG_QUAL_GRAY,4,2              ; @TPG_QUAL_GRAY
	.no_dead_strip	_vivid_get_quality
.subsections_via_symbols
