	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dnxhd_find_qscale
_dnxhd_find_qscale:                     ## @dnxhd_find_qscale
	.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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_INT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	(%rdi), %ebx
	xorl	%r12d, %r12d
	movl	$1, %edi
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_2 Depth 2
                                        ##       Child Loop BB0_5 Depth 3
                                        ##         Child Loop BB0_11 Depth 4
                                        ##         Child Loop BB0_16 Depth 4
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	xorl	%eax, %eax
	testl	%r12d, %r12d
	sete	%al
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	$1, %r13d
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_2:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_5 Depth 3
                                        ##         Child Loop BB0_11 Depth 4
                                        ##         Child Loop BB0_16 Depth 4
	movq	%rbx, %r15
	movl	%ebx, (%r14)
	movq	24(%r14), %rdi
	movq	_dnxhd_calc_bits_thread@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	8(%r14), %r8d
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	*8(%rdi)
	movl	8(%r14), %esi
	testl	%esi, %esi
	jle	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=2
	movl	%r13d, -48(%rbp)                ## 4-byte Spill
	movl	4(%r14), %ebx
	movl	12(%r14), %edx
	movslq	%edx, %r9
	movl	%r9d, %eax
	andl	$-4, %eax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	addq	$-4, %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	%rax, %rcx
	shrq	$2, %rcx
	incq	%rcx
	movq	%rcx, %rax
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	andq	$-2, %rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	xorl	%r11d, %r11d
	movl	$2, %r13d
	xorl	%r12d, %r12d
	xorl	%r8d, %r8d
	movq	%r15, %rdi
	movl	%ebx, -64(%rbp)                 ## 4-byte Spill
	movq	%rsi, -112(%rbp)                ## 8-byte Spill
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_1 Depth=1
                                        ##     Parent Loop BB0_2 Depth=2
                                        ## =>    This Loop Header: Depth=3
                                        ##         Child Loop BB0_11 Depth 4
                                        ##         Child Loop BB0_16 Depth 4
	testl	%edx, %edx
	jle	LBB0_17
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=3
	movslq	16(%r14), %rax
	movslq	%edi, %r15
	imulq	%rax, %r15
	movq	32(%r14), %r10
	cmpl	$4, %edx
	jae	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=3
	xorl	%eax, %eax
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=3
	movq	%r14, %rsi
	movq	%rdi, %r14
	movd	%r8d, %xmm0
	cmpq	$0, -96(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=3
	leaq	(%r15,%r13), %rax
	leaq	(%r10,%rax,8), %rax
	pxor	%xmm1, %xmm1
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_1 Depth=1
                                        ##     Parent Loop BB0_2 Depth=2
                                        ##       Parent Loop BB0_5 Depth=3
                                        ## =>      This Inner Loop Header: Depth=4
	movdqu	-16(%rax,%rbx,8), %xmm2
	movdqu	(%rax,%rbx,8), %xmm3
	movdqu	16(%rax,%rbx,8), %xmm4
	movdqu	32(%rax,%rbx,8), %xmm5
	pshufd	$232, %xmm2, %xmm2              ## xmm2 = xmm2[0,2,2,3]
	paddd	%xmm0, %xmm2
	pshufd	$232, %xmm3, %xmm3              ## xmm3 = xmm3[0,2,2,3]
	paddd	%xmm1, %xmm3
	pshufd	$232, %xmm4, %xmm0              ## xmm0 = xmm4[0,2,2,3]
	paddd	%xmm2, %xmm0
	pshufd	$232, %xmm5, %xmm1              ## xmm1 = xmm5[0,2,2,3]
	paddd	%xmm3, %xmm1
	addq	$8, %rbx
	addq	$-2, %rcx
	jne	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_5 Depth=3
	testb	$1, -88(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_14
LBB0_13:                                ##   in Loop: Header=BB0_5 Depth=3
	movq	%r12, %rax
	imulq	%r9, %rax
	addq	%rbx, %rax
	addq	%r15, %rax
	movdqu	(%r10,%rax,8), %xmm2
	movdqu	16(%r10,%rax,8), %xmm3
	pshufd	$232, %xmm2, %xmm2              ## xmm2 = xmm2[0,2,2,3]
	paddd	%xmm2, %xmm0
	pshufd	$232, %xmm3, %xmm2              ## xmm2 = xmm3[0,2,2,3]
	paddd	%xmm2, %xmm1
LBB0_14:                                ##   in Loop: Header=BB0_5 Depth=3
	paddd	%xmm1, %xmm0
	pshufd	$85, %xmm0, %xmm1               ## xmm1 = xmm0[1,1,1,1]
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r8d
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	movq	%rcx, %rax
	cmpq	%rdx, %rcx
	movq	%r14, %rdi
	movq	%rsi, %r14
	movl	-64(%rbp), %ebx                 ## 4-byte Reload
	movq	-112(%rbp), %rsi                ## 8-byte Reload
	je	LBB0_17
LBB0_15:                                ##   in Loop: Header=BB0_5 Depth=3
	addq	%r11, %r15
	leaq	(%r10,%r15,8), %rcx
	.p2align	4, 0x90
LBB0_16:                                ##   Parent Loop BB0_1 Depth=1
                                        ##     Parent Loop BB0_2 Depth=2
                                        ##       Parent Loop BB0_5 Depth=3
                                        ## =>      This Inner Loop Header: Depth=4
	addl	(%rcx,%rax,8), %r8d
	incq	%rax
	cmpq	%rax, %rdx
	jne	LBB0_16
LBB0_17:                                ##   in Loop: Header=BB0_5 Depth=3
	addl	$31, %r8d
	andl	$-32, %r8d
	cmpl	%ebx, %r8d
	jg	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_5 Depth=3
	incq	%r12
	addq	%r9, %r13
	addq	%r9, %r11
	cmpq	%rsi, %r12
	jb	LBB0_5
	jmp	LBB0_19
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=3
	pxor	%xmm1, %xmm1
	xorl	%ebx, %ebx
	testb	$1, -88(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_13
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=2
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movl	-48(%rbp), %r13d                ## 4-byte Reload
	cmpl	%ebx, %r8d
	jl	LBB0_21
	jmp	LBB0_28
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=2
	movl	4(%r14), %ebx
	xorl	%r8d, %r8d
	movq	%r15, %rdi
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	cmpl	%ebx, %r8d
	jge	LBB0_28
LBB0_21:                                ##   in Loop: Header=BB0_2 Depth=2
	cmpl	$1, %edi
	je	LBB0_22
## %bb.23:                              ##   in Loop: Header=BB0_2 Depth=2
	leal	-1(%rdi), %eax
	cmpl	%eax, %r12d
	je	LBB0_24
## %bb.27:                              ##   in Loop: Header=BB0_2 Depth=2
	movl	%r15d, %esi
	movq	%rdi, %rbx
	callq	_FFMIN
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	leal	(%rbx,%r12), %eax
	sarl	%eax
	subl	%r13d, %ebx
	addl	-60(%rbp), %r13d                ## 4-byte Folded Reload
	testl	%r12d, %r12d
	cmovnel	%eax, %ebx
	cmpl	$2, %ebx
	movl	$1, %eax
	movl	$1, -44(%rbp)                   ## 4-byte Folded Spill
	cmovll	%eax, %ebx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_28:                                ##   in Loop: Header=BB0_1 Depth=1
	leal	1(%rdi), %eax
	cmpl	%eax, %r15d
	je	LBB0_25
## %bb.29:                              ##   in Loop: Header=BB0_1 Depth=1
	movl	%r12d, %esi
	movq	%rdi, %rbx
	callq	_FFMAX
	leal	(%rbx,%r15), %ecx
	sarl	%ecx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	addl	%edi, %ebx
	xorl	%edx, %edx
	movq	_INT_MAX@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %r15d
	movl	%eax, %r12d
	sete	%dl
	cmovnel	%ecx, %ebx
	addl	%edx, %edi
	movq	24(%r14), %rax
	cmpl	(%rax), %ebx
	jl	LBB0_1
## %bb.30:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_22:
	movl	$1, %eax
	jmp	LBB0_26
LBB0_24:
	movl	%r12d, %edi
LBB0_25:
	movl	%edi, (%r14)
	xorl	%eax, %eax
LBB0_26:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_MAX,4,2                    ## @INT_MAX
	.comm	_dnxhd_calc_bits_thread,4,2     ## @dnxhd_calc_bits_thread
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_dnxhd_find_qscale
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dnxhd_find_qscale
_dnxhd_find_qscale:                     ; @dnxhd_find_qscale
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	mov	w20, #0
Lloh0:
	adrp	x23, _INT_MAX@GOTPAGE
Lloh1:
	ldr	x23, [x23, _INT_MAX@GOTPAGEOFF]
	ldr	w21, [x23]
	ldr	w22, [x0]
	mov	w25, #1
Lloh2:
	adrp	x24, _dnxhd_calc_bits_thread@GOTPAGE
Lloh3:
	ldr	x24, [x24, _dnxhd_calc_bits_thread@GOTPAGEOFF]
LBB0_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_2 Depth 2
                                        ;       Child Loop BB0_4 Depth 3
                                        ;         Child Loop BB0_8 Depth 4
                                        ;         Child Loop BB0_11 Depth 4
	cmp	w20, #0
	cset	w26, eq
	mov	w27, #1
LBB0_2:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_4 Depth 3
                                        ;         Child Loop BB0_8 Depth 4
                                        ;         Child Loop BB0_11 Depth 4
	str	w22, [x19]
	ldr	x0, [x19, #24]
	ldr	x8, [x0, #8]
	ldr	w1, [x24]
	ldr	w4, [x19, #8]
	mov	x2, #0
	mov	x3, #0
	blr	x8
	ldr	w9, [x19, #8]
	cmp	w9, #0
	b.le	LBB0_14
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=2
	mov	x10, #0
	mov	x11, #0
	mov	w15, #0
	ldr	w12, [x19, #12]
	ldr	w8, [x19, #4]
	sxtw	x13, w12
	and	x14, x12, #0xfffffff8
LBB0_4:                                 ;   Parent Loop BB0_1 Depth=1
                                        ;     Parent Loop BB0_2 Depth=2
                                        ; =>    This Loop Header: Depth=3
                                        ;         Child Loop BB0_8 Depth 4
                                        ;         Child Loop BB0_11 Depth 4
	cmp	w13, #1
	b.lt	LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=3
	ldr	x16, [x19, #32]
	ldrsw	x17, [x19, #16]
	sxtw	x0, w22
	mul	x17, x17, x0
	cmp	w13, #8
	b.hs	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=3
	mov	x0, #0
	b	LBB0_10
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=3
	movi	d0, #0000000000000000
	mov.s	v0[0], w15
	add	x15, x10, x17
	add	x15, x16, x15, lsl #3
	add	x15, x15, #32
	movi.2d	v1, #0000000000000000
	mov	x0, x14
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_8:                                 ;   Parent Loop BB0_1 Depth=1
                                        ;     Parent Loop BB0_2 Depth=2
                                        ;       Parent Loop BB0_4 Depth=3
                                        ; =>      This Inner Loop Header: Depth=4
	ldp	q4, q5, [x15, #-32]
	ldp	q6, q7, [x15], #64
	xtn.2s	v4, v4
	xtn.2s	v5, v5
	xtn.2s	v6, v6
	xtn.2s	v7, v7
	add.2s	v0, v0, v4
	add.2s	v1, v1, v5
	add.2s	v2, v2, v6
	add.2s	v3, v3, v7
	subs	x0, x0, #8
	b.ne	LBB0_8
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=3
	add.2s	v0, v1, v0
	add.2s	v0, v2, v0
	add.2s	v0, v3, v0
	addp.2s	v0, v0, v0
	fmov	w15, s0
	mov	x0, x14
	cmp	x14, x12
	b.eq	LBB0_12
LBB0_10:                                ;   in Loop: Header=BB0_4 Depth=3
	add	x1, x0, x10
	add	x17, x1, x17
	add	x16, x16, x17, lsl #3
	sub	x17, x12, x0
LBB0_11:                                ;   Parent Loop BB0_1 Depth=1
                                        ;     Parent Loop BB0_2 Depth=2
                                        ;       Parent Loop BB0_4 Depth=3
                                        ; =>      This Inner Loop Header: Depth=4
	ldr	w0, [x16], #8
	add	w15, w15, w0
	subs	x17, x17, #1
	b.ne	LBB0_11
LBB0_12:                                ;   in Loop: Header=BB0_4 Depth=3
	add	w15, w15, #31
	and	w15, w15, #0xffffffe0
	cmp	w15, w8
	b.gt	LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_4 Depth=3
	add	x11, x11, #1
	add	x10, x10, x13
	cmp	x11, x9
	b.lo	LBB0_4
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_2 Depth=2
	mov	w15, #0
	ldr	w8, [x19, #4]
LBB0_15:                                ;   in Loop: Header=BB0_2 Depth=2
	cmp	w15, w8
	b.ge	LBB0_19
; %bb.16:                               ;   in Loop: Header=BB0_2 Depth=2
	subs	w8, w22, #1
	b.eq	LBB0_22
; %bb.17:                               ;   in Loop: Header=BB0_2 Depth=2
	cmp	w20, w8
	b.eq	LBB0_23
; %bb.18:                               ;   in Loop: Header=BB0_2 Depth=2
	mov	x0, x22
	mov	x1, x21
	bl	_FFMIN
	mov	x21, x0
	add	w8, w22, w20
	asr	w8, w8, #1
	sub	w9, w22, w27
	add	w27, w27, w26
	cmp	w20, #0
	csel	w8, w9, w8, eq
	cmp	w8, #1
	csinc	w22, w8, wzr, gt
	mov	w25, #1
	b	LBB0_2
LBB0_19:                                ;   in Loop: Header=BB0_1 Depth=1
	add	w8, w22, #1
	cmp	w21, w8
	b.eq	LBB0_24
; %bb.20:                               ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x22
	mov	x1, x20
	bl	_FFMAX
	mov	x20, x0
	ldr	w8, [x23]
	add	w9, w22, w21
	asr	w9, w9, #1
	add	w10, w22, w25
	cmp	w21, w8
	csel	w22, w10, w9, eq
	cinc	w25, w25, eq
	ldr	x8, [x19, #24]
	ldr	w8, [x8]
	cmp	w22, w8
	b.lt	LBB0_1
; %bb.21:
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_AVERROR
LBB0_22:
	mov	w0, #1
	b	LBB0_25
LBB0_23:
	mov	x22, x20
LBB0_24:
	mov	w0, #0
	str	w22, [x19]
LBB0_25:
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_MAX,4,2                    ; @INT_MAX
	.comm	_dnxhd_calc_bits_thread,4,2     ; @dnxhd_calc_bits_thread
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_dnxhd_find_qscale
.subsections_via_symbols
