	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dnxhd_encode_fast
_dnxhd_encode_fast:                     ## @dnxhd_encode_fast
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	callq	_dnxhd_find_qscale
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	28(%r12), %r8d
	testl	%r8d, %r8d
	jle	LBB0_3
## %bb.4:
	movq	_RC_VARIANCE@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movl	32(%r12), %eax
	xorl	%ebx, %ebx
	xorl	%r10d, %r10d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	28(%r12), %r8d
LBB0_14:                                ##   in Loop: Header=BB0_5 Depth=1
	addl	$31, %ebx
	incl	%r10d
	cmpl	%r8d, %r10d
	jge	LBB0_15
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	testl	%eax, %eax
	jle	LBB0_14
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%r12), %r13
	movq	16(%r12), %rcx
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	40(%r12), %r8
	xorl	%edi, %edi
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_7
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=2
	movq	_INT_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=2
	movq	%rsi, %r14
	movl	%eax, 4(%r10,%r15,8)
	movl	%r13d, %r10d
	movq	-64(%rbp), %r13                 ## 8-byte Reload
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=2
	addl	%r11d, %ebx
	movl	32(%r12), %eax
	incq	%rdi
	cmpl	%eax, %edi
	jge	LBB0_13
LBB0_7:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	imull	%r10d, %eax
	movl	(%r12), %esi
	movl	36(%r12), %edx
	imull	%esi, %edx
	leal	(%rdx,%rax), %ecx
	addl	%edi, %ecx
	movslq	%eax, %r15
	addq	%rdi, %r15
	movl	%esi, (%r13,%r15,4)
	movslq	%ecx, %r9
	movl	(%r8,%r9,8), %ecx
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	%ecx, (%rsi,%r15,4)
	movl	(%r8,%r9,8), %r11d
	testq	%r14, %r14
	jne	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	movl	%r10d, %r13d
	movq	%r14, %rsi
	addl	36(%r12), %edx
	leaq	(%rdi,%rax), %rcx
	addl	%eax, %edx
	addl	%edi, %edx
	movslq	%edx, %rax
	movl	(%r8,%rax,8), %edx
	movq	48(%r12), %r10
	movl	%ecx, (%r10,%r15,8)
	movl	%r11d, %r14d
	subl	%edx, %r14d
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=2
	movl	4(%r8,%r9,8), %ecx
	subl	4(%r8,%rax,8), %ecx
	imull	$100, %ecx, %eax
	cltd
	idivl	%r14d
	jmp	LBB0_11
LBB0_1:
                                        ## kill: def $eax killed $eax def $rax
	jmp	LBB0_23
LBB0_3:
	xorl	%ebx, %ebx
LBB0_15:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_16
LBB0_22:
	xorl	%eax, %eax
LBB0_23:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	_RC_VARIANCE@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_18
## %bb.17:
	movq	_dnxhd_mb_var_thread@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	*(%rdi)
LBB0_18:
	movq	48(%r12), %rdi
	movl	56(%r12), %esi
	movl	36(%r12), %edx
	callq	_radix_sort
	movl	36(%r12), %ecx
	testl	%ecx, %ecx
	movl	$0, %eax
	jle	LBB0_23
## %bb.19:
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	cmpl	24(%r12), %ebx
	jle	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movq	48(%r12), %rdx
	movslq	(%rdx,%rax,8), %r8
	movl	(%r12), %esi
	movl	%esi, %edi
	imull	%ecx, %edi
	movslq	%edi, %rdi
	addq	%r8, %rdi
	movq	40(%r12), %rdx
	addl	%edi, %ecx
	movslq	%ecx, %rcx
	subl	(%rdx,%rdi,8), %ebx
	addl	(%rdx,%rcx,8), %ebx
	incl	%esi
	movq	8(%r12), %rcx
	movl	%esi, (%rcx,%r8,4)
	movslq	36(%r12), %rcx
	movslq	%edi, %rsi
	addq	%rcx, %rsi
	movl	(%rdx,%rsi,8), %ecx
	movq	16(%r12), %rdx
	movl	%ecx, (%rdx,%r8,4)
	incq	%rax
	movslq	36(%r12), %rcx
	cmpq	%rcx, %rax
	jl	LBB0_20
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_RC_VARIANCE,8,3                ## @RC_VARIANCE
	.comm	_INT_MIN,4,2                    ## @INT_MIN
	.comm	_dnxhd_mb_var_thread,4,2        ## @dnxhd_mb_var_thread
	.no_dead_strip	_dnxhd_encode_fast
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dnxhd_encode_fast
_dnxhd_encode_fast:                     ; @dnxhd_encode_fast
	.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
	mov	x0, x1
	bl	_dnxhd_find_qscale
	tbnz	w0, #31, LBB0_16
; %bb.1:
	ldr	w4, [x19, #28]
	cmp	w4, #1
	b.lt	LBB0_13
; %bb.2:
	mov	w21, #0
	mov	w8, #0
Lloh0:
	adrp	x9, _RC_VARIANCE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _RC_VARIANCE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	ldr	w12, [x19, #32]
Lloh3:
	adrp	x10, _INT_MIN@GOTPAGE
Lloh4:
	ldr	x10, [x10, _INT_MIN@GOTPAGEOFF]
	mov	w11, #100
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w4, [x19, #28]
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w21, w21, #31
	add	w8, w8, #1
	cmp	w8, w4
	b.ge	LBB0_14
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	cmp	w12, #1
	b.lt	LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x13, #0
	ldr	x14, [x19, #40]
	ldp	x15, x16, [x19, #8]
	b	LBB0_10
LBB0_7:                                 ;   in Loop: Header=BB0_10 Depth=2
	ldr	w2, [x10]
LBB0_8:                                 ;   in Loop: Header=BB0_10 Depth=2
	add	x12, x12, x17, lsl #3
	str	w2, [x12, #4]
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=2
	add	w21, w1, w21
	ldr	w12, [x19, #32]
	add	x13, x13, #1
	cmp	w13, w12
	b.ge	LBB0_3
LBB0_10:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mul	w3, w8, w12
	ldr	w1, [x19]
	ldr	w17, [x19, #36]
	mul	w4, w17, w1
	add	w17, w4, w3
	add	w2, w13, w17
	add	x17, x13, w3, sxtw
	lsl	x5, x17, #2
	str	w1, [x15, x5]
	sbfiz	x1, x2, #3, #32
	ldr	w6, [x14, x1]
	str	w6, [x16, x5]
	ldr	w1, [x14, x1]
	cbnz	x9, LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	ldr	w5, [x19, #36]
	add	w4, w5, w4
	madd	w12, w8, w12, w4
	add	w4, w13, w12
	sbfiz	x12, x4, #3, #32
	ldr	w5, [x14, x12]
	add	x3, x13, x3
	ldr	x12, [x19, #48]
	lsl	x6, x17, #3
	str	w3, [x12, x6]
	subs	w3, w1, w5
	b.eq	LBB0_7
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=2
	sxtw	x2, w2
	sxtw	x4, w4
	add	x2, x14, x2, lsl #3
	ldr	w2, [x2, #4]
	add	x4, x14, x4, lsl #3
	ldr	w4, [x4, #4]
	sub	w2, w2, w4
	mul	w2, w2, w11
	sdiv	w2, w2, w3
	b	LBB0_8
LBB0_13:
	mov	w21, #0
LBB0_14:
	cbz	w0, LBB0_17
LBB0_15:
	mov	w0, #0
LBB0_16:
	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_17:
Lloh5:
	adrp	x8, _RC_VARIANCE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _RC_VARIANCE@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cbz	x8, LBB0_19
; %bb.18:
	ldr	x8, [x20]
Lloh8:
	adrp	x9, _dnxhd_mb_var_thread@GOTPAGE
Lloh9:
	ldr	x9, [x9, _dnxhd_mb_var_thread@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x9]
	mov	x0, x20
	mov	x2, #0
	mov	x3, #0
	blr	x8
LBB0_19:
	ldr	x0, [x19, #48]
	ldr	w1, [x19, #56]
	ldr	w2, [x19, #36]
	bl	_radix_sort
	ldr	w10, [x19, #36]
	cmp	w10, #1
	b.lt	LBB0_15
; %bb.20:
	mov	x8, #0
	mov	x9, #0
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x19, #24]
	cmp	w21, w11
	b.le	LBB0_15
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=1
	ldp	x12, x11, [x19, #40]
	ldrsw	x11, [x11, x8]
	ldr	w13, [x19]
	madd	w14, w13, w10, w11
	sbfiz	x15, x14, #3, #32
	ldr	w15, [x12, x15]
	add	w10, w14, w10
	sbfiz	x10, x10, #3, #32
	ldr	w10, [x12, x10]
	add	w13, w13, #1
	lsl	x11, x11, #2
	ldp	x16, x17, [x19, #8]
	str	w13, [x16, x11]
	sub	w13, w21, w15
	add	w21, w13, w10
	ldr	w10, [x19, #36]
	add	w10, w10, w14
	sbfiz	x10, x10, #3, #32
	ldr	w10, [x12, x10]
	str	w10, [x17, x11]
	add	x9, x9, #1
	ldrsw	x10, [x19, #36]
	add	x8, x8, #8
	cmp	x9, x10
	b.lt	LBB0_21
	b	LBB0_15
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_RC_VARIANCE,8,3                ; @RC_VARIANCE
	.comm	_INT_MIN,4,2                    ; @INT_MIN
	.comm	_dnxhd_mb_var_thread,4,2        ; @dnxhd_mb_var_thread
	.no_dead_strip	_dnxhd_encode_fast
.subsections_via_symbols
